@Override
  public String buildByTemplateIdAndSubix(
      String businessFormTemplateId,
      String baseSubix,
      String mainSubix,
      String detailSubix,
      String htmlSubix) {
    StringBuffer bld = new StringBuffer();
    List<businessBaseVo> businessBaseFormList = new ArrayList<businessBaseVo>();
    BusinessFormTemplate businsessFormTemplate =
        businessFormTemplateDao.getById(businessFormTemplateId);
    String htmlTemplatePath = businsessFormTemplate.getHtmlElementPath() + htmlSubix;
    List<BusinessBaseTemplate> list =
        businessBaseTemplateDao.queryBybusinessBaseTemplate(businessFormTemplateId);
    for (BusinessBaseTemplate baseTemplate : list) {
      String businessBaseId = baseTemplate.getBusinessBaseId();
      BusinessBase businessBase = this.businessBaseDao.getById(businessBaseId);
      Integer isDetail = businessBase.getIsDetail();
      String templatePath = baseTemplate.getBusinessBaseTemplate();
      if (isDetail != null && isDetail.intValue() == 0) {
        templatePath = templatePath + mainSubix;
      } else {
        templatePath = templatePath + detailSubix;
      }
      BaseForm baseForm = this.baseFormDao.getById(businessBase.getBaseFormId());
      baseForm.setBaseFormCode(baseForm.getBaseFormCode().toLowerCase());
      List<TemplateField> fieldList = templateFieldDao.queryByTemplateFormId(baseTemplate.getId());
      List<TemplateFieldDto> templateFieldList = new ArrayList<TemplateFieldDto>();
      for (TemplateField templateField : fieldList) {
        if (htmlSubix.equalsIgnoreCase(".read")) {
          templateField.setIsEdit(0);
          templateField.setIsRequire(0);
        }
        if (templateField != null
            && templateField.getIsShow() != null
            && templateField.getIsShow() == 1) {
          if (isDetail != null && isDetail.intValue() == 0) {
            templateFieldList.add(
                templateFieldService.bulidMainField(templateField, htmlTemplatePath));
          } else {
            templateFieldList.add(
                templateFieldService.buildDetailField(templateField, htmlTemplatePath));
          }
        }
      }
      Map<String, Object> param = new HashMap<String, Object>();
      param.put("templateFieldList", templateFieldList);
      param.put("baseTemplate", baseTemplate);
      param.put("baseForm", baseForm);
      try {
        Template template = formTemplateService.getTemplate(templatePath);
        StringWriter writer = new StringWriter();
        template.process(param, writer);
        businessBaseVo vo = new businessBaseVo();
        vo.setBusinessBaseHtml(writer.toString());
        vo.setBusinessBaseTemplate(baseTemplate);
        businessBaseFormList.add(vo);
      } catch (IOException e) {
        log.error(
            this.getClass().getSimpleName()
                + " e==> buildByBusinessFormTemplateId ,IOException + businessFormTemplateId:["
                + businessFormTemplateId
                + "]",
            e);
        throw new FormException("form-209");
      } catch (TemplateException e) {
        log.error(
            this.getClass().getSimpleName()
                + " e==> buildByBusinessFormTemplateId ,TemplateException + businessFormTemplateId:["
                + businessFormTemplateId
                + "]",
            e);
        throw new FormException("form-210");
      }
    }

    try {
      String baseTemplatePath =
          businessFormTemplateDao.getById(businessFormTemplateId).getTempatePath() + baseSubix;
      Map<String, Object> param = new HashMap<String, Object>();
      param.put("businsessFormTemplate", businsessFormTemplate);
      param.put("businessBaseFormList", businessBaseFormList);
      Template template = formTemplateService.getTemplate(baseTemplatePath);
      StringWriter writer = new StringWriter();
      template.process(param, writer);
      bld.append(writer.toString());
    } catch (IOException e) {
      log.error(
          this.getClass().getSimpleName()
              + " e==> buildByBusinessFormTemplateId ,IOException + businessFormTemplateId:["
              + businessFormTemplateId
              + "]",
          e);
      throw new FormException("form-209");
    } catch (TemplateException e) {
      log.error(
          this.getClass().getSimpleName()
              + " e==> buildByBusinessFormTemplateId ,TemplateException + businessFormTemplateId:["
              + businessFormTemplateId
              + "]",
          e);
      throw new FormException("form-210");
    }
    String resultForm = bld.toString();
    return resultForm;
  }
 @Override
 public String buildByTemplateIdAndShowOrder(String businessFormTemplateId, int start, int end) {
   StringBuffer bld = new StringBuffer();
   List<businessBaseVo> businessBaseFormList = new ArrayList<businessBaseVo>();
   BusinessFormTemplate businsessFormTemplate =
       businessFormTemplateDao.getById(businessFormTemplateId);
   String htmlTemplatePath = businsessFormTemplate.getHtmlElementPath();
   List<BusinessBaseTemplate> list =
       businessBaseTemplateDao.queryBybusinessBaseTemplate(businessFormTemplateId);
   for (BusinessBaseTemplate baseTemplate : list) {
     if (baseTemplate.getShowOrder() > end || baseTemplate.getShowOrder() < start) continue;
     String templatePath = baseTemplate.getBusinessBaseTemplate();
     String businessBaseId = baseTemplate.getBusinessBaseId();
     BusinessBase businessBase = this.businessBaseDao.getById(businessBaseId);
     Integer isDetail = businessBase.getIsDetail();
     BaseForm baseForm = this.baseFormDao.getById(businessBase.getBaseFormId());
     baseForm.setBaseFormCode(baseForm.getBaseFormCode().toLowerCase());
     List<TemplateField> fieldList = templateFieldDao.queryByTemplateFormId(baseTemplate.getId());
     List<TemplateFieldDto> templateFieldList = new ArrayList<TemplateFieldDto>();
     for (TemplateField templateField : fieldList) {
       if (templateField != null
           && templateField.getIsShow() != null
           && templateField.getIsShow() == 1) {
         if (isDetail != null && isDetail.intValue() == 0) {
           templateFieldList.add(
               templateFieldService.bulidMainField(templateField, htmlTemplatePath));
         } else {
           templateFieldList.add(
               templateFieldService.buildDetailField(templateField, htmlTemplatePath));
         }
       }
     }
     Map<String, Object> param = new HashMap<String, Object>();
     param.put("templateFieldList", templateFieldList);
     param.put("baseTemplate", baseTemplate);
     param.put("baseForm", baseForm);
     try {
       Template template = formTemplateService.getTemplate(templatePath);
       StringWriter writer = new StringWriter();
       template.process(param, writer);
       bld.append(writer.toString());
     } catch (IOException e) {
       log.error(
           this.getClass().getSimpleName()
               + " e==> buildByBusinessFormTemplateId ,IOException + businessFormTemplateId:["
               + businessFormTemplateId
               + "]",
           e);
       throw new FormException("form-209");
     } catch (TemplateException e) {
       log.error(
           this.getClass().getSimpleName()
               + " e==> buildByBusinessFormTemplateId ,TemplateException + businessFormTemplateId:["
               + businessFormTemplateId
               + "]",
           e);
       throw new FormException("form-210");
     }
   }
   return bld.toString();
 }