|
|
|
@ -229,13 +229,18 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
//保存对应业务表单
|
|
|
|
|
String saved = saveEntity(JSONObject.toJSONString(recDTO)); |
|
|
|
|
//开启动作流
|
|
|
|
|
R r = this.startProcess(JSON.toJSONString(saved), DutyRecProcessConstant.DUTY_REC_FLOW_KEY,null); |
|
|
|
|
R r = this.startProcess(saved, DutyRecProcessConstant.DUTY_REC_FLOW_KEY,null); |
|
|
|
|
return r; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public String saveEntity(String entity) { |
|
|
|
|
ImsDutyRecDTO recDTO= JSONObject.parseObject(entity, ImsDutyRecDTO.class); |
|
|
|
|
// 判断是否已交班
|
|
|
|
|
List<ImsDutyRecEntity> dutyRecs = this.list(Wrappers.<ImsDutyRecEntity>lambdaQuery().eq(ImsDutyRecEntity::getDutyId, recDTO.getDutyId())); |
|
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(dutyRecs),() -> { |
|
|
|
|
throw new ServiceException("您已交班,请勿重复交班!"); |
|
|
|
|
}); |
|
|
|
|
transactionTemplate.setTransactionManager(transactionManager); |
|
|
|
|
// 获取班组组长
|
|
|
|
|
Long managerId = this.getHandleGroupManagerByDuty(recDTO.getDutyId()); |
|
|
|
@ -258,13 +263,13 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
transactionTemplate.setTransactionManager(transactionManager); |
|
|
|
|
String res = transactionTemplate.execute(status -> { |
|
|
|
|
// 在这里执行需要事务控制的代码
|
|
|
|
|
|
|
|
|
|
if(Func.isNotEmpty(duration) && duration > 0) { |
|
|
|
|
recDTO.setDelayStatus(DutyContants.DutyRecDelayStatusEnum.HAND_DELAY_STATUS.getStatus()); |
|
|
|
|
} |
|
|
|
|
ImsDutyRecEntity recEntity = BeanUtil.copy(recDTO,ImsDutyRecEntity.class); |
|
|
|
|
if (Func.isEmpty(recEntity.getId())) { |
|
|
|
|
save(recEntity); |
|
|
|
|
recDTO.setId(recEntity.getId()); |
|
|
|
|
} |
|
|
|
|
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity(); |
|
|
|
|
imsDutyLogEntity.setHandTime(DateUtil.format(new Date(),PATTERN_DATETIME)); |
|
|
|
@ -339,11 +344,7 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
*/ |
|
|
|
|
private Long getHandleGroupManagerByDuty(Long dutyId) { |
|
|
|
|
ImsDutyMainEntity dutyMain = imsDutyMainMapper.selectById(dutyId); |
|
|
|
|
// 判断是否已交班
|
|
|
|
|
List<ImsDutyRecEntity> dutyRecs = this.list(Wrappers.<ImsDutyRecEntity>lambdaQuery().eq(ImsDutyRecEntity::getDutyId, dutyId)); |
|
|
|
|
Assert.isTrue(CollectionUtil.isEmpty(dutyRecs),() -> { |
|
|
|
|
throw new ServiceException("您已交班,请勿重复交班!"); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
//根据上一班值班id查询值班信息
|
|
|
|
|
ImsDutyMainEntity carryDutyMain = imsDutyMainMapper.selectOne(Wrappers.<ImsDutyMainEntity>lambdaQuery().eq(ImsDutyMainEntity::getPreDutyId, dutyId)); |
|
|
|
|
Assert.isTrue(ObjectUtil.isNotEmpty(carryDutyMain),() -> { |
|
|
|
|