|
|
@ -85,16 +85,62 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void handleData(OrderInfoDTO orderInfoDTO) { |
|
|
|
public void handleData(OrderInfoDTO orderInfoDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先保存原始请求数据
|
|
|
|
|
|
|
|
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); |
|
|
|
|
|
|
|
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderInfoDTO)); |
|
|
|
|
|
|
|
panOrderStatusLog.setStatus(1); |
|
|
|
|
|
|
|
panOrderStatusLog.setType(1); |
|
|
|
|
|
|
|
panOrderStatusLogService.save(panOrderStatusLog); |
|
|
|
|
|
|
|
|
|
|
|
//根据客户订单号去查询WMS装车清单号
|
|
|
|
//根据客户订单号去查询WMS装车清单号
|
|
|
|
QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>(); |
|
|
|
QueryWrapper<PanFactoryOrder> queryWrapper = new QueryWrapper<>(); |
|
|
|
queryWrapper.eq("order_no",orderInfoDTO.getOrderNo()); |
|
|
|
queryWrapper.eq("order_no",orderInfoDTO.getOrderNo()); |
|
|
|
PanFactoryOrder panFactoryOrder = factoryOrderService.getOne(queryWrapper); |
|
|
|
PanFactoryOrder panFactoryOrder = factoryOrderService.getOne(queryWrapper); |
|
|
|
String loadingList = panFactoryOrder.getLoadingList();//装车清单编号
|
|
|
|
String plantId = panFactoryOrder.getPlantId();//工厂id
|
|
|
|
orderInfoDTO.setLoadingList(loadingList); |
|
|
|
String deliveryNumber = panFactoryOrder.getDeliveryNumber(); |
|
|
|
|
|
|
|
orderInfoDTO.setPlantId(plantId); |
|
|
|
|
|
|
|
orderInfoDTO.setDeliveryNumber(deliveryNumber); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拼接参数
|
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("payload", JSONObject.toJSONString(orderInfoDTO)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
|
|
|
|
|
|
String s = gson.toJson(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//先获取token
|
|
|
|
|
|
|
|
String panToken = getPanToken(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//请求参数
|
|
|
|
|
|
|
|
logger.info("##############handleData: 推送包件状态请求参数 {}",s); |
|
|
|
|
|
|
|
//处理逻辑
|
|
|
|
|
|
|
|
//TODO 这里还差那边给到请求接口
|
|
|
|
|
|
|
|
String result = HttpRequest.post(panFactoryProperties.getUrl()+"") |
|
|
|
|
|
|
|
.header("Authorization","Bearer "+panToken) |
|
|
|
|
|
|
|
.header("Content-Type","application/json") |
|
|
|
|
|
|
|
.body(s).timeout(5 * 1000) |
|
|
|
|
|
|
|
.execute().body(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.info("##############handleData: 推送包件状态返回参数 {}",result); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//把结果字符串转为json对象
|
|
|
|
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(result); |
|
|
|
|
|
|
|
JSONObject payload = jsonObject.getJSONObject("payload"); |
|
|
|
|
|
|
|
if(!Objects.isNull(payload)){ |
|
|
|
|
|
|
|
Integer code = payload.getInteger("code"); |
|
|
|
|
|
|
|
String message = payload.getString("data"); |
|
|
|
|
|
|
|
if(code.equals(1)){ |
|
|
|
|
|
|
|
logger.info("##########handleData: 物流状态传递成功"); |
|
|
|
|
|
|
|
panOrderStatusLog.setStatus(0); |
|
|
|
|
|
|
|
panOrderStatusLogService.saveOrUpdate(panOrderStatusLog); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
throw new CustomerException(400,message); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
throw new CustomerException(400,"返回格式有误:"+result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//推送到皮阿诺系统
|
|
|
|
|
|
|
|
String url = ""; |
|
|
|
|
|
|
|
// String result = HttpRequest.post(url+"/oauth/oauth/token").form(map).timeout(5 * 1000).execute().body();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -105,12 +151,11 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService { |
|
|
|
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); |
|
|
|
PanOrderStatusLog panOrderStatusLog = new PanOrderStatusLog(); |
|
|
|
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); |
|
|
|
panOrderStatusLog.setArgs(JSONObject.toJSONString(orderStatusDTO)); |
|
|
|
panOrderStatusLog.setStatus(1); |
|
|
|
panOrderStatusLog.setStatus(1); |
|
|
|
|
|
|
|
panOrderStatusLog.setType(2); |
|
|
|
panOrderStatusLogService.save(panOrderStatusLog); |
|
|
|
panOrderStatusLogService.save(panOrderStatusLog); |
|
|
|
|
|
|
|
|
|
|
|
//拼接参数
|
|
|
|
//拼接参数
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
// map.put("payload",JSONObject.toJSONString(orderStatusDTO));
|
|
|
|
|
|
|
|
// map.put("payload", CommonUtil.formatJson(orderStatusDTO));
|
|
|
|
|
|
|
|
map.put("payload", JSONObject.toJSONString(orderStatusDTO)); |
|
|
|
map.put("payload", JSONObject.toJSONString(orderStatusDTO)); |
|
|
|
|
|
|
|
|
|
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
|
|
Gson gson = new GsonBuilder().setPrettyPrinting().create(); |
|
|
|