Commit f2281c35ba94a097db928d9488032f7aebbe974e

Authored by 颜惠青
1 parent 598c9fe4

全域巡查员流程 和业务线变动改造

urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/garden/AppGardenTaskConvert.java
@@ -19,6 +19,7 @@ import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.Attachment @@ -19,6 +19,7 @@ import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.Attachment
19 import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO; 19 import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoExtDO;
20 import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper; 20 import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper;
21 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO; 21 import com.zteits.urbanops.module.workorder.dto.AppGardenWorkOrderRespVO;
  22 +import jodd.util.StringUtil;
22 import org.flowable.engine.history.HistoricProcessInstance; 23 import org.flowable.engine.history.HistoricProcessInstance;
23 import org.flowable.engine.runtime.ProcessInstance; 24 import org.flowable.engine.runtime.ProcessInstance;
24 import org.flowable.task.api.Task; 25 import org.flowable.task.api.Task;
@@ -201,9 +202,11 @@ public interface AppGardenTaskConvert { @@ -201,9 +202,11 @@ public interface AppGardenTaskConvert {
201 default List<String> queryAttachment(String busiLine, String busiType, String orderNo, AttachmentMapper attachmentMapper) { 202 default List<String> queryAttachment(String busiLine, String busiType, String orderNo, AttachmentMapper attachmentMapper) {
202 203
203 LambdaQueryWrapper<AttachmentDO> queryWrapper = new LambdaQueryWrapper<AttachmentDO>() 204 LambdaQueryWrapper<AttachmentDO> queryWrapper = new LambdaQueryWrapper<AttachmentDO>()
204 - .eq(AttachmentDO::getBusiLine, busiLine)  
205 .eq(AttachmentDO::getBusiType, busiType) 205 .eq(AttachmentDO::getBusiType, busiType)
206 .eq(AttachmentDO::getOrderNo, orderNo); 206 .eq(AttachmentDO::getOrderNo, orderNo);
  207 + if(StringUtil.isNotEmpty(busiLine)){// 全域巡查员 发起的工单 业务线有可能为空
  208 + queryWrapper.eq(AttachmentDO::getBusiLine, busiLine);
  209 + }
207 List<AttachmentDO> attachments = attachmentMapper.selectList(queryWrapper); 210 List<AttachmentDO> attachments = attachmentMapper.selectList(queryWrapper);
208 if (attachments == null || attachments.isEmpty()) { 211 if (attachments == null || attachments.isEmpty()) {
209 return List.of(); 212 return List.of();
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/convert/garden/BpmGardenWorkOrderConverter.java
@@ -7,6 +7,7 @@ import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.Attachment @@ -7,6 +7,7 @@ import com.zteits.urbanops.module.workorder.dal.dataobject.attachment.Attachment
7 import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO; 7 import com.zteits.urbanops.module.workorder.dal.dataobject.garden.BpmGardenWorkOrderDO;
8 import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO; 8 import com.zteits.urbanops.module.workorder.dal.dataobject.maininfo.MainInfoDO;
9 import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper; 9 import com.zteits.urbanops.module.workorder.dal.mysql.attachment.AttachmentMapper;
  10 +import jodd.util.StringUtil;
10 import org.springframework.beans.BeanUtils; 11 import org.springframework.beans.BeanUtils;
11 12
12 import java.util.Arrays; 13 import java.util.Arrays;
@@ -104,9 +105,11 @@ public class BpmGardenWorkOrderConverter { @@ -104,9 +105,11 @@ public class BpmGardenWorkOrderConverter {
104 private List<String> queryAttachment(String busiLine, String busiType, String orderNo, AttachmentMapper attachmentMapper) { 105 private List<String> queryAttachment(String busiLine, String busiType, String orderNo, AttachmentMapper attachmentMapper) {
105 106
106 LambdaQueryWrapper<AttachmentDO> queryWrapper = new LambdaQueryWrapper<AttachmentDO>() 107 LambdaQueryWrapper<AttachmentDO> queryWrapper = new LambdaQueryWrapper<AttachmentDO>()
107 - .eq(AttachmentDO::getBusiLine, busiLine)  
108 .eq(AttachmentDO::getBusiType, busiType) 108 .eq(AttachmentDO::getBusiType, busiType)
109 .eq(AttachmentDO::getOrderNo, orderNo); 109 .eq(AttachmentDO::getOrderNo, orderNo);
  110 + if(StringUtil.isNotEmpty(busiLine)){// 全域巡查员 发起的工单 业务线有可能为空
  111 + queryWrapper.eq(AttachmentDO::getBusiLine, busiLine);
  112 + }
110 List<AttachmentDO> attachments = attachmentMapper.selectList(queryWrapper); 113 List<AttachmentDO> attachments = attachmentMapper.selectList(queryWrapper);
111 if (attachments == null || attachments.isEmpty()) { 114 if (attachments == null || attachments.isEmpty()) {
112 return List.of(); 115 return List.of();
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/BpmGardenServiceImpl.java
@@ -653,7 +653,9 @@ public class BpmGardenServiceImpl implements BpmGardenService{ @@ -653,7 +653,9 @@ public class BpmGardenServiceImpl implements BpmGardenService{
653 public void attachmentInsertOrUpdate(List<String> imgList,String type,MainInfoDO workOrder){ 653 public void attachmentInsertOrUpdate(List<String> imgList,String type,MainInfoDO workOrder){
654 if(ObjectUtils.isNotAllEmpty(imgList)){ 654 if(ObjectUtils.isNotAllEmpty(imgList)){
655 AttachmentDO saveDO = new AttachmentDO(); 655 AttachmentDO saveDO = new AttachmentDO();
656 - saveDO.setBusiLine(workOrder.getBusiLine()); 656 + if(StringUtil.isNotEmpty(workOrder.getBusiLine())){// 全域巡查员 发起的工单 业务线有可能为空
  657 + saveDO.setBusiLine(workOrder.getBusiLine());
  658 + }
657 saveDO.setBusiType(type); 659 saveDO.setBusiType(type);
658 if(StringUtil.isEmpty(workOrder.getOrderNo())){ 660 if(StringUtil.isEmpty(workOrder.getOrderNo())){
659 throw exception(APP_WORK_ORADER_NO_NOT_EXISTS); 661 throw exception(APP_WORK_ORADER_NO_NOT_EXISTS);
@@ -662,9 +664,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{ @@ -662,9 +664,11 @@ public class BpmGardenServiceImpl implements BpmGardenService{
662 String filePaths = String.join(",",imgList); 664 String filePaths = String.join(",",imgList);
663 saveDO.setFileNames(filePaths); 665 saveDO.setFileNames(filePaths);
664 LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>() 666 LambdaQueryWrapper<AttachmentDO> deleteWrapper = new LambdaQueryWrapper<AttachmentDO>()
665 - .eq(AttachmentDO::getBusiLine, workOrder.getBusiLine())  
666 .eq(AttachmentDO::getBusiType, type) 667 .eq(AttachmentDO::getBusiType, type)
667 .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo()); 668 .eq(AttachmentDO::getOrderNo, workOrder.getOrderNo());
  669 + if(StringUtil.isNotEmpty(workOrder.getBusiLine())){// 全域巡查员 发起的工单 业务线有可能为空
  670 + deleteWrapper.eq(AttachmentDO::getBusiLine, workOrder.getBusiLine());
  671 + }
668 attachmentMapper.delete(deleteWrapper); 672 attachmentMapper.delete(deleteWrapper);
669 attachmentMapper.insert(saveDO); 673 attachmentMapper.insert(saveDO);
670 } 674 }
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BpmProcessTaskAutoCompleteAIListener.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden.listener;
  2 +
  3 +import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEvent;
  4 +import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEventListener;
  5 +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  6 +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService;
  7 +import jakarta.annotation.Resource;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +/**
  12 + * @author yanhuiqing
  13 + * @version 1.0
  14 + * @description: 处理流程的任务自动完成监听器
  15 + * @date 2025/12/6 14:00
  16 + */
  17 +@Component
  18 +@Slf4j
  19 +public class BpmProcessTaskAutoCompleteAIListener extends BpmProcessInstanceStatusEventListener {
  20 + @Resource
  21 + private BpmGardenService gardenService;
  22 + @Override
  23 + protected String getProcessDefinitionKey() {
  24 +
  25 + //return BpmCommonConstant.BPM_GARDEN_INSPECT_WO;
  26 + return BpmCommonConstant.BPM_AI_WO;
  27 + }
  28 +
  29 + @Override
  30 + protected void onEvent(BpmProcessInstanceStatusEvent event) {
  31 + log.info("业务ID:"+event.getBusinessKey()+",业务状态"+event.getStatus());
  32 + gardenService.updateWorkOrderStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
  33 +
  34 + }
  35 +}
urbanops-module-workorder/src/main/java/com/zteits/urbanops/module/workorder/service/garden/listener/BpmProcessTaskAutoCompleteInspectorListener.java 0 → 100644
  1 +package com.zteits.urbanops.module.workorder.service.garden.listener;
  2 +
  3 +import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEvent;
  4 +import com.zteits.urbanops.module.bpm.api.event.BpmProcessInstanceStatusEventListener;
  5 +import com.zteits.urbanops.module.workorder.api.constant.BpmCommonConstant;
  6 +import com.zteits.urbanops.module.workorder.service.garden.BpmGardenService;
  7 +import jakarta.annotation.Resource;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.springframework.stereotype.Component;
  10 +
  11 +/**
  12 + * @author yanhuiqing
  13 + * @version 1.0
  14 + * @description: 处理流程的任务自动完成监听器
  15 + * @date 2025/12/6 14:00
  16 + */
  17 +@Component
  18 +@Slf4j
  19 +public class BpmProcessTaskAutoCompleteInspectorListener extends BpmProcessInstanceStatusEventListener {
  20 + @Resource
  21 + private BpmGardenService gardenService;
  22 + @Override
  23 + protected String getProcessDefinitionKey() {
  24 +
  25 + //return BpmCommonConstant.BPM_GARDEN_INSPECT_WO;
  26 + return BpmCommonConstant.BPM_UNIVERSE_INSPECTOR_WO;
  27 + }
  28 +
  29 + @Override
  30 + protected void onEvent(BpmProcessInstanceStatusEvent event) {
  31 + log.info("业务ID:"+event.getBusinessKey()+",业务状态"+event.getStatus());
  32 + gardenService.updateWorkOrderStatus(Long.parseLong(event.getBusinessKey()), event.getStatus());
  33 +
  34 + }
  35 +}