|
|
@@ -10,10 +10,17 @@ import cn.start.tz.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.start.tz.module.pressure2.controller.admin.planscheduling.vo.*;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.acceptorder.AcceptOrderDO;
|
|
|
import cn.start.tz.module.pressure2.dal.dataobject.appointmentconfirmorder.AppointmentConfirmOrderDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.boilerequipoperationrecord.BoilerEquipOperationRecordDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.equipboiler.EquipBoilerDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.equippipe.EquipPipeDO;
|
|
|
+import cn.start.tz.module.pressure2.dal.dataobject.pipeequipmentoperationrecord.PipeEquipmentOperationRecordDO;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.acceptorder.AcceptOrderMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.appointmentconfirmorder.AppointmentConfirmOrderMapper;
|
|
|
+import cn.start.tz.module.pressure2.dal.mysql.boilerequipoperationrecord.BoilerEquipOperationRecordMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.equipboiler.EquipBoilerMapper;
|
|
|
import cn.start.tz.module.pressure2.dal.mysql.equippipe.EquipPipeMapper;
|
|
|
+import cn.start.tz.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
+import cn.start.tz.module.pressure2.dal.mysql.pipeequipmentoperationrecord.PipeEquipmentOperationRecordMapper;
|
|
|
import cn.start.tz.module.system.api.clientunit.ClientUnitApi;
|
|
|
import cn.start.tz.module.system.api.clientunit.dto.ClientUnitDTO;
|
|
|
import cn.start.tz.module.system.api.clientunit.dto.ClientUnitPageDTO;
|
|
|
@@ -21,16 +28,22 @@ import cn.start.tz.module.system.api.dept.DeptApi;
|
|
|
import cn.start.tz.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.start.tz.module.system.api.dict.DictDataApi;
|
|
|
import cn.start.tz.module.system.api.dict.dto.DictDataRespDTO;
|
|
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static cn.start.tz.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
|
|
+
|
|
|
@Service
|
|
|
@Validated
|
|
|
public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
@@ -50,6 +63,14 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
@Resource
|
|
|
private AppointmentConfirmOrderMapper appointmentConfirmOrderMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private BoilerEquipOperationRecordMapper boilerEquipOperationRecordMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private PipeEquipmentOperationRecordMapper pipeEquipOperationRecordMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ObjectMapper objectMapper;
|
|
|
|
|
|
@Resource
|
|
|
private AcceptOrderMapper acceptOrderMapper;
|
|
|
@@ -1611,4 +1632,135 @@ public class PlanSchedulingServiceImpl implements PlanSchedulingService {
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updatePendingInspectionRemark(PendingInspectionRemarkUpdateVO updateVO, Integer equipMainType) {
|
|
|
+ List<String> ids = updateVO.getIds();
|
|
|
+ if (CollUtil.isEmpty(ids)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ String annotatorId = SecurityFrameworkUtils.getLoginUserId();
|
|
|
+ String annotatorName = SecurityFrameworkUtils.getLoginUserNickname();
|
|
|
+ LocalDateTime annotatorDate = LocalDateTime.now();
|
|
|
+
|
|
|
+ // 200-锅炉, 300-管道
|
|
|
+ if (equipMainType == 200) {
|
|
|
+ List<EquipBoilerDO> equipBoilerDOS = equipBoilerMapper.selectByIds(ids);
|
|
|
+ if (CollUtil.isEmpty(equipBoilerDOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ equipBoilerDOS.forEach(boiler -> {
|
|
|
+ EquipBoilerDO updateDO = new EquipBoilerDO();
|
|
|
+ updateDO.setId(boiler.getId());
|
|
|
+ updateDO.setPendingInspectionRemark(updateVO.getPendingInspectionRemark());
|
|
|
+ updateDO.setAnnotatorId(annotatorId);
|
|
|
+ updateDO.setAnnotatorName(annotatorName);
|
|
|
+ updateDO.setAnnotatorDate(annotatorDate);
|
|
|
+ equipBoilerMapper.updateById(updateDO);
|
|
|
+ });
|
|
|
+ } else if (equipMainType == 300) {
|
|
|
+ List<EquipPipeDO> equipPipeDOS = equipPipeMapper.selectByIds(ids);
|
|
|
+ if (CollUtil.isEmpty(equipPipeDOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ equipPipeDOS.forEach(pipe -> {
|
|
|
+ EquipPipeDO updateDO = new EquipPipeDO();
|
|
|
+ updateDO.setId(pipe.getId());
|
|
|
+ updateDO.setPendingInspectionRemark(updateVO.getPendingInspectionRemark());
|
|
|
+ updateDO.setAnnotatorId(annotatorId);
|
|
|
+ updateDO.setAnnotatorName(annotatorName);
|
|
|
+ updateDO.setAnnotatorDate(annotatorDate);
|
|
|
+ equipPipeMapper.updateById(updateDO);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateEquipContactBatch(ContactUpdateVO contactUpdateVO, Integer equipMainType) {
|
|
|
+ List<String> ids = contactUpdateVO.getIds();
|
|
|
+ if (CollUtil.isEmpty(ids)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 200-锅炉, 300-管道
|
|
|
+ if (equipMainType == 200) {
|
|
|
+ List<EquipBoilerDO> equipBoilerDOS = equipBoilerMapper.selectByIds(ids);
|
|
|
+ if (CollUtil.isEmpty(equipBoilerDOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ equipBoilerDOS.forEach(boiler -> {
|
|
|
+
|
|
|
+ EquipBoilerDO equipBoilerDO = new EquipBoilerDO();
|
|
|
+ equipBoilerDO.setId(boiler.getId());
|
|
|
+ equipBoilerDO.setContact(contactUpdateVO.getContact());
|
|
|
+ equipBoilerDO.setContactPhone(contactUpdateVO.getContactPhone());
|
|
|
+
|
|
|
+ equipBoilerMapper.updateById(equipBoilerDO);
|
|
|
+
|
|
|
+ // 之前的记录数
|
|
|
+ Long count = boilerEquipOperationRecordMapper.selectCount(BoilerEquipOperationRecordDO::getEquipCode, boiler.getEquipCode());
|
|
|
+ String beforeJson = null;
|
|
|
+ String afterJson = null;
|
|
|
+ try {
|
|
|
+ beforeJson = objectMapper.writeValueAsString(boiler);
|
|
|
+ boiler.setContact(contactUpdateVO.getContact());
|
|
|
+ boiler.setContactPhone(contactUpdateVO.getContactPhone());
|
|
|
+ afterJson = objectMapper.writeValueAsString(boiler);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ throw exception0(900, e.getMessage());
|
|
|
+ }
|
|
|
+ BoilerEquipOperationRecordDO record = new BoilerEquipOperationRecordDO();
|
|
|
+ record.setVersion(boiler.getEquipCode() + "-" + (count + 1));
|
|
|
+ record.setType(100);
|
|
|
+ record.setReason("人工修改");
|
|
|
+
|
|
|
+ record.setEquipId(boiler.getId());
|
|
|
+ record.setEquipCode(boiler.getEquipCode());
|
|
|
+ record.setBeforeJson(beforeJson);
|
|
|
+ record.setAfterJson(afterJson);
|
|
|
+ boilerEquipOperationRecordMapper.insert(record);
|
|
|
+
|
|
|
+ });
|
|
|
+ } else if (equipMainType == 300) {
|
|
|
+ List<EquipPipeDO> equipPipeDOS = equipPipeMapper.selectByIds(ids);
|
|
|
+ if (CollUtil.isEmpty(equipPipeDOS)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ equipPipeDOS.forEach(pipe -> {
|
|
|
+
|
|
|
+ EquipPipeDO equipPipeDO = new EquipPipeDO();
|
|
|
+ equipPipeDO.setId(pipe.getId());
|
|
|
+ equipPipeDO.setContact(contactUpdateVO.getContact());
|
|
|
+ equipPipeDO.setContactPhone(contactUpdateVO.getContactPhone());
|
|
|
+
|
|
|
+ equipPipeMapper.updateById(equipPipeDO);
|
|
|
+
|
|
|
+ // 之前的记录数
|
|
|
+ Long count = pipeEquipOperationRecordMapper.selectCount(PipeEquipmentOperationRecordDO::getProjectNo, pipe.getProjectNo());
|
|
|
+ String beforeJson = null;
|
|
|
+ String afterJson = null;
|
|
|
+ try {
|
|
|
+ beforeJson = objectMapper.writeValueAsString(pipe);
|
|
|
+ pipe.setContact(contactUpdateVO.getContact());
|
|
|
+ pipe.setContactPhone(contactUpdateVO.getContactPhone());
|
|
|
+ afterJson = objectMapper.writeValueAsString(pipe);
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ throw exception0(900, e.getMessage());
|
|
|
+ }
|
|
|
+ PipeEquipmentOperationRecordDO record = new PipeEquipmentOperationRecordDO();
|
|
|
+ record.setVersion(pipe.getProjectNo() + "-" + (count + 1));
|
|
|
+// record.set(100);
|
|
|
+ record.setReason("人工修改");
|
|
|
+
|
|
|
+ record.setPipeId(pipe.getId());
|
|
|
+ record.setProjectNo(pipe.getProjectNo());
|
|
|
+ record.setBeforeJson(beforeJson);
|
|
|
+ record.setAfterJson(afterJson);
|
|
|
+ pipeEquipOperationRecordMapper.insert(record);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|