feat: 消息下发
parent
860b96aab9
commit
05bb8f5b58
|
|
@ -54,6 +54,22 @@ public class EvalRiskAnalysisController {
|
|||
return evalRiskAnalysisApi.saveParticipant(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* // 站内信通知
|
||||
* SafetyMessageEntity safetyMessageEntity = new SafetyMessageEntity();
|
||||
* NoticeTypeEnum.ON_SITE_REVIEW_NOTICE
|
||||
* safetyMessageEntity.setSendName(MsgConstant.MSG_TYPE_SYSTEM);
|
||||
* safetyMessageEntity.setSendId(MsgConstant.MSG_TYPE_SYSTEM_ID);
|
||||
* safetyMessageEntity.setSendType("系统发送");
|
||||
* safetyMessageEntity.setSendContent("您被添加为项目成员,请及时处理");
|
||||
* safetyMessageEntity.setReceiveId(entity.getPersonnelId());
|
||||
* safetyMessageEntity.setSendState(0);
|
||||
* safetyMessageEntity.setCreateTime(LocalDateTime.now());
|
||||
* safetyMessageGateway.save(safetyMessageEntity);
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
|
||||
@ApiOperation("删除参与人")
|
||||
@PostMapping("/participant/delete")
|
||||
public SingleResponse<Void> deleteParticipant(@RequestBody Req<Long> req) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,61 @@
|
|||
package org.qinan.safetyeval.domain.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum NoticeTypeEnum {
|
||||
|
||||
SUPERVISION_INSPECTION_NOTICE(
|
||||
"SUPERVISION_INSPECTION_NOTICE",
|
||||
"监督检查告知",
|
||||
"贵机构已收到{checkType},检查时间:{checkTime},请于{deadline}前确认并提交相关材料。"),
|
||||
|
||||
RECTIFICATION_NOTICE(
|
||||
"RECTIFICATION_NOTICE",
|
||||
"整改/补正通知",
|
||||
"发现{issue},请于{deadline}前完成整改并上传证明材料。逾期将纳入监管记录。"),
|
||||
|
||||
ON_SITE_REVIEW_NOTICE(
|
||||
"ON_SITE_REVIEW_NOTICE",
|
||||
"现场审查通知",
|
||||
"定于{datetime}对贵机构开展{applicationItem}现场审查,请按通知准备{materialCount}项材料。"),
|
||||
|
||||
PROJECT_WORK_NOTICE(
|
||||
"PROJECT_WORK_NOTICE",
|
||||
"项目从业告知提醒",
|
||||
"项目{projectName}将于{date}开展现场踏勘,请完成从业告知通知,并在现场进行APP签到、签退和影像上传。"),
|
||||
|
||||
TRAINING_TASK_NOTICE(
|
||||
"TRAINING_TASK_NOTICE",
|
||||
"培训任务通知",
|
||||
"已下发“{taskName}”,请于{deadline}前完成{courseCount}门课程及考试,要求学时{hours}。"),
|
||||
|
||||
SIGN_TASK_NOTICE(
|
||||
"SIGN_TASK_NOTICE",
|
||||
"签字任务通知",
|
||||
"请签署《{fileName}》版本号{version}。您的角色:{role}。请核对内容后于{deadline}前完成手写签字。");
|
||||
|
||||
@Getter
|
||||
private final String val;
|
||||
@Getter
|
||||
private final String msg;
|
||||
@Getter
|
||||
private final String template;
|
||||
|
||||
|
||||
/**
|
||||
* 填充模板并返回最终提示词
|
||||
* @param params 占位符键值对,例如 Map.of("checkType", "专项检查", "checkTime", "2026-07-24", ...)
|
||||
* @return 填充后的提示词
|
||||
*/
|
||||
public String fillTemplate(Map<String, String> params) {
|
||||
String result = this.template;
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
result = result.replace("{" + entry.getKey() + "}", entry.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,11 +3,8 @@ package org.qinan.safetyeval.infrastructure.gatewayimpl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.qinan.safetyeval.domain.constant.MsgConstant;
|
||||
import org.qinan.safetyeval.domain.entity.EvalProjectMemberEntity;
|
||||
import org.qinan.safetyeval.domain.entity.SafetyMessageEntity;
|
||||
import org.qinan.safetyeval.domain.gateway.EvalProjectMemberGateway;
|
||||
import org.qinan.safetyeval.domain.gateway.SafetyMessageGateway;
|
||||
import org.qinan.safetyeval.domain.query.EvalProjectMemberQuery;
|
||||
import org.qinan.safetyeval.domain.query.PageResult;
|
||||
import org.qinan.safetyeval.infrastructure.convertor.EvalProjectMemberDoConvertor;
|
||||
|
|
@ -15,13 +12,11 @@ import org.qinan.safetyeval.infrastructure.dataobject.EvalProjectMemberDO;
|
|||
import org.qinan.safetyeval.infrastructure.mapper.EvalProjectMemberMapper;
|
||||
import org.qinan.safetyeval.infrastructure.support.InsertFieldDefaults;
|
||||
import org.qinan.safetyeval.infrastructure.support.OrgContextResolver;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -37,9 +32,6 @@ public class EvalProjectMemberGatewayImpl implements EvalProjectMemberGateway {
|
|||
@Resource
|
||||
private EvalProjectMemberDoConvertor evalProjectMemberDoConvertor;
|
||||
|
||||
@Autowired
|
||||
private SafetyMessageGateway safetyMessageGateway;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public EvalProjectMemberEntity save(EvalProjectMemberEntity entity) {
|
||||
|
|
@ -48,16 +40,6 @@ public class EvalProjectMemberGatewayImpl implements EvalProjectMemberGateway {
|
|||
InsertFieldDefaults.apply(dataObject);
|
||||
evalProjectMemberMapper.insert(dataObject);
|
||||
entity.setId(dataObject.getId());
|
||||
// 站内信通知
|
||||
SafetyMessageEntity safetyMessageEntity = new SafetyMessageEntity();
|
||||
safetyMessageEntity.setSendName(MsgConstant.MSG_TYPE_SYSTEM);
|
||||
safetyMessageEntity.setSendId(MsgConstant.MSG_TYPE_SYSTEM_ID);
|
||||
safetyMessageEntity.setSendType("系统发送");
|
||||
safetyMessageEntity.setSendContent("您被添加为项目成员,请及时处理");
|
||||
safetyMessageEntity.setReceiveId(entity.getPersonnelId());
|
||||
safetyMessageEntity.setSendState(0);
|
||||
safetyMessageEntity.setCreateTime(LocalDateTime.now());
|
||||
safetyMessageGateway.save(safetyMessageEntity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue