|
|
@@ -0,0 +1,82 @@
|
|
|
+package com.jjt.order;
|
|
|
+
|
|
|
+import cn.hutool.http.HttpUtil;
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.jjt.JjtApplication;
|
|
|
+import com.jjt.biz.vo.OrderFlowerVO;
|
|
|
+import com.jjt.order.service.ITwinOrderService;
|
|
|
+import com.jjt.utils.MssqlService;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * DataProcess$
|
|
|
+ *
|
|
|
+ * @author wukai
|
|
|
+ * @date 2024/5/7 11:49
|
|
|
+ */
|
|
|
+@SpringBootTest(classes = JjtApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
|
|
+public class MesTest {
|
|
|
+ @Resource
|
|
|
+ private ITwinOrderService orderService;
|
|
|
+ // @Resource
|
|
|
+// private ITwinFormulaInfoService formulaInfoService;
|
|
|
+ @Resource
|
|
|
+ private MssqlService mssqlService;
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ Map<String, Map<String, Object>> map = new HashMap<>();
|
|
|
+ String url = "http://192.168.33.113/mes/api/v1/PmOrderFace4ZHENA/getOrderFlowerLister";
|
|
|
+ String result = HttpUtil.post(url, "{}");
|
|
|
+
|
|
|
+ // 解析JSON数据并放入List中
|
|
|
+ List<OrderFlowerVO> orderFlowers = parseOrderFlowers(result);
|
|
|
+
|
|
|
+ // 打印解析结果
|
|
|
+ for (OrderFlowerVO flower : orderFlowers) {
|
|
|
+ System.out.println(flower.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解析订单花型数据
|
|
|
+ * @param jsonResult JSON结果字符串
|
|
|
+ * @return 订单花型列表
|
|
|
+ */
|
|
|
+ private static List<OrderFlowerVO> parseOrderFlowers(String jsonResult) {
|
|
|
+ List<OrderFlowerVO> orderFlowers = new ArrayList<>();
|
|
|
+
|
|
|
+ // 解析JSON
|
|
|
+ JSONObject jsonObject = JSON.parseObject(jsonResult);
|
|
|
+ JSONArray dataObj = jsonObject.getJSONArray("dataObj");
|
|
|
+
|
|
|
+ if (dataObj != null) {
|
|
|
+ for (int i = 0; i < dataObj.size(); i++) {
|
|
|
+ JSONObject item = dataObj.getJSONObject(i);
|
|
|
+ OrderFlowerVO orderFlower = new OrderFlowerVO();
|
|
|
+
|
|
|
+ orderFlower.setBillNo(item.getString("BILLNO"));
|
|
|
+ orderFlower.setDefine11(item.getString("DEFINE11"));
|
|
|
+ orderFlower.setDefine12(item.getString("DEFINE12"));
|
|
|
+ orderFlower.setDefine20(item.getString("DEFINE20"));
|
|
|
+ orderFlower.setDefine28(item.getString("DEFINE28"));
|
|
|
+ orderFlower.setDefine29(item.getString("DEFINE29"));
|
|
|
+ orderFlower.setDefine31(item.getString("DEFINE31"));
|
|
|
+ orderFlower.setDefine32(item.getString("DEFINE32"));
|
|
|
+ orderFlower.setDefine33(item.getString("DEFINE33"));
|
|
|
+ orderFlower.setDefine45(item.getString("DEFINE45"));
|
|
|
+ orderFlower.setClientName(item.getString("CLIENT_NAME"));
|
|
|
+ orderFlower.setSorderNo(item.getString("SORDER_NO"));
|
|
|
+ orderFlower.setDeviceNo(item.getString("DEVICE_NO"));
|
|
|
+
|
|
|
+ orderFlowers.add(orderFlower);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return orderFlowers;
|
|
|
+ }
|
|
|
+}
|