|
@@ -1,161 +1,163 @@
|
|
|
-package com.tokheim.aifueling.communication.toInternalInterface.entity;
|
|
|
-
|
|
|
-import com.tokheim.aifueling.communication.entitys.*;
|
|
|
-import lombok.Data;
|
|
|
-
|
|
|
-import java.math.BigDecimal;
|
|
|
-
|
|
|
-/**
|
|
|
- * 定义内部接口请求参数
|
|
|
- * <h5>Type:指令</h5>
|
|
|
- * <h5>ClientId:加油机 id,用 ip 填入</h5>
|
|
|
- * <h5>AIId:AI id</h5>
|
|
|
- * <h5>GLId:格林 id</h5>
|
|
|
- * <h5>NozzleNo:枪号</h5>
|
|
|
- * <h5>OilCode:油品编码</h5>
|
|
|
- * <h5>Balance:卡余额</h5>
|
|
|
- * <h5>MaxRefuelingAmount:最大可加金额</h5>
|
|
|
- * <h5>CardType:卡类型</h5>
|
|
|
- * <h5>Amount:金额</h5>
|
|
|
- * <h5>Vol:升数</h5>
|
|
|
- * <h5>LicensePlateMatching:车牌匹配结果</h5>
|
|
|
- * <p>00:不匹配</p>
|
|
|
- * <p>01:匹配</p>
|
|
|
- * <p>02:不是限车牌卡</p>
|
|
|
- */
|
|
|
-@Data
|
|
|
-public class FuelSendRequest {
|
|
|
- /**
|
|
|
- * 指令
|
|
|
- */
|
|
|
- private String Type;
|
|
|
-
|
|
|
- /**
|
|
|
- * 加油机 id,用 ip 填入
|
|
|
- */
|
|
|
- private String ClientId;
|
|
|
-
|
|
|
- /**
|
|
|
- * AI id
|
|
|
- */
|
|
|
- private String AIId;
|
|
|
-
|
|
|
- /**
|
|
|
- * 格林 id
|
|
|
- */
|
|
|
- private String GLId;
|
|
|
-
|
|
|
- /**
|
|
|
- * 枪号
|
|
|
- */
|
|
|
- private Integer NozzleNo;
|
|
|
-
|
|
|
- /**
|
|
|
- * 油品编码
|
|
|
- */
|
|
|
- private String OilCode;
|
|
|
-
|
|
|
- /**
|
|
|
- * 卡余额
|
|
|
- */
|
|
|
- private BigDecimal Balance;
|
|
|
-
|
|
|
- /**
|
|
|
- * 最大可加金额
|
|
|
- */
|
|
|
- private BigDecimal MaxRefuelingAmount;
|
|
|
-
|
|
|
- /**
|
|
|
- * 卡类型
|
|
|
- */
|
|
|
- public Integer CardType;
|
|
|
-
|
|
|
- /**
|
|
|
- * 金额
|
|
|
- */
|
|
|
- public BigDecimal Amount;
|
|
|
-
|
|
|
- /**
|
|
|
- * 升数
|
|
|
- */
|
|
|
- public BigDecimal Vol;
|
|
|
-
|
|
|
- /**
|
|
|
- * 车牌匹配结果
|
|
|
- * <p>00:不匹配</p>
|
|
|
- * <p>01:匹配</p>
|
|
|
- * <p>02:不是限车牌卡</p>
|
|
|
- */
|
|
|
- public Integer LicensePlateMatching;
|
|
|
-
|
|
|
-// FuelSendRequest(){
|
|
|
-// this.Type = "";
|
|
|
-// this.ClientId = "";
|
|
|
-// this.AIId = "";
|
|
|
-// this.GLId = "";
|
|
|
-// this.NozzleNo = -1;
|
|
|
-// this.OilCode = "";
|
|
|
-// this.Balance = BigDecimal.valueOf(-1);
|
|
|
-// this.MaxRefuelingAmount = BigDecimal.valueOf(-1);
|
|
|
-// this.CardType = -1;
|
|
|
-// this.Amount = BigDecimal.valueOf(-1);
|
|
|
-// this.Vol = BigDecimal.valueOf(-1);
|
|
|
-// this.LicensePlateMatching = -1;
|
|
|
-// }
|
|
|
- /**
|
|
|
- * 油机信息对象转化为内部接口请求对象
|
|
|
- * @param type 数据类型
|
|
|
- * <p>1:卡状态相关数据</p>
|
|
|
- * <p>2:油枪状态相关数据</p>
|
|
|
- * <p>3:一键加油相关数据</p>
|
|
|
- * <p>4:停止加油相关数据</p>
|
|
|
- * <p>5:定量加油相关数据</p>
|
|
|
- * <p>6:发送车牌号相关数据</p>
|
|
|
- * @param baseInfo 油机信息对象
|
|
|
- * @return 内部接口请求对象
|
|
|
- */
|
|
|
- public static FuelSendRequest convert(Integer type,BaseInfo baseInfo){
|
|
|
- FuelSendRequest fuelSendRequest = new FuelSendRequest();
|
|
|
- //填入基本信息
|
|
|
- fuelSendRequest.setClientId(baseInfo.getIp());
|
|
|
- fuelSendRequest.setAIId(baseInfo.getAiId());
|
|
|
- fuelSendRequest.setGLId(baseInfo.getGeLinId());
|
|
|
- fuelSendRequest.setOilCode(baseInfo.getOilCode());
|
|
|
- fuelSendRequest.setNozzleNo(baseInfo.getNozzleNum());
|
|
|
- fuelSendRequest.setCardType(baseInfo.getCardType());
|
|
|
-
|
|
|
- switch (type) {
|
|
|
- case 1:
|
|
|
- CardStatus cardStatus = (CardStatus) baseInfo;
|
|
|
- fuelSendRequest.setType(cardStatus.getEvent());
|
|
|
- if (cardStatus.getMaxRefuelingAmount() != null) fuelSendRequest.setMaxRefuelingAmount(new BigDecimal(cardStatus.getMaxRefuelingAmount()));
|
|
|
- if (cardStatus.getBalance() != null) fuelSendRequest.setBalance(new BigDecimal(cardStatus.getBalance()));
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- NozzleStatus nozzleStatus = (NozzleStatus) baseInfo;
|
|
|
- fuelSendRequest.setType(nozzleStatus.getEvent());
|
|
|
- if(nozzleStatus.getMaxRefuelingAmount() != null) fuelSendRequest.setMaxRefuelingAmount(new BigDecimal(nozzleStatus.getMaxRefuelingAmount()));
|
|
|
- if(nozzleStatus.getBalance() != null) fuelSendRequest.setBalance(new BigDecimal(nozzleStatus.getBalance()));
|
|
|
- if(nozzleStatus.getAmount() != null) fuelSendRequest.setAmount(new BigDecimal(nozzleStatus.getAmount()));
|
|
|
- if(nozzleStatus.getVol() != null) fuelSendRequest.setVol(new BigDecimal(nozzleStatus.getVol()));
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- RefuelCode refuelCode = (RefuelCode) baseInfo;
|
|
|
- fuelSendRequest.setType(refuelCode.getEvent());
|
|
|
- if (refuelCode.getMaxRefuelingAmount() != null) fuelSendRequest.setAmount(new BigDecimal(refuelCode.getMaxRefuelingAmount()));
|
|
|
- if (refuelCode.getMaxRefuelingVolume() != null) fuelSendRequest.setVol(new BigDecimal(refuelCode.getMaxRefuelingVolume()));
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- Quantitative quantitative = (Quantitative) baseInfo;
|
|
|
- fuelSendRequest.setType(quantitative.getEvent());
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- CarNum carNum = (CarNum) baseInfo;
|
|
|
- fuelSendRequest.setType(carNum.getEvent());
|
|
|
- fuelSendRequest.setLicensePlateMatching(carNum.getMatchResult());
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- return fuelSendRequest;
|
|
|
- }
|
|
|
-}
|
|
|
+package com.tokheim.aifueling.communication.toInternalInterface.entity;
|
|
|
+
|
|
|
+import com.tokheim.aifueling.communication.entitys.*;
|
|
|
+import lombok.Data;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 定义内部接口请求参数
|
|
|
+ * <h5>Type:指令</h5>
|
|
|
+ * <h5>ClientId:加油机 id,用 ip 填入</h5>
|
|
|
+ * <h5>AIId:AI id</h5>
|
|
|
+ * <h5>GLId:格林 id</h5>
|
|
|
+ * <h5>NozzleNo:枪号</h5>
|
|
|
+ * <h5>OilCode:油品编码</h5>
|
|
|
+ * <h5>Balance:卡余额</h5>
|
|
|
+ * <h5>MaxRefuelingAmount:最大可加金额</h5>
|
|
|
+ * <h5>CardType:卡类型</h5>
|
|
|
+ * <h5>Amount:金额</h5>
|
|
|
+ * <h5>Vol:升数</h5>
|
|
|
+ * <h5>LicensePlateMatching:车牌匹配结果</h5>
|
|
|
+ * <p>00:不匹配</p>
|
|
|
+ * <p>01:匹配</p>
|
|
|
+ * <p>02:不是限车牌卡</p>
|
|
|
+ */
|
|
|
+@Data
|
|
|
+public class FuelSendRequest {
|
|
|
+ /**
|
|
|
+ * 指令
|
|
|
+ */
|
|
|
+ private String Type;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 加油机 id,用 ip 填入
|
|
|
+ */
|
|
|
+ private String ClientId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * AI id
|
|
|
+ */
|
|
|
+ private String AIId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 格林 id
|
|
|
+ */
|
|
|
+ private String GLId;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 枪号
|
|
|
+ */
|
|
|
+ private Integer NozzleNo;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 油品编码
|
|
|
+ */
|
|
|
+ private String OilCode;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 卡余额
|
|
|
+ */
|
|
|
+ private BigDecimal Balance;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 最大可加金额
|
|
|
+ */
|
|
|
+ private BigDecimal MaxRefuelingAmount;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 卡类型
|
|
|
+ */
|
|
|
+ public Integer CardType;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 金额
|
|
|
+ */
|
|
|
+ public BigDecimal Amount;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 升数
|
|
|
+ */
|
|
|
+ public BigDecimal Vol;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 车牌匹配结果
|
|
|
+ * <p>00:不匹配</p>
|
|
|
+ * <p>01:匹配</p>
|
|
|
+ * <p>02:不是限车牌卡</p>
|
|
|
+ */
|
|
|
+ public Integer LicensePlateMatching;
|
|
|
+
|
|
|
+// FuelSendRequest(){
|
|
|
+// this.Type = "";
|
|
|
+// this.ClientId = "";
|
|
|
+// this.AIId = "";
|
|
|
+// this.GLId = "";
|
|
|
+// this.NozzleNo = -1;
|
|
|
+// this.OilCode = "";
|
|
|
+// this.Balance = BigDecimal.valueOf(-1);
|
|
|
+// this.MaxRefuelingAmount = BigDecimal.valueOf(-1);
|
|
|
+// this.CardType = -1;
|
|
|
+// this.Amount = BigDecimal.valueOf(-1);
|
|
|
+// this.Vol = BigDecimal.valueOf(-1);
|
|
|
+// this.LicensePlateMatching = -1;
|
|
|
+// }
|
|
|
+ /**
|
|
|
+ * 油机信息对象转化为内部接口请求对象
|
|
|
+ * @param type 数据类型
|
|
|
+ * <p>1:卡状态相关数据</p>
|
|
|
+ * <p>2:油枪状态相关数据</p>
|
|
|
+ * <p>3:一键加油相关数据</p>
|
|
|
+ * <p>4:停止加油相关数据</p>
|
|
|
+ * <p>5:定量加油相关数据</p>
|
|
|
+ * <p>6:发送车牌号相关数据</p>
|
|
|
+ * @param baseInfo 油机信息对象
|
|
|
+ * @return 内部接口请求对象
|
|
|
+ */
|
|
|
+ public static FuelSendRequest convert(Integer type,BaseInfo baseInfo){
|
|
|
+ FuelSendRequest fuelSendRequest = new FuelSendRequest();
|
|
|
+ //填入基本信息
|
|
|
+ fuelSendRequest.setClientId(baseInfo.getIp());
|
|
|
+ fuelSendRequest.setAIId(baseInfo.getAiId());
|
|
|
+ fuelSendRequest.setGLId(baseInfo.getGeLinId());
|
|
|
+ fuelSendRequest.setOilCode(baseInfo.getOilCode());
|
|
|
+ fuelSendRequest.setNozzleNo(baseInfo.getNozzleNum());
|
|
|
+ fuelSendRequest.setCardType(baseInfo.getCardType());
|
|
|
+
|
|
|
+ switch (type) {
|
|
|
+ case 1:
|
|
|
+ CardStatus cardStatus = (CardStatus) baseInfo;
|
|
|
+ fuelSendRequest.setType(cardStatus.getEvent());
|
|
|
+ if (cardStatus.getMaxRefuelingAmount() != null) fuelSendRequest.setMaxRefuelingAmount(new BigDecimal(cardStatus.getMaxRefuelingAmount()));
|
|
|
+ if (cardStatus.getBalance() != null) fuelSendRequest.setBalance(new BigDecimal(cardStatus.getBalance()));
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ NozzleStatus nozzleStatus = (NozzleStatus) baseInfo;
|
|
|
+ fuelSendRequest.setType(nozzleStatus.getEvent());
|
|
|
+ if(nozzleStatus.getMaxRefuelingAmount() != null) fuelSendRequest.setMaxRefuelingAmount(new BigDecimal(nozzleStatus.getMaxRefuelingAmount()));
|
|
|
+ if(nozzleStatus.getBalance() != null) fuelSendRequest.setBalance(new BigDecimal(nozzleStatus.getBalance()));
|
|
|
+ if(nozzleStatus.getAmount() != null) fuelSendRequest.setAmount(new BigDecimal(nozzleStatus.getAmount()));
|
|
|
+ if(nozzleStatus.getVol() != null) fuelSendRequest.setVol(new BigDecimal(nozzleStatus.getVol()));
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ RefuelCode refuelCode = (RefuelCode) baseInfo;
|
|
|
+ fuelSendRequest.setType(refuelCode.getEvent());
|
|
|
+ if (refuelCode.getMaxRefuelingAmount() != null) fuelSendRequest.setAmount(new BigDecimal(refuelCode.getMaxRefuelingAmount()));
|
|
|
+ if (refuelCode.getMaxRefuelingVolume() != null) fuelSendRequest.setVol(new BigDecimal(refuelCode.getMaxRefuelingVolume()));
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ Quantitative quantitative = (Quantitative) baseInfo;
|
|
|
+ fuelSendRequest.setType(quantitative.getEvent());
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ CarNum carNum = (CarNum) baseInfo;
|
|
|
+ fuelSendRequest.setType(carNum.getEvent());
|
|
|
+// fuelSendRequest.setLicensePlateMatching(carNum.getMatchResult());
|
|
|
+ //目前无格林摄像头,先将车牌卡改为非车牌卡
|
|
|
+ fuelSendRequest.setLicensePlateMatching(2);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ return fuelSendRequest;
|
|
|
+ }
|
|
|
+}
|