D40002Service.java 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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.D40002BaseModel;
  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. * 基础系统,“1维瓦斯结果文件获取”逻辑处理(重新生成不覆盖)。
  15. */
  16. public class D40002Service extends D40002BaseModel implements ExecProcessFlow {
  17. private static final long serialVersionUID = -7051358269847459502L;
  18. /**
  19. * 基础系统,“1维瓦斯结果文件获取”业务核心处理
  20. */
  21. public void transExecute() throws Exception {
  22. Integer aid= getA_d40002().getAid();
  23. Integer step=getA_d40002().getStep();
  24. DAccidentMapper accidentDao = UtilTools.getBean(DAccidentMapper.class);
  25. DAccident accident= accidentDao.selectByPrimaryKey(aid);
  26. String outPath="";
  27. String fileName ="";
  28. outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/gas/mid/vtk";
  29. fileName ="WAMPOST"+step+".vtk";
  30. Path path = Paths.get(outPath+"/"+fileName);
  31. String mimeType = MFMimeTypeUtils.getMimeType(path);
  32. HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
  33. UtilTools.setHttpServerTransFile(transFile);
  34. }
  35. /**
  36. * 基础系统,“1维瓦斯结果文件获取”业务前处理
  37. */
  38. public void preTransFlow() throws Exception {
  39. this.validater();
  40. }
  41. /**
  42. * 基础系统,“1维瓦斯结果文件获取”业务后处理
  43. */
  44. public void afterTransFlow() throws Exception {
  45. }
  46. /**
  47. * 基础系统,“1维瓦斯结果文件获取”逻辑入口处理方法
  48. */
  49. @SuppressWarnings("rawtypes")
  50. @Override
  51. public Map execute(Map vars) throws Exception {
  52. this.setTransMap(vars);
  53. preTransFlow();// 执行业务开始的规则检查和校验
  54. transExecute();// 执行核心业务段
  55. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  56. return this.getTransMap();
  57. }
  58. }