|  |  | 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 org.basis.enhance.groovy.entity.ExecuteParams | 
|  |  | import org.slf4j.Logger | 
|  |  | import org.slf4j.LoggerFactory | 
|  |  | import org.springframework.context.ApplicationContext | 
|  |  |  | 
|  |  | /** | 
|  |  | * 流转申请-核销 | 
|  |  | * 1. 单进单出即核销判定 | 
|  |  | * 2. 根据申请单中的通道类型及通道信息判定没有未走完的通道类型,可以核销.比如 申请单证的通道只有进通道,车可以走进一,进二,进二入场,走完进一,即可核销.(一线进) | 
|  |  | * 3. 只要有进记录或者出记录 就核销 | 
|  |  | * 4. 用来布尔类型的核销,一般放在其他布尔验放规则的最后. | 
|  |  | */ | 
|  |  | class X21FormSingileReleaseCheckWithTrue extends Script implements ChannelCheckScript{ | 
|  |  |  | 
|  |  | private final Logger log = LoggerFactory.getLogger(getClass()); | 
|  |  |  | 
|  |  |  | 
|  |  | /**x21指令判定 | 
|  |  | * 传入gatherInfo | 
|  |  | * | 
|  |  | * 传入从redis读取的申请表体实体,验证 | 
|  |  | * 进行通道比对 | 
|  |  | */ | 
|  |  | Boolean check(ExecuteParams executeParams) { | 
|  |  | try { | 
|  |  | int count = 0; | 
|  |  | // 获取product对象 | 
|  |  | GatherInfo gatherInfo = (GatherInfo) executeParams.get("GatherInfo"); | 
|  |  | if (gatherInfo!=null){ | 
|  |  | // 调用方法 | 
|  |  | ApplicationContext context = getContext(); | 
|  |  | 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); | 
|  |  | return true; | 
|  |  | }else { | 
|  |  | log.error("[Singile-Release-Faild]-{}-{}",gatherInfo.getBarcode(),gatherInfo.getVename()) | 
|  |  | } | 
|  |  | }else { | 
|  |  | log.error("[Singile-Release-Faild]-核销失败,缺少关键过卡信息"); | 
|  |  | } | 
|  |  |  | 
|  |  | } catch (Exception e){ | 
|  |  | e.printStackTrace(); | 
|  |  | log.error("[LockNoticeCheck-ERR]:",e); | 
|  |  | } | 
|  |  | return false; | 
|  |  | } | 
|  |  |  | 
|  |  | @Override | 
|  |  | Object run() { | 
|  |  | return false; | 
|  |  | } | 
|  |  |  | 
|  |  | // 获取spring容器 | 
|  |  | ApplicationContext getContext() { | 
|  |  | // 获取spring IOC容器 | 
|  |  | ApplicationContext context = applicationContext; | 
|  |  | 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); | 
|  |  | } | 
|  |  |  | 
|  |  | } | 
... | ... |  |