use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class OrganizationLogicServiceImpl method createOrgChartData.
/**
* 這個 Method 的 ServiceMethodAuthority 權限給查詢狀態
* 這裡的 basePath 只是要取 getTreeData 時參數要用, 再這是沒有用處的
*/
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<String> createOrgChartData(String basePath, OrganizationVO currentOrganization) throws ServiceException, Exception {
if (null != currentOrganization && !super.isBlank(currentOrganization.getOid())) {
currentOrganization = this.findOrganizationData(currentOrganization.getOid());
}
List<Map<String, Object>> treeMap = this.getTreeData(basePath, false, "");
if (null == treeMap || treeMap.size() < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.SEARCH_NO_DATA));
}
this.resetTreeMapContentForOrgChartData(treeMap, currentOrganization);
Map<String, Object> rootMap = new HashMap<String, Object>();
rootMap.put("name", "Organization / Department hierarchy");
rootMap.put("title", "hierarchy structure");
rootMap.put("children", treeMap);
ObjectMapper objectMapper = new ObjectMapper();
String jsonData = objectMapper.writeValueAsString(rootMap);
String uploadOid = UploadSupportUtils.create(Constants.getSystem(), UploadTypes.IS_TEMP, false, jsonData.getBytes(), SimpleUtils.getUUIDStr() + ".json");
DefaultResult<String> result = new DefaultResult<String>();
result.setValue(uploadOid);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.INSERT_SUCCESS)));
return result;
}
use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class PdcaLogicServiceImpl method startProcess.
@ServiceMethodAuthority(type = { ServiceMethodType.UPDATE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<PdcaVO> startProcess(PdcaVO pdca) throws ServiceException, Exception {
if (null == pdca || super.isBlank(pdca.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<PdcaVO> result = this.pdcaService.findObjectByOid(pdca);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
pdca = result.getValue();
if (YesNo.YES.equals(pdca.getConfirmFlag())) {
throw new ServiceException("The project is confirm, cannot start audit processing!");
}
List<BusinessProcessManagementTaskVO> tasks = this.queryTaskByVariablePdcaOid(pdca.getOid());
if (tasks != null && tasks.size() > 0) {
throw new ServiceException("Audit processing has been started!");
}
String reason = "Start PDCA audit processing, " + pdca.getTitle() + "";
this.startProcess(this.getProcessFlowParam(pdca.getOid(), "*", SimpleUtils.getStrYMD(""), super.getAccountId(), YesNo.YES, reason, YesNo.NO));
result.setSystemMessage(new SystemMessage(reason));
return result;
}
use of com.netsteadfast.greenstep.base.model.SystemMessage in project bamboobsc by billchen198318.
the class SwotLogicServiceImpl 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, String organizationOid, List<SwotVO> datas) throws ServiceException, Exception {
if (super.isBlank(visionOid) || super.isBlank(organizationOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
VisionVO vision = new VisionVO();
vision.setOid(visionOid);
DefaultResult<VisionVO> vResult = this.visionService.findObjectByOid(vision);
if (vResult.getValue() == null) {
throw new ServiceException(vResult.getSystemMessage().getValue());
}
vision = vResult.getValue();
OrganizationVO organization = this.findOrganizationData(organizationOid);
//因為 dojo 的 dijit.InlineEditBox 元件特性是, 沒有修改過, 就不會產生editor , 所以修改模式下用全部刪除後->再全部新增會有問題
//this.delete(vision.getVisId());
DefaultResult<Boolean> result = new DefaultResult<Boolean>();
result.setValue(Boolean.TRUE);
result.setSystemMessage(new SystemMessage(SysMessageUtil.get(GreenStepSysMsgConstants.UPDATE_SUCCESS)));
Map<String, Object> params = new HashMap<String, Object>();
for (SwotVO swot : datas) {
if (!vision.getVisId().equals(swot.getVisId()) || !organization.getOrgId().equals(swot.getOrgId())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
this.setStringValueMaxLength(swot, "issues", MAX_ISSUES_LENGTH);
params.clear();
params.put("perId", swot.getPerId());
if (this.perspectiveService.countByParams(params) < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
if (this.swotService.countByUK(swot) > 0) {
// 修改 ISSUES
this.updateIssues(swot);
} else {
// 新增
this.swotService.saveObject(swot);
}
}
return result;
}
Aggregations