作者 xudada

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

... ... @@ -31,10 +31,9 @@ import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;
@Component
... ... @@ -85,7 +84,8 @@ public class LiftBar {
private static String ALLOCATE_04 = "39103 分拨申请重复传输,海关审核不通过。";
//初始化装载货物重量
private double goodsWt=0.0,inWt=0.0,diffVal=0.0,selfWt=0.0;
private static double goodsWt=0.0,inWt=0.0,diffVal=0.0,selfWt=0.0;
private List<LAND_BUSINEESTYPE_LIST_INFO> listinfos;
@Autowired
private FeignService feignService;
... ... @@ -128,7 +128,7 @@ public class LiftBar {
//1. 若无车牌号,返回未识别错误
if (vaName.length() <= 0) {
logger.error(NO_CHEPAI+vaName);
logic.sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList());
logic.sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList(),listinfos);
//CommandClient.Client(info, NO_CHEPAI + vaName);
return result;
}
... ... @@ -138,14 +138,12 @@ public class LiftBar {
//若无备案信息,返回车辆未备案或者识别错误
if (ve == null) {
logger.error(NORECORD+vaName);
logic.sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList());
logic.sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList(),listinfos);
//CommandClient.Client(info, NORECORD + vaName);
return result;
}
selfWt=Double.parseDouble(ve.getSelfWt());//车辆备案我不是
List<LAND_BUSINEESTYPE_LIST_INFO> listinfos=logic.busnesslistinfoService.selectmanilist(info.getBarcode());
/**
* 3. 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E
* 查询是否已有此场站通道的申请
... ... @@ -155,7 +153,7 @@ public class LiftBar {
//4. 若查询结果为null,返回无相对应进出场申请
if (list == null) {
logger.error(vaName+IEPORSE);
logic.sendBw(info,false,vaName+IEPORSE,list);
logic.sendBw(info,false,vaName+IEPORSE,list,listinfos);
//CommandClient.Client(info, IEPORSE);
return result;
}
... ... @@ -166,6 +164,8 @@ public class LiftBar {
boolean checkResult = false;
boolean check = false;
boolean checkMainfest =false;
//查询运单列表
listinfos=logic.busnesslistinfoService.selectmanilist(info.getBarcode());
//7. 判断是进场申请还是出场申请
if("I".equals(info.getIetype())){
//进场申请宽进
... ... @@ -221,7 +221,7 @@ public class LiftBar {
checkResult=true;
}else{
logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
... ... @@ -236,7 +236,7 @@ public class LiftBar {
}else {
//有运单未放行
logger.error("[进口提货]-出场未通过校验:"+FANGXING+list.getMasterList());
logic.sendBw(info,false,FANGXING+list.getMasterList(),list);
logic.sendBw(info,false,FANGXING+list.getMasterList(),list,listinfos);
//CommandClient.Client(info, FANGXING);
return false;
}
... ... @@ -244,7 +244,7 @@ public class LiftBar {
//todo:装载运单历史数据累加超重判定
}else{
logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
... ... @@ -255,7 +255,7 @@ public class LiftBar {
boolean allocatCheck = checkNmmsAllocate(list.getMasterList());
if(!allocatCheck){
logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO);
logic.sendBw(info,false,FENBO,list);
logic.sendBw(info,false,FENBO,list,listinfos);
//CommandClient.Client(info, FENBO);
return false;
}
... ... @@ -263,7 +263,7 @@ public class LiftBar {
//todo:分拨运抵通知,重车入场视为运抵
}else{
logger.error("[分拨业务]-出场重量未通过校验:"+GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
... ... @@ -277,14 +277,14 @@ public class LiftBar {
}else {
//有运单未放行
logger.error("[调拨业务]-出场未通过校验:"+FANGXING+list.getMasterList());
logic.sendBw(info,false,FANGXING,list);
logic.sendBw(info,false,FANGXING,list,listinfos);
//CommandClient.Client(info, FANGXING);
return false;
}
//todo:检查ULD放行.
}else{
logger.error("[调拨业务]-出场未通过校验:"+GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
logic.sendBw(info,false,GROWSSEXCETION,list,listinfos);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
... ... @@ -319,7 +319,7 @@ public class LiftBar {
}
//发送抬杆指令,todo:生产环境去掉下面注释
boolean commandResult = logic.sendBw(info, checkResult,null,list);
boolean commandResult = logic.sendBw(info, checkResult,PERMITTHOUGH,list,listinfos);
//fortest 正式环境删除
// boolean commandResult = true;
if(commandResult){//发送抬杆儿报文
... ... @@ -420,28 +420,30 @@ public class LiftBar {
* @param info 车辆过卡信息
* @param check 是否放行抬杆
*/
public boolean sendBw(GatherInfo info, boolean check,String reason,LandBusinessTypeList land) {
public boolean sendBw(GatherInfo info, boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) {
logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt()));
boolean flag = false;
if (check) {
CommandClient.Client(info, PERMITTHOUGH);
//CommandClient.Client(info, PERMITTHOUGH);
logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<==============");
flag = true;
} else {
CommandClient.Client(info, reason);
//CommandClient.Client(info, reason);
logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<==============");
}
logic.commandlog(info,check,reason,land);
commandlog(info,check,reason,land,list_infos);
return flag;
}
public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land){
public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land,List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){
String flag="",type="";
commandLog command=new commandLog();
command.setId(UUID.randomUUID().toString());
command.setBarcode(land.getBarcode());
if(land!=null){
command.setBarcode(land.getBarcode());
command.setBusnessType(land.getBusinesstype());
}
command.setAreaId(info.getAreaid());
command.setChnlNo(info.getChnlno());
command.setBusnessType(land.getBusinesstype());
if (check){
flag = "00";
} else{
... ... @@ -461,7 +463,7 @@ public class LiftBar {
command.setInGrossWeight(inWt);
command.setGoodsWeight(goodsWt);
command.setActualGoodsWeight(diffVal);
command.setMasterList(land.getMasterList());
command.setMasterList(Arrays.toString(toStrArry(list_infos)));
logic.commandLogService.insert(command);
}
/**
... ...
... ... @@ -47,26 +47,21 @@ public class ResMessageServiceImpl implements ResMessageService {
public boolean checkManifestRelease(GatherInfo info, List<LAND_BUSINEESTYPE_LIST_INFO> list_infos) {
List<String> noRelease = new Vector<>();
if (list_infos.size() < 1) {
CommandClient.Client(info, AWB_EMPTY);
//CommandClient.Client(info, AWB_EMPTY);
return false;
}
List<String> manifestList=new ArrayList<String>();
for(LAND_BUSINEESTYPE_LIST_INFO land:list_infos){
manifestList.add(land.getAwba());
}
//manifestList = manifestList.replace("-", "").replace(",", ",");
String[] maifest = manifestList.toArray(new String[manifestList.size()]);
logger.info("运单列表:" + manifestList);
logger.info("运单列表:" + toStrArry(list_infos));
boolean flag = false;
List<RESMESSAGE> list = selectByManifestList(maifest);
List<RESMESSAGE> list = selectByManifestList(toStrArry(list_infos));
if (list.size() == maifest.length) {
if (list.size() == toStrArry(list_infos).length) {
flag = true;
}else{
//返回未放行的运单列表
if (maifest.length>0){
for (String awb : maifest) {
if (toStrArry(list_infos).length>0){
for (String awb : toStrArry(list_infos)) {
boolean anyMatch = list.stream().anyMatch(resmessage -> {
return resmessage.getManifest().equals(awb);
});
... ... @@ -76,10 +71,19 @@ public class ResMessageServiceImpl implements ResMessageService {
}
if (!noRelease.isEmpty()) {
logger.info(Arrays.toString(noRelease.toArray())+FANGXING);
CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
//CommandClient.Client(info, Arrays.toString(noRelease.toArray())+FANGXING);
}
}
}
return flag;
}
public static String[] toStrArry(List<LAND_BUSINEESTYPE_LIST_INFO> list_infos){
List<String> manifestList=new ArrayList<String>();
for(LAND_BUSINEESTYPE_LIST_INFO land:list_infos){
manifestList.add(land.getAwba());
}
//manifestList = manifestList.replace("-", "").replace(",", ",");
String[] maifest = manifestList.toArray(new String[manifestList.size()]);
return maifest;
}
}
... ...
package com.sy.service.impl;
import com.sy.logic.LiftBar;
import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
import com.sy.service.ResMessageService;
import com.sy.service.WeightCheckHandleService;
import org.apache.log4j.Logger;
... ... @@ -11,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
@RunWith(SpringRunner.class)
... ... @@ -25,9 +28,11 @@ class ResMessageServiceImplTest {
@Autowired
private ResMessageService resMessageService;
private List<LAND_BUSINEESTYPE_LIST_INFO> list;
@Test
void checkManifestRelease() {
boolean re = resMessageService.checkManifestRelease(null,"157-55140831,157-55140853,157-55140724,157-76344026,157-76344022");
boolean re = resMessageService.checkManifestRelease(null,list);
logger.info("结果:"+re);
}
}
... ...