Commit da5f3ae0e9d77444e28ddaf6f30c37d0a49700fe
1 parent
3db8d6b6
APP端工作流 候选人 el表达式表单编写
Showing
8 changed files
with
123 additions
and
8 deletions
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/admin/maininfo/vo/MainInfoHasTaskPageReqVO.java
| ... | ... | @@ -49,4 +49,7 @@ public class MainInfoHasTaskPageReqVO extends PageParam { |
| 49 | 49 | private String streetName; |
| 50 | 50 | @Schema(description = "养护级别ID", example = "1") |
| 51 | 51 | private Integer curingLevelId; |
| 52 | + | |
| 53 | + @Schema(description = "任务编号", example = "1") | |
| 54 | + private String taskId; | |
| 52 | 55 | } |
| 53 | 56 | \ No newline at end of file | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/AppGardenWorkOrderRespVO.java
| ... | ... | @@ -29,6 +29,9 @@ public class AppGardenWorkOrderRespVO extends MainInfoRespVO { |
| 29 | 29 | @Schema(description = "任务名称") |
| 30 | 30 | private String taskName; |
| 31 | 31 | |
| 32 | + @Schema(description = "任务key") | |
| 33 | + private String taskKey; | |
| 34 | + | |
| 32 | 35 | @Schema(description = "流程定义名称") |
| 33 | 36 | private String processDefinitionName; |
| 34 | 37 | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskApproveReqVO.java
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/controller/app/garden/vo/task/AppGardenTaskReturnReqVO.java
| ... | ... | @@ -4,6 +4,8 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import jakarta.validation.constraints.NotEmpty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 7 | 9 | /** |
| 8 | 10 | * 类描述:园林APP端退回 reqVO |
| 9 | 11 | * 创建人:yanhuiqing |
| ... | ... | @@ -24,11 +26,22 @@ public class AppGardenTaskReturnReqVO { |
| 24 | 26 | @NotEmpty(message = "任务编号不能为空") |
| 25 | 27 | private String id; |
| 26 | 28 | |
| 27 | - @Schema(description = "退回到的任务 Key", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 29 | + /*@Schema(description = "退回到的任务 Key", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 28 | 30 | @NotEmpty(message = "退回到的任务 Key 不能为空") |
| 29 | - private String targetTaskDefinitionKey; | |
| 31 | + private String targetTaskDefinitionKey;*/ | |
| 30 | 32 | |
| 31 | 33 | @Schema(description = "退回意见", requiredMode = Schema.RequiredMode.REQUIRED, example = "我就是想驳回") |
| 32 | 34 | @NotEmpty(message = "退回意见不能为空") |
| 33 | 35 | private String reason; |
| 36 | + | |
| 37 | + @Schema(description = "当前任务的taksKey", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 38 | + @NotEmpty(message = "当前任务的taksKey不能为空") | |
| 39 | + private String curTaskKey; | |
| 40 | + | |
| 41 | + @Schema(description = "工单的数据id", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 42 | + @NotEmpty(message = "工单的数据id不能为空") | |
| 43 | + private Long workerDataId; | |
| 44 | + | |
| 45 | + @Schema(description = "退回时的拍照图片") | |
| 46 | + private List<String> returnImgs; | |
| 34 | 47 | } |
| 35 | 48 | \ No newline at end of file | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/dataobject/maininfo/MainInfoExtDO.java
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/dal/mysql/maininfo/MainInfoExtMapper.java
| ... | ... | @@ -37,6 +37,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 37 | 37 | " m.*,", |
| 38 | 38 | " t.ID_ AS task_id,", |
| 39 | 39 | " t.NAME_ AS task_name,", |
| 40 | + " t.task_def_key_ as task_key,", | |
| 40 | 41 | " pd.NAME_ AS process_definition_name,", |
| 41 | 42 | " t.START_TIME_,", |
| 42 | 43 | " t.END_TIME_,", |
| ... | ... | @@ -80,6 +81,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 80 | 81 | " <if test='query.curingLevelId != null'>", |
| 81 | 82 | " AND m.curing_level_id = #{query.curingLevelId}", |
| 82 | 83 | " </if>", |
| 84 | + " <if test='query.taskId != null'>", | |
| 85 | + " AND t.id = #{query.taskId}", | |
| 86 | + " </if>", | |
| 83 | 87 | "ORDER BY t.END_TIME_ DESC", |
| 84 | 88 | "</script>" |
| 85 | 89 | }) |
| ... | ... | @@ -121,6 +125,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 121 | 125 | |
| 122 | 126 | @Result(column = "task_id", property = "taskId"), |
| 123 | 127 | @Result(column = "task_name", property = "taskName"), |
| 128 | + @Result(column = "task_key", property = "taskKey"), | |
| 124 | 129 | @Result(column = "process_definition_name", property = "processDefinitionName"), |
| 125 | 130 | @Result(column = "START_TIME_", property = "startTime"), |
| 126 | 131 | @Result(column = "END_TIME_", property = "endTime"), |
| ... | ... | @@ -140,6 +145,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 140 | 145 | " m.*,", |
| 141 | 146 | " t.ID_ AS task_id,", |
| 142 | 147 | " t.NAME_ AS task_name,", |
| 148 | + " t.task_def_key_ as task_key,", | |
| 143 | 149 | " pd.NAME_ AS process_definition_name,", |
| 144 | 150 | " t.CREATE_TIME_ AS START_TIME_,", |
| 145 | 151 | " t.DUE_DATE_ AS END_TIME_,", |
| ... | ... | @@ -180,6 +186,9 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 180 | 186 | " <if test='query.curingLevelId != null'>", |
| 181 | 187 | " AND m.curing_level_id = #{query.curingLevelId}", |
| 182 | 188 | " </if>", |
| 189 | + " <if test='query.taskId != null'>", | |
| 190 | + " AND t.id = #{query.taskId}", | |
| 191 | + " </if>", | |
| 183 | 192 | "ORDER BY t.CREATE_TIME_ DESC", |
| 184 | 193 | "</script>" |
| 185 | 194 | }) |
| ... | ... | @@ -221,6 +230,7 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 221 | 230 | |
| 222 | 231 | @Result(column = "task_id", property = "taskId"), |
| 223 | 232 | @Result(column = "task_name", property = "taskName"), |
| 233 | + @Result(column = "task_key", property = "taskKey"), | |
| 224 | 234 | @Result(column = "process_definition_name", property = "processDefinitionName"), |
| 225 | 235 | @Result(column = "START_TIME_", property = "startTime"), |
| 226 | 236 | @Result(column = "END_TIME_", property = "endTime"), |
| ... | ... | @@ -271,6 +281,10 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 271 | 281 | " <if test='notHas'>", |
| 272 | 282 | " AND su.id <> #{loginUserId}", |
| 273 | 283 | " </if>", |
| 284 | + " and sr.deleted='0'", | |
| 285 | + " and su.deleted='0'", | |
| 286 | + " and sur.deleted='0'", | |
| 287 | + " and sr.deleted='0'", | |
| 274 | 288 | "</script>" |
| 275 | 289 | }) |
| 276 | 290 | @Results({ |
| ... | ... | @@ -311,6 +325,11 @@ public interface MainInfoExtMapper extends BaseMapperX<MainInfoDO> { |
| 311 | 325 | " FIND_IN_SET(#{busiLine}, REPLACE(su.busi_line, ' ', '')) > 0", |
| 312 | 326 | " AND gr.id = #{roadId}", |
| 313 | 327 | " AND sr.code = #{roleCode}", |
| 328 | + " and gr.deleted='0'", | |
| 329 | + " and sd.deleted='0'", | |
| 330 | + " and su.deleted='0'", | |
| 331 | + " and sur.deleted='0'", | |
| 332 | + " and sr.deleted='0'", | |
| 314 | 333 | "</script>" |
| 315 | 334 | }) |
| 316 | 335 | @Results({ | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
| ... | ... | @@ -177,6 +177,9 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 177 | 177 | Map<String, Object> variables = new HashMap<>(); |
| 178 | 178 | //审批通过 |
| 179 | 179 | variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_STATUS,BpmTaskStatusEnum.APPROVE.getStatus()); |
| 180 | + if(ObjectUtils.isNotAllEmpty(reqVO.getNextAssignee())){ | |
| 181 | + variables.put("ylWorkerId",reqVO.getNextAssignee()); | |
| 182 | + } | |
| 180 | 183 | targetVO.setVariables(variables); |
| 181 | 184 | //TODO 审批候选人需要赋值 |
| 182 | 185 | Map<String, List<Long>> nextAssignees = new HashMap<>(); |
| ... | ... | @@ -245,6 +248,8 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 245 | 248 | } |
| 246 | 249 | } |
| 247 | 250 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); |
| 251 | + //TODO 先写死 | |
| 252 | + taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); | |
| 248 | 253 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderDonePage(pageVO,taskBuzReqVO); |
| 249 | 254 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); |
| 250 | 255 | } |
| ... | ... | @@ -277,6 +282,8 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 277 | 282 | } |
| 278 | 283 | } |
| 279 | 284 | taskBuzReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId()); |
| 285 | + //TODO 先写死 | |
| 286 | + taskBuzReqVO.setKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO); | |
| 280 | 287 | PageResult<MainInfoExtDO> pageResult = workOrderExtMapper.selectWorkOrderTodoPage(pageVO,taskBuzReqVO); |
| 281 | 288 | |
| 282 | 289 | return AppGardenTaskConvert.INSTANCE.buildBuziTaskPage(pageResult,attachmentMapper); |
| ... | ... | @@ -335,7 +342,7 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 335 | 342 | List<String> longRangeImgList = createRequestVo.getLongRangeImgList(); |
| 336 | 343 | |
| 337 | 344 | MainInfoDO workOrder = BeanUtils.toBean(createRequestVo, MainInfoDO.class) |
| 338 | - .setStatus(BpmTaskStatusEnum.NOT_START.getStatus()); | |
| 345 | + .setStatus(BpmTaskStatusEnum.RUNNING.getStatus()); | |
| 339 | 346 | RoadStreetRespDTO roadStreetRespDTO = roadApi.getRoadInfoById(createRequestVo.getRoadId()); |
| 340 | 347 | workOrder.setStreetId(roadStreetRespDTO.getStreetId()); |
| 341 | 348 | workOrder.setStreetName(roadStreetRespDTO.getStreetName()); |
| ... | ... | @@ -355,10 +362,8 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 355 | 362 | // 发起 BPM 流程 |
| 356 | 363 | Long userId = SecurityFrameworkUtils.getLoginUserId(); |
| 357 | 364 | Map<String, Object> processInstanceVariables = new HashMap<>(); |
| 358 | - processInstanceVariables.put("workOrder", workOrder); | |
| 359 | - processInstanceVariables.put("imgList", imgList); | |
| 360 | - processInstanceVariables.put("longRangeImgList", longRangeImgList); | |
| 361 | - processInstanceVariables.put("initiator", userId); | |
| 365 | + processInstanceVariables.put("roadId", workOrder.getRoadId()); | |
| 366 | + processInstanceVariables.put("applyUserId", userId); | |
| 362 | 367 | Map<String, List<Long>> startUserSelectAssignees = new HashMap<>(); |
| 363 | 368 | List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(workOrder.getRoadId(),BpmCommonConstant.TEAM_LEADER_YL,createRequestVo.getBusiLine()); |
| 364 | 369 | if(org.springframework.util.ObjectUtils.isEmpty(userList)){ |
| ... | ... | @@ -370,7 +375,8 @@ public class BpmGardenServiceImpl implements BpmGardenService{ |
| 370 | 375 | .map(AdminUserRespDTO::getId) |
| 371 | 376 | // 收集结果到List |
| 372 | 377 | .collect(Collectors.toList()); |
| 373 | - startUserSelectAssignees.put("",idList); | |
| 378 | + //startUserSelectAssignees.put("",idList); | |
| 379 | + processInstanceVariables.put("ylTeamLeaderId", idList.get(0)); | |
| 374 | 380 | String processInstanceId = processInstanceApi.createProcessInstance(userId, |
| 375 | 381 | new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(BpmCommonConstant.BPM_GARDEN_INSPECT_WO) |
| 376 | 382 | .setVariables(processInstanceVariables).setBusinessKey(String.valueOf(workOrder.getId())) | ... | ... |
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/el/YlTaskAssignService.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.workorder.service.garden.el; | |
| 2 | + | |
| 3 | +import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | |
| 4 | +import com.zteits.urbanops.module.system.api.user.dto.AdminUserRespDTO; | |
| 5 | +import com.zteits.urbanops.module.workorder.dal.mysql.maininfo.MainInfoExtMapper; | |
| 6 | +import jakarta.annotation.Resource; | |
| 7 | +import org.apache.ibatis.annotations.Param; | |
| 8 | +import org.springframework.lang.NonNull; | |
| 9 | +import org.springframework.stereotype.Component; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 14 | +import static com.zteits.urbanops.module.workorder.enums.ErrorCodeConstants.TEAM_LEADER_YL_NOT_EXISTS; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * 类描述:园林流程用户任务表单数据service | |
| 18 | + * 创建人:yanhuiqing | |
| 19 | + * 创建时间:2025/12/17 15:41 | |
| 20 | + * 修改人:yanhuiqing | |
| 21 | + * 修改时间:2025/12/17 15:41 | |
| 22 | + * 修改备注: | |
| 23 | + * | |
| 24 | + * @author yanhuiqing | |
| 25 | + * @version 1.0 | |
| 26 | + */ | |
| 27 | +@Component("ylTaskAssignService") // Bean名称,需与表达式中一致 | |
| 28 | +public class YlTaskAssignService { | |
| 29 | + | |
| 30 | + @Resource | |
| 31 | + private MainInfoExtMapper workOrderExtMapper; | |
| 32 | + public Long getInitiatorApproverByBusiness(Long roadId,String roleCode,String busiLine) { | |
| 33 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByRoadIdAndRoleCode(roadId,roleCode,busiLine); | |
| 34 | + if(null != userList && userList.size() > 0){ | |
| 35 | + return userList.get(0).getId(); | |
| 36 | + } | |
| 37 | + throw exception(TEAM_LEADER_YL_NOT_EXISTS); | |
| 38 | + } | |
| 39 | + | |
| 40 | + public List<String> getYlWorkerIdsByTeamLeader(String roleCode,String busiLine) { | |
| 41 | + Long userId = SecurityFrameworkUtils.getLoginUserId(); | |
| 42 | + // 业务逻辑:查养护组长下属的养护员,或根据业务类型查共同处理人 | |
| 43 | + List<AdminUserRespDTO> userList = workOrderExtMapper.getUserByLoginIdAndRoleCode(userId,roleCode,busiLine,true); | |
| 44 | + return null; | |
| 45 | + } | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * 场景3:复用养护组长ID(供验收节点使用) | |
| 49 | + * @param ylTeamLeaderId 养护组长ID | |
| 50 | + * @return 养护组长ID(直接返回,或查其上级) | |
| 51 | + */ | |
| 52 | + public String getTeamLeaderConfirmId(String ylTeamLeaderId) { | |
| 53 | + return ylTeamLeaderId; // 验收节点直接用之前指定的养护组长ID | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 场景4:复用巡查员ID(供验收节点使用) | |
| 58 | + * @param applyUserId 巡查员ID | |
| 59 | + * @return 巡查员ID | |
| 60 | + */ | |
| 61 | + public String getInspectorConfirmId(String applyUserId) { | |
| 62 | + return applyUserId; // 验收节点用发起的巡查员ID | |
| 63 | + } | |
| 64 | +} | |
| 0 | 65 | \ No newline at end of file | ... | ... |