Search in sources :

Example 1 with TbSysTemplateParam

use of com.netsteadfast.greenstep.po.hbm.TbSysTemplateParam in project bamboobsc by billchen198318.

the class TemplateUtils method getResult.

/**
	 * 產生 template 結果
	 * Map 值放入 title 與 message
	 * 
	 * @param templateId	樣板id
	 * @param dataObj		資料來源
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
public static TemplateResultObj getResult(String templateId, Object dataObj) throws ServiceException, Exception {
    if (StringUtils.isBlank(templateId) || null == dataObj) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    TemplateResultObj resultObj = new TemplateResultObj();
    SysTemplateVO sysTemplate = loadSysTemplate(templateId);
    List<TbSysTemplateParam> sysTemplateParamList = loadSysTemplateParam(templateId);
    Map<String, Object> titleParams = getTemplateParamMap(IS_TITLE, sysTemplateParamList, dataObj);
    Map<String, Object> msgParams = getTemplateParamMap(IS_MESSAGE, sysTemplateParamList, dataObj);
    resultObj.setTitle(processTemplate(sysTemplate.getTitle(), titleParams));
    resultObj.setContent(processTemplate(sysTemplate.getMessage(), msgParams));
    return resultObj;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysTemplateVO(com.netsteadfast.greenstep.vo.SysTemplateVO) TbSysTemplateParam(com.netsteadfast.greenstep.po.hbm.TbSysTemplateParam) TemplateResultObj(com.netsteadfast.greenstep.model.TemplateResultObj)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)1 TemplateResultObj (com.netsteadfast.greenstep.model.TemplateResultObj)1 TbSysTemplateParam (com.netsteadfast.greenstep.po.hbm.TbSysTemplateParam)1 SysTemplateVO (com.netsteadfast.greenstep.vo.SysTemplateVO)1