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

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
@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