package com.miniframe.bisiness.system; import com.miniframe.constant.XIConstant; import com.miniframe.core.ExecProcessFlow; import com.miniframe.core.exception.BusinessException; import com.miniframe.core.ext.UtilTools; import com.miniframe.generate.appcode.CertificationState; import com.miniframe.generate.business.system.model.A00007BaseModel; import com.miniframe.model.system.SysUser; import com.miniframe.model.system.dao.SysUserMapper; import java.util.List; import java.util.Map; /** * 基础系统,“验证授权码”逻辑处理(重新生成不覆盖)。 */ public class A00007Service extends A00007BaseModel implements ExecProcessFlow { private static final long serialVersionUID = -7051358269847459502L; /** * 基础系统,“验证授权码”业务核心处理 */ public void transExecute() throws Exception { String authCode = this.getA_a00007().getAuthCode(); String authUserId = (String) UtilTools.getUserCache(XIConstant.AuthKeyPre + authCode); if (UtilTools.isNullOrBlank(authUserId)) { throw new BusinessException("EB8000107"); } String authToken = (String) UtilTools.getUserCache(XIConstant.UserKeyPre + authUserId); if (UtilTools.isNullOrBlank(authToken)) { throw new BusinessException("EB8000108"); } this.getD_a00007().setAuthUserId(authUserId); this.getD_a00007().setAuthUserToken(authToken); SysUser authSysUser = UtilTools.getBean(SysUserMapper.class).selectByPrimaryKey(authUserId); if (authSysUser != null) { this.getD_a00007().setAuthUserName(authSysUser.getUsername()); this.getD_a00007().setAuthUserType(authSysUser.getUserType()); } //验证一次后就清除 UtilTools.removeUserCache(XIConstant.AuthKeyPre + authCode); } /** * 基础系统,“验证授权码”业务前处理 */ public void preTransFlow() throws Exception { this.validater(); } /** * 基础系统,“验证授权码”业务后处理 */ public void afterTransFlow() throws Exception { } /** * 基础系统,“验证授权码”逻辑入口处理方法 */ @SuppressWarnings("rawtypes") @Override public Map execute(Map vars) throws Exception { this.setTransMap(vars); preTransFlow();// 执行业务开始的规则检查和校验 transExecute();// 执行核心业务段 afterTransFlow();// 执行核心逻辑完成后的收尾逻辑 return this.getTransMap(); } }