D000014Service.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.D000014BaseModel;
  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 D000014Service extends D000014BaseModel implements ExecProcessFlow {
  17. private static final long serialVersionUID = -7051358269847459502L;
  18. /**
  19. * 基础系统,“灾情几何文件获取”业务核心处理
  20. */
  21. public void transExecute() throws Exception {
  22. Integer aid= getA_d000014().getAid();
  23. DAccidentMapper accidentDao = UtilTools.getBean(DAccidentMapper.class);
  24. DAccident accident= accidentDao.selectByPrimaryKey(aid);
  25. // String id = getA_b00022().getId();
  26. String outPath="";
  27. String fileName ="";
  28. if(accident.getStype().endsWith("Fire")){
  29. outPath= TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/fire/out";
  30. fileName ="FireGrid.vtk";
  31. }
  32. if(accident.getStype().endsWith("Water")){
  33. outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/water/out";
  34. fileName ="WaterGrid.vtk";
  35. }
  36. Path path = Paths.get(outPath+"/"+fileName);
  37. String mimeType = MFMimeTypeUtils.getMimeType(path);
  38. HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
  39. UtilTools.setHttpServerTransFile(transFile);
  40. }
  41. /**
  42. * 基础系统,“灾情几何文件获取”业务前处理
  43. */
  44. public void preTransFlow() throws Exception {
  45. this.validater();
  46. }
  47. /**
  48. * 基础系统,“灾情几何文件获取”业务后处理
  49. */
  50. public void afterTransFlow() throws Exception {
  51. }
  52. /**
  53. * 基础系统,“灾情几何文件获取”逻辑入口处理方法
  54. */
  55. @SuppressWarnings("rawtypes")
  56. @Override
  57. public Map execute(Map vars) throws Exception {
  58. this.setTransMap(vars);
  59. preTransFlow();// 执行业务开始的规则检查和校验
  60. transExecute();// 执行核心业务段
  61. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  62. return this.getTransMap();
  63. }
  64. }