Search in sources :

Example 16 with ServiceMethodAuthority

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

the class SystemJreportLogicServiceImpl method createParam.

@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysJreportParamVO> createParam(SysJreportParamVO reportParam, String reportOid) throws ServiceException, Exception {
    if (reportParam == null || super.isBlank(reportOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysJreportVO> mResult = this.sysJreportService.findForSimple(reportOid);
    if (mResult.getValue() == null) {
        throw new ServiceException(mResult.getSystemMessage().getValue());
    }
    SysJreportVO report = mResult.getValue();
    reportParam.setReportId(report.getReportId());
    return this.sysJreportParamService.saveObject(reportParam);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysJreportVO(com.netsteadfast.greenstep.vo.SysJreportVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with ServiceMethodAuthority

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

the class ApplicationSystemLogicServiceImpl method update.

/**
	 * 更新 TB_SYS 資料
	 * 
	 * @param sys
	 * @param iconOid
	 * @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<SysVO> update(SysVO sys, String iconOid) throws ServiceException, Exception {
    if (null == sys || StringUtils.isBlank(sys.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysIconVO sysIcon = new SysIconVO();
    sysIcon.setOid(iconOid);
    DefaultResult<SysIconVO> iconResult = this.sysIconService.findObjectByOid(sysIcon);
    if (iconResult.getValue() == null) {
        throw new ServiceException(iconResult.getSystemMessage().getValue());
    }
    sys.setIcon(iconResult.getValue().getIconId());
    return this.sysService.updateObject(sys);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysIconVO(com.netsteadfast.greenstep.vo.SysIconVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 18 with ServiceMethodAuthority

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

the class RoleLogicServiceImpl method copyAsNew.

/**
	 * 拷備一份role
	 * 
	 * @param fromRoleOid
	 * @param role
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<RoleVO> copyAsNew(String fromRoleOid, RoleVO role) throws ServiceException, Exception {
    if (role == null || super.isBlank(role.getRole()) || super.isBlank(fromRoleOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    super.setStringValueMaxLength(role, "description", MAX_DESCRIPTION_LENGTH);
    DefaultResult<RoleVO> result = this.roleService.saveObject(role);
    RoleVO oldRole = new RoleVO();
    oldRole.setOid(fromRoleOid);
    DefaultResult<RoleVO> fromResult = this.roleService.findObjectByOid(oldRole);
    if (fromResult.getValue() == null) {
        throw new ServiceException(fromResult.getSystemMessage().getValue());
    }
    oldRole = fromResult.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("role", oldRole.getRole());
    List<TbRolePermission> permissions = this.rolePermissionService.findListByParams(paramMap);
    for (int i = 0; permissions != null && i < permissions.size(); i++) {
        RolePermissionVO permission = new RolePermissionVO();
        this.rolePermissionService.fillToValueObject(permission, permissions.get(i));
        permission.setOid(null);
        permission.setRole(result.getValue().getRole());
        this.rolePermissionService.saveObject(permission);
    }
    // 選單menu role 也copy一份
    List<TbSysMenuRole> menuRoles = this.sysMenuRoleService.findListByParams(paramMap);
    for (int i = 0; menuRoles != null && i < menuRoles.size(); i++) {
        SysMenuRoleVO menuRole = new SysMenuRoleVO();
        this.sysMenuRoleService.fillToValueObject(menuRole, menuRoles.get(i));
        menuRole.setOid(null);
        menuRole.setRole(result.getValue().getRole());
        this.sysMenuRoleService.saveObject(menuRole);
    }
    return result;
}
Also used : SysMenuRoleVO(com.netsteadfast.greenstep.vo.SysMenuRoleVO) TbSysMenuRole(com.netsteadfast.greenstep.po.hbm.TbSysMenuRole) HashMap(java.util.HashMap) TbRolePermission(com.netsteadfast.greenstep.po.hbm.TbRolePermission) RolePermissionVO(com.netsteadfast.greenstep.vo.RolePermissionVO) 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) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 19 with ServiceMethodAuthority

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

the class RoleLogicServiceImpl method getDefaultUserRole.

/**
	 * 使用者設的role-id(角色), 它設定在 tb_sys_code中
	 * 
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
public String getDefaultUserRole() throws ServiceException, Exception {
    String role = "";
    SysCodeVO sysCode = new SysCodeVO();
    sysCode.setType(DEFAULT_ROLE_CODE_TYPE);
    sysCode.setCode(DEFAULT_ROLE_CODE);
    DefaultResult<SysCodeVO> result = this.sysCodeService.findByUK(sysCode);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    sysCode = result.getValue();
    role = sysCode.getParam1();
    if (super.isBlank(role)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("role", role);
    if (this.roleService.countByParams(params) != 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    return role;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysCodeVO(com.netsteadfast.greenstep.vo.SysCodeVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Example 20 with ServiceMethodAuthority

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

the class WeightLogicServiceImpl method update.

@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> update(List<PerspectiveVO> perspectives, List<ObjectiveVO> objectives, List<KpiVO> kpis) throws ServiceException, Exception {
    if (perspectives == null || perspectives.size() < 1 || objectives == null || objectives.size() < 1 || kpis == null || kpis.size() < 1) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    for (PerspectiveVO perspective : perspectives) {
        BbPerspective entity = this.perspectiveService.findByPKng(perspective.getOid());
        entity.setWeight(perspective.getWeight());
        this.perspectiveService.update(entity);
    }
    for (ObjectiveVO objective : objectives) {
        BbObjective entity = this.objectiveService.findByPKng(objective.getOid());
        entity.setWeight(objective.getWeight());
        this.objectiveService.update(entity);
    }
    for (KpiVO kpi : kpis) {
        BbKpi entity = this.kpiService.findByPKng(kpi.getOid());
        entity.setWeight(kpi.getWeight());
        this.kpiService.update(entity);
    }
    DefaultResult<Boolean> result = new DefaultResult<Boolean>();
    result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
    result.setValue(Boolean.TRUE);
    return result;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ObjectiveVO(com.netsteadfast.greenstep.vo.ObjectiveVO) BbObjective(com.netsteadfast.greenstep.po.hbm.BbObjective) KpiVO(com.netsteadfast.greenstep.vo.KpiVO) PerspectiveVO(com.netsteadfast.greenstep.vo.PerspectiveVO) BbPerspective(com.netsteadfast.greenstep.po.hbm.BbPerspective) BbKpi(com.netsteadfast.greenstep.po.hbm.BbKpi) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)95 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)91 Transactional (org.springframework.transaction.annotation.Transactional)84 HashMap (java.util.HashMap)32 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)31 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)29 SysVO (com.netsteadfast.greenstep.vo.SysVO)13 LinkedHashMap (java.util.LinkedHashMap)13 Map (java.util.Map)12 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)7 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)7 BaseEntity (com.netsteadfast.greenstep.base.model.BaseEntity)6 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)6 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)6 IOException (java.io.IOException)6 BaseValueObj (com.netsteadfast.greenstep.base.model.BaseValueObj)5 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)5 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)5 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)5 BbReportRoleView (com.netsteadfast.greenstep.po.hbm.BbReportRoleView)4