作者 xudada

进出卡口写日志更新写入运单列表问题

@@ -31,10 +31,9 @@ import java.io.InputStreamReader; @@ -31,10 +31,9 @@ import java.io.InputStreamReader;
31 import java.net.MalformedURLException; 31 import java.net.MalformedURLException;
32 import java.net.URL; 32 import java.net.URL;
33 import java.net.URLConnection; 33 import java.net.URLConnection;
34 -import java.util.Date;  
35 -import java.util.List;  
36 -import java.util.Map;  
37 -import java.util.UUID; 34 +import java.util.*;
  35 +
  36 +import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;
38 37
39 38
40 @Component 39 @Component
@@ -85,7 +84,8 @@ public class LiftBar { @@ -85,7 +84,8 @@ public class LiftBar {
85 private static String ALLOCATE_04 = "39103 分拨申请重复传输,海关审核不通过。"; 84 private static String ALLOCATE_04 = "39103 分拨申请重复传输,海关审核不通过。";
86 85
87 //初始化装载货物重量 86 //初始化装载货物重量
88 - private double goodsWt=0.0,inWt=0.0,diffVal=0.0,selfWt=0.0; 87 + private static double goodsWt=0.0,inWt=0.0,diffVal=0.0,selfWt=0.0;
  88 + private List<LAND_BUSINEESTYPE_LIST_INFO> listinfos;
89 89
90 @Autowired 90 @Autowired
91 private FeignService feignService; 91 private FeignService feignService;
@@ -128,7 +128,7 @@ public class LiftBar { @@ -128,7 +128,7 @@ public class LiftBar {
128 //1. 若无车牌号,返回未识别错误 128 //1. 若无车牌号,返回未识别错误
129 if (vaName.length() <= 0) { 129 if (vaName.length() <= 0) {
130 logger.error(NO_CHEPAI+vaName); 130 logger.error(NO_CHEPAI+vaName);
131 - logic.sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList()); 131 + logic.sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList(),listinfos);
132 //CommandClient.Client(info, NO_CHEPAI + vaName); 132 //CommandClient.Client(info, NO_CHEPAI + vaName);
133 return result; 133 return result;
134 } 134 }
@@ -138,14 +138,12 @@ public class LiftBar { @@ -138,14 +138,12 @@ public class LiftBar {
138 //若无备案信息,返回车辆未备案或者识别错误 138 //若无备案信息,返回车辆未备案或者识别错误
139 if (ve == null) { 139 if (ve == null) {
140 logger.error(NORECORD+vaName); 140 logger.error(NORECORD+vaName);
141 - logic.sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList()); 141 + logic.sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList(),listinfos);
142 //CommandClient.Client(info, NORECORD + vaName); 142 //CommandClient.Client(info, NORECORD + vaName);
143 return result; 143 return result;
144 } 144 }
145 selfWt=Double.parseDouble(ve.getSelfWt());//车辆备案我不是 145 selfWt=Double.parseDouble(ve.getSelfWt());//车辆备案我不是
146 146
147 - List<LAND_BUSINEESTYPE_LIST_INFO> listinfos=logic.busnesslistinfoService.selectmanilist(info.getBarcode());  
148 -  
149 /** 147 /**
150 * 3. 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E 148 * 3. 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E
151 * 查询是否已有此场站通道的申请 149 * 查询是否已有此场站通道的申请
@@ -155,7 +153,7 @@ public class LiftBar { @@ -155,7 +153,7 @@ public class LiftBar {
155 //4. 若查询结果为null,返回无相对应进出场申请 153 //4. 若查询结果为null,返回无相对应进出场申请
156 if (list == null) { 154 if (list == null) {
157 logger.error(vaName+IEPORSE); 155 logger.error(vaName+IEPORSE);
158 - logic.sendBw(info,false,vaName+IEPORSE,list); 156 + logic.sendBw(info,false,vaName+IEPORSE,list,listinfos);
159 //CommandClient.Client(info, IEPORSE); 157 //CommandClient.Client(info, IEPORSE);
160 return result; 158 return result;
161 } 159 }
@@ -166,6 +164,8 @@ public class LiftBar { @@ -166,6 +164,8 @@ public class LiftBar {
166 boolean checkResult = false; 164 boolean checkResult = false;
167 boolean check = false; 165 boolean check = false;
168 boolean checkMainfest =false; 166 boolean checkMainfest =false;
  167 + //查询运单列表
  168 + listinfos=logic.busnesslistinfoService.selectmanilist(info.getBarcode());
169 //7. 判断是进场申请还是出场申请 169 //7. 判断是进场申请还是出场申请
170 if("I".equals(info.getIetype())){ 170 if("I".equals(info.getIetype())){
171 //进场申请宽进 171 //进场申请宽进
@@ -221,7 +221,7 @@ public class LiftBar { @@ -221,7 +221,7 @@ public class LiftBar {
221 checkResult=true; 221 checkResult=true;
222 }else{ 222 }else{
223 logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION); 223 logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION);
224 - logic.sendBw(info,false,GROWSSEXCETION,list); 224 + logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
225 //CommandClient.Client(info, GROWSSEXCETION); 225 //CommandClient.Client(info, GROWSSEXCETION);
226 return false; 226 return false;
227 } 227 }
@@ -236,7 +236,7 @@ public class LiftBar { @@ -236,7 +236,7 @@ public class LiftBar {
236 }else { 236 }else {
237 //有运单未放行 237 //有运单未放行
238 logger.error("[进口提货]-出场未通过校验:"+FANGXING+list.getMasterList()); 238 logger.error("[进口提货]-出场未通过校验:"+FANGXING+list.getMasterList());
239 - logic.sendBw(info,false,FANGXING+list.getMasterList(),list); 239 + logic.sendBw(info,false,FANGXING+list.getMasterList(),list,listinfos);
240 //CommandClient.Client(info, FANGXING); 240 //CommandClient.Client(info, FANGXING);
241 return false; 241 return false;
242 } 242 }
@@ -244,7 +244,7 @@ public class LiftBar { @@ -244,7 +244,7 @@ public class LiftBar {
244 //todo:装载运单历史数据累加超重判定 244 //todo:装载运单历史数据累加超重判定
245 }else{ 245 }else{
246 logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION); 246 logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION);
247 - logic.sendBw(info,false,GROWSSEXCETION,list); 247 + logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
248 //CommandClient.Client(info, GROWSSEXCETION); 248 //CommandClient.Client(info, GROWSSEXCETION);
249 return false; 249 return false;
250 } 250 }
@@ -255,7 +255,7 @@ public class LiftBar { @@ -255,7 +255,7 @@ public class LiftBar {
255 boolean allocatCheck = checkNmmsAllocate(list.getMasterList()); 255 boolean allocatCheck = checkNmmsAllocate(list.getMasterList());
256 if(!allocatCheck){ 256 if(!allocatCheck){
257 logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO); 257 logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO);
258 - logic.sendBw(info,false,FENBO,list); 258 + logic.sendBw(info,false,FENBO,list,listinfos);
259 //CommandClient.Client(info, FENBO); 259 //CommandClient.Client(info, FENBO);
260 return false; 260 return false;
261 } 261 }
@@ -263,7 +263,7 @@ public class LiftBar { @@ -263,7 +263,7 @@ public class LiftBar {
263 //todo:分拨运抵通知,重车入场视为运抵 263 //todo:分拨运抵通知,重车入场视为运抵
264 }else{ 264 }else{
265 logger.error("[分拨业务]-出场重量未通过校验:"+GROWSSEXCETION); 265 logger.error("[分拨业务]-出场重量未通过校验:"+GROWSSEXCETION);
266 - logic.sendBw(info,false,GROWSSEXCETION,list); 266 + logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
267 //CommandClient.Client(info, GROWSSEXCETION); 267 //CommandClient.Client(info, GROWSSEXCETION);
268 return false; 268 return false;
269 } 269 }
@@ -277,14 +277,14 @@ public class LiftBar { @@ -277,14 +277,14 @@ public class LiftBar {
277 }else { 277 }else {
278 //有运单未放行 278 //有运单未放行
279 logger.error("[调拨业务]-出场未通过校验:"+FANGXING+list.getMasterList()); 279 logger.error("[调拨业务]-出场未通过校验:"+FANGXING+list.getMasterList());
280 - logic.sendBw(info,false,FANGXING,list); 280 + logic.sendBw(info,false,FANGXING,list,listinfos);
281 //CommandClient.Client(info, FANGXING); 281 //CommandClient.Client(info, FANGXING);
282 return false; 282 return false;
283 } 283 }
284 //todo:检查ULD放行. 284 //todo:检查ULD放行.
285 }else{ 285 }else{
286 logger.error("[调拨业务]-出场未通过校验:"+GROWSSEXCETION); 286 logger.error("[调拨业务]-出场未通过校验:"+GROWSSEXCETION);
287 - logic.sendBw(info,false,GROWSSEXCETION,list); 287 + logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
288 //CommandClient.Client(info, GROWSSEXCETION); 288 //CommandClient.Client(info, GROWSSEXCETION);
289 return false; 289 return false;
290 } 290 }
@@ -319,7 +319,7 @@ public class LiftBar { @@ -319,7 +319,7 @@ public class LiftBar {
319 } 319 }
320 320
321 //发送抬杆指令,todo:生产环境去掉下面注释 321 //发送抬杆指令,todo:生产环境去掉下面注释
322 - boolean commandResult = logic.sendBw(info, checkResult,null,list); 322 + boolean commandResult = logic.sendBw(info, checkResult,PERMITTHOUGH,list,listinfos);
323 //fortest 正式环境删除 323 //fortest 正式环境删除
324 // boolean commandResult = true; 324 // boolean commandResult = true;
325 if(commandResult){//发送抬杆儿报文 325 if(commandResult){//发送抬杆儿报文
@@ -420,28 +420,30 @@ public class LiftBar { @@ -420,28 +420,30 @@ public class LiftBar {
420 * @param info 车辆过卡信息 420 * @param info 车辆过卡信息
421 * @param check 是否放行抬杆 421 * @param check 是否放行抬杆
422 */ 422 */
423 - public boolean sendBw(GatherInfo info, boolean check,String reason,LandBusinessTypeList land) { 423 + public boolean sendBw(GatherInfo info, boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) {
424 logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt())); 424 logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt()));
425 boolean flag = false; 425 boolean flag = false;
426 if (check) { 426 if (check) {
427 - CommandClient.Client(info, PERMITTHOUGH); 427 + //CommandClient.Client(info, PERMITTHOUGH);
428 logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<=============="); 428 logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<==============");
429 flag = true; 429 flag = true;
430 } else { 430 } else {
431 - CommandClient.Client(info, reason); 431 + //CommandClient.Client(info, reason);
432 logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); 432 logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<==============");
433 } 433 }
434 - logic.commandlog(info,check,reason,land); 434 + commandlog(info,check,reason,land,list_infos);
435 return flag; 435 return flag;
436 } 436 }
437 - public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land){ 437 + public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){
438 String flag="",type=""; 438 String flag="",type="";
439 commandLog command=new commandLog(); 439 commandLog command=new commandLog();
440 command.setId(UUID.randomUUID().toString()); 440 command.setId(UUID.randomUUID().toString());
  441 + if(land!=null){
441 command.setBarcode(land.getBarcode()); 442 command.setBarcode(land.getBarcode());
  443 + command.setBusnessType(land.getBusinesstype());
  444 + }
442 command.setAreaId(info.getAreaid()); 445 command.setAreaId(info.getAreaid());
443 command.setChnlNo(info.getChnlno()); 446 command.setChnlNo(info.getChnlno());
444 - command.setBusnessType(land.getBusinesstype());  
445 if (check){ 447 if (check){
446 flag = "00"; 448 flag = "00";
447 } else{ 449 } else{
@@ -461,7 +463,7 @@ public class LiftBar { @@ -461,7 +463,7 @@ public class LiftBar {
461 command.setInGrossWeight(inWt); 463 command.setInGrossWeight(inWt);
462 command.setGoodsWeight(goodsWt); 464 command.setGoodsWeight(goodsWt);
463 command.setActualGoodsWeight(diffVal); 465 command.setActualGoodsWeight(diffVal);
464 - command.setMasterList(land.getMasterList()); 466 + command.setMasterList(Arrays.toString(toStrArry(list_infos)));
465 logic.commandLogService.insert(command); 467 logic.commandLogService.insert(command);
466 } 468 }
467 /** 469 /**
@@ -47,26 +47,21 @@ public class ResMessageServiceImpl implements ResMessageService { @@ -47,26 +47,21 @@ public class ResMessageServiceImpl implements ResMessageService {
47 public boolean checkManifestRelease(GatherInfo info, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) { 47 public boolean checkManifestRelease(GatherInfo info, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) {
48 List<String> noRelease = new Vector<>(); 48 List<String> noRelease = new Vector<>();
49 if (list_infos.size() < 1) { 49 if (list_infos.size() < 1) {
50 - CommandClient.Client(info, AWB_EMPTY); 50 + //CommandClient.Client(info, AWB_EMPTY);
51 return false; 51 return false;
52 } 52 }
53 - List<String> manifestList=new ArrayList<String>();  
54 - for(LAND_BUSINEESTYPE_LIST_INFO land:list_infos){  
55 - manifestList.add(land.getAwba());  
56 - }  
57 - //manifestList = manifestList.replace("-", "").replace(",", ",");  
58 - String[] maifest = manifestList.toArray(new String[manifestList.size()]);  
59 - logger.info("运单列表:" + manifestList); 53 +
  54 + logger.info("运单列表:" + toStrArry(list_infos));
60 boolean flag = false; 55 boolean flag = false;
61 56
62 - List<RESMESSAGE> list = selectByManifestList(maifest); 57 + List<RESMESSAGE> list = selectByManifestList(toStrArry(list_infos));
63 58
64 - if (list.size() == maifest.length) { 59 + if (list.size() == toStrArry(list_infos).length) {
65 flag = true; 60 flag = true;
66 }else{ 61 }else{
67 //返回未放行的运单列表 62 //返回未放行的运单列表
68 - if (maifest.length>0){  
69 - for (String awb : maifest) { 63 + if (toStrArry(list_infos).length>0){
  64 + for (String awb : toStrArry(list_infos)) {
70 boolean anyMatch = list.stream().anyMatch(resmessage -> { 65 boolean anyMatch = list.stream().anyMatch(resmessage -> {
71 return resmessage.getManifest().equals(awb); 66 return resmessage.getManifest().equals(awb);
72 }); 67 });
@@ -76,10 +71,19 @@ public class ResMessageServiceImpl implements ResMessageService { @@ -76,10 +71,19 @@ public class ResMessageServiceImpl implements ResMessageService {
76 } 71 }
77 if (!noRelease.isEmpty()) { 72 if (!noRelease.isEmpty()) {
78 logger.info(Arrays.toString(noRelease.toArray())+FANGXING); 73 logger.info(Arrays.toString(noRelease.toArray())+FANGXING);
79 - CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING); 74 + //CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
80 } 75 }
81 } 76 }
82 } 77 }
83 return flag; 78 return flag;
84 } 79 }
  80 + public static String[] toStrArry(List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){
  81 + List<String> manifestList=new ArrayList<String>();
  82 + for(LAND_BUSINEESTYPE_LIST_INFO land:list_infos){
  83 + manifestList.add(land.getAwba());
  84 + }
  85 + //manifestList = manifestList.replace("-", "").replace(",", ",");
  86 + String[] maifest = manifestList.toArray(new String[manifestList.size()]);
  87 + return maifest;
  88 + }
85 } 89 }
1 package com.sy.service.impl; 1 package com.sy.service.impl;
2 2
3 import com.sy.logic.LiftBar; 3 import com.sy.logic.LiftBar;
  4 +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
4 import com.sy.service.ResMessageService; 5 import com.sy.service.ResMessageService;
5 import com.sy.service.WeightCheckHandleService; 6 import com.sy.service.WeightCheckHandleService;
6 import org.apache.log4j.Logger; 7 import org.apache.log4j.Logger;
@@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.boot.test.context.SpringBootTest; 12 import org.springframework.boot.test.context.SpringBootTest;
12 import org.springframework.test.context.junit4.SpringRunner; 13 import org.springframework.test.context.junit4.SpringRunner;
13 14
  15 +import java.util.List;
  16 +
14 import static org.junit.jupiter.api.Assertions.*; 17 import static org.junit.jupiter.api.Assertions.*;
15 18
16 @RunWith(SpringRunner.class) 19 @RunWith(SpringRunner.class)
@@ -25,9 +28,11 @@ class ResMessageServiceImplTest { @@ -25,9 +28,11 @@ class ResMessageServiceImplTest {
25 @Autowired 28 @Autowired
26 private ResMessageService resMessageService; 29 private ResMessageService resMessageService;
27 30
  31 + private List<LAND_BUSINEESTYPE_LIST_INFO> list;
  32 +
28 @Test 33 @Test
29 void checkManifestRelease() { 34 void checkManifestRelease() {
30 - boolean re = resMessageService.checkManifestRelease(null,"157-55140831,157-55140853,157-55140724,157-76344026,157-76344022"); 35 + boolean re = resMessageService.checkManifestRelease(null,list);
31 logger.info("结果:"+re); 36 logger.info("结果:"+re);
32 } 37 }
33 } 38 }