linbl пре 2 недеља
родитељ
комит
dc70e92d42

+ 11 - 13
pom.xml

@@ -20,6 +20,14 @@
 
 
     <dependencies>
+        <!-- 集成redis -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+            <version>2.3.3.RELEASE</version>
+        </dependency>
+
+
         <dependency>
             <groupId>io.netty</groupId>
             <artifactId>netty-all</artifactId>
@@ -52,24 +60,14 @@
             <version>5.8.18</version>
         </dependency>
         <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-            <version>20.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.sun.jna</groupId>
-            <artifactId>jna</artifactId>
-            <version>3.0.9</version>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.6</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
         </dependency>
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>fastjson</artifactId>
-            <version>2.0.6</version>
-        </dependency>
     </dependencies>
 
 

+ 22 - 0
src/main/java/com/ruoyi/web/Test.java

@@ -0,0 +1,22 @@
+package com.ruoyi.web;
+
+import com.ruoyi.web.config.AesEncryptUtil;
+
+public class Test {
+
+    public static void main(String[] args) {//LYZX002  //LYZX005  //DLPKK02   //DLPKK04
+        String jin = "{\"chnlNo\":\"LYZX001\",\"containerStatus\":0,\"crossCode\":\"LYZX001\",\"gateNo\":\"11\",\"grossWt\":16000.0,\"ieFlag\":\"I\",\"isEmpty\":0,\"isLoaded\":0,\"isSendPlaceCode\":1,\"jsStatus\":0,\"placeCode\":\"LYZX002\",\"steps\":[{\"api\":\"reservationToSorJ_Test\",\"name\":\"集散混合\",\"remark\":\"\"}],\"veLicenseNo\":\"桂NCY990\"}";
+        String jinencrypt = AesEncryptUtil.AESEncrypt(jin);
+        System.out.println("进卡口:"+jinencrypt);
+        System.out.println("--------------");
+        String chu = "{\"chnlNo\":\"LYZX003\",\"containerStatus\":1,\"crossCode\":\"LYZX003\",\"gateNo\":\"14\",\"grossWt\":30000.0,\"ieFlag\":\"E\",\"isEmpty\":0,\"isLoaded\":0,\"isSendPlaceCode\":1,\"jsStatus\":1,\"placeCode\":\"LYZX005\",\"steps\":[{\"api\":\"reservationToSorJ_Test\",\"name\":\"集散混合\",\"remark\":\"\"}],\"veLicenseNo\":\"桂NCY990\"}";
+        String chuencrypt = AesEncryptUtil.AESEncrypt(chu);
+        System.out.println("出卡口:"+chuencrypt);
+
+    }
+}
+/**
+
+curl "http://127.0.0.1:9292/interaction/process" -H "Content-Type:application/json;charset=UTF-8" -X POST -d C59EDA96487C750AEE056B41FE888FDFB228F42ECCDEE7C288E1B6A84405F9F2AF3505556F25D15BABAAD97631A0DE536CC9D5E02F94C2FFFB754BC12F0D2F75C556994960087433D3D8F358394C20D59FB2D668B3D73A832136A394624F125C4E9DD496E294EB9555C71D29C1967C5F56411DCD5D2CE7924C54265C548B46C15E512B9A95442578CAC1C71A31DEC443229EFF20DBCAB63CF40C30E59E712DB59948BFF5AF3E8C01177AA07BF0929FF67AE79E9AF08AF24E32C3A2E0CB522CCE1E08C9B6DD84E4AA7FDBCAD73B6C9EE0EBA004FB14286D032BB9C8D5D0D81C555C97A443F0FDF635B28AEF5BE28ECEBE6AF0DCB4770B66F4C4ED6149800E9400ED6D89A4C09025497606449659BF81C82A6CF2F40F7542B5EEBB4E4E4859F670AEFB29BEB2BC2DECF1CB56D259ACC00C
+
+ */

+ 119 - 0
src/main/java/com/ruoyi/web/config/cache/RedisUtil.java

@@ -0,0 +1,119 @@
+package com.ruoyi.web.config.cache;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+/**
+ * Redis工具类
+ * @author kongyongshun
+ *
+ */
+@Component
+public class RedisUtil {
+
+
+	public static long ttl = 24* 7;	//默认超时时间,单位周,此为一周
+
+
+	/**
+	 * 对象专用
+	 */
+	public static RedisTemplate<String, Object> redisTemplate;
+	@Autowired
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public void setRedisTemplate(RedisTemplate redisTemplate) {
+		RedisUtil.redisTemplate = redisTemplate;
+	}
+
+	/**
+	 * string专用
+	 */
+	static StringRedisTemplate stringRedisTemplate;
+	@Autowired
+	public void setStringRedisTemplate(StringRedisTemplate stringRedisTemplates) {
+		RedisUtil.stringRedisTemplate = stringRedisTemplates;
+	}
+
+
+
+	/* * * * * * * * * * * * * * * * String操作 * * * * * * * * * * * * * * * * * * * * * * * * */
+
+
+	// 默认7*24小时
+	public static void set(String key, String value) {
+		stringRedisTemplate.opsForValue().set(key, value, ttl, TimeUnit.HOURS);
+	}
+	public static void setBySECONDS(String key, String value,int time) {
+		stringRedisTemplate.opsForValue().set(key, value, ttl, TimeUnit.MINUTES);
+	}
+
+	// 写入,并设置时长,单位 Hours
+	public static void setByHour(String key, String value, int timeout) {
+		stringRedisTemplate.opsForValue().set(key, value, timeout, TimeUnit.HOURS);
+	}
+
+	// 写入,并设置时长,单位 分钟 MINUTES
+	public static void setByMINUTES(String key, String value, int timeout) {
+		stringRedisTemplate.opsForValue().set(key, value, timeout, TimeUnit.MINUTES);
+	}
+
+	// 读取
+	public static String get(String key) {
+		return stringRedisTemplate.opsForValue().get(key);
+	}
+
+
+	// 删除
+	public static void del(String key) {
+		stringRedisTemplate.delete(key);
+	}
+
+
+	/* * * * * * * * * * * * * * * * List集合操作 * * * * * * * * * * * * * * * * * * * * * * * * */
+
+	// 查询
+	public static List<Object> forListGet(String key){
+		return redisTemplate.opsForList().range(key, 0, -1);
+	}
+
+	// 追加键值
+	public static void forListAdd(String key, Object... args){
+		redisTemplate.opsForList().rightPushAll(key,  args);
+	}
+
+	// 移除所有键值
+	public static void forListRemove(String key){
+		List<Object> list = forListGet(key);
+		for (int i = 0; i < list.size(); i++) {
+			redisTemplate.opsForList().remove(key, -1,list.get(i));
+		}
+	}
+
+
+	/* * * * * * * * * * * * * * * * Object值操作 * * * * * * * * * * * * * * * * * * * * * * * * */
+
+	// 写入值
+	public static void forValueSet(String key, Object value){
+		redisTemplate.opsForValue().set(key, value, ttl, TimeUnit.HOURS);
+	}
+
+	// 读取值
+	@SuppressWarnings("unchecked")
+	public static <T>T forValueGet(String key, Class<T> cs){
+		return (T) redisTemplate.opsForValue().get(key);
+	}
+
+
+
+
+
+
+
+
+
+}

+ 0 - 193
src/main/java/com/ruoyi/web/controller/ProcessController.java

@@ -1,32 +1,17 @@
 package com.ruoyi.web.controller;
 
-import cn.hutool.core.util.XmlUtil;
-import cn.hutool.http.HttpRequest;
-import cn.hutool.http.HttpResponse;
-import cn.hutool.http.webservice.SoapClient;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.web.bo.GatherBo;
 import com.ruoyi.web.bo.ReleaseBo;
 import com.ruoyi.web.bo.ResponseBo;
-import com.ruoyi.web.bo.Steps;
 import com.ruoyi.web.config.AesEncryptUtil;
-import com.ruoyi.web.config.ConfigComponent;
 import com.ruoyi.web.entity.GatherData;
 import com.ruoyi.web.entity.Release;
 import com.ruoyi.web.service.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
 
 @RestController
 @RequestMapping("/interaction")
@@ -39,120 +24,7 @@ public class ProcessController {
     private CustomsService customsService;
     @Autowired
     private ReservationService reservationService;
-    @Autowired
-    private BulkloadService bulkloadService;
-
-    //@GetMapping("/LogOn")
-    public ResponseBo LogOn(String a,double b, String c) {
-        GatherData gatherData = new GatherData();
-        /*gatherData.setIsEmpty(bo.getIsEmpty());
-        gatherData.setIsLoaded(bo.getIsLoaded());
-
-        gatherData.setCrossCode(bo.getCrossCode());
-        gatherData.setCntrnoF(bo.getCntrnoF());
-        gatherData.setCntrnoA(bo.getCntrnoA());*/
-
-        //进出标识,I进E出
-        gatherData.setI_E_FLAG(c);
-        //场站号,固定写为场所分配的场站号
-        /*gatherData.setAREA_ID(bo.getAreaId());
-        //通道号,已经从通道号配置文件中读取
-        gatherData.setCHNL_NO(bo.getChnlNo());
-        //通道业务类型,通常为A,已经读取
-        gatherData.setGETHER_MODE(bo.getGetherMode());*/
-        //会话编号,自动生成
-        //gatherData.setSESSION_ID(bo.getSessionId());
-
-        //IC卡配置信息
-        //读取到的IC卡号
-        /*gatherData.setIC_ID(bo.getIcId());
-        gatherData.setIC_GOODS_NAME(bo.getIcGoodsName());
-        gatherData.setIC_BILL_NO(bo.getIcBillNo());
-        gatherData.setIC_NO(bo.getIcNo());
-        gatherData.setIC_Type(bo.getIcType());
-        gatherData.setIC_EXTENDED_CONTENT(bo.getIcExtendedContent());
-
-        gatherData.setDR_CUSTOMS_NO(bo.getDrCustomsNo());
-        gatherData.setVE_CUSTOMS_NO(bo.getVeCustomsNo());*/
-        //读取到的车牌号信息
-        gatherData.setVE_LICENSE_NO(a);
-        //gatherData.setESEAL_ID(bo.getEsealId());
-        //读取到的地磅重量
-        gatherData.setGROSS_WT(b);
-
-        //VE_RFID信息
-        //RFID卡号信息
-        //gatherData.setVE_RFID_ID(bo.getVeRfidId());
-        //RFID绑定的光学车牌信息
-        /*gatherData.setVE_LICENSE_NO_RFID(bo.getVeLicenseNoRfid());
-        gatherData.setVE_CUSTOMS_NO_RFID(bo.getVeCustomsNoRfid());
-        gatherData.setVE_WT_RFID(bo.getVeWtRfid());
-        gatherData.setVE_COMPANY_RFID(bo.getVeCompanyRfid());
-        gatherData.setVE_PERFORMANCE_RFID(bo.getVePerformanceRfid());
-
-        //DR_RFID信息
-        gatherData.setDR_RFID_ID(bo.getDrRfidId());
-        gatherData.setDR_NAME(bo.getDrName());
-        gatherData.setDR_CUSTOMS_NO_RFID(bo.getDrCustomsNoRfid());
-        gatherData.setDR_COMPANY(bo.getDrCompany());
-        gatherData.setDR_PERFORMANCE(bo.getDrPerformance());
 
-        gatherData.setOPERATOR_ID(bo.getOperatorId());
-        gatherData.setOPERATE_TIME(bo.getOperateTime());
-
-
-        gatherData.setDOMESTIC_LICENSE_NO(bo.getDomesticLicenseNo());
-        //车牌图片保存路径,如有箱号,有箱号图片路径
-        gatherData.setDOMESTIC_LICENSE_COLOR(bo.getDomesticLicenseColor());
-        gatherData.setFOREIGN_LICENSE_NO(bo.getForeignLicenseNo());
-        gatherData.setFOREIGN_LICENSE_COLOR(bo.getForeignLicenseColor());
-        gatherData.setCONFIDENCE_RATIO(bo.getConfidenceRatio());*/
-        ResponseBo res = bulkloadService.LogOn(gatherData);
-        return res;
-    }
-
-    //@GetMapping("/process_test")
-    public ResponseBo process_test() {
-        Steps steps = new Steps();
-        steps.setName("集装箱");
-        steps.setApi("GetBookingInfo");
-        steps.setRemark("");
-        List<Steps> stepsList = new ArrayList<>();
-        stepsList.add(steps);
-
-        GatherData gatherData = new GatherData();
-        gatherData.setSteps(stepsList);
-
-        gatherData.setJsStatus(0);
-        gatherData.setContainerStatus(0);
-
-        gatherData.setIsEmpty(0);
-        gatherData.setIsLoaded(0);
-
-        //gatherData.setCrossCode(bo.getCrossCode());
-        gatherData.setCntrnoF("TEST2024011");
-        gatherData.setCntrnoFType("22G1");
-        gatherData.setCntrnoA("TEST2024012");
-        gatherData.setCntrnoAType("22G1");
-
-        //进出标识,I进E出
-        gatherData.setI_E_FLAG("I");
-
-        //读取到的车牌号信息
-        gatherData.setVE_LICENSE_NO("桂A12345");
-        //读取到的地磅重量——>KG转换为吨
-        BigDecimal grossWt = new BigDecimal(2600);
-        grossWt = grossWt.divide(BigDecimal.valueOf(1000),2, RoundingMode.HALF_UP);
-        gatherData.setGROSS_WT(grossWt.doubleValue());
-
-        return processService.process(gatherData);
-    }
-
-    public static void main(String[] args) {
-        String content = "C59EDA96487C750AEE056B41FE888FDFB228F42ECCDEE7C288E1B6A84405F9F2AF3505556F25D15BABAAD97631A0DE536CC9D5E02F94C2FFFB754BC12F0D2F75C556994960087433D3D8F358394C20D5B3E3636C423CBED72657A55500EBBF944E9DD496E294EB9555C71D29C1967C5F56411DCD5D2CE7924C54265C548B46C15E512B9A95442578CAC1C71A31DEC443229EFF20DBCAB63CF40C30E59E712DB59948BFF5AF3E8C01177AA07BF0929FF6887DF0103EFCE8CE71268E3E4E3113C71E08C9B6DD84E4AA7FDBCAD73B6C9EE0EBA004FB14286D032BB9C8D5D0D81C555C97A443F0FDF635B28AEF5BE28ECEBE6AF0DCB4770B66F4C4ED6149800E9400ED6D89A4C09025497606449659BF81C8D133DDD6B2A0FEB92617C96C1BC558C069617F200977E0B4FCAA7E25574711CB";
-        String decrypt = AesEncryptUtil.AESDecrypt(content);
-        System.out.println(decrypt);
-    }
     @PostMapping("/process")
     public ResponseBo process(@RequestBody String content) {
         log.info("---------------开始---------------");
@@ -260,69 +132,4 @@ public class ProcessController {
         return res;
     }
 
-    //@GetMapping("/GetBookingInfo")
-    public String GetBookingInfo(String veLicenseNo) {
-        /*SoapClient client = SoapClient.create("http://10.26.1.34:8531/TOPSService/SHB.TOPS.Contract.Gate.SmartGate.ISmartGate")
-                .header("SOAPAction","http://tempuri.org/ISmartGate/GetBookingInfo")
-                .header("Content-Type","text/xml; charset=utf-8")
-                // 设置要请求的方法,此接口方法前缀为web,传入对应的命名空间
-                .setMethod("tem:GetBookingInfo","http://tempuri.org/")
-                // 设置参数,此处自动添加方法的前缀:web
-                .setParam("trkno", veLicenseNo,false)
-                .setParam("msg","",false);
-        System.out.println(client.getMsgStr(true));
-        HttpResponse response= client.sendForResponse();
-        String body = response.body();
-        String xml = client.send(true);
-
-        Document document= XmlUtil.parseXml(body);
-        Element rootElement = XmlUtil.getRootElement(document);
-        Element element1=XmlUtil.getElement(rootElement,"s:Body");
-        Element element2=XmlUtil.getElement(element1,"GetBookingInfoResponse");
-        Node getBookingInfoResult = XmlUtil.getElement(element2, "GetBookingInfoResult").getFirstChild();
-        String nodeValue1 = getBookingInfoResult.getNodeValue();
-        Node msg = XmlUtil.getElement(element2, "msg").getFirstChild();
-        String nodeValue2 = msg.getNodeValue();*/
-        //操作员工,请使用员工号
-        String I_EMPTNO = "00000";
-        //道口号,例:1、2、12
-        String I_GAT_GATENO = "I3";
-        //车牌号
-        String i_trkno = veLicenseNo;
-        //提箱/进箱标志 	提箱 1;进箱 2
-        String I_GAT_DRFG = "1";
-        //卡车自重
-        Integer I_WEIGHT = 2600;
-        //IC卡ID号,填写固定值999999
-        String I_ICID = "999999";
-        //IC卡类型,填写固定值9
-        String I_ICTYPE = "9";
-
-        SoapClient client = SoapClient.create("http://10.26.1.34:8531/TOPSService/SHB.TOPS.Contract.Gate.SmartGate.ISmartGate")
-                .header("SOAPAction","http://tempuri.org/ISmartGate/GET_CARDS")
-                .header("Content-Type","text/xml; charset=utf-8")
-                // 设置要请求的方法,此接口方法前缀为web,传入对应的命名空间
-                .setMethod("tem:GET_CARDS","http://tempuri.org/")
-                // 设置参数,此处自动添加方法的前缀:web
-                .setParam("I_GAT_GATENO", "I3")
-                .setParam("i_trkno", "桂AF92120")
-                .setParam("I_CNT_VAL", "36773461");
-        log.info("获取进场小票信息接口:\n{}",client.getMsgStr(true));
-        HttpResponse response= client.sendForResponse();
-        String body = response.body();
-        log.info("获取进场小票信息接口输出报文:\n{}",body);
-
-        Document document= XmlUtil.parseXml(body);
-        Element rootElement = XmlUtil.getRootElement(document);
-        Element element1=XmlUtil.getElement(rootElement,"s:Body");
-        Element element2=XmlUtil.getElement(element1,"GET_CARDSResponse");
-        Node node1 = XmlUtil.getElement(element2, "GET_CARDSResult").getFirstChild();
-        String result = node1 != null ? node1.getNodeValue() : "";
-        log.info("进场小票:\n{}",result);
-        /*System.out.println("body:"+body);
-        System.out.println("result:"+result);*/
-        //log.info("xml:{}",xml);
-        return body;
-    }
-
 }

+ 0 - 17
src/main/java/com/ruoyi/web/entity/GatherFeedBack.java

@@ -1,17 +0,0 @@
-package com.ruoyi.web.entity;
-
-import lombok.Data;
-
-@Data
-public class GatherFeedBack {
-
-    private String AREA_ID;
-    private String CHNL_NO;
-    private String SESSION_ID;
-    //@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone="GMT+8")
-    private String FEEDBACK_TIME;
-    private String CHECK_RESULT;    //N
-    private String OP_HINT;         //箱号不匹配,预约的箱号【CICU8066818】未采集到   |   箱号正确匹配
-    private String LED_HINT;        //箱号不匹配,预约的箱号【CICU8066818】未采集到   |   箱号正确匹配
-
-}

+ 6 - 6
src/main/java/com/ruoyi/web/entity/Release.java

@@ -9,18 +9,18 @@ import lombok.Data;
 public class Release {
 
     //报文序列号
-    private String SEQ_NO;
+    public String SEQ_NO;
     //进出标识,I进E出
-    private String I_E_FLAG;
+    public String I_E_FLAG;
     //场站号,固定写为场所分配的场站号
-    private String AREA_ID;
+    public String AREA_ID;
     //通道号,已经从通道号配置文件中读取
-    private String CHNL_NO;
+    public String CHNL_NO;
 
     //返回结果
-    private String EXCUTE_COMMAND;
+    public String EXCUTE_COMMAND;
 
     //计数器值
-    private String ESEAL_USE_COUNT;
+    public String ESEAL_USE_COUNT;
 
 }

+ 3 - 3
src/main/java/com/ruoyi/web/entity/Reservation.java

@@ -8,8 +8,8 @@ import lombok.Data;
 @Data
 public class Reservation {
 
-    private String carNumber;//"桂E12345",
-    private String sExamineState;//散杂货预约状态	00为没有预约,01为已有预约
-    private String jExamineState;//集装箱预约状态	00为没有预约,01为已有预约
+    public String carNumber;//"桂E12345",
+    public String sExamineState;//散杂货预约状态	00为没有预约,01为已有预约
+    public String jExamineState;//集装箱预约状态	00为没有预约,01为已有预约
 
 }

+ 6 - 3
src/main/java/com/ruoyi/web/entity/VerificationRes.java

@@ -5,16 +5,19 @@ import lombok.Data;
 /**
  * 散货系统-预约确认接口-返回结果对象
  * {"THRFLAG":"N","RESULT":true,"MESSAGE":""}
+ * {"MESSAGE":"请在场内完成过磅","RESULT":false}
+ * {"MESSAGE":"一次过磅称重成功","RESULT":true}
+ * {"MESSAGE":"放行失败(车牌号:桂N09908D)未找到进港记录或出门证失效,请确认","RESULT":false}
  */
 @Data
 public class VerificationRes {
 
     //校验结果 ,为 true 或 false
-    private String RESULT;
+    public String RESULT;
 
     //提示信息
-    private String MESSAGE;
+    public String MESSAGE;
 
     //第三方预约标志,如果车号为第三方预约返回Y 码头预约返回 N
-    private String THRFLAG;
+    public String THRFLAG;
 }

+ 0 - 17
src/main/java/com/ruoyi/web/entity/WeightRes.java

@@ -1,17 +0,0 @@
-package com.ruoyi.web.entity;
-
-import lombok.Data;
-
-/**
- * 散货系统-称重接口-返回结果对象
- */
-@Data
-public class WeightRes {
-
-    //校验结果 ,为 true 或 false
-    private String RESULT;
-
-    //预约号
-    private String RegistrationNo;
-
-}

+ 51 - 26
src/main/java/com/ruoyi/web/service/BulkloadService.java

@@ -1,14 +1,11 @@
 package com.ruoyi.web.service;
 
-import cn.hutool.crypto.digest.HMac;
-import cn.hutool.crypto.digest.HmacAlgorithm;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.web.bo.ResponseBo;
 import com.ruoyi.web.config.ConfigComponent;
 import com.ruoyi.web.config.RestUtil;
-import com.ruoyi.web.entity.GatherData;
-import com.ruoyi.web.entity.VerificationRes;
-import com.ruoyi.web.entity.WeightRes;
+import com.ruoyi.web.entity.*;
+import com.ruoyi.web.config.cache.RedisUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
@@ -30,9 +27,9 @@ import java.util.Map;
 @Slf4j
 public class BulkloadService {
 
-  //  private static HttpHeaders headers = new HttpHeaders();
+    //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<>();
+    //private final static Map<String,String> THRFLAG_MAP=new ConcurrentReferenceHashMap<>();
     @Autowired
     private ConfigComponent configComponent;
 
@@ -85,7 +82,8 @@ 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,THRFLAG_MAP.get(gatherData.getVE_LICENSE_NO()));
+            res = this.OutWeight(gatherData,RedisUtil.get("数据交换中心:"+gatherData.getVE_LICENSE_NO()));
         }
         return res;
     }
@@ -124,6 +122,16 @@ public class BulkloadService {
             JSONObject result = RestUtil.get(url, headers);
             log.info("进港:预约确认接口返回结果:{}",result.toString());
             verificationRes = JSONObject.parseObject(result.toString(), VerificationRes.class);
+            if("false".equalsIgnoreCase(verificationRes.getRESULT())) {
+                if(verificationRes.getMESSAGE().contains("未找到车辆") && verificationRes.getMESSAGE().contains("预约信息")) {
+                    res.setFlag("散货无预约");
+                }
+                res.setCode(500);
+                res.setMsg(verificationRes.getMESSAGE());
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
+                return res;
+            }
         } catch (Exception e) {
             String message = e.getMessage();
             if(message.contains("Message")) {
@@ -134,18 +142,10 @@ public class BulkloadService {
             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;
-        }
-
-        THRFLAG_MAP.put(gatherData.getVE_LICENSE_NO(), verificationRes.getTHRFLAG());
+        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;
     }
@@ -219,21 +219,27 @@ public class BulkloadService {
         JSONObject params = JSONObject.parseObject(body);
         log.info("进港:卡车称重接口url:{}",url);
         log.info("进港:卡车称重接口params:{}",params);
+        VerificationRes verificationRes = new VerificationRes();
         try {
             //{"MESSAGE":"一次过磅称重成功","RESULT":true}
             HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
             JSONObject jsonObject = RestUtil.post(url, headers, params);
             log.info("进港:卡车称重接口返回结果:{}",jsonObject);
+            verificationRes = JSONObject.parseObject(jsonObject.toString(), VerificationRes.class);
+            if("false".equalsIgnoreCase(verificationRes.getRESULT())) {
+                res.setCode(500);
+                res.setMsg(verificationRes.getMESSAGE());
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
+                return res;
+            }
             if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
                 res.setCode(500);
                 res.setMsg(jsonObject.getString("Message"));
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
                 return res;
             }
-            /*if(jsonObject != null && jsonObject.toString().contains("RESULT")) {
-                res.setCode(200);
-                res.setMsg(jsonObject.getString("MESSAGE"));
-                return res;
-            }*/
         } catch (Exception e) {
             String message = e.getMessage();
             if(message.contains("Message")) {
@@ -281,12 +287,23 @@ public class BulkloadService {
         log.info("出港:卡车称重接口url:{}",url);
         log.info("出港:卡车称重接口params:{}",params);
         HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
+        VerificationRes verificationRes = new VerificationRes();
         try {
             JSONObject jsonObject = RestUtil.post(url, headers, params);
             log.info("出港:卡车称重接口返回结果:{}",jsonObject);
+            verificationRes = JSONObject.parseObject(jsonObject.toString(), VerificationRes.class);
+            if("false".equalsIgnoreCase(verificationRes.getRESULT())) {
+                res.setCode(500);
+                res.setMsg(verificationRes.getMESSAGE());
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
+                return res;
+            }
             if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
                 res.setCode(500);
                 res.setMsg(jsonObject.getString("Message"));
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
                 return res;
             }
         } catch (Exception e) {
@@ -329,8 +346,6 @@ public class BulkloadService {
             res.setMsg(message);
             return res;
         }
-        /*WeightRes weightRes = JSONObject.parseObject(jsonObject.toString(), WeightRes.class);
-        * res.setRegistrationNo(weightRes.getRegistrationNo());*/
         res.setCode(200);
         res = this.GetOutReport(gatherData,THIRDFLAG);
         return res;
@@ -403,10 +418,19 @@ public class BulkloadService {
         JSONObject params = JSONObject.parseObject(body);
         log.info("出港:卡车放行报告接口url:{}",url);
         log.info("出港:卡车放行报告接口params:{}",params);
+        VerificationRes verificationRes = new VerificationRes();
         try {
             HttpHeaders headers=  HEADERS_MAP.get(gatherData.getVE_LICENSE_NO());
             JSONObject jsonObject = RestUtil.post(url, headers, params);
             log.info("出港:卡车放行报告接口返回结果:{}",jsonObject);
+            verificationRes = JSONObject.parseObject(jsonObject.toString(), VerificationRes.class);
+            if("false".equalsIgnoreCase(verificationRes.getRESULT())) {
+                res.setCode(500);
+                res.setMsg(verificationRes.getMESSAGE());
+                //退出登录
+                this.LogOff(gatherData.getVE_LICENSE_NO());
+                return res;
+            }
             if(jsonObject != null && jsonObject.toString().contains("ErrorCode")) {
                 res.setCode(500);
                 res.setMsg(jsonObject.getString("Message"));
@@ -429,7 +453,8 @@ public class BulkloadService {
         res.setNotes(bo.getNotes());*/
         //退出登录
         this.LogOff(gatherData.getVE_LICENSE_NO());
-        THRFLAG_MAP.remove(gatherData.getVE_LICENSE_NO());
+        RedisUtil.del("数据交换中心:"+gatherData.getVE_LICENSE_NO());
+        //THRFLAG_MAP.remove(gatherData.getVE_LICENSE_NO());
         return res;
     }
 

+ 1 - 1
src/main/java/com/ruoyi/web/service/ContainerService.java

@@ -17,7 +17,6 @@ import org.springframework.util.StringUtils;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -71,6 +70,7 @@ public class ContainerService {
             log.info("集装箱进场预约信息接口报错:{}",e.getMessage());
             res.setCode(500);
             res.setMsg(e.getMessage());
+            res.setFlag("未知");
             return res;
         }
 

+ 0 - 1
src/main/java/com/ruoyi/web/service/CustomsService.java

@@ -6,7 +6,6 @@ import com.ruoyi.web.bo.ResponseBo;
 import com.ruoyi.web.config.AesEncryptUtil;
 import com.ruoyi.web.config.ConfigComponent;
 import com.ruoyi.web.config.MessageXML;
-import com.ruoyi.web.config.RestUtil;
 import com.ruoyi.web.entity.Customs;
 import com.ruoyi.web.entity.CustomsRes;
 import com.ruoyi.web.entity.GatherData;

+ 0 - 82
src/main/java/com/ruoyi/web/service/IntermodalTransporService.java

@@ -1,82 +0,0 @@
-package com.ruoyi.web.service;
-
-import com.alibaba.fastjson2.JSONObject;
-import com.ruoyi.web.bo.ResponseBo;
-import com.ruoyi.web.config.ConfigComponent;
-import com.ruoyi.web.config.RestUtil;
-import com.ruoyi.web.entity.GatherData;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-
-/**
- * 钦州联运中心智慧闸口接口调用-业务处理
- */
-@Service
-@Slf4j
-public class IntermodalTransporService {
-    @Autowired
-    private ConfigComponent configComponent;
-
-
-    /** 钦州闸口识别对接接口 */
-    public ResponseBo gateIdentify(GatherData gatherData) {
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.parseMediaType(MediaType.APPLICATION_JSON_VALUE));
-        ResponseBo res = new ResponseBo();
-
-        //车牌号(必输)
-        String plateNum = gatherData.getVE_LICENSE_NO();
-        //过磅重量NUMBER(18,3)(必输)
-        //读取到的地磅重量——>KG转换为吨
-        BigDecimal grossWt = new BigDecimal(gatherData.getGROSS_WT());
-        grossWt = grossWt.divide(BigDecimal.valueOf(1000),2, RoundingMode.HALF_UP);
-        double weight = grossWt.doubleValue();
-        //进出信息,in 进 out 出
-        String laneMode = "I".equalsIgnoreCase(gatherData.getI_E_FLAG()) ? "in" : "out";
-        //前箱箱号
-        String boxNo = gatherData.getCntrnoF();
-        //后箱箱号
-        String boxNoSecond = gatherData.getCntrnoA();
-        //重磅/空磅:E/F
-        String weightType = "";
-
-        //请求地址
-        String url = configComponent.getGateIdentifyUrl();
-        //请求体
-        String body = "{\"appid\":\""+configComponent.getAppid()+"\"," +
-                "\"data\":{\"plateNum\":\""+plateNum+"\",\"weight\":\""+weight+"\",\"laneMode\":\""+laneMode+"\"," +
-                "\"boxNo\":\""+boxNo+"\",\"boxNoSecond\":\""+boxNoSecond+"\",\"weightType\":\""+weightType+"\"}}";
-        JSONObject params = JSONObject.parseObject(body);
-        log.info("钦州闸口识别对接接口url:{}",url);
-        log.info("钦州闸口识别对接接口params:{}",params);
-        try {
-            JSONObject jsonObject = RestUtil.post(url, headers, params);
-            log.info("钦州闸口识别对接接口返回结果:{}",jsonObject);
-            if(jsonObject != null && jsonObject.toString().contains("success") && jsonObject.getBoolean("success")) {
-                res.setCode(200);
-                res.setMsg(jsonObject.getString("message"));
-            } else {
-                res.setCode(500);
-                res.setMsg(jsonObject.getString("message"));
-            }
-        } catch (Exception e) {
-            log.info("钦州闸口识别对接接口报错:{}",e.getMessage());
-            res.setCode(500);
-            res.setMsg(e.getMessage());
-            return res;
-        }
-
-        res.setCode(200);
-        res.setMsg("请通行");
-
-        return res;
-    }
-
-
-}

+ 0 - 7
src/main/java/com/ruoyi/web/service/ProcessService.java

@@ -22,8 +22,6 @@ public class ProcessService {
     @Autowired
     private BulkloadService bulkloadService;
     @Autowired
-    private IntermodalTransporService intermodalTransporService;
-    @Autowired
     private SendSocket81Service sendSocket81Service;
 
     public ResponseBo process(GatherData gatherData) {
@@ -106,11 +104,6 @@ public class ProcessService {
                 examineState = res.getExamineState();
                 if(500 == res.getCode()) return res;
             }
-            else if("gateIdentify".equalsIgnoreCase(steps.getApi())) {//联运中心接口
-                examineState = "联运中心";
-                res = intermodalTransporService.gateIdentify(gatherData);
-                if(500 == res.getCode()) return res;
-            }
         }
 
         res.setExamineState(examineState);

+ 6 - 0
src/main/java/com/ruoyi/web/service/ReservationService.java

@@ -37,6 +37,8 @@ public class ReservationService {
         //请求地址
         String url = configComponent.getReservationUrl() + "?carNumber=" + TRUCK_NO;
 
+        //url = configComponent.getInVerificationUrl() + "?TruckNo=" + gatherData.getVE_LICENSE_NO() + "&PLACE_CODE=" + gatherData.getPlaceCode();
+
         //返回预约结果对象
         //获取预约状态接口调用失败,默认集装箱处理。
         /*{
@@ -132,6 +134,10 @@ public class ReservationService {
             if(("散货无预约".equals(res.getFlag()) || res.getMsg().contains("登录失败")) && 500 == res.getCode()) {
                 res = containerService.GetBookingInfo(gatherData);
                 res.setExamineState("有集装箱预约");
+                if("未知".equals(res.getFlag()) && 500 == res.getCode()) {
+                    res.setExamineState("未知");
+                    return res;
+                }
                 if("集装箱无预约".equals(res.getFlag()) && 500 == res.getCode()) {
                     log.info("---------------------没有预约------------------");
                     res.setExamineState("没有预约");

+ 0 - 1
src/main/java/com/ruoyi/web/service/SendSocket81Service.java

@@ -2,7 +2,6 @@ package com.ruoyi.web.service;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.web.backgroud.client.BackgroundClientNetty;
-import com.ruoyi.web.bo.GatherBo;
 import com.ruoyi.web.bo.ResponseBo;
 import com.ruoyi.web.config.AesEncryptUtil;
 import com.ruoyi.web.config.ConfigComponent;

+ 0 - 11
src/main/java/com/ruoyi/web/task/TaskDTO.java

@@ -1,11 +0,0 @@
-package com.ruoyi.web.task;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-@Data
-@Accessors(chain = true)
-public class TaskDTO implements Serializable {
-}

+ 0 - 19
src/main/java/com/ruoyi/web/task/TokenTask.java

@@ -1,19 +0,0 @@
-package com.ruoyi.web.task;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import java.util.Properties;
-
-@Component
-@Slf4j
-public class TokenTask {
-    @Scheduled(fixedDelay = 7*24*60*60*1000)
-    public void tokenTask(){
-        Properties properties = System.getProperties();
-        String rootPath = properties.getProperty("user.dir");
-        log.info("root path:{}",rootPath);
-
-    }
-}

+ 24 - 0
src/main/resources/application.yml

@@ -6,6 +6,30 @@ server:
 #    # 应用的访问路径
 #    context-path: /
 
+spring:
+  # redis配置
+  redis:
+    # Redis数据库索引(默认为0)
+    database: 1
+    # Redis服务器地址
+    host: 127.0.0.1
+    # Redis服务器连接端口
+    port: 6379
+    # Redis服务器连接密码(默认为空)
+    password:
+    # 连接超时时间(毫秒)
+    timeout: 1000ms
+    jedis:
+      pool:
+        # 连接池最大连接数
+        max-active: 200
+        # 连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1ms
+        # 连接池中的最大空闲连接
+        max-idle: 10
+        # 连接池中的最小空闲连接
+        min-idle: 0
+
 manager:
   host: 10.3.2.214
   beatPort: 8050