use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class ManualJobServiceImpl method execute.
@WebMethod
@POST
@Path("/executeJob/{uploadOid}")
@Override
public String execute(@WebParam(name = "uploadOid") @PathParam("uploadOid") String uploadOid) throws Exception {
SysExprJobLogVO result = null;
Subject subject = null;
ObjectMapper objectMapper = new ObjectMapper();
String exceptionMessage = "";
try {
Map<String, Object> dataMap = SystemExpressionJobUtils.getDecUploadOid(uploadOid);
if (dataMap == null || StringUtils.isBlank((String) dataMap.get("accountId")) || StringUtils.isBlank((String) dataMap.get("sysExprJobOid"))) {
log.error("no data accountId / sysExprJobOid");
result = new SysExprJobLogVO();
result.setFaultMsg("no data accountId / sysExprJobOid");
return objectMapper.writeValueAsString(result);
}
String accountId = (String) dataMap.get("accountId");
String sysExprJobOid = (String) dataMap.get("sysExprJobOid");
ShiroLoginSupport loginSupport = new ShiroLoginSupport();
subject = loginSupport.forceCreateLoginSubject(accountId);
result = SystemExpressionJobUtils.executeJobForManual(sysExprJobOid);
} catch (ServiceException se) {
se.printStackTrace();
exceptionMessage = se.getMessage().toString();
} catch (Exception e) {
e.printStackTrace();
if (e.getMessage() == null) {
exceptionMessage = e.toString();
} else {
exceptionMessage = e.getMessage().toString();
}
} finally {
if (result == null) {
result = new SysExprJobLogVO();
}
if (subject != null) {
subject.logout();
}
if (!StringUtils.isBlank(exceptionMessage) && StringUtils.isBlank(result.getFaultMsg())) {
result.setFaultMsg(exceptionMessage);
}
}
return objectMapper.writeValueAsString(result);
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class BaseService method ibatisSelectOneByValue.
@Transactional(isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public DefaultResult<E> ibatisSelectOneByValue(E valueObj) throws ServiceException, Exception {
if (null == valueObj) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
DefaultResult<E> result = new DefaultResult<E>();
E searchResult = this.getBaseDataAccessObject().ibatisSelectOneByValue(valueObj);
if (searchResult != null) {
result.setValue(searchResult);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
}
return result;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class SystemExpressionJobUtils method getEncUploadOid.
public static String getEncUploadOid(String accountId, String sysExprJobOid) throws ServiceException, Exception {
if (StringUtils.isBlank(accountId) || StringUtils.isBlank(sysExprJobOid)) {
throw new Exception("error, accountId or sysExprJobOid value is blank!");
}
Map<String, Object> dataMap = new HashMap<String, Object>();
dataMap.put("accountId", accountId);
dataMap.put("sysExprJobOid", sysExprJobOid);
ObjectMapper objectMapper = new ObjectMapper();
String jsonData = objectMapper.writeValueAsString(dataMap);
String uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, jsonData.getBytes(), SimpleUtils.getUUIDStr() + ".json");
uploadOid = SimpleUtils.toHex(EncryptorUtils.encrypt(Constants.getEncryptorKey1(), Constants.getEncryptorKey2(), uploadOid));
return uploadOid;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class SystemFormUtils method findTemplate.
public static SysFormTemplateVO findTemplate(String templateId) throws ServiceException, Exception {
SysFormTemplateVO template = new SysFormTemplateVO();
template.setTplId(templateId);
DefaultResult<SysFormTemplateVO> result = sysFormTemplateService.findByUK(template);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
template = result.getValue();
//this.writePage(template);
return template;
}
use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.
the class SystemFtpClientUtils method findSysFtp.
public static SysFtpVO findSysFtp(String ftpId) throws ServiceException, Exception {
SysFtpVO ftp = new SysFtpVO();
ftp.setId(ftpId);
DefaultResult<SysFtpVO> result = sysFtpService.findByUK(ftp);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
ftp = result.getValue();
return ftp;
}
Aggregations