Browse Source

feat(all): 修改车次完结时计算成本时的结算品类取值问题

dist.1.3.0
zhaoqiaobo 6 months ago
parent
commit
34a3588540
  1. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataFactoryCategoryClient.java
  2. 63
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataFactoryCategoryEntityClient.java
  3. 20
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/report/DeliverFinishReportListener.java

3
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") @PostMapping(API_PREFIX+"/findEntityByBrandAndMaterielName")
BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity); BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity);
@PostMapping(API_PREFIX+"/findEntityByPaeam")
BasicdataFactoryCategoryEntity findEntityByPaeam(@RequestBody BasicdataFactoryCategoryEntity factoryCategoryEntity);
} }

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

@ -1,7 +1,9 @@
package com.logpm.basicdata.feign; package com.logpm.basicdata.feign;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
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.BasicdataFactoryCategoryEntity;
import com.logpm.basicdata.service.IBasicdataFactoryCategoryService; import com.logpm.basicdata.service.IBasicdataFactoryCategoryService;
@ -14,7 +16,7 @@ import java.util.List;
@ApiIgnore() @ApiIgnore()
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient{ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCategoryClient {
private final IBasicdataFactoryCategoryService factoryCategoryService; private final IBasicdataFactoryCategoryService factoryCategoryService;
@ -26,11 +28,11 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
@Override @Override
public BasicdataFactoryCategoryEntity findEntityByThreeCategory(BasicdataFactoryCategoryEntity entity) { public BasicdataFactoryCategoryEntity findEntityByThreeCategory(BasicdataFactoryCategoryEntity entity) {
return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda()
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity.getFirsts()) .eq(BasicdataFactoryCategoryEntity::getFirsts, entity.getFirsts())
.eq(BasicdataFactoryCategoryEntity::getSeconds,entity.getSeconds()) .eq(BasicdataFactoryCategoryEntity::getSeconds, entity.getSeconds())
.eq(BasicdataFactoryCategoryEntity::getThirds,entity.getThirds()) .eq(BasicdataFactoryCategoryEntity::getThirds, entity.getThirds())
.eq(BasicdataFactoryCategoryEntity::getMaterielName,entity.getMaterielName()) .eq(BasicdataFactoryCategoryEntity::getMaterielName, entity.getMaterielName())
.eq(BasicdataFactoryCategoryEntity::getBrandId,entity.getBrandId()) .eq(BasicdataFactoryCategoryEntity::getBrandId, entity.getBrandId())
); );
} }
@ -40,26 +42,26 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
.isNull(BasicdataFactoryCategoryEntity::getFirsts) .isNull(BasicdataFactoryCategoryEntity::getFirsts)
.isNull(BasicdataFactoryCategoryEntity::getSeconds) .isNull(BasicdataFactoryCategoryEntity::getSeconds)
.isNull(BasicdataFactoryCategoryEntity::getThirds) .isNull(BasicdataFactoryCategoryEntity::getThirds)
.eq(BasicdataFactoryCategoryEntity::getMaterielName,entity2.getMaterielName()) .eq(BasicdataFactoryCategoryEntity::getMaterielName, entity2.getMaterielName())
); );
} }
@Override @Override
public BasicdataFactoryCategoryEntity findEntityByCategoryName(BasicdataFactoryCategoryEntity entity3) { public BasicdataFactoryCategoryEntity findEntityByCategoryName(BasicdataFactoryCategoryEntity entity3) {
return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() return factoryCategoryService.getOne(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda()
.isNull(BasicdataFactoryCategoryEntity::getMaterielName) .isNull(BasicdataFactoryCategoryEntity::getMaterielName)
.isNull(BasicdataFactoryCategoryEntity::getSeconds) .isNull(BasicdataFactoryCategoryEntity::getSeconds)
.isNull(BasicdataFactoryCategoryEntity::getThirds) .isNull(BasicdataFactoryCategoryEntity::getThirds)
.eq(BasicdataFactoryCategoryEntity::getFirsts,entity3.getFirsts()) .eq(BasicdataFactoryCategoryEntity::getFirsts, entity3.getFirsts())
); );
} }
@Override @Override
public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) { public BasicdataFactoryCategoryEntity findEntityByBrandAndMaterielName(BasicdataFactoryCategoryEntity factoryCategoryEntity) {
if(StrUtil.isEmpty(factoryCategoryEntity.getBrand())){ if (StrUtil.isEmpty(factoryCategoryEntity.getBrand())) {
return null; return null;
} }
if(StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())){ if (StrUtil.isEmpty(factoryCategoryEntity.getMaterielName())) {
return null; return null;
} }
List<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda() List<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(Wrappers.<BasicdataFactoryCategoryEntity>query().lambda()
@ -67,7 +69,44 @@ public class BasicdataFactoryCategoryEntityClient implements IBasicdataFactoryCa
.eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName()) .eq(BasicdataFactoryCategoryEntity::getMaterielName, factoryCategoryEntity.getMaterielName())
.eq(BasicdataFactoryCategoryEntity::getType, factoryCategoryEntity.getType()) .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<BasicdataFactoryCategoryEntity> wrapper = Wrappers.<BasicdataFactoryCategoryEntity>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<BasicdataFactoryCategoryEntity> list = factoryCategoryService.list(wrapper);
if (CollUtil.isNotEmpty(list)) {
return list.get(0); return list.get(0);
} }
return null; return null;

20
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.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.dto.ReportQualityDeliverDTO;
import com.logpm.distribution.entity.QualityDeliverEntity; import com.logpm.distribution.entity.QualityDeliverEntity;
import com.logpm.distribution.service.IDistributionAddvaluePackageService; import com.logpm.distribution.service.IDistributionAddvaluePackageService;
@ -66,11 +67,11 @@ public class DeliverFinishReportListener {
@Resource @Resource
private IFactoryDataClient factoryDataClient; private IFactoryDataClient factoryDataClient;
@Resource @Resource
private IBasicdataDrivermiddleClient drivermiddleClient;
@Resource
private IExpenseDispatchClient expenseDispatchClient; private IExpenseDispatchClient expenseDispatchClient;
@Resource @Resource
private IDistributionAddvaluePackageService addvaluePackageService; private IDistributionAddvaluePackageService addvaluePackageService;
@Resource
private IBasicdataFactoryCategoryClient factoryCategoryClient;
@RabbitListener(bindings = @QueueBinding( @RabbitListener(bindings = @QueueBinding(
value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillAndFinish.QUEUE.REPORT, durable = "true"), value = @Queue(name = FanoutConstants.DeliveryOfPickup.BillAndFinish.QUEUE.REPORT, durable = "true"),
@ -133,6 +134,19 @@ public class DeliverFinishReportListener {
QualityDeliverEntity entity = new QualityDeliverEntity(); QualityDeliverEntity entity = new QualityDeliverEntity();
entity.setId(qualityDeliverEntity.getId()); entity.setId(qualityDeliverEntity.getId());
entity.setCarComplateTime(new Date()); 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); valueMap.put(qualityDeliverEntity.getId(), entity);
} }
for (QualityDeliverEntity qualityDeliverEntity : value) { for (QualityDeliverEntity qualityDeliverEntity : value) {

Loading…
Cancel
Save