Search in sources :

Example 1 with SystemMessage

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

Example 2 with SystemMessage

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

Example 3 with SystemMessage

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

Example 4 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage 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;
}
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 5 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage 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;
}
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