diff --git a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java index a0faa71eb..98bb69fae 100644 --- a/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java +++ b/blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java @@ -46,4 +46,7 @@ public interface IBasicdataFactoryCategoryClient { @PostMapping(API_PREFIX+"/findEntityByBrandAndMaterielName") BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity); + + @PostMapping(API_PREFIX+"/findEntityByPaeam") + BasicdataFactoryCategoryEntity findEntityByPaeam(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity); } diff --git a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java index ad52fcde9..f8397410f 100644 --- a/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java +++ b/blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java @@ -1,7 +1,9 @@ package com.logpm.basicdata.feign; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; @@ -14,7 +16,7 @@ import java.util.List; @ApiIgnore() @RestController @AllArgsConstructor -public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient{ +public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient { private final IBasicdataFactoryCategoryService factoryCategoryService; @@ -26,11 +28,11 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa @Override public BasicdataFactoryCategoryEntity findEntityByThreeCategory(BasicdataFactoryCategoryEntity entity) { return factoryCategoryService.getOne(Wrappers.query().lambda() - .eq(BasicdataFactoryCategoryEntity::getFirsts,entity.getFirsts()) - .eq(BasicdataFactoryCategoryEntity::getSeconds,entity.getSeconds()) - .eq(BasicdataFactoryCategoryEntity::getThirds,entity.getThirds()) - .eq(BasicdataFactoryCategoryEntity::getMaterielName,entity.getMaterielName()) - .eq(BasicdataFactoryCategoryEntity::getBrandId,entity.getBrandId()) + .eq(BasicdataFactoryCategoryEntity::getFirsts, entity.getFirsts()) + .eq(BasicdataFactoryCategoryEntity::getSeconds, entity.getSeconds()) + .eq(BasicdataFactoryCategoryEntity::getThirds, entity.getThirds()) + .eq(BasicdataFactoryCategoryEntity::getMaterielName, entity.getMaterielName()) + .eq(BasicdataFactoryCategoryEntity::getBrandId, entity.getBrandId()) ); } @@ -40,26 +42,26 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa .isNull(BasicdataFactoryCategoryEntity::getFirsts) .isNull(BasicdataFactoryCategoryEntity::getSeconds) .isNull(BasicdataFactoryCategoryEntity::getThirds) - .eq(BasicdataFactoryCategoryEntity::getMaterielName,entity2.getMaterielName()) + .eq(BasicdataFactoryCategoryEntity::getMaterielName, entity2.getMaterielName()) ); } @Override public BasicdataFactoryCategoryEntity findEntityByCategoryName(BasicdataFactoryCategoryEntity entity3) { - return factoryCategoryService.getOne(Wrappers.query().lambda() + return factoryCategoryService.getOne(Wrappers.query().lambda() .isNull(BasicdataFactoryCategoryEntity::getMaterielName) .isNull(BasicdataFactoryCategoryEntity::getSeconds) .isNull(BasicdataFactoryCategoryEntity::getThirds) - .eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts()) + .eq(BasicdataFactoryCategoryEntity::getFirsts, entity3.getFirsts()) ); } @Override public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) { - if(StrUtil.isEmpty(factoryCategoryEntity.getBrand())){ + if (StrUtil.isEmpty(factoryCategoryEntity.getBrand())) { return null; } - if(StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())){ + if (StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())) { return null; } List list = factoryCategoryService.list(Wrappers.query().lambda() @@ -67,7 +69,44 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa .eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()) .eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()) ); - if(CollUtil.isNotEmpty(list)){ + if (CollUtil.isNotEmpty(list)) { + return list.get(0); + } + return null; + } + + @Override + public BasicdataFactoryCategoryEntity findEntityByPaeam(BasicdataFactoryCategoryEntity factoryCategoryEntity) { + // 没有品牌直接返回 null + if (StrUtil.isBlank(factoryCategoryEntity.getBrand())) { + return null; + } + // 如果都为空,则返回 null + if (StrUtil.isBlank(factoryCategoryEntity.getFirsts()) + && StrUtil.isBlank(factoryCategoryEntity.getSeconds()) + && StrUtil.isBlank(factoryCategoryEntity.getThirds()) + && StrUtil.isBlank(factoryCategoryEntity.getMaterielName())) { + return null; + } + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(BasicdataFactoryCategoryEntity::getBrand, factoryCategoryEntity.getBrand()); + if (StrUtil.isNotEmpty(factoryCategoryEntity.getFirsts())) { + wrapper.eq(BasicdataFactoryCategoryEntity::getFirsts, factoryCategoryEntity.getFirsts()); + } + if (StrUtil.isNotEmpty(factoryCategoryEntity.getSeconds())) { + wrapper.eq(BasicdataFactoryCategoryEntity::getSeconds, factoryCategoryEntity.getSeconds()); + } + if (StrUtil.isNotEmpty(factoryCategoryEntity.getThirds())) { + wrapper.eq(BasicdataFactoryCategoryEntity::getThirds, factoryCategoryEntity.getThirds()); + } + if (StrUtil.isNotEmpty(factoryCategoryEntity.getMaterielName())) { + wrapper.eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()); + } + if (ObjectUtil.isNotEmpty(factoryCategoryEntity.getType())) { + wrapper.eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()); + } + List list = factoryCategoryService.list(wrapper); + if (CollUtil.isNotEmpty(list)) { return list.get(0); } return null; diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java index 545832bb9..7e98f822a 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java @@ -8,7 +8,8 @@ import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.logpm.basicdata.feign.IBasicdataDrivermiddleClient; +import com.logpm.basicdata.entity.BasicdataFactoryCategoryEntity; +import com.logpm.basicdata.feign.IBasicdataFactoryCategoryClient; import com.logpm.distribution.dto.ReportQualityDeliverDTO; import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.service.IDistributionAddvaluePackageService; @@ -66,11 +67,11 @@ public class DeliverFinishReportListener { @Resource private IFactoryDataClient factoryDataClient; @Resource - private IBasicdataDrivermiddleClient drivermiddleClient; - @Resource private IExpenseDispatchClient expenseDispatchClient; @Resource private IDistributionAddvaluePackageService addvaluePackageService; + @Resource + private IBasicdataFactoryCategoryClient factoryCategoryClient; @RabbitListener(bindings = @QueueBinding( value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillAndFinish.QUEUE.REPORT, durable = "true"), @@ -133,6 +134,19 @@ public class DeliverFinishReportListener { QualityDeliverEntity entity = new QualityDeliverEntity(); entity.setId(qualityDeliverEntity.getId()); entity.setCarComplateTime(new Date()); + // 查询品类 + BasicdataFactoryCategoryEntity param = new BasicdataFactoryCategoryEntity(); + param.setBrand(qualityDeliverEntity.getBrandName()); + param.setFirsts(qualityDeliverEntity.getFirstsProduct()); + param.setSeconds(qualityDeliverEntity.getSecondProduct()); + param.setThirds(qualityDeliverEntity.getThirdProduct()); + param.setMaterielName(qualityDeliverEntity.getMaterielName()); + param.setType(2); + BasicdataFactoryCategoryEntity factoryCategoryEntity = factoryCategoryClient.findEntityByPaeam(param); + if(ObjectUtil.isNotEmpty(factoryCategoryEntity)){ + entity.setCostCategory(factoryCategoryEntity.getCategory()); + entity.setCostCategoryId(factoryCategoryEntity.getCategoryId()); + } valueMap.put(qualityDeliverEntity.getId(), entity); } for (QualityDeliverEntity qualityDeliverEntity : value) {