use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority 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.ServiceMethodAuthority 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;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class WorkspaceLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@SuppressWarnings("unchecked")
@Override
public DefaultResult<WorkspaceVO> create(String spaceId, String name, String description, String workspaceTemplateOid, Map<String, Object> jsonData) throws ServiceException, Exception {
if (super.isBlank(spaceId) || super.isBlank(name) || super.isNoSelectId(workspaceTemplateOid) || jsonData == null || jsonData.size() < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
if (jsonData.get("nodes") == null || !(jsonData.get("nodes") instanceof List)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
if (jsonData.get("labels") == null || !(jsonData.get("labels") instanceof List)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
WorkspaceTemplateVO template = new WorkspaceTemplateVO();
template.setOid(workspaceTemplateOid);
DefaultResult<WorkspaceTemplateVO> wtResult = this.workspaceTemplateService.findObjectByOid(template);
if (wtResult.getValue() == null) {
throw new ServiceException(wtResult.getSystemMessage().getValue());
}
template = wtResult.getValue();
WorkspaceVO workspace = new WorkspaceVO();
workspace.setSpaceId(spaceId);
workspace.setTemplateId(template.getTemplateId());
workspace.setName(name);
workspace.setDescription(super.defaultString(description));
this.setStringValueMaxLength(workspace, "description", MAX_DESCRIPTION_LENGTH);
DefaultResult<WorkspaceVO> result = this.workspaceService.saveObject(workspace);
if (result.getValue() == null) {
throw new ServiceException(result.getSystemMessage().getValue());
}
workspace = result.getValue();
List<Map<String, Object>> nodes = (List<Map<String, Object>>) jsonData.get("nodes");
List<Map<String, Object>> labels = (List<Map<String, Object>>) jsonData.get("labels");
for (int i = 0; nodes != null && i < nodes.size(); i++) {
Map<String, Object> data = nodes.get(i);
String id = (String) data.get("id");
int position = Integer.parseInt(String.valueOf(data.get("position")));
BbWorkspaceCompoment compoment = new BbWorkspaceCompoment();
compoment.setCompId(id);
if (this.workspaceCompomentService.countByEntityUK(compoment) < 1) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
WorkspaceConfigVO configObj = new WorkspaceConfigVO();
configObj.setSpaceId(workspace.getSpaceId());
configObj.setCompId(id);
configObj.setPosition(position);
this.workspaceConfigService.saveObject(configObj);
}
for (int i = 0; labels != null && i < labels.size(); i++) {
Map<String, Object> data = labels.get(i);
String label = (String) data.get("label");
int position = Integer.parseInt(String.valueOf(data.get("position")));
if (StringUtils.isBlank(label)) {
label = " ";
}
WorkspaceLabelVO labelObj = new WorkspaceLabelVO();
labelObj.setSpaceId(workspace.getSpaceId());
labelObj.setLabel(label);
labelObj.setPosition(position);
this.workspaceLabelService.saveIgnoreUK(labelObj);
}
return result;
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class PerspectiveLogicServiceImpl method create.
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<PerspectiveVO> create(PerspectiveVO perspective, String visionOid) throws ServiceException, Exception {
if (null == perspective || super.isBlank(visionOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<VisionVO> vResult = this.visionService.findForSimple(visionOid);
if (vResult.getValue() == null) {
throw new ServiceException(vResult.getSystemMessage().getValue());
}
VisionVO vision = vResult.getValue();
perspective.setVisId(vision.getVisId());
if (!SimpleUtils.checkBeTrueOf_azAZ09(4, 14, perspective.getPerId())) {
// for import-mode from csv file PER_ID is old(before id).
perspective.setPerId(this.findForMaxPerId(SimpleUtils.getStrYMD("")));
}
this.setStringValueMaxLength(perspective, "description", MAX_DESCRIPTION_LENGTH);
return this.perspectiveService.saveObject(perspective);
}
use of com.netsteadfast.greenstep.base.model.ServiceMethodAuthority in project bamboobsc by billchen198318.
the class ReportRoleViewLogicServiceImpl method findForEmployeeMap.
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public Map<String, String> findForEmployeeMap(boolean pleaseSelect, String accountId) throws ServiceException, Exception {
if (super.isBlank(accountId)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
Map<String, String> dataMap = new LinkedHashMap<String, String>();
if (pleaseSelect) {
dataMap.put(Constants.HTML_SELECT_NO_SELECT_ID, Constants.HTML_SELECT_NO_SELECT_NAME);
}
List<TbUserRole> roles = this.getUserRoles(accountId);
for (int i = 0; roles != null && i < roles.size(); i++) {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("role", roles.get(i).getRole());
paramMap.put("type", ReportRoleViewTypes.IS_EMPLOYEE);
List<BbReportRoleView> views = this.reportRoleViewService.findListByParams(paramMap);
for (int j = 0; views != null && j < views.size(); j++) {
paramMap.clear();
paramMap.put("account", views.get(j).getIdName());
List<BbEmployee> employees = this.getEmployeeService().findListByParams(paramMap);
for (int e = 0; employees != null && e < employees.size(); e++) {
BbEmployee employee = employees.get(e);
if (dataMap.get(employee.getOid()) != null) {
continue;
}
dataMap.put(employee.getOid(), employee.getFullName());
}
}
}
return dataMap;
}
Aggregations