|
@@ -342,6 +342,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
//记录日志上下文
|
|
|
String operatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getOperator());
|
|
|
String twoOperatorNickname = adminUserMapper.selectNicknameByUserId(existingSpecimen.getTwoOperator());
|
|
|
+ LogRecordContext.putVariable("existingSpecimen", existingSpecimen);
|
|
|
LogRecordContext.putVariable("operatorNickname", operatorNickname);
|
|
|
LogRecordContext.putVariable("twoOperatorNickname", twoOperatorNickname);
|
|
|
LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
|
|
@@ -385,36 +386,51 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
throw exception(ONLY_OUTBOUND_SPECIMEN_CAN_RETURNED);
|
|
|
}
|
|
|
|
|
|
- SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
|
|
|
- updateObj.setStatus(4).setReturnDate(LocalDateTime.now()); // 设置回库时间为当前时间
|
|
|
+ // 判断是否已经填写回库表单
|
|
|
+ if (existingSpecimen.getReturnConfirm() == null) {
|
|
|
+ // 如果回库表单为空,则更新回库单
|
|
|
+ SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
|
|
|
+ updateObj.setReturnConfirm(getLoginUserId());
|
|
|
+ // 更新数据库
|
|
|
+ specimenOutboundMapper.updateById(updateObj);
|
|
|
|
|
|
- // 更新数据库
|
|
|
- specimenOutboundMapper.updateById(updateObj);
|
|
|
+ } else if(existingSpecimen.getTwoReturnConfirm() == null){
|
|
|
|
|
|
- String infoIdString = existingSpecimen.getInfoId();
|
|
|
- infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
|
|
|
- String[] infoIds = infoIdString.split(","); // 按逗号分割
|
|
|
+ // 检查是否和第一个出库确认员相同
|
|
|
+ if (existingSpecimen.getReturnConfirm().equals(getLoginUserId())) {
|
|
|
+ throw exception(YOU_HAVE_CONFIRMED_THAT_SPECIMEN_RETURNED);
|
|
|
+ }
|
|
|
+ // 更新数据库
|
|
|
+ SpecimenOutboundDO updateObj = BeanUtils.toBean(updateReqVO, SpecimenOutboundDO.class);
|
|
|
+ updateObj.setTwoReturnConfirm(getLoginUserId())
|
|
|
+ .setStatus(4).setReturnDate(LocalDateTime.now()); // 设置回库时间为当前时间
|
|
|
+ specimenOutboundMapper.updateById(updateObj);
|
|
|
|
|
|
- // 更新所有标本信息的馆藏状态为0(在馆)
|
|
|
- for (String infoId : infoIds) {
|
|
|
- specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 0);
|
|
|
- }
|
|
|
- // 记录日志上下文
|
|
|
- LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
|
|
|
+ String infoIdString = existingSpecimen.getInfoId();
|
|
|
+ infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
|
|
|
+ String[] infoIds = infoIdString.split(","); // 按逗号分割
|
|
|
|
|
|
- //发送站内信
|
|
|
- String templateCode = "specimen_return_request_approved";
|
|
|
- Map<String, Object> templateParams = new HashMap<>();
|
|
|
+ // 更新所有标本信息的馆藏状态为0(在馆)
|
|
|
+ for (String infoId : infoIds) {
|
|
|
+ specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 0);
|
|
|
+ }
|
|
|
+ // 记录日志上下文
|
|
|
+ LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新的出库单对象
|
|
|
|
|
|
- // 定义格式化模板
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ //发送站内信
|
|
|
+ String templateCode = "specimen_return_request_approved";
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
|
|
|
- // 转换 LocalDateTime 为字符串
|
|
|
- String formattedDate = existingSpecimen.getCreateTime().format(formatter);
|
|
|
- templateParams.put("createTime",formattedDate);
|
|
|
+ // 定义格式化模板
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
- notifySendApi.sendSingleMessageToAdmin(new NotifySendSingleToUserReqDTO()
|
|
|
- .setUserId(Long.valueOf(existingSpecimen.getCreator())).setTemplateCode(templateCode).setTemplateParams(templateParams));
|
|
|
+ // 转换 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
|