diff --git a/src/main/java/com/qs/serve/modules/sys/controller/SysUserController.java b/src/main/java/com/qs/serve/modules/sys/controller/SysUserController.java index f45a608f..9cf0bf6a 100644 --- a/src/main/java/com/qs/serve/modules/sys/controller/SysUserController.java +++ b/src/main/java/com/qs/serve/modules/sys/controller/SysUserController.java @@ -355,12 +355,12 @@ public class SysUserController { // if(param.getLoginEnable()!=null){ // param.setServingState(param.getLoginEnable()==1?1:0); // } -// if(param.getSyUserId()==null){ + if(param.getSyUserId()==null){ param.setSyUserId(null); -// } -// if(param.getSyAccount()==null){ + } + if(param.getSyAccount()==null){ param.setSyAccount(null); -// } + } param.setSuperFlag(null); param.setPassword(null); param.setUpdateTime(LocalDateTime.now()); diff --git a/src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java b/src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java index 939b4f12..bdf3c337 100644 --- a/src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java +++ b/src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java @@ -281,10 +281,24 @@ public class TbsCostApplyController { @SysLog(module = SystemModule.Budget, title = "费用申请", biz = BizType.INSERT) @Transactional(rollbackFor = Exception.class) public R cancelWithChange(@PathVariable("id") Long id){ - costApplyPart1Service.cancelSetChanged(id); + costApplyPart1Service.cancelSetChanged(id,true); return R.ok(); } + /** + * 通过编号加载费用 + * @param code + * @return + */ + @PostMapping("/listByCode/{code}") + public R getChangeList(@PathVariable("code") String code){ + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(TbsCostApply::getCode,code); + lqw.orderByAsc(TbsCostApply::getCreateTime); + List costApplyList = tbsCostApplyService.list(lqw); + return R.ok(costApplyList); + } + /** * 根据模板,新增费用及活动 * @param param diff --git a/src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java b/src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java index 9d5942e0..dea0ecc9 100644 --- a/src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java +++ b/src/main/java/com/qs/serve/modules/tbs/entity/TbsCostApply.java @@ -162,6 +162,17 @@ public class TbsCostApply implements Serializable { */ private Long changeExtendId; + /** + * 异动时记录状态 + */ + private Integer changeStateRecord; + + /** + * 异动发起时间 + */ + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") + private LocalDateTime changeActionTime; @TableField(exist = false) private String affairId; diff --git a/src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyPart1Service.java b/src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyPart1Service.java index fe1da91c..725abb98 100644 --- a/src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyPart1Service.java +++ b/src/main/java/com/qs/serve/modules/tbs/service/TbsCostApplyPart1Service.java @@ -19,7 +19,8 @@ public interface TbsCostApplyPart1Service { /** * 取消异动 * @param costId + * @param checkThrow 检测抛异常 */ - void cancelSetChanged(Long costId); + void cancelSetChanged(Long costId,boolean checkThrow); } diff --git a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyOperationServiceImpl.java b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyOperationServiceImpl.java index b3e6ae9a..ba494e56 100644 --- a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyOperationServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyOperationServiceImpl.java @@ -33,6 +33,7 @@ import com.qs.serve.modules.tbs.mapper.TbsActivityMapper; import com.qs.serve.modules.tbs.mapper.TbsActivitySlottingFeeMapper; import com.qs.serve.modules.tbs.mapper.TbsBudgetLogMapper; import com.qs.serve.modules.tbs.service.TbsBudgetLogService; +import com.qs.serve.modules.tbs.service.TbsCostApplyPart1Service; import com.qs.serve.modules.tbs.service.TbsCostApplyService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -64,6 +65,8 @@ public class TbsCostApplyOperationServiceImpl implements SeeYonOperationService private final TbsActivitySlottingFeeMapper activitySlottingFeeMapper; private final TbsBudgetLogMapper tbsBudgetLogMapper; + private final TbsCostApplyPart1Service costApplyPart1Service; + @Override public SysUserService getSysUserService() { return sysUserService; @@ -270,6 +273,10 @@ public class TbsCostApplyOperationServiceImpl implements SeeYonOperationService activityParam.setActivityState(TbsActivityState.STATE_5_Close); tbsActivityMapper.update(activityParam,activityLqw); activitySlottingFeeMapper.updatePassFlagByCostApplyId(costApplyId,0); + //如果时异动,则恢复原来的异动状态 + if(apply.getChangeSourceId()!=null){ + costApplyPart1Service.cancelSetChanged(costApplyId,false); + } return null; } diff --git a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyPart1ServiceImpl.java b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyPart1ServiceImpl.java index 04994c1f..656d5287 100644 --- a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyPart1ServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyPart1ServiceImpl.java @@ -29,6 +29,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; @@ -54,12 +55,16 @@ public class TbsCostApplyPart1ServiceImpl implements TbsCostApplyPart1Service { private TbsActivityChannelPointService tbsActivityChannelPointService; private TbsCostContractMapper costContractMapper; private VtbVerificationMapper verificationMapper; + private TbsBudgetLogMapper tbsBudgetLogMapper; @Override @Transactional(rollbackFor = Exception.class) public TbsCostApply toSetChanged(Long costId) { String userId = AuthContextUtils.getSysUserId(); TbsCostApply orgCost = tbsCostApplyService.getById(costId); + if(orgCost.getCancelFlag().equals(1)){ + Assert.throwEx("该记录的费用已异动"); + } // if(orgCost.getChangeSourceId()!=null){ // Assert.throwEx("异动单据不可再异动,请取消源单据异动后进行"); // } @@ -114,13 +119,49 @@ public class TbsCostApplyPart1ServiceImpl implements TbsCostApplyPart1Service { orgCost.setChargeState(TbsCostApplyState.State_7_changed.getCode()); orgCost.setCancelFlag(1); orgCost.setChangeExtendId(costApply.getId()); + orgCost.setChangeStateRecord(costApply.getChargeState()); + orgCost.setChangeActionTime(LocalDateTime.now()); tbsCostApplyService.updateById(orgCost); return costApply; } @Override - public void cancelSetChanged(Long costId) { - + @Transactional(rollbackFor = Exception.class) + public void cancelSetChanged(Long costId,boolean checkThrow) { + //判断是否有核销记录 + LambdaQueryWrapper vtbLqwCount = new LambdaQueryWrapper<>(); + vtbLqwCount.eq(VtbVerification::getCostApplyId,costId); + vtbLqwCount.and(qw->{ + qw.eq(VtbVerification::getVerificationState, VtbVerificationState.Commiting.getCode()) + .or().eq(VtbVerification::getVerificationState,VtbVerificationState.Finished.getCode()); + }); + Long count = verificationMapper.selectCount(vtbLqwCount); + if(count>0){ + Assert.throwEx("含有核销记录不支持取消异动"); + } + TbsCostApply extCost = tbsCostApplyService.getById(costId); + if(checkThrow){ + if(extCost.getCancelFlag().equals(1)){ + Assert.throwEx("请选择最新的异动记录"); + } + if(extCost.getChangeSourceId()==null){ + Assert.throwEx("无异动记录"); + } + } + extCost.setCancelFlag(1); + extCost.setChargeState(TbsCostApplyState.State_8_changed_fail.getCode()); + extCost.setChangeStateRecord(extCost.getChargeState()); + tbsCostApplyService.updateById(extCost); + //恢复原来费用申请的状态 + TbsCostApply costApply = tbsCostApplyService.getById(extCost.getChangeSourceId()); + costApply.setChargeState(costApply.getChangeStateRecord()); + costApply.setChangeActionTime(LocalDateTime.now()); + costApply.setCancelFlag(0); + tbsCostApplyService.updateById(costApply); + //恢复原来的费用占用 + tbsBudgetLogMapper.updateLogDelFlagByCostApply(extCost.getChangeSourceId(),0); + //删除当前的异动记录 + tbsBudgetLogMapper.updateLogDelFlagByCostApply(extCost.getId(),1); } /** diff --git a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java index 17eec755..585cdc44 100644 --- a/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java @@ -408,7 +408,9 @@ public class TbsCostApplyServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); diff --git a/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java b/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java index 572c0202..5a7cceba 100644 --- a/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java +++ b/src/main/java/com/qs/serve/modules/vtb/service/impl/VtbVerificationServiceImpl.java @@ -193,7 +193,7 @@ public class VtbVerificationServiceImpl extends ServiceImpl