|
|
@ -51,11 +51,6 @@ public class DistributeWorkOrderServiceImpl implements IDistributeWorkOrderServi |
|
|
|
private final IOperPhenomenonService operPhenomenonService; |
|
|
|
private final IOperPhenomenonService operPhenomenonService; |
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
|
|
|
|
|
|
|
|
@Value("${url.water-out.orderCrtPackage}") |
|
|
|
|
|
|
|
private String orderCrtPackageUrl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${url.water-out.orderCrtGrabPackage}") |
|
|
|
|
|
|
|
private String orderCrtGrabPackageUrl; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${hzims.operation.workOrder.access}") |
|
|
|
@Value("${hzims.operation.workOrder.access}") |
|
|
|
private String accessWorkOrderKey; |
|
|
|
private String accessWorkOrderKey; |
|
|
@ -63,152 +58,6 @@ public class DistributeWorkOrderServiceImpl implements IDistributeWorkOrderServi |
|
|
|
@Value("${hzims.operation.workOrder.defect}") |
|
|
|
@Value("${hzims.operation.workOrder.defect}") |
|
|
|
private String defectWorkOrderKey; |
|
|
|
private String defectWorkOrderKey; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R distributeAccessTask(OperAccessTaskEntity operAccessTaskEntity){ |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(operAccessTaskEntity)){ |
|
|
|
|
|
|
|
return R.fail("暂无检修记录!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
OrderPackageDto orderPackageDto = new OrderPackageDto(); |
|
|
|
|
|
|
|
orderPackageDto.setCreater(AuthUtil.getUser().getUserName()); |
|
|
|
|
|
|
|
orderPackageDto.setFloatRange("1"); |
|
|
|
|
|
|
|
orderPackageDto.setProjectCost(0); |
|
|
|
|
|
|
|
/*结束时间需大于当前时间*/ |
|
|
|
|
|
|
|
orderPackageDto.setFinishTime(DateUtil.format(LocalDateTime.now().plusHours(5),DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
orderPackageDto.setProjectCode(operAccessTaskEntity.getId().toString()); |
|
|
|
|
|
|
|
orderPackageDto.setProjectName(operAccessTaskEntity.getName()); |
|
|
|
|
|
|
|
Publisher publisher = new Publisher(); |
|
|
|
|
|
|
|
publisher.setId(operAccessTaskEntity.getCreateUser().toString()); |
|
|
|
|
|
|
|
User user = UserCache.getUser(operAccessTaskEntity.getCreateUser()); |
|
|
|
|
|
|
|
publisher.setContactAddress("123123"); |
|
|
|
|
|
|
|
publisher.setContactName("123123"); |
|
|
|
|
|
|
|
publisher.setContactPhone(user.getPhone()); |
|
|
|
|
|
|
|
publisher.setPublisher(user.getRealName()); |
|
|
|
|
|
|
|
publisher.setPublisherScale("123123"); |
|
|
|
|
|
|
|
orderPackageDto.setPublisher(publisher); |
|
|
|
|
|
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
orderPackageDto.setStartTime(fmt.format(operAccessTaskEntity.getPlanStartTime())); |
|
|
|
|
|
|
|
orderPackageDto.setWaterId(operAccessTaskEntity.getCreateDept().toString()); |
|
|
|
|
|
|
|
//完善招标信息
|
|
|
|
|
|
|
|
List<TenderDto> tenderList = new ArrayList<>(); |
|
|
|
|
|
|
|
TenderDto tenderDto = new TenderDto(); |
|
|
|
|
|
|
|
//采用大修工单
|
|
|
|
|
|
|
|
tenderDto.setOrderType("6"); |
|
|
|
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
|
|
|
|
LocalDateTime planStartTime = LocalDateTime.ofInstant(operAccessTaskEntity.getPlanStartTime().toInstant(),zoneId); |
|
|
|
|
|
|
|
LocalDateTime planEndTime = LocalDateTime.ofInstant(operAccessTaskEntity.getPlanEndTime().toInstant(),zoneId); |
|
|
|
|
|
|
|
Long workHours = Duration.between(planStartTime,planEndTime).toHours(); |
|
|
|
|
|
|
|
tenderDto.setWorkHours(workHours.intValue()); |
|
|
|
|
|
|
|
tenderDto.setWorkPrice("0"); |
|
|
|
|
|
|
|
//大修工单内容
|
|
|
|
|
|
|
|
List<OtherOrderDTO> overhaulOrderList = new ArrayList<>(); |
|
|
|
|
|
|
|
OtherOrderDTO overHaulOrder = new OtherOrderDTO(); |
|
|
|
|
|
|
|
overHaulOrder.setOrderType("6"); |
|
|
|
|
|
|
|
overHaulOrder.setWorkCode(operAccessTaskEntity.getCode()); |
|
|
|
|
|
|
|
overHaulOrder.setTenantId(operAccessTaskEntity.getTenantId()); |
|
|
|
|
|
|
|
overHaulOrder.setWorkHour(workHours.intValue()); |
|
|
|
|
|
|
|
overHaulOrder.setWorkName(operAccessTaskEntity.getName()); |
|
|
|
|
|
|
|
EmInfoEntity emInfoEntity = emInfoClient.getByCode(operAccessTaskEntity.getEmCode()); |
|
|
|
|
|
|
|
overHaulOrder.setWorkPos(Optional.ofNullable(emInfoEntity).map(EmInfoEntity::getName).orElse(null)); |
|
|
|
|
|
|
|
overHaulOrder.setWorkTime(DateUtil.format(operAccessTaskEntity.getPlanStartTime(),DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
overhaulOrderList.add(overHaulOrder); |
|
|
|
|
|
|
|
tenderDto.setOverhaulOrderList(overhaulOrderList); |
|
|
|
|
|
|
|
tenderList.add(tenderDto); |
|
|
|
|
|
|
|
orderPackageDto.setTenderList(tenderList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("-------------------------------------派发工单对象为-------------------------------------"); |
|
|
|
|
|
|
|
log.info(JSON.toJSONString(orderPackageDto)); |
|
|
|
|
|
|
|
HttpResponse httpResponse = HttpClientUtils.post(orderCrtPackageUrl, JSONObject.toJSONString(orderPackageDto)); |
|
|
|
|
|
|
|
if(httpResponse.getCode() == 200){ |
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(httpResponse.getData()); |
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
|
|
String id = JSONObject.parseObject(jsonObject.getString("data")).getString("id"); |
|
|
|
|
|
|
|
//将工单处理结果暂存入redis中
|
|
|
|
|
|
|
|
// long maxSize = redisTemplate.opsForZSet().zCard(accessWorkOrderKey);
|
|
|
|
|
|
|
|
// redisTemplate.opsForZSet().add(accessWorkOrderKey,id, maxSize > 0 ? (maxSize - 1) : 0L);
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception e){ |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return R.data("调用成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R distributeDefectTask(OperDefectEntity operDefectEntity){ |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(operDefectEntity)){ |
|
|
|
|
|
|
|
return R.fail("暂无消缺单记录!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
GrabPackageDTO grabPackageDTO = new GrabPackageDTO(); |
|
|
|
|
|
|
|
grabPackageDTO.setCreateUser(AuthUtil.getUser().getUserName()); |
|
|
|
|
|
|
|
grabPackageDTO.setFinishTime(DateUtil.format(LocalDateTime.now().plusHours(8),DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
List<RepairOrderAcptDto> repairOrderAcptDtos = new ArrayList<>(); |
|
|
|
|
|
|
|
RepairOrderAcptDto repairOrderAcptDto = new RepairOrderAcptDto(); |
|
|
|
|
|
|
|
//完善工单内容
|
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(operDefectEntity.getDefectCode())){ |
|
|
|
|
|
|
|
//根据现象、缺陷编码获取现象
|
|
|
|
|
|
|
|
OperPhenomenonEntity operPhenomenonEntity = operPhenomenonService.getOne(new LambdaQueryWrapper<OperPhenomenonEntity>(){{ |
|
|
|
|
|
|
|
eq(OperPhenomenonEntity::getDefectCode,operDefectEntity.getDefectCode()); |
|
|
|
|
|
|
|
}}.last("limit 1")); |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(operPhenomenonEntity)){ |
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(operPhenomenonEntity.getEmCode())){ |
|
|
|
|
|
|
|
repairOrderAcptDto.setEquCode(operPhenomenonEntity.getEmCode()); |
|
|
|
|
|
|
|
EmInfoEntity emInfoEntity = emInfoClient.getByCode(operPhenomenonEntity.getEmCode()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setEquName(Optional.ofNullable(emInfoEntity).map(EmInfoEntity::getName).orElse(null)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(StringUtil.isNotBlank(operPhenomenonEntity.getFaultCode())){ |
|
|
|
|
|
|
|
List<RepairOrderContentDTO> contentDTOList = new ArrayList<>(); |
|
|
|
|
|
|
|
RepairOrderContentDTO repairOrderContentDTO = new RepairOrderContentDTO(); |
|
|
|
|
|
|
|
repairOrderContentDTO.setFaultCode(operPhenomenonEntity.getFaultCode()); |
|
|
|
|
|
|
|
repairOrderContentDTO.setFaultName(operPhenomenonEntity.getFaultName()); |
|
|
|
|
|
|
|
contentDTOList.add(repairOrderContentDTO); |
|
|
|
|
|
|
|
repairOrderAcptDto.setContentList(contentDTOList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
|
|
String startTime = Optional.ofNullable(operDefectEntity.getActStartTime()).map(time->fmt.format(time)).orElse(null); |
|
|
|
|
|
|
|
repairOrderAcptDto.setStartTime(startTime); |
|
|
|
|
|
|
|
R<Dept> deptR = sysClient.getDept(operDefectEntity.getCreateDept()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setEquType("010101"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setOrgName("长沙敢胜院"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setCreateUser(operDefectEntity.getCreateUser().toString()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setTenantId(operDefectEntity.getTenantId()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setWorkTime(DateUtil.format(operDefectEntity.getActStartTime(),DateUtil.PATTERN_DATETIME)); |
|
|
|
|
|
|
|
repairOrderAcptDto.setFaultDisp("捞渣、清渣装置故障"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setInstallPos("粗格栅间"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setIsBallot(0); |
|
|
|
|
|
|
|
repairOrderAcptDto.setUserName(UserCache.getUser(operDefectEntity.getCreateUser()).getName()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setIsMajorRepairs("一般维修"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setRepairType("general_repair"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setSeverity("严重"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setSpecModel("GL1400"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setTimeLimit("6.00"); |
|
|
|
|
|
|
|
repairOrderAcptDto.setWorkCode(operDefectEntity.getId().toString()); |
|
|
|
|
|
|
|
repairOrderAcptDto.setWorkPrice(0); |
|
|
|
|
|
|
|
repairOrderAcptDto.setWorkRatio(1); |
|
|
|
|
|
|
|
repairOrderAcptDto.setWorkHour(4); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<RepairOrderPrognosisDTO> repairOrderPrognosisDTOS = new ArrayList<>(); |
|
|
|
|
|
|
|
RepairOrderPrognosisDTO repairOrderPrognosisDTO = new RepairOrderPrognosisDTO(); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setCause("测试..."); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setDescribeContent("测试..."); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setProjectCode("test0000001"); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setProjectContent("测试...."); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setProjectName("测试..."); |
|
|
|
|
|
|
|
repairOrderPrognosisDTO.setWorkHour("4.00"); |
|
|
|
|
|
|
|
repairOrderPrognosisDTOS.add(repairOrderPrognosisDTO); |
|
|
|
|
|
|
|
repairOrderAcptDto.setPrognosisList(repairOrderPrognosisDTOS); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repairOrderAcptDtos.add(repairOrderAcptDto); |
|
|
|
|
|
|
|
grabPackageDTO.setRepairOrderAcptDtos(repairOrderAcptDtos); |
|
|
|
|
|
|
|
log.info("-------------------------------------派发消缺单对象为-------------------------------------"); |
|
|
|
|
|
|
|
log.info(JSON.toJSONString(grabPackageDTO)); |
|
|
|
|
|
|
|
HttpResponse httpResponse = HttpClientUtils.post(orderCrtGrabPackageUrl, JSONObject.toJSONString(grabPackageDTO)); |
|
|
|
|
|
|
|
//将工单处理结果暂存入redis中
|
|
|
|
|
|
|
|
long maxSize = redisTemplate.opsForZSet().zCard(defectWorkOrderKey); |
|
|
|
|
|
|
|
//redisTemplate.opsForZSet().add(defectWorkOrderKey,"", maxSize > 0 ? (maxSize - 1) : 0L);
|
|
|
|
|
|
|
|
return R.data("调用成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public R getAccessWorkOrderList(){ |
|
|
|
public R getAccessWorkOrderList(){ |
|
|
|