diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/inspection/InspectionInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/inspection/InspectionInfoServiceImpl.java index d51ac94..6290d87 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/inspection/InspectionInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/inspection/InspectionInfoServiceImpl.java @@ -78,6 +78,7 @@ public class InspectionInfoServiceImpl implements InspectionInfoService { @Override @TenantIgnore + @Transactional public String createInspectionInfo(InspectionInfoSaveReqVO createReqVO) { // 插入 InspectionInfoDO inspectionInfo = BeanUtils.toBean(createReqVO, InspectionInfoDO.class); @@ -110,12 +111,24 @@ public class InspectionInfoServiceImpl implements InspectionInfoService { @Override @TenantIgnore + @Transactional public void updateInspectionInfo(InspectionInfoSaveReqVO updateReqVO) { // 校验存在 - validateInspectionInfoExists(updateReqVO.getInspectionId()); + InspectionInfoDO validateInfo = validateInspectionInfoExists(updateReqVO.getInspectionId()); // 更新 InspectionInfoDO updateObj = BeanUtils.toBean(updateReqVO, InspectionInfoDO.class); inspectionInfoMapper.updateById(updateObj); + //消息推送 + NotifyMessageDO noticeMessageDO = new NotifyMessageDO() + .setOrderId(updateObj.getInspectionId()) + .setTitle("新增定制化点检工单通知") + .setContent("您有一个新的定制化点检工单,请及时处理!") + .setType(NoticeType.INSPECTION_ORDER) + .setReadStatus(false) + .setUserId(SecurityFrameworkUtils.getLoginUserId()) + .setTemplateNickname(SecurityFrameworkUtils.getLoginUserNickname()) + .setTenantId(validateInfo.getTenantId()); + notifyMessageService.createNotifyMessage(noticeMessageDO); } @Override @@ -129,10 +142,12 @@ public class InspectionInfoServiceImpl implements InspectionInfoService { inspectionFeedbackService.deleteByInspectionId(id); } - private void validateInspectionInfoExists(String id) { - if (inspectionInfoMapper.selectById(id) == null) { + private InspectionInfoDO validateInspectionInfoExists(String id) { + InspectionInfoDO inspectionInfo = inspectionInfoMapper.selectById(id); + if (inspectionInfo == null) { throw exception(INSPECTION_INFO_NOT_EXISTS); } + return inspectionInfo; } @Override