作者 xudada

过卡日志

... ... @@ -34,6 +34,7 @@ import java.net.URLConnection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
@Component
... ... @@ -52,6 +53,8 @@ public class LiftBar {
private BusnesslistinfoService busnesslistinfoService;
@Autowired
BusnessViewService busnessViewService;
@Autowired
CommandLogService commandLogService;
@Autowired
WeightCheckHandleService weightCheckHandleService;
... ... @@ -81,6 +84,9 @@ public class LiftBar {
private static String ALLOCATE_01 = "39301 分拨申请审核通过。";
private static String ALLOCATE_04 = "39103 分拨申请重复传输,海关审核不通过。";
//初始化装载货物重量
private double goodsWt=0.0,inWt=0.0,diffVal=0.0,selfWt=0.0;
@Autowired
private FeignService feignService;
... ... @@ -102,6 +108,7 @@ public class LiftBar {
logic.nmmsHost=this.nmmsHost;
logic.feignService=this.feignService;
logic.nmmsService=this.nmmsService;
logic.commandLogService=this.commandLogService;
}
/**
... ... @@ -115,16 +122,14 @@ public class LiftBar {
//获取过磅重量
double growssWt = info.getGrosswt().doubleValue();
//初始化装载货物重量
double goodsWt=0.0,inWt=0.0,diffVal=0.0;
//取车牌号,判定卡口是否取到车牌号
String vaName = info.getVename();
//1. 若无车牌号,返回未识别错误
if (vaName.length() <= 0) {
logger.error(NO_CHEPAI+vaName);
CommandClient.Client(info, NO_CHEPAI + vaName);
logic.sendBw(info,false,NO_CHEPAI + vaName,new LandBusinessTypeList());
//CommandClient.Client(info, NO_CHEPAI + vaName);
return result;
}
... ... @@ -133,10 +138,11 @@ public class LiftBar {
//若无备案信息,返回车辆未备案或者识别错误
if (ve == null) {
logger.error(NORECORD+vaName);
CommandClient.Client(info, NORECORD + vaName);
logic.sendBw(info,false,NORECORD + vaName,new LandBusinessTypeList());
//CommandClient.Client(info, NORECORD + vaName);
return result;
}
selfWt=Double.parseDouble(ve.getSelfWt());//车辆备案我不是
/**
* 3. 车牌号,二维码,场站ID/号,通道ID/号,进出业务类型标识I/E
* 查询是否已有此场站通道的申请
... ... @@ -146,7 +152,8 @@ public class LiftBar {
//4. 若查询结果为null,返回无相对应进出场申请
if (list == null) {
logger.error(vaName+IEPORSE);
CommandClient.Client(info, IEPORSE);
logic.sendBw(info,false,vaName+IEPORSE,list);
//CommandClient.Client(info, IEPORSE);
return result;
}
... ... @@ -212,7 +219,8 @@ public class LiftBar {
checkResult=true;
}else{
logger.error("[出口送货]-出场重量未通过校验:"+GROWSSEXCETION);
CommandClient.Client(info, GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
break;
... ... @@ -226,14 +234,16 @@ public class LiftBar {
}else {
//有运单未放行
logger.error("[进口提货]-出场未通过校验:"+FANGXING+list.getMasterList());
CommandClient.Client(info, FANGXING);
logic.sendBw(info,false,FANGXING+list.getMasterList(),list);
//CommandClient.Client(info, FANGXING);
return false;
}
//todo:装载运单历史数据累加超重判定
}else{
logger.error("[进口提货]-出场重量未通过校验:"+GROWSSEXCETION);
CommandClient.Client(info, GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
break;
... ... @@ -243,14 +253,16 @@ public class LiftBar {
boolean allocatCheck = checkNmmsAllocate(list.getMasterList());
if(!allocatCheck){
logger.error("[分拨业务]-分拨申请舱单未通过校验:"+FENBO);
CommandClient.Client(info, FENBO);
logic.sendBw(info,false,FENBO,list);
//CommandClient.Client(info, FENBO);
return false;
}
checkResult=true;
//todo:分拨运抵通知,重车入场视为运抵
}else{
logger.error("[分拨业务]-出场重量未通过校验:"+GROWSSEXCETION);
CommandClient.Client(info, GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
break;
... ... @@ -263,13 +275,15 @@ public class LiftBar {
}else {
//有运单未放行
logger.error("[调拨业务]-出场未通过校验:"+FANGXING+list.getMasterList());
CommandClient.Client(info, FANGXING);
logic.sendBw(info,false,FANGXING,list);
//CommandClient.Client(info, FANGXING);
return false;
}
//todo:检查ULD放行.
}else{
logger.error("[调拨业务]-出场未通过校验:"+GROWSSEXCETION);
CommandClient.Client(info, GROWSSEXCETION);
logic.sendBw(info,false,GROWSSEXCETION,list);
//CommandClient.Client(info, GROWSSEXCETION);
return false;
}
break;
... ... @@ -303,7 +317,7 @@ public class LiftBar {
}
//发送抬杆指令,todo:生产环境去掉下面注释
boolean commandResult = logic.sendBw(info, checkResult);
boolean commandResult = logic.sendBw(info, checkResult,null,list);
//fortest 正式环境删除
// boolean commandResult = true;
if(commandResult){//发送抬杆儿报文
... ... @@ -404,7 +418,7 @@ public class LiftBar {
* @param info 车辆过卡信息
* @param check 是否放行抬杆
*/
public boolean sendBw(GatherInfo info, boolean check) {
public boolean sendBw(GatherInfo info, boolean check,String reason,LandBusinessTypeList land) {
logger.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt()));
boolean flag = false;
if (check) {
... ... @@ -412,12 +426,42 @@ public class LiftBar {
logger.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<==============");
flag = true;
} else {
CommandClient.Client(info, GROWSSEXCETION);
CommandClient.Client(info, reason);
logger.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<==============");
}
logic.commandlog(info,check,reason,land);
return flag;
}
public void commandlog(GatherInfo info,boolean check,String reason,LandBusinessTypeList land){
String flag="",type="";
commandLog command=new commandLog();
command.setId(UUID.randomUUID().toString());
command.setBarcode(land.getBarcode());
command.setAreaId(info.getAreaid());
command.setChnlNo(info.getChnlno());
command.setBusnessType(land.getBusinesstype());
if (check){
flag = "00";
} else{
flag = "11";
}
if("I".equals(info.getIetype())){
type="000000200000000000";
}else{
type="000000100000000000";
}
command.setReasonCode(flag+type);
command.setReasonText(reason);
command.setVeName(info.getVename());
command.setVeWeight(selfWt);
command.setIeType(info.getIetype());
command.setExitGrossWeight(info.getGrosswt().doubleValue());
command.setInGrossWeight(inWt);
command.setGoodsWeight(goodsWt);
command.setActualGoodsWeight(diffVal);
command.setMasterList(land.getMasterList());
logic.commandLogService.insert(command);
}
/**
* 给码头发送卡口数据
*
... ...
package com.sy.mapper;
import com.sy.model.commandLog;
public interface commandLogMapper {
int deleteByPrimaryKey(String id);
int insert(commandLog record);
int insertSelective(commandLog record);
commandLog selectByPrimaryKey(String id);
int updateByPrimaryKeySelective(commandLog record);
int updateByPrimaryKey(commandLog record);
}
\ No newline at end of file
... ...
package com.sy.model;
import java.util.Date;
public class commandLog {
private String id;
private String barcode;
private String areaId;
private String chnlNo;
private String busnessType;
private String reasonCode;
private String reasonText;
private String veName;
private Double veWeight;
private String ieType;
private Double exitGrossWeight;
private Double inGrossWeight;
private Double goodsWeight;
private Double actualGoodsWeight;
private Date creatTime;
private Date updateTime;
private String masterList;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode == null ? null : barcode.trim();
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId == null ? null : areaId.trim();
}
public String getChnlNo() {
return chnlNo;
}
public void setChnlNo(String chnlNo) {
this.chnlNo = chnlNo == null ? null : chnlNo.trim();
}
public String getBusnessType() {
return busnessType;
}
public void setBusnessType(String busnessType) {
this.busnessType = busnessType == null ? null : busnessType.trim();
}
public String getReasonCode() {
return reasonCode;
}
public void setReasonCode(String reasonCode) {
this.reasonCode = reasonCode == null ? null : reasonCode.trim();
}
public String getReasonText() {
return reasonText;
}
public void setReasonText(String reasonText) {
this.reasonText = reasonText == null ? null : reasonText.trim();
}
public String getVeName() {
return veName;
}
public void setVeName(String veName) {
this.veName = veName == null ? null : veName.trim();
}
public Double getVeWeight() {
return veWeight;
}
public void setVeWeight(Double veWeight) {
this.veWeight = veWeight;
}
public String getIeType() {
return ieType;
}
public void setIeType(String ieType) {
this.ieType = ieType == null ? null : ieType.trim();
}
public Double getExitGrossWeight() {
return exitGrossWeight;
}
public void setExitGrossWeight(Double exitGrossWeight) {
this.exitGrossWeight = exitGrossWeight;
}
public Double getInGrossWeight() {
return inGrossWeight;
}
public void setInGrossWeight(Double inGrossWeight) {
this.inGrossWeight = inGrossWeight;
}
public Double getGoodsWeight() {
return goodsWeight;
}
public void setGoodsWeight(Double goodsWeight) {
this.goodsWeight = goodsWeight;
}
public Double getActualGoodsWeight() {
return actualGoodsWeight;
}
public void setActualGoodsWeight(Double actualGoodsWeight) {
this.actualGoodsWeight = actualGoodsWeight;
}
public Date getCreatTime() {
return creatTime;
}
public void setCreatTime(Date creatTime) {
this.creatTime = creatTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getMasterList() {
return masterList;
}
public void setMasterList(String masterList) {
this.masterList = masterList == null ? null : masterList.trim();
}
}
\ No newline at end of file
... ...
package com.sy.service;
import com.sy.model.commandLog;
public interface CommandLogService {
int insert(commandLog command);
}
... ...
package com.sy.service.impl;
import com.sy.mapper.commandLogMapper;
import com.sy.model.commandLog;
import com.sy.service.CommandLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CommandLogImpl implements CommandLogService {
@Autowired
commandLogMapper mapper;
@Override
public int insert(commandLog command) {
return mapper.insertSelective(command);
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sy.mapper.commandLogMapper">
<resultMap id="BaseResultMap" type="com.sy.model.commandLog">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="barcode" jdbcType="VARCHAR" property="barcode" />
<result column="area_id" jdbcType="VARCHAR" property="areaId" />
<result column="chnl_no" jdbcType="VARCHAR" property="chnlNo" />
<result column="busness_type" jdbcType="VARCHAR" property="busnessType" />
<result column="reason_code" jdbcType="VARCHAR" property="reasonCode" />
<result column="reason_text" jdbcType="VARCHAR" property="reasonText" />
<result column="ve_name" jdbcType="VARCHAR" property="veName" />
<result column="ve_weight" jdbcType="DOUBLE" property="veWeight" />
<result column="ie_type" jdbcType="VARCHAR" property="ieType" />
<result column="exit_gross_weight" jdbcType="DOUBLE" property="exitGrossWeight" />
<result column="in_gross_weight" jdbcType="DOUBLE" property="inGrossWeight" />
<result column="goods_weight" jdbcType="DOUBLE" property="goodsWeight" />
<result column="actual_goods_weight" jdbcType="DOUBLE" property="actualGoodsWeight" />
<result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="master_list" jdbcType="VARCHAR" property="masterList" />
</resultMap>
<sql id="Base_Column_List">
id, barcode, area_id, chnl_no, busness_type, reason_code, reason_text, ve_name, ve_weight,
ie_type, exit_gross_weight, in_gross_weight, goods_weight, actual_goods_weight, creat_time,
update_time, master_list
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from command_log
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from command_log
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.sy.model.commandLog">
insert into command_log (id, barcode, area_id,
chnl_no, busness_type, reason_code,
reason_text, ve_name, ve_weight,
ie_type, exit_gross_weight, in_gross_weight,
goods_weight, actual_goods_weight, creat_time,
update_time, master_list)
values (#{id,jdbcType=VARCHAR}, #{barcode,jdbcType=VARCHAR}, #{areaId,jdbcType=VARCHAR},
#{chnlNo,jdbcType=VARCHAR}, #{busnessType,jdbcType=VARCHAR}, #{reasonCode,jdbcType=VARCHAR},
#{reasonText,jdbcType=VARCHAR}, #{veName,jdbcType=VARCHAR}, #{veWeight,jdbcType=DOUBLE},
#{ieType,jdbcType=VARCHAR}, #{exitGrossWeight,jdbcType=DOUBLE}, #{inGrossWeight,jdbcType=DOUBLE},
#{goodsWeight,jdbcType=DOUBLE}, #{actualGoodsWeight,jdbcType=DOUBLE}, #{creatTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{masterList,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.sy.model.commandLog">
insert into command_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="barcode != null">
barcode,
</if>
<if test="areaId != null">
area_id,
</if>
<if test="chnlNo != null">
chnl_no,
</if>
<if test="busnessType != null">
busness_type,
</if>
<if test="reasonCode != null">
reason_code,
</if>
<if test="reasonText != null">
reason_text,
</if>
<if test="veName != null">
ve_name,
</if>
<if test="veWeight != null">
ve_weight,
</if>
<if test="ieType != null">
ie_type,
</if>
<if test="exitGrossWeight != null">
exit_gross_weight,
</if>
<if test="inGrossWeight != null">
in_gross_weight,
</if>
<if test="goodsWeight != null">
goods_weight,
</if>
<if test="actualGoodsWeight != null">
actual_goods_weight,
</if>
<if test="creatTime != null">
creat_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="masterList != null">
master_list,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="barcode != null">
#{barcode,jdbcType=VARCHAR},
</if>
<if test="areaId != null">
#{areaId,jdbcType=VARCHAR},
</if>
<if test="chnlNo != null">
#{chnlNo,jdbcType=VARCHAR},
</if>
<if test="busnessType != null">
#{busnessType,jdbcType=VARCHAR},
</if>
<if test="reasonCode != null">
#{reasonCode,jdbcType=VARCHAR},
</if>
<if test="reasonText != null">
#{reasonText,jdbcType=VARCHAR},
</if>
<if test="veName != null">
#{veName,jdbcType=VARCHAR},
</if>
<if test="veWeight != null">
#{veWeight,jdbcType=DOUBLE},
</if>
<if test="ieType != null">
#{ieType,jdbcType=VARCHAR},
</if>
<if test="exitGrossWeight != null">
#{exitGrossWeight,jdbcType=DOUBLE},
</if>
<if test="inGrossWeight != null">
#{inGrossWeight,jdbcType=DOUBLE},
</if>
<if test="goodsWeight != null">
#{goodsWeight,jdbcType=DOUBLE},
</if>
<if test="actualGoodsWeight != null">
#{actualGoodsWeight,jdbcType=DOUBLE},
</if>
<if test="creatTime != null">
#{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="masterList != null">
#{masterList,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sy.model.commandLog">
update command_log
<set>
<if test="barcode != null">
barcode = #{barcode,jdbcType=VARCHAR},
</if>
<if test="areaId != null">
area_id = #{areaId,jdbcType=VARCHAR},
</if>
<if test="chnlNo != null">
chnl_no = #{chnlNo,jdbcType=VARCHAR},
</if>
<if test="busnessType != null">
busness_type = #{busnessType,jdbcType=VARCHAR},
</if>
<if test="reasonCode != null">
reason_code = #{reasonCode,jdbcType=VARCHAR},
</if>
<if test="reasonText != null">
reason_text = #{reasonText,jdbcType=VARCHAR},
</if>
<if test="veName != null">
ve_name = #{veName,jdbcType=VARCHAR},
</if>
<if test="veWeight != null">
ve_weight = #{veWeight,jdbcType=DOUBLE},
</if>
<if test="ieType != null">
ie_type = #{ieType,jdbcType=VARCHAR},
</if>
<if test="exitGrossWeight != null">
exit_gross_weight = #{exitGrossWeight,jdbcType=DOUBLE},
</if>
<if test="inGrossWeight != null">
in_gross_weight = #{inGrossWeight,jdbcType=DOUBLE},
</if>
<if test="goodsWeight != null">
goods_weight = #{goodsWeight,jdbcType=DOUBLE},
</if>
<if test="actualGoodsWeight != null">
actual_goods_weight = #{actualGoodsWeight,jdbcType=DOUBLE},
</if>
<if test="creatTime != null">
creat_time = #{creatTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="masterList != null">
master_list = #{masterList,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sy.model.commandLog">
update command_log
set barcode = #{barcode,jdbcType=VARCHAR},
area_id = #{areaId,jdbcType=VARCHAR},
chnl_no = #{chnlNo,jdbcType=VARCHAR},
busness_type = #{busnessType,jdbcType=VARCHAR},
reason_code = #{reasonCode,jdbcType=VARCHAR},
reason_text = #{reasonText,jdbcType=VARCHAR},
ve_name = #{veName,jdbcType=VARCHAR},
ve_weight = #{veWeight,jdbcType=DOUBLE},
ie_type = #{ieType,jdbcType=VARCHAR},
exit_gross_weight = #{exitGrossWeight,jdbcType=DOUBLE},
in_gross_weight = #{inGrossWeight,jdbcType=DOUBLE},
goods_weight = #{goodsWeight,jdbcType=DOUBLE},
actual_goods_weight = #{actualGoodsWeight,jdbcType=DOUBLE},
creat_time = #{creatTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
master_list = #{masterList,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
... ...