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);
}
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);
}
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;
}
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;
}
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;
}
Aggregations