|
@@ -36,9 +36,6 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|
|
import static cn.iocoder.yudao.module.museums.enums.ErrorCodeConstants.*;
|
|
|
import static cn.iocoder.yudao.module.museums.enums.social.LogRecordConstants.*;
|
|
|
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 标本出库回库信息 Service 实现类
|
|
|
*
|
|
@@ -178,14 +175,14 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
if (req.getStatus() == 1 || req.getStatus() == 2) {
|
|
|
if (req.getStatus() == 1) {
|
|
|
templateCode = "specimen_withdrawal_request_one_approved";
|
|
|
- } else if (req.getStatus() == 2) {
|
|
|
+ } else {
|
|
|
templateCode = "specimen_withdrawal_request_rejected";
|
|
|
templateParams.put("processInstanceId", req.getProcessInstanceId());
|
|
|
}
|
|
|
} else if (req.getStatus() == 5 || req.getStatus() == 6) {
|
|
|
if (req.getStatus() == 5) {
|
|
|
templateCode = "specimen_withdrawal_request_two_approved";
|
|
|
- } else if (req.getStatus() == 6) {
|
|
|
+ } else {
|
|
|
templateCode = "specimen_withdrawal_two_request_rejected";
|
|
|
templateParams.put("rejectionReasons", req.getRejectionReasons());
|
|
|
}
|
|
@@ -272,7 +269,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
}else{
|
|
|
userId = 142L;
|
|
|
}
|
|
|
- String templateCode = "";
|
|
|
+ String templateCode = "sample_outbound_request_modified";
|
|
|
Map<String, Object> templateParams = new HashMap<>();
|
|
|
String operatorNickname = adminUserMapper.selectNicknameByUserId(Long.valueOf(specimenOutbound.getCreator()));
|
|
|
templateParams.put("operator", operatorNickname);
|
|
@@ -287,7 +284,6 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
.setUserId(userId).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 记录日志上下文
|
|
|
LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(specimenInfo, SpecimenOutboundSaveReqVO.class));
|
|
|
}
|
|
@@ -343,14 +339,26 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 1); // 设为借出状态
|
|
|
}
|
|
|
|
|
|
- // 记录日志上下文
|
|
|
- LogRecordContext.putVariable("existingSpecimen", existingSpecimen);
|
|
|
-
|
|
|
//记录日志上下文
|
|
|
String operatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getOperator());
|
|
|
String twoOperatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getTwoOperator());
|
|
|
LogRecordContext.putVariable("operatorNickname", operatorNickname);
|
|
|
LogRecordContext.putVariable("twoOperatorNickname", twoOperatorNickname);
|
|
|
+
|
|
|
+ //发送站内信
|
|
|
+ String templateCode = "specimen_withdrawal_confirmed";
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
+
|
|
|
+ // 定义格式化模板
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ // 转换 LocalDateTime 为字符串
|
|
|
+ String formattedDate = existingSpecimen.getCreateTime().format(formatter);
|
|
|
+ templateParams.put("createTime",formattedDate);
|
|
|
+
|
|
|
+ notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
+ .setUserId(Long.valueOf(existingSpecimen.getCreator())).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
+
|
|
|
return "标本ID:" + existingSpecimen.getInfoId() + "出库确认成功";
|
|
|
} else {
|
|
|
// 如果只确认了一个操作员,更新出库单的信息但不修改状态
|
|
@@ -392,11 +400,24 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
}
|
|
|
// 记录日志上下文
|
|
|
LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
|
|
|
+
|
|
|
+ //发送站内信
|
|
|
+ String templateCode = "specimen_return_request_approved";
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
+
|
|
|
+ // 定义格式化模板
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+
|
|
|
+ // 转换 LocalDateTime 为字符串
|
|
|
+ String formattedDate = existingSpecimen.getCreateTime().format(formatter);
|
|
|
+ templateParams.put("createTime",formattedDate);
|
|
|
+
|
|
|
+ notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
+ .setUserId(Long.valueOf(existingSpecimen.getCreator())).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void deleteSpecimenOutbound(Long id) {
|
|
|
- // TODO 删除方法待考虑是否关闭开放,如果开放可以考虑鉴权,或者需要多个老师确认(先不弄)
|
|
|
// 校验存在
|
|
|
validateSpecimenOutboundExists(id);
|
|
|
// 删除
|
|
@@ -464,7 +485,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
response.setOperator(operatorNickname)
|
|
|
.setOperator(twoOperatorNickname)
|
|
|
.setApproveUsers(approveUsersNickname)
|
|
|
- .setTwoApproveUsers(twoApproveUsersNickname); // 设置操作员(出库员)的昵称
|
|
|
+ .setTwoApproveUsers(twoApproveUsersNickname);
|
|
|
|
|
|
// 设置分页后的标本信息列表
|
|
|
response.setSpecimenInfoList(pageResultVO);
|