From 3221648a97f83d4eb9bf561cddd869740088110d Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 13 二月 2023 09:15:32 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |   72 ++++--------------------------------
 1 files changed, 8 insertions(+), 64 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 8d37d41..c334d7a 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -1,7 +1,5 @@
 package com.zy.asrs.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.core.common.BaseRes;
@@ -16,13 +14,11 @@
 import com.zy.asrs.mapper.TagMapper;
 import com.zy.asrs.service.*;
 import com.zy.asrs.task.AbstractHandler;
-import com.zy.asrs.task.core.ReturnT;
 import com.zy.asrs.utils.MatUtils;
-import com.zy.common.constant.MesConstant;
+import com.zy.asrs.utils.PostMesDataUtils;
 import com.zy.common.model.DetlDto;
 import com.zy.common.model.enums.WorkNoType;
 import com.zy.common.service.CommonService;
-import com.zy.common.utils.HttpHandler;
 import com.zy.common.utils.NodeUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -70,12 +66,7 @@
     @Autowired
     private CommonService commonService;
     @Autowired
-    private ApiLogService apiLogService;
-    @Autowired
     private WrkMastService wrkMastService;
-
-    @Value("${mes.url}")
-    private String mesUrl;
 
     @Value("${mes.inPath}")
     private String inpath;
@@ -724,7 +715,7 @@
                     combParam.setLocNo(locMast.getLocNo());
                     combParam.setPackSts(7);
                     combParam.setRequestTime(DateUtils.convert(new Date()));
-                    postMesData(inpath,combParam);
+                    new PostMesDataUtils().postMesData(inpath,combParam);
 
                     if (!locMastService.updateById(locMast)) {
                         throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細"+locMast.getLocNo());
@@ -775,7 +766,8 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(2);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData(inpath,combParam);
+
                 if (!locMastService.update(locMast,new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存柊浜у搧鐘舵�佸け璐�");
                 }
@@ -816,7 +808,8 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(3);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData(inpath,combParam);
+
                 if (!locMastService.update(locMast, new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存敼浜у搧鐘舵�佸け璐�");
                 }
@@ -856,7 +849,8 @@
                 combParam.setLocNo(locMast.getLocNo());
                 combParam.setPackSts(4);
                 combParam.setRequestTime(DateUtils.convert(new Date()));
-                postMesData(inpath,combParam);
+                new PostMesDataUtils().postMesData(inpath,combParam);
+
                 if (!locMastService.update(locMast, new EntityWrapper<LocMast>().eq("loc_no", review.getLocNo()))){
                     throw new CoolException("鏇存敼浜у搧鐘舵�佸け璐�");
                 }
@@ -869,56 +863,6 @@
             throw new CoolException("鐘舵�佸紓甯�");
         }
         return success;
-    }
-
-    private ReturnT<String> postMesData(String mesPath, Object combParam){
-        if(combParam != null){
-            String response = "";
-            boolean success = false;
-            try {
-//                Map<String, Object> map = new HashMap<>();
-//                map.put("appkey","ea1f0459efc02a79f046f982767939ae");
-                response = new HttpHandler.Builder()
-//                        .setHeaders(map)
-                        .setUri(mesUrl)
-                        .setPath(mesPath)
-                        .setJson(JSON.toJSONString(combParam))
-                        .build()
-                        .doPost();
-                JSONObject jsonObject = JSON.parseObject(response);
-                if (jsonObject.getInteger("code").equals(200)) {
-//                    if (jsonObject.getDate("isComplete").equals(true)){
-                        success = true;
-//                    }else if (jsonObject.getDate("isComplete").equals(false)){
-//                        success = false;
-//                    }else {
-//                        log.error("杩斿洖鍊煎嚭閿�!!!url锛歿}锛況equest锛歿}锛況esponse锛歿}", mesUrl+"/"+mesPath, JSON.toJSONString(combParam), response);
-//                        throw new CoolException("杩斿洖鍊煎嚭閿�");
-//                    }
-                } else {
-                    log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", mesUrl+"/"+mesPath, JSON.toJSONString(combParam), response);
-                    throw new CoolException("涓婃姤mes绯荤粺澶辫触");
-                }
-            } catch (Exception e) {
-                log.error("fail", e);
-//                      TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                return FAIL.setMsg(e.getMessage());
-            } finally {
-                try {
-                    // 淇濆瓨鎺ュ彛鏃ュ織
-                    apiLogService.save(
-                            "涓婃姤mes绯荤粺",
-                            mesUrl +"/"+ mesPath,
-                            null,
-                            "127.0.0.1",
-                            JSON.toJSONString(combParam),
-                            response,
-                            success
-                    );
-                } catch (Exception e) { log.error("", e); }
-            }
-        }
-        return SUCCESS;
     }
     /*...........................璧e窞鏂板..............浠ヤ笂.............璧e窞鏂板...........................*/
 

--
Gitblit v1.9.1