HM0000Service.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.miniframe.bisiness.system;
  2. import com.miniframe.core.ExecProcessFlow;
  3. import com.miniframe.core.ext.UtilTools;
  4. import com.miniframe.export.VerificationImage;
  5. import com.miniframe.generate.business.system.model.HM0000BaseModel;
  6. import com.miniframe.httpserver.HttpServerTransFile;
  7. import java.io.ByteArrayOutputStream;
  8. import java.util.Map;
  9. /**
  10. * 基础系统,“获取验证码”逻辑处理(重新生成不覆盖)。
  11. */
  12. public class HM0000Service extends HM0000BaseModel implements ExecProcessFlow {
  13. private static final long serialVersionUID = -7051358269847459502L;
  14. /**
  15. * 基础系统,“获取验证码”业务核心处理
  16. */
  17. public void transExecute() throws Exception {
  18. //产生验证码文件,并且已经将验证码放入的userCache中。
  19. VerificationImage image = new VerificationImage();
  20. String clientToken= this.getA_systemhead().getClientToken();
  21. org.apache.commons.io.output.ByteArrayOutputStream bos = image.createImage(clientToken);
  22. //验证验证码是否正确使用
  23. //VerificationImage.checkImage(clientToken, image.capText)
  24. //设置下行回写的文件
  25. String fileType= "jpg";
  26. String fileName = this.getA_systemhead().getTransCode()+"."+fileType;
  27. ByteArrayOutputStream bos1 =new ByteArrayOutputStream();
  28. bos1.write(bos.toByteArray());
  29. HttpServerTransFile transFile = new HttpServerTransFile(fileName,fileType,bos1);
  30. UtilTools.setDownFile(transFile);
  31. }
  32. /**
  33. * 产生验证码文件
  34. * @throws Exception
  35. */
  36. public void createDownloadFile() throws Exception {
  37. }
  38. /**
  39. * 基础系统,“获取验证码”业务前处理
  40. */
  41. public void preTransFlow() throws Exception {
  42. this.validater();
  43. }
  44. /**
  45. * 基础系统,“获取验证码”业务后处理
  46. */
  47. public void afterTransFolw() throws Exception {
  48. }
  49. /**
  50. * 基础系统,“获取验证码”逻辑入口处理方法
  51. */
  52. @SuppressWarnings("rawtypes")
  53. @Override
  54. public Map execute(Map vars) throws Exception {
  55. this.setTransMap(vars);
  56. preTransFlow();// 执行业务开始的规则检查和校验
  57. transExecute();// 执行核心业务段
  58. afterTransFolw();// 执行核心逻辑完成后的收尾逻辑
  59. return this.getTransMap();
  60. }
  61. }