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;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class WorkspaceLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(String workspaceOid) throws ServiceException, Exception {
if (super.isBlank(workspaceOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
WorkspaceVO workspace = new WorkspaceVO();
workspace.setOid(workspaceOid);
DefaultResult<WorkspaceVO> oldResult = this.workspaceService.findObjectByOid(workspace);
if (oldResult.getValue() == null) {
throw new ServiceException(oldResult.getSystemMessage().getValue());
}
workspace = oldResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("spaceId", workspace.getSpaceId());
List<BbWorkspaceConfig> configs = this.workspaceConfigService.findListByParams(params);
List<BbWorkspaceLabel> labels = this.workspaceLabelService.findListByParams(params);
for (int i = 0; configs != null && i < configs.size(); i++) {
BbWorkspaceConfig config = configs.get(i);
this.workspaceConfigService.delete(config);
}
for (int i = 0; labels != null && i < labels.size(); i++) {
BbWorkspaceLabel label = labels.get(i);
this.workspaceLabelService.delete(label);
}
return workspaceService.deleteObject(workspace);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class StrategyMapLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT, ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> create(String visionOid, Map<String, Object> jsonData) throws ServiceException, Exception {
this.delete(visionOid);
VisionVO vision = new VisionVO();
vision.setOid(visionOid);
DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
if (vResult.getValue() == null) {
// 沒 TB_VISION 資料, 不用清 STRATEGY MAP
throw new ServiceException(vResult.getSystemMessage().getValue());
}
vision = vResult.getValue();
StrategyMapVO strategyMap = new StrategyMapVO();
strategyMap.setVisId(vision.getVisId());
DefaultResult<StrategyMapVO> smResult = strategyMapService.saveObject(strategyMap);
if (smResult.getValue() == null) {
throw new ServiceException(smResult.getSystemMessage().getValue());
}
strategyMap = smResult.getValue();
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
this.saveNodesAndConnections(strategyMap, jsonData);
return result;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class StrategyMapLogicServiceImpl method delete.
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(String visionOid) throws ServiceException, Exception {
if (super.isBlank(visionOid) || super.isNoSelectId(visionOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.DELETE_SUCCESS)));
VisionVO vision = new VisionVO();
vision.setOid(visionOid);
DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
if (vResult.getValue() == null) {
// 沒 TB_VISION 資料, 不用清 STRATEGY MAP
return result;
}
vision = vResult.getValue();
StrategyMapVO strategyMap = new StrategyMapVO();
strategyMap.setVisId(vision.getVisId());
DefaultResult<StrategyMapVO> smResult = this.strategyMapService.findByUK(strategyMap);
if (smResult.getValue() == null) {
// 沒有 BB_STRATEGY_MAP 資料
return result;
}
strategyMap = smResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("masterOid", strategyMap.getOid());
List<BbStrategyMapNodes> nodes = this.strategyMapNodesService.findListByParams(params);
List<BbStrategyMapConns> conns = this.strategyMapConnsService.findListByParams(params);
for (int i = 0; nodes != null && i < nodes.size(); i++) {
strategyMapNodesService.delete(nodes.get(i));
}
for (int i = 0; conns != null && i < conns.size(); i++) {
strategyMapConnsService.delete(conns.get(i));
}
return strategyMapService.deleteObject(strategyMap);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class ApplicationSystemLogicServiceImpl method createMultiName.
/**
* 產生 tb_sys_multi_name 資料
*
* @param multiName
* @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<SysMultiNameVO> createMultiName(SysMultiNameVO multiName) throws ServiceException, Exception {
if (null == multiName || super.isBlank(multiName.getSysId()) || super.isBlank(multiName.getName()) || super.isBlank(multiName.getLocaleCode())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
if (LocaleLanguageUtils.getMap().get(multiName.getLocaleCode()) == null) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
SysVO sys = new SysVO();
sys.setSysId(multiName.getSysId());
DefaultResult<SysVO> sysResult = this.sysService.findByUK(sys);
if (sysResult.getValue() == null) {
throw new ServiceException(sysResult.getSystemMessage().getValue());
}
super.setStringValueMaxLength(multiName, "name", 100);
return this.sysMultiNameService.saveObject(multiName);
}
Aggregations