定制化点检消息推送功能更新

This commit is contained in:
zhangjunwen 2024-11-07 09:24:38 +08:00
parent af585ecb17
commit f8f4bd3eb5

View File

@ -78,6 +78,7 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
@Override @Override
@TenantIgnore @TenantIgnore
@Transactional
public String createInspectionInfo(InspectionInfoSaveReqVO createReqVO) { public String createInspectionInfo(InspectionInfoSaveReqVO createReqVO) {
// 插入 // 插入
InspectionInfoDO inspectionInfo = BeanUtils.toBean(createReqVO, InspectionInfoDO.class); InspectionInfoDO inspectionInfo = BeanUtils.toBean(createReqVO, InspectionInfoDO.class);
@ -110,12 +111,24 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
@Override @Override
@TenantIgnore @TenantIgnore
@Transactional
public void updateInspectionInfo(InspectionInfoSaveReqVO updateReqVO) { public void updateInspectionInfo(InspectionInfoSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateInspectionInfoExists(updateReqVO.getInspectionId()); InspectionInfoDO validateInfo = validateInspectionInfoExists(updateReqVO.getInspectionId());
// 更新 // 更新
InspectionInfoDO updateObj = BeanUtils.toBean(updateReqVO, InspectionInfoDO.class); InspectionInfoDO updateObj = BeanUtils.toBean(updateReqVO, InspectionInfoDO.class);
inspectionInfoMapper.updateById(updateObj); 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 @Override
@ -129,10 +142,12 @@ public class InspectionInfoServiceImpl implements InspectionInfoService {
inspectionFeedbackService.deleteByInspectionId(id); inspectionFeedbackService.deleteByInspectionId(id);
} }
private void validateInspectionInfoExists(String id) { private InspectionInfoDO validateInspectionInfoExists(String id) {
if (inspectionInfoMapper.selectById(id) == null) { InspectionInfoDO inspectionInfo = inspectionInfoMapper.selectById(id);
if (inspectionInfo == null) {
throw exception(INSPECTION_INFO_NOT_EXISTS); throw exception(INSPECTION_INFO_NOT_EXISTS);
} }
return inspectionInfo;
} }
@Override @Override