调整结算模块
This commit is contained in:
+2
-15
@@ -1112,20 +1112,7 @@ public class ReceivablePayableDetailServiceImpl
|
|||||||
if ("receivable".equals(targetSettlementType)) {
|
if ("receivable".equals(targetSettlementType)) {
|
||||||
wrapper.eq(Waybill::getContractId, contract.getId());
|
wrapper.eq(Waybill::getContractId, contract.getId());
|
||||||
} else {
|
} else {
|
||||||
List<Long> customerContractIds = contractManageService.list(Wrappers.<ContractManage>lambdaQuery()
|
wrapper.eq(Waybill::getCarrierContractId, contract.getId());
|
||||||
.select(ContractManage::getId)
|
|
||||||
.eq(ContractManage::getIsDeleted, 0)
|
|
||||||
.eq(ContractManage::getProjectId, contract.getProjectId())
|
|
||||||
.eq(ContractManage::getContractCategory, "客户合同")
|
|
||||||
.eq(ContractManage::getPartyA, contract.getPartyA()))
|
|
||||||
.stream().map(ContractManage::getId).toList();
|
|
||||||
if (customerContractIds.isEmpty()) {
|
|
||||||
wrapper.eq(Waybill::getId, -1L);
|
|
||||||
} else {
|
|
||||||
wrapper.in(Waybill::getContractId, customerContractIds)
|
|
||||||
.eq(Waybill::getProjectId, contract.getProjectId())
|
|
||||||
.eq(Waybill::getCarrierName, contract.getPartyB());
|
|
||||||
}
|
|
||||||
wrapper.and(item -> item.isNull(Waybill::getTransportType)
|
wrapper.and(item -> item.isNull(Waybill::getTransportType)
|
||||||
.or().ne(Waybill::getTransportType, TRANSPORT_TYPE_SELF));
|
.or().ne(Waybill::getTransportType, TRANSPORT_TYPE_SELF));
|
||||||
wrapper.and(item -> item.isNull(Waybill::getCarrierType)
|
wrapper.and(item -> item.isNull(Waybill::getCarrierType)
|
||||||
@@ -1134,7 +1121,7 @@ public class ReceivablePayableDetailServiceImpl
|
|||||||
wrapper.notInSql(Waybill::getId,
|
wrapper.notInSql(Waybill::getId,
|
||||||
"select waybill_id from blade_receivable_payable_detail"
|
"select waybill_id from blade_receivable_payable_detail"
|
||||||
+ " where is_deleted = 0 and waybill_id is not null"
|
+ " where is_deleted = 0 and waybill_id is not null"
|
||||||
+ " and settlement_type in ('receivable', 'payable')");
|
+ " and settlement_type = '" + targetSettlementType + "'");
|
||||||
if (Func.isNotEmpty(request.getBatchNo())) {
|
if (Func.isNotEmpty(request.getBatchNo())) {
|
||||||
wrapper.like(Waybill::getBatchNo, request.getBatchNo());
|
wrapper.like(Waybill::getBatchNo, request.getBatchNo());
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-8
@@ -81,6 +81,7 @@ public class TransportPlanServiceImpl extends BaseServiceImpl<TransportPlanMappe
|
|||||||
public IPage<TransportPlanVO> selectTransportPlanPage(IPage<TransportPlan> page, TransportPlanVO transportPlan) {
|
public IPage<TransportPlanVO> selectTransportPlanPage(IPage<TransportPlan> page, TransportPlanVO transportPlan) {
|
||||||
IPage<TransportPlan> entityPage = page(page, buildQuery(transportPlan));
|
IPage<TransportPlan> entityPage = page(page, buildQuery(transportPlan));
|
||||||
IPage<TransportPlanVO> resultPage = TransportPlanWrapper.build().pageVO(entityPage);
|
IPage<TransportPlanVO> resultPage = TransportPlanWrapper.build().pageVO(entityPage);
|
||||||
|
fillCustomerNamesFromContracts(resultPage.getRecords());
|
||||||
fillDispatchRows(resultPage.getRecords());
|
fillDispatchRows(resultPage.getRecords());
|
||||||
return resultPage;
|
return resultPage;
|
||||||
}
|
}
|
||||||
@@ -88,26 +89,47 @@ public class TransportPlanServiceImpl extends BaseServiceImpl<TransportPlanMappe
|
|||||||
@Override
|
@Override
|
||||||
public TransportPlanVO detail(Long id) {
|
public TransportPlanVO detail(Long id) {
|
||||||
TransportPlanVO transportPlan = TransportPlanWrapper.build().entityVO(loadEditable(id, false));
|
TransportPlanVO transportPlan = TransportPlanWrapper.build().entityVO(loadEditable(id, false));
|
||||||
fillContractNo(transportPlan);
|
fillContractInfo(transportPlan);
|
||||||
fillDispatchRows(Collections.singletonList(transportPlan));
|
fillDispatchRows(Collections.singletonList(transportPlan));
|
||||||
return transportPlan;
|
return transportPlan;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillContractNo(TransportPlanVO transportPlan) {
|
private void fillContractInfo(TransportPlanVO transportPlan) {
|
||||||
ContractManage contract = resolveContract(transportPlan);
|
ContractManage contract = resolveContract(transportPlan);
|
||||||
transportPlan.setContractNo(contract == null ? null : contract.getContractNo());
|
transportPlan.setContractNo(contract == null ? null : contract.getContractNo());
|
||||||
|
fillCustomerNameFromContract(transportPlan, contract);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillCustomerNamesFromContracts(List<TransportPlanVO> transportPlans) {
|
||||||
|
transportPlans.forEach(transportPlan ->
|
||||||
|
fillCustomerNameFromContract(transportPlan, resolveContract(transportPlan)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fillCustomerNameFromContract(TransportPlan transportPlan, ContractManage contract) {
|
||||||
|
if (contract != null && "客户合同".equals(contract.getContractCategory())
|
||||||
|
&& Func.isNotEmpty(contract.getPartyA())) {
|
||||||
|
transportPlan.setCustomerName(TransportBusinessSupport.trimToNull(contract.getPartyA()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContractManage resolveContract(TransportPlanVO transportPlan) {
|
private ContractManage resolveContract(TransportPlanVO transportPlan) {
|
||||||
if (Func.isNotEmpty(transportPlan.getContractId())) {
|
return resolveContract(transportPlan.getContractId(), transportPlan.getContractName(), transportPlan.getProjectId());
|
||||||
ContractManage contract = contractManageService.getById(transportPlan.getContractId());
|
}
|
||||||
|
|
||||||
|
private ContractManage resolveContract(TransportPlan transportPlan) {
|
||||||
|
return resolveContract(transportPlan.getContractId(), transportPlan.getContractName(), transportPlan.getProjectId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ContractManage resolveContract(Long contractId, String contractName, Long projectId) {
|
||||||
|
if (Func.isNotEmpty(contractId)) {
|
||||||
|
ContractManage contract = contractManageService.getById(contractId);
|
||||||
if (contract != null) return contract;
|
if (contract != null) return contract;
|
||||||
}
|
}
|
||||||
if (Func.isEmpty(transportPlan.getContractName())) return null;
|
if (Func.isEmpty(contractName)) return null;
|
||||||
LambdaQueryWrapper<ContractManage> query = new LambdaQueryWrapper<ContractManage>()
|
LambdaQueryWrapper<ContractManage> query = new LambdaQueryWrapper<ContractManage>()
|
||||||
.eq(ContractManage::getContractName, transportPlan.getContractName());
|
.eq(ContractManage::getContractName, contractName);
|
||||||
if (Func.isNotEmpty(transportPlan.getProjectId())) {
|
if (Func.isNotEmpty(projectId)) {
|
||||||
query.eq(ContractManage::getProjectId, transportPlan.getProjectId());
|
query.eq(ContractManage::getProjectId, projectId);
|
||||||
}
|
}
|
||||||
return contractManageService.getOne(query, false);
|
return contractManageService.getOne(query, false);
|
||||||
}
|
}
|
||||||
@@ -123,6 +145,7 @@ public class TransportPlanServiceImpl extends BaseServiceImpl<TransportPlanMappe
|
|||||||
transportPlan.setDeptName(oldRecord.getDeptName());
|
transportPlan.setDeptName(oldRecord.getDeptName());
|
||||||
}
|
}
|
||||||
prepare(transportPlan);
|
prepare(transportPlan);
|
||||||
|
fillCustomerNameFromContract(transportPlan, resolveContract(transportPlan));
|
||||||
if (created) {
|
if (created) {
|
||||||
transportPlan.setPlanNo(nextCode());
|
transportPlan.setPlanNo(nextCode());
|
||||||
}
|
}
|
||||||
|
|||||||
+22
@@ -105,6 +105,7 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
|||||||
@Override
|
@Override
|
||||||
public WaybillVO detail(Long id) {
|
public WaybillVO detail(Long id) {
|
||||||
WaybillVO result = WaybillWrapper.build().entityVO(loadEditable(id, false));
|
WaybillVO result = WaybillWrapper.build().entityVO(loadEditable(id, false));
|
||||||
|
fillCustomerNameFromContract(result);
|
||||||
fillMileageMaintainable(List.of(result));
|
fillMileageMaintainable(List.of(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -148,6 +149,13 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void fillCustomerName(Waybill waybill) {
|
private void fillCustomerName(Waybill waybill) {
|
||||||
|
if (Func.isNotEmpty(waybill.getContractId())) {
|
||||||
|
ContractManage contract = contractManageService.getById(waybill.getContractId());
|
||||||
|
if (isCustomerContract(contract) && Func.isNotEmpty(contract.getPartyA())) {
|
||||||
|
waybill.setCustomerName(TransportBusinessSupport.trimToNull(contract.getPartyA()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Func.isNotEmpty(waybill.getCustomerName()) || Func.isEmpty(waybill.getProjectId())) {
|
if (Func.isNotEmpty(waybill.getCustomerName()) || Func.isEmpty(waybill.getProjectId())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -157,6 +165,20 @@ public class WaybillServiceImpl extends BaseServiceImpl<WaybillMapper, Waybill>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillCustomerNameFromContract(WaybillVO waybill) {
|
||||||
|
if (waybill == null || Func.isEmpty(waybill.getContractId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ContractManage contract = contractManageService.getById(waybill.getContractId());
|
||||||
|
if (isCustomerContract(contract) && Func.isNotEmpty(contract.getPartyA())) {
|
||||||
|
waybill.setCustomerName(TransportBusinessSupport.trimToNull(contract.getPartyA()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isCustomerContract(ContractManage contract) {
|
||||||
|
return contract != null && "客户合同".equals(contract.getContractCategory());
|
||||||
|
}
|
||||||
|
|
||||||
private void fillProjectProcessConfig(Waybill waybill) {
|
private void fillProjectProcessConfig(Waybill waybill) {
|
||||||
if (Func.isNotEmpty(waybill.getProcessJson()) || Func.isEmpty(waybill.getProjectId())) {
|
if (Func.isNotEmpty(waybill.getProcessJson()) || Func.isEmpty(waybill.getProjectId())) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user