Commit 95940001 authored by zhangfeng's avatar zhangfeng

feature-ecw-node:新增前端下拉框获取网点信息接口

parent 4dd96931
...@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*; import io.swagger.annotations.*;
...@@ -17,11 +19,13 @@ import java.util.stream.Collectors; ...@@ -17,11 +19,13 @@ import java.util.stream.Collectors;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.ecw.controller.admin.node.vo.*; import cn.iocoder.yudao.module.ecw.controller.admin.node.vo.*;
...@@ -83,6 +87,13 @@ public class NodeController { ...@@ -83,6 +87,13 @@ public class NodeController {
return success(NodeConvert.INSTANCE.convertList(list)); return success(NodeConvert.INSTANCE.convertList(list));
} }
@GetMapping("/list-all-simple")
@ApiOperation(value = "获得服务网点精简信息列表", notes = "主要用于前端的下拉选项")
public CommonResult<List<NodeSimpleRespVO>> getNodeListAllSimple() {
List<NodeDO> list = nodeService.getNodeList();
return success(NodeConvert.INSTANCE.convertListSimple(list));
}
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得服务网点分页") @ApiOperation("获得服务网点分页")
// @PreAuthorize("@ss.hasPermission('ecw:node:query')") // @PreAuthorize("@ss.hasPermission('ecw:node:query')")
...@@ -98,7 +109,7 @@ public class NodeController { ...@@ -98,7 +109,7 @@ public class NodeController {
@PreAuthorize("@ss.hasPermission('ecw:node:export')") @PreAuthorize("@ss.hasPermission('ecw:node:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportNodeExcel(@Valid NodeExportReqVO exportReqVO, public void exportNodeExcel(@Valid NodeExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<NodeDO> list = nodeService.getNodeList(exportReqVO); List<NodeDO> list = nodeService.getNodeList(exportReqVO);
matchUser(list); matchUser(list);
...@@ -113,13 +124,13 @@ public class NodeController { ...@@ -113,13 +124,13 @@ public class NodeController {
.filter(t -> t.getAdminId() != null) .filter(t -> t.getAdminId() != null)
.map(NodeDO::getAdminId) .map(NodeDO::getAdminId)
.collect(Collectors.toList()); .collect(Collectors.toList());
if(CollectionUtil.isEmpty(userIdList)) return; if (CollectionUtil.isEmpty(userIdList)) return;
List<AdminUserRespDTO> userList = adminUserApi.getUsers(userIdList); List<AdminUserRespDTO> userList = adminUserApi.getUsers(userIdList);
Map<Long, String> userNameMap = userList.stream() Map<Long, String> userNameMap = userList.stream()
.collect(Collectors.toMap(AdminUserRespDTO::getId, AdminUserRespDTO::getNickname, (v1,v2)->v2)); .collect(Collectors.toMap(AdminUserRespDTO::getId, AdminUserRespDTO::getNickname, (v1, v2) -> v2));
nodeList.forEach(t -> { nodeList.forEach(t -> {
Long adminId = t.getAdminId(); Long adminId = t.getAdminId();
if(adminId != null && userNameMap.containsKey(adminId)) { if (adminId != null && userNameMap.containsKey(adminId)) {
t.setAdminName(userNameMap.get(adminId)); t.setAdminName(userNameMap.get(adminId));
} }
}); });
......
package cn.iocoder.yudao.module.ecw.controller.admin.node.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
@ApiModel("网点精简信息 Response VO")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class NodeSimpleRespVO {
@ApiModelProperty(value = "", required = true)
private Long id;
@ApiModelProperty(value = "中文标题")
private String titleZh;
@ApiModelProperty(value = "英文标题")
private String titleEn;
}
...@@ -27,6 +27,8 @@ public interface NodeConvert { ...@@ -27,6 +27,8 @@ public interface NodeConvert {
List<NodeRespVO> convertList(List<NodeDO> list); List<NodeRespVO> convertList(List<NodeDO> list);
List<NodeSimpleRespVO> convertListSimple(List<NodeDO> list);
PageResult<NodeRespVO> convertPage(PageResult<NodeDO> page); PageResult<NodeRespVO> convertPage(PageResult<NodeDO> page);
List<NodeExcelVO> convertList02(List<NodeDO> list); List<NodeExcelVO> convertList02(List<NodeDO> list);
......
...@@ -51,6 +51,13 @@ public interface NodeService { ...@@ -51,6 +51,13 @@ public interface NodeService {
*/ */
List<NodeDO> getNodeList(Collection<Long> ids); List<NodeDO> getNodeList(Collection<Long> ids);
/**
* 获得服务网点列表
*
* @return 所有服务网点列表
*/
List<NodeDO> getNodeList();
/** /**
* 获得服务网点分页 * 获得服务网点分页
* *
......
...@@ -71,6 +71,11 @@ public class NodeServiceImpl implements NodeService { ...@@ -71,6 +71,11 @@ public class NodeServiceImpl implements NodeService {
return nodeMapper.selectBatchIds(ids); return nodeMapper.selectBatchIds(ids);
} }
@Override
public List<NodeDO> getNodeList() {
return nodeMapper.selectList();
}
@Override @Override
public PageResult<NodeDO> getNodePage(NodePageReqVO pageReqVO) { public PageResult<NodeDO> getNodePage(NodePageReqVO pageReqVO) {
return nodeMapper.selectPage(pageReqVO); return nodeMapper.selectPage(pageReqVO);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment