|
@@ -124,7 +124,7 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
specimenOutbound.setStatus(req.getStatus());
|
|
|
specimenOutbound.setProcessInstanceId(req.getProcessInstanceId());
|
|
|
specimenOutbound.setApprovalTime(req.getApprovalTime()); // 设置当前审批时间
|
|
|
- specimenOutbound.setApproveUsers(getLoginUserId()); // 设置一审操作员
|
|
|
+// specimenOutbound.setApproveUsers(getLoginUserId()); // 设置一审操作员
|
|
|
}
|
|
|
|
|
|
// 二审逻辑
|
|
@@ -196,34 +196,59 @@ public class SpecimenOutboundServiceImpl implements SpecimenOutboundService {
|
|
|
success = MUSEUMS_SPECIMEN_CREATE_CONFIEM_OUTBOUND_SUCCESS,
|
|
|
extra = "{{#existingSpecimen.infoId}}") // 使用标本信息 ID
|
|
|
public String confirmOutbound(Long id, Long operator) {
|
|
|
- // 校验存在
|
|
|
+ // 校验标本是否存在
|
|
|
validateSpecimenOutboundExists(id);
|
|
|
- // 获取当前标本的状态
|
|
|
+
|
|
|
+ // 获取当前标本的出库单信息
|
|
|
SpecimenOutboundDO existingSpecimen = specimenOutboundMapper.selectById(id);
|
|
|
+
|
|
|
// 判断状态是否为审批通过(5)
|
|
|
if (existingSpecimen == null || existingSpecimen.getStatus() != 5) {
|
|
|
throw exception(ONLY_PASSED_SECOND_INSTANCE_OUTBOUND);
|
|
|
}
|
|
|
- existingSpecimen.setStatus(3) // 更新状态为已出库(3)
|
|
|
- .setOperator(operator) // 设置出库员
|
|
|
- .setOutgoingTime(LocalDateTime.now()); // 设置出库时间
|
|
|
-
|
|
|
- // 更新数据库
|
|
|
- specimenOutboundMapper.updateById(existingSpecimen);
|
|
|
- // 更新标本信息的馆藏状态为1(借出)
|
|
|
- String infoIdString = existingSpecimen.getInfoId();
|
|
|
- infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
|
|
|
- String[] infoIds = infoIdString.split(","); // 按逗号分割
|
|
|
|
|
|
- for (String infoId : infoIds) {
|
|
|
- specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 1);
|
|
|
+ // 判断第一个操作员(operator)是否已经确认
|
|
|
+ if (existingSpecimen.getOperator() == null) {
|
|
|
+ // 如果operator为空,设置当前操作员为operator
|
|
|
+ existingSpecimen.setOperator(operator);
|
|
|
+ } else if (existingSpecimen.getTwoOperator() == null) {
|
|
|
+ // 如果operator不为空,且twoOperator为空,设置当前操作员为twoOperator
|
|
|
+ // 检查是否和第一个操作员相同
|
|
|
+ if (existingSpecimen.getOperator().equals(operator)) {
|
|
|
+ //第一个操作员和第二个操作员不能相同
|
|
|
+ throw exception(YOU_HAVE_CONFIRMED_THAT_SPECIMEN);
|
|
|
+ }
|
|
|
+ existingSpecimen.setTwoOperator(operator);
|
|
|
}
|
|
|
- // 记录日志上下文
|
|
|
- LogRecordContext.putVariable("existingSpecimen", existingSpecimen); // 添加更新后的出库单对象
|
|
|
|
|
|
- return "标本ID:"+existingSpecimen.getInfoId()+"出库成功";
|
|
|
+ // 如果第二个操作员(twoOperator)不为空,则更新状态为已出库(3)并执行馆藏状态更新操作
|
|
|
+ if (existingSpecimen.getOperator() != null && existingSpecimen.getTwoOperator() != null) {
|
|
|
+ // 仅在两个操作员都确认时才更新出库状态
|
|
|
+ existingSpecimen.setStatus(3) // 更新状态为已出库(3)
|
|
|
+ .setOutgoingTime(LocalDateTime.now()); // 设置出库时间
|
|
|
+
|
|
|
+ // 更新出库单状态为已出库(3)
|
|
|
+ specimenOutboundMapper.updateById(existingSpecimen);
|
|
|
+
|
|
|
+ // 更新标本信息的馆藏状态为1(借出)
|
|
|
+ String infoIdString = existingSpecimen.getInfoId();
|
|
|
+ infoIdString = infoIdString.replaceAll("[\\[\\] ]", ""); // 移除方括号和空格
|
|
|
+ String[] infoIds = infoIdString.split(","); // 按逗号分割
|
|
|
+
|
|
|
+ for (String infoId : infoIds) {
|
|
|
+ specimenInfoMapper.updateCollectionStatus(Long.valueOf(infoId.trim()), 1); // 设为借出状态
|
|
|
+ }
|
|
|
+
|
|
|
+ return "标本ID:" + existingSpecimen.getInfoId() + "出库确认成功";
|
|
|
+ } else {
|
|
|
+ // 如果只确认了一个操作员,更新出库单的信息但不修改状态
|
|
|
+ specimenOutboundMapper.updateById(existingSpecimen);
|
|
|
+ return "标本编号:" + existingSpecimen.getNumber() + "等待第二个操作员确认";
|
|
|
+ }
|
|
|
+ //TODO 日志还没做
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//填写回库表单
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|