Search in sources :

Example 71 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class KpiSaveOrUpdateAction method checkMaxTargetMinCriteria.

private void checkMaxTargetMinCriteria(KpiVO kpi) throws ServiceException, ControllerException, Exception {
    /*
		 * 不一定是固定MAX>TARGET>MIN, 所以移到表達式中處理, 讓以後比較能客製化
		 * 
		if (kpi.getMax() <= kpi.getTarget()) {
			this.getFieldsId().add("max");
			this.getFieldsId().add("target");
			throw new ControllerException( this.getText("MESSAGE.BSC_PROG002D0004A_maxTargetMinCriteria_msg1") );			
		}
		if (kpi.getTarget() <= kpi.getMin()) {
			this.getFieldsId().add("target");
			this.getFieldsId().add("min");			
			throw new ControllerException( this.getText("MESSAGE.BSC_PROG002D0004A_maxTargetMinCriteria_msg2") );
		}
		*/
    SysExpressionVO expressionObj = new SysExpressionVO();
    expressionObj.setExprId("BSC_KPI_EXPR0003");
    DefaultResult<SysExpressionVO> exprResult = this.sysExpressionService.findByUK(expressionObj);
    if (exprResult.getValue() == null) {
        throw new ServiceException(exprResult.getSystemMessage().getValue());
    }
    expressionObj = exprResult.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("kpi", kpi);
    paramMap.put("fieldsId", this.getFieldsId());
    paramMap.put("fields", this.getFields());
    paramMap.put("fieldsMessage", this.getFieldsMessage());
    paramMap.put("msg1", this.getText("MESSAGE.BSC_PROG002D0004A_maxTargetMinCriteria_msg1"));
    paramMap.put("msg2", this.getText("MESSAGE.BSC_PROG002D0004A_maxTargetMinCriteria_msg2"));
    ScriptExpressionUtils.execute(expressionObj.getType(), expressionObj.getContent(), null, paramMap);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 72 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class WorkspaceUtils method getTemplateConfResource.

public static String getTemplateConfResource(String templateOid) throws ServiceException, Exception {
    if (StringUtils.isBlank(templateOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    WorkspaceTemplateVO template = new WorkspaceTemplateVO();
    template.setOid(templateOid);
    DefaultResult<WorkspaceTemplateVO> result = workspaceTemplateService.findObjectByOid(template);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    template = result.getValue();
    String content = TemplateUtils.getResourceSrc(WorkspaceUtils.class.getClassLoader(), RESOURCE_DIR + template.getResourceConf());
    if (StringUtils.isBlank(content)) {
        content = "";
    }
    return content;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) WorkspaceTemplateVO(com.netsteadfast.greenstep.vo.WorkspaceTemplateVO)

Example 73 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class WorkspaceUtils method getContent.

private static String getContent(String workspaceOid, boolean defaultMode, Map<String, Object> templateParameters) throws ServiceException, Exception {
    if (StringUtils.isBlank(workspaceOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    WorkspaceVO workspace = new WorkspaceVO();
    workspace.setOid(workspaceOid);
    DefaultResult<WorkspaceVO> result = workspaceService.findObjectByOid(workspace);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    workspace = result.getValue();
    if (defaultMode) {
        // for default mode need title
        templateParameters.put("title", workspace.getName());
    }
    WorkspaceTemplateVO template = new WorkspaceTemplateVO();
    template.setTemplateId(workspace.getTemplateId());
    DefaultResult<WorkspaceTemplateVO> wtResult = workspaceTemplateService.findByUK(template);
    if (wtResult.getValue() == null) {
        throw new ServiceException(wtResult.getSystemMessage().getValue());
    }
    template = wtResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("spaceId", workspace.getSpaceId());
    List<BbWorkspaceConfig> configs = workspaceConfigService.findListByParams(params);
    String content = TemplateUtils.processTemplate("resourceTemplate", WorkspaceUtils.class.getClassLoader(), RESOURCE_DIR + template.getResource(), fillTemplateParameters(template, configs, defaultMode, templateParameters));
    if (StringUtils.isBlank(content)) {
        content = "";
    }
    return content;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) WorkspaceTemplateVO(com.netsteadfast.greenstep.vo.WorkspaceTemplateVO) HashMap(java.util.HashMap) WorkspaceVO(com.netsteadfast.greenstep.vo.WorkspaceVO) BbWorkspaceConfig(com.netsteadfast.greenstep.po.hbm.BbWorkspaceConfig)

Example 74 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class DegreeFeedbackProjectScoreSaveOrUpdateAction method fetchScores.

private void fetchScores() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields("fetch");
    BbEmployee rater = this.employeeService.findByAccountOid(this.getAccountOid());
    if (null == rater || StringUtils.isBlank(rater.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    BbEmployee owner = this.employeeService.findByPKng(this.getFields().get("ownerOid"));
    if (null == owner || StringUtils.isBlank(owner.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_NO_EXIST));
    }
    String projectOid = this.getFields().get("projectOid");
    DegreeFeedbackAssignVO assing = new DegreeFeedbackAssignVO();
    assing.setProjectOid(projectOid);
    assing.setOwnerId(owner.getEmpId());
    assing.setRaterId(rater.getEmpId());
    DefaultResult<DegreeFeedbackAssignVO> result = this.degreeFeedbackAssignService.findByUK(assing);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    assing = result.getValue();
    Map<String, Object> paramMap = new HashMap<String, Object>();
    paramMap.put("assignOid", assing.getOid());
    paramMap.put("projectOid", projectOid);
    this.projectScores = this.degreeFeedbackScoreService.findListVOByParams(paramMap);
    paramMap.clear();
    paramMap.put("projectOid", projectOid);
    this.projectLevels = this.degreeFeedbackLevelService.findListVOByParams(paramMap);
    paramMap.clear();
    BbDegreeFeedbackLevel minLevel = this.degreeFeedbackLevelService.findForMinByProject(projectOid);
    if (minLevel != null) {
        this.minLevelOid = minLevel.getOid();
    }
    this.success = IS_YES;
}
Also used : BbEmployee(com.netsteadfast.greenstep.po.hbm.BbEmployee) DegreeFeedbackAssignVO(com.netsteadfast.greenstep.vo.DegreeFeedbackAssignVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) BbDegreeFeedbackLevel(com.netsteadfast.greenstep.po.hbm.BbDegreeFeedbackLevel)

Example 75 with ServiceException

use of com.netsteadfast.greenstep.base.exception.ServiceException in project bamboobsc by billchen198318.

the class DepartmentReportContentQueryAction method getChainContext.

@SuppressWarnings("unchecked")
private Context getChainContext() throws Exception {
    Context context = new ContextBase();
    context.put("visionOid", this.getFields().get("visionOid"));
    context.put("frequency", this.getFields().get("frequency"));
    context.put("startYearDate", this.getFields().get("year"));
    context.put("endYearDate", this.getFields().get("year"));
    context.put("dateType", this.getFields().get("dateType"));
    context.put("dataFor", BscConstants.MEASURE_DATA_FOR_ORGANIZATION);
    OrganizationVO organization = new OrganizationVO();
    organization.setOid(this.getFields().get("organizationOid"));
    DefaultResult<OrganizationVO> result = this.organizationService.findObjectByOid(organization);
    if (result.getValue() == null) {
        throw new ServiceException(result.getSystemMessage().getValue());
    }
    organization = result.getValue();
    context.put("empId", BscConstants.MEASURE_DATA_EMPLOYEE_FULL);
    context.put("orgId", organization.getOrgId());
    context.put("uploadSignatureOid", this.getFields().get("uploadSignatureOid"));
    return context;
}
Also used : Context(org.apache.commons.chain.Context) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) OrganizationVO(com.netsteadfast.greenstep.vo.OrganizationVO) ContextBase(org.apache.commons.chain.impl.ContextBase)

Aggregations

ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)291 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)91 Transactional (org.springframework.transaction.annotation.Transactional)89 HashMap (java.util.HashMap)65 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)49 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)48 SysVO (com.netsteadfast.greenstep.vo.SysVO)30 IOException (java.io.IOException)24 VisionVO (com.netsteadfast.greenstep.vo.VisionVO)20 EmployeeVO (com.netsteadfast.greenstep.vo.EmployeeVO)19 List (java.util.List)19 Map (java.util.Map)19 ArrayList (java.util.ArrayList)17 LinkedHashMap (java.util.LinkedHashMap)17 OrganizationVO (com.netsteadfast.greenstep.vo.OrganizationVO)16 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)15 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)15 SysUploadVO (com.netsteadfast.greenstep.vo.SysUploadVO)14 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)13 AccountVO (com.netsteadfast.greenstep.vo.AccountVO)12