|
|
@ -2,6 +2,7 @@ package com.hnac.hzims.operational.defect.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
|
|
@ -27,6 +28,7 @@ import com.hnac.hzims.operational.defect.service.IDefectCheckService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperAppearanceService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperAppearanceService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperDefectService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperDefectService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IOperDefectStatisticsService; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.util.TimeUtils; |
|
|
|
import com.hnac.hzims.ticket.repair.entity.RepairEntity; |
|
|
|
import com.hnac.hzims.ticket.repair.entity.RepairEntity; |
|
|
|
import com.hnac.hzims.ticket.repair.fegin.IRepairClient; |
|
|
|
import com.hnac.hzims.ticket.repair.fegin.IRepairClient; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -166,7 +168,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode(); |
|
|
|
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode(); |
|
|
|
// 开启新的缺陷流程
|
|
|
|
// 开启新的缺陷流程
|
|
|
|
String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()); |
|
|
|
String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()); |
|
|
|
Map<String, Object> variable = entityToMap(entity); |
|
|
|
Map<String, Object> variable = JSONObject.parseObject(JSONObject.toJSONStringWithDateFormat(entity,DateUtil.PATTERN_DATETIME), Map.class); |
|
|
|
|
|
|
|
// variables.put("creator", TaskUtil.getTaskUser(String.valueOf(AuthUtil.getUserId())));
|
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK, businessKey, processName, variable); |
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK, businessKey, processName, variable); |
|
|
|
// 流程开启失败
|
|
|
|
// 流程开启失败
|
|
|
|
if (!result.isSuccess()) { |
|
|
|
if (!result.isSuccess()) { |
|
|
@ -253,15 +256,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
try { |
|
|
|
try { |
|
|
|
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); |
|
|
|
Map<String, Object> variables = (Map<String, Object>) processWorkFlowResponse.getVariables(); |
|
|
|
//现象缺陷全表更新
|
|
|
|
//现象缺陷全表更新
|
|
|
|
operPhenomenonEntity = mapToEntity(OperPhenomenonEntity.class, variables); |
|
|
|
operPhenomenonEntity= JSONObject.parseObject(JSONObject.toJSONString(variables), new TypeReference<OperPhenomenonEntity>(){}); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("消息转换失败"); |
|
|
|
log.info("消息转换失败"); |
|
|
|
return R.fail("消息转换失败"); |
|
|
|
return R.fail("消息转换失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//设置当前环节+当前环节处理人
|
|
|
|
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { |
|
|
|
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { |
|
|
|
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getNextStepOperator()); |
|
|
|
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getTaskName()); |
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getProcessDefinitionKey()); |
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getNextStepOperator()); |
|
|
|
} |
|
|
|
} |
|
|
|
//缺陷记录
|
|
|
|
//缺陷记录
|
|
|
|
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ |
|
|
|
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ |
|
|
@ -271,7 +274,17 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{ |
|
|
|
OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{ |
|
|
|
eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); |
|
|
|
eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && "1".equals(operPhenomenonEntity.getIsWarehousing())) { |
|
|
|
//计算工时
|
|
|
|
|
|
|
|
if(ObjectUtils.isNotEmpty(operPhenomenonEntity.getActStartTime())&&ObjectUtils.isNotEmpty(operPhenomenonEntity.getActEndTime())){ |
|
|
|
|
|
|
|
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getActStartTime(), operPhenomenonEntity.getActEndTime()); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCheckHours(differTime.intValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtils.isNotEmpty(operPhenomenonEntity.getPlanStartTime())&&ObjectUtils.isNotEmpty(operPhenomenonEntity.getPlanEndTime())){ |
|
|
|
|
|
|
|
Long differTime = TimeUtils.getDifferTime(operPhenomenonEntity.getPlanStartTime(), operPhenomenonEntity.getPlanEndTime()); |
|
|
|
|
|
|
|
operPhenomenonEntity.setPlanHours(differTime.intValue()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//缺陷库记录
|
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && 1==(operPhenomenonEntity.getIsWarehousing())) { |
|
|
|
OperDefectEntity operDefectEntity = new OperDefectEntity(); |
|
|
|
OperDefectEntity operDefectEntity = new OperDefectEntity(); |
|
|
|
BeanUtil.copy(operPhenomenonEntity, operDefectEntity); |
|
|
|
BeanUtil.copy(operPhenomenonEntity, operDefectEntity); |
|
|
|
operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString()); |
|
|
|
operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString()); |
|
|
|