Browse Source

feat(all): 我乐工厂

1 增加我乐工厂自动拉取订单数据
fix-sign
zhaoqiaobo 5 months ago
parent
commit
e5d4f7368a
  1. 12
      blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java
  2. 4
      blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java

12
blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java

@ -7,6 +7,7 @@ import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.logpm.factorydata.olo.pros.OldProperties;
import com.logpm.factorydata.olo.service.DeliveryNoteService;
import com.logpm.factorydata.olo.vo.DeliveryNoteVO;
import com.xxl.job.core.biz.model.ReturnT;
@ -30,6 +31,7 @@ import java.util.stream.Collectors;
public class PullOrderDataJob {
private final DeliveryNoteService deliveryNoteService;
private final OldProperties oldProperties;
/**
* 定时获取老系统数据
@ -46,16 +48,14 @@ public class PullOrderDataJob {
} else {
oldParam.put("date", DateUtil.today());
}
String s = HttpUtil.get("http://twms.huitongys.com/openApi/new-system/wole-data", oldParam);
log.info("请求返回==》 {}", s);
if(StrUtil.isNotEmpty(s)){
String s = HttpUtil.get(oldProperties.getPullOrderUrl(), oldParam);
if (StrUtil.isNotEmpty(s)) {
JSONObject entries = JSONUtil.parseObj(s);
JSONArray data = entries.getJSONArray("data");
List<DeliveryNoteVO> vos = data.stream().map(p -> BeanUtil.toBean(p, DeliveryNoteVO.class)).collect(Collectors.toList());
log.info("vos==>{}",JSONUtil.toJsonStr(vos));
String res = "";
try {
// res = deliveryNoteService.order(vos);
log.info("拉取老系统订单数:{}", vos.size());
deliveryNoteService.order(vos);
} catch (Exception e) {
log.error("工厂订单异常:{} ", e);
}

4
blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/pros/OldProperties.java

@ -15,6 +15,10 @@ public class OldProperties {
* 推送节点数据到来系统的 url
*/
private String pushNodeUrl;
/**
* 拉取我乐老系统订单 url
*/
private String pullOrderUrl;
/** 是否推送工厂 */
private Boolean enable = true;

Loading…
Cancel
Save