Search in sources :

Example 31 with SystemMessage

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 32 with SystemMessage

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysJreportVO(com.netsteadfast.greenstep.vo.SysJreportVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 33 with SystemMessage

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BaseValueObj(com.netsteadfast.greenstep.base.model.BaseValueObj) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 34 with SystemMessage

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BaseValueObj(com.netsteadfast.greenstep.base.model.BaseValueObj) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 35 with SystemMessage

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) BaseEntity(com.netsteadfast.greenstep.base.model.BaseEntity) BaseValueObj(com.netsteadfast.greenstep.base.model.BaseValueObj) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) IOException(java.io.IOException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)53 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)50 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)49 Transactional (org.springframework.transaction.annotation.Transactional)34 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)31 HashMap (java.util.HashMap)13 List (java.util.List)12 Map (java.util.Map)10 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 AggregationMethodVO (com.netsteadfast.greenstep.vo.AggregationMethodVO)3 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)3 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)3 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)3 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)3 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)3 BigDecimal (java.math.BigDecimal)3