|  | @@ -2,6 +2,7 @@ package com.miniframe.template;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.miniframe.core.exception.BusinessException;
 |  |  import com.miniframe.core.exception.BusinessException;
 | 
											
												
													
														|  |  import com.miniframe.core.ext.UtilTools;
 |  |  import com.miniframe.core.ext.UtilTools;
 | 
											
												
													
														|  | 
 |  | +import com.miniframe.dbtransfer.DVentdoorDbTransfer;
 | 
											
												
													
														|  |  import com.miniframe.model.system.*;
 |  |  import com.miniframe.model.system.*;
 | 
											
												
													
														|  |  import com.miniframe.model.system.dao.*;
 |  |  import com.miniframe.model.system.dao.*;
 | 
											
												
													
														|  |  import com.miniframe.tools.XIFileUtils;
 |  |  import com.miniframe.tools.XIFileUtils;
 | 
											
										
											
												
													
														|  | @@ -562,16 +563,76 @@ public class TemplateGenerator2 {
 | 
											
												
													
														|  |          fileWriter.close();
 |  |          fileWriter.close();
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * 设备信息
 | 
											
												
													
														|  | 
 |  | +     * @param aid
 | 
											
												
													
														|  | 
 |  | +     * @param jid
 | 
											
												
													
														|  | 
 |  | +     * @throws IOException
 | 
											
												
													
														|  | 
 |  | +     * @throws TemplateException
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public static void createDevice(Integer aid, Integer jid) throws IOException, TemplateException {
 | 
											
												
													
														|  | 
 |  | +        Configuration cfg = new Configuration(Configuration.VERSION_2_3_0);
 | 
											
												
													
														|  | 
 |  | +        // 设置模板所在目录
 | 
											
												
													
														|  | 
 |  | +        cfg.setClassForTemplateLoading(TemplateGenerator2.class, "/templates");
 | 
											
												
													
														|  | 
 |  | +        // 获取模板对象
 | 
											
												
													
														|  | 
 |  | +        Template template = cfg.getTemplate("device.ftl");
 | 
											
												
													
														|  | 
 |  | +        // 定义数据模型(Map)
 | 
											
												
													
														|  | 
 |  | +        Map<String, Object> dataModel = new HashMap<>();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        DVentfanMapper fanDao =UtilTools.getBean(DVentfanMapper.class);
 | 
											
												
													
														|  | 
 |  | +        DVentfanSQLBuilder fansb =new DVentfanSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        DVentfanSQLBuilder.Criteria fansc = fansb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        List<DVentfan> fans =fanDao.selectByExample(fansb);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        DVentdoorMapper doorDao =UtilTools.getBean(DVentdoorMapper.class);
 | 
											
												
													
														|  | 
 |  | +        DVentdoorSQLBuilder doorsb =new DVentdoorSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        DVentdoorSQLBuilder.Criteria doorsc = doorsb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        doorsc.andAidEqualTo(aid);
 | 
											
												
													
														|  | 
 |  | +        List<DVentdoor> doors =doorDao.selectByExample(doorsb);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        DPumpMapper pDao =UtilTools.getBean(DPumpMapper.class);
 | 
											
												
													
														|  | 
 |  | +        DPumpSQLBuilder psb =new DPumpSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        DPumpSQLBuilder.Criteria psc =psb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        List<DPump> dPumpList =pDao.selectByExample(psb);
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        DPumpHfMapper hfDao =UtilTools.getBean(DPumpHfMapper.class);
 | 
											
												
													
														|  | 
 |  | +        DPumpHfSQLBuilder hfsb =new DPumpHfSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        DPumpHfSQLBuilder.Criteria hfsc = hfsb.createCriteria();
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -    public static void main(String[] args) throws Exception {
 |  | 
 | 
											
												
													
														|  | -//        TemplateGenerator.createWaterRunsh(5);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        List<DPumpVo> pumps= new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        dPumpList.forEach(dPump -> {
 | 
											
												
													
														|  | 
 |  | +            DPumpVo vo =new DPumpVo();
 | 
											
												
													
														|  | 
 |  | +            vo.setPump(dPump);
 | 
											
												
													
														|  | 
 |  | +            hfsb.clear();
 | 
											
												
													
														|  | 
 |  | +            hfsc.andPumpidEqualTo(dPump.getId());
 | 
											
												
													
														|  | 
 |  | +            hfsb.setOrderByClause("hight");
 | 
											
												
													
														|  | 
 |  | +            List<DPumpHf> hfs =hfDao.selectByExample(hfsb);
 | 
											
												
													
														|  | 
 |  | +            vo.setHfs(hfs);
 | 
											
												
													
														|  | 
 |  | +            vo.setNum(hfs.size());
 | 
											
												
													
														|  | 
 |  | +            pumps.add(vo);
 | 
											
												
													
														|  | 
 |  | +        });
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -        float myFloat = 495545.603f;
 |  | 
 | 
											
												
													
														|  | -        String formattedString = String.format("%.32f", myFloat);
 |  | 
 | 
											
												
													
														|  | -        System.out.println(myFloat); // 输出: 123.46
 |  | 
 | 
											
												
													
														|  | -        System.out.println(formattedString); // 输出: 123.46
 |  | 
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        dataModel.put("fannum",fans.size());//风机数量
 | 
											
												
													
														|  | 
 |  | +        dataModel.put("fans",fans);//风机
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        dataModel.put("doornum",doors.size());//风门数量
 | 
											
												
													
														|  | 
 |  | +        dataModel.put("doors",doors);//风门
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        dataModel.put("pumps",pumps);//水泵
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        // 将数据模型传入模板进行处理
 | 
											
												
													
														|  | 
 |  | +        StringWriter writer = new StringWriter();
 | 
											
												
													
														|  | 
 |  | +        template.process(dataModel, writer);
 | 
											
												
													
														|  | 
 |  | +        mkDirs(aid, jid, "/fire");
 | 
											
												
													
														|  | 
 |  | +        FileWriter fileWriter = new FileWriter(BPATH + "/" + aid + "/" + jid  + "/device.txt");
 | 
											
												
													
														|  | 
 |  | +        fileWriter.write(writer.toString());
 | 
											
												
													
														|  | 
 |  | +        fileWriter.close();
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      public static void createGasControl(Integer aid, Integer jid, Integer gid, String totaltime,
 |  |      public static void createGasControl(Integer aid, Integer jid, Integer gid, String totaltime,
 | 
											
												
													
														|  |                                          String dt, String dx, String reportstep, String interactionstep,
 |  |                                          String dt, String dx, String reportstep, String interactionstep,
 | 
											
												
													
														|  |                                          String cocodes) throws IOException, TemplateException {
 |  |                                          String cocodes) throws IOException, TemplateException {
 |