Commit cce74b8f by 罗承锋

预制卡变更待配送状态

parent b8d24f0a
...@@ -1938,7 +1938,7 @@ public class IntelligenceSendOrder { ...@@ -1938,7 +1938,7 @@ public class IntelligenceSendOrder {
HashMap<String, Object> mapData = new HashMap<>(); HashMap<String, Object> mapData = new HashMap<>();
mapData.putAll(OBJECT_MAPPER.readValue(httpResult, mapData.getClass())); mapData.putAll(OBJECT_MAPPER.readValue(httpResult, mapData.getClass()));
log.info("智能平台请求状态返回数据:" + mapData); log.info("智能平台请求状态返回数据:" + mapData);
if (mapData.get("status") == "000001") { if ("000001".equals(mapData.get("status"))) {
return JSONObject.toJSONString(mapData); return JSONObject.toJSONString(mapData);
} }
} catch (SocketTimeoutException e) { } catch (SocketTimeoutException e) {
......
...@@ -56,15 +56,67 @@ public class OrderTask { ...@@ -56,15 +56,67 @@ public class OrderTask {
} }
/** /**
* 更新移动卡的状态
*/
@Scheduled(cron = "0 0/2 * * * ?")
public void updateMobileCardStatus() {
log.info("更新预制卡状态开始");
// 有卡品id,并且未审核中的状态
Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("order_status", "审核中");
wrapper.isNotNull("package_id");
wrapper.isNotNull("order_id");
List<Order> orders = orderMapper.selectList(wrapper);
// 循环请求获取数据
for(Order order : orders) {
if (StringUtils.isNotBlank(order.getOrderId())) {
String s = intelligenceSendOrder.queryStatus( null, order.getOrderId());
if (StringUtils.isNotBlank(s)) {
Order update = new Order();
update.setId(order.getId());
update.setUpdateTime(new Date());
JSONObject json = JSONObject.parseObject(s);
OrderHistory orderHistory = new OrderHistory();
orderHistory.setOrderId(order.getId());
orderHistory.setCreateDate(new Date());
orderHistory.setStatus("智能平台状态获取");
// 未获取到需要的状态不做更新
if ("待配送".equals(json.get("orderStatus")) || "物流配送中".equals(json.get("orderStatus"))
|| "配送成功".equals(json.get("orderStatus")) || "归档".equals(json.get("orderStatus"))) {
orderHistory.setStatus("审核通过,等待配送");
orderHistoryMapper.insert(orderHistory);
update.setThStatus(json.get("orderStatus").toString());
update.setOrderStatus("待配送");
orderMapper.updateById(update);
} else if (json.get("orderStatus").equals("待图片审核") || json.get("orderStatus").equals("作废")) {
orderHistory.setStatus(json.getString("orderStatus"));
orderHistoryMapper.insert(orderHistory);
update.setThStatus(json.get("orderStatus").toString());
update.setOrderStatus("异常单");
orderMapper.updateById(update);
}
}
}
}
log.info("更新预制卡状态完成");
}
/**
* 定时器更新智能平台状态 * 定时器更新智能平台状态
*/ */
@Scheduled(cron = "0 0/5 * * * ?") @Scheduled(cron = "0 0/5 * * * ?")
// @Scheduled(fixedRate=28800000)
public void updateStatus() { public void updateStatus() {
// 获取审核中的订单 // 获取审核中的订单
Wrapper<Order> wrapper = new EntityWrapper<>(); Wrapper<Order> wrapper = new EntityWrapper<>();
wrapper.eq("order_status", "审核中"); wrapper.eq("order_status", "审核中");
wrapper.isNull("package_id");
List<Order> orders = orderMapper.selectList(wrapper); List<Order> orders = orderMapper.selectList(wrapper);
// 循环请求获取数据 // 循环请求获取数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment