|
@@ -1,9 +1,12 @@
|
|
|
package com.rongwei.bscommon.sys.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.rongwei.bscommon.sys.feign.SysNotifyFeginService;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionDispatchService;
|
|
|
import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionOperLogService;
|
|
|
import com.rongwei.bscommon.sys.utils.ZhcxCommon;
|
|
@@ -13,8 +16,10 @@ import com.rongwei.bscommon.sys.service.ZhcxInsideInspectionService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bsentity.dto.InsideInspectionOperRequest;
|
|
|
import com.rongwei.bsentity.dto.InsideOperLogDto;
|
|
|
+import com.rongwei.bsentity.dto.NotifyDto;
|
|
|
import com.rongwei.bsentity.dto.OperDto;
|
|
|
import com.rongwei.bsentity.dto.inside.*;
|
|
|
+import com.rongwei.bsentity.vo.OperOutsideInspectionVo;
|
|
|
import com.rongwei.commonservice.serial.service.SysSerialNumberService;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysRoleDo;
|
|
|
import com.rongwei.rwadmincommon.system.domain.SysUserDo;
|
|
@@ -24,6 +29,7 @@ import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
+import com.rongwei.rwcommon.vo.MailDo;
|
|
|
import com.rongwei.rwcommon.vo.generalsql.MasterSlaveUpdateVo;
|
|
|
import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -107,7 +113,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
List<String> msgList = new ArrayList<>();
|
|
|
List<ZhcxInsideInspectionDispatchDo> dispatchList = new ArrayList<>();
|
|
|
List<ZhcxInsideInspectionDo> inspectionList = new ArrayList<>();
|
|
|
- List<ZhcxInsideInspectionOperLogDo> logList = new ArrayList<>();
|
|
|
+ List<NotifyDto> notifyList = new ArrayList<>();
|
|
|
|
|
|
for(String insideId : req.getInsideIdList()) {
|
|
|
InsideOperDto inOper = getInsideOperDto(insideId);
|
|
@@ -151,6 +157,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
inside.setId(insideId);
|
|
|
inside.setInspectionstatus("40");
|
|
|
inspectionList.add(inside);
|
|
|
+
|
|
|
+ NotifyDto notify = getMailInfo4Cancel(inOper, req);
|
|
|
+ notifyList.add(notify);
|
|
|
}
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(msgList)) {
|
|
@@ -164,6 +173,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
|
|
|
//操作日志
|
|
|
operLogService.saveOperLog(req, operDto, Collections.emptyMap());
|
|
|
+
|
|
|
+ //发送提醒
|
|
|
+ zhcxCommon.sendMsg(notifyList);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -331,13 +343,92 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
}
|
|
|
|
|
|
OperDto operDto = getOper("70");
|
|
|
+ Map<String, String> descMap = new HashMap<>();
|
|
|
|
|
|
for(String inside : req.getInsideIdList()) {
|
|
|
- reInspection(inside, req.getMap().get(inside));
|
|
|
+ List<String> editList = reInspection(inside, req.getMap().get(inside));
|
|
|
+ if(ObjectUtil.isNotEmpty(editList)) {
|
|
|
+ descMap.put(inside, StringUtils.join(editList, "; "));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//添加日志
|
|
|
- operLogService.saveOperLog(req, operDto, Collections.emptyMap());
|
|
|
+ operLogService.saveOperLog(req, operDto, descMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改记录
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void addModifyHistory(InsideInspectionModifyRecordRequest req) {
|
|
|
+ if(ObjectUtil.isEmpty(req.getInsideIdList())) {
|
|
|
+ throw new CustomException("请联系管理员,暂无报验单");
|
|
|
+ }
|
|
|
+
|
|
|
+ OperDto operDto = getOper("80");
|
|
|
+ Map<String, String> descMap = new HashMap<>();
|
|
|
+
|
|
|
+ for(String inside : req.getInsideIdList()) {
|
|
|
+ ZhcxInsideInspectionDo insideObj = getById(inside);
|
|
|
+ List<String> editList = editColsHistory(insideObj, req.getMap().get(inside));
|
|
|
+ if(ObjectUtil.isNotEmpty(editList)) {
|
|
|
+ descMap.put(inside, StringUtils.join(editList, "; "));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //添加日志
|
|
|
+ operLogService.saveOperLog(req, operDto, descMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取取消发送邮件内容
|
|
|
+ *
|
|
|
+ * @param operDto
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private NotifyDto getMailInfo4Cancel(InsideOperDto operDto, InsideInspectionRequest req) {
|
|
|
+ NotifyDto notifyDto = NotifyDto.builder()
|
|
|
+ .subject("取消报验提醒")
|
|
|
+ .build();
|
|
|
+
|
|
|
+ List<String> userList = new ArrayList<>();
|
|
|
+
|
|
|
+ StringBuilder msg = new StringBuilder();
|
|
|
+ msg.append("取消报验提醒:您好,报验单编号【");
|
|
|
+ msg.append(operDto.getInspection().getInspectioncode());
|
|
|
+
|
|
|
+ //自检员取消
|
|
|
+ if("self".equals(req.getPageType())) {
|
|
|
+ msg.append("】已被自检员【");
|
|
|
+ msg.append(operDto.getInspection().getSelftester());
|
|
|
+ msg.append("】取消,联系方式:【");
|
|
|
+ msg.append(operDto.getInspection().getSelftestercontact());
|
|
|
+
|
|
|
+ //通知检验员
|
|
|
+ userList.add(operDto.getDispatch().getSupervisionid());
|
|
|
+ }
|
|
|
+ //检验员取消
|
|
|
+ else if("execute".equals(req.getPageType())) {
|
|
|
+ msg.append("】已被检验员【");
|
|
|
+ msg.append(operDto.getDispatch().getSupervision());
|
|
|
+ msg.append("】取消,联系方式:【");
|
|
|
+ msg.append(operDto.getDispatch().getSupervisionphone());
|
|
|
+
|
|
|
+ //通知自检员
|
|
|
+ userList.add(operDto.getInspection().getSelftesterid());
|
|
|
+ }
|
|
|
+
|
|
|
+ msg.append("】取消原因:【");
|
|
|
+ msg.append(req.getReason());
|
|
|
+ msg.append("】,请知悉。");
|
|
|
+
|
|
|
+ notifyDto.setContent(msg.toString());
|
|
|
+ notifyDto.setReceiverIds(userList);
|
|
|
+
|
|
|
+ return notifyDto;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -350,7 +441,7 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
* @param id
|
|
|
* @param masterSlaveUpdate
|
|
|
*/
|
|
|
- private void reInspection(String id, MasterSlaveUpdateVo masterSlaveUpdate) {
|
|
|
+ private List<String> reInspection(String id, MasterSlaveUpdateVo masterSlaveUpdate) {
|
|
|
ZhcxInsideInspectionDo inside = getById(id);
|
|
|
if("99".equals(inside.getLifecycle())) {
|
|
|
throw new CustomException("该报验单不能再次报验");
|
|
@@ -365,6 +456,9 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
|
|
|
//保存新的报验单
|
|
|
saveReNew(inside, dispatch, masterSlaveUpdate);
|
|
|
+
|
|
|
+ //修改字段
|
|
|
+ return editColsHistory(inside, masterSlaveUpdate);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -402,6 +496,198 @@ public class ZhcxInsideInspectionServiceImpl extends ServiceImpl<ZhcxInsideInspe
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改字段历史
|
|
|
+ *
|
|
|
+ * @param oldInside
|
|
|
+ * @param masterSlaveUpdate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<String> editColsHistory(ZhcxInsideInspectionDo oldInside, MasterSlaveUpdateVo masterSlaveUpdate) {
|
|
|
+
|
|
|
+ List<String> editDataList = new ArrayList<>();
|
|
|
+
|
|
|
+ Map<String, Object> updatecolumns = masterSlaveUpdate.getMasterUpdate().getUpdatecolumns();
|
|
|
+ //预约报验时间
|
|
|
+// if(ObjectUtil.isNotEmpty(updatecolumns.get("RESERVATIONINSPECTIONTIME"))) {
|
|
|
+// String reservationinspectiontime = updatecolumns.get("RESERVATIONINSPECTIONTIME").toString();
|
|
|
+// if(reservationinspectiontime.split(":").length == 3) {
|
|
|
+//
|
|
|
+// }
|
|
|
+// }
|
|
|
+ String reTime = DateUtil.format(oldInside.getReservationinspectiontime(), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ if(ObjectUtil.isNotNull(reTime)
|
|
|
+ && ObjectUtil.isNotNull(updatecolumns.get("RESERVATIONINSPECTIONTIME"))) {
|
|
|
+ if(!reTime.equals(updatecolumns.get("RESERVATIONINSPECTIONTIME").toString())) {
|
|
|
+ String reservationinspectiontime = StrUtil.concat(true, "预约报验时间:"
|
|
|
+ , DateUtil.format(oldInside.getReservationinspectiontime(), "yyyy-MM-dd HH:mm")
|
|
|
+ , " 变更为:"
|
|
|
+ , updatecolumns.get("RESERVATIONINSPECTIONTIME").toString()
|
|
|
+ );
|
|
|
+ editDataList.add(reservationinspectiontime);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else if(ObjectUtil.isNotNull(reTime)) {
|
|
|
+ if(!reTime.equals(updatecolumns.get("RESERVATIONINSPECTIONTIME").toString())) {
|
|
|
+ String reservationinspectiontime = StrUtil.concat(true, "预约报验时间:"
|
|
|
+ , DateUtil.format(oldInside.getReservationinspectiontime(), "yyyy-MM-dd HH:mm")
|
|
|
+ , " 变更为:"
|
|
|
+ );
|
|
|
+ editDataList.add(reservationinspectiontime);
|
|
|
+ }
|
|
|
+ } else if(ObjectUtil.isNotNull(updatecolumns.get("RESERVATIONINSPECTIONTIME"))) {
|
|
|
+ if(!updatecolumns.get("RESERVATIONINSPECTIONTIME").toString().equals(reTime)) {
|
|
|
+ String reservationinspectiontime = StrUtil.concat(true, "预约报验时间:"
|
|
|
+ , " 变更为:"
|
|
|
+ , updatecolumns.get("RESERVATIONINSPECTIONTIME").toString()
|
|
|
+ );
|
|
|
+ editDataList.add(reservationinspectiontime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //项目工号
|
|
|
+ if(!oldInside.getProjectcode().equals(updatecolumns.get("PROJECTCODE").toString())) {
|
|
|
+ String projectcode = StrUtil.concat(true, "项目工号:", oldInside.getProjectcode()
|
|
|
+ , " 变更为:", updatecolumns.get("PROJECTCODE").toString());
|
|
|
+ editDataList.add(projectcode);
|
|
|
+ }
|
|
|
+
|
|
|
+ //总装机号
|
|
|
+ String machineno = null;
|
|
|
+ //同时不为空
|
|
|
+ if(ObjectUtil.isNotEmpty(oldInside.getMachineno())
|
|
|
+ && ObjectUtil.isNotEmpty(updatecolumns.get("MACHINENO")) ) {
|
|
|
+ if(!oldInside.getMachineno().equals(updatecolumns.get("MACHINENO"))) {
|
|
|
+ machineno = StrUtil.concat(true, "总装机号:", oldInside.getMachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("MACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //旧数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(oldInside.getMachineno())) {
|
|
|
+ if(!oldInside.getMachineno().equals(updatecolumns.get("MACHINENO"))) {
|
|
|
+ machineno = StrUtil.concat(true, "总装机号:", oldInside.getMachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("MACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(updatecolumns.get("MACHINENO"))) {
|
|
|
+ if(!updatecolumns.get("MACHINENO").toString().equals(oldInside.getMachineno())) {
|
|
|
+ machineno = StrUtil.concat(true, "总装机号:", oldInside.getMachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("MACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(machineno)) {
|
|
|
+ editDataList.add(machineno);
|
|
|
+ }
|
|
|
+
|
|
|
+ //结构机号
|
|
|
+ String structuremachineno = null;
|
|
|
+ //同时不为空
|
|
|
+ if(ObjectUtil.isNotEmpty(oldInside.getStructuremachineno())
|
|
|
+ && ObjectUtil.isNotEmpty(updatecolumns.get("STRUCTUREMACHINENO")) ) {
|
|
|
+ if(!oldInside.getStructuremachineno().equals(updatecolumns.get("STRUCTUREMACHINENO"))) {
|
|
|
+ structuremachineno = StrUtil.concat(true, "结构机号:", oldInside.getStructuremachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("STRUCTUREMACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //旧数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(oldInside.getStructuremachineno())) {
|
|
|
+ if(!oldInside.getStructuremachineno().equals(updatecolumns.get("STRUCTUREMACHINENO"))) {
|
|
|
+ structuremachineno = StrUtil.concat(true, "结构机号:", oldInside.getStructuremachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("STRUCTUREMACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(updatecolumns.get("STRUCTUREMACHINENO"))) {
|
|
|
+ if(!updatecolumns.get("STRUCTUREMACHINENO").toString().equals(oldInside.getStructuremachineno())) {
|
|
|
+ structuremachineno = StrUtil.concat(true, "结构机号:", oldInside.getStructuremachineno()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("STRUCTUREMACHINENO"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(structuremachineno)) {
|
|
|
+ editDataList.add(structuremachineno);
|
|
|
+ }
|
|
|
+
|
|
|
+ //构件名称
|
|
|
+ if(!oldInside.getStructurename().equals(updatecolumns.get("STRUCTURENAME").toString())) {
|
|
|
+ String structurename = StrUtil.concat(true, "构件名称:", oldInside.getStructurename()
|
|
|
+ , " 变更为:", updatecolumns.get("STRUCTURENAME").toString());
|
|
|
+ editDataList.add(structurename);
|
|
|
+ }
|
|
|
+
|
|
|
+ //报验内容
|
|
|
+ if(!oldInside.getInspectioncontent().equals(updatecolumns.get("INSPECTIONCONTENT").toString())) {
|
|
|
+ String structurename = StrUtil.concat(true, "报验内容:", oldInside.getInspectioncontent()
|
|
|
+ , " 变更为:", updatecolumns.get("INSPECTIONCONTENT").toString());
|
|
|
+ editDataList.add(structurename);
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查地点
|
|
|
+ if(!oldInside.getInspectionlocation().equals(updatecolumns.get("INSPECTIONLOCATION").toString())) {
|
|
|
+ String structurename = StrUtil.concat(true, "检查地点:", oldInside.getInspectionlocation()
|
|
|
+ , " 变更为:", updatecolumns.get("INSPECTIONLOCATION").toString());
|
|
|
+ editDataList.add(structurename);
|
|
|
+ }
|
|
|
+
|
|
|
+ //检查地点补充
|
|
|
+ String inspectionlocationsupplement = null;
|
|
|
+ //同时不为空
|
|
|
+ if(ObjectUtil.isNotEmpty(oldInside.getInspectionlocationsupplement())
|
|
|
+ && ObjectUtil.isNotEmpty(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT")) ) {
|
|
|
+ if(!oldInside.getInspectionlocationsupplement().equals(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"))) {
|
|
|
+ inspectionlocationsupplement = StrUtil.concat(true, "检查地点补充:", oldInside.getInspectionlocationsupplement()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //旧数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(oldInside.getInspectionlocationsupplement())) {
|
|
|
+ if(!oldInside.getInspectionlocationsupplement().equals(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"))) {
|
|
|
+ inspectionlocationsupplement = StrUtil.concat(true, "检查地点补充:", oldInside.getInspectionlocationsupplement()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"))) {
|
|
|
+ if(!updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT").toString().equals(oldInside.getInspectionlocationsupplement())) {
|
|
|
+ inspectionlocationsupplement = StrUtil.concat(true, "检查地点补充:", oldInside.getInspectionlocationsupplement()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("INSPECTIONLOCATIONSUPPLEMENT"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(inspectionlocationsupplement)) {
|
|
|
+ editDataList.add(inspectionlocationsupplement);
|
|
|
+ }
|
|
|
+
|
|
|
+ //备注
|
|
|
+ String remark = null;
|
|
|
+ //同时不为空
|
|
|
+ if(ObjectUtil.isNotEmpty(oldInside.getRemark())
|
|
|
+ && ObjectUtil.isNotEmpty(updatecolumns.get("REMARK")) ) {
|
|
|
+ if(!oldInside.getRemark().equals(updatecolumns.get("REMARK"))) {
|
|
|
+ remark = StrUtil.concat(true, "备注:", oldInside.getRemark()
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("REMARK"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //旧数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(oldInside.getRemark())) {
|
|
|
+ if(!oldInside.getRemark().equals(updatecolumns.get("REMARK"))) {
|
|
|
+ remark = StrUtil.concat(true, "备注:", oldInside.getRemark()
|
|
|
+ , " 变更为: ");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //新数据不为空
|
|
|
+ else if(ObjectUtil.isNotEmpty(updatecolumns.get("REMARK"))) {
|
|
|
+ if(!updatecolumns.get("REMARK").equals(oldInside.getRemark())) {
|
|
|
+ remark = StrUtil.concat(true, "备注: "
|
|
|
+ , " 变更为:", StringUtils.toString(updatecolumns.get("REMARK"), ""));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(ObjectUtil.isNotNull(remark)) {
|
|
|
+ editDataList.add(remark);
|
|
|
+ }
|
|
|
+
|
|
|
+ return editDataList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成新的编码
|
|
|
*
|