D000015Service.java 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package com.miniframe.bisiness.system;
  2. import java.nio.file.Path;
  3. import java.nio.file.Paths;
  4. import java.util.Map;
  5. import com.miniframe.core.ExecProcessFlow;
  6. import com.miniframe.core.ext.UtilTools;
  7. import com.miniframe.generate.business.system.model.D000015BaseModel;
  8. import com.miniframe.httpserver.HttpServerTransFile;
  9. import com.miniframe.model.system.DAccident;
  10. import com.miniframe.model.system.dao.DAccidentMapper;
  11. import com.miniframe.template.TemplateGenerator;
  12. import com.miniframe.utils.MFMimeTypeUtils;
  13. /**
  14. * 基础系统,“日志文件获取”逻辑处理(重新生成不覆盖)。
  15. */
  16. public class D000015Service extends D000015BaseModel implements ExecProcessFlow {
  17. private static final long serialVersionUID = -7051358269847459502L;
  18. /**
  19. * 基础系统,“日志文件获取”业务核心处理
  20. */
  21. public void transExecute() throws Exception {
  22. Integer aid= getA_d000015().getAid();
  23. DAccidentMapper accidentDao = UtilTools.getBean(DAccidentMapper.class);
  24. DAccident accident= accidentDao.selectByPrimaryKey(aid);
  25. String outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getSid()+"/"+accident.getStype().toLowerCase();
  26. String fileName ="log.txt";
  27. Path path = Paths.get(outPath+"/"+fileName);
  28. String mimeType = MFMimeTypeUtils.getMimeType(path);
  29. HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
  30. UtilTools.setHttpServerTransFile(transFile);
  31. }
  32. /**
  33. * 基础系统,“日志文件获取”业务前处理
  34. */
  35. public void preTransFlow() throws Exception {
  36. this.validater();
  37. }
  38. /**
  39. * 基础系统,“日志文件获取”业务后处理
  40. */
  41. public void afterTransFlow() throws Exception {
  42. }
  43. /**
  44. * 基础系统,“日志文件获取”逻辑入口处理方法
  45. */
  46. @SuppressWarnings("rawtypes")
  47. @Override
  48. public Map execute(Map vars) throws Exception {
  49. this.setTransMap(vars);
  50. preTransFlow();// 执行业务开始的规则检查和校验
  51. transExecute();// 执行核心业务段
  52. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  53. return this.getTransMap();
  54. }
  55. }