作者 朱兆平

关锁业务生产第一环节完结

@@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody; @@ -17,6 +17,8 @@ import org.springframework.web.bind.annotation.RequestBody;
17 import org.springframework.web.bind.annotation.RequestMapping; 17 import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.RestController; 18 import org.springframework.web.bind.annotation.RestController;
19 19
  20 +import java.math.BigDecimal;
  21 +
20 @RestController 22 @RestController
21 @RequestMapping("/lock") 23 @RequestMapping("/lock")
22 @Slf4j 24 @Slf4j
@@ -37,10 +39,10 @@ public class CustomsLockController { @@ -37,10 +39,10 @@ public class CustomsLockController {
37 39
38 log.info("收到关锁通知"); 40 log.info("收到关锁通知");
39 StringBuilder sb = new StringBuilder(); 41 StringBuilder sb = new StringBuilder();
40 - sb.append("施解封时间:").append(feedBack.locktime).append("\n")  
41 - .append("关锁秘钥:").append(feedBack.secret).append("\n")  
42 - .append("施解封内容:").append(feedBack.feedbackconten).append("\n")  
43 - .append("施解封状态:").append(feedBack.feedbackcode).append("\n"); 42 +// sb.append("施解封时间:").append(feedBack.locktime).append("\n")
  43 +// .append("关锁秘钥:").append(feedBack.secret).append("\n")
  44 +// .append("施解封内容:").append(feedBack.feedbackconten).append("\n")
  45 +// .append("施解封状态:").append(feedBack.feedbackcode).append("\n");
44 46
45 String LOCK_TYPE_UNLOCK = "2"; 47 String LOCK_TYPE_UNLOCK = "2";
46 /** 48 /**
@@ -77,13 +79,16 @@ public class CustomsLockController { @@ -77,13 +79,16 @@ public class CustomsLockController {
77 sb.append("关锁缓存信息读取失败"); 79 sb.append("关锁缓存信息读取失败");
78 gatherInfo = new GatherInfo(); 80 gatherInfo = new GatherInfo();
79 gatherInfo.setBarcode(feedBack.barcode); 81 gatherInfo.setBarcode(feedBack.barcode);
  82 + gatherInfo.setGrosswt(new BigDecimal(0));
80 commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0); 83 commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0);
81 log.info("[LOCK-RSP]-关锁缓存信息读取失败"); 84 log.info("[LOCK-RSP]-关锁缓存信息读取失败");
82 } 85 }
83 }else { 86 }else {
84 - sb.append("关锁缓存信息读取失败"); 87 + sb.append("关锁施解封失败");
85 GatherInfo gatherInfo = new GatherInfo(); 88 GatherInfo gatherInfo = new GatherInfo();
86 gatherInfo.setBarcode(feedBack.barcode); 89 gatherInfo.setBarcode(feedBack.barcode);
  90 + gatherInfo.setGrosswt(new BigDecimal(0));
  91 +
87 commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0); 92 commandLogService.commandlog(gatherInfo,false,sb.toString(),null,null,0.0,0.0,0.0,0.0);
88 log.info("[LOCK-RSP]-关锁施解封失败"); 93 log.info("[LOCK-RSP]-关锁施解封失败");
89 } 94 }
@@ -27,4 +27,12 @@ public interface RedisService { @@ -27,4 +27,12 @@ public interface RedisService {
27 * @return 27 * @return
28 */ 28 */
29 boolean set(String key,String value,long time); 29 boolean set(String key,String value,long time);
  30 +
  31 + /**
  32 + * 计数
  33 + * @param key key
  34 + * @param delta 步进值
  35 + * @return 返回总数
  36 + */
  37 + long incr(String key, long delta);
30 } 38 }
@@ -634,6 +634,10 @@ public class GatherInfoHandle implements GatherInfoService { @@ -634,6 +634,10 @@ public class GatherInfoHandle implements GatherInfoService {
634 List<LandBusinessTypeList> r = landBusinessTypeListList.stream().filter(item ->{ 634 List<LandBusinessTypeList> r = landBusinessTypeListList.stream().filter(item ->{
635 //判断还有没有没有出区的场站,还有没有出区的场站就不核销 635 //判断还有没有没有出区的场站,还有没有出区的场站就不核销
636 log.debug("[releaseFormCheck-Stream-loop]-缓存与已出核碰,缓存元素场站:[{}],已出记录场站:[{}]",item.getEndstation(),businessTypeList.getEndstation()); 636 log.debug("[releaseFormCheck-Stream-loop]-缓存与已出核碰,缓存元素场站:[{}],已出记录场站:[{}]",item.getEndstation(),businessTypeList.getEndstation());
  637 + //解决缓存那里存储有不一样的把人错的的有问题的点,二维码不一致也把缓存删除
  638 + if (!item.getBarcode().equals(businessTypeList.getBarcode())){
  639 + return true;
  640 + }
637 if(item.getEndstation().equals(businessTypeList.getEndstation())) { 641 if(item.getEndstation().equals(businessTypeList.getEndstation())) {
638 log.info("[releaseFormCheck-Stream-loop]-缓存元素场站:[{}],已出记录场站:[{}]-核销判定对碰成功",item.getEndstation(),businessTypeList.getEndstation()); 642 log.info("[releaseFormCheck-Stream-loop]-缓存元素场站:[{}],已出记录场站:[{}]-核销判定对碰成功",item.getEndstation(),businessTypeList.getEndstation());
639 return true; 643 return true;
@@ -692,6 +696,9 @@ public class GatherInfoHandle implements GatherInfoService { @@ -692,6 +696,9 @@ public class GatherInfoHandle implements GatherInfoService {
692 log.info("[流转缓存]-{}缓存已核销",vaName); 696 log.info("[流转缓存]-{}缓存已核销",vaName);
693 //核销记录 697 //核销记录
694 releaseRecord(); 698 releaseRecord();
  699 +
  700 + //总业务车次计数
  701 + gatherInfoHandle.redisService.incr("kako-barcode-total",1);
695 } 702 }
696 703
697 /** 704 /**
@@ -712,6 +719,8 @@ public class GatherInfoHandle implements GatherInfoService { @@ -712,6 +719,8 @@ public class GatherInfoHandle implements GatherInfoService {
712 if (gatherInfoHandle.debug){ 719 if (gatherInfoHandle.debug){
713 if (check) { 720 if (check) {
714 record(); 721 record();
  722 + //总进出车次计数
  723 + gatherInfoHandle.redisService.incr("kako-total",1);
715 } 724 }
716 commandlog(info,check,reason,land,list_infos); 725 commandlog(info,check,reason,land,list_infos);
717 return check; 726 return check;
@@ -724,6 +733,9 @@ public class GatherInfoHandle implements GatherInfoService { @@ -724,6 +733,9 @@ public class GatherInfoHandle implements GatherInfoService {
724 log.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<=============="); 733 log.info("=============>>>>>>>>放行报文发送成功<<<<<<<<<==============");
725 flag = true; 734 flag = true;
726 record(); 735 record();
  736 +
  737 + //总进出车次计数
  738 + gatherInfoHandle.redisService.incr("kako-total",1);
727 } else { 739 } else {
728 CommandClient.Client(info, reason); 740 CommandClient.Client(info, reason);
729 log.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<=============="); 741 log.info("=============>>>>>>>>重量异常报文发送成功<<<<<<<<<==============");
@@ -165,6 +165,7 @@ public class RedisServiceImpl implements RedisService { @@ -165,6 +165,7 @@ public class RedisServiceImpl implements RedisService {
165 * @param delta 要增加几(大于0) 165 * @param delta 要增加几(大于0)
166 * @return 166 * @return
167 */ 167 */
  168 + @Override
168 public long incr(String key, long delta){ 169 public long incr(String key, long delta){
169 if(delta<0){ 170 if(delta<0){
170 throw new RuntimeException("递增因子必须大于0"); 171 throw new RuntimeException("递增因子必须大于0");
@@ -89,19 +89,33 @@ public class CustomsLockServiceImpl implements CustomsLockService { @@ -89,19 +89,33 @@ public class CustomsLockServiceImpl implements CustomsLockService {
89 LandBusinessTypeList landBusinessTypeList = landBusListService.getLandBusinessTypeListByGather(info); 89 LandBusinessTypeList landBusinessTypeList = landBusListService.getLandBusinessTypeListByGather(info);
90 if (landBusinessTypeList!=null){ 90 if (landBusinessTypeList!=null){
91 if ("调拨业务".equals(landBusinessTypeList.getBusinesstype()) || "分拨业务".equals(landBusinessTypeList.getBusinesstype())) { 91 if ("调拨业务".equals(landBusinessTypeList.getBusinesstype()) || "分拨业务".equals(landBusinessTypeList.getBusinesstype())) {
92 - //综保区场站及内三不通知,顺丰场站不通知 92 +
93 String sfAreaid = "4600541001"; 93 String sfAreaid = "4600541001";
94 - if ("4600329012".equals(landBusinessTypeList.getEndstation())  
95 - || "4612199001".equals(landBusinessTypeList.getEndstation())  
96 - || sfAreaid.equals(landBusinessTypeList.getEndstation())  
97 - ) {  
98 - log.info("[LOCK-CHECK]-综保区及内三场站,顺丰场站,不处理关锁业务,当前场站:{}",landBusinessTypeList.getEndstation());  
99 - return false;  
100 - }else {  
101 - return true;  
102 - /**  
103 - * 单证验证-取消  
104 - */ 94 + String zbqAreaid = "4600329012";
  95 + String zbqN3Areaid = "4612199001";
  96 +
  97 +
  98 + String carEndstationList = redisService.get(info.getVename() + "_endstationList");
  99 + if (StringUtils.isNotEmpty(info.getVename()) && StringUtils.isNotEmpty(carEndstationList)){
  100 +
  101 + //涉及综保区场站的申请不核验关锁业务.
  102 + if (carEndstationList.contains(zbqAreaid)) {
  103 + log.info("[LOCK-CHECK]-申报场站列表包含综保区,不处理关锁业务,当前场站:{}",landBusinessTypeList.getEndstation());
  104 + return false;
  105 + }
  106 +
  107 + //综保区场站及内三不通知,顺丰场站不通知
  108 + if (zbqAreaid.equals(landBusinessTypeList.getEndstation())
  109 + || zbqN3Areaid.equals(landBusinessTypeList.getEndstation())
  110 + || sfAreaid.equals(landBusinessTypeList.getEndstation())
  111 + ) {
  112 + log.info("[LOCK-CHECK]-综保区及内三场站,顺丰场站,不处理关锁业务,当前场站:{}",landBusinessTypeList.getEndstation());
  113 + return false;
  114 + }else {
  115 + return true;
  116 + /**
  117 + * 单证验证-取消
  118 + */
105 // List<LAND_BUSINEESTYPE_LIST_INFO> land_busineestype_list_infos = landBusinessTypeList.getLandBusineestypeListInfoList(); 119 // List<LAND_BUSINEESTYPE_LIST_INFO> land_busineestype_list_infos = landBusinessTypeList.getLandBusineestypeListInfoList();
106 // if (!land_busineestype_list_infos.isEmpty()){ 120 // if (!land_busineestype_list_infos.isEmpty()){
107 // LAND_BUSINEESTYPE_LIST_INFO list_info = land_busineestype_list_infos.stream().parallel() 121 // LAND_BUSINEESTYPE_LIST_INFO list_info = land_busineestype_list_infos.stream().parallel()
@@ -114,6 +128,9 @@ public class CustomsLockServiceImpl implements CustomsLockService { @@ -114,6 +128,9 @@ public class CustomsLockServiceImpl implements CustomsLockService {
114 // return true; 128 // return true;
115 // } 129 // }
116 // } 130 // }
  131 + }
  132 + }else {
  133 + return false;
117 } 134 }
118 } 135 }
119 }else { 136 }else {