D000014Service.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. if(accident.getStype().endsWith("Gass")){
  37. outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/gas/out";
  38. fileName ="FireGrid.vtk";
  39. }
  40. Path path = Paths.get(outPath+"/"+fileName);
  41. String mimeType = MFMimeTypeUtils.getMimeType(path);
  42. HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
  43. UtilTools.setHttpServerTransFile(transFile);
  44. }
  45. /**
  46. * 基础系统,“灾情几何文件获取”业务前处理
  47. */
  48. public void preTransFlow() throws Exception {
  49. this.validater();
  50. }
  51. /**
  52. * 基础系统,“灾情几何文件获取”业务后处理
  53. */
  54. public void afterTransFlow() throws Exception {
  55. }
  56. /**
  57. * 基础系统,“灾情几何文件获取”逻辑入口处理方法
  58. */
  59. @SuppressWarnings("rawtypes")
  60. @Override
  61. public Map execute(Map vars) throws Exception {
  62. this.setTransMap(vars);
  63. preTransFlow();// 执行业务开始的规则检查和校验
  64. transExecute();// 执行核心业务段
  65. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  66. return this.getTransMap();
  67. }
  68. }