Browse Source

增加仓库推送限制 判断只有目前使用了新系统的仓库才进行数据推送

single_db
pref_mail@163.com 1 year ago
parent
commit
a7468ee864
  1. 30
      blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java
  2. 3
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseLog.java
  3. 6
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  4. 10
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  5. 10
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java
  6. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java
  7. 14
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

30
blade-biz-common/src/main/java/org/springblade/common/constant/OldSystemDataPushConfig.java

@ -0,0 +1,30 @@
package org.springblade.common.constant;
import java.util.ArrayList;
import java.util.List;
/**
* 老系统仓库
* 配置允许的仓库ID
*/
public class OldSystemDataPushConfig {
private static List<String> warehourseIds = new ArrayList<>();
static {
warehourseIds.add("30");
warehourseIds.add("38");
warehourseIds.add("124");
}
public static List<String> getWarehourseIdList(){
return warehourseIds;
}
}

3
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/entity/WarehouseLog.java

@ -14,6 +14,9 @@ public class WarehouseLog extends BaseEntity {
private String args;
/**
* 1 开单数据推送 2 托盘空置
*/
private Integer type;
private String brand;//品牌

6
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -6,6 +6,7 @@ import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
@ -69,9 +70,10 @@ public class DealWithDataHandler {
// channel.basicAck(deliveryTag,false);
} else {
//真正的处理需要的数据
if ("38".equals(currentWarehouseId) || "124".equals(currentWarehouseId) || "30".equals(currentWarehouseId)) {
try {
if(OldSystemDataPushConfig.getWarehourseIdList().contains(currentWarehouseId)){
try {
if ("1".equals(status)) {
// 始发仓和目的仓入库

10
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -36,6 +36,7 @@ import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.utils.CommonUtil;
import org.springblade.common.utils.FileLogsUtil;
import org.springblade.core.oss.model.BladeFile;
@ -728,9 +729,11 @@ public class TestService {
// 获取字典上配置的不
// List<Dict> htUseOpShops = DictCache.getList("ht_use_op_shops");
// System.out.println(htUseOpShops);
String defaultRoleId = DictBizCache.getValue(DictBizConstant.DEFAULT_MALL_ROLE_ID, DictBizConstant.DEFAULT_MALL_ROLE_ID);
// String defaultRoleId = DictBizCache.getValue(DictBizConstant.DEFAULT_MALL_ROLE_ID, DictBizConstant.DEFAULT_MALL_ROLE_ID);
//
// System.out.println(defaultRoleId);
System.out.println(defaultRoleId);
// System.out.println(OldSystemDataPushConfig.getWarehourseIdList().contains(30+""));
}
@ -781,5 +784,8 @@ public class TestService {
}
}

10
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java

@ -12,6 +12,8 @@ import com.logpm.oldproject.service.IWayBillService;
import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
@ -44,6 +46,14 @@ public class OldWaybillClient implements IOldWaybillClient {
WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId));
// 需要验证当前需要开启的数据推送仓库
if(!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId()+"")){
log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId());
return null;
}
String authCode = oldLogin(byWaybillId.getArriveSiteId() + "");
String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId;

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java

@ -46,6 +46,11 @@ public class OldSystemPushController {
//
// private final IDistributionStockArticleClient distributionStockArticleClient;
/**
* 该接口需老系统判断这个运单的开单为 当前仓和始发仓为相同才进行推送
* @param waybillDTOS
* @return
*/
@ResponseBody
@PostMapping("/sendWaybillData")
@ApiOperationSupport(order = 1)
@ -96,7 +101,7 @@ public class OldSystemPushController {
WarehouseLog warehouseLog = new WarehouseLog();
warehouseLog.setArgs(JSONObject.toJSONString(map));
warehouseLog.setStatus(1);
warehouseLog.setType(1);
warehouseLog.setType(2);
warehouseLogService.save(warehouseLog);
//先判断托盘有没有数据

14
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseWaybillServiceImpl.java

@ -37,6 +37,7 @@ import com.logpm.warehouse.vo.WarehouseWaybillVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.OldSystemDataPushConfig;
import org.springblade.common.constant.TenantNum;
import org.springblade.common.constant.order.*;
import org.springblade.common.exception.CustomerException;
@ -82,10 +83,7 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
@Override
@Transactional(rollbackFor = Exception.class)
public void
waybillDataHandler(WaybillDTO waybillDTO) {
public void waybillDataHandler(WaybillDTO waybillDTO) {
// 这里需要通过查询运单信息 判单
@ -105,15 +103,17 @@ public class WarehouseWaybillServiceImpl extends BaseServiceImpl<WarehouseWaybil
WayBillEntity wayBillEntity = wayBillClient.getByWaybillId(wayBillId);
if (ObjectUtils.isNull(wayBillEntity)) {
log.warn("##############waybillDataHandler: 老系统中未找到对应运单waybillId={}", waybillDTO.getId());
throw new CustomerException("老系统中未找到对应运单");
}
// 需要验证当前需要开启的数据推送仓库
if(!OldSystemDataPushConfig.getWarehourseIdList().contains(wayBillEntity.getWarehouseId()+"")){
log.info(">>>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", wayBillEntity.getWarehouseId());
throw new CustomerException("当前开单仓库不是目前系统上线运行仓库");
}
String waybillNo = wayBillEntity.getWaybillNo();

Loading…
Cancel
Save