Search in sources :

Example 11 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class SystemMenuLogicServiceImpl method createOrUpdate.

/**
	 * 更新或是新增 TB_SYS_MENU 資料
	 * 
	 * @param folderProgramOid
	 * @param childProgramOidList
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> createOrUpdate(String folderProgramOid, List<String> childProgramOidList) throws ServiceException, Exception {
    if (StringUtils.isBlank(folderProgramOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(false);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    // 找 TB_SYS_PROG 資料
    SysProgVO sysProg = new SysProgVO();
    sysProg.setOid(folderProgramOid);
    DefaultResult<SysProgVO> spResult = this.sysProgService.findObjectByOid(sysProg);
    if (spResult.getValue() == null) {
        throw new ServiceException(spResult.getSystemMessage().getValue());
    }
    sysProg = spResult.getValue();
    // 找出 TB_SYS_MENU 原資料 , 沒有資料就是新增
    SysMenuVO sysMenu = new SysMenuVO();
    sysMenu.setProgId(sysProg.getProgId());
    sysMenu.setParentOid(ZeroKeyProvide.OID_KEY);
    if (this.sysMenuService.countByUK(sysMenu) > 0) {
        // update 更新
        DefaultResult<SysMenuVO> smResult = this.sysMenuService.findByUK(sysMenu);
        if (smResult.getValue() == null) {
            throw new ServiceException(smResult.getSystemMessage().getValue());
        }
        sysMenu = smResult.getValue();
    } else {
        // create new 新產
        sysMenu.setProgId(sysProg.getProgId());
        sysMenu.setParentOid(ZeroKeyProvide.OID_KEY);
        sysMenu.setEnableFlag(YesNo.YES);
        DefaultResult<SysMenuVO> smResult = this.sysMenuService.saveObject(sysMenu);
        if (smResult.getValue() == null) {
            throw new ServiceException(smResult.getSystemMessage().getValue());
        }
        sysMenu = smResult.getValue();
    }
    this.removeMenuChildData(sysMenu);
    this.createOrUpdate(sysMenu, childProgramOidList);
    result.setValue(true);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class RoleLogicServiceImpl method updateMenuRole.

/**
	 * 更新存在選單中程式的選單所屬 role
	 * 
	 * @param progOid
	 * @param roles
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> updateMenuRole(String progOid, List<String> roles) throws ServiceException, Exception {
    if (super.isBlank(progOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysProgVO sysProg = new SysProgVO();
    sysProg.setOid(progOid);
    DefaultResult<SysProgVO> spResult = this.sysProgService.findObjectByOid(sysProg);
    if (spResult.getValue() == null) {
        throw new ServiceException(spResult.getSystemMessage().getValue());
    }
    sysProg = spResult.getValue();
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setValue(false);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_FAIL)));
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("progId", sysProg.getProgId());
    List<TbSysMenuRole> sysMenuRoleList = this.sysMenuRoleService.findListByParams(params);
    for (int i = 0; sysMenuRoleList != null && i < sysMenuRoleList.size(); i++) {
        TbSysMenuRole sysMenuRole = sysMenuRoleList.get(i);
        this.sysMenuRoleService.delete(sysMenuRole);
    }
    for (int i = 0; roles != null && i < roles.size(); i++) {
        String roleOid = roles.get(i).trim();
        if (super.isBlank(roleOid)) {
            continue;
        }
        RoleVO role = new RoleVO();
        role.setOid(roleOid);
        DefaultResult<RoleVO> rResult = this.roleService.findObjectByOid(role);
        if (rResult.getValue() == null) {
            throw new ServiceException(rResult.getSystemMessage().getValue());
        }
        role = rResult.getValue();
        SysMenuRoleVO sysMenuRole = new SysMenuRoleVO();
        sysMenuRole.setProgId(sysProg.getProgId());
        sysMenuRole.setRole(role.getRole());
        DefaultResult<SysMenuRoleVO> smrResult = this.sysMenuRoleService.saveObject(sysMenuRole);
        if (smrResult.getValue() == null) {
            throw new ServiceException(smrResult.getSystemMessage().getValue());
        }
    }
    result.setValue(true);
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    return result;
}
Also used : SysMenuRoleVO(com.netsteadfast.greenstep.vo.SysMenuRoleVO) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) TbSysMenuRole(com.netsteadfast.greenstep.po.hbm.TbSysMenuRole) HashMap(java.util.HashMap) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) UserRoleVO(com.netsteadfast.greenstep.vo.UserRoleVO) SysMenuRoleVO(com.netsteadfast.greenstep.vo.SysMenuRoleVO) RoleVO(com.netsteadfast.greenstep.vo.RoleVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 13 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class AggregationMethodServiceImpl method findSimpleById.

@Override
public DefaultResult<AggregationMethodVO> findSimpleById(String aggrId) throws ServiceException, Exception {
    if (StringUtils.isBlank(aggrId) || super.isNoSelectId(aggrId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    AggregationMethodVO aggr = this.aggregationMethodDAO.findSimpleById(aggrId);
    DefaultResult<AggregationMethodVO> result = new DefaultResult<AggregationMethodVO>();
    if (aggr != null && !StringUtils.isBlank(aggr.getOid())) {
        result.setValue(aggr);
    } else {
        result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA)));
    }
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) AggregationMethodVO(com.netsteadfast.greenstep.vo.AggregationMethodVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 14 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class DegreeFeedbackProjectServiceImpl method findByPublishFlag.

@Override
public DefaultResult<List<BbDegreeFeedbackProject>> findByPublishFlag(String publishFlag, String raterId) throws Exception {
    if (StringUtils.isBlank(raterId) || StringUtils.isBlank(publishFlag)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    if (!YesNo.YES.equals(publishFlag) && !YesNo.NO.equals(publishFlag)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_INCORRECT));
    }
    DefaultResult<List<BbDegreeFeedbackProject>> result = new DefaultResult<List<BbDegreeFeedbackProject>>();
    List<BbDegreeFeedbackProject> list = this.degreeFeedbackProjectDAO.findByPublishFlag(publishFlag, raterId);
    if (null != list && list.size() > 0) {
        result.setValue(list);
    } 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) BbDegreeFeedbackProject(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackProject) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

Example 15 with SystemMessage

use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.

the class OrganizationServiceImpl method findForInKpiOrga.

@Override
public DefaultResult<List<BbOrganization>> findForInKpiOrga(String kpiId) throws ServiceException, Exception {
    if (StringUtils.isBlank(kpiId)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<List<BbOrganization>> result = new DefaultResult<List<BbOrganization>>();
    List<BbOrganization> searchList = this.organizationDAO.findForInKpiOrga(kpiId);
    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) BbOrganization(com.netsteadfast.greenstep.po.hbm.BbOrganization) ArrayList(java.util.ArrayList) List(java.util.List) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult)

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