1、调整导入运单
2、调整对账
This commit is contained in:
+3
-2
@@ -114,8 +114,9 @@ public class ProcessConfigController extends BladeController {
|
||||
.eq(VoucherImage::getMatched, 1)
|
||||
.eq(VoucherImage::getIsDeleted, 0)
|
||||
.orderByDesc(VoucherImage::getCreateTime));
|
||||
Map<Long, VoucherManage> voucherMap = voucherManageMapper.selectBatchIds(imageRecords.stream()
|
||||
.map(VoucherImage::getVoucherId).filter(java.util.Objects::nonNull).distinct().toList()).stream()
|
||||
List<Long> voucherIds = imageRecords.stream()
|
||||
.map(VoucherImage::getVoucherId).filter(java.util.Objects::nonNull).distinct().toList();
|
||||
Map<Long, VoucherManage> voucherMap = voucherIds.isEmpty() ? Map.of() : voucherManageMapper.selectBatchIds(voucherIds).stream()
|
||||
.collect(java.util.stream.Collectors.toMap(VoucherManage::getId, item -> item, (left, right) -> left));
|
||||
List<Map<String, Object>> images = imageRecords.stream()
|
||||
// 承运商上传的凭证只允许审核通过后在运单详情展示,内部上传保持原有展示规则。
|
||||
|
||||
+45
-5
@@ -211,8 +211,10 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
||||
List<FormalSettlementSource> sources = sourceMapper.selectList(Wrappers.<FormalSettlementSource>lambdaQuery()
|
||||
.eq(FormalSettlementSource::getFormalSettlementId, id).orderByAsc(FormalSettlementSource::getCreateTime));
|
||||
vo.setSources(sources);
|
||||
vo.setDetails(detailMapper.selectList(Wrappers.<FormalSettlementDetail>lambdaQuery()
|
||||
.eq(FormalSettlementDetail::getFormalSettlementId, id).orderByAsc(FormalSettlementDetail::getLineNo)));
|
||||
List<FormalSettlementDetail> details = detailMapper.selectList(Wrappers.<FormalSettlementDetail>lambdaQuery()
|
||||
.eq(FormalSettlementDetail::getFormalSettlementId, id).orderByAsc(FormalSettlementDetail::getLineNo));
|
||||
fillDetailWaybillAddresses(details);
|
||||
vo.setDetails(details);
|
||||
vo.setSummaryFees(listSummaryFees(id));
|
||||
vo.setPayments(paymentMapper.selectList(Wrappers.<FormalSettlementPayment>lambdaQuery()
|
||||
.eq(FormalSettlementPayment::getFormalSettlementId, id).orderByDesc(FormalSettlementPayment::getCreateTime)));
|
||||
@@ -246,6 +248,37 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 为历史正式结算明细补充运单收发货信息,保留明细中已有的快照值。
|
||||
*/
|
||||
private void fillDetailWaybillAddresses(List<FormalSettlementDetail> details) {
|
||||
if (details == null || details.isEmpty()) return;
|
||||
List<Long> waybillIds = details.stream()
|
||||
.map(FormalSettlementDetail::getWaybillId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.toList();
|
||||
if (waybillIds.isEmpty()) return;
|
||||
Map<Long, Waybill> waybillMap = waybillService.listByIds(waybillIds).stream()
|
||||
.collect(Collectors.toMap(Waybill::getId, Function.identity(), (left, right) -> left));
|
||||
for (FormalSettlementDetail detail : details) {
|
||||
Waybill waybill = waybillMap.get(detail.getWaybillId());
|
||||
if (waybill == null) continue;
|
||||
if (Func.isEmpty(detail.getDepartureAddress())) {
|
||||
detail.setDepartureAddress(Func.isNotEmpty(waybill.getDepartureAddress())
|
||||
? waybill.getDepartureAddress() : waybill.getDepartureName());
|
||||
}
|
||||
if (Func.isEmpty(detail.getArrivalAddress())) {
|
||||
detail.setArrivalAddress(Func.isNotEmpty(waybill.getArrivalAddress())
|
||||
? waybill.getArrivalAddress() : waybill.getArrivalName());
|
||||
}
|
||||
if (Func.isEmpty(detail.getDepartureContact())) detail.setDepartureContact(waybill.getDepartureContact());
|
||||
if (Func.isEmpty(detail.getDeparturePhone())) detail.setDeparturePhone(waybill.getDeparturePhone());
|
||||
if (Func.isEmpty(detail.getArrivalContact())) detail.setArrivalContact(waybill.getArrivalContact());
|
||||
if (Func.isEmpty(detail.getArrivalPhone())) detail.setArrivalPhone(waybill.getArrivalPhone());
|
||||
}
|
||||
}
|
||||
|
||||
private List<FormalSettlementInvoice> listInvoices(FormalSettlement settlement) {
|
||||
List<FormalSettlementInvoice> settlementInvoices = invoiceMapper.selectList(
|
||||
Wrappers.<FormalSettlementInvoice>lambdaQuery()
|
||||
@@ -1042,7 +1075,10 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
||||
FormalSettlementDetail detail = new FormalSettlementDetail();
|
||||
detail.setFormalSettlementId(settlement.getId()); detail.setSourceDetailId(source.getId()); detail.setLineNo(lineNo++);
|
||||
detail.setDocumentNo(source.getDocumentNo()); detail.setWaybillId(source.getWaybillId()); detail.setWaybillNo(source.getWaybillNo());
|
||||
detail.setVehicleNo(source.getVehicleNo()); detail.setTransportType(source.getTransportType()); detail.setCargoName(source.getCargoName());
|
||||
detail.setVehicleNo(source.getVehicleNo()); detail.setDepartureAddress(source.getDepartureAddress()); detail.setArrivalAddress(source.getArrivalAddress());
|
||||
detail.setDepartureContact(source.getDepartureContact()); detail.setDeparturePhone(source.getDeparturePhone());
|
||||
detail.setArrivalContact(source.getArrivalContact()); detail.setArrivalPhone(source.getArrivalPhone());
|
||||
detail.setTransportType(source.getTransportType()); detail.setCargoName(source.getCargoName());
|
||||
detail.setCargoType(source.getCargoType()); detail.setTransportQuantity(money(source.getTransportQuantity())); detail.setQuantityUnit(source.getQuantityUnit());
|
||||
detail.setMileage(source.getMileage()); detail.setBatchNo(source.getBatchNo()); detail.setUnitPrice(source.getUnitPrice());
|
||||
detail.setFreightAmount(money(source.getFreightAmount())); detail.setFeeItemsJson(source.getFeeItemsJson());
|
||||
@@ -1050,8 +1086,12 @@ public class FormalSettlementServiceImpl extends BaseServiceImpl<FormalSettlemen
|
||||
detail.setSettlementAmountTax(money(source.getTotalAmount())); detail.setCurrency(Func.isEmpty(source.getCurrency()) ? "RMB" : source.getCurrency());
|
||||
Waybill waybill = source.getWaybillId() == null ? null : waybillService.getById(source.getWaybillId());
|
||||
if (waybill != null) {
|
||||
detail.setDepartureAddress(Func.isNotEmpty(waybill.getDepartureAddress()) ? waybill.getDepartureAddress() : waybill.getDepartureName());
|
||||
detail.setArrivalAddress(Func.isNotEmpty(waybill.getArrivalAddress()) ? waybill.getArrivalAddress() : waybill.getArrivalName());
|
||||
if (Func.isEmpty(detail.getDepartureAddress())) detail.setDepartureAddress(Func.isNotEmpty(waybill.getDepartureAddress()) ? waybill.getDepartureAddress() : waybill.getDepartureName());
|
||||
if (Func.isEmpty(detail.getArrivalAddress())) detail.setArrivalAddress(Func.isNotEmpty(waybill.getArrivalAddress()) ? waybill.getArrivalAddress() : waybill.getArrivalName());
|
||||
if (Func.isEmpty(detail.getDepartureContact())) detail.setDepartureContact(waybill.getDepartureContact());
|
||||
if (Func.isEmpty(detail.getDeparturePhone())) detail.setDeparturePhone(waybill.getDeparturePhone());
|
||||
if (Func.isEmpty(detail.getArrivalContact())) detail.setArrivalContact(waybill.getArrivalContact());
|
||||
if (Func.isEmpty(detail.getArrivalPhone())) detail.setArrivalPhone(waybill.getArrivalPhone());
|
||||
detail.setActualDepartureTime(waybill.getStartDate() == null ? null : waybill.getStartDate().atStartOfDay());
|
||||
detail.setActualCompletionTime(waybill.getEndDate() == null ? null : waybill.getEndDate().atStartOfDay());
|
||||
}
|
||||
|
||||
+28
-6
@@ -711,10 +711,18 @@ public class PreSettlementServiceImpl extends BaseServiceImpl<PreSettlementMappe
|
||||
result.put("formalSettlementNo", source.getFormalSettlementNo());
|
||||
result.put("waybillNo", source.getWaybillNo());
|
||||
result.put("vehicleNo", source.getVehicleNo());
|
||||
result.put("departureAddress", waybill == null ? "" :
|
||||
firstNotEmpty(waybill.getDepartureAddress(), waybill.getDepartureName()));
|
||||
result.put("arrivalAddress", waybill == null ? "" :
|
||||
firstNotEmpty(waybill.getArrivalAddress(), waybill.getArrivalName()));
|
||||
result.put("departureAddress", Func.isNotEmpty(source.getDepartureAddress()) ? source.getDepartureAddress()
|
||||
: waybill == null ? "" : firstNotEmpty(waybill.getDepartureAddress(), waybill.getDepartureName()));
|
||||
result.put("arrivalAddress", Func.isNotEmpty(source.getArrivalAddress()) ? source.getArrivalAddress()
|
||||
: waybill == null ? "" : firstNotEmpty(waybill.getArrivalAddress(), waybill.getArrivalName()));
|
||||
result.put("departureContact", Func.isNotEmpty(source.getDepartureContact()) ? source.getDepartureContact()
|
||||
: waybill == null ? "" : waybill.getDepartureContact());
|
||||
result.put("departurePhone", Func.isNotEmpty(source.getDeparturePhone()) ? source.getDeparturePhone()
|
||||
: waybill == null ? "" : waybill.getDeparturePhone());
|
||||
result.put("arrivalContact", Func.isNotEmpty(source.getArrivalContact()) ? source.getArrivalContact()
|
||||
: waybill == null ? "" : waybill.getArrivalContact());
|
||||
result.put("arrivalPhone", Func.isNotEmpty(source.getArrivalPhone()) ? source.getArrivalPhone()
|
||||
: waybill == null ? "" : waybill.getArrivalPhone());
|
||||
result.put("actualDepartureTime", waybill == null || waybill.getStartDate() == null ? null :
|
||||
waybill.getStartDate().atStartOfDay());
|
||||
result.put("actualCompletionTime", waybill == null || waybill.getEndDate() == null ? null :
|
||||
@@ -832,6 +840,12 @@ public class PreSettlementServiceImpl extends BaseServiceImpl<PreSettlementMappe
|
||||
detail.setWaybillId(source.getWaybillId());
|
||||
detail.setWaybillNo(source.getWaybillNo());
|
||||
detail.setVehicleNo(source.getVehicleNo());
|
||||
detail.setDepartureAddress(source.getDepartureAddress());
|
||||
detail.setArrivalAddress(source.getArrivalAddress());
|
||||
detail.setDepartureContact(source.getDepartureContact());
|
||||
detail.setDeparturePhone(source.getDeparturePhone());
|
||||
detail.setArrivalContact(source.getArrivalContact());
|
||||
detail.setArrivalPhone(source.getArrivalPhone());
|
||||
detail.setTransportType(source.getTransportType());
|
||||
detail.setCargoName(source.getCargoName());
|
||||
detail.setCargoType(source.getCargoType());
|
||||
@@ -850,8 +864,16 @@ public class PreSettlementServiceImpl extends BaseServiceImpl<PreSettlementMappe
|
||||
detail.setRemark(source.getRemark());
|
||||
Waybill waybill = source.getWaybillId() == null ? null : waybillService.getById(source.getWaybillId());
|
||||
if (waybill != null) {
|
||||
detail.setDepartureAddress(firstNotEmpty(waybill.getDepartureAddress(), waybill.getDepartureName()));
|
||||
detail.setArrivalAddress(firstNotEmpty(waybill.getArrivalAddress(), waybill.getArrivalName()));
|
||||
if (Func.isEmpty(detail.getDepartureAddress())) {
|
||||
detail.setDepartureAddress(firstNotEmpty(waybill.getDepartureAddress(), waybill.getDepartureName()));
|
||||
}
|
||||
if (Func.isEmpty(detail.getArrivalAddress())) {
|
||||
detail.setArrivalAddress(firstNotEmpty(waybill.getArrivalAddress(), waybill.getArrivalName()));
|
||||
}
|
||||
if (Func.isEmpty(detail.getDepartureContact())) detail.setDepartureContact(waybill.getDepartureContact());
|
||||
if (Func.isEmpty(detail.getDeparturePhone())) detail.setDeparturePhone(waybill.getDeparturePhone());
|
||||
if (Func.isEmpty(detail.getArrivalContact())) detail.setArrivalContact(waybill.getArrivalContact());
|
||||
if (Func.isEmpty(detail.getArrivalPhone())) detail.setArrivalPhone(waybill.getArrivalPhone());
|
||||
detail.setActualDepartureTime(waybill.getStartDate() == null ? null : waybill.getStartDate().atStartOfDay());
|
||||
detail.setActualCompletionTime(waybill.getEndDate() == null ? null : waybill.getEndDate().atStartOfDay());
|
||||
}
|
||||
|
||||
+18
@@ -1170,6 +1170,12 @@ public class ReceivablePayableDetailServiceImpl
|
||||
detail.setWaybillId(waybill.getId());
|
||||
detail.setWaybillNo(waybill.getWaybillNo());
|
||||
detail.setVehicleNo(waybill.getVehicleNo());
|
||||
detail.setDepartureAddress(waybill.getDepartureAddress());
|
||||
detail.setArrivalAddress(waybill.getArrivalAddress());
|
||||
detail.setDepartureContact(waybill.getDepartureContact());
|
||||
detail.setDeparturePhone(waybill.getDeparturePhone());
|
||||
detail.setArrivalContact(waybill.getArrivalContact());
|
||||
detail.setArrivalPhone(waybill.getArrivalPhone());
|
||||
detail.setTransportType(waybill.getTransportType());
|
||||
detail.setCargoName(waybill.getCargoName());
|
||||
detail.setCargoType(waybill.getCargoType());
|
||||
@@ -1268,8 +1274,12 @@ public class ReceivablePayableDetailServiceImpl
|
||||
masterGoodsItem.setQuantityUnit(stringValue(goods, "quantityUnit"));
|
||||
masterGoodsItem.setDepartureName(masterOrder.getDepartureName());
|
||||
masterGoodsItem.setDepartureAddress(masterOrder.getDepartureAddress());
|
||||
masterGoodsItem.setDepartureContact(masterOrder.getDepartureContact());
|
||||
masterGoodsItem.setDeparturePhone(masterOrder.getDeparturePhone());
|
||||
masterGoodsItem.setArrivalName(masterOrder.getArrivalName());
|
||||
masterGoodsItem.setArrivalAddress(masterOrder.getArrivalAddress());
|
||||
masterGoodsItem.setArrivalContact(masterOrder.getArrivalContact());
|
||||
masterGoodsItem.setArrivalPhone(masterOrder.getArrivalPhone());
|
||||
masterGoodsItem.setEndDate(masterOrder.getPlanEndTime() == null ? LocalDate.now()
|
||||
: masterOrder.getPlanEndTime().toLocalDate());
|
||||
masterGoodsItem.setMasterNo(masterOrder.getMasterNo());
|
||||
@@ -2373,8 +2383,10 @@ public class ReceivablePayableDetailServiceImpl
|
||||
map.put("cargoInfo", waybill.getCargoName());
|
||||
map.put("departureAddress", waybill.getDepartureAddress());
|
||||
map.put("departureContact", waybill.getDepartureContact());
|
||||
map.put("departurePhone", waybill.getDeparturePhone());
|
||||
map.put("arrivalAddress", waybill.getArrivalAddress());
|
||||
map.put("arrivalContact", waybill.getArrivalContact());
|
||||
map.put("arrivalPhone", waybill.getArrivalPhone());
|
||||
map.put("unitPrice", waybill.getUnitPrice());
|
||||
map.put("freight", waybillFreight(waybill));
|
||||
map.put("otherFeeTotal", waybillOtherFee(waybill));
|
||||
@@ -2479,6 +2491,12 @@ public class ReceivablePayableDetailServiceImpl
|
||||
map.put("formalSettlementNo", detail.getFormalSettlementNo());
|
||||
map.put("waybillNo", detail.getWaybillNo());
|
||||
map.put("vehicleNo", detail.getVehicleNo());
|
||||
map.put("departureAddress", detail.getDepartureAddress());
|
||||
map.put("arrivalAddress", detail.getArrivalAddress());
|
||||
map.put("departureContact", detail.getDepartureContact());
|
||||
map.put("departurePhone", detail.getDeparturePhone());
|
||||
map.put("arrivalContact", detail.getArrivalContact());
|
||||
map.put("arrivalPhone", detail.getArrivalPhone());
|
||||
map.put("transportType", detail.getTransportType());
|
||||
map.put("cargoName", detail.getCargoName());
|
||||
map.put("cargoType", detail.getCargoType());
|
||||
|
||||
Reference in New Issue
Block a user