use of com.netsteadfast.greenstep.po.hbm.TbSysMailHelper in project bamboobsc by billchen198318.
the class SysMailHelperServiceImpl method findForJobList.
@Override
public DefaultResult<List<TbSysMailHelper>> findForJobList(String mailId, String successFlag) throws ServiceException, Exception {
if (StringUtils.isBlank(mailId) || StringUtils.isBlank(successFlag)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<List<TbSysMailHelper>> result = new DefaultResult<List<TbSysMailHelper>>();
List<TbSysMailHelper> searchList = this.sysMailHelperDAO.findForJobList(mailId, successFlag);
if (searchList != null && searchList.size() > 0) {
result.setValue(searchList);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
}
return result;
}
use of com.netsteadfast.greenstep.po.hbm.TbSysMailHelper in project bamboobsc by billchen198318.
the class ExpressionJobExecuteCallable method sendMail.
private void sendMail() {
try {
if (ExpressionJobConstants.CONTACT_MODE_NO.equals(this.jobObj.getSysExprJob().getContactMode())) {
return;
}
if (ExpressionJobConstants.CONTACT_MODE_ONLY_FAULT.equals(this.jobObj.getSysExprJob().getContactMode()) && !ExpressionJobConstants.RUNSTATUS_FAULT.equals(this.jobObj.getSysExprJob().getRunStatus())) {
return;
}
if (ExpressionJobConstants.CONTACT_MODE_ONLY_SUCCESS.equals(this.jobObj.getSysExprJob().getContactMode()) && !ExpressionJobConstants.RUNSTATUS_SUCCESS.equals(this.jobObj.getSysExprJob().getRunStatus())) {
return;
}
String contact = StringUtils.defaultString(this.jobObj.getSysExprJob().getContact()).trim();
if (StringUtils.isBlank(contact)) {
return;
}
String subject = this.jobObj.getSysExprJob().getId() + " - " + this.jobObj.getSysExprJob().getName();
String content = subject + Constants.HTML_BR;
content += "Run status: " + this.jobObj.getSysExprJob().getRunStatus() + Constants.HTML_BR;
content += "Start: " + this.jobObj.getSysExprJobLog().getBeginDatetime().toString() + Constants.HTML_BR;
content += "End: " + this.jobObj.getSysExprJobLog().getEndDatetime().toString() + Constants.HTML_BR;
if (ExpressionJobConstants.RUNSTATUS_FAULT.equals(this.jobObj.getSysExprJob().getRunStatus())) {
content += Constants.HTML_BR;
content += "Fault: " + Constants.HTML_BR;
content += this.jobObj.getSysExprJobLog().getFaultMsg();
}
@SuppressWarnings("unchecked") ISysMailHelperService<SysMailHelperVO, TbSysMailHelper, String> sysMailHelperService = (ISysMailHelperService<SysMailHelperVO, TbSysMailHelper, String>) AppContext.getBean("core.service.SysMailHelperService");
String mailId = SimpleUtils.getStrYMD("");
SysMailHelperVO mailHelper = new SysMailHelperVO();
mailHelper.setMailId(sysMailHelperService.findForMaxMailIdComplete(mailId));
mailHelper.setMailFrom(MailClientUtils.getDefaultFrom());
mailHelper.setMailTo(contact);
mailHelper.setSubject(subject);
mailHelper.setText(content.getBytes("utf8"));
mailHelper.setRetainFlag(YesNo.NO);
mailHelper.setSuccessFlag(YesNo.NO);
sysMailHelperService.saveObject(mailHelper);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations