package com.sy.groovy import com.sy.model.GatherInfo import com.sy.model.LandBusinessTypeList import com.sy.service.impl.GatherInfoHandle import org.basis.enhance.groovy.entity.ExecuteParams import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.context.ApplicationContext /** * 基本验放 * 流转申请信息验放 */ class BaseFormCacheCheck extends Script implements ChannelCheckScript { private final Logger logger = LoggerFactory.getLogger(getClass()); private final String CHANEL_ERR= "无对应通道流转申请,走错通道"; private final String IEPORSE = "无相对应进出场申请"; /**x21指令判定 * 传入gatherInfo * * 传入从redis读取的申请表体实体,验证 * 进行通道比对 */ Boolean check(ExecuteParams executeParams) { try{ // 获取product对象 GatherInfo gatherInfo = (GatherInfo) executeParams.get("gatherInfo"); LandBusinessTypeList chanelFormInfo = (LandBusinessTypeList) executeParams.get("chanelFormInfo"); // 调用方法 ApplicationContext context = getContext(); // 获取容器中的bean GatherInfoHandle gatherInfoHandle = context.getBean(GatherInfoHandle.class); if (chanelFormInfo==null){ logger.error("[FORM-CHECK-ERR]:车辆-{}的流转申请校验失败,无对应通道流转申请信息",gatherInfo.getVename()); gatherInfoHandle.sendBw(gatherInfo,false, gatherInfo.getVename()+IEPORSE,null,null); return false; } logger.info("[FORM-CHECK]:车辆-{}的流转申请校验通过",gatherInfo.getVename()); return true; }catch (Exception e){ e.printStackTrace(); logger.error("[CACHE-PARSE-ERROR]:",e); return false; } } @Override Object run() { return false; } // 获取spring容器 ApplicationContext getContext() { // 获取spring IOC容器 ApplicationContext context = applicationContext; return context; } }