D00009Service.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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.exception.BusinessException;
  7. import com.miniframe.core.ext.UtilTools;
  8. import com.miniframe.generate.business.system.model.D00009BaseModel;
  9. import com.miniframe.httpserver.HttpServerTransFile;
  10. import com.miniframe.model.system.DAccident;
  11. import com.miniframe.model.system.SysFile;
  12. import com.miniframe.model.system.dao.DAccidentMapper;
  13. import com.miniframe.model.system.dao.SysFileMapper;
  14. import com.miniframe.template.TemplateGenerator;
  15. import com.miniframe.tools.XIFileUtils;
  16. import com.miniframe.utils.MFMimeTypeUtils;
  17. /**
  18. * 基础系统,“灾情文件获取”逻辑处理(重新生成不覆盖)。
  19. */
  20. public class D00009Service extends D00009BaseModel implements ExecProcessFlow {
  21. private static final long serialVersionUID = -7051358269847459502L;
  22. /**
  23. * 基础系统,“灾情文件获取”业务核心处理
  24. */
  25. public void transExecute() throws Exception {
  26. Integer aid= getA_d00009().getAid();
  27. Integer step =getA_d00009().getStep();
  28. DAccidentMapper accidentDao = UtilTools.getBean(DAccidentMapper.class);
  29. DAccident accident= accidentDao.selectByPrimaryKey(aid);
  30. // String id = getA_b00022().getId();
  31. String outPath="";
  32. String fileName ="";
  33. if(accident.getStype().endsWith("Fire")){
  34. outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/fire/out/vtk/";
  35. fileName ="POST"+step+".vtk";
  36. }
  37. if(accident.getStype().endsWith("Water")){
  38. outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/water/out/vtk/";
  39. fileName ="POST"+step+".vtk";
  40. }
  41. if(accident.getStype().endsWith("Gass")){
  42. outPath=TemplateGenerator.BPATH+"/"+aid+"/"+accident.getJid()+"/gas/out/vtk/";
  43. fileName ="POST"+step+".vtk";
  44. }
  45. Path path = Paths.get(outPath+"/"+fileName);
  46. String mimeType = MFMimeTypeUtils.getMimeType(path);
  47. HttpServerTransFile transFile = new HttpServerTransFile(fileName, mimeType, path);
  48. UtilTools.setHttpServerTransFile(transFile);
  49. }
  50. /**
  51. * 基础系统,“灾情文件获取”业务前处理
  52. */
  53. public void preTransFlow() throws Exception {
  54. this.validater();
  55. }
  56. /**
  57. * 基础系统,“灾情文件获取”业务后处理
  58. */
  59. public void afterTransFlow() throws Exception {
  60. }
  61. /**
  62. * 基础系统,“灾情文件获取”逻辑入口处理方法
  63. */
  64. @SuppressWarnings("rawtypes")
  65. @Override
  66. public Map execute(Map vars) throws Exception {
  67. this.setTransMap(vars);
  68. preTransFlow();// 执行业务开始的规则检查和校验
  69. transExecute();// 执行核心业务段
  70. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  71. return this.getTransMap();
  72. }
  73. }