1 changed files with 66 additions and 0 deletions
@ -0,0 +1,66 @@ |
|||||||
|
package com.logpm.factorydata.olo.job; |
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil; |
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
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.service.DeliveryNoteService; |
||||||
|
import com.logpm.factorydata.olo.vo.DeliveryNoteVO; |
||||||
|
import com.xxl.job.core.biz.model.ReturnT; |
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author zhaoqiaobo |
||||||
|
* @create 2024-04-02 |
||||||
|
*/ |
||||||
|
@AllArgsConstructor |
||||||
|
@Component |
||||||
|
@Slf4j |
||||||
|
public class PullOrderDataJob { |
||||||
|
|
||||||
|
private final DeliveryNoteService deliveryNoteService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 定时获取老系统数据 |
||||||
|
* |
||||||
|
* @param param |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
@XxlJob("pullOrederOldData") |
||||||
|
public ReturnT<String> pushDataJob(String param) throws Exception { |
||||||
|
Map<String, Object> oldParam = new HashMap<>(); |
||||||
|
if (StrUtil.isNotEmpty(param)) { |
||||||
|
oldParam.put("date", param); |
||||||
|
} else { |
||||||
|
oldParam.put("date", DateUtil.today()); |
||||||
|
} |
||||||
|
String s = HttpUtil.get("http://twms.huitongys.com/openApi/newSystem/woledata/get", oldParam); |
||||||
|
log.info("请求返回==》 {}", s); |
||||||
|
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);
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("工厂订单异常:{} ", e); |
||||||
|
} |
||||||
|
} |
||||||
|
return ReturnT.SUCCESS; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue