作者 朱兆平

验放逻辑及验放规则继续完善

@@ -27,8 +27,8 @@ class BaseFormCacheCheck extends Script implements ChannelCheckScript { @@ -27,8 +27,8 @@ class BaseFormCacheCheck extends Script implements ChannelCheckScript {
27 Boolean check(ExecuteParams executeParams) { 27 Boolean check(ExecuteParams executeParams) {
28 try{ 28 try{
29 // 获取product对象 29 // 获取product对象
30 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo");  
31 - LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("chanelFormInfo"); 30 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
  31 + LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
32 32
33 // 调用方法 33 // 调用方法
34 ApplicationContext context = getContext(); 34 ApplicationContext context = getContext();
@@ -29,7 +29,7 @@ class BaseVeCheck extends Script implements ChannelCheckScript { @@ -29,7 +29,7 @@ class BaseVeCheck extends Script implements ChannelCheckScript {
29 */ 29 */
30 Boolean check(ExecuteParams executeParams) { 30 Boolean check(ExecuteParams executeParams) {
31 try{ 31 try{
32 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 32 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
33 LandRoadVe ve = (LandRoadVe) executeParams.get("LandRoadVe"); 33 LandRoadVe ve = (LandRoadVe) executeParams.get("LandRoadVe");
34 34
35 //3.车辆备案验证 35 //3.车辆备案验证
@@ -11,6 +11,7 @@ import org.springframework.context.ApplicationContext @@ -11,6 +11,7 @@ import org.springframework.context.ApplicationContext
11 /** 11 /**
12 * 基本验放 12 * 基本验放
13 * 过卡信息验放 13 * 过卡信息验放
  14 + * todo:重复过卡验放
14 */ 15 */
15 class BaseX21GatherInfoCheck extends Script implements ChannelCheckScript { 16 class BaseX21GatherInfoCheck extends Script implements ChannelCheckScript {
16 17
@@ -22,7 +23,7 @@ class BaseX21GatherInfoCheck extends Script implements ChannelCheckScript { @@ -22,7 +23,7 @@ class BaseX21GatherInfoCheck extends Script implements ChannelCheckScript {
22 */ 23 */
23 Boolean check(ExecuteParams executeParams) { 24 Boolean check(ExecuteParams executeParams) {
24 try{ 25 try{
25 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 26 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
26 27
27 // 获取容器中的bean 28 // 获取容器中的bean
28 // 调用方法 29 // 调用方法
@@ -31,7 +31,7 @@ class BillAllocateCheck extends Script implements ChannelCheckScript { @@ -31,7 +31,7 @@ class BillAllocateCheck extends Script implements ChannelCheckScript {
31 */ 31 */
32 Boolean check(ExecuteParams executeParams) { 32 Boolean check(ExecuteParams executeParams) {
33 try{ 33 try{
34 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 34 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
35 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 35 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
36 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists"); 36 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
37 37
@@ -28,7 +28,7 @@ class BillReleaseCheck extends Script implements ChannelCheckScript { @@ -28,7 +28,7 @@ class BillReleaseCheck extends Script implements ChannelCheckScript {
28 */ 28 */
29 Boolean check(ExecuteParams executeParams) { 29 Boolean check(ExecuteParams executeParams) {
30 try{ 30 try{
31 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 31 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
32 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 32 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
33 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists"); 33 List<LAND_BUSINEESTYPE_LIST_INFO> listinfos = (List<LAND_BUSINEESTYPE_LIST_INFO>) executeParams.get("ChanelFormBillLists");
34 34
@@ -32,8 +32,8 @@ class G2Notice extends Script implements ChannelCheckScript { @@ -32,8 +32,8 @@ class G2Notice extends Script implements ChannelCheckScript {
32 * 1. 从缓存获取车辆进出场申请信息,有流转信息再进行通道对碰. 32 * 1. 从缓存获取车辆进出场申请信息,有流转信息再进行通道对碰.
33 * 无流转信息则说明缓存失效或者二维码不对. 33 * 无流转信息则说明缓存失效或者二维码不对.
34 */ 34 */
35 - GatherInfo info = (GatherInfo) executeParams.get("gatherInfo");  
36 - LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("chanelFormInfo"); 35 + GatherInfo info = (GatherInfo) executeParams.get("GatherInfo");
  36 + LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
37 if (landBusinessTypeList!=null){ 37 if (landBusinessTypeList!=null){
38 rightChnelCheck(landBusinessTypeList.getBusinesstype(),info); 38 rightChnelCheck(landBusinessTypeList.getBusinesstype(),info);
39 }else { 39 }else {
@@ -38,7 +38,7 @@ class LockNoticeCheck extends Script implements ChannelCheckScript { @@ -38,7 +38,7 @@ class LockNoticeCheck extends Script implements ChannelCheckScript {
38 * 离场标识 38 * 离场标识
39 */ 39 */
40 String OUT_TYPE="E"; 40 String OUT_TYPE="E";
41 - GatherInfo info = (GatherInfo) executeParams.get("gatherInfo"); 41 + GatherInfo info = (GatherInfo) executeParams.get("GatherInfo");
42 // 获取容器中的bean 42 // 获取容器中的bean
43 // 调用方法 43 // 调用方法
44 ApplicationContext context = getContext(); 44 ApplicationContext context = getContext();
@@ -25,7 +25,7 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript @@ -25,7 +25,7 @@ class WeightCheckAllocateOrDispatch extends Script implements ChannelCheckScript
25 */ 25 */
26 Boolean check(ExecuteParams executeParams) { 26 Boolean check(ExecuteParams executeParams) {
27 try{ 27 try{
28 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 28 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
29 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 29 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
30 Double selfWt = (Double) executeParams.get("selfWt"); 30 Double selfWt = (Double) executeParams.get("selfWt");
31 Double goodsWt = (Double) executeParams.get("goodsWt"); 31 Double goodsWt = (Double) executeParams.get("goodsWt");
@@ -27,7 +27,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript { @@ -27,7 +27,7 @@ class WeightCheckEmpty extends Script implements ChannelCheckScript {
27 */ 27 */
28 Boolean check(ExecuteParams executeParams) { 28 Boolean check(ExecuteParams executeParams) {
29 try{ 29 try{
30 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 30 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
32 Double selfWt = (Double) executeParams.get("selfWt"); 32 Double selfWt = (Double) executeParams.get("selfWt");
33 Double goodsWt = (Double) executeParams.get("goodsWt"); 33 Double goodsWt = (Double) executeParams.get("goodsWt");
@@ -27,7 +27,7 @@ class WeightCheckExportUnload extends Script implements ChannelCheckScript { @@ -27,7 +27,7 @@ class WeightCheckExportUnload extends Script implements ChannelCheckScript {
27 */ 27 */
28 Boolean check(ExecuteParams executeParams) { 28 Boolean check(ExecuteParams executeParams) {
29 try{ 29 try{
30 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 30 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
32 Double selfWt = (Double) executeParams.get("selfWt"); 32 Double selfWt = (Double) executeParams.get("selfWt");
33 Double goodsWt = (Double) executeParams.get("goodsWt"); 33 Double goodsWt = (Double) executeParams.get("goodsWt");
@@ -27,7 +27,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript { @@ -27,7 +27,7 @@ class WeightCheckImportDlv extends Script implements ChannelCheckScript {
27 */ 27 */
28 Boolean check(ExecuteParams executeParams) { 28 Boolean check(ExecuteParams executeParams) {
29 try{ 29 try{
30 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); 30 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo"); 31 LandBusinessTypeList landBusinessTypeList = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
32 Double selfWt = (Double) executeParams.get("selfWt"); 32 Double selfWt = (Double) executeParams.get("selfWt");
33 Double goodsWt = (Double) executeParams.get("goodsWt"); 33 Double goodsWt = (Double) executeParams.get("goodsWt");
@@ -25,11 +25,11 @@ class X21FormReleaseCheck extends Script { @@ -25,11 +25,11 @@ class X21FormReleaseCheck extends Script {
25 * 传入从redis读取的申请表体实体,验证 25 * 传入从redis读取的申请表体实体,验证
26 * 进行通道比对 26 * 进行通道比对
27 */ 27 */
28 - void releaseCheck(ExecuteParams executeParams) { 28 + void check(ExecuteParams executeParams) {
29 try{ 29 try{
30 // 获取product对象 30 // 获取product对象
31 - GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo");  
32 - List<LandBusinessTypeList> formList = (List<LandBusinessTypeList>) executeParams.get("formList"); 31 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
  32 + List<LandBusinessTypeList> formList = (List<LandBusinessTypeList>) executeParams.get("FormList");
33 33
34 // 调用方法 34 // 调用方法
35 ApplicationContext context = getContext(); 35 ApplicationContext context = getContext();
  1 +package com.sy.groovy
  2 +
  3 +import com.sy.model.GatherInfo
  4 +import com.sy.model.LandBusinessTypeList
  5 +import com.sy.service.impl.GatherInfoHandle
  6 +import org.basis.enhance.groovy.entity.ExecuteParams
  7 +import org.slf4j.Logger
  8 +import org.slf4j.LoggerFactory
  9 +import org.springframework.context.ApplicationContext
  10 +
  11 +import java.util.stream.Collectors
  12 +
  13 +/**
  14 + * 流转申请-核销
  15 + * 1. 单进单出即核销判定
  16 + * 2. 根据申请单中的通道类型及通道信息判定没有未走完的通道类型,可以核销.比如 申请单证的通道只有进通道,车可以走进一,进二,进二入场,走完进一,即可核销.(一线进)
  17 + */
  18 +class X21FormSingileReleaseCheck extends Script {
  19 +
  20 + private final Logger logger = LoggerFactory.getLogger(getClass());
  21 +
  22 +
  23 + /**x21指令判定
  24 + * 传入gatherInfo
  25 + *
  26 + * 传入从redis读取的申请表体实体,验证
  27 + * 进行通道比对
  28 + */
  29 + void check(ExecuteParams executeParams) {
  30 + try{
  31 + // 获取product对象
  32 + GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
  33 + List<LandBusinessTypeList> formList = (List<LandBusinessTypeList>) executeParams.get("FormList");
  34 +
  35 + // 调用方法
  36 + ApplicationContext context = getContext();
  37 + // 获取容器中的bean
  38 + GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
  39 +
  40 + List<LandBusinessTypeList> temp = new ArrayList<>(formList);
  41 + //二维码已出区的记录
  42 + List<LandBusinessTypeList> havenCrossList = gatherInfoHandle.listService.selectByBarcodeWithE(gatherInfo.getBarcode());
  43 +
  44 + if (formList == null && formList.isEmpty() ){
  45 + logger.error("[FORM-RELEASE-CHECK]-车辆进出场对应申请缓存数据为空:{}",gatherInfo.getBarcode());
  46 + return;
  47 + }
  48 +
  49 + if (havenCrossList.isEmpty()){
  50 + logger.error("[FORM-RELEASE-CHECK]{}:车辆无离场数据,不核销",gatherInfo.getVename());
  51 + return;
  52 + }
  53 + logger.info("[FORM-RELEASE-CHECK]:已过卡数量:[{}]",havenCrossList.size())
  54 + //申请核销判定,已出区的记录与流转申请数据核碰.如果流转申请列表核碰完,还剩下的需要出区的场站则不核销.
  55 + for (LandBusinessTypeList businessTypeList : havenCrossList) {
  56 + List<LandBusinessTypeList> r = formList.stream().filter({item ->
  57 + //判断还有没有没有出区的场站,还有没有出区的场站就不核销
  58 + logger.debug("[releaseFormCheck-Stream-loop]-缓存与已出核碰,缓存元素场站:[{}],已出记录场站:[{}]",item.getEndstation(),businessTypeList.getEndstation());
  59 + //解决缓存那里存储有不一样的把人错的的有问题的点,二维码不一致也把缓存删除
  60 + if (!item.getBarcode().equals(businessTypeList.getBarcode())){
  61 + return true;
  62 + }
  63 + if(item.getEndstation().equals(businessTypeList.getEndstation())) {
  64 + logger.info("[releaseFormCheck-Stream-loop]-缓存元素场站:[{}],已出记录场站:[{}]-核销判定对碰成功",item.getEndstation(),businessTypeList.getEndstation());
  65 + return true;
  66 + }else {
  67 + return false;
  68 + }
  69 + }).collect(Collectors.toList());
  70 + temp.removeAll(r);
  71 + }
  72 + logger.info("[FORM-RELEASE-CHECK]-核销判定结果:{}",temp.size());
  73 + if (temp.isEmpty()){
  74 + //todo:流转申请状态核销
  75 + logger.info("[进出场申请]-流转申请开始核销:"+gatherInfo.getVename());
  76 + //二维码核销
  77 +// gatherInfoHandle.releaseBarCode();
  78 + logger.info("[进出场申请]-流转申请已核销:"+gatherInfo.getVename());
  79 + }
  80 + }catch (Exception e){
  81 + e.printStackTrace();
  82 + logger.error("[FORM-RELEASE-ERROR]:",e);
  83 + }
  84 + }
  85 +
  86 + @Override
  87 + Object run() {
  88 + return false;
  89 + }
  90 +
  91 + // 获取spring容器
  92 + ApplicationContext getContext() {
  93 + // 获取spring IOC容器
  94 + ApplicationContext context = applicationContext;
  95 + return context;
  96 + }
  97 +
  98 +}
  1 +package com.sy.mapper;
  2 +
  3 +import com.sy.model.RuleChannelConfig;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface RuleChannelConfigDao {
  8 + int deleteByPrimaryKey(Integer configId);
  9 +
  10 + int insert(RuleChannelConfig record);
  11 +
  12 + int insertSelective(RuleChannelConfig record);
  13 +
  14 + RuleChannelConfig selectByPrimaryKey(Integer configId);
  15 +
  16 + /**
  17 + * 根据通道及申报信息查询相关验放规则
  18 + * @param record 查询参数包含通道号,业务类型,货物类型
  19 + * @return 验放规则列表
  20 + */
  21 + List<RuleChannelConfig> selectByChannelAndBusiTypeAndGoodsType(RuleChannelConfig record);
  22 +
  23 + int updateByPrimaryKeySelective(RuleChannelConfig record);
  24 +
  25 + int updateByPrimaryKey(RuleChannelConfig record);
  26 +}
  1 +package com.sy.mapper;
  2 +
  3 +import com.sy.model.RuleConfig;
  4 +
  5 +public interface RuleConfigDao {
  6 + int deleteByPrimaryKey(Integer ruleId);
  7 +
  8 + int insert(RuleConfig record);
  9 +
  10 + int insertSelective(RuleConfig record);
  11 +
  12 + RuleConfig selectByPrimaryKey(Integer ruleId);
  13 +
  14 + int updateByPrimaryKeySelective(RuleConfig record);
  15 +
  16 + int updateByPrimaryKey(RuleConfig record);
  17 +}
  1 +package com.sy.model;
  2 +
  3 +/**
  4 + * 新舱单查询实体类
  5 + */
  6 +public class NmmsPrepaidMasterSearch {
  7 + /**
  8 + * 主单号
  9 + * 格式为 804-31118371
  10 + */
  11 + public String waybillno;
  12 + public int pageIndex;
  13 + public int pageSize;
  14 +
  15 + public NmmsPrepaidMasterSearch(String waybillno, int pageIndex, int pageSize) {
  16 + this.waybillno = waybillno;
  17 + this.pageIndex = pageIndex;
  18 + this.pageSize = pageSize;
  19 + }
  20 +}
  1 +package com.sy.model;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +import lombok.Data;
  6 +
  7 +/**
  8 + * rule_channel_config
  9 + * @author
  10 + */
  11 +@Data
  12 +public class RuleChannelConfig implements Serializable {
  13 + private Integer configId;
  14 +
  15 + /**
  16 + * 通道号
  17 + */
  18 + private String channelNum;
  19 +
  20 + /**
  21 + * 业务类型
  22 + */
  23 + private String businessType;
  24 +
  25 + /**
  26 + * 货物类型
  27 + */
  28 + private String goodsType;
  29 +
  30 + /**
  31 + * 验放规则id
  32 + */
  33 + private Integer ruleId;
  34 +
  35 + /**
  36 + * 验放顺序
  37 + */
  38 + private Byte configOrder;
  39 +
  40 + /**
  41 + * 数据创建时间
  42 + */
  43 + private Date creatTime;
  44 +
  45 + /**
  46 + * 更新时间
  47 + */
  48 + private Date updateTime;
  49 +
  50 + /**
  51 + * 关联验放脚本配置类
  52 + */
  53 + public RuleConfig ruleConfig;
  54 +
  55 + private static final long serialVersionUID = 1L;
  56 +}
  1 +package com.sy.model;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.Date;
  5 +import lombok.Data;
  6 +
  7 +/**
  8 + * rule_config
  9 + * @author
  10 + */
  11 +@Data
  12 +public class RuleConfig implements Serializable {
  13 + private Integer ruleId;
  14 +
  15 + /**
  16 + * 规则名称
  17 + */
  18 + private String ruleName;
  19 +
  20 + /**
  21 + * 规则key,存redis的键名
  22 + */
  23 + private String ruleKey;
  24 +
  25 + /**
  26 + * 规则脚本key,存redis中的hash字典中的key名
  27 + */
  28 + private String scriptKey;
  29 +
  30 + /**
  31 + * 规则脚本内容
  32 + */
  33 + private String ruleScriptContent;
  34 +
  35 + /**
  36 + * 规则脚本入口方法名
  37 + */
  38 + private String scriptMethodName;
  39 +
  40 + /**
  41 + * 规则脚本入口方法返回类型
  42 + */
  43 + private String scriptMethodReturn;
  44 +
  45 + /**
  46 + * 规则描述
  47 + */
  48 + private String ruleDes;
  49 +
  50 + /**
  51 + * 规则状态,默认1启用,0弃用
  52 + */
  53 + private Boolean ruleState;
  54 +
  55 + /**
  56 + * 规则验证顺序
  57 + */
  58 + private Byte ruleOrder;
  59 +
  60 + /**
  61 + * 规则类型
  62 + */
  63 + private String ruleType;
  64 +
  65 + /**
  66 + * 数据创建时间
  67 + */
  68 + private Date creatTime;
  69 +
  70 + /**
  71 + * 更新时间
  72 + */
  73 + private Date updateTime;
  74 +
  75 + private static final long serialVersionUID = 1L;
  76 +}
  1 +package com.sy.service;
  2 +
  3 +import com.sy.model.GatherInfo;
  4 +import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
  5 +import com.sy.model.LandBusinessTypeList;
  6 +import org.basis.enhance.groovy.entity.ExecuteParams;
  7 +
  8 +import java.util.List;
  9 +
  10 +/**
  11 + * 调用groovy 引擎进行验放处理接口
  12 + * @author mrz
  13 + * @date 2023-05-23
  14 + */
  15 +public interface EnginCheckService {
  16 +
  17 + /**
  18 + * 根据gatherInfo报文数据获取整体验放数据,并进行脚本验放
  19 + * @param gatherInfo 车辆过卡X21报文数据
  20 + * @return true 验放成功 可以放行,false 验放失败不可放行
  21 + */
  22 + Boolean enginCheckByGatherInfo(GatherInfo gatherInfo,ExecuteParams executeParams);
  23 +
  24 + /**
  25 + * 过卡信息参数生成
  26 + * @param gatherInfo 过卡信息
  27 + * @return 过卡校验相关数据 为map格式
  28 + */
  29 + ExecuteParams makeParaByGagherInfo(GatherInfo gatherInfo);
  30 +
  31 + /**
  32 + * 发送X22指令
  33 + * @param info 过卡信息
  34 + * @param check true 抬杆,false 不抬杆
  35 + * @param reason 原因
  36 + * @param executeParams 所有过卡所需数据
  37 + * @return 调试模式 直接返回true,生产模式按业务走
  38 + */
  39 + void sendBw(GatherInfo info, boolean check, String reason, ExecuteParams executeParams);
  40 +
  41 + /**
  42 + * 直接放行
  43 + */
  44 + void pass(GatherInfo info,ExecuteParams executeParams);
  45 +
  46 + /**
  47 + * 记录已进出区信息
  48 + */
  49 + void record(GatherInfo info,ExecuteParams executeParams);
  50 +
  51 + /**
  52 + * 放行日志记录
  53 + * @param info 过卡信息
  54 + * @param check 是否放行true放行,false不放行
  55 + * @param reason 原因
  56 + */
  57 + void commandlog(GatherInfo info, boolean check, String reason,ExecuteParams executeParams);
  58 +
  59 +
  60 +
  61 +}
@@ -2,6 +2,7 @@ package com.sy.service; @@ -2,6 +2,7 @@ package com.sy.service;
2 2
3 3
4 import com.sy.model.Feign_Allocate_Search; 4 import com.sy.model.Feign_Allocate_Search;
  5 +import com.sy.model.NmmsPrepaidMasterSearch;
5 import com.sy.service.impl.NmmsServiceHystrix; 6 import com.sy.service.impl.NmmsServiceHystrix;
6 import org.springframework.cloud.openfeign.FeignClient; 7 import org.springframework.cloud.openfeign.FeignClient;
7 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
@@ -21,5 +22,10 @@ public interface NmmsService { @@ -21,5 +22,10 @@ public interface NmmsService {
21 @PostMapping(value = "/Allocate/querypage_inportallocate") 22 @PostMapping(value = "/Allocate/querypage_inportallocate")
22 Map getAllocate(@RequestBody Feign_Allocate_Search feignAllocateSearch); 23 Map getAllocate(@RequestBody Feign_Allocate_Search feignAllocateSearch);
23 24
  25 + @ResponseBody
  26 + @PostMapping(value = "/Preallocation/QueryPage_Prepared")
  27 + Map getPrepaidMaster(@RequestBody NmmsPrepaidMasterSearch prepaidMaster);
  28 +
24 29
25 } 30 }
  31 +
  1 +package com.sy.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONArray;
  4 +import com.sy.mapper.RuleChannelConfigDao;
  5 +import com.sy.model.*;
  6 +import com.sy.service.*;
  7 +import com.sy.socket.CommandClient;
  8 +import lombok.extern.slf4j.Slf4j;
  9 +import org.apache.commons.lang.StringUtils;
  10 +import org.basis.enhance.groovy.constants.ExecutionStatus;
  11 +import org.basis.enhance.groovy.entity.EngineExecutorResult;
  12 +import org.basis.enhance.groovy.entity.ExecuteParams;
  13 +import org.basis.enhance.groovy.entity.ScriptQuery;
  14 +import org.basis.enhance.groovy.executor.EngineExecutor;
  15 +import org.springframework.beans.factory.annotation.Autowired;
  16 +import org.springframework.beans.factory.annotation.Value;
  17 +import org.springframework.stereotype.Service;
  18 +
  19 +import javax.annotation.Resource;
  20 +import java.util.Arrays;
  21 +import java.util.Date;
  22 +import java.util.List;
  23 +import java.util.UUID;
  24 +
  25 +import static com.sy.service.impl.ResMessageServiceImpl.toStrArry;
  26 +
  27 +/**
  28 + * 车辆过卡脚本引擎处理
  29 + */
  30 +@Service
  31 +@Slf4j
  32 +public class EnginCheckServiceImpl implements EnginCheckService {
  33 +
  34 + private static String PERMITTHOUGH = "直接放行";
  35 +
  36 + @Autowired
  37 + private EngineExecutor engineExecutor;
  38 +
  39 + @Autowired
  40 + private BusnesslistinfoService busnesslistinfoService;
  41 +
  42 + @Autowired
  43 + private LandBusListService landBusListService;
  44 +
  45 + /**
  46 + * 指令日志表
  47 + */
  48 + @Autowired
  49 + private CommandLogService commandLogService;
  50 +
  51 + @Autowired
  52 + private RedisService redisService;
  53 +
  54 + @Autowired
  55 + private LandBusListService listService;
  56 +
  57 + @Autowired
  58 + LandRoadVeService veService;
  59 +
  60 + @Resource
  61 + RuleChannelConfigDao ruleChannelConfigDao;
  62 +
  63 + @Value("${devdebug}")
  64 + private Boolean debug;
  65 +
  66 +
  67 + @Override
  68 + public Boolean enginCheckByGatherInfo(GatherInfo gatherInfo,ExecuteParams executeParams) {
  69 +
  70 + //获取申请信息
  71 + LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
  72 + if (chanelFormInfo!=null){
  73 + //查询验放配置参数生成
  74 + RuleChannelConfig ruleChannelConfig = new RuleChannelConfig();
  75 + ruleChannelConfig.setBusinessType(chanelFormInfo.getBusinesstype());
  76 + ruleChannelConfig.setGoodsType(chanelFormInfo.getCocode());
  77 + ruleChannelConfig.setChannelNum(gatherInfo.getChnlno());
  78 + List<RuleChannelConfig> ruleChannelConfigs = ruleChannelConfigDao.selectByChannelAndBusiTypeAndGoodsType(ruleChannelConfig);
  79 +
  80 + for (int i = 0; i < ruleChannelConfigs.size(); i++) {
  81 + // 执行脚本中指定的方法 changeProduct
  82 + EngineExecutorResult executorResult = engineExecutor.execute(
  83 + ruleChannelConfigs.get(i).ruleConfig.getScriptMethodName(), new ScriptQuery(ruleChannelConfigs.get(i).ruleConfig.getScriptKey()), executeParams);
  84 + log.info("验证脚本名称:{},验证KEY-NAME:{}", ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey());
  85 + log.info("使用groovy脚本来验证过卡判定放行结果=========>>>>>>>>>>>执行结果:{}", executorResult);
  86 + if (executorResult.getExecutionStatus().equals(ExecutionStatus.SUCCESS)){
  87 + if (executorResult.getContext() instanceof Boolean){
  88 + Boolean execResult = (Boolean) executorResult.getContext();
  89 + if (execResult) {
  90 + log.info("验证脚本名称:{},验证KEY-NAME:{}-[验放成功]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey());
  91 + }else {
  92 + log.info("验放失败");
  93 + return false;
  94 + }
  95 + }
  96 +
  97 + //核销判定
  98 + if (executorResult.getContext()==null && "void".equals(ruleChannelConfigs.get(i).ruleConfig.getScriptMethodReturn())){
  99 + log.info("核销判定");
  100 + }
  101 + }else {
  102 + log.error("验证脚本名称:{},验证KEY-NAME:{}-[验放失败]",ruleChannelConfigs.get(i).ruleConfig.getRuleName(),ruleChannelConfigs.get(i).ruleConfig.getScriptKey());
  103 + return false;
  104 + }
  105 + }
  106 + return true;
  107 + }
  108 + log.error("未找到流转申请信息");
  109 + return false;
  110 + }
  111 +
  112 + @Override
  113 + public ExecuteParams makeParaByGagherInfo(GatherInfo gatherInfo){
  114 + ExecuteParams executeParams = new ExecuteParams();
  115 + //初始化
  116 + executeParams.put("GatherInfo", gatherInfo);
  117 + executeParams.put("FormList", null);
  118 + executeParams.put("ChanelFormInfo", null);
  119 + executeParams.put("ChanelFormBillLists", null);
  120 + executeParams.put("LandRoadVe", null);
  121 + executeParams.put("inAisleWT", 0.0);
  122 + executeParams.put("diffVal", 0.0);
  123 + executeParams.put("selfWt", 0.0);
  124 + executeParams.put("goodsWt", 0.0);
  125 +
  126 + //车辆备案信息
  127 + LandRoadVe ve = veService.selectByFrameNo(gatherInfo.getVename());
  128 + if (ve != null) {
  129 + //车辆备案重量
  130 + Double selfWt=Double.parseDouble(ve.getSelfWt());
  131 + executeParams.put("LandRoadVe", ve);
  132 + executeParams.put("selfWt", selfWt);
  133 + }
  134 +
  135 + //获取申请单表体
  136 + log.info("[FORM-CACHE-GET]:车辆-{}核碰缓存",gatherInfo.getVename());
  137 + String landBusinessJson = redisService.get(gatherInfo.getVename());
  138 + if (StringUtils.isNotEmpty(landBusinessJson)) {
  139 + //这个是申请单表体
  140 + List<LandBusinessTypeList> list = JSONArray.parseArray(landBusinessJson, LandBusinessTypeList.class);
  141 + executeParams.put("FormList", list);
  142 +
  143 + //通道对应申请信息
  144 + LandBusinessTypeList chanelFormInfo = landBusListService.getLandBusinessTypeListByGather(gatherInfo);
  145 + executeParams.put("ChanelFormInfo", chanelFormInfo);
  146 + if (chanelFormInfo!= null){
  147 + executeParams.put("goodsWt", Double.parseDouble(chanelFormInfo.getRemark()));
  148 + }
  149 +
  150 + //查询申请单运单列表
  151 + List<LAND_BUSINEESTYPE_LIST_INFO> chanelFormBillLists= busnesslistinfoService.selectmanilist(gatherInfo.getBarcode());
  152 + executeParams.put("ChanelFormBillLists", chanelFormBillLists);
  153 +
  154 + }
  155 +
  156 + //对应场站入场信息重量
  157 + if ("E".equals(gatherInfo.getIetype())){
  158 + List<LandBusinessTypeList> stationInChanleInfo= listService.selectwt(gatherInfo.getVename(),gatherInfo.getBarcode(),gatherInfo.getAreaid(),"I");
  159 + if (stationInChanleInfo.isEmpty()){
  160 + log.info("未查询到车辆:{}的入场信息",gatherInfo.getVename());
  161 + }else {
  162 + for(LandBusinessTypeList typeList:stationInChanleInfo){
  163 + if(typeList.getAislewt()!=null){
  164 + //对应场站进场过磅重量
  165 + Double inAisleWT = typeList.getAislewt();
  166 + executeParams.put("inAisleWT", inAisleWT);
  167 + //离场与入场重量差值
  168 + Double diffVal = inAisleWT- gatherInfo.getGrosswt().doubleValue();
  169 + executeParams.put("diffVal", diffVal);
  170 + }
  171 + }
  172 + //TODO:进场校验 增加 车辆备案重量要 <= 进场过磅重量 ,要有误差判定
  173 + }
  174 + }
  175 + return executeParams;
  176 + }
  177 +
  178 + /**
  179 + * 发送X22指令
  180 + * @param info 过卡信息
  181 + * @param check true 抬杆,false 不抬杆
  182 + * @param reason 原因
  183 + * 调试模式 直接返回true,生产模式按业务走
  184 + */
  185 + @Override
  186 + public void sendBw(GatherInfo info, boolean check, String reason,ExecuteParams executeParams) {
  187 + //调试模式 直接返回true
  188 + if (debug){
  189 + if (check) {
  190 + record(info,executeParams);
  191 + //总进出车次计数
  192 + redisService.incr("kako-total",1);
  193 + }
  194 + commandlog(info,check,reason,executeParams);
  195 + }
  196 +
  197 + log.info(String.format("开始发送指令:车牌%s,场站%s,通道%s,重量%s",info.getVename(),info.getAreaid(),info.getChnlno(),info.getGrosswt()));
  198 + boolean flag = false;
  199 + if (check) {
  200 + CommandClient.Client(info, PERMITTHOUGH);
  201 + log.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<==============");
  202 + flag = true;
  203 + record(info,executeParams);
  204 +
  205 + //总进出车次计数
  206 + redisService.incr("kako-total",1);
  207 + } else {
  208 + CommandClient.Client(info, reason);
  209 + log.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<==============");
  210 + }
  211 + commandlog(info,check,reason,executeParams);
  212 + }
  213 +
  214 + /**
  215 + * 直接放行
  216 + */
  217 + @Override
  218 + public void pass(GatherInfo info, ExecuteParams executeParams){
  219 + sendBw(info,true,PERMITTHOUGH,executeParams);
  220 + }
  221 +
  222 + /**
  223 + * 记录进出区信息
  224 + */
  225 + @Override
  226 + public void record(GatherInfo info, ExecuteParams executeParams){
  227 + LandBusinessTypeList landBusinessTypeList = executeParams.getValue("ChanelFormInfo");
  228 + Double goodsWt = executeParams.getValue("goodsWt");
  229 + Double selfWt = executeParams.getValue("selfWt");
  230 + Double diffVal = executeParams.getValue("diffVal");
  231 + if ("I".equals(info.getIetype())){
  232 + landBusinessTypeList.setAislewt(info.getGrosswt().doubleValue());
  233 + landBusinessTypeList.setUpdateDate(new Date());
  234 + landBusinessTypeList.setRemark(String.format("%.1f", goodsWt));
  235 + //车辆备案重量
  236 + landBusinessTypeList.setRemark2(String.valueOf(selfWt));
  237 + landBusinessTypeList.setContrastflag("已进站");
  238 + }else {
  239 + landBusinessTypeList.setAislewt(info.getGrosswt().doubleValue());
  240 + landBusinessTypeList.setUpdateDate(new Date());
  241 + //装载货物总重量
  242 + landBusinessTypeList.setRemark(String.format("%.1f", goodsWt));
  243 + //进出差值
  244 + landBusinessTypeList.setRemark1(String.format("%.1f", diffVal));
  245 + landBusinessTypeList.setRemark2(String.valueOf(selfWt));
  246 + landBusinessTypeList.setContrastflag("已出站");
  247 + }
  248 +
  249 + //todo:判定放行后,插入数据库,出入区记录
  250 + landBusinessTypeList.setId(UUID.randomUUID().toString());
  251 + landBusinessTypeList.setIsvalid("1");
  252 + //todo:这里SEQN也要入库
  253 + listService.saveList(landBusinessTypeList);
  254 + }
  255 +
  256 + /**
  257 + * 放行日志记录
  258 + * @param info
  259 + * @param check
  260 + * @param reason
  261 + */
  262 + @Override
  263 + public void commandlog(GatherInfo info, boolean check, String reason,ExecuteParams executeParams){
  264 + LandBusinessTypeList land = executeParams.getValue("ChanelFormInfo");
  265 + Double selfWt = executeParams.getValue("selfWt");
  266 + Double inWt = executeParams.getValue("inWt");
  267 + Double goodsWt = executeParams.getValue("goodsWt");
  268 + Double diffVal = executeParams.getValue("diffVal");
  269 + List<LAND_BUSINEESTYPE_LIST_INFO> listInfos = executeParams.getValue("ChanelFormBillLists");
  270 + String flag="",type="";
  271 + commandLog command=new commandLog();
  272 + command.setId(UUID.randomUUID().toString());
  273 + command.setBarcode(info.getBarcode());
  274 +
  275 + if(land!=null){
  276 + command.setBarcode(land.getBarcode());
  277 + command.setBusnessType(land.getBusinesstype());
  278 + }
  279 + command.setAreaId(info.getAreaid());
  280 + command.setChnlNo(info.getChnlno());
  281 + if (check){
  282 + flag = "00";
  283 + } else{
  284 + flag = "11";
  285 + }
  286 + if("I".equals(info.getIetype())){
  287 + type="000000200000000000";
  288 + }else{
  289 + type="000000100000000000";
  290 + }
  291 + command.setReasonCode(flag+type);
  292 + command.setReasonText(reason);
  293 + command.setVeName(info.getVename());
  294 + command.setVeWeight(selfWt);
  295 + command.setIeType(info.getIetype());
  296 + command.setExitGrossWeight(info.getGrosswt().doubleValue());
  297 + command.setInGrossWeight(inWt);
  298 + command.setGoodsWeight(goodsWt);
  299 + command.setActualGoodsWeight(diffVal);
  300 + if(listInfos !=null && listInfos.size()>0){
  301 + command.setMasterList(Arrays.toString(toStrArry(listInfos)));
  302 + }
  303 + commandLogService.insert(command);
  304 + }
  305 +}
1 package com.sy.service.impl; 1 package com.sy.service.impl;
2 2
3 import com.sy.model.Feign_Allocate_Search; 3 import com.sy.model.Feign_Allocate_Search;
  4 +import com.sy.model.NmmsPrepaidMasterSearch;
4 import com.sy.service.NmmsService; 5 import com.sy.service.NmmsService;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
@@ -18,4 +19,10 @@ public class NmmsServiceHystrix implements NmmsService { @@ -18,4 +19,10 @@ public class NmmsServiceHystrix implements NmmsService {
18 logger.error("feign查询分拨申请数据失败,{}",feignAllocateSearch.waybill); 19 logger.error("feign查询分拨申请数据失败,{}",feignAllocateSearch.waybill);
19 return new HashMap<>(); 20 return new HashMap<>();
20 } 21 }
  22 +
  23 + @Override
  24 + public Map<String, Object> getPrepaidMaster(NmmsPrepaidMasterSearch nmmsPrepaidMasterSearch) {
  25 + logger.error("feign查询预配数据失败,{}",nmmsPrepaidMasterSearch.waybillno);
  26 + return new HashMap<>();
  27 + }
21 } 28 }
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sy.mapper.RuleChannelConfigDao">
  4 + <resultMap id="BaseResultMap" type="com.sy.model.RuleChannelConfig">
  5 + <id column="config_id" jdbcType="INTEGER" property="configId" />
  6 + <result column="channel_num" jdbcType="VARCHAR" property="channelNum" />
  7 + <result column="business_type" jdbcType="VARCHAR" property="businessType" />
  8 + <result column="goods_type" jdbcType="VARCHAR" property="goodsType" />
  9 + <result column="rule_id" jdbcType="INTEGER" property="ruleId" />
  10 + <result column="config_order" jdbcType="TINYINT" property="configOrder" />
  11 + <result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
  12 + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  13 + </resultMap>
  14 + <resultMap id="WithRuleConf" extends="BaseResultMap" type="com.sy.model.RuleChannelConfig">
  15 + <association property="ruleConfig" javaType="com.sy.model.RuleConfig">
  16 + <result column="script_key" jdbcType="VARCHAR" property="scriptKey" />
  17 + <result column="script_method_name" jdbcType="VARCHAR" property="scriptMethodName" />
  18 + <result column="script_method_return" jdbcType="VARCHAR" property="scriptMethodReturn" />
  19 + <result column="rule_name" jdbcType="VARCHAR" property="ruleName" />
  20 + </association>
  21 + </resultMap>
  22 + <sql id="Base_Column_List">
  23 + config_id, channel_num, business_type, goods_type, rule_id, config_order, creat_time,
  24 + update_time
  25 + </sql>
  26 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  27 + select
  28 + <include refid="Base_Column_List" />
  29 + from rule_channel_config
  30 + where config_id = #{configId,jdbcType=INTEGER}
  31 + </select>
  32 + <select id="selectByChannelAndBusiTypeAndGoodsType" parameterType="com.sy.model.RuleChannelConfig" resultMap="WithRuleConf">
  33 + SELECT
  34 + conf.channel_num,
  35 + conf.business_type,
  36 + conf.goods_type,
  37 + conf.config_order,
  38 + conf.rule_id,
  39 + rule.script_key,
  40 + rule.script_method_name,
  41 + rule.script_method_return,
  42 + rule.rule_name
  43 + FROM
  44 + (
  45 + SELECT
  46 + channel_num,
  47 + business_type,
  48 + goods_type,
  49 + config_order,
  50 + rule_id
  51 + FROM
  52 + rule_channel_config
  53 + WHERE
  54 + channel_num = #{channelNum,jdbcType=VARCHAR}
  55 + AND business_type = #{businessType,jdbcType=VARCHAR}
  56 + AND goods_type = #{goodsType,jdbcType=VARCHAR}
  57 + ORDER BY config_order
  58 + ) conf
  59 + LEFT JOIN
  60 + rule_config rule
  61 + ON
  62 + conf.rule_id = rule.rule_id
  63 + </select>
  64 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  65 + delete from rule_channel_config
  66 + where config_id = #{configId,jdbcType=INTEGER}
  67 + </delete>
  68 + <insert id="insert" keyColumn="config_id" keyProperty="configId" parameterType="com.sy.model.RuleChannelConfig" useGeneratedKeys="true">
  69 + insert into rule_channel_config (channel_num, business_type, goods_type,
  70 + rule_id, config_order, creat_time,
  71 + update_time)
  72 + values (#{channelNum,jdbcType=VARCHAR}, #{businessType,jdbcType=VARCHAR}, #{goodsType,jdbcType=VARCHAR},
  73 + #{ruleId,jdbcType=INTEGER}, #{configOrder,jdbcType=TINYINT}, #{creatTime,jdbcType=TIMESTAMP},
  74 + #{updateTime,jdbcType=TIMESTAMP})
  75 + </insert>
  76 + <insert id="insertSelective" keyColumn="config_id" keyProperty="configId" parameterType="com.sy.model.RuleChannelConfig" useGeneratedKeys="true">
  77 + insert into rule_channel_config
  78 + <trim prefix="(" suffix=")" suffixOverrides=",">
  79 + <if test="channelNum != null">
  80 + channel_num,
  81 + </if>
  82 + <if test="businessType != null">
  83 + business_type,
  84 + </if>
  85 + <if test="goodsType != null">
  86 + goods_type,
  87 + </if>
  88 + <if test="ruleId != null">
  89 + rule_id,
  90 + </if>
  91 + <if test="configOrder != null">
  92 + config_order,
  93 + </if>
  94 + <if test="creatTime != null">
  95 + creat_time,
  96 + </if>
  97 + <if test="updateTime != null">
  98 + update_time,
  99 + </if>
  100 + </trim>
  101 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  102 + <if test="channelNum != null">
  103 + #{channelNum,jdbcType=VARCHAR},
  104 + </if>
  105 + <if test="businessType != null">
  106 + #{businessType,jdbcType=VARCHAR},
  107 + </if>
  108 + <if test="goodsType != null">
  109 + #{goodsType,jdbcType=VARCHAR},
  110 + </if>
  111 + <if test="ruleId != null">
  112 + #{ruleId,jdbcType=INTEGER},
  113 + </if>
  114 + <if test="configOrder != null">
  115 + #{configOrder,jdbcType=TINYINT},
  116 + </if>
  117 + <if test="creatTime != null">
  118 + #{creatTime,jdbcType=TIMESTAMP},
  119 + </if>
  120 + <if test="updateTime != null">
  121 + #{updateTime,jdbcType=TIMESTAMP},
  122 + </if>
  123 + </trim>
  124 + </insert>
  125 + <update id="updateByPrimaryKeySelective" parameterType="com.sy.model.RuleChannelConfig">
  126 + update rule_channel_config
  127 + <set>
  128 + <if test="channelNum != null">
  129 + channel_num = #{channelNum,jdbcType=VARCHAR},
  130 + </if>
  131 + <if test="businessType != null">
  132 + business_type = #{businessType,jdbcType=VARCHAR},
  133 + </if>
  134 + <if test="goodsType != null">
  135 + goods_type = #{goodsType,jdbcType=VARCHAR},
  136 + </if>
  137 + <if test="ruleId != null">
  138 + rule_id = #{ruleId,jdbcType=INTEGER},
  139 + </if>
  140 + <if test="configOrder != null">
  141 + config_order = #{configOrder,jdbcType=TINYINT},
  142 + </if>
  143 + <if test="creatTime != null">
  144 + creat_time = #{creatTime,jdbcType=TIMESTAMP},
  145 + </if>
  146 + <if test="updateTime != null">
  147 + update_time = #{updateTime,jdbcType=TIMESTAMP},
  148 + </if>
  149 + </set>
  150 + where config_id = #{configId,jdbcType=INTEGER}
  151 + </update>
  152 + <update id="updateByPrimaryKey" parameterType="com.sy.model.RuleChannelConfig">
  153 + update rule_channel_config
  154 + set channel_num = #{channelNum,jdbcType=VARCHAR},
  155 + business_type = #{businessType,jdbcType=VARCHAR},
  156 + goods_type = #{goodsType,jdbcType=VARCHAR},
  157 + rule_id = #{ruleId,jdbcType=INTEGER},
  158 + config_order = #{configOrder,jdbcType=TINYINT},
  159 + creat_time = #{creatTime,jdbcType=TIMESTAMP},
  160 + update_time = #{updateTime,jdbcType=TIMESTAMP}
  161 + where config_id = #{configId,jdbcType=INTEGER}
  162 + </update>
  163 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.sy.mapper.RuleConfigDao">
  4 + <resultMap id="BaseResultMap" type="com.sy.model.RuleConfig">
  5 + <id column="rule_id" jdbcType="INTEGER" property="ruleId" />
  6 + <result column="rule_name" jdbcType="VARCHAR" property="ruleName" />
  7 + <result column="rule_key" jdbcType="VARCHAR" property="ruleKey" />
  8 + <result column="script_key" jdbcType="VARCHAR" property="scriptKey" />
  9 + <result column="rule_script_content" jdbcType="VARCHAR" property="ruleScriptContent" />
  10 + <result column="script_method_name" jdbcType="VARCHAR" property="scriptMethodName" />
  11 + <result column="script_method_return" jdbcType="VARCHAR" property="scriptMethodReturn" />
  12 + <result column="rule_des" jdbcType="VARCHAR" property="ruleDes" />
  13 + <result column="rule_state" jdbcType="BOOLEAN" property="ruleState" />
  14 + <result column="rule_order" jdbcType="TINYINT" property="ruleOrder" />
  15 + <result column="rule_type" jdbcType="VARCHAR" property="ruleType" />
  16 + <result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
  17 + <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  18 + </resultMap>
  19 + <sql id="Base_Column_List">
  20 + rule_id, rule_name, rule_key, script_key, rule_script_content, script_method_name,
  21 + script_method_return, rule_des, rule_state, rule_order, rule_type, creat_time, update_time
  22 + </sql>
  23 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  24 + select
  25 + <include refid="Base_Column_List" />
  26 + from rule_config
  27 + where rule_id = #{ruleId,jdbcType=INTEGER}
  28 + </select>
  29 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  30 + delete from rule_config
  31 + where rule_id = #{ruleId,jdbcType=INTEGER}
  32 + </delete>
  33 + <insert id="insert" keyColumn="rule_id" keyProperty="ruleId" parameterType="com.sy.model.RuleConfig" useGeneratedKeys="true">
  34 + insert into rule_config (rule_name, rule_key, script_key,
  35 + rule_script_content, script_method_name, script_method_return,
  36 + rule_des, rule_state, rule_order,
  37 + rule_type, creat_time, update_time
  38 + )
  39 + values (#{ruleName,jdbcType=VARCHAR}, #{ruleKey,jdbcType=VARCHAR}, #{scriptKey,jdbcType=VARCHAR},
  40 + #{ruleScriptContent,jdbcType=VARCHAR}, #{scriptMethodName,jdbcType=VARCHAR}, #{scriptMethodReturn,jdbcType=VARCHAR},
  41 + #{ruleDes,jdbcType=VARCHAR}, #{ruleState,jdbcType=BOOLEAN}, #{ruleOrder,jdbcType=TINYINT},
  42 + #{ruleType,jdbcType=VARCHAR}, #{creatTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
  43 + )
  44 + </insert>
  45 + <insert id="insertSelective" keyColumn="rule_id" keyProperty="ruleId" parameterType="com.sy.model.RuleConfig" useGeneratedKeys="true">
  46 + insert into rule_config
  47 + <trim prefix="(" suffix=")" suffixOverrides=",">
  48 + <if test="ruleName != null">
  49 + rule_name,
  50 + </if>
  51 + <if test="ruleKey != null">
  52 + rule_key,
  53 + </if>
  54 + <if test="scriptKey != null">
  55 + script_key,
  56 + </if>
  57 + <if test="ruleScriptContent != null">
  58 + rule_script_content,
  59 + </if>
  60 + <if test="scriptMethodName != null">
  61 + script_method_name,
  62 + </if>
  63 + <if test="scriptMethodReturn != null">
  64 + script_method_return,
  65 + </if>
  66 + <if test="ruleDes != null">
  67 + rule_des,
  68 + </if>
  69 + <if test="ruleState != null">
  70 + rule_state,
  71 + </if>
  72 + <if test="ruleOrder != null">
  73 + rule_order,
  74 + </if>
  75 + <if test="ruleType != null">
  76 + rule_type,
  77 + </if>
  78 + <if test="creatTime != null">
  79 + creat_time,
  80 + </if>
  81 + <if test="updateTime != null">
  82 + update_time,
  83 + </if>
  84 + </trim>
  85 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  86 + <if test="ruleName != null">
  87 + #{ruleName,jdbcType=VARCHAR},
  88 + </if>
  89 + <if test="ruleKey != null">
  90 + #{ruleKey,jdbcType=VARCHAR},
  91 + </if>
  92 + <if test="scriptKey != null">
  93 + #{scriptKey,jdbcType=VARCHAR},
  94 + </if>
  95 + <if test="ruleScriptContent != null">
  96 + #{ruleScriptContent,jdbcType=VARCHAR},
  97 + </if>
  98 + <if test="scriptMethodName != null">
  99 + #{scriptMethodName,jdbcType=VARCHAR},
  100 + </if>
  101 + <if test="scriptMethodReturn != null">
  102 + #{scriptMethodReturn,jdbcType=VARCHAR},
  103 + </if>
  104 + <if test="ruleDes != null">
  105 + #{ruleDes,jdbcType=VARCHAR},
  106 + </if>
  107 + <if test="ruleState != null">
  108 + #{ruleState,jdbcType=BOOLEAN},
  109 + </if>
  110 + <if test="ruleOrder != null">
  111 + #{ruleOrder,jdbcType=TINYINT},
  112 + </if>
  113 + <if test="ruleType != null">
  114 + #{ruleType,jdbcType=VARCHAR},
  115 + </if>
  116 + <if test="creatTime != null">
  117 + #{creatTime,jdbcType=TIMESTAMP},
  118 + </if>
  119 + <if test="updateTime != null">
  120 + #{updateTime,jdbcType=TIMESTAMP},
  121 + </if>
  122 + </trim>
  123 + </insert>
  124 + <update id="updateByPrimaryKeySelective" parameterType="com.sy.model.RuleConfig">
  125 + update rule_config
  126 + <set>
  127 + <if test="ruleName != null">
  128 + rule_name = #{ruleName,jdbcType=VARCHAR},
  129 + </if>
  130 + <if test="ruleKey != null">
  131 + rule_key = #{ruleKey,jdbcType=VARCHAR},
  132 + </if>
  133 + <if test="scriptKey != null">
  134 + script_key = #{scriptKey,jdbcType=VARCHAR},
  135 + </if>
  136 + <if test="ruleScriptContent != null">
  137 + rule_script_content = #{ruleScriptContent,jdbcType=VARCHAR},
  138 + </if>
  139 + <if test="scriptMethodName != null">
  140 + script_method_name = #{scriptMethodName,jdbcType=VARCHAR},
  141 + </if>
  142 + <if test="scriptMethodReturn != null">
  143 + script_method_return = #{scriptMethodReturn,jdbcType=VARCHAR},
  144 + </if>
  145 + <if test="ruleDes != null">
  146 + rule_des = #{ruleDes,jdbcType=VARCHAR},
  147 + </if>
  148 + <if test="ruleState != null">
  149 + rule_state = #{ruleState,jdbcType=BOOLEAN},
  150 + </if>
  151 + <if test="ruleOrder != null">
  152 + rule_order = #{ruleOrder,jdbcType=TINYINT},
  153 + </if>
  154 + <if test="ruleType != null">
  155 + rule_type = #{ruleType,jdbcType=VARCHAR},
  156 + </if>
  157 + <if test="creatTime != null">
  158 + creat_time = #{creatTime,jdbcType=TIMESTAMP},
  159 + </if>
  160 + <if test="updateTime != null">
  161 + update_time = #{updateTime,jdbcType=TIMESTAMP},
  162 + </if>
  163 + </set>
  164 + where rule_id = #{ruleId,jdbcType=INTEGER}
  165 + </update>
  166 + <update id="updateByPrimaryKey" parameterType="com.sy.model.RuleConfig">
  167 + update rule_config
  168 + set rule_name = #{ruleName,jdbcType=VARCHAR},
  169 + rule_key = #{ruleKey,jdbcType=VARCHAR},
  170 + script_key = #{scriptKey,jdbcType=VARCHAR},
  171 + rule_script_content = #{ruleScriptContent,jdbcType=VARCHAR},
  172 + script_method_name = #{scriptMethodName,jdbcType=VARCHAR},
  173 + script_method_return = #{scriptMethodReturn,jdbcType=VARCHAR},
  174 + rule_des = #{ruleDes,jdbcType=VARCHAR},
  175 + rule_state = #{ruleState,jdbcType=BOOLEAN},
  176 + rule_order = #{ruleOrder,jdbcType=TINYINT},
  177 + rule_type = #{ruleType,jdbcType=VARCHAR},
  178 + creat_time = #{creatTime,jdbcType=TIMESTAMP},
  179 + update_time = #{updateTime,jdbcType=TIMESTAMP}
  180 + where rule_id = #{ruleId,jdbcType=INTEGER}
  181 + </update>
  182 +</mapper>
@@ -5,10 +5,7 @@ import com.sy.model.GatherInfo; @@ -5,10 +5,7 @@ import com.sy.model.GatherInfo;
5 import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO; 5 import com.sy.model.LAND_BUSINEESTYPE_LIST_INFO;
6 import com.sy.model.LandBusinessTypeList; 6 import com.sy.model.LandBusinessTypeList;
7 import com.sy.model.LandRoadVe; 7 import com.sy.model.LandRoadVe;
8 -import com.sy.service.BusnesslistinfoService;  
9 -import com.sy.service.LandBusListService;  
10 -import com.sy.service.LandRoadVeService;  
11 -import com.sy.service.RedisService; 8 +import com.sy.service.*;
12 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
13 import org.apache.commons.lang.StringUtils; 10 import org.apache.commons.lang.StringUtils;
14 import org.basis.enhance.groovy.entity.EngineExecutorResult; 11 import org.basis.enhance.groovy.entity.EngineExecutorResult;
@@ -53,6 +50,9 @@ public class EnginTest { @@ -53,6 +50,9 @@ public class EnginTest {
53 @Autowired 50 @Autowired
54 LandRoadVeService veService; 51 LandRoadVeService veService;
55 52
  53 + @Autowired
  54 + EnginCheckService enginCheckService;
  55 +
56 56
57 57
58 /** 58 /**
@@ -71,7 +71,7 @@ public class EnginTest { @@ -71,7 +71,7 @@ public class EnginTest {
71 ExecuteParams executeParams = new ExecuteParams(); 71 ExecuteParams executeParams = new ExecuteParams();
72 //初始化 72 //初始化
73 executeParams.put("gatherInfo", gatherInfo); 73 executeParams.put("gatherInfo", gatherInfo);
74 - executeParams.put("formList", null); 74 + executeParams.put("FormList", null);
75 executeParams.put("ChanelFormInfo", null); 75 executeParams.put("ChanelFormInfo", null);
76 executeParams.put("ChanelFormBillLists", null); 76 executeParams.put("ChanelFormBillLists", null);
77 executeParams.put("LandRoadVe", null); 77 executeParams.put("LandRoadVe", null);
@@ -95,7 +95,7 @@ public class EnginTest { @@ -95,7 +95,7 @@ public class EnginTest {
95 if (StringUtils.isNotEmpty(landBusinessJson)) { 95 if (StringUtils.isNotEmpty(landBusinessJson)) {
96 //这个是申请单表体 96 //这个是申请单表体
97 List<LandBusinessTypeList> list = JSONArray.parseArray(landBusinessJson, LandBusinessTypeList.class); 97 List<LandBusinessTypeList> list = JSONArray.parseArray(landBusinessJson, LandBusinessTypeList.class);
98 - executeParams.put("formList", list); 98 + executeParams.put("FormList", list);
99 99
100 //通道对应申请信息 100 //通道对应申请信息
101 LandBusinessTypeList chanelFormInfo = landBusListService.getLandBusinessTypeListByGather(gatherInfo); 101 LandBusinessTypeList chanelFormInfo = landBusListService.getLandBusinessTypeListByGather(gatherInfo);
@@ -198,4 +198,24 @@ public class EnginTest { @@ -198,4 +198,24 @@ public class EnginTest {
198 log.info("共插入{}条规则",i); 198 log.info("共插入{}条规则",i);
199 } 199 }
200 200
  201 + @Test
  202 + public void enginTest(){
  203 + GatherInfo gatherInfo = new GatherInfo();
  204 + gatherInfo.setAreaid("4604600000");
  205 + gatherInfo.setChnlno("4604600010");
  206 + gatherInfo.setBarcode("681-43e2-925c-7b1e1054fbef");
  207 + gatherInfo.setGrosswt(new BigDecimal("6000"));
  208 + gatherInfo.setSeqno("20220630184441000028");
  209 + gatherInfo.setIetype("I");
  210 + gatherInfo.setVename("豫A61CR7");
  211 +
  212 + ExecuteParams executeParams = enginCheckService.makeParaByGagherInfo(gatherInfo);
  213 + Boolean check = enginCheckService.enginCheckByGatherInfo(gatherInfo,executeParams);
  214 + if (check){
  215 + log.info("脚本验放测试通过");
  216 + enginCheckService.pass(gatherInfo,executeParams);
  217 + }else {
  218 + log.error("脚本验放测试失败");
  219 + }
  220 + }
201 } 221 }
  1 +package com.sy.nmms;
  2 +
  3 +
  4 +import com.sy.model.Feign_Allocate_Search;
  5 +import com.sy.model.NmmsPrepaidMasterSearch;
  6 +import com.sy.service.NmmsService;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.junit.Test;
  9 +import org.junit.runner.RunWith;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.boot.test.context.SpringBootTest;
  12 +import org.springframework.test.context.junit4.SpringRunner;
  13 +
  14 +import javax.validation.constraints.NotNull;
  15 +import java.util.Map;
  16 +
  17 +
  18 +@RunWith(SpringRunner.class)
  19 +@SpringBootTest
  20 +@Slf4j
  21 +public class NmmsTest {
  22 +
  23 + @Autowired
  24 + NmmsService nmmsService;
  25 +
  26 + void nmmsAllocate(@NotNull String waybill){
  27 + log.info("新舱单查询分拨申请数据开始");
  28 + Feign_Allocate_Search feignAllocateSearch = new Feign_Allocate_Search(waybill,0,10);
  29 + Map map = nmmsService.getAllocate(feignAllocateSearch);
  30 + log.info(""+map);
  31 + }
  32 +
  33 +
  34 +
  35 + @Test
  36 + public void prepaid(){
  37 + log.info("新舱单查询预配主单数据开始");
  38 + NmmsPrepaidMasterSearch nmmsPrepaidMasterSearch = new NmmsPrepaidMasterSearch("994-67007802",0,100);
  39 + Map map = nmmsService.getPrepaidMaster(nmmsPrepaidMasterSearch);
  40 + log.info(""+map);
  41 + }
  42 +}