Search in sources :

Example 86 with ServiceMethodAuthority

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;
}
Also used : BusinessProcessManagementTaskVO(com.netsteadfast.greenstep.vo.BusinessProcessManagementTaskVO) SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) PdcaVO(com.netsteadfast.greenstep.vo.PdcaVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 87 with ServiceMethodAuthority

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;
}
Also used : SystemMessage(com.netsteadfast.greenstep.base.model.SystemMessage) SwotVO(com.netsteadfast.greenstep.vo.SwotVO) HashMap(java.util.HashMap) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) DefaultResult(com.netsteadfast.greenstep.base.model.DefaultResult) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 88 with ServiceMethodAuthority

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;
}
Also used : BbWorkspaceCompoment(com.netsteadfast.greenstep.po.hbm.BbWorkspaceCompoment) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) WorkspaceTemplateVO(com.netsteadfast.greenstep.vo.WorkspaceTemplateVO) WorkspaceVO(com.netsteadfast.greenstep.vo.WorkspaceVO) WorkspaceLabelVO(com.netsteadfast.greenstep.vo.WorkspaceLabelVO) List(java.util.List) WorkspaceConfigVO(com.netsteadfast.greenstep.vo.WorkspaceConfigVO) HashMap(java.util.HashMap) Map(java.util.Map) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 89 with ServiceMethodAuthority

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) VisionVO(com.netsteadfast.greenstep.vo.VisionVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 90 with ServiceMethodAuthority

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;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BbReportRoleView(com.netsteadfast.greenstep.po.hbm.BbReportRoleView) TbUserRole(com.netsteadfast.greenstep.po.hbm.TbUserRole) LinkedHashMap(java.util.LinkedHashMap) BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

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