From a82bf6d8220a6e3cecebcc482be2ab372f88cab2 Mon Sep 17 00:00:00 2001 From: zhaoqiaobo <583671871@qq.com> Date: Tue, 19 Nov 2024 14:59:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(all):=20=E6=88=91=E4=B9=90=E5=B7=A5?= =?UTF-8?q?=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 增加我乐工厂自动拉取订单数据 --- .../factorydata/olo/job/PullOrderDataJob.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java diff --git a/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java new file mode 100644 index 000000000..7bf9c0687 --- /dev/null +++ b/blade-service/logpm-factory-data/logpm-factory-data-olo/src/main/java/com/logpm/factorydata/olo/job/PullOrderDataJob.java @@ -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 pushDataJob(String param) throws Exception { + Map 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 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; + } + +}