|
@@ -441,11 +441,23 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
wrapper.eq("t1", Contract::getContractType, dto.getContractType());
|
|
|
|
|
|
+
|
|
|
+
|
|
|
|
|
|
wrapper.eq("t1", Contract::getBelongType, dto.getBelongType());
|
|
|
|
|
|
|
|
|
wrapper.eq("t1.isSpecialOutbound", dto.getIsSpecialOutbound());
|
|
|
+
|
|
|
+
|
|
|
+ wrapper.eq("t1.isSpecialOutbound", dto.getIsSpecialOutbound());
|
|
|
+
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getNotLinkSample())) {
|
|
|
+ wrapper.eq("t1", Contract::getContractType, 3);
|
|
|
+ wrapper.eq("t1", Contract::getStatus, 30);
|
|
|
+ wrapper.isNull("t1.link_contract_id");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1402,6 +1414,14 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
@Override
|
|
|
public void saveOrEdit(ContractDto contract) {
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(contract.getId())) {
|
|
|
+ Contract oldCo = this.getById(contract.getId());
|
|
|
+ if (ObjectUtil.isNotEmpty(oldCo) && ObjectUtil.isNotEmpty(oldCo.getSalesmanId())) {
|
|
|
+ this.update(q -> q.eq(Contract::getId, oldCo.getSalesmanId()).set(Contract::getLinkContractId, null));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (ObjectUtil.isEmpty(contract.getCode())) {
|
|
|
contract.setCode(codingRuleService.createCode(CodingRuleEnum.CONTRACT.getKey(), contract.getBuyCorporationId()));
|
|
|
}
|
|
@@ -1460,12 +1480,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
c.setContractId(contract.getId());
|
|
|
}
|
|
|
contractProjectService.editLinked(contractProjectList, ContractProject::getContractId, contract.getId());
|
|
|
+
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(contract.getSampleId())) {
|
|
|
+ contractService.update(q -> q.eq(Contract::getId, contract.getSalesmanId()).set(Contract::getLinkContractId, contract.getId()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@DSTransactional
|
|
|
@Override
|
|
|
- public void cancellation(ContractDto contractDto) {
|
|
|
- Long id = contractDto.getId();
|
|
|
+ public void cancellation(Long id) {
|
|
|
Contract contract = getById(id);
|
|
|
Assert.notEmpty(contract, "查询不到合同信息");
|
|
|
|
|
@@ -1510,6 +1534,11 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
|
|
|
|
|
|
contractCancelEditAvailableQuantity(contract);
|
|
|
+
|
|
|
+
|
|
|
+ if (ObjectUtil.isNotEmpty(contract.getSampleId())) {
|
|
|
+ contractService.update(q -> q.eq(Contract::getId, contract.getSalesmanId()).set(Contract::getLinkContractId, null));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|