作者 zhangFan

kakoIMF check some message

@@ -4,7 +4,6 @@ import com.sy.bwAssist.Message; @@ -4,7 +4,6 @@ import com.sy.bwAssist.Message;
4 import com.sy.logic.LogicOperation; 4 import com.sy.logic.LogicOperation;
5 import com.sy.model.*; 5 import com.sy.model.*;
6 import com.sy.service.*; 6 import com.sy.service.*;
7 -import com.sy.socket.CommandClient;  
8 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
10 9
@@ -64,14 +63,7 @@ public class AnalysisRoute { @@ -64,14 +63,7 @@ public class AnalysisRoute {
64 }else{ 63 }else{
65 GatherInfo info = gatherInfoAnalysis.toJavaBean(message); 64 GatherInfo info = gatherInfoAnalysis.toJavaBean(message);
66 route.infoService.save(info); 65 route.infoService.save(info);
67 - String flag = null;  
68 - if(new LogicOperation().operation(info)){  
69 - flag = "11";  
70 - CommandClient.Client(info,flag);  
71 - }else{  
72 - flag = "00";  
73 - CommandClient.Client(info,flag);  
74 - } 66 + LogicOperation.operation(info);
75 } 67 }
76 } else if (stype.equals("ES1")) { 68 } else if (stype.equals("ES1")) {
77 airone_ex_stock exStock = exStockAnalysis.toExStock(message); 69 airone_ex_stock exStock = exStockAnalysis.toExStock(message);
@@ -8,6 +8,7 @@ import com.sy.model.LandBusinessTypeList; @@ -8,6 +8,7 @@ import com.sy.model.LandBusinessTypeList;
8 import com.sy.model.LandRoadVe; 8 import com.sy.model.LandRoadVe;
9 import com.sy.service.LandBusListService; 9 import com.sy.service.LandBusListService;
10 import com.sy.service.LandRoadVeService; 10 import com.sy.service.LandRoadVeService;
  11 +import com.sy.socket.CommandClient;
11 import com.sy.utils.FileTool; 12 import com.sy.utils.FileTool;
12 import com.sy.utils.UUIDCreate; 13 import com.sy.utils.UUIDCreate;
13 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
@@ -44,6 +45,12 @@ public class LogicOperation { @@ -44,6 +45,12 @@ public class LogicOperation {
44 //读取配置文件里的载重与称重的可控范围 45 //读取配置文件里的载重与称重的可控范围
45 private static String checkWt = FileTool.readProperties("grossWt"); 46 private static String checkWt = FileTool.readProperties("grossWt");
46 47
  48 + //逻辑判断后的结果定义
  49 + private static String PERMITTHOUGH = "直接放行";
  50 + private static String GROWSSEXCETION = "禁止通行,重量不在可控范围";
  51 + private static String INPUTSTATION = "此车辆未做进站申请";
  52 + private static String ENTERSTATION = "此车辆未做出站申请";
  53 +
47 @PostConstruct 54 @PostConstruct
48 public void init(){ 55 public void init(){
49 logic = this; 56 logic = this;
@@ -51,12 +58,14 @@ public class LogicOperation { @@ -51,12 +58,14 @@ public class LogicOperation {
51 logic.veService = this.veService; 58 logic.veService = this.veService;
52 } 59 }
53 60
54 - public boolean operation(GatherInfo info){  
55 - //开关  
56 - boolean sign = false; 61 + /**
  62 + * @Param info 卡口采集数据
  63 + * @Result 计算卡口采集数据并发送报文
  64 + * */
  65 + public static void operation(GatherInfo info){
57 BigDecimal grosswt = info.getGrosswt(); 66 BigDecimal grosswt = info.getGrosswt();
58 //转为double类型 67 //转为double类型
59 - double growsswWt = grosswt.doubleValue(); 68 + double growssWt = grosswt.doubleValue();
60 String ietype = info.getIetype(); 69 String ietype = info.getIetype();
61 List<LandBusinessTypeList>lists = null; 70 List<LandBusinessTypeList>lists = null;
62 LandRoadVe ve = logic.veService.selectByFrameNo(info.getIcvename()); 71 LandRoadVe ve = logic.veService.selectByFrameNo(info.getIcvename());
@@ -68,35 +77,36 @@ public class LogicOperation { @@ -68,35 +77,36 @@ public class LogicOperation {
68 if(list.getContrastflag()=="" | list.getContrastflag()==null){ 77 if(list.getContrastflag()=="" | list.getContrastflag()==null){
69 //判断载货重量是否符合所设定的范围 78 //判断载货重量是否符合所设定的范围
70 double goodsWt = GoodsWt(list.getMasterList(),"E"); 79 double goodsWt = GoodsWt(list.getMasterList(),"E");
71 - if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){  
72 - sign = true;  
73 - } 80 + double selfWt = Double.parseDouble(ve.getSelfWt());
  81 + sendBw(info,growssWt,selfWt,goodsWt);
74 list.setContrastflag("已出站"); 82 list.setContrastflag("已出站");
75 logic.listService.updateById(list); 83 logic.listService.updateById(list);
76 - if("货物流转".equals(list.getBusinesstype()) |"分拨分流".equals(list.getBusinesstype())){ 84 + if("货物流转".equals(list.getBusinesstype()) | "分拨分流".equals(list.getBusinesstype())){
77 if(list.getMasterList().length()>0) { 85 if(list.getMasterList().length()>0) {
78 createTypeList(list); 86 createTypeList(list);
79 } 87 }
80 } 88 }
  89 + }else {
  90 + CommandClient.Client(info,ENTERSTATION);
81 } 91 }
82 } 92 }
83 }else { 93 }else {
84 ietype = "进场站"; 94 ietype = "进场站";
85 - lists = listService.selectByFrameNoAndType(info.getIcvename(),ietype); 95 + lists = logic.listService.selectByFrameNoAndType(info.getIcvename(),ietype);
86 for (LandBusinessTypeList list:lists) { 96 for (LandBusinessTypeList list:lists) {
87 //查询是否做了出场申请 97 //查询是否做了出场申请
88 if(list.getContrastflag()=="" | list.getContrastflag()==null){ 98 if(list.getContrastflag()=="" | list.getContrastflag()==null){
89 //判断载货重量是否符合所设定的范围 99 //判断载货重量是否符合所设定的范围
90 double goodsWt = GoodsWt(list.getMasterList(),"I"); 100 double goodsWt = GoodsWt(list.getMasterList(),"I");
91 - if(checkResult(growsswWt,Double.parseDouble(ve.getSelfWt()),goodsWt)){  
92 - sign = true;  
93 - } 101 + double selfWt = Double.parseDouble(ve.getSelfWt());
  102 + sendBw(info,growssWt,selfWt,goodsWt);
94 list.setContrastflag("已进站"); 103 list.setContrastflag("已进站");
95 logic.listService.updateById(list); 104 logic.listService.updateById(list);
  105 + }else {
  106 + CommandClient.Client(info,INPUTSTATION);
96 } 107 }
97 } 108 }
98 } 109 }
99 - return sign;  
100 } 110 }
101 111
102 //将获取的checkWt进行小数转化 112 //将获取的checkWt进行小数转化
@@ -119,7 +129,7 @@ public class LogicOperation { @@ -119,7 +129,7 @@ public class LogicOperation {
119 * @Result 获取运单重量 129 * @Result 获取运单重量
120 * */ 130 * */
121 //校验载重和称重是否在合理的范围 131 //校验载重和称重是否在合理的范围
122 - public boolean checkResult(double grossWt,double wt,double goodsWt){ 132 + public static boolean checkResult(double grossWt,double wt,double goodsWt){
123 boolean flag = false; 133 boolean flag = false;
124 double result = (grossWt-wt)/goodsWt; 134 double result = (grossWt-wt)/goodsWt;
125 BigDecimal bd = new BigDecimal(result); 135 BigDecimal bd = new BigDecimal(result);
@@ -183,7 +193,7 @@ public class LogicOperation { @@ -183,7 +193,7 @@ public class LogicOperation {
183 /** 193 /**
184 * 分拨或者流转业务生成新的进站申请 194 * 分拨或者流转业务生成新的进站申请
185 * */ 195 * */
186 - public static int createTypeList(LandBusinessTypeList list){ 196 + public static void createTypeList(LandBusinessTypeList list){
187 LandBusinessTypeList typeList = new LandBusinessTypeList(); 197 LandBusinessTypeList typeList = new LandBusinessTypeList();
188 typeList.setId(UUIDCreate.getUUID()); 198 typeList.setId(UUIDCreate.getUUID());
189 typeList.setAgentname(list.getAgentname()); 199 typeList.setAgentname(list.getAgentname());
@@ -205,7 +215,18 @@ public class LogicOperation { @@ -205,7 +215,18 @@ public class LogicOperation {
205 typeList.setProdectTime(new Date()); 215 typeList.setProdectTime(new Date());
206 typeList.setMasterList(list.getMasterList()); 216 typeList.setMasterList(list.getMasterList());
207 typeList.setBusinesstype(list.getBusinesstype()); 217 typeList.setBusinesstype(list.getBusinesstype());
208 - int result = logic.listService.saveList(typeList);  
209 - return result; 218 + logic.listService.saveList(typeList);
  219 + }
  220 + /**
  221 + *校验重量并发送报文
  222 + * */
  223 +
  224 + public static void sendBw(GatherInfo info,double growsswWt,double selfWt,double goodsWt){
  225 + String flag = null;
  226 + if(checkResult(growsswWt,selfWt,goodsWt)){
  227 + CommandClient.Client(info,PERMITTHOUGH);
  228 + }else {
  229 + CommandClient.Client(info,GROWSSEXCETION);
  230 + }
210 } 231 }
211 } 232 }
1 -package com.sy.model;  
2 -  
3 -public class User {  
4 - private Integer userId;  
5 -  
6 - private String userName;  
7 -  
8 - private String password;  
9 -  
10 - private String phone;  
11 -  
12 - public Integer getUserId() {  
13 - return userId;  
14 - }  
15 -  
16 - public void setUserId(Integer userId) {  
17 - this.userId = userId;  
18 - }  
19 -  
20 - public String getUserName() {  
21 - return userName;  
22 - }  
23 -  
24 - public void setUserName(String userName) {  
25 - this.userName = userName == null ? null : userName.trim();  
26 - }  
27 -  
28 - public String getPassword() {  
29 - return password;  
30 - }  
31 -  
32 - public void setPassword(String password) {  
33 - this.password = password == null ? null : password.trim();  
34 - }  
35 -  
36 - public String getPhone() {  
37 - return phone;  
38 - }  
39 -  
40 - public void setPhone(String phone) {  
41 - this.phone = phone == null ? null : phone.trim();  
42 - }  
43 -}  
@@ -77,13 +77,14 @@ public class CommandClient { @@ -77,13 +77,14 @@ public class CommandClient {
77 /** 77 /**
78 * @Param info 卡口采集信息 78 * @Param info 卡口采集信息
79 * @Param flag 放行标识 79 * @Param flag 放行标识
  80 + * @Result 生成放行报文
80 * */ 81 * */
81 - private static String getXmlInfo(GatherInfo info,String flag) {  
82 - String message = null;  
83 - if ("11".equals(flag)){  
84 - message="直接放行";  
85 - }else{  
86 - message = "禁止通行,载重比对不在可控范围"; 82 + private static String getXmlInfo(GatherInfo info,String message) {
  83 + String flag = null;
  84 + if ("直接放行".equals(message)){
  85 + flag = "11";
  86 + } else{
  87 + flag = "00";
87 } 88 }
88 StringBuffer buffer = new StringBuffer(); 89 StringBuffer buffer = new StringBuffer();
89 buffer.append("<COMMAND_INFO AREA_ID=\""+info.getAreaid()+"\" CHNL_NO=\""+info.getChnlno()+"\" I_E_TYPE=\""+info 90 buffer.append("<COMMAND_INFO AREA_ID=\""+info.getAreaid()+"\" CHNL_NO=\""+info.getChnlno()+"\" I_E_TYPE=\""+info
1 #设置访问端口 1 #设置访问端口
2 -server.port=8082 2 +server.port=8848
3 #eureka注册中心服务器地址 3 #eureka注册中心服务器地址
4 #eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/ 4 #eureka.client.service-url.defaultZone=http://10.50.3.82:19527/eureka/
5 #服务名 5 #服务名