Browse Source

Merge branch 'fix_bug_20231220' into fix_bug_20231221

single_db
zhenghaoyu 1 year ago
parent
commit
ca574cd092
  1. 18
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/OldWaybillClient.java

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

@ -13,7 +13,6 @@ 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;
@ -23,6 +22,7 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@ApiIgnore()
@RestController
@ -48,10 +48,10 @@ public class OldWaybillClient implements IOldWaybillClient {
WayBillEntity byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId));
if(byWaybillId==null){
return null;
while (Objects.isNull(byWaybillId)){
byWaybillId = wayBillService.getByWaybillId(Integer.parseInt(waybillId));
}
log.info(">>>>>>>>>>>>>>>>> 运单信息 {}", byWaybillId);
log.info(">>>>>>>>>>>>>>>>> 旧仓库ID 集合 {}", OldSystemDataPushConfig.getWarehourseIdList());
@ -59,17 +59,18 @@ public class OldWaybillClient implements IOldWaybillClient {
// 需要验证当前需要开启的数据推送仓库 null+""
if (!OldSystemDataPushConfig.getWarehourseIdList().contains(byWaybillId.getWarehouseId() + "")) {
log.info(">>> waybillDataHandler 当前开单仓库不是目前系统上线运行仓库 {}", byWaybillId.getWarehouseId());
return null;
return R.fail(405,"当前仓不处理");
}
String authCode = oldLogin(byWaybillId.getArriveSiteId() + "");
String url = oldSystemProperties.getUrl() + "openApi/newSystem.WaybillQuery/index?waybillId=" + waybillId;
log.info("#############waybillDataHandler: 请求地址为 url={}",url);
String body = HttpRequest.get(url).header("token", authCode).execute().body();
log.info(">>>>> waybillDataHandler 老系统返回结果 {} ",body);
JSONObject jsonObject = JSONObject.parseObject(body);
if (200 == Integer.parseInt(jsonObject.get("code").toString())) {
Integer code = jsonObject.getInteger("code");
if (200 == code) {
// 请求成功
JSONArray jsonArray = jsonObject.getJSONArray("data");
// 循环结果
@ -85,12 +86,9 @@ public class OldWaybillClient implements IOldWaybillClient {
String operationTime = DateUtil.format(new Date(), "yyyy-MM-dd hh:mm:ss");
oldSystemWaybillClient.handleDataToPlatform(unitNo, operationTime);
}
}
} else {
log.error("##################waybillDataHandler: 请求老系统接口 失败,url:{},waybillId:{}", url, waybillId);
// 请求失败
}
} catch (Exception e) {
log.error(">>>> 运单信息查询解析报错 ", e);

Loading…
Cancel
Save