Browse Source

feat(all): 优化配送明细报表消费

1 删除一些不必要的逻辑,提高消费效率
visual
zhaoqiaobo 3 months ago
parent
commit
5e25010f64
  1. 54
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java

54
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java

@ -7,7 +7,6 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataFactoryCategoryClient; import com.logpm.basicdata.feign.IBasicdataFactoryCategoryClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -20,7 +19,6 @@ import com.logpm.distribution.service.IDistributionParcelListService;
import com.logpm.distribution.service.IDistributionStockArticleService; import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.service.IDistributionStockListService; import com.logpm.distribution.service.IDistributionStockListService;
import com.logpm.distribution.service.IQualityDeliverService; import com.logpm.distribution.service.IQualityDeliverService;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient; import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import com.logpm.warehouse.entity.WarehouseWayBillDetail; import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.entity.WarehouseWaybillEntity; import com.logpm.warehouse.entity.WarehouseWaybillEntity;
@ -194,11 +192,13 @@ public class QualityDeliverListener {
private void saveOrUpdate(LambdaQueryWrapper<QualityDeliverEntity> wrapper, QualityDeliverEntity qualityDeliverEntity) { private void saveOrUpdate(LambdaQueryWrapper<QualityDeliverEntity> wrapper, QualityDeliverEntity qualityDeliverEntity) {
QualityDeliverEntity entity = null; QualityDeliverEntity entity = null;
if (ObjectUtil.isNotEmpty(wrapper)) { if (ObjectUtil.isNotEmpty(wrapper)) {
wrapper.select(QualityDeliverEntity::getId);
entity = qualityDeliverService.getOne(wrapper); entity = qualityDeliverService.getOne(wrapper);
} }
if (ObjectUtil.isNotEmpty(entity)) { if (ObjectUtil.isNotEmpty(entity)) {
// 修改 // 修改
qualityDeliverService.update(qualityDeliverEntity, wrapper); qualityDeliverEntity.setId(entity.getId());
qualityDeliverService.updateById(qualityDeliverEntity);
} else { } else {
// 新增 // 新增
// 初始化基础数据 // 初始化基础数据
@ -262,24 +262,24 @@ public class QualityDeliverListener {
qualityDeliverEntity.setEndWarehouseInTime(stockList.getWarehousingTime()); qualityDeliverEntity.setEndWarehouseInTime(stockList.getWarehousingTime());
} }
// 品类 // 品类
if (StrUtil.isNotEmpty(materielName) && StrUtil.isNotEmpty(brandName)) { // if (StrUtil.isNotEmpty(materielName) && StrUtil.isNotEmpty(brandName)) {
BasicdataFactoryCategoryEntity factoryCategoryEntity = new BasicdataFactoryCategoryEntity(); // BasicdataFactoryCategoryEntity factoryCategoryEntity = new BasicdataFactoryCategoryEntity();
factoryCategoryEntity.setMaterielName(materielName); // factoryCategoryEntity.setMaterielName(materielName);
factoryCategoryEntity.setBrand(brandName); // factoryCategoryEntity.setBrand(brandName);
factoryCategoryEntity.setType(2); // factoryCategoryEntity.setType(2);
BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity); // BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity);
factoryCategoryEntity.setType(1); // factoryCategoryEntity.setType(1);
BasicdataFactoryCategoryEntity categoryEntity1 = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity); // BasicdataFactoryCategoryEntity categoryEntity1 = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity);
if (ObjectUtil.isNotEmpty(categoryEntity)) { // if (ObjectUtil.isNotEmpty(categoryEntity)) {
qualityDeliverEntity.setCostCategoryId(categoryEntity.getCategoryId()); // qualityDeliverEntity.setCostCategoryId(categoryEntity.getCategoryId());
qualityDeliverEntity.setCostCategory(categoryEntity.getCategory()); // qualityDeliverEntity.setCostCategory(categoryEntity.getCategory());
} // }
if (ObjectUtil.isNotEmpty(categoryEntity1)) { // if (ObjectUtil.isNotEmpty(categoryEntity1)) {
qualityDeliverEntity.setRevenueCategory(categoryEntity.getCategory()); // qualityDeliverEntity.setRevenueCategory(categoryEntity.getCategory());
qualityDeliverEntity.setRevenueCategoryId(categoryEntity1.getCategoryId()); // qualityDeliverEntity.setRevenueCategoryId(categoryEntity1.getCategoryId());
} // }
// TODO 从入库单上查询入库时间 // TODO 从入库单上查询入库时间
} // }
} }
} }
@ -322,13 +322,13 @@ public class QualityDeliverListener {
buildWaybillInfo(qualityDeliverEntity, waybillNumber); buildWaybillInfo(qualityDeliverEntity, waybillNumber);
} }
// 暂存单查询结算品类 // 暂存单查询结算品类
TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailClient.findEntityByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode()); // TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailClient.findEntityByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode());
if (ObjectUtil.isNotEmpty(advanceDetailEntity)) { // if (ObjectUtil.isNotEmpty(advanceDetailEntity)) {
qualityDeliverEntity.setCostCategoryId(advanceDetailEntity.getCostCategoryId()); // qualityDeliverEntity.setCostCategoryId(advanceDetailEntity.getCostCategoryId());
qualityDeliverEntity.setCostCategory(advanceDetailEntity.getCostCategoryName()); // qualityDeliverEntity.setCostCategory(advanceDetailEntity.getCostCategoryName());
qualityDeliverEntity.setRevenueCategoryId(advanceDetailEntity.getIncomeCategoryId()); // qualityDeliverEntity.setRevenueCategoryId(advanceDetailEntity.getIncomeCategoryId());
qualityDeliverEntity.setRevenueCategory(advanceDetailEntity.getIncomeCategoryName()); // qualityDeliverEntity.setRevenueCategory(advanceDetailEntity.getIncomeCategoryName());
} // }
// 构建订单相关信息 // 构建订单相关信息
buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode()); buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode());
} }

Loading…
Cancel
Save