Commit d7f03be76852b1ac9de86e7e2c9885067a7b26e8
Merge remote-tracking branch 'origin/dev' into dev
Showing
7 changed files
with
133 additions
and
15 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/workorder/WorkOrderApi.java
| ... | ... | @@ -2,6 +2,8 @@ package com.zteits.urbanops.module.workorder.api.workorder; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | 4 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; |
| 5 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderReqVO; | |
| 6 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderRespVO; | |
| 5 | 7 | |
| 6 | 8 | import java.util.List; |
| 7 | 9 | |
| ... | ... | @@ -33,4 +35,11 @@ public interface WorkOrderApi { |
| 33 | 35 | * @return |
| 34 | 36 | */ |
| 35 | 37 | public List<AdminUserRespDTO> getUserByRoadIdAndRoleCode(Long roadId,String roleCode,String busiLine); |
| 38 | + | |
| 39 | + /** | |
| 40 | + * 创建工单API | |
| 41 | + * @param createRequestVo | |
| 42 | + * @return | |
| 43 | + */ | |
| 44 | + public AppGardenWorkOrderRespVO createWorkOrder(AppGardenWorkOrderReqVO createRequestVo); | |
| 36 | 45 | } | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/api/workorder/WorkOrderApiImpl.java
| 1 | 1 | package com.zteits.urbanops.module.workorder.api.workorder; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | |
| 4 | 5 | import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; |
| 5 | 6 | import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant; |
| 7 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderReqVO; | |
| 8 | +import com.zteits.urbanops.module.workorder.controller.app.garden.vo.AppGardenWorkOrderRespVO; | |
| 9 | +import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; | |
| 6 | 10 | import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper; |
| 11 | +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService; | |
| 7 | 12 | import jakarta.annotation.Resource; |
| 8 | 13 | import org.springframework.stereotype.Service; |
| 9 | 14 | import org.springframework.util.ObjectUtils; |
| ... | ... | @@ -30,6 +35,9 @@ public class WorkOrderApiImpl implements WorkOrderApi{ |
| 30 | 35 | private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
| 31 | 36 | private static final AtomicInteger counter = new AtomicInteger(1); |
| 32 | 37 | |
| 38 | + @Resource | |
| 39 | + private BpmGardenService gardenService; | |
| 40 | + | |
| 33 | 41 | @Override |
| 34 | 42 | public String generateWONum(String prefix) { |
| 35 | 43 | if (ObjectUtils.isEmpty(prefix)) { |
| ... | ... | @@ -63,4 +71,10 @@ public class WorkOrderApiImpl implements WorkOrderApi{ |
| 63 | 71 | } |
| 64 | 72 | return workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine); |
| 65 | 73 | } |
| 74 | + | |
| 75 | + @Override | |
| 76 | + public AppGardenWorkOrderRespVO createWorkOrder(AppGardenWorkOrderReqVO createRequestVo) { | |
| 77 | + BpmGardenWorkOrderDO targetVO = gardenService.getWorkOrder(gardenService.createWorkOrder(createRequestVo)); | |
| 78 | + return BeanUtils.toBean(targetVO,AppGardenWorkOrderRespVO.class); | |
| 79 | + } | |
| 66 | 80 | } | ... | ... |
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 | +} | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/FirstApprovalAutoCompleteListener.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden.listener; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * 类描述:第一次跳过审批,第二次手动审批 | |
| 5 | + * 创建人:yanhuiqing | |
| 6 | + * 创建时间:2025/12/18 20:28 | |
| 7 | + * 修改人:yanhuiqing | |
| 8 | + * 修改时间:2025/12/18 20:28 | |
| 9 | + * 修改备注: | |
| 10 | + * | |
| 11 | + * @author yanhuiqing | |
| 12 | + * @version 1.0 | |
| 13 | + */ | |
| 14 | +import org.flowable.engine.TaskService; | |
| 15 | +import org.flowable.engine.delegate.TaskListener; | |
| 16 | +import org.flowable.task.service.delegate.DelegateTask; | |
| 17 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 18 | +import org.springframework.stereotype.Component; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 初审节点自动通过监听器 | |
| 22 | + */ | |
| 23 | +@Component("firstApprovalAutoCompleteListener") // 组件名,供流程设计器调用 | |
| 24 | +public class FirstApprovalAutoCompleteListener implements TaskListener { | |
| 25 | + | |
| 26 | + // 注入Flowable的TaskService,用于完成任务 | |
| 27 | + @Autowired | |
| 28 | + private TaskService taskService; | |
| 29 | + | |
| 30 | + @Override | |
| 31 | + public void notify(DelegateTask delegateTask) { | |
| 32 | + // 1. 获取流程变量 | |
| 33 | + String starterId = (String) delegateTask.getVariable("starterId"); // 发起人ID | |
| 34 | + Boolean isFirstEnter = (Boolean) delegateTask.getVariable("isFirstEnterFirstApproval"); // 是否首次进入 | |
| 35 | + Boolean isReturned = (Boolean) delegateTask.getVariable("isReturnedToFirstApproval"); // 是否退回 | |
| 36 | + | |
| 37 | + // 2. 获取当前审批节点的审批人ID | |
| 38 | + String assigneeId = delegateTask.getAssignee(); | |
| 39 | + | |
| 40 | + // 3. 核心逻辑:首次进入 + 发起人=审批人 → 自动完成任务 | |
| 41 | + if (isFirstEnter != null && isFirstEnter | |
| 42 | + && !Boolean.TRUE.equals(isReturned) | |
| 43 | + && starterId != null && starterId.equals(assigneeId)) { | |
| 44 | + | |
| 45 | + // 标记:首次进入已处理,后续不再触发自动通过 | |
| 46 | + delegateTask.setVariable("isFirstEnterFirstApproval", false); | |
| 47 | + | |
| 48 | + // 自动完成任务(流程继续向下) | |
| 49 | + taskService.complete(delegateTask.getId()); | |
| 50 | + } | |
| 51 | + // 若为退回进入(isReturned=true),则不执行自动完成,等待手动处理 | |
| 52 | + } | |
| 53 | +} | |
| 0 | 54 | \ No newline at end of file | ... | ... |