|
@@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.museums.dal.mysql.specimeninfo.SpecimenInfoMapper
|
|
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
|
|
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
|
|
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
|
|
|
+import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
import com.mzt.logapi.context.LogRecordContext;
|
|
|
import com.mzt.logapi.service.impl.DiffParseFunction;
|
|
|
import com.mzt.logapi.starter.annotation.LogRecord;
|
|
@@ -57,6 +58,9 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
@Resource
|
|
|
private NotifyMessageSendApi notifySendApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private AdminUserService adminUserService;
|
|
|
+
|
|
|
//创建出库申请
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -99,9 +103,13 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
String formattedDate = specimenOutbound.getCreateTime().format(formatter);
|
|
|
templateParams.put("createTime",formattedDate);
|
|
|
templateParams.put("operator",getLoginUserNickname());
|
|
|
-
|
|
|
- notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
- .setUserId(143L).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
+ List<Long> userId = adminUserService.selectUserIdByRoleCode("deputy_leader");
|
|
|
+ for (Long id :userId){
|
|
|
+ notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
+ .setUserId(id)
|
|
|
+ .setTemplateCode(templateCode)
|
|
|
+ .setTemplateParams(templateParams));
|
|
|
+ }
|
|
|
|
|
|
// 返回出库记录ID
|
|
|
return specimenOutbound.getId();
|
|
@@ -198,10 +206,14 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
templateCode = "specimen_withdrawal_request_two_submitted";
|
|
|
String operatorNickname = adminUserMapper.selectNicknameByUserId(Long.valueOf(specimenOutbound.getCreator()));
|
|
|
templateParams.put("operator", operatorNickname);
|
|
|
- notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
- .setUserId(142L)
|
|
|
- .setTemplateCode(templateCode)
|
|
|
- .setTemplateParams(templateParams));
|
|
|
+ List<Long> userId = adminUserService.selectUserIdByRoleCode("leadership");
|
|
|
+
|
|
|
+ for (Long id :userId){
|
|
|
+ notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
+ .setUserId(id)
|
|
|
+ .setTemplateCode(templateCode)
|
|
|
+ .setTemplateParams(templateParams));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 更新数据库
|
|
@@ -261,13 +273,14 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
updateObj.setInfoId(validInfoIds.toString());
|
|
|
specimenOutboundMapper.updateById(updateObj);
|
|
|
|
|
|
+
|
|
|
// 1. 准备参数
|
|
|
+ List<Long> userId;
|
|
|
if(currentStatus == 2 || currentStatus == 6){
|
|
|
- Long userId = null;
|
|
|
if(currentStatus == 2){
|
|
|
- userId = 143L;
|
|
|
+ userId = adminUserService.selectUserIdByRoleCode("deputy_leader");
|
|
|
}else{
|
|
|
- userId = 142L;
|
|
|
+ userId = adminUserService.selectUserIdByRoleCode("leadership");
|
|
|
}
|
|
|
String templateCode = "sample_outbound_request_modified";
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
@@ -280,8 +293,12 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
templateParams.put("createTime", formattedDate);
|
|
|
|
|
|
// 2. 发送站内信
|
|
|
- notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
- .setUserId(userId).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
+ for (Long id :userId){
|
|
|
+ notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
+ .setUserId(id)
|
|
|
+ .setTemplateCode(templateCode)
|
|
|
+ .setTemplateParams(templateParams));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 记录日志上下文
|