use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.
the class SystemExpressionSaveOrUpdateAction method update.
private void update() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields();
SysExpressionVO expression = new SysExpressionVO();
this.transformFields2ValueObject(expression, new String[] { "oid", "exprId", "type", "name", "content", "description" });
DefaultResult<SysExpressionVO> result = this.systemExpressionLogicService.update(expression);
this.message = result.getSystemMessage().getValue();
if (result.getValue() != null) {
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysExpressionVO 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.vo.SysExpressionVO in project bamboobsc by billchen198318.
the class BscReportSupportUtils method getUrlIconBase.
public static String getUrlIconBase(String mode, float target, float min, float score, String kpiCompareType, String kpiManagement, float kpiQuasiRange) throws Exception {
String icon = "";
SysExpressionVO sysExpression = exprThreadLocal03.get();
if (null == sysExpression) {
return icon;
}
Map<String, Object> parameters = new HashMap<String, Object>();
Map<String, Object> results = new HashMap<String, Object>();
parameters.put("mode", mode);
parameters.put("target", target);
parameters.put("min", min);
parameters.put("score", score);
parameters.put("compareType", kpiCompareType);
parameters.put("management", kpiManagement);
parameters.put("quasiRange", kpiQuasiRange);
results.put("icon", " ");
ScriptExpressionUtils.execute(sysExpression.getType(), sysExpression.getContent(), results, parameters);
icon = (String) results.get("icon");
return StringUtils.defaultString(icon);
}
use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.
the class BscReportSupportUtils method getByteIcon.
public static byte[] getByteIcon(KpiVO kpi, float score) throws Exception {
byte[] datas = null;
SysExpressionVO sysExpression = exprThreadLocal02.get();
if (null == sysExpression) {
return datas;
}
Map<String, Object> parameters = new HashMap<String, Object>();
Map<String, Object> results = new HashMap<String, Object>();
parameters.put("kpi", kpi);
parameters.put("score", score);
results.put("icon", " ");
ScriptExpressionUtils.execute(sysExpression.getType(), sysExpression.getContent(), results, parameters);
String iconResource = (String) results.get("icon");
ClassLoader classLoader = BscReportSupportUtils.class.getClassLoader();
datas = IOUtils.toByteArray(classLoader.getResource(iconResource).openStream());
return datas;
}
use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.
the class BscReportSupportUtils method getUrlIcon.
public static String getUrlIcon(KpiVO kpi, float score) throws Exception {
String icon = "";
SysExpressionVO sysExpression = exprThreadLocal01.get();
if (null == sysExpression) {
return icon;
}
Map<String, Object> parameters = new HashMap<String, Object>();
Map<String, Object> results = new HashMap<String, Object>();
parameters.put("kpi", kpi);
parameters.put("score", score);
results.put("icon", " ");
ScriptExpressionUtils.execute(sysExpression.getType(), sysExpression.getContent(), results, parameters);
icon = (String) results.get("icon");
return StringUtils.defaultString(icon);
}
Aggregations