|
|
package com.sy.groovy
|
|
|
|
|
|
import com.sy.crossDomain.BuildBarCode
|
|
|
import com.sy.mapper.LandListDao
|
|
|
import com.sy.model.GatherInfo
|
|
|
import com.sy.model.LandBusinessTypeList
|
|
|
import com.sy.service.CommandLogService
|
|
|
import com.sy.service.LandBusListService
|
|
|
import com.sy.service.RedisService
|
|
|
import com.sy.service.impl.GatherInfoHandle
|
|
|
import org.basis.enhance.groovy.entity.ExecuteParams
|
|
|
import org.slf4j.Logger
|
...
|
...
|
@@ -14,10 +19,11 @@ import java.util.stream.Collectors |
|
|
* 流转申请-核销
|
|
|
* 1. 单进单出即核销判定
|
|
|
* 2. 根据申请单中的通道类型及通道信息判定没有未走完的通道类型,可以核销.比如 申请单证的通道只有进通道,车可以走进一,进二,进二入场,走完进一,即可核销.(一线进)
|
|
|
* 3. 只要有进记录或者出记录 就核销
|
|
|
*/
|
|
|
class X21FormSingileReleaseCheck extends Script {
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
|
|
|
|
|
|
|
|
/**x21指令判定
|
...
|
...
|
@@ -27,59 +33,28 @@ class X21FormSingileReleaseCheck extends Script { |
|
|
* 进行通道比对
|
|
|
*/
|
|
|
void check(ExecuteParams executeParams) {
|
|
|
try{
|
|
|
try {
|
|
|
int count = 0;
|
|
|
// 获取product对象
|
|
|
GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo");
|
|
|
List<LandBusinessTypeList> formList = (List<LandBusinessTypeList>) executeParams.get("FormList");
|
|
|
|
|
|
if (gatherInfo!=null){
|
|
|
// 调用方法
|
|
|
ApplicationContext context = getContext();
|
|
|
// 获取容器中的bean
|
|
|
GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class);
|
|
|
|
|
|
List<LandBusinessTypeList> temp = new ArrayList<>(formList);
|
|
|
//二维码已出区的记录
|
|
|
List<LandBusinessTypeList> havenCrossList = gatherInfoHandle.listService.selectByBarcodeWithE(gatherInfo.getBarcode());
|
|
|
|
|
|
if (formList == null && formList.isEmpty() ){
|
|
|
logger.error("[FORM-RELEASE-CHECK]-车辆进出场对应申请缓存数据为空:{}",gatherInfo.getBarcode());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (havenCrossList.isEmpty()){
|
|
|
logger.error("[FORM-RELEASE-CHECK]{}:车辆无离场数据,不核销",gatherInfo.getVename());
|
|
|
return;
|
|
|
}
|
|
|
logger.info("[FORM-RELEASE-CHECK]:已过卡数量:[{}]",havenCrossList.size())
|
|
|
//申请核销判定,已出区的记录与流转申请数据核碰.如果流转申请列表核碰完,还剩下的需要出区的场站则不核销.
|
|
|
for (LandBusinessTypeList businessTypeList : havenCrossList) {
|
|
|
List<LandBusinessTypeList> r = formList.stream().filter({item ->
|
|
|
//判断还有没有没有出区的场站,还有没有出区的场站就不核销
|
|
|
logger.debug("[releaseFormCheck-Stream-loop]-缓存与已出核碰,缓存元素场站:[{}],已出记录场站:[{}]",item.getEndstation(),businessTypeList.getEndstation());
|
|
|
//解决缓存那里存储有不一样的把人错的的有问题的点,二维码不一致也把缓存删除
|
|
|
if (!item.getBarcode().equals(businessTypeList.getBarcode())){
|
|
|
return true;
|
|
|
}
|
|
|
if(item.getEndstation().equals(businessTypeList.getEndstation())) {
|
|
|
logger.info("[releaseFormCheck-Stream-loop]-缓存元素场站:[{}],已出记录场站:[{}]-核销判定对碰成功",item.getEndstation(),businessTypeList.getEndstation());
|
|
|
return true;
|
|
|
LandBusListService landBusListService = context.getBean(LandBusListService.class)
|
|
|
count = landBusListService.selectHistoryCount(gatherInfo.getBarcode());
|
|
|
if (count>0){
|
|
|
log.info("[Singile-Release-Success]-{}-{}",gatherInfo.getBarcode(),gatherInfo.getVename())
|
|
|
releaseBarCode(gatherInfo,executeParams);
|
|
|
}else {
|
|
|
return false;
|
|
|
}
|
|
|
}).collect(Collectors.toList());
|
|
|
temp.removeAll(r);
|
|
|
log.error("[Singile-Release-Faild]-{}-{}",gatherInfo.getBarcode(),gatherInfo.getVename())
|
|
|
}
|
|
|
logger.info("[FORM-RELEASE-CHECK]-核销判定结果:{}",temp.size());
|
|
|
if (temp.isEmpty()){
|
|
|
//todo:流转申请状态核销
|
|
|
logger.info("[进出场申请]-流转申请开始核销:"+gatherInfo.getVename());
|
|
|
//二维码核销
|
|
|
// gatherInfoHandle.releaseBarCode();
|
|
|
logger.info("[进出场申请]-流转申请已核销:"+gatherInfo.getVename());
|
|
|
}else {
|
|
|
log.error("[Singile-Release-Faild]-核销失败,缺少关键过卡信息");
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
|
|
|
} catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
logger.error("[FORM-RELEASE-ERROR]:",e);
|
|
|
log.error("[LockNoticeCheck-ERR]:",e);
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -95,4 +70,53 @@ class X21FormSingileReleaseCheck extends Script { |
|
|
return context;
|
|
|
}
|
|
|
|
|
|
void releaseBarCode(GatherInfo info,ExecuteParams executeParams){
|
|
|
ApplicationContext context = getContext();
|
|
|
// 获取容器中的bean
|
|
|
LandListDao landListDao = context.getBean(LandListDao.class);
|
|
|
Boolean devdebug = (Boolean)context.getBean("devdebug");
|
|
|
|
|
|
if (!devdebug){
|
|
|
BuildBarCode.cancleBarCode(info.getVename());
|
|
|
log.info("[流转申请]-二维码已释放:"+info.getVename());
|
|
|
}
|
|
|
|
|
|
int rc = landListDao.releaseBarcode(info.getBarcode());
|
|
|
if (rc>0) {
|
|
|
log.info("[进出场核销]-{}流转已核销:{}",info.getVename(),info.getBarcode());
|
|
|
}else{
|
|
|
log.error("[进出场核销-ERROR]-{}流转未核销成功:{}",info.getVename(),info.getBarcode());
|
|
|
}
|
|
|
//车辆流转申请缓存删除
|
|
|
releaseCache(info,executeParams);
|
|
|
|
|
|
}
|
|
|
|
|
|
void releaseCache(GatherInfo info,ExecuteParams executeParams){
|
|
|
|
|
|
ApplicationContext context = getContext();
|
|
|
// 获取容器中的bean
|
|
|
RedisService redisService = context.getBean(RedisService.class);
|
|
|
|
|
|
//车辆流转申请缓存删除
|
|
|
redisService.del(info.getVename());
|
|
|
//流转申请时生成的临时核碰场站代码列表
|
|
|
redisService.del(info.getVename()+"_endstationList");
|
|
|
//车辆过卡信息缓存删除-X22金二判定时候生成的这个缓存
|
|
|
redisService.del(info.getSeqno());
|
|
|
log.info("[流转缓存]-{}缓存已核销",info.getVename());
|
|
|
//核销记录
|
|
|
releaseRecord(info,executeParams);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 核销记录
|
|
|
*/
|
|
|
void releaseRecord(GatherInfo info,ExecuteParams executeParams){
|
|
|
LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("ChanelFormInfo");
|
|
|
ApplicationContext context = getContext();
|
|
|
CommandLogService commandLogService = context.getBean(CommandLogService.class);
|
|
|
commandLogService.commandlog(info,true,"流转核销",chanelFormInfo,null,0.0,0.0,0.0,0.0);
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|