|
|
@ -4,25 +4,34 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
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.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
|
|
|
import com.hnac.hzims.common.logs.utils.StringUtils; |
|
|
|
import com.hnac.hzims.fdp.feign.IFdpTaskClient; |
|
|
|
import com.hnac.hzims.fdp.feign.IFdpTaskClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.message.MessageConstants; |
|
|
|
|
|
|
|
import com.hnac.hzims.message.dto.MessagePushRecordDto; |
|
|
|
|
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
|
|
|
|
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessPlanDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessPlanDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessPlanService; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessPlanService; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; |
|
|
|
import com.hnac.hzims.operational.access.service.IOperAccessTaskService; |
|
|
|
import com.hnac.hzims.operational.defect.config.DefectConfiguration; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.constants.RepairConstant; |
|
|
|
import com.hnac.hzims.operational.defect.constants.RepairConstant; |
|
|
|
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; |
|
|
|
import com.hnac.hzims.operational.defect.constants.TreatMethodConstant; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.defect.entity.OperAppearanceEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperDefectEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperDefectStatisticsEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
|
|
|
import com.hnac.hzims.operational.defect.entity.OperPhenomenonEntity; |
|
|
|
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper; |
|
|
|
import com.hnac.hzims.operational.defect.mapper.OperPhenomenonMapper; |
|
|
|
import com.hnac.hzims.operational.defect.service.IDefectCheckService; |
|
|
|
import com.hnac.hzims.operational.defect.service.IDefectCheckService; |
|
|
|
|
|
|
|
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.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; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
@ -34,6 +43,7 @@ import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
import org.springblade.flow.core.utils.FlowUtil; |
|
|
|
import org.springblade.flow.core.utils.FlowUtil; |
|
|
|
import org.springblade.flow.core.vo.ComleteTask; |
|
|
|
import org.springblade.flow.core.vo.ComleteTask; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
import org.springblade.system.cache.DictCache; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
@ -41,6 +51,11 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.beans.BeanInfo; |
|
|
|
|
|
|
|
import java.beans.Introspector; |
|
|
|
|
|
|
|
import java.beans.PropertyDescriptor; |
|
|
|
|
|
|
|
import java.lang.reflect.Field; |
|
|
|
|
|
|
|
import java.lang.reflect.InvocationTargetException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
@ -53,6 +68,7 @@ import java.util.stream.Collectors; |
|
|
|
* @author ysj |
|
|
|
* @author ysj |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper, OperPhenomenonEntity> implements IDefectCheckService { |
|
|
|
public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper, OperPhenomenonEntity> implements IDefectCheckService { |
|
|
|
|
|
|
|
|
|
|
@ -61,6 +77,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
private final IOperAccessPlanService operAccessPlanService; |
|
|
|
private final IOperAccessPlanService operAccessPlanService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IOperAppearanceService operAppearanceService; |
|
|
|
|
|
|
|
|
|
|
|
private final IOperDefectStatisticsService statisticsService; |
|
|
|
private final IOperDefectStatisticsService statisticsService; |
|
|
|
private final IOperDefectService defectService; |
|
|
|
private final IOperDefectService defectService; |
|
|
|
|
|
|
|
|
|
|
@ -72,6 +90,10 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
private final IUserClient userClient; |
|
|
|
private final IUserClient userClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IMessageClient messageClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IFdpTaskClient fdpTaskClient; |
|
|
|
private final IFdpTaskClient fdpTaskClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -79,6 +101,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存现象、开启缺陷处理流程 |
|
|
|
* 保存现象、开启缺陷处理流程 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -86,27 +109,28 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public OperPhenomenonEntity startCheck(OperPhenomenonEntity entity) { |
|
|
|
public OperPhenomenonEntity startCheck(OperPhenomenonEntity entity) { |
|
|
|
// 步骤1.保存现象
|
|
|
|
// 步骤1.保存现象
|
|
|
|
if(!this.savePhenomenon(entity)){ |
|
|
|
if (!this.savePhenomenon(entity)) { |
|
|
|
throw new ServiceException("保存现象失败!"); |
|
|
|
throw new ServiceException("保存现象失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 步骤2.开启缺陷流程
|
|
|
|
// 步骤2.开启缺陷流程
|
|
|
|
this.startDefectCheck(entity); |
|
|
|
this.startDefectCheckV2(entity); |
|
|
|
return entity; |
|
|
|
return entity; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存现象 |
|
|
|
* 保存现象 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean savePhenomenon(OperPhenomenonEntity entity) { |
|
|
|
private boolean savePhenomenon(OperPhenomenonEntity entity) { |
|
|
|
DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME_MINI); |
|
|
|
DateTimeFormatter format = DateTimeFormatter.ofPattern(DateUtil.PATTERN_DATETIME_MINI); |
|
|
|
// 缺陷编码 : 缺陷来源 + 时间格式化 + 三位长度随机值
|
|
|
|
// 缺陷编码 : 缺陷来源 + 时间格式化 + 三位长度随机值
|
|
|
|
if(Func.isEmpty(entity.getDefectCode())){ |
|
|
|
if (Func.isEmpty(entity.getDefectCode())) { |
|
|
|
entity.setDefectCode(entity.getSourceCode() + format.format(LocalDateTime.now()) + Func.random(3)); |
|
|
|
entity.setDefectCode(entity.getSourceCode() + format.format(LocalDateTime.now()) + Func.random(3)); |
|
|
|
} |
|
|
|
} |
|
|
|
// 现象发起人 : 当前用户Id
|
|
|
|
// 现象发起人 : 当前用户Id
|
|
|
|
if(Func.isEmpty(entity.getFinder())){ |
|
|
|
if (Func.isEmpty(entity.getFinder())) { |
|
|
|
entity.setFinder(AuthUtil.getUserId()); |
|
|
|
entity.setFinder(AuthUtil.getUserId()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 现象发起时间
|
|
|
|
// 现象发起时间
|
|
|
@ -114,33 +138,230 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
// 现象更新时间
|
|
|
|
// 现象更新时间
|
|
|
|
entity.setUpdateTime(new Date()); |
|
|
|
entity.setUpdateTime(new Date()); |
|
|
|
// 现在最后甄别时间
|
|
|
|
// 现在最后甄别时间
|
|
|
|
Date discriminateDeadline = DateUtil.plusHours(entity.getUpdateTime(), DefectConfiguration.discriminateDeadline); |
|
|
|
// Date discriminateDeadline = DateUtil.plusHours(entity.getUpdateTime(), DefectConfiguration.discriminateDeadline);
|
|
|
|
entity.setDiscriminateDeadline(discriminateDeadline); |
|
|
|
// entity.setDiscriminateDeadline(discriminateDeadline);
|
|
|
|
|
|
|
|
// 最后甄别时间字段弃用
|
|
|
|
return this.save(entity); |
|
|
|
return this.save(entity); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 启动缺陷处理流程 |
|
|
|
* 启动缺陷处理流程 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
private void startDefectCheckV2(OperPhenomenonEntity entity) { |
|
|
|
|
|
|
|
// 获取机构下执行定论缺陷角色用户
|
|
|
|
|
|
|
|
List<User> list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_SCREEN_ALIAS); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
|
|
|
throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 现象发起人名字
|
|
|
|
|
|
|
|
String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse(""); |
|
|
|
|
|
|
|
// 现象发起来源
|
|
|
|
|
|
|
|
String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX, entity.getSourceCode()); |
|
|
|
|
|
|
|
// 流程名称
|
|
|
|
|
|
|
|
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode(); |
|
|
|
|
|
|
|
// 开启新的缺陷流程
|
|
|
|
|
|
|
|
String businessKey = FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()); |
|
|
|
|
|
|
|
Map<String, Object> variable = entityToMap(entity); |
|
|
|
|
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK_PRIMARY_KEY_TY, businessKey, processName, variable); |
|
|
|
|
|
|
|
// 流程开启失败
|
|
|
|
|
|
|
|
if (!result.isSuccess()) { |
|
|
|
|
|
|
|
throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 关联流程唯一键
|
|
|
|
|
|
|
|
entity.setCheckProcessInstanceId(result.getData().getProcessInstanceId()); |
|
|
|
|
|
|
|
this.baseMapper.updateById(entity); |
|
|
|
|
|
|
|
//新增缺陷流程记录
|
|
|
|
|
|
|
|
OperDefectStatisticsEntity operDefectStatisticsEntity = new OperDefectStatisticsEntity(); |
|
|
|
|
|
|
|
BeanUtil.copy(entity, operDefectStatisticsEntity); |
|
|
|
|
|
|
|
statisticsService.save(operDefectStatisticsEntity); |
|
|
|
|
|
|
|
//新增现象记录
|
|
|
|
|
|
|
|
OperAppearanceEntity operAppearanceEntity = new OperAppearanceEntity(); |
|
|
|
|
|
|
|
BeanUtil.copy(entity, operAppearanceEntity); |
|
|
|
|
|
|
|
operAppearanceService.save(operAppearanceEntity); |
|
|
|
|
|
|
|
this.save(entity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 实体类转换成map |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param obj |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static Map<String, Object> entityToMap(Object obj) { |
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>(); |
|
|
|
|
|
|
|
Class<?> clazz = obj.getClass(); |
|
|
|
|
|
|
|
for (Field field : clazz.getDeclaredFields()) { |
|
|
|
|
|
|
|
field.setAccessible(true); |
|
|
|
|
|
|
|
String fieldName = field.getName(); |
|
|
|
|
|
|
|
Object object = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
object = field.get(obj); |
|
|
|
|
|
|
|
} catch (IllegalArgumentException | IllegalAccessException e) { |
|
|
|
|
|
|
|
log.info(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put(fieldName, object); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return map; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Map转实体类:要转换的Map的key跟实体类属性名相同的数据会转过去,不相同的字段会为null |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param clazz |
|
|
|
|
|
|
|
* @param map |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static <T> T mapToEntity(Class<T> clazz, Map<String, Object> map) { |
|
|
|
|
|
|
|
T obj = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
BeanInfo beanInfo = Introspector.getBeanInfo(clazz); |
|
|
|
|
|
|
|
obj = clazz.newInstance(); // 创建 JavaBean 对象
|
|
|
|
|
|
|
|
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); |
|
|
|
|
|
|
|
// 给 JavaBean 对象的属性赋值
|
|
|
|
|
|
|
|
for (int i = 0; i < propertyDescriptors.length; i++) { |
|
|
|
|
|
|
|
PropertyDescriptor descriptor = propertyDescriptors[i]; |
|
|
|
|
|
|
|
String propertyName = descriptor.getName(); |
|
|
|
|
|
|
|
if (map.containsKey(propertyName)) { |
|
|
|
|
|
|
|
Object value = map.get(propertyName); |
|
|
|
|
|
|
|
Object[] args = new Object[1]; |
|
|
|
|
|
|
|
args[0] = value; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
descriptor.getWriteMethod().invoke(obj, args); |
|
|
|
|
|
|
|
} catch (InvocationTargetException e) { |
|
|
|
|
|
|
|
log.info(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.info(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return (T) obj; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @param processWorkFlowResponse |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R listenAndUpdateDefect(ProcessWorkFlowResponse processWorkFlowResponse) { |
|
|
|
|
|
|
|
String variables = processWorkFlowResponse.getVariables().toString(); |
|
|
|
|
|
|
|
OperPhenomenonEntity operPhenomenonEntity; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
//现象缺陷全表更新
|
|
|
|
|
|
|
|
operPhenomenonEntity = JSONObject.parseObject(variables, OperPhenomenonEntity.class); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
log.info("消息转换失败"); |
|
|
|
|
|
|
|
return R.fail("消息转换失败"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (processWorkFlowResponse.getTaskId() != null || processWorkFlowResponse.getUserId() != null) { |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentOperator(processWorkFlowResponse.getNextStepOperator()); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(processWorkFlowResponse.getProcessDefinitionKey()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//缺陷记录
|
|
|
|
|
|
|
|
OperDefectStatisticsEntity statisticsEntity = statisticsService.getOne(new LambdaUpdateWrapper<OperDefectStatisticsEntity>() {{ |
|
|
|
|
|
|
|
eq(OperDefectStatisticsEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
//现象记录
|
|
|
|
|
|
|
|
OperAppearanceEntity appearanceEntity = operAppearanceService.getOne(new LambdaUpdateWrapper<OperAppearanceEntity>() {{ |
|
|
|
|
|
|
|
eq(OperAppearanceEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(operPhenomenonEntity.getIsWarehousing()) && operPhenomenonEntity.getIsWarehousing()) { |
|
|
|
|
|
|
|
OperDefectEntity operDefectEntity=new OperDefectEntity(); |
|
|
|
|
|
|
|
BeanUtil.copy(operPhenomenonEntity,operDefectEntity); |
|
|
|
|
|
|
|
operDefectEntity.setProcessInstanceId(operPhenomenonEntity.getHandleTaskId().toString()); |
|
|
|
|
|
|
|
defectService.save(operDefectEntity); |
|
|
|
|
|
|
|
log.info("缺陷ID:"+operPhenomenonEntity.getDefectCode()+"入库成功"); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentOperator("定论"); |
|
|
|
|
|
|
|
operPhenomenonEntity.setCurrentLinkHandler(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//更新数据库
|
|
|
|
|
|
|
|
Long statisticsEntityId = statisticsEntity.getId(); |
|
|
|
|
|
|
|
Long appearanceEntityId = appearanceEntity.getId(); |
|
|
|
|
|
|
|
BeanUtil.copy(operPhenomenonEntity, statisticsEntity); |
|
|
|
|
|
|
|
BeanUtil.copy(operPhenomenonEntity, appearanceEntity); |
|
|
|
|
|
|
|
statisticsEntity.setId(statisticsEntityId); |
|
|
|
|
|
|
|
appearanceEntity.setId(appearanceEntityId); |
|
|
|
|
|
|
|
this.baseMapper.update(operPhenomenonEntity, new LambdaUpdateWrapper<OperPhenomenonEntity>() {{ |
|
|
|
|
|
|
|
eq(OperPhenomenonEntity::getDefectCode, operPhenomenonEntity.getDefectCode()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
statisticsService.updateById(statisticsEntity); |
|
|
|
|
|
|
|
operAppearanceService.updateById(appearanceEntity); |
|
|
|
|
|
|
|
//推送消息中心相关消息
|
|
|
|
|
|
|
|
sendMessage(processWorkFlowResponse, operPhenomenonEntity); |
|
|
|
|
|
|
|
return R.success("消息保存成功"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void sendMessage(ProcessWorkFlowResponse processWorkFlowResponse, OperPhenomenonEntity operPhenomenonEntity) { |
|
|
|
|
|
|
|
//推送消息
|
|
|
|
|
|
|
|
if (processWorkFlowResponse.getTaskId() != null) { |
|
|
|
|
|
|
|
MessagePushRecordDto message = new MessagePushRecordDto(); |
|
|
|
|
|
|
|
message.setBusinessClassify("business"); |
|
|
|
|
|
|
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getKey()); |
|
|
|
|
|
|
|
message.setSubject(MessageConstants.BusinessClassifyEnum.OPERATIONDEFECTMESSAGE.getDescription()); |
|
|
|
|
|
|
|
message.setTaskId(operPhenomenonEntity.getId()); |
|
|
|
|
|
|
|
message.setTenantId("200000"); |
|
|
|
|
|
|
|
message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH)); |
|
|
|
|
|
|
|
message.setPushType(MessageConstants.IMMEDIATELY); |
|
|
|
|
|
|
|
//您有一张工作票待审批,工作内容:*****,审批环节:*****;
|
|
|
|
|
|
|
|
String countent = |
|
|
|
|
|
|
|
"您的消缺流程待审批!现象名称:".concat(operPhenomenonEntity.getDefectName()) |
|
|
|
|
|
|
|
.concat(",审批环节:") |
|
|
|
|
|
|
|
.concat(processWorkFlowResponse.getTaskName()); |
|
|
|
|
|
|
|
message.setContent(countent); |
|
|
|
|
|
|
|
message.setDeptId(operPhenomenonEntity.getCreateDept()); |
|
|
|
|
|
|
|
R<String> deptName = sysClient.getDeptName(operPhenomenonEntity.getCreateDept()); |
|
|
|
|
|
|
|
if (deptName.isSuccess()) { |
|
|
|
|
|
|
|
message.setDeptName(deptName.getData()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String userIds = processWorkFlowResponse.getUserId(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(userIds)) { |
|
|
|
|
|
|
|
log.error("推送的消息不能为空哦,{}", userIds); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String[] split = userIds.split(","); |
|
|
|
|
|
|
|
for (String userId : split) { |
|
|
|
|
|
|
|
message.setPusher(userId); |
|
|
|
|
|
|
|
User user = UserCache.getUser(NumberUtils.toLong(userId)); |
|
|
|
|
|
|
|
if (ObjectUtils.isNotEmpty(user)) { |
|
|
|
|
|
|
|
message.setPusherName(user.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
message.setAccount(userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
message.setCreateUser(NumberUtils.toLong(userId)); |
|
|
|
|
|
|
|
messageClient.sendMessage(message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 启动缺陷处理流程 |
|
|
|
|
|
|
|
* 此端口弃用20230614 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param entity |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Deprecated |
|
|
|
private void startDefectCheck(OperPhenomenonEntity entity) { |
|
|
|
private void startDefectCheck(OperPhenomenonEntity entity) { |
|
|
|
// 获取机构下执行定论缺陷角色用户
|
|
|
|
// 获取机构下执行定论缺陷角色用户
|
|
|
|
List<User> list = this.getAliasUser(entity.getTenantId(),entity.getCreateDept(),TreatMethodConstant.PHENOMENON_SCREEN_ALIAS); |
|
|
|
List<User> list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_SCREEN_ALIAS); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!"); |
|
|
|
throw new ServiceException("请先添加甄别缺陷角色用户,再发起现象!"); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList()); |
|
|
|
List<String> userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList()); |
|
|
|
// 现象发起人名字
|
|
|
|
// 现象发起人名字
|
|
|
|
String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse(""); |
|
|
|
String userName = Optional.ofNullable(UserCache.getUser(entity.getFinder()).getName()).orElse(""); |
|
|
|
// 现象发起来源
|
|
|
|
// 现象发起来源
|
|
|
|
String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX,entity.getSourceCode()); |
|
|
|
String sourceName = DictCache.getValue(TreatMethodConstant.SOURCE_CODE_PREFIX, entity.getSourceCode()); |
|
|
|
// 流程名称
|
|
|
|
// 流程名称
|
|
|
|
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" +"——>" + entity.getDefectCode(); |
|
|
|
String processName = "[" + userName + "] 发起 " + "【" + sourceName + "】缺陷处理流程" + "——>" + entity.getDefectCode(); |
|
|
|
// 设置下一步执行流程用户
|
|
|
|
// 设置下一步执行流程用户
|
|
|
|
Kv variables = Kv.create() |
|
|
|
Kv variables = Kv.create() |
|
|
|
.set(TreatMethodConstant.PHENOMENON_SCREEN_USER,String.join(",", userList)); |
|
|
|
.set(TreatMethodConstant.PHENOMENON_SCREEN_USER, String.join(",", userList)); |
|
|
|
// 开启新的缺陷流程
|
|
|
|
// 开启新的缺陷流程
|
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK_PRIMARY_KEY, FlowUtil.getBusinessKey("hzims_oper_phenomenon","" + entity.getId()), processName, variables); |
|
|
|
R<BladeFlow> result = processClient.startProcessInstanceContainNameByKey(TreatMethodConstant.DEFECT_CHECK_PRIMARY_KEY, FlowUtil.getBusinessKey("hzims_oper_phenomenon", "" + entity.getId()), processName, variables); |
|
|
|
// 流程开启失败
|
|
|
|
// 流程开启失败
|
|
|
|
if (!result.isSuccess()) { |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode()); |
|
|
|
throw new ServiceException("缺陷流程开启失败,错误描述 : " + result.getCode()); |
|
|
@ -150,20 +371,20 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
this.baseMapper.updateById(entity); |
|
|
|
this.baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取当前机构指定角色的用户 |
|
|
|
* 获取当前机构指定角色的用户 |
|
|
|
|
|
|
|
* |
|
|
|
* @param tenantId |
|
|
|
* @param tenantId |
|
|
|
* @param deptId |
|
|
|
* @param deptId |
|
|
|
* @param alias |
|
|
|
* @param alias |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public List<User> getAliasUser(String tenantId,Long deptId,String alias){ |
|
|
|
public List<User> getAliasUser(String tenantId, Long deptId, String alias) { |
|
|
|
if(Func.isEmpty(tenantId)){ |
|
|
|
if (Func.isEmpty(tenantId)) { |
|
|
|
tenantId = AuthUtil.getTenantId(); |
|
|
|
tenantId = AuthUtil.getTenantId(); |
|
|
|
} |
|
|
|
} |
|
|
|
R<List<User>> result = userClient.relationUserListByRoleAlias(tenantId, deptId, alias); |
|
|
|
R<List<User>> result = userClient.relationUserListByRoleAlias(tenantId, deptId, alias); |
|
|
|
if(!result.isSuccess()){ |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException("查询角色用户信息失败!"); |
|
|
|
throw new ServiceException("查询角色用户信息失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
return result.getData(); |
|
|
@ -171,19 +392,21 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 修改缺陷状态 -> 问题定论 |
|
|
|
* 修改缺陷状态 -> 问题定论 |
|
|
|
|
|
|
|
* |
|
|
|
* @param handleStatus |
|
|
|
* @param handleStatus |
|
|
|
* @param defectCode |
|
|
|
* @param defectCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateDefectHandleState(String handleStatus, String defectCode) { |
|
|
|
private void updateDefectHandleState(String handleStatus, String defectCode) { |
|
|
|
this.defectService.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
this.defectService.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
.set(OperDefectEntity::getHandleStatus,handleStatus) |
|
|
|
.set(OperDefectEntity::getHandleStatus, handleStatus) |
|
|
|
.eq(OperDefectEntity::getDefectCode,defectCode) |
|
|
|
.eq(OperDefectEntity::getDefectCode, defectCode) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 甄别缺陷 |
|
|
|
* 甄别缺陷 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -205,6 +428,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 现象前置判断 |
|
|
|
* 现象前置判断 |
|
|
|
|
|
|
|
* |
|
|
|
* @param processInstanceId |
|
|
|
* @param processInstanceId |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -214,15 +438,15 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
}}; |
|
|
|
}}; |
|
|
|
// 查询现象状态
|
|
|
|
// 查询现象状态
|
|
|
|
OperPhenomenonEntity entity = this.getOne(wrapper); |
|
|
|
OperPhenomenonEntity entity = this.getOne(wrapper); |
|
|
|
if(ObjectUtil.isEmpty(entity)){ |
|
|
|
if (ObjectUtil.isEmpty(entity)) { |
|
|
|
throw new ServiceException("现象不存在"); |
|
|
|
throw new ServiceException("现象不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 现象已被自动甄别
|
|
|
|
// 现象已被自动甄别
|
|
|
|
if(TreatMethodConstant.AUTO_SCREENED.equals(entity.getAutoDiscriminateStatus())){ |
|
|
|
if (TreatMethodConstant.AUTO_SCREENED.equals(entity.getAutoDiscriminateStatus())) { |
|
|
|
throw new ServiceException("该现象已经自动甄别"); |
|
|
|
throw new ServiceException("该现象已经自动甄别"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 现象已被手动动甄别
|
|
|
|
// 现象已被手动动甄别
|
|
|
|
if(TreatMethodConstant.SCREENED.equals(entity.getDiscriminateStatus())){ |
|
|
|
if (TreatMethodConstant.SCREENED.equals(entity.getDiscriminateStatus())) { |
|
|
|
throw new ServiceException("该现象已甄别"); |
|
|
|
throw new ServiceException("该现象已甄别"); |
|
|
|
} |
|
|
|
} |
|
|
|
return entity; |
|
|
|
return entity; |
|
|
@ -230,6 +454,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 缺陷保存 |
|
|
|
* 缺陷保存 |
|
|
|
|
|
|
|
* |
|
|
|
* @param phenomenon |
|
|
|
* @param phenomenon |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void defectSave(OperPhenomenonEntity phenomenon) { |
|
|
|
private void defectSave(OperPhenomenonEntity phenomenon) { |
|
|
@ -245,27 +470,28 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更新甄别状态、数据 |
|
|
|
* 更新甄别状态、数据 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void screePhenomenonUpdate(ComleteTask task) { |
|
|
|
private void screePhenomenonUpdate(ComleteTask task) { |
|
|
|
// 查询流程状态
|
|
|
|
// 查询流程状态
|
|
|
|
String processStatus = TreatMethodConstant.RUNNING; |
|
|
|
String processStatus = TreatMethodConstant.RUNNING; |
|
|
|
R<String> result = processClient.queryProcessInstanceStatus(task.getProcessInstanceId()); |
|
|
|
R<String> result = processClient.queryProcessInstanceStatus(task.getProcessInstanceId()); |
|
|
|
if(result.isSuccess() && StringUtil.isNotBlank(result.getData()) && TreatMethodConstant.PROCESS_STATE_OVER.equals(result.getData())){ |
|
|
|
if (result.isSuccess() && StringUtil.isNotBlank(result.getData()) && TreatMethodConstant.PROCESS_STATE_OVER.equals(result.getData())) { |
|
|
|
processStatus = TreatMethodConstant.PROCESS_STATE_OVER; |
|
|
|
processStatus = TreatMethodConstant.PROCESS_STATE_OVER; |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取参数集
|
|
|
|
// 获取参数集
|
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
boolean invalid = (boolean) variables.get("invalid"); |
|
|
|
boolean invalid = (boolean) variables.get("invalid"); |
|
|
|
LambdaUpdateWrapper<OperPhenomenonEntity> lambdaUpdate = Wrappers.lambdaUpdate(); |
|
|
|
LambdaUpdateWrapper<OperPhenomenonEntity> lambdaUpdate = Wrappers.lambdaUpdate(); |
|
|
|
if(invalid){ |
|
|
|
if (invalid) { |
|
|
|
lambdaUpdate |
|
|
|
lambdaUpdate |
|
|
|
.set(OperPhenomenonEntity::getStatus,processStatus) |
|
|
|
.set(OperPhenomenonEntity::getStatus, processStatus) |
|
|
|
.set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT) |
|
|
|
.set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.IS_DEFECT) |
|
|
|
.set(OperPhenomenonEntity::getAutoDiscriminateStatus, TreatMethodConstant.ORDINARY_SCREENED) |
|
|
|
.set(OperPhenomenonEntity::getAutoDiscriminateStatus, TreatMethodConstant.ORDINARY_SCREENED) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateTime, new Date()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateTime, new Date()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateStatus,variables.get("discriminateStatus").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateStatus, variables.get("discriminateStatus").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateDesc, Optional.ofNullable(variables.get("discriminateDesc")).map(Object::toString).orElse(null)) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateDesc, Optional.ofNullable(variables.get("discriminateDesc")).map(Object::toString).orElse(null)) |
|
|
|
.set(OperPhenomenonEntity::getSafeInfos, variables.get("safeInfos").toString()) |
|
|
|
.set(OperPhenomenonEntity::getSafeInfos, variables.get("safeInfos").toString()) |
|
|
|
.set(OperPhenomenonEntity::getWorkStandards, Optional.ofNullable(variables.get("workStandards")).map(Object::toString).orElse(null)) |
|
|
|
.set(OperPhenomenonEntity::getWorkStandards, Optional.ofNullable(variables.get("workStandards")).map(Object::toString).orElse(null)) |
|
|
@ -274,22 +500,23 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
.set(OperPhenomenonEntity::getPlanStartTime, variables.get("planStartTime").toString()) |
|
|
|
.set(OperPhenomenonEntity::getPlanStartTime, variables.get("planStartTime").toString()) |
|
|
|
.set(OperPhenomenonEntity::getPlanEndTime, variables.get("planEndTime").toString()) |
|
|
|
.set(OperPhenomenonEntity::getPlanEndTime, variables.get("planEndTime").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDefectLevel, variables.get("defectLevel").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDefectLevel, variables.get("defectLevel").toString()) |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId,task.getProcessInstanceId()); |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId()); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
lambdaUpdate |
|
|
|
lambdaUpdate |
|
|
|
.set(OperPhenomenonEntity::getStatus,processStatus) |
|
|
|
.set(OperPhenomenonEntity::getStatus, processStatus) |
|
|
|
.set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.NO_DEFECT) |
|
|
|
.set(OperPhenomenonEntity::getIsDefect, TreatMethodConstant.NO_DEFECT) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateStatus,variables.get("discriminateStatus").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateStatus, variables.get("discriminateStatus").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminator, AuthUtil.getUserId()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateTime, new Date()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateTime, new Date()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateDesc, variables.get("discriminateDesc").toString()) |
|
|
|
.set(OperPhenomenonEntity::getDiscriminateDesc, variables.get("discriminateDesc").toString()) |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId,task.getProcessInstanceId()); |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId()); |
|
|
|
} |
|
|
|
} |
|
|
|
this.update(lambdaUpdate); |
|
|
|
this.update(lambdaUpdate); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 决策处理方式 |
|
|
|
* 决策处理方式 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -300,17 +527,16 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤2.根据处理方式进行处理
|
|
|
|
// 步骤2.根据处理方式进行处理
|
|
|
|
String state = RepairConstant.REPAIR_DEFECT_STATE,processKey = RepairConstant.REPAIR_PROCESS_PRIMARY_KEY |
|
|
|
String state = RepairConstant.REPAIR_DEFECT_STATE, processKey = RepairConstant.REPAIR_PROCESS_PRIMARY_KEY, type = variables.get("type").toString(); |
|
|
|
,type = variables.get("type").toString(); |
|
|
|
switch (type) { |
|
|
|
switch (type){ |
|
|
|
|
|
|
|
// 应急抢修处理
|
|
|
|
// 应急抢修处理
|
|
|
|
case TreatMethodConstant.TYPE_RUSH_TO_REPAIR: |
|
|
|
case TreatMethodConstant.TYPE_RUSH_TO_REPAIR: |
|
|
|
this.startRepair(task,variables); |
|
|
|
this.startRepair(task, variables); |
|
|
|
break; |
|
|
|
break; |
|
|
|
// 检修计划处理
|
|
|
|
// 检修计划处理
|
|
|
|
case TreatMethodConstant.TYPE_PLAN: |
|
|
|
case TreatMethodConstant.TYPE_PLAN: |
|
|
|
state = RepairConstant.ACCESS_PLAN_STATE; |
|
|
|
state = RepairConstant.ACCESS_PLAN_STATE; |
|
|
|
this.startMaintenancePlan(task,variables); |
|
|
|
this.startMaintenancePlan(task, variables); |
|
|
|
break; |
|
|
|
break; |
|
|
|
// 检修任务处理
|
|
|
|
// 检修任务处理
|
|
|
|
case TreatMethodConstant.TYPE_TASK: |
|
|
|
case TreatMethodConstant.TYPE_TASK: |
|
|
@ -321,10 +547,10 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
throw new IllegalStateException("Unexpected type: " + type); |
|
|
|
throw new IllegalStateException("Unexpected type: " + type); |
|
|
|
} |
|
|
|
} |
|
|
|
// 步骤3.关联处理任务
|
|
|
|
// 步骤3.关联处理任务
|
|
|
|
this.relationHandlerTask(variables,type,task.getProcessInstanceId(),state); |
|
|
|
this.relationHandlerTask(variables, type, task.getProcessInstanceId(), state); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤4.缺陷库保存处理任务信息
|
|
|
|
// 步骤4.缺陷库保存处理任务信息
|
|
|
|
this.saveDefectInfo(variables,task.getProcessInstanceId(),processKey,state); |
|
|
|
this.saveDefectInfo(variables, task.getProcessInstanceId(), processKey, state); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤5.流程执行 -> 处理缺陷
|
|
|
|
// 步骤5.流程执行 -> 处理缺陷
|
|
|
|
processClient.completeTask(task); |
|
|
|
processClient.completeTask(task); |
|
|
@ -332,30 +558,32 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 启动应急抢修流程 |
|
|
|
* 启动应急抢修流程 |
|
|
|
|
|
|
|
* |
|
|
|
* @param variables |
|
|
|
* @param variables |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void startRepair(ComleteTask task,Map<String, Object> variables) { |
|
|
|
private void startRepair(ComleteTask task, Map<String, Object> variables) { |
|
|
|
String json = JSON.toJSONString(variables.get("repair")); |
|
|
|
String json = JSON.toJSONString(variables.get("repair")); |
|
|
|
RepairEntity entity = JSONObject.parseObject(json, RepairEntity.class); |
|
|
|
RepairEntity entity = JSONObject.parseObject(json, RepairEntity.class); |
|
|
|
R<RepairEntity> result = repairClient.startRepair(entity); |
|
|
|
R<RepairEntity> result = repairClient.startRepair(entity); |
|
|
|
if(!result.isSuccess()){ |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException("开启检修任务流程失败!"); |
|
|
|
throw new ServiceException("开启检修任务流程失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
variables.put("handlerTaskId",result.getData().getId()); |
|
|
|
variables.put("handlerTaskId", result.getData().getId()); |
|
|
|
variables.put("handlerType",TreatMethodConstant.REPAIR); |
|
|
|
variables.put("handlerType", TreatMethodConstant.REPAIR); |
|
|
|
variables.put("handlerProcessInstanceId",result.getData().getProcessInstanceId()); |
|
|
|
variables.put("handlerProcessInstanceId", result.getData().getProcessInstanceId()); |
|
|
|
variables.put("handlerUserId",result.getData().getCharge()); |
|
|
|
variables.put("handlerUserId", result.getData().getCharge()); |
|
|
|
variables.put(TreatMethodConstant.DEFECT_HANDLER_USER,"taskUser_" + result.getData().getCharge()); |
|
|
|
variables.put(TreatMethodConstant.DEFECT_HANDLER_USER, "taskUser_" + result.getData().getCharge()); |
|
|
|
task.setVariables(variables); |
|
|
|
task.setVariables(variables); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 开启检修计划 |
|
|
|
* 开启检修计划 |
|
|
|
|
|
|
|
* |
|
|
|
* @param variables |
|
|
|
* @param variables |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void startMaintenancePlan(ComleteTask task,Map<String, Object> variables) { |
|
|
|
private void startMaintenancePlan(ComleteTask task, Map<String, Object> variables) { |
|
|
|
String json = JSON.toJSONString(variables.get("accessPlan")); |
|
|
|
String json = JSON.toJSONString(variables.get("accessPlan")); |
|
|
|
OperAccessPlanDTO accessPlan = JSONObject.parseObject(json,OperAccessPlanDTO.class); |
|
|
|
OperAccessPlanDTO accessPlan = JSONObject.parseObject(json, OperAccessPlanDTO.class); |
|
|
|
// 查询现象
|
|
|
|
// 查询现象
|
|
|
|
OperPhenomenonEntity phenomenon = this.getOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ |
|
|
|
OperPhenomenonEntity phenomenon = this.getOne(new LambdaQueryWrapper<OperPhenomenonEntity>() {{ |
|
|
|
eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId()); |
|
|
|
eq(OperPhenomenonEntity::getCheckProcessInstanceId, task.getProcessInstanceId()); |
|
|
@ -368,66 +596,68 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
accessPlan.setActStartTime(DateUtil.now()); |
|
|
|
accessPlan.setActStartTime(DateUtil.now()); |
|
|
|
// 计划草稿
|
|
|
|
// 计划草稿
|
|
|
|
R result = operAccessPlanService.doSave(accessPlan); |
|
|
|
R result = operAccessPlanService.doSave(accessPlan); |
|
|
|
if(!result.isSuccess()){ |
|
|
|
if (!result.isSuccess()) { |
|
|
|
throw new ServiceException("开启检修计划失败"); |
|
|
|
throw new ServiceException("开启检修计划失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 计划流程开启
|
|
|
|
// 计划流程开启
|
|
|
|
accessPlanService.handlePlan(accessPlan,null); |
|
|
|
accessPlanService.handlePlan(accessPlan, null); |
|
|
|
variables.put("handlerTaskId",accessPlan.getId()); |
|
|
|
variables.put("handlerTaskId", accessPlan.getId()); |
|
|
|
variables.put("handlerProcessInstanceId",accessPlan.getProcessInstanceId()); |
|
|
|
variables.put("handlerProcessInstanceId", accessPlan.getProcessInstanceId()); |
|
|
|
variables.put("handlerUserId",AuthUtil.getUserId()); |
|
|
|
variables.put("handlerUserId", AuthUtil.getUserId()); |
|
|
|
variables.put("handlerType",TreatMethodConstant.MAINTENANCE_PLAN); |
|
|
|
variables.put("handlerType", TreatMethodConstant.MAINTENANCE_PLAN); |
|
|
|
variables.put("actStartTime",accessPlan.getActStartTime()); |
|
|
|
variables.put("actStartTime", accessPlan.getActStartTime()); |
|
|
|
variables.put(TreatMethodConstant.DEFECT_HANDLER_USER,"taskUser_" + AuthUtil.getUserId()); |
|
|
|
variables.put(TreatMethodConstant.DEFECT_HANDLER_USER, "taskUser_" + AuthUtil.getUserId()); |
|
|
|
task.setVariables(variables); |
|
|
|
task.setVariables(variables); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 开启检修任务 |
|
|
|
* 开启检修任务 |
|
|
|
|
|
|
|
* |
|
|
|
* @param comleteTask |
|
|
|
* @param comleteTask |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void startMaintenanceTask(ComleteTask comleteTask) { |
|
|
|
public void startMaintenanceTask(ComleteTask comleteTask) { |
|
|
|
Assert.isTrue(CollectionUtil.isNotEmpty(comleteTask.getVariables()) && ObjectUtil.isNotEmpty(comleteTask.getVariables().get("accessTask")),()->{ |
|
|
|
Assert.isTrue(CollectionUtil.isNotEmpty(comleteTask.getVariables()) && ObjectUtil.isNotEmpty(comleteTask.getVariables().get("accessTask")), () -> { |
|
|
|
throw new ServiceException("检修任务信息不能为空!"); |
|
|
|
throw new ServiceException("检修任务信息不能为空!"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
Map<String,Object> variables = comleteTask.getVariables(); |
|
|
|
Map<String, Object> variables = comleteTask.getVariables(); |
|
|
|
OperAccessTaskDTO accessTask = JSONObject.parseObject(JSON.toJSONString(variables.get("accessTask")),OperAccessTaskDTO.class); |
|
|
|
OperAccessTaskDTO accessTask = JSONObject.parseObject(JSON.toJSONString(variables.get("accessTask")), OperAccessTaskDTO.class); |
|
|
|
Assert.isTrue(Func.isNotEmpty(accessTask.getPhenomenonId()),()->{ |
|
|
|
Assert.isTrue(Func.isNotEmpty(accessTask.getPhenomenonId()), () -> { |
|
|
|
throw new ServiceException("检修任务信息必须传入现象Id"); |
|
|
|
throw new ServiceException("检修任务信息必须传入现象Id"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
R result = operAccessTaskService.doSave(accessTask); |
|
|
|
R result = operAccessTaskService.doSave(accessTask); |
|
|
|
if(result.isSuccess()){ |
|
|
|
if (result.isSuccess()) { |
|
|
|
variables.put("handler", "taskUser_"+accessTask.getHandler()); |
|
|
|
variables.put("handler", "taskUser_" + accessTask.getHandler()); |
|
|
|
} |
|
|
|
} |
|
|
|
comleteTask.setVariables(this.excludeProperties(variables,"accessTask")); |
|
|
|
comleteTask.setVariables(this.excludeProperties(variables, "accessTask")); |
|
|
|
processClient.completeTask(comleteTask); |
|
|
|
processClient.completeTask(comleteTask); |
|
|
|
variables.put("handlerTaskId",accessTask.getId()); |
|
|
|
variables.put("handlerTaskId", accessTask.getId()); |
|
|
|
variables.put("handlerProcessInstanceId",accessTask.getProcessInstanceId()); |
|
|
|
variables.put("handlerProcessInstanceId", accessTask.getProcessInstanceId()); |
|
|
|
variables.put("handlerUserId",accessTask.getHandler()); |
|
|
|
variables.put("handlerUserId", accessTask.getHandler()); |
|
|
|
variables.put("handlerType",TreatMethodConstant.MAINTENANCE_TASK); |
|
|
|
variables.put("handlerType", TreatMethodConstant.MAINTENANCE_TASK); |
|
|
|
variables.put("actStartTime",accessTask.getCreateTime()); |
|
|
|
variables.put("actStartTime", accessTask.getCreateTime()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存缺陷信息 |
|
|
|
* 保存缺陷信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @param variables |
|
|
|
* @param variables |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void saveDefectInfo(Map<String, Object> variables,String processInstanceId,String processKey,String state) { |
|
|
|
private void saveDefectInfo(Map<String, Object> variables, String processInstanceId, String processKey, String state) { |
|
|
|
// 新启线程保存缺陷
|
|
|
|
// 新启线程保存缺陷
|
|
|
|
ExecutorService exe = Executors.newSingleThreadExecutor(); |
|
|
|
ExecutorService exe = Executors.newSingleThreadExecutor(); |
|
|
|
exe.execute(()->{ |
|
|
|
exe.execute(() -> { |
|
|
|
// 查询现象
|
|
|
|
// 查询现象
|
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(processInstanceId); |
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(processInstanceId); |
|
|
|
|
|
|
|
|
|
|
|
// 保存流程信息至缺陷表
|
|
|
|
// 保存流程信息至缺陷表
|
|
|
|
this.defectService.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
this.defectService.update(Wrappers.<OperDefectEntity>lambdaUpdate() |
|
|
|
.set(OperDefectEntity::getProcDefId,processKey + "->" + variables.get("handlerTaskId")) |
|
|
|
.set(OperDefectEntity::getProcDefId, processKey + "->" + variables.get("handlerTaskId")) |
|
|
|
.set(OperDefectEntity::getActStartTime,variables.get("actStartTime")) |
|
|
|
.set(OperDefectEntity::getActStartTime, variables.get("actStartTime")) |
|
|
|
.set(OperDefectEntity::getHandleStatus,state) |
|
|
|
.set(OperDefectEntity::getHandleStatus, state) |
|
|
|
.set(OperDefectEntity::getHandleType,variables.get("handlerType")) |
|
|
|
.set(OperDefectEntity::getHandleType, variables.get("handlerType")) |
|
|
|
.eq(OperDefectEntity::getDefectCode,entity.getDefectCode()) |
|
|
|
.eq(OperDefectEntity::getDefectCode, entity.getDefectCode()) |
|
|
|
); |
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
exe.shutdown(); |
|
|
|
exe.shutdown(); |
|
|
@ -435,22 +665,24 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 关联处理任务 |
|
|
|
* 关联处理任务 |
|
|
|
|
|
|
|
* |
|
|
|
* @param variables |
|
|
|
* @param variables |
|
|
|
* @param type |
|
|
|
* @param type |
|
|
|
* @param processInstanceId |
|
|
|
* @param processInstanceId |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void relationHandlerTask( Map<String, Object> variables,String type,String processInstanceId,String state) { |
|
|
|
private void relationHandlerTask(Map<String, Object> variables, String type, String processInstanceId, String state) { |
|
|
|
this.update(Wrappers.<OperPhenomenonEntity>lambdaUpdate() |
|
|
|
this.update(Wrappers.<OperPhenomenonEntity>lambdaUpdate() |
|
|
|
.set(OperPhenomenonEntity::getHandleTaskId,variables.get("handlerTaskId")) |
|
|
|
.set(OperPhenomenonEntity::getHandleTaskId, variables.get("handlerTaskId")) |
|
|
|
.set(OperPhenomenonEntity::getHandler,variables.get("handlerUserId")) |
|
|
|
.set(OperPhenomenonEntity::getHandler, variables.get("handlerUserId")) |
|
|
|
.set(OperPhenomenonEntity::getHandleType,type) |
|
|
|
.set(OperPhenomenonEntity::getHandleType, type) |
|
|
|
.set(OperPhenomenonEntity::getHandleStatus,state) |
|
|
|
.set(OperPhenomenonEntity::getHandleStatus, state) |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId,processInstanceId) |
|
|
|
.eq(OperPhenomenonEntity::getCheckProcessInstanceId, processInstanceId) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 补开工作票 |
|
|
|
* 补开工作票 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -459,8 +691,8 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId()); |
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤2.获取定论角色-用户
|
|
|
|
// 步骤2.获取定论角色-用户
|
|
|
|
List<User> list = this.getAliasUser(entity.getTenantId(),entity.getCreateDept(),TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS); |
|
|
|
List<User> list = this.getAliasUser(entity.getTenantId(), entity.getCreateDept(), TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
throw new ServiceException("请先添加缺陷定论角色用户,再进行补工作票"); |
|
|
|
throw new ServiceException("请先添加缺陷定论角色用户,再进行补工作票"); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList()); |
|
|
|
List<String> userList = list.stream().map(o -> "taskUser_" + o.getId().toString()).collect(Collectors.toList()); |
|
|
@ -469,11 +701,11 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
this.updatePhenomenonState(entity); |
|
|
|
this.updatePhenomenonState(entity); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤4.缺陷状态 -> 问题定论
|
|
|
|
// 步骤4.缺陷状态 -> 问题定论
|
|
|
|
this.updateDefectHandleState(RepairConstant.CONCLUSION_PROBLEM,entity.getDefectCode()); |
|
|
|
this.updateDefectHandleState(RepairConstant.CONCLUSION_PROBLEM, entity.getDefectCode()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤5.设置参数
|
|
|
|
// 步骤5.设置参数
|
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
variables.put(TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS,String.join(",", userList)); |
|
|
|
variables.put(TreatMethodConstant.PHENOMENON_CONCLUSION_ALIAS, String.join(",", userList)); |
|
|
|
task.setVariables(variables); |
|
|
|
task.setVariables(variables); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤6.执行流程->问题定论
|
|
|
|
// 步骤6.执行流程->问题定论
|
|
|
@ -482,6 +714,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 现象状态 -> 问题定论 |
|
|
|
* 现象状态 -> 问题定论 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updatePhenomenonState(OperPhenomenonEntity entity) { |
|
|
|
private void updatePhenomenonState(OperPhenomenonEntity entity) { |
|
|
@ -491,6 +724,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查询现象 |
|
|
|
* 查询现象 |
|
|
|
|
|
|
|
* |
|
|
|
* @param processInstanceId |
|
|
|
* @param processInstanceId |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -503,6 +737,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 定论 |
|
|
|
* 定论 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -511,7 +746,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId()); |
|
|
|
OperPhenomenonEntity entity = this.queryPhenomenon(task.getProcessInstanceId()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤2.更新现象定论信息
|
|
|
|
// 步骤2.更新现象定论信息
|
|
|
|
this.defectConclusionInfo(task,entity.getId()); |
|
|
|
this.defectConclusionInfo(task, entity.getId()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤3.现象加入台账
|
|
|
|
// 步骤3.现象加入台账
|
|
|
|
this.saveDefect(entity); |
|
|
|
this.saveDefect(entity); |
|
|
@ -520,17 +755,19 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
this.updateFaultState(entity.getFaultCode()); |
|
|
|
this.updateFaultState(entity.getFaultCode()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤5.更新缺陷状态 -> 已处理
|
|
|
|
// 步骤5.更新缺陷状态 -> 已处理
|
|
|
|
this.updateDefectHandleState(RepairConstant.COMPLETE_DEFECT_STATE,entity.getDefectCode()); |
|
|
|
this.updateDefectHandleState(RepairConstant.COMPLETE_DEFECT_STATE, entity.getDefectCode()); |
|
|
|
|
|
|
|
|
|
|
|
// 步骤6.缺陷流程->结束
|
|
|
|
// 步骤6.缺陷流程->结束
|
|
|
|
processClient.completeTask(task); |
|
|
|
processClient.completeTask(task); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更新现象定论信息 |
|
|
|
* 更新现象定论信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @param task |
|
|
|
* @param task |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void defectConclusionInfo(ComleteTask task,Long phenomenonId) { |
|
|
|
private void defectConclusionInfo(ComleteTask task, Long phenomenonId) { |
|
|
|
// 获取参数集
|
|
|
|
// 获取参数集
|
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
Map<String, Object> variables = task.getVariables(); |
|
|
|
|
|
|
|
|
|
|
@ -549,6 +786,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 现象加入台账 |
|
|
|
* 现象加入台账 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void saveDefect(OperPhenomenonEntity entity) { |
|
|
|
private void saveDefect(OperPhenomenonEntity entity) { |
|
|
@ -557,7 +795,7 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
OperDefectStatisticsEntity statistics = BeanUtil.copy(entity, OperDefectStatisticsEntity.class); |
|
|
|
OperDefectStatisticsEntity statistics = BeanUtil.copy(entity, OperDefectStatisticsEntity.class); |
|
|
|
// 查询缺陷
|
|
|
|
// 查询缺陷
|
|
|
|
OperDefectEntity defect = this.defectService.getOne(Wrappers.<OperDefectEntity>lambdaUpdate().eq(OperDefectEntity::getDefectCode, entity.getDefectCode())); |
|
|
|
OperDefectEntity defect = this.defectService.getOne(Wrappers.<OperDefectEntity>lambdaUpdate().eq(OperDefectEntity::getDefectCode, entity.getDefectCode())); |
|
|
|
if(ObjectUtil.isEmpty(statistics)){ |
|
|
|
if (ObjectUtil.isEmpty(statistics)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 实际执行时长
|
|
|
|
// 实际执行时长
|
|
|
@ -574,10 +812,11 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 故障状态更新 |
|
|
|
* 故障状态更新 |
|
|
|
|
|
|
|
* |
|
|
|
* @param faultCode |
|
|
|
* @param faultCode |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void updateFaultState(String faultCode) { |
|
|
|
private void updateFaultState(String faultCode) { |
|
|
|
if(StringUtil.isBlank(faultCode)){ |
|
|
|
if (StringUtil.isBlank(faultCode)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
fdpTaskClient.updateFinishStatusByDefectCode(faultCode); |
|
|
|
fdpTaskClient.updateFinishStatusByDefectCode(faultCode); |
|
|
@ -585,15 +824,16 @@ public class DefectCheckServiceImpl extends BaseServiceImpl<OperPhenomenonMapper |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 排除业务中所需属性 避免传入工作流中 |
|
|
|
* 排除业务中所需属性 避免传入工作流中 |
|
|
|
|
|
|
|
* |
|
|
|
* @param variable 工作流传参map |
|
|
|
* @param variable 工作流传参map |
|
|
|
* @param properties 不计入工作流传参的属性 |
|
|
|
* @param properties 不计入工作流传参的属性 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private Map<String,Object> excludeProperties(Map<String,Object> variable,String... properties) { |
|
|
|
private Map<String, Object> excludeProperties(Map<String, Object> variable, String... properties) { |
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
variable.forEach((k,v)->{ |
|
|
|
variable.forEach((k, v) -> { |
|
|
|
if(!Arrays.asList(properties).contains(k)) { |
|
|
|
if (!Arrays.asList(properties).contains(k)) { |
|
|
|
result.put(k,v); |
|
|
|
result.put(k, v); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|