From 0ed2995fbd51293095e78b6c55055d6f7794f992 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 09 四月 2025 16:30:15 +0800 Subject: [PATCH] 修改指派程序至设备,点检工单流程与异常报修,修改flow已办查询 --- lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java | 7 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml | 81 +++++---- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java | 8 + lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java | 5 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java | 7 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java | 13 + lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java | 251 +++++++++++++++++++++---------- lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java | 2 lxzn-module-flowable/pom.xml | 5 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java | 4 lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java | 52 +++-- 11 files changed, 280 insertions(+), 155 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java index 34d3494..49e51e3 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/AssignFileStreamServiceImpl.java @@ -1,6 +1,7 @@ package org.jeecg.modules.dncFlow.service.impl; import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -8,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.flowable.engine.TaskService; @@ -36,6 +36,7 @@ import org.jeecg.modules.dncFlow.service.IToEquipmentTaskService; import org.jeecg.modules.dncFlow.vo.AssignFlowTaskVo; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; +import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; import org.jeecg.modules.flowable.apithird.service.FlowCommonService; import org.jeecg.modules.flowable.domain.vo.FlowTaskVo; @@ -105,6 +106,8 @@ private IFlowTaskService flowTaskService; @Autowired private IDeviceTypeService deviceTypeService; + @Autowired + private IFlowMyBusinessService flowMyBusinessService; @Value("${securedoc.whether}") private String whether; @@ -289,6 +292,30 @@ //flowable澶勭悊 FlowTaskVo flowTaskVo = new FlowTaskVo(); BeanUtils.copyProperties(assignFlowTaskVo, flowTaskVo); + + List<FlowMyBusiness> businessList = flowMyBusinessService.list( + new QueryWrapper<FlowMyBusiness>() + .eq("process_instance_id", assignFlowTaskVo.getInstanceId()) + ); + if (businessList.isEmpty()) { + return false; + } + FlowMyBusiness flowMyBusiness = businessList.get(0); + List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); + if (todoUsers == null || !todoUsers.contains(user.getUsername())) { + return false; + } + + // 4. 璁ら浠诲姟锛堝鐞嗗凡琚棰嗙殑鎯呭喌锛� + String taskId = flowMyBusiness.getTaskId(); + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (task == null) { + return false; + } + if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { + return false; + } + taskService.claim(taskId, user.getUsername()); Map<String, Object> values=new HashMap<>(); values.put("dataId", assignFlowTaskVo.getDataId()); flowTaskVo.setTaskId(assignFlowTaskVo.getTaskId()); @@ -407,14 +434,6 @@ List<TaskRequest> list = approveBatchRequest.getTaskArr(); if(list == null || list.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); -// list.forEach(item -> { -// AssignFileStream stream = new AssignFileStream(); -// stream.setApproveContent(approveBatchRequest.getApproveContent()); -// stream.setStatus(approveBatchRequest.getStatus()); -// boolean b = approveAssignFile(item.getId(), item.getBusinessKey(), stream); -// if(!b) -// ExceptionCast.cast(ActivitiCode.ACT_APPROVE_ERROR); -// }); return synchronizedFlagService.updateFlag(1); } @@ -651,19 +670,6 @@ } } - //寮�濮嬪伐浣滄祦 -// private ProcessInstance startProcessInstance(AssignFileStream stream, List<String> userIdList) { -// String approveUsers = String.join(",", userIdList); -// Map<String, Object> avariableMap = new HashMap<>(); -// avariableMap.put(APPLY_VARIABLE, stream.getApplyUserId()); -// avariableMap.put(APPROVE_VARIABLE, approveUsers); -// ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_KEY, stream.getStreamId(), avariableMap); -// if (processInstance == null) { -// ExceptionCast.cast(ActivitiCode.ACT_APPROVE_USERS_NONE); -// } -// return processInstance; -// } - //鎷惧彇浠诲姟 private void completeTask(ProcessInstance processInstance, String userId) { Task task = taskService.createTaskQuery().processDefinitionKey(PROCESS_KEY).taskAssignee(userId) @@ -771,6 +777,6 @@ @Override public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { - return Lists.newArrayList("jeecg"); + return null; } } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java index 563f2f9..bb2358a 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrder.java @@ -16,6 +16,7 @@ import java.io.Serializable; import java.util.Date; +import java.util.List; /** * @Description: 鐐规宸ュ崟 @@ -133,4 +134,16 @@ /**璁惧缂栧彿*/ @ApiModelProperty(value = "璁惧缂栧彿") private transient String equipmentCode; + + /**鍒楄〃 淇濆吇椤规槑缁�*/ + @ApiModelProperty(value = "鍒楄〃 淇濆吇椤规槑缁�") + private transient List<EamInspectionOrderDetail> tableDetailList; + + /**澶勭悊绫诲瀷*/ + @ApiModelProperty(value = "澶勭悊绫诲瀷") + private transient String dealType; + + /**澶勭悊鎰忚*/ + @ApiModelProperty(value = "澶勭悊鎰忚") + private transient String dealSuggestion; } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java index 06b9397..1759b3a 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/EamInspectionOrderDetail.java @@ -73,6 +73,6 @@ private String itemName; /**淇濆吇瑕佹眰*/ @ApiModelProperty(value = "淇濆吇瑕佹眰") - private String itemDemand; + private String itemDemand; } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java index 3eb586f..691f2b2 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamInspectionOrderRequest.java @@ -123,4 +123,12 @@ /**鍒楄〃 淇濆吇椤规槑缁�*/ @ApiModelProperty(value = "鍒楄〃 淇濆吇椤规槑缁�") private List<EamInspectionOrderDetail> tableDetailList; + + /**澶勭悊绫诲瀷*/ + @ApiModelProperty(value = "澶勭悊绫诲瀷") + private String dealType; + + /**澶勭悊鎰忚*/ + @ApiModelProperty(value = "澶勭悊鎰忚") + private String dealSuggestion; } diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java index b26567c..a9ac0fc 100644 --- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java +++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java @@ -9,16 +9,14 @@ import org.flowable.engine.TaskService; import org.flowable.task.api.Task; import org.jeecg.common.api.vo.Result; +import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.eam.constant.InspectionStatus; -import org.jeecg.modules.eam.entity.EamEquipment; -import org.jeecg.modules.eam.entity.EamInspectionOrder; -import org.jeecg.modules.eam.entity.EamInspectionOrderDetail; +import org.jeecg.modules.eam.constant.ReportRepairEnum; +import org.jeecg.modules.eam.entity.*; import org.jeecg.modules.eam.mapper.EamInspectionOrderMapper; import org.jeecg.modules.eam.request.EamInspectionOrderRequest; -import org.jeecg.modules.eam.service.IEamEquipmentService; -import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService; -import org.jeecg.modules.eam.service.IEamInspectionOrderService; +import org.jeecg.modules.eam.service.*; import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; @@ -62,6 +60,11 @@ private IEamEquipmentService iEamEquipmentService; @Autowired private IMdcUserProductionService mdcUserProductionService; + @Autowired + private IEamReportRepairService eamReportRepairService; + @Autowired + private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService; + @Override @Transactional(rollbackFor = Exception.class) public boolean addInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { @@ -125,6 +128,9 @@ public boolean editInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { EamInspectionOrder eamInspectionOrder = new EamInspectionOrder(); BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder); + if (StrUtil.isNotEmpty(eamInspectionOrder.getOperator())){ + eamInspectionOrder.setInspectionStatus(InspectionStatus.IN_PROGRESS.getCode()); + } updateById(eamInspectionOrder); //澶勭悊鏄庣粏鏁版嵁 if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) { @@ -181,100 +187,57 @@ * @return */ @Override - @Transactional - public Result<?> inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest){ + public Result<?> inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest) { try { - // 鍙傛暟鏍¢獙 - if (!StrUtil.isNotBlank(eamInspectionOrderRequest.getTaskId()) || !StrUtil.isNotBlank(eamInspectionOrderRequest.getDataId())) { + // 妫�鏌ヨ姹傚弬鏁� + if (!isValidRequest(eamInspectionOrderRequest)) { return Result.error("闈炴硶鍙傛暟"); } - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - eamInspectionOrderRequest.setAssignee(user.getUsername()); - if (!StrUtil.isNotBlank(userId)) { + + // 鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + LoginUser user = getCurrentUser(); + if (user == null || StrUtil.isBlank(user.getId())) { return Result.error("璐﹀彿涓嶅瓨鍦�"); } + eamInspectionOrderRequest.setAssignee(user.getUsername()); - // 鏁版嵁鏌ヨ - EamInspectionOrder eamInspectionOrder = this.getById(eamInspectionOrderRequest.getDataId()); + // 鑾峰彇鐐规宸ュ崟淇℃伅 + EamInspectionOrder eamInspectionOrder = getEamInspectionOrder(eamInspectionOrderRequest.getDataId()); if (eamInspectionOrder == null) { return Result.error("鏈壘鍒板搴旀暟鎹�"); } - // 2. 鏌ヨ娴佺▼涓氬姟璁板綍锛堝鐞嗙┖缁撴灉锛� - List<FlowMyBusiness> businessList = flowMyBusinessService.list( - new QueryWrapper<FlowMyBusiness>() - .eq("process_instance_id", eamInspectionOrderRequest.getInstanceId()) - ); - if (businessList.isEmpty()) { + // 鑾峰彇娴佺▼涓氬姟璁板綍 + FlowMyBusiness flowMyBusiness = getFlowMyBusiness(eamInspectionOrderRequest.getInstanceId()); + if (flowMyBusiness == null) { return Result.error("娴佺▼璁板綍涓嶅瓨鍦�"); } - FlowMyBusiness flowMyBusiness = businessList.get(0); - // 3. 鏍¢獙鐢ㄦ埛鏄惁涓哄�欓�夊鐞嗕汉 - List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); - if (todoUsers == null || !todoUsers.contains(user.getUsername())) { + // 妫�鏌ョ敤鎴锋槸鍚︽湁鏉冮檺鎿嶄綔浠诲姟 + if (!isUserAuthorized(flowMyBusiness, user)) { return Result.error("鐢ㄦ埛鏃犳潈鎿嶄綔姝や换鍔�"); } - // 4. 璁ら浠诲姟锛堝鐞嗗凡琚棰嗙殑鎯呭喌锛� - String taskId = flowMyBusiness.getTaskId(); - Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); - if (task == null) { - return Result.error("浠诲姟涓嶅瓨鍦ㄦ垨宸插畬鎴�"); + // 璁ら浠诲姟 + if (!claimTask(flowMyBusiness.getTaskId(), user)) { + return Result.error("浠诲姟涓嶅瓨鍦ㄣ�佸凡瀹屾垚鎴栧凡琚粬浜鸿棰�"); } - if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { - return Result.error("浠诲姟宸茶浠栦汉璁ら"); - } - taskService.claim(taskId, user.getUsername()); - Map<String, Object> values = new HashMap<>(); - if ((InspectionStatus.IN_PROGRESS.getCode()).equals(eamInspectionOrder.getInspectionStatus())) { - //鐐规浜虹偣妫�缁撴潫 - //鏌ヨ瀵瑰簲鐝粍闀�,浣滀负涓嬩竴鑺傜偣澶勭悊浜�,瀛樺湪澶氫釜澶勭悊浜� - String orgId=iEamEquipmentService.getById(eamInspectionOrder.getEquipmentId()).getOrgId(); - //绛涢�夊嚭鐝粍闀垮矖浣�,post涓篜CR0003 - List<SysUser> sysUserList= mdcUserProductionService.queryByPostAndProId("PCR0003",orgId); - List<String> usernameList; - if (sysUserList.isEmpty()){ - return Result.error("鏈壘鍒拌璁惧瀵瑰簲杞﹂棿鐨勭彮缁勯暱锛岃鑱旂郴绠$悊鍛樺鐞�"); - }else { - usernameList = sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); - } - // 璁剧疆娴佺▼鍙橀噺 - values.put("dataId", eamInspectionOrder.getId()); - values.put("organization", "鐐规浜虹偣妫�缁撴潫"); - values.put("comment","鐐规浜虹偣妫�缁撴潫" ); - values.put("NextAssignee", usernameList); - eamInspectionOrderRequest.setComment("鐐规浜虹偣妫�缁撴潫"); - }else { - //鐝粍闀跨‘璁� - values.put("dataId", eamInspectionOrder.getId()); - values.put("organization", "鐝粍闀跨‘璁�"); - values.put("comment","鐝粍闀跨‘璁�" ); - eamInspectionOrderRequest.setComment("鐝粍闀跨‘璁�"); - } - eamInspectionOrderRequest.setValues(values); + // 璁剧疆娴佺▼鍙橀噺 + setupProcessVariables(eamInspectionOrderRequest, eamInspectionOrder, user); + // 瀹屾垚娴佺▼浠诲姟 Result result = flowTaskService.complete(eamInspectionOrderRequest); - if (result.isSuccess()) { - // 鏇存柊鐘舵�� - if ((InspectionStatus.IN_PROGRESS.getCode()).equals(eamInspectionOrder.getInspectionStatus())) { - //鐐规瀹屾垚 - eamInspectionOrder.setInspectionStatus("3"); - eamInspectionOrder.setInspectionDate(new Date()); - eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", eamInspectionOrder.getId())); - eamInspectionOrderDetailService.saveBatch(eamInspectionOrderRequest.getTableDetailList()); - this.updateById(eamInspectionOrder); - } - } else if ((InspectionStatus.COMPLETED.getCode()).equals(eamInspectionOrder.getInspectionStatus())){ - // 鐝粍闀跨‘璁や换鍔� - eamInspectionOrder.setInspectionStatus("4"); - eamInspectionOrder.setConfirmUser(user.getUsername()); - eamInspectionOrder.setConfirmTime(new Date()); - this.updateById(eamInspectionOrder); - //澶勭悊寮傚父鏁版嵁杩涘叆缁翠慨鍗� - return result; + + // 鏍规嵁浠诲姟瀹屾垚缁撴灉鏇存柊宸ュ崟鐘舵�� + updateOrderStatus(result, eamInspectionOrderRequest, eamInspectionOrder, user); + + // 鏇存柊宸ュ崟淇℃伅 + updateEamInspectionOrder(eamInspectionOrder); + + //鏌ヨ鏁版嵁,杩涜璁惧缁翠慨澶勭悊 + if (eamInspectionOrder.getInspectionStatus().equals(InspectionStatus.CONFIRMED.getCode())){ + updateEamInspectionOrderDetail(eamInspectionOrder); } return Result.OK("鎿嶄綔鎴愬姛"); @@ -283,6 +246,134 @@ } } + private boolean isValidRequest(EamInspectionOrderRequest request) { + return StrUtil.isNotBlank(request.getTaskId()) && StrUtil.isNotBlank(request.getDataId()); + } + + private LoginUser getCurrentUser() { + try { + return (LoginUser) SecurityUtils.getSubject().getPrincipal(); + } catch (Exception e) { + return null; + } + } + + private EamInspectionOrder getEamInspectionOrder(String dataId) { + return this.getById(dataId); + } + + private FlowMyBusiness getFlowMyBusiness(String instanceId) { + List<FlowMyBusiness> businessList = flowMyBusinessService.list( + new QueryWrapper<FlowMyBusiness>().eq("process_instance_id", instanceId)); + return businessList.isEmpty() ? null : businessList.get(0); + } + + private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { + List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); + return todoUsers != null && todoUsers.contains(user.getUsername()); + } + + private boolean claimTask(String taskId, LoginUser user) { + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); + if (task == null) { + return false; + } + if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) { + return false; + } + taskService.claim(taskId, user.getUsername()); + return true; + } + + private void setupProcessVariables(EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user) { + Map<String, Object> values = new HashMap<>(); + if (InspectionStatus.IN_PROGRESS.getCode().equals(order.getInspectionStatus()) && user.getUsername().equals(order.getOperator())) { + // 鐐规浜虹偣妫�缁撴潫 + String orgId = Optional.ofNullable(iEamEquipmentService.getById(order.getEquipmentId())) + .map(equipment -> equipment.getOrgId()) + .orElse(null); + if (orgId == null) { + throw new IllegalArgumentException("鏈壘鍒拌澶囩殑缁勭粐 ID"); + } + List<SysUser> sysUserList = mdcUserProductionService.queryByPostAndProId("PCR0003", orgId); + List<String> usernameList = sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); + if (usernameList.isEmpty()) { + throw new IllegalArgumentException("鏈壘鍒拌璁惧瀵瑰簲杞﹂棿鐨勭彮缁勯暱锛岃鑱旂郴绠$悊鍛樺鐞�"); + } + values.put("dataId", order.getId()); + values.put("organization", "鐐规浜虹偣妫�缁撴潫"); + values.put("comment", "鐐规浜虹偣妫�缁撴潫"); + values.put("NextAssignee", usernameList); + request.setComment("鐐规浜虹偣妫�缁撴潫"); + } else { + // 鐝粍闀跨‘璁� + values.put("dataId", order.getId()); + values.put("organization", request.getDealSuggestion()); + values.put("comment", request.getDealSuggestion()); + values.put("confirmation", request.getDealType()); + request.setComment(request.getDealSuggestion()); + if ("2".equals(request.getDealType())) { + // 鐝粍闀块┏鍥� + List<String> usernames = new ArrayList<>(); + usernames.add(order.getOperator()); + order.setInspectionStatus("2"); + values.put("NextAssignee", usernames); + } + } + request.setValues(values); + } + + private void updateOrderStatus(Result result, EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user) { + if (result.isSuccess()) { + if (InspectionStatus.IN_PROGRESS.getCode().equals(order.getInspectionStatus()) && StrUtil.isEmpty(request.getDealType())) { + // 鐐规瀹屾垚 + order.setInspectionStatus("3"); + order.setOperateTime(new Date()); + eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", order.getId())); + eamInspectionOrderDetailService.saveBatch(request.getTableDetailList()); + } else if (InspectionStatus.COMPLETED.getCode().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getDealType())) { + // 鐝粍闀跨‘璁や换鍔� + order.setInspectionStatus("4"); + order.setConfirmUser(user.getUsername()); + order.setConfirmTime(new Date()); + } + } + } + + private void updateEamInspectionOrder(EamInspectionOrder eamInspectionOrder) { + this.updateById(eamInspectionOrder); + } + + /** + * 璁惧鏄惁瀛樺湪寮傚父,骞惰繘琛岃澶囩淮淇� + * @param eamInspectionOrder + */ + private void updateEamInspectionOrderDetail(EamInspectionOrder eamInspectionOrder) { + EamEquipmentFaultReason eamEquipmentFaultReason=eamEquipmentFaultReasonService. + getOne(new QueryWrapper<EamEquipmentFaultReason>().eq("fault_code","EFR20250003")); + List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService + .list(new QueryWrapper<EamInspectionOrderDetail>() + .eq("order_id", eamInspectionOrder.getId()).eq("report_flag","1")); + List<EamReportRepair> eamReportRepairs = new ArrayList<>(); + if (!eamInspectionOrderDetails.isEmpty()) { + eamInspectionOrderDetails.forEach(item->{ + EamReportRepair eamReportRepair=new EamReportRepair(); + eamReportRepair.setEquipmentId(eamInspectionOrder.getEquipmentId()); + eamReportRepair.setFaultName(eamEquipmentFaultReason.getFaultName()); + eamReportRepair.setFaultType(eamEquipmentFaultReason.getFaultCategory()); + eamReportRepair.setFaultDescription(eamEquipmentFaultReason.getFaultDescription()); + eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); + eamReportRepair.setDelFlag(CommonConstant.DEL_FLAG_0); + eamReportRepair.setFaultStartTime(new Date()); + eamReportRepair.setRemark(item.getExceptionDescription()); + eamReportRepairs.add(eamReportRepair); + }); + } + if (!eamReportRepairs.isEmpty()) { + eamReportRepairService.saveBatch(eamReportRepairs); + } + } + /** * 鎵归噺浣滃簾涓庨鍙� * @param ids diff --git a/lxzn-module-flowable/pom.xml b/lxzn-module-flowable/pom.xml index 56d4169..b3339f3 100644 --- a/lxzn-module-flowable/pom.xml +++ b/lxzn-module-flowable/pom.xml @@ -56,11 +56,6 @@ <artifactId>lombok</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.projectlombok</groupId> - <artifactId>lombok</artifactId> - <scope>provided</scope> - </dependency> </dependencies> </project> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java index 78a07d1..bc0fda2 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/FlowMyBusinessMapper.java @@ -8,6 +8,8 @@ import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; import org.jeecg.modules.flowable.domain.dto.FlowTaskDto; +import java.util.List; + /** * @Description: 娴佺▼涓氬姟鎵╁睍琛� * @Author: jeecg-boot @@ -17,11 +19,10 @@ public interface FlowMyBusinessMapper extends BaseMapper<FlowMyBusiness> { /** * 娴佺▼-鎴戠殑宸插姙 - * @param flowMyBusinessDto - * @param page + * @param dto * @return */ - IPage<FlowTaskDto> PageListMyBusiness(@Param("page")Page page, @Param("flowMyBusinessDto") FlowMyBusinessDto flowMyBusinessDto); + List<FlowTaskDto> ListMyBusiness(@Param("dto") FlowMyBusinessDto dto); /** * 娴佺▼鎬诲彴璐� diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml index 07c540b..790a193 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml @@ -43,50 +43,59 @@ ORDER BY flow_my_business.create_time desc </select> - <select id="PageListMyBusiness" resultType="org.jeecg.modules.flowable.domain.dto.FlowTaskDto"> + + <select id="ListMyBusiness" resultType="org.jeecg.modules.flowable.domain.dto.FlowTaskDto"> SELECT - task.ID_ AS 'taskId', - TASK.PROC_INST_ID_ AS 'procInsId', + fmb.task_id AS 'taskId', + fmb.process_instance_id AS 'procInsId', ACT_RE_PROCDEF.CATEGORY_ AS 'category', - ACT_RE_PROCDEF.NAME_ 'procDefName', - flow_my_business.title AS 'Description', - flow_my_business.data_id AS 'dataId', - flow_my_business.process_definition_key AS 'processDefinitionKey', - flow_my_business.process_definition_id AS 'processDefinitionId', - ACT_HI_PROCINST.START_TIME_ AS createTime, - ACT_RU_TASK.ASSIGNEE_ as todoUsers, - task.END_TIME_ AS 'finishTime', - TASK.EXECUTION_ID_ AS 'executionId', - task.NAME_ AS 'taskName', - task.DURATION_ 'duration', - task.TASK_DEF_KEY_ AS 'TaskDefKey' + ACT_RE_PROCDEF.NAME_ AS 'procDefName', + fmb.title AS 'Description', + fmb.data_id AS 'dataId', + fmb.process_definition_key AS 'processDefinitionKey', + fmb.process_definition_id AS 'processDefinitionId', + fmb.proposer, + fmb.task_name, + latest_task.NAME_ AS taskName, + fmb.create_time AS createTime, + latest_task.END_TIME_ AS finishTime FROM - ACT_HI_TASKINST TASK - LEFT JOIN flow_my_business ON flow_my_business.process_instance_id = TASK.PROC_INST_ID_ - LEFT JOIN ACT_RE_PROCDEF ON flow_my_business.process_definition_id = ACT_RE_PROCDEF.ID_ - LEFT JOIN ACT_HI_PROCINST ON TASK.PROC_INST_ID_ = ACT_HI_PROCINST.ID_ - left join ACT_RU_TASK on flow_my_business.task_id = ACT_RU_TASK.ID_ + flow_my_business fmb + LEFT JOIN ACT_RE_PROCDEF ON fmb.process_definition_id = ACT_RE_PROCDEF.ID_ + LEFT JOIN ACT_HI_PROCINST ON fmb.process_instance_id = ACT_HI_PROCINST.ID_ + LEFT JOIN ( + SELECT + *, + ROW_NUMBER() OVER ( + PARTITION BY PROC_INST_ID_ + ORDER BY END_TIME_ DESC + ) AS rn + FROM ACT_HI_TASKINST + WHERE ASSIGNEE_ = #{dto.currentUser} <!-- 缁熶竴鍒悕 --> + <if test="dto.startTime != null"> + AND START_TIME_ >= #{dto.startTime} + </if> + <if test="dto.endTime != null"> + AND END_TIME_ <= #{dto.endTime} + </if> + ) latest_task + ON fmb.process_instance_id = latest_task.PROC_INST_ID_ + AND latest_task.rn = 1 WHERE - TASK.END_TIME_ IS NOT NULL - <if test="flowMyBusinessDto.currentUser != null and flowMyBusinessDto.currentUser != ''"> - AND TASK.ASSIGNEE_ = #{flowMyBusinessDto.currentUser} + <!-- 鍔ㄦ�佹潯浠剁粺涓�浣跨敤 dto --> + <if test="dto.currentUser != null and dto.currentUser != ''"> + fmb.done_users like concat('%',#{dto.currentUser},'%') </if> - <if test="flowMyBusinessDto.category != null and flowMyBusinessDto.category != ''"> - and ACT_RE_PROCDEF.CATEGORY_ = #{flowMyBusinessDto.category} + <if test="dto.category != null and dto.category != ''"> + AND ACT_RE_PROCDEF.CATEGORY_ = #{dto.category} </if> - <if test="flowMyBusinessDto.flowName!= null and flowMyBusinessDto.flowName!= ''"> - AND ACT_RE_PROCDEF.name_ LIKE CONCAT('%',#{flowMyBusinessDto.flowName},'%') + <if test="dto.flowName != null and dto.flowName != ''"> + AND ACT_RE_PROCDEF.NAME_ LIKE CONCAT('%', #{dto.flowName}, '%') </if> - <if test="flowMyBusinessDto.title != null and flowMyBusinessDto.title != ''"> - AND flow_my_business.title LIKE CONCAT('%',#{flowMyBusinessDto.title},'%') - </if> - <if test="flowMyBusinessDto.startTime!= null and flowMyBusinessDto.startTime!= ''"> - AND TASK.START_TIME_ >= #{flowMyBusinessDto.startTime} - </if> - <if test="flowMyBusinessDto.endTime!= null and flowMyBusinessDto.endTime!= ''"> - AND TASK.END_TIME_ <= #{flowMyBusinessDto.endTime} + <if test="dto.title != null and dto.title != ''"> + AND fmb.title LIKE CONCAT('%', #{dto.title}, '%') </if> ORDER BY - TASK.END_TIME_ DESC + latest_task.END_TIME_ DESC </select> </mapper> diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java index 28f101e..3216cf9 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java @@ -81,11 +81,10 @@ /** * 娴佺▼-鎴戠殑宸插姙 * @param flowMyBusinessDto - * @param page * @return */ - public IPage<FlowTaskDto> getPageListMyBusiness(Page page, FlowMyBusinessDto flowMyBusinessDto){ - return flowMyBusinessMapper.PageListMyBusiness(page,flowMyBusinessDto); + public List<FlowTaskDto> ListMyBusiness(FlowMyBusinessDto flowMyBusinessDto){ + return flowMyBusinessMapper.ListMyBusiness(flowMyBusinessDto); } /** diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java index 403bfec..6775bed 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/domain/dto/FlowTaskDto.java @@ -94,11 +94,11 @@ private String dataId; @ApiModelProperty("浠诲姟鍒涘缓鏃堕棿") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") private Date createTime; @ApiModelProperty("浠诲姟瀹屾垚鏃堕棿") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") private Date finishTime; /**娴佺▼瀹氫箟key 涓�涓猭ey浼氭湁澶氫釜鐗堟湰鐨刬d*/ diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java index e4f7eb4..99738f1 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java @@ -1039,8 +1039,8 @@ Page page = new Page(pageNum, pageSize); String username = iFlowThirdService.getLoginUser().getUsername(); flowMyBusinessDto.setCurrentUser(username); - IPage<FlowTaskDto> flowTaskDtoIPage = flowMyBusinessService.getPageListMyBusiness(page,flowMyBusinessDto); - flowTaskDtoIPage.getRecords().forEach(flowTaskDto -> { + List<FlowTaskDto> list = flowMyBusinessService.ListMyBusiness(flowMyBusinessDto); + list.forEach(flowTaskDto -> { // 娴佺▼鍙戣捣浜轰俊鎭� HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(flowTaskDto.getProcInsId()) @@ -1051,6 +1051,9 @@ List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername,"锛�")); }); + IPage<FlowTaskDto> flowTaskDtoIPage = new Page<>(); + flowTaskDtoIPage.setRecords(list); + flowTaskDtoIPage.setTotal(page.getTotal()); return Result.OK(flowTaskDtoIPage); } -- Gitblit v1.9.3