linbl před 2 týdny
rodič
revize
f34ff38525

+ 0 - 160
src/main/java/com/ruoyi/web/service/BulkloadService.java

@@ -27,9 +27,7 @@ import java.util.Map;
 @Slf4j
 public class BulkloadService {
 
-    //private static HttpHeaders headers = new HttpHeaders();
     private final static Map<String,HttpHeaders> HEADERS_MAP=new ConcurrentReferenceHashMap<>();
-    //private final static Map<String,String> THRFLAG_MAP=new ConcurrentReferenceHashMap<>();
     @Autowired
     private ConfigComponent configComponent;
 
@@ -53,7 +51,6 @@ public class BulkloadService {
         String body = "{\"UserName\":\""+UserName+"\",\"AuthToken\":\""+AuthToken+"\"}";
         JSONObject params = JSONObject.parseObject(body);
 
-       // headers.clear();
         headers.setContentType(MediaType.parseMediaType(MediaType.APPLICATION_JSON_VALUE));
         headers.add("Accept", MediaType.APPLICATION_JSON_VALUE);
         String AccessToken = "";
@@ -82,7 +79,6 @@ public class BulkloadService {
         if("I".equalsIgnoreCase(gatherData.getI_E_FLAG())) {//进港
             res = this.InVerification(gatherData);
         } else {//出港
-            //res = this.OutWeight(gatherData,THRFLAG_MAP.get(gatherData.getVE_LICENSE_NO()));
             res = this.OutWeight(gatherData,RedisUtil.get("数据交换中心:"+gatherData.getVE_LICENSE_NO()));
         }
         return res;
@@ -145,54 +141,10 @@ public class BulkloadService {
         res.setCode(200);
         res.setMsg(verificationRes.getMESSAGE());
         RedisUtil.set("数据交换中心:"+gatherData.getVE_LICENSE_NO(), verificationRes.getTHRFLAG());
-        //THRFLAG_MAP.put(gatherData.getVE_LICENSE_NO(), verificationRes.getTHRFLAG());
         res = this.InWeight(gatherData,verificationRes.getTHRFLAG());
         return res;
     }
 
-    /** 出港:预约确认接口 */
-    public ResponseBo OutVerification(GatherData gatherData) {
-        ResponseBo res = new ResponseBo();
-        res.setJsStatus(gatherData.getJsStatus());
-        res.setContainerStatus(gatherData.getContainerStatus());
-
-        //请求地址:接口是否发送——散货过磅地点:默认0=不发送,1=发送
-        String url = configComponent.getOutVerificationUrl() + "?TruckNo=" + gatherData.getVE_LICENSE_NO();
-        if(gatherData.getIsSendPlaceCode() == 1) {
-            url = configComponent.getOutVerificationUrl() + "?TruckNo=" + gatherData.getVE_LICENSE_NO() + "&PLACE_CODE=" + gatherData.getPlaceCode();
-        }
-
-        log.info("出港:预约确认接口url:{}",url);
-        VerificationRes verificationRes = new VerificationRes();
-        try {
-            HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
-            JSONObject result = RestUtil.get(url, headers);
-            log.info("出港:预约确认接口返回结果:{}",result.toString());
-            verificationRes = JSONObject.parseObject(result.toString(), VerificationRes.class);
-        } catch (Exception e) {
-            String message = e.getMessage();
-            if(message.contains("Message")) {
-                message = message.substring(message.indexOf("Message\":\"")+10,message.indexOf("\"}]"));
-            }
-            log.info("出港:预约确认接口报错:{}",message);
-            res.setCode(500);
-            res.setMsg(message);
-            return res;
-        }
-
-        res.setCode(200);
-        res.setMsg(verificationRes.getMESSAGE());
-        if("false".equalsIgnoreCase(verificationRes.getRESULT())) {
-            res.setCode(500);
-            res.setFlag("散货无预约");
-            //退出登录
-            this.LogOff(gatherData.getVE_LICENSE_NO());
-            return res;
-        }
-        res = this.OutWeight(gatherData,verificationRes.getTHRFLAG());
-        return res;
-    }
-
     /** 进港:卡车称重接口 */
     public ResponseBo InWeight(GatherData gatherData, String THIRDFLAG) {
         ResponseBo res = new ResponseBo();
@@ -207,9 +159,6 @@ public class BulkloadService {
         BigDecimal grossWt = new BigDecimal(gatherData.getGROSS_WT());
         grossWt = grossWt.divide(BigDecimal.valueOf(1000),2, RoundingMode.HALF_UP);
         double WEIGHT = grossWt.doubleValue();
-        //时间戳
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-        String UCINO = sdf.format(new Date());
 
         //请求地址
         String url = configComponent.getInWeightUrl();
@@ -274,9 +223,6 @@ public class BulkloadService {
         BigDecimal grossWt = new BigDecimal(gatherData.getGROSS_WT());
         grossWt = grossWt.divide(BigDecimal.valueOf(1000),2, RoundingMode.HALF_UP);
         double WEIGHT = grossWt.doubleValue();
-        //时间戳
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-        String UCINO = sdf.format(new Date());
 
         //请求地址
         String url = configComponent.getOutWeightUrl();
@@ -313,7 +259,6 @@ public class BulkloadService {
             }
             log.info("出港:卡车称重接口报错:{}",message);
             if(message != null && message.contains("Read timed out;")) {
-                UCINO = sdf.format(new Date());
                 body = "{\"TRUCK_NO\": \""+TRUCK_NO+"\", \"PLACE_CODE\": \""+PLACE_CODE+"\", \"WEIGHT\":"+WEIGHT+", \"THR_FLAG\":\""+THIRDFLAG+"\"}";
                 params = JSONObject.parseObject(body);
                 try {
@@ -351,53 +296,6 @@ public class BulkloadService {
         return res;
     }
 
-    /** 进港:卡车放行报告接口 */
-    public ResponseBo GetInReport(GatherData gatherData, String THIRDFLAG) {
-        ResponseBo res = new ResponseBo();
-        res.setJsStatus(gatherData.getJsStatus());
-        res.setContainerStatus(gatherData.getContainerStatus());
-        //车牌号(必输)
-        String TRUCK_NO = gatherData.getVE_LICENSE_NO();
-        //过磅地点(必输)
-        String PLACE_CODE =gatherData.getPlaceCode();
-        //道口号(必输)
-        String GATE_NO = gatherData.getGateNo();
-
-        //请求地址
-        String url = configComponent.getInReportUrl();
-        //请求体
-        String body = "{\"TRUCK_NO\": \""+TRUCK_NO+"\", \"PLACE_CODE\": \""+PLACE_CODE+"\", \"THR_FLAG\":\""+THIRDFLAG+"\"}";
-
-        JSONObject params = JSONObject.parseObject(body);
-        log.info("进港:卡车放行报告接口url:{}",url);
-        log.info("进港:卡车放行报告接口params:{}",params);
-        try {
-            HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
-            JSONObject jsonObject = RestUtil.post(url, headers, params);
-            log.info("进港:卡车放行报告接口返回结果:{}",jsonObject);
-            if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
-                res.setCode(500);
-                res.setMsg(jsonObject.getString("Message"));
-                return res;
-            }
-        } catch (Exception e) {
-            String message = e.getMessage();
-            if(message.contains("Message")) {
-                message = message.substring(message.indexOf("Message\":\"")+10,message.indexOf("\"}]"));
-            }
-            log.info("进港:卡车放行报告接口报错:{}",message);
-            res.setCode(500);
-            res.setMsg(message);
-            return res;
-        }
-        res.setJsStatus(1);
-        res.setCode(200);
-        res.setMsg("散货接口通过");
-        //退出登录
-        this.LogOff(gatherData.getVE_LICENSE_NO());
-        return res;
-    }
-
     /** 出港:卡车放行报告接口 */
     public ResponseBo GetOutReport(GatherData gatherData, String THIRDFLAG) {
         ResponseBo res = new ResponseBo();
@@ -407,8 +305,6 @@ public class BulkloadService {
         String TRUCK_NO = gatherData.getVE_LICENSE_NO();
         //过磅地点(必输)
         String PLACE_CODE = gatherData.getPlaceCode();
-        //道口号(必输)
-        String GATE_NO = gatherData.getGateNo();
 
         //请求地址
         String url = configComponent.getOutReportUrl();
@@ -449,67 +345,11 @@ public class BulkloadService {
         res.setJsStatus(1);
         res.setCode(200);
         res.setMsg("散货接口通过");
-        /*ResponseBo bo = this.OutWeightReport(gatherData, THIRDFLAG);
-        res.setNotes(bo.getNotes());*/
         //退出登录
         this.LogOff(gatherData.getVE_LICENSE_NO());
         RedisUtil.del("数据交换中心:"+gatherData.getVE_LICENSE_NO());
-        //THRFLAG_MAP.remove(gatherData.getVE_LICENSE_NO());
-        return res;
-    }
-
-    /** 进港:获取卡车进港称重报告(打印小票) */
-    public ResponseBo InWeightReport(GatherData gatherData, String THIRDFLAG) {
-        ResponseBo res = new ResponseBo();
-        res.setJsStatus(gatherData.getJsStatus());
-        res.setContainerStatus(gatherData.getContainerStatus());
-        //车牌号(必输)
-        String TRUCK_NO = gatherData.getVE_LICENSE_NO();
-        //过磅地点(必输)
-        String PLACE_CODE = gatherData.getPlaceCode();
-        //道口号(必输)
-        String GATE_NO = gatherData.getGateNo();
-
-        HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
-        //请求地址
-        String url = configComponent.getInWeightReportUrl() + "?TRUCK_NO="+TRUCK_NO + "&PLACE_CODE="+PLACE_CODE + "&THIRDFLAG="+THIRDFLAG + "&GATE_NO="+GATE_NO;
-        JSONObject jsonObject = RestUtil.get(url, headers);
-        if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
-            res.setCode(500);
-            res.setMsg(jsonObject.getString("Message"));
-            return res;
-        }
-        res.setCode(200);
-        res.setMsg("获取进港小票成功");
-        res.setNotes(jsonObject.toJSONString());
         return res;
     }
 
-    /** 出港:获取卡车出港称重报告(打印小票) */
-    public ResponseBo OutWeightReport(GatherData gatherData, String THIRDFLAG) {
-        ResponseBo res = new ResponseBo();
-        res.setJsStatus(gatherData.getJsStatus());
-        res.setContainerStatus(gatherData.getContainerStatus());
-        //车牌号(必输)
-        String TRUCK_NO = gatherData.getVE_LICENSE_NO();
-        //过磅地点(必输)
-        String PLACE_CODE = gatherData.getPlaceCode();
-        //道口号(必输)
-        String GATE_NO = gatherData.getGateNo();
-
-        //请求地址
-        String url = configComponent.getOutWeightReportUrl() + "?TRUCK_NO="+TRUCK_NO + "&PLACE_CODE="+PLACE_CODE + "&THIRDFLAG="+THIRDFLAG + "&GATE_NO="+GATE_NO;
-        HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
-        JSONObject jsonObject = RestUtil.get(url, headers);
-        if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
-            res.setCode(500);
-            res.setMsg(jsonObject.getString("Message"));
-            return res;
-        }
-        log.info("获取出港小票成功:\n{}",jsonObject.toJSONString());
-        res.setMsg("获取出港小票成功");
-        res.setNotes(jsonObject.toJSONString());
-        return res;
-    }
 
 }