Commit cc14c2abf1be55074f5f2b9f1d9fd6f813828e10

Authored by 房远帅
1 parent b4525071

订单明细报表:处理运费和回程运费问题

@@ -9,6 +9,7 @@ import com.lframework.xingyun.sc.entity.OrderDetailReport; @@ -9,6 +9,7 @@ import com.lframework.xingyun.sc.entity.OrderDetailReport;
9 import io.swagger.annotations.ApiModelProperty; 9 import io.swagger.annotations.ApiModelProperty;
10 10
11 import lombok.Data; 11 import lombok.Data;
  12 +import org.apache.commons.lang3.StringUtils;
12 13
13 /** 14 /**
14 * <p> 15 * <p>
@@ -295,6 +296,16 @@ public class GetOrderDetailReportBo extends BaseBo<OrderDetailReport> { @@ -295,6 +296,16 @@ public class GetOrderDetailReportBo extends BaseBo<OrderDetailReport> {
295 296
296 @Override 297 @Override
297 protected void afterInit(OrderDetailReport dto) { 298 protected void afterInit(OrderDetailReport dto) {
298 - 299 + if ("PROCESS_STD_AGMT".equals(dto.getContractType())) {
  300 + if (StringUtils.isBlank(this.returnShippingCost) && StringUtils.isNotBlank(this.shippingCost)) {
  301 + this.returnShippingCost = this.shippingCost;
  302 + }
  303 + this.shippingCost = null;
  304 + } else {
  305 + if (StringUtils.isBlank(this.shippingCost) && StringUtils.isNotBlank(this.returnShippingCost)) {
  306 + this.shippingCost = this.returnShippingCost;
  307 + }
  308 + this.returnShippingCost = null;
  309 + }
299 } 310 }
300 } 311 }
@@ -354,6 +354,17 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> { @@ -354,6 +354,17 @@ public class QueryOrderDetailReportBo extends BaseBo<OrderDetailReport> {
354 this.specialRequirements = getDicItemNameOrOriginal(DIC_SPECIAL_REQUIREMENTS, this.specialRequirements); 354 this.specialRequirements = getDicItemNameOrOriginal(DIC_SPECIAL_REQUIREMENTS, this.specialRequirements);
355 this.deptCode = convertDeptNameToDeptCode(this.deptName); 355 this.deptCode = convertDeptNameToDeptCode(this.deptName);
356 this.contractTypeName = handleContractType(this.contractTypeCode); 356 this.contractTypeName = handleContractType(this.contractTypeCode);
  357 + if ("PROCESS_STD_AGMT".equals(this.contractTypeCode)) {
  358 + if (StringUtils.isBlank(this.returnShippingCost) && StringUtils.isNotBlank(this.shippingCost)) {
  359 + this.returnShippingCost = this.shippingCost;
  360 + }
  361 + this.shippingCost = null;
  362 + } else {
  363 + if (StringUtils.isBlank(this.shippingCost) && StringUtils.isNotBlank(this.returnShippingCost)) {
  364 + this.shippingCost = this.returnShippingCost;
  365 + }
  366 + this.returnShippingCost = null;
  367 + }
357 } 368 }
358 369
359 private static String getDicItemNameOrOriginal(String dicCode, String itemCode) { 370 private static String getDicItemNameOrOriginal(String dicCode, String itemCode) {
@@ -952,8 +952,17 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic @@ -952,8 +952,17 @@ public class BusinessDataHandlerServiceImpl implements BusinessDataHandlerServic
952 vo.setPerformance(orderDetailReport.getPerformance()); 952 vo.setPerformance(orderDetailReport.getPerformance());
953 vo.setPackaging(orderDetailReport.getPackaging()); 953 vo.setPackaging(orderDetailReport.getPackaging());
954 vo.setRemarks(orderDetailReport.getRemarks()); 954 vo.setRemarks(orderDetailReport.getRemarks());
955 - vo.setReturnShippingCost(orderDetailReport.getReturnShippingCost());  
956 - vo.setShippingCost(orderDetailReport.getShippingCost()); 955 + if (orderDetailReport.getContractType() != null && orderDetailReport.getContractType().contains("加工")) {
  956 + vo.setReturnShippingCost(StringUtils.isNotBlank(orderDetailReport.getReturnShippingCost())
  957 + ? orderDetailReport.getReturnShippingCost()
  958 + : orderDetailReport.getShippingCost());
  959 + vo.setShippingCost(null);
  960 + } else {
  961 + vo.setShippingCost(StringUtils.isNotBlank(orderDetailReport.getShippingCost())
  962 + ? orderDetailReport.getShippingCost()
  963 + : orderDetailReport.getReturnShippingCost());
  964 + vo.setReturnShippingCost(null);
  965 + }
957 vo.setCustomerType(orderDetailReport.getCustomerType()); 966 vo.setCustomerType(orderDetailReport.getCustomerType());
958 vo.setQuality(orderDetailReport.getQuality()); 967 vo.setQuality(orderDetailReport.getQuality());
959 vo.setContractType(orderDetailReport.getContractType()); 968 vo.setContractType(orderDetailReport.getContractType());
@@ -577,8 +577,10 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR @@ -577,8 +577,10 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR
577 String type = standard.getType(); 577 String type = standard.getType();
578 if ("PROCESS_STD_AGMT".equals(type)) { 578 if ("PROCESS_STD_AGMT".equals(type)) {
579 vo.setReturnShippingCost(orderInfo.getShippingCost()); 579 vo.setReturnShippingCost(orderInfo.getShippingCost());
  580 + vo.setShippingCost(null);
580 } else { 581 } else {
581 vo.setShippingCost(orderInfo.getShippingCost()); 582 vo.setShippingCost(orderInfo.getShippingCost());
  583 + vo.setReturnShippingCost(null);
582 } 584 }
583 vo.setCustomerType(orderDetailReport.getCustomerType()); 585 vo.setCustomerType(orderDetailReport.getCustomerType());
584 vo.setQuality(line.getQuality()); 586 vo.setQuality(line.getQuality());
@@ -380,8 +380,10 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde @@ -380,8 +380,10 @@ public class PurchaseOrderInfoServiceImpl extends BaseMpServiceImpl<PurchaseOrde
380 String type = standard.getType(); 380 String type = standard.getType();
381 if ("PROCESS_STD_AGMT".equals(type)) { 381 if ("PROCESS_STD_AGMT".equals(type)) {
382 vo.setReturnShippingCost(purchaseOrderInfo.getShippingCost()); 382 vo.setReturnShippingCost(purchaseOrderInfo.getShippingCost());
  383 + vo.setShippingCost(null);
383 } else { 384 } else {
384 vo.setShippingCost(purchaseOrderInfo.getShippingCost()); 385 vo.setShippingCost(purchaseOrderInfo.getShippingCost());
  386 + vo.setReturnShippingCost(null);
385 } 387 }
386 if (customerCredit != null) { 388 if (customerCredit != null) {
387 SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", customerCredit.getEnterpriseType()); 389 SysDataDicItem dataDicItem = sysDataDicItemService.findByCode("ENTERPRISE_TYPE", customerCredit.getEnterpriseType());
@@ -250,6 +250,23 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR @@ -250,6 +250,23 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR
250 log.error("超协价格式错误,使用原始销售价。value=" + assessmentExceedsAgreement); 250 log.error("超协价格式错误,使用原始销售价。value=" + assessmentExceedsAgreement);
251 } 251 }
252 } 252 }
  253 +
  254 + String shippingCost = StringUtil.isBlank(vo.getShippingCost()) ? null : vo.getShippingCost();
  255 + String returnShippingCost = null;
  256 + boolean isProcessContract = false;
  257 + PurchaseOrderLine purchaseOrderLine = purchaseOrderLineService.findById(vo.getPurchaseOrderLineId());
  258 + if (purchaseOrderLine != null && StringUtils.isNotBlank(purchaseOrderLine.getPurchaseOrderId())) {
  259 + PurchaseOrderInfo purchaseOrderInfo = purchaseOrderInfoService.findById(purchaseOrderLine.getPurchaseOrderId());
  260 + if (purchaseOrderInfo != null && StringUtils.isNotBlank(purchaseOrderInfo.getContractId())) {
  261 + ContractDistributorStandard standard = contractDistributorStandardService.findById(purchaseOrderInfo.getContractId());
  262 + isProcessContract = standard != null && "PROCESS_STD_AGMT".equals(standard.getType());
  263 + }
  264 + }
  265 + if (isProcessContract) {
  266 + returnShippingCost = shippingCost;
  267 + shippingCost = null;
  268 + }
  269 +
253 LambdaUpdateWrapper<OrderDetailReport> updateWrapper = Wrappers.lambdaUpdate(OrderDetailReport.class) 270 LambdaUpdateWrapper<OrderDetailReport> updateWrapper = Wrappers.lambdaUpdate(OrderDetailReport.class)
254 .set(OrderDetailReport::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate()) 271 .set(OrderDetailReport::getDeliveryDate, vo.getDeliveryDate() == null ? null : vo.getDeliveryDate())
255 .set(OrderDetailReport::getAssessmentExceedsAgreement, StringUtil.isBlank(vo.getAssessmentExceedsAgreement()) ? null : vo.getAssessmentExceedsAgreement()) 272 .set(OrderDetailReport::getAssessmentExceedsAgreement, StringUtil.isBlank(vo.getAssessmentExceedsAgreement()) ? null : vo.getAssessmentExceedsAgreement())
@@ -262,7 +279,8 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR @@ -262,7 +279,8 @@ public class OrderDetailReportServiceImpl extends BaseMpServiceImpl<OrderDetailR
262 .set(OrderDetailReport::getPerformance, StringUtil.isBlank(vo.getPerformance()) ? null : vo.getPerformance()) 279 .set(OrderDetailReport::getPerformance, StringUtil.isBlank(vo.getPerformance()) ? null : vo.getPerformance())
263 .set(OrderDetailReport::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging()) 280 .set(OrderDetailReport::getPackaging, StringUtil.isBlank(vo.getPackaging()) ? null : vo.getPackaging())
264 .set(OrderDetailReport::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks()) 281 .set(OrderDetailReport::getRemarks, StringUtil.isBlank(vo.getRemarks()) ? null : vo.getRemarks())
265 - .set(OrderDetailReport::getShippingCost, StringUtil.isBlank(vo.getShippingCost()) ? null : vo.getShippingCost()) 282 + .set(OrderDetailReport::getShippingCost, shippingCost)
  283 + .set(OrderDetailReport::getReturnShippingCost, returnShippingCost)
266 .set(OrderDetailReport::getSuggestedPrice, StringUtil.isBlank(vo.getSuggestedPrice()) ? null : vo.getSuggestedPrice()) 284 .set(OrderDetailReport::getSuggestedPrice, StringUtil.isBlank(vo.getSuggestedPrice()) ? null : vo.getSuggestedPrice())
267 .set(OrderDetailReport::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess()) 285 .set(OrderDetailReport::getProductionProcess, StringUtil.isBlank(vo.getProductionProcess()) ? null : vo.getProductionProcess())
268 .eq(OrderDetailReport::getShowOrder, 0) 286 .eq(OrderDetailReport::getShowOrder, 0)