use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class SysMenuServiceImpl method findForMenuGenerator.
/**
* 找此帳戶有的選單 , 如果是 super 就把 account 帶入空白
*
* @param progSystem
* @param account
* @return
* @throws ServiceException
* @throws Exception
*/
@Override
public DefaultResult<List<SysMenuVO>> findForMenuGenerator(String progSystem, String account) throws ServiceException, Exception {
if (StringUtils.isBlank(progSystem)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<List<SysMenuVO>> result = new DefaultResult<List<SysMenuVO>>();
List<SysMenuVO> searchList = this.sysMenuDAO.findForMenuGenerator(progSystem, account);
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.base.model.SystemMessage in project bamboobsc by billchen198318.
the class SysJreportServiceImpl method findForSimple.
@Override
public DefaultResult<SysJreportVO> findForSimple(String oid) throws ServiceException, Exception {
if (StringUtils.isBlank(oid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
SysJreportVO searchObj = this.sysJreportDAO.findForSimple(oid);
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.SystemMessage in project bamboobsc by billchen198318.
the class BaseService method findObjectByOid.
@SuppressWarnings("unchecked")
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
public DefaultResult<T> findObjectByOid(T object) throws ServiceException, Exception {
if (object == null || !(object instanceof BaseValueObj)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0);
Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
E entityObject = entityObjectClass.newInstance();
T objectByOid = null;
try {
this.doMapper(object, entityObject, this.getMapperIdVo2Po());
E entityByOid = this.findByOid(entityObject);
if (entityByOid != null) {
objectByOid = valueObjectClass.newInstance();
this.doMapper(entityByOid, objectByOid, this.getMapperIdPo2Vo());
}
} catch (Exception e) {
e.printStackTrace();
}
DefaultResult<T> result = new DefaultResult<T>();
if (objectByOid != null && !StringUtils.isBlank(((BaseValueObj) objectByOid).getOid())) {
result.setValue(objectByOid);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
}
return result;
}
use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class BaseService method findByUK.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, timeout = 25, readOnly = true)
@SuppressWarnings("unchecked")
public DefaultResult<T> findByUK(T object) throws ServiceException, Exception {
if (object == null || !(object instanceof BaseValueObj)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.OBJ_NULL));
}
Class<T> valueObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 0);
Class<E> entityObjectClass = GenericsUtils.getSuperClassGenricType(getClass(), 1);
E entityObject = entityObjectClass.newInstance();
T objectByUK = null;
try {
this.doMapper(object, entityObject, this.getMapperIdVo2Po());
E entityByUK = this.getBaseDataAccessObject().findByUK(entityObject);
if (entityByUK != null) {
objectByUK = valueObjectClass.newInstance();
this.doMapper(entityByUK, objectByUK, this.getMapperIdPo2Vo());
}
} catch (Exception e) {
e.printStackTrace();
}
DefaultResult<T> result = new DefaultResult<T>();
if (objectByUK != null && !StringUtils.isBlank(((BaseValueObj) objectByUK).getOid())) {
result.setValue(objectByUK);
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
}
return result;
}
use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class BaseService method saveOrMergeObject.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@SuppressWarnings({ "rawtypes", "unchecked" })
private DefaultResult<T> saveOrMergeObject(String type, boolean checkUK, 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();
this.doMapper(object, entityObject, getMapperIdVo2Po());
if (checkUK) {
int countByUK = 1;
try {
countByUK = this.getBaseDataAccessObject().countByUK(entityObject);
} catch (Exception e) {
e.printStackTrace();
}
if (countByUK > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_IS_EXIST));
}
}
((BaseEntity) entityObject).setOid(this.generateOid());
((BaseEntity) entityObject).setCuserid(this.getAccountId());
((BaseEntity) entityObject).setCdate(this.generateDate());
E insertEntity = null;
try {
if ("save".equals(type)) {
insertEntity = this.getBaseDataAccessObject().save(entityObject);
} else {
insertEntity = this.getBaseDataAccessObject().merge(entityObject);
}
} catch (Exception e) {
e.printStackTrace();
}
if (insertEntity != null && ((BaseEntity) insertEntity).getOid() != null) {
T insertValueObj = valueObjectClass.newInstance();
this.doMapper(insertEntity, insertValueObj, getMapperIdPo2Vo());
result.setValue(insertValueObj);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS)));
} else {
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_FAIL)));
}
return result;
}
Aggregations