A00007Service.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.miniframe.bisiness.system;
  2. import com.miniframe.constant.XIConstant;
  3. import com.miniframe.core.ExecProcessFlow;
  4. import com.miniframe.core.exception.BusinessException;
  5. import com.miniframe.core.ext.UtilTools;
  6. import com.miniframe.generate.appcode.CertificationState;
  7. import com.miniframe.generate.business.system.model.A00007BaseModel;
  8. import com.miniframe.model.system.SysUser;
  9. import com.miniframe.model.system.dao.SysUserMapper;
  10. import java.util.List;
  11. import java.util.Map;
  12. /**
  13. * 基础系统,“验证授权码”逻辑处理(重新生成不覆盖)。
  14. */
  15. public class A00007Service extends A00007BaseModel implements ExecProcessFlow {
  16. private static final long serialVersionUID = -7051358269847459502L;
  17. /**
  18. * 基础系统,“验证授权码”业务核心处理
  19. */
  20. public void transExecute() throws Exception {
  21. String authCode = this.getA_a00007().getAuthCode();
  22. String authUserId = (String) UtilTools.getUserCache(XIConstant.AuthKeyPre + authCode);
  23. if (UtilTools.isNullOrBlank(authUserId)) {
  24. throw new BusinessException("EB8000107");
  25. }
  26. String authToken = (String) UtilTools.getUserCache(XIConstant.UserKeyPre + authUserId);
  27. if (UtilTools.isNullOrBlank(authToken)) {
  28. throw new BusinessException("EB8000108");
  29. }
  30. this.getD_a00007().setAuthUserId(authUserId);
  31. this.getD_a00007().setAuthUserToken(authToken);
  32. SysUser authSysUser = UtilTools.getBean(SysUserMapper.class).selectByPrimaryKey(authUserId);
  33. if (authSysUser != null) {
  34. this.getD_a00007().setAuthUserName(authSysUser.getUsername());
  35. this.getD_a00007().setAuthUserType(authSysUser.getUserType());
  36. }
  37. //验证一次后就清除
  38. UtilTools.removeUserCache(XIConstant.AuthKeyPre + authCode);
  39. }
  40. /**
  41. * 基础系统,“验证授权码”业务前处理
  42. */
  43. public void preTransFlow() throws Exception {
  44. this.validater();
  45. }
  46. /**
  47. * 基础系统,“验证授权码”业务后处理
  48. */
  49. public void afterTransFlow() throws Exception {
  50. }
  51. /**
  52. * 基础系统,“验证授权码”逻辑入口处理方法
  53. */
  54. @SuppressWarnings("rawtypes")
  55. @Override
  56. public Map execute(Map vars) throws Exception {
  57. this.setTransMap(vars);
  58. preTransFlow();// 执行业务开始的规则检查和校验
  59. transExecute();// 执行核心业务段
  60. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  61. return this.getTransMap();
  62. }
  63. }