Commit 2d5662104db14f7c043d9dae26490a135aa0edf2
1 parent
db099989
工单管理详情字段翻译
Showing
4 changed files
with
57 additions
and
15 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/maininfo/MainInfoController.java
| 1 | 1 | package com.zteits.urbanops.module.workorder.controller.admin.maininfo; |
| 2 | 2 | |
| 3 | -import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |
| 4 | 3 | import com.zteits.urbanops.framework.apilog.core.annotation.ApiAccessLog; |
| 5 | 4 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 6 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 7 | 6 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 8 | 7 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 9 | 8 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 10 | -import com.zteits.urbanops.module.workorder.controller.admin.attachment.vo.AttachmentReqVO; | |
| 9 | +import com.zteits.urbanops.module.system.api.user.AdminUserApi; | |
| 10 | +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | |
| 11 | +import com.zteits.urbanops.module.system.dal.dataobject.dept.DeptDO; | |
| 12 | +import com.zteits.urbanops.module.system.service.dept.DeptService; | |
| 11 | 13 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoPageReqVO; |
| 12 | 14 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoRespVO; |
| 13 | 15 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoSaveReqVO; |
| ... | ... | @@ -28,10 +30,7 @@ import org.springframework.validation.annotation.Validated; |
| 28 | 30 | import org.springframework.web.bind.annotation.*; |
| 29 | 31 | |
| 30 | 32 | import java.io.IOException; |
| 31 | -import java.util.Arrays; | |
| 32 | -import java.util.Collections; | |
| 33 | -import java.util.List; | |
| 34 | -import java.util.Map; | |
| 33 | +import java.util.*; | |
| 35 | 34 | import java.util.stream.Collectors; |
| 36 | 35 | |
| 37 | 36 | import static com.zteits.urbanops.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| ... | ... | @@ -50,6 +49,11 @@ public class MainInfoController { |
| 50 | 49 | @Resource |
| 51 | 50 | private AttachmentService attachmentService; |
| 52 | 51 | |
| 52 | + @Resource | |
| 53 | + private DeptService deptService; | |
| 54 | + @Resource | |
| 55 | + private AdminUserApi adminUserApi; | |
| 56 | + | |
| 53 | 57 | @PostMapping("/create") |
| 54 | 58 | @Operation(summary = "创建工单信息") |
| 55 | 59 | @PreAuthorize("@ss.hasPermission('workorder:main-info:create')") |
| ... | ... | @@ -105,7 +109,16 @@ public class MainInfoController { |
| 105 | 109 | )); |
| 106 | 110 | } |
| 107 | 111 | } |
| 108 | - return success(MainInfoConvert.INSTANCE.buildMainInfo(mainInfo, attachmentMap)); | |
| 112 | + DeptDO dept = deptService.getDept(mainInfo.getCompanyId()); | |
| 113 | + Set<Long> userIds = new HashSet<>(); | |
| 114 | + if (mainInfo.getCoHandlers() != null) { | |
| 115 | + mainInfo.getCoHandlers().stream() | |
| 116 | + .filter(Objects::nonNull) // 过滤null ID | |
| 117 | + .forEach(userIds::add); | |
| 118 | + } | |
| 119 | + userIds.add(mainInfo.getUserId()); | |
| 120 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIds); | |
| 121 | + return success(MainInfoConvert.INSTANCE.buildMainInfo(mainInfo, attachmentMap, dept.getName(), userMap)); | |
| 109 | 122 | } |
| 110 | 123 | |
| 111 | 124 | @GetMapping("/page") | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/maininfo/vo/MainInfoRespVO.java
| ... | ... | @@ -137,4 +137,14 @@ public class MainInfoRespVO { |
| 137 | 137 | |
| 138 | 138 | @Schema(description = "文件名称") |
| 139 | 139 | private String fileNames; |
| 140 | + | |
| 141 | + @Schema(description = "共同处理人") | |
| 142 | + private Set<Long> coHandlers; | |
| 143 | + @Schema(description = "共同处理人名称,多个逗号拼接") | |
| 144 | + private String coHandlersName; | |
| 145 | + | |
| 146 | + @Schema(description = "单位名称") | |
| 147 | + private String companyName; | |
| 148 | + @Schema(description = "提交人电话") | |
| 149 | + private String userMobile; | |
| 140 | 150 | } | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/maininfo/MainInfoConvert.java
| ... | ... | @@ -3,6 +3,7 @@ package com.zteits.urbanops.module.workorder.convert.maininfo; |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; |
| 5 | 5 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 6 | +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | |
| 6 | 7 | import com.zteits.urbanops.module.workorder.controller.admin.maininfo.vo.MainInfoRespVO; |
| 7 | 8 | import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.AttachmentDO; |
| 8 | 9 | import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; |
| ... | ... | @@ -11,6 +12,8 @@ import org.mapstruct.factory.Mappers; |
| 11 | 12 | |
| 12 | 13 | import java.util.List; |
| 13 | 14 | import java.util.Map; |
| 15 | +import java.util.Objects; | |
| 16 | +import java.util.stream.Collectors; | |
| 14 | 17 | |
| 15 | 18 | /** |
| 16 | 19 | * @Classname MainInfoConvert |
| ... | ... | @@ -26,18 +29,34 @@ public interface MainInfoConvert { |
| 26 | 29 | default PageResult<MainInfoRespVO> buildMainInfoPage(PageResult<MainInfoDO> pageResult, Map<String, AttachmentDO> attachmentMap) { |
| 27 | 30 | List<MainInfoRespVO> mainInfoVOList = CollectionUtils.convertList(pageResult.getList(), mainInfoDO -> { |
| 28 | 31 | MainInfoRespVO mainInfoVo = BeanUtils.toBean(mainInfoDO, MainInfoRespVO.class); |
| 29 | - AttachmentDO attachmentDO = attachmentMap.get(mainInfoDO.getOrderNo()); | |
| 30 | - mainInfoVo.setFileNames(attachmentDO.getFileNames()); | |
| 32 | + if (attachmentMap != null && !attachmentMap.isEmpty()) { | |
| 33 | + AttachmentDO attachmentDO = attachmentMap.get(mainInfoDO.getOrderNo()); | |
| 34 | + mainInfoVo.setFileNames(attachmentDO.getFileNames()); | |
| 35 | + } | |
| 31 | 36 | return mainInfoVo; |
| 32 | 37 | }); |
| 33 | 38 | return new PageResult<>(mainInfoVOList, pageResult.getTotal()); |
| 34 | 39 | } |
| 35 | 40 | |
| 36 | - default MainInfoRespVO buildMainInfo(MainInfoDO mainInfoDO, Map<String, AttachmentDO> attachmentMap) { | |
| 41 | + default MainInfoRespVO buildMainInfo(MainInfoDO mainInfoDO, Map<String, AttachmentDO> attachmentMap, String deptName,Map<Long, AdminUserRespDTO> userMap) { | |
| 37 | 42 | MainInfoRespVO mainInfoVo = BeanUtils.toBean(mainInfoDO, MainInfoRespVO.class); |
| 38 | 43 | if (mainInfoDO != null) { |
| 39 | - AttachmentDO attachmentDO = attachmentMap.get(mainInfoDO.getOrderNo()); | |
| 40 | - mainInfoVo.setFileNames(attachmentDO.getFileNames()); | |
| 44 | + if (attachmentMap != null && !attachmentMap.isEmpty()) { | |
| 45 | + AttachmentDO attachmentDO = attachmentMap.get(mainInfoDO.getOrderNo()); | |
| 46 | + mainInfoVo.setFileNames(attachmentDO.getFileNames()); | |
| 47 | + } | |
| 48 | + mainInfoVo.setCompanyName(deptName); | |
| 49 | + if (mainInfoVo.getCoHandlers() != null && !mainInfoVo.getCoHandlers().isEmpty()) { | |
| 50 | + String coHandlersName = mainInfoVo.getCoHandlers() == null ? "" : mainInfoVo.getCoHandlers().stream() | |
| 51 | + .filter(userId -> userId != null) | |
| 52 | + .map(userMap::get) | |
| 53 | + .filter(Objects::nonNull) | |
| 54 | + .map(AdminUserRespDTO::getNickname) | |
| 55 | + .filter(nickname -> nickname != null && !nickname.isEmpty()) | |
| 56 | + .collect(Collectors.joining(",")); | |
| 57 | + mainInfoVo.setCoHandlersName(coHandlersName); | |
| 58 | + } | |
| 59 | + mainInfoVo.setUserMobile(userMap.get(mainInfoVo.getUserId()).getMobile()); | |
| 41 | 60 | } |
| 42 | 61 | return mainInfoVo; |
| 43 | 62 | } | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/maininfo/MainInfoDO.java
| ... | ... | @@ -18,7 +18,7 @@ import org.hibernate.validator.constraints.Length; |
| 18 | 18 | * |
| 19 | 19 | * @author 超级管理员 |
| 20 | 20 | */ |
| 21 | -@TableName("workorder_main_info") | |
| 21 | +@TableName(value = "workorder_main_info", autoResultMap = true) | |
| 22 | 22 | @KeySequence("workorder_main_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 23 | 23 | @Data |
| 24 | 24 | @EqualsAndHashCode(callSuper = true) |
| ... | ... | @@ -34,7 +34,7 @@ public class MainInfoDO extends BaseDO { |
| 34 | 34 | @TableId |
| 35 | 35 | private Long id; |
| 36 | 36 | /** |
| 37 | - * 业务线:yl 园林,wy 物业,sz 市政 | |
| 37 | + * 业务线:yl 园林,wy 物业,sz 市政 | |
| 38 | 38 | */ |
| 39 | 39 | private String busiLine; |
| 40 | 40 | /** |
| ... | ... | @@ -151,4 +151,4 @@ public class MainInfoDO extends BaseDO { |
| 151 | 151 | private Set<Long> coHandlers; |
| 152 | 152 | |
| 153 | 153 | |
| 154 | -} | |
| 155 | 154 | \ No newline at end of file |
| 155 | +} | ... | ... |