|
@@ -709,12 +709,20 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
@Override
|
|
|
public void cancels(ContractDto contractDto) {
|
|
|
Assert.notEmpty(contractDto.getId(), "合同id不能为空");
|
|
|
- contractService.update(q -> q
|
|
|
+ Contract contract = this.getById(contractDto.getId());
|
|
|
+ if (contract.getStatus().equals(FlowStatusEnum1.UPDATE_LOADING.getKey())) {
|
|
|
+ throw new ServiceException("变更中不允许作废");
|
|
|
+ }
|
|
|
+ boolean updateStatus = contractService.update(q -> q
|
|
|
.eq(Contract::getId, contractDto.getId())
|
|
|
.set(Contract::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
.set(BasePo::getUpdateTime, new Date())
|
|
|
.set(BasePo::getUpdateUser, SecurityUtils.getUserId())
|
|
|
+ .ne(Contract::getStatus, FlowStatusEnum1.UPDATE_LOADING.getKey())
|
|
|
);
|
|
|
+ if (!updateStatus) {
|
|
|
+ throw new ServiceException("作废失败,请重试");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|