Browse Source

增加欧派的数据重复 推送的处理

training
pref_mail@163.com 1 year ago
parent
commit
99875029de
  1. 6
      blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java
  2. 34
      blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

6
blade-biz-common/src/main/java/org/springblade/common/constant/RedisKeyConstant.java

@ -3,4 +3,10 @@ package org.springblade.common.constant;
public class RedisKeyConstant {
/**
* 欧派入库扫描缓存key
*/
public static final String cache_oupai_key ="cache:oupai-key:";
}

34
blade-service/logpm-factory/src/main/java/com/logpm/factory/oupai/service/impl/OuPaiFactoryServiceImpl.java

@ -24,10 +24,12 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.io.IOUtils;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.constant.RedisKeyConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileLogsUtil;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.resource.feign.IOssClient;
@ -85,6 +87,9 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
@Autowired
private IOpPackagePushLogService opPackagePushLogService;
@Autowired
private BladeRedis bladeRedis;
@Override
public String saveOuPaiFactoryOrderDTOByCarCarNumber(String code) {
@ -288,11 +293,20 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
public Boolean checkReceivingOrder(String code) {
Boolean isUpdate = false;
String o = bladeRedis.get(RedisKeyConstant.cache_oupai_key + code);
if(code.equals(o)){
return true;
}
LambdaQueryWrapper<ReceivingOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode, code);
List<ReceivingOrderEntity> receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper);
if (ObjectUtils.isNotNull(receivingOrderEntities)) {
isUpdate = true;
// 加入缓存
bladeRedis.setEx(RedisKeyConstant.cache_oupai_key+code,code,60*60*60L);
}
return isUpdate;
}
@ -631,6 +645,17 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
//新发车单数据
ReceivingOrderEntity receivingOrderEntity = new ReceivingOrderEntity();
receivingOrderEntity.setCode(code);
LambdaQueryWrapper<ReceivingOrderEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceivingOrderEntity::getCode,code);
List<ReceivingOrderEntity> receivingOrderEntities = receivingOrderMapper.selectList(lambdaQueryWrapper);
if(ObjectUtils.isNotNull(receivingOrderEntities)){
log.info(">>>>>>>>>>>>>>>>>>>>>>> 收货单已存在 {} ",code);
return ;
}
String type = valueObject.getString("Type");
if ("中转".equals(type)) {
receivingOrderEntity.setType(1);
@ -796,6 +821,12 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
factoryOrderEntity.setReceiptStatus(0);
factoryOrderEntity.setPushStatus(0);
factoryOrderEntity.setTurnStatus(0);
//
boolean save = factoryOrderService.save(factoryOrderEntity);
if (!save) {
log.warn("############handleData: 保存订单失败 selfCode={}", selfCode);
@ -807,7 +838,10 @@ public class OuPaiFactoryServiceImpl implements IOuPaiFactoryService {
String packageCode = packageEntity.getString("Code");
QueryWrapper<FactoryPackageEntity> packageEntityQueryWrapper = new QueryWrapper<>();
packageEntityQueryWrapper.eq("code", packageCode);
FactoryPackageEntity factoryPackageEntity = factoryPackageService.getOne(packageEntityQueryWrapper);
if (Objects.isNull(factoryPackageEntity)) {
factoryPackageEntity = new FactoryPackageEntity();
factoryPackageEntity.setOrderId(orderId);

Loading…
Cancel
Save