Browse Source

feat(all): 增加配送车次完结计算成本逻辑

dist.1.3.0
zhaoqiaobo 7 months ago
parent
commit
6f434eefa8
  1. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java
  2. 3
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java
  3. 23
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java
  4. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java
  5. 35
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/QualityDeliverListener.java
  6. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java
  7. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java
  8. 44
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java
  9. 4
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java
  10. 21
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java

3
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java

@ -43,4 +43,7 @@ public interface IBasicdataFactoryCategoryClient {
*/
@PostMapping(API_PREFIX+"/findEntityByCategoryName")
BasicdataFactoryCategoryEntity findEntityByCategoryName(@RequestBody BasicdataFactoryCategoryEntity entity3);
@PostMapping(API_PREFIX+"/findEntityByBrandAndMaterielName")
BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity);
}

3
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/feign/IWarehouseWaybillDetailClient.java

@ -69,4 +69,7 @@ public interface IWarehouseWaybillDetailClient {
List<WarehouseWayBillDetail> findByWaybillIds(@RequestBody List<Long> waybillIds);
@PostMapping(API_PREFIX+"/deleteByWaybillNo")
void deleteByWaybillNo(String waybillNo);
@GetMapping(API_PREFIX+"/findENtityByCodeAndName")
WarehouseWayBillDetail findENtityByCodeAndName(@RequestParam String orderCode, @RequestParam String category);
}

23
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java

@ -1,5 +1,7 @@
package com.logpm.basicdata.feign;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity;
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService;
@ -7,7 +9,7 @@ import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.concurrent.locks.Condition;
import java.util.List;
@ApiIgnore()
@RestController
@ -51,4 +53,23 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts())
);
}
@Override
public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) {
if(StrUtil.isEmpty(factoryCategoryEntity.getBrand())){
return null;
}
if(StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())){
return null;
}
List<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda()
.eq(BasicdataFactoryCategoryEntity::getBrand, factoryCategoryEntity.getBrand())
.eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName())
.eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType())
);
if(CollUtil.isNotEmpty(list)){
return list.get(0);
}
return null;
}
}

11
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.feign.IBasicdataDrivermiddleClient;
import com.logpm.distribution.dto.ReportQualityDeliverDTO;
import com.logpm.distribution.entity.QualityDeliverEntity;
import com.logpm.distribution.service.IDistributionAddvaluePackageService;
import com.logpm.distribution.service.IQualityDeliverService;
import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.vo.SendMsg;
@ -66,6 +67,8 @@ public class DeliverFinishReportListener {
private IBasicdataDrivermiddleClient drivermiddleClient;
@Resource
private IExpenseDispatchClient expenseDispatchClient;
@Resource
private IDistributionAddvaluePackageService addvaluePackageService;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillAndFinish.QUEUE.REPORT, durable = "true"),
@ -218,6 +221,8 @@ public class DeliverFinishReportListener {
List<ExpenseDispatchPriceCategoryVO> addPriceList = priceVO.getAddPriceList();
if (CollUtil.isNotEmpty(addPriceList)) {
Map<Long, ExpenseDispatchPriceCategoryVO> addPriceMap = addPriceList.stream().collect(Collectors.toMap(ExpenseDispatchPriceCategoryVO::getCategoryId, v -> v));
Set<String> collect1 = value.stream().map(v -> v.getOrderPackageCode()).collect(Collectors.toSet());
Map<String, String> addvaluePackageMap = addvaluePackageService.findMapByPackageCode(collect1);
for (QualityDeliverEntity entity : value) {
if (ObjectUtil.isNotEmpty(entity.getCostCategoryId()) && addPriceMap.containsKey(entity.getCostCategoryId())) {
ExpenseDispatchPriceCategoryVO expenseDispatchPriceCategoryVO = addPriceMap.get(entity.getCostCategoryId());
@ -231,7 +236,11 @@ public class DeliverFinishReportListener {
// 装卸费单价
String loadingUnloadingFee = expenseDispatchPriceCategoryVO.getLoadingUnloadingFee();
// 上楼层数
Integer stairsNumber = entity.getStairsNumber();
// 查询出上楼层数
Integer stairsNumber = 0;
if (addvaluePackageMap.containsKey(entity.getOrderPackageCode())) {
stairsNumber = Convert.toInt(addvaluePackageMap.get(entity.getOrderPackageCode()));
}
// 签收数量
Integer signNum = entity.getSignNum();
if (ObjectUtil.isNotEmpty(signNum)) {

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

@ -20,8 +20,12 @@ import com.logpm.distribution.service.IDistributionParcelListService;
import com.logpm.distribution.service.IDistributionStockArticleService;
import com.logpm.distribution.service.IDistributionStockListService;
import com.logpm.distribution.service.IQualityDeliverService;
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.Nullable;
@ -71,6 +75,12 @@ public class QualityDeliverListener {
@Resource
private IBasicdataFactoryCategoryClient factoryCategoryClient;
@Resource
private ITrunklineAdvanceDetailClient advanceDetailClient;
@Resource
private IWarehouseWaybillDetailClient waybillDetailClient;
@RabbitListener(bindings = @QueueBinding(
value = @Queue(name = ReportConstants.REPORT_QUALITY_DELIVER_QUEUE, durable = "true"),
exchange = @Exchange(name = ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE, type = ExchangeTypes.TOPIC),
@ -205,6 +215,13 @@ public class QualityDeliverListener {
}
if (ObjectUtil.equals(PackageTypeEnums.LTL.getCode(), conditions)) {
// 零担
WarehouseWayBillDetail wayBillDetail = waybillDetailClient.findENtityByCodeAndName(qualityDeliverEntity.getOrderCode(), qualityDeliverEntity.getCategory());
if (ObjectUtil.isNotEmpty(wayBillDetail)) {
qualityDeliverEntity.setCostCategoryId(wayBillDetail.getProductId());
qualityDeliverEntity.setRevenueCategoryId(wayBillDetail.getProductId());
qualityDeliverEntity.setCostCategory(wayBillDetail.getProductName());
qualityDeliverEntity.setRevenueCategory(wayBillDetail.getProductName());
}
DistributionParcelListEntity parcelListEntity = parcelListService.findByOrderCodeAndCategory(qualityDeliverEntity.getOrderCode(), qualityDeliverEntity.getCategory(), qualityDeliverEntity.getWarehouseId());
buildCmpBasicInfo(qualityDeliverEntity, parcelListEntity);
// buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode());
@ -238,11 +255,17 @@ public class QualityDeliverListener {
BasicdataFactoryCategoryEntity factoryCategoryEntity = new BasicdataFactoryCategoryEntity();
factoryCategoryEntity.setMaterielName(materielName);
factoryCategoryEntity.setBrand(brandName);
BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByMaterielName(factoryCategoryEntity);
factoryCategoryEntity.setType(2);
BasicdataFactoryCategoryEntity categoryEntity = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity);
factoryCategoryEntity.setType(1);
BasicdataFactoryCategoryEntity categoryEntity1 = factoryCategoryClient.findEntityByBrandAndMaterielName(factoryCategoryEntity);
if (ObjectUtil.isNotEmpty(categoryEntity)) {
// TODO 存id
qualityDeliverEntity.setCostCategoryId(categoryEntity.getCategoryId());
qualityDeliverEntity.setCostCategory(categoryEntity.getCategory());
}
if (ObjectUtil.isNotEmpty(categoryEntity1)) {
qualityDeliverEntity.setRevenueCategory(categoryEntity.getCategory());
qualityDeliverEntity.setRevenueCategoryId(categoryEntity1.getCategoryId());
}
// TODO 从入库单上查询入库时间
}
@ -287,6 +310,14 @@ public class QualityDeliverListener {
// 构建运单相关信息
buildWaybillInfo(qualityDeliverEntity, waybillNumber);
}
// 暂存单查询结算品类
TrunklineAdvanceDetailEntity advanceDetailEntity = advanceDetailClient.findEntityByOrderPackageCode(qualityDeliverEntity.getOrderPackageCode());
if (ObjectUtil.isNotEmpty(advanceDetailEntity)) {
qualityDeliverEntity.setCostCategoryId(advanceDetailEntity.getCostCategoryId());
qualityDeliverEntity.setCostCategory(advanceDetailEntity.getCostCategoryName());
qualityDeliverEntity.setRevenueCategoryId(advanceDetailEntity.getIncomeCategoryId());
qualityDeliverEntity.setRevenueCategory(advanceDetailEntity.getIncomeCategoryName());
}
// 构建订单相关信息
buildOrderInfo(qualityDeliverEntity, qualityDeliverEntity.getWarehouseId(), qualityDeliverEntity.getOrderCode());
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/SignforReportListener.java

@ -1,6 +1,7 @@
package com.logpm.distribution.receiver.report;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
@ -72,6 +73,7 @@ public class SignforReportListener {
.signUserName(bean.getOperator())
.signTime(bean.getOperatorTime())
.signCarNumber(vo.getVehicleName())
.signCarId(StrUtil.isNotEmpty(vo.getVehicleId()) ? Convert.toLong(vo.getVehicleId()) : null)
.signTrainNumber(vo.getTrainNumber())
.signReservationCode(vo.getReservationCode())
.signType(vo.getOperatMode())

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionAddvaluePackageService.java

@ -24,6 +24,8 @@ import com.logpm.distribution.excel.DistributionAddvaluePackageExcel;
import com.logpm.distribution.vo.DistributionAddvaluePackageVO;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* 增值服务包件表 服务类
@ -50,4 +52,6 @@ public interface IDistributionAddvaluePackageService extends IService<Distributi
*/
List<DistributionAddvaluePackageExcel> exportDistributionAddvaluePackage(Wrapper<DistributionAddvaluePackageEntity> queryWrapper);
Map<String, String> findMapByPackageCode(Set<String> collect1);
}

44
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionAddvaluePackageServiceImpl.java

@ -16,17 +16,26 @@
*/
package com.logpm.distribution.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.distribution.entity.DistributionAddvalueDetailEntity;
import com.logpm.distribution.entity.DistributionAddvaluePackageEntity;
import com.logpm.distribution.excel.DistributionAddvaluePackageExcel;
import com.logpm.distribution.mapper.DistributionAddvaluePackageMapper;
import com.logpm.distribution.service.IDistributionAddvalueDetailService;
import com.logpm.distribution.service.IDistributionAddvaluePackageService;
import com.logpm.distribution.vo.DistributionAddvaluePackageVO;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 增值服务包件表 服务实现类
@ -37,6 +46,9 @@ import java.util.List;
@Service
public class DistributionAddvaluePackageServiceImpl extends BaseServiceImpl<DistributionAddvaluePackageMapper, DistributionAddvaluePackageEntity> implements IDistributionAddvaluePackageService {
@Resource
private IDistributionAddvalueDetailService addvalueDetailService;
@Override
public IPage<DistributionAddvaluePackageVO> selectDistributionAddvaluePackagePage(IPage<DistributionAddvaluePackageVO> page, DistributionAddvaluePackageVO distributionAddvaluePackage) {
return page.setRecords(baseMapper.selectDistributionAddvaluePackagePage(page, distributionAddvaluePackage));
@ -46,10 +58,34 @@ public class DistributionAddvaluePackageServiceImpl extends BaseServiceImpl<Dist
@Override
public List<DistributionAddvaluePackageExcel> exportDistributionAddvaluePackage(Wrapper<DistributionAddvaluePackageEntity> queryWrapper) {
List<DistributionAddvaluePackageExcel> distributionAddvaluePackageList = baseMapper.exportDistributionAddvaluePackage(queryWrapper);
//distributionAddvaluePackageList.forEach(distributionAddvaluePackage -> {
// distributionAddvaluePackageList.forEach(distributionAddvaluePackage -> {
// distributionAddvaluePackage.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionAddvaluePackage.getType()));
//});
return distributionAddvaluePackageList;
}
@Override
public Map<String, String> findMapByPackageCode(Set<String> collect1) {
Map<String, String> result = new HashMap<>();
List<DistributionAddvaluePackageEntity> list = this.list(Wrappers.<DistributionAddvaluePackageEntity>lambdaQuery()
.select(DistributionAddvaluePackageEntity::getAddvalueDetailId)
.in(DistributionAddvaluePackageEntity::getOrderPackageCode, collect1));
if (CollUtil.isNotEmpty(list)) {
// 转map
Map<Long, String> map = list.stream().collect(Collectors.toMap(DistributionAddvaluePackageEntity::getAddvalueDetailId, DistributionAddvaluePackageEntity::getOrderPackageCode));
List<DistributionAddvalueDetailEntity> list1 = addvalueDetailService.list(
Wrappers.<DistributionAddvalueDetailEntity>lambdaQuery()
.select(DistributionAddvalueDetailEntity::getFloolNum, DistributionAddvalueDetailEntity::getId)
.in(DistributionAddvalueDetailEntity::getId, map.keySet())
);
if (CollUtil.isNotEmpty(list1)) {
Map<Long, Integer> map1 = list1.stream().collect(Collectors.toMap(DistributionAddvalueDetailEntity::getId, DistributionAddvalueDetailEntity::getFloolNum));
map.forEach((k, v) -> {
result.put(v, map1.get(k) + "");
});
}
}
return result;
}
}

4
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionSignforServiceImpl.java

@ -2959,6 +2959,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionLoadscaninvnEntity distributionLoadscanEntity = pushList.get(0);
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
DistributionReservationEntity byId = distributionReservationService.getById(distributionLoadscanEntity.getReservationId());
if (!Func.isEmpty(byId)) {
@ -3012,6 +3013,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionLoadscanEntity distributionLoadscanEntity = pushList.get(0);
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
// 获取车辆类型
String carModelType = iBasicCarModelClient.getCarModelByCarNumber(distributionLoadscanEntity.getVehicleName());
@ -5814,6 +5816,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
DistributionLoadscanEntity distributionLoadscanEntity = distributionLoadscanEntityLists.get(0);
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
distributionLoadVO.setReservationCode(reservationEntity.getReservationCode());
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
distributionLoadVO.setReservationId(reservationEntity.getId());
@ -6687,6 +6690,7 @@ public class DistributionSignforServiceImpl extends BaseServiceImpl<Distribution
distributionLoadVO.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
distributionLoadVO.setDriverName(distributionLoadscanEntity.getDriverName());
distributionLoadVO.setVehicleName(distributionLoadscanEntity.getVehicleName());
distributionLoadVO.setVehicleId(distributionLoadscanEntity.getVehicleId());
DistributionReservationEntity byId = distributionReservationService.getById(distributionLoadscanEntity.getReservationId());
if (!Func.isEmpty(byId)) {
distributionLoadVO.setReservationCode(byId.getReservationCode());

21
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/WarehouseWaybillDetailClient.java

@ -1,5 +1,8 @@
package com.logpm.warehouse.feign;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.service.IWarehouseWayBillDetailService;
import lombok.AllArgsConstructor;
@ -59,4 +62,22 @@ public class WarehouseWaybillDetailClient implements IWarehouseWaybillDetailClie
public void deleteByWaybillNo(String waybillNo) {
warehouseWayBillDetailService.deleteByWaybillNo(waybillNo);
}
@Override
public WarehouseWayBillDetail findENtityByCodeAndName(String orderCode, String category) {
if(StrUtil.isEmpty(orderCode)){
return null;
}
if(StrUtil.isEmpty(category)){
return null;
}
List<WarehouseWayBillDetail> list = warehouseWayBillDetailService.list(Wrappers.<WarehouseWayBillDetail>lambdaQuery()
.eq(WarehouseWayBillDetail::getWaybillNo, orderCode)
.eq(WarehouseWayBillDetail::getProductName, category)
);
if(CollUtil.isNotEmpty(list)){
return list.get(0);
}
return null;
}
}

Loading…
Cancel
Save