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;
}
Aggregations