use of com.netsteadfast.greenstep.base.model.DefaultResult 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.model.DefaultResult in project bamboobsc by billchen198318.
the class SysUploadServiceImpl method updateTypeOnly.
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateTypeOnly(String oid, String type) throws ServiceException, Exception {
if (StringUtils.isBlank(oid) || StringUtils.isBlank(type)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.FALSE);
if (this.sysUploadDAO.updateTypeOnly(oid, type, this.getAccountId()) == 1) {
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
} else {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_FAIL));
}
return result;
}
use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.
the class SysUploadServiceImpl method findForNoByteContent.
@Override
public DefaultResult<SysUploadVO> findForNoByteContent(String oid) throws ServiceException, Exception {
if (StringUtils.isBlank(oid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
SysUploadVO upload = this.sysUploadDAO.findForNoByteContent(oid);
DefaultResult<SysUploadVO> result = new DefaultResult<SysUploadVO>();
if (upload != null && !StringUtils.isBlank(upload.getOid())) {
result.setValue(upload);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST)));
}
return result;
}
use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.
the class SysJreportServiceImpl method findForSimpleByReportId.
@Override
public DefaultResult<SysJreportVO> findForSimpleByReportId(String reportId) throws ServiceException, Exception {
if (StringUtils.isBlank(reportId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
SysJreportVO searchObj = this.sysJreportDAO.findForSimpleByReportId(reportId);
DefaultResult<SysJreportVO> result = new DefaultResult<SysJreportVO>();
if (null != searchObj && !StringUtils.isBlank(searchObj.getOid())) {
result.setValue(searchObj);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST)));
}
return result;
}
use of com.netsteadfast.greenstep.base.model.DefaultResult in project bamboobsc by billchen198318.
the class BaseService method updateObject.
@SuppressWarnings({ "unchecked", "rawtypes" })
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
public DefaultResult<T> updateObject(T object) throws ServiceException, Exception {
if (object == null || !(object instanceof BaseValueObj)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
DefaultResult<T> result = new DefaultResult<T>();
Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0);
Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
E entityObject = entityObjectClass.newInstance();
((BaseEntity) entityObject).setOid(((BaseValueObj) object).getOid());
E findEntity = this.findByOid(entityObject);
if (findEntity == null) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
}
this.doMapper(object, findEntity, this.getMapperIdVo2Po());
E updateEntity = null;
try {
((BaseEntity) findEntity).setUuserid(this.getAccountId());
((BaseEntity) findEntity).setUdate(this.generateDate());
updateEntity = this.getBaseDataAccessObject().update(findEntity);
} catch (Exception e) {
e.printStackTrace();
}
if (updateEntity != null && ((BaseEntity) updateEntity).getOid() != null) {
T updateValueObj = valueObjectClass.newInstance();
this.doMapper(updateEntity, updateValueObj, this.getMapperIdPo2Vo());
result.setValue(updateValueObj);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
}
return result;
}
Aggregations