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);
}
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;
}
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;
}
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;
}
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;
}
Aggregations