Search in sources :

Example 6 with SysExpressionVO

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;
    }
}
Also used : SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 7 with SysExpressionVO

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);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 8 with SysExpressionVO

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);
}
Also used : HashMap(java.util.HashMap) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 9 with SysExpressionVO

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;
}
Also used : HashMap(java.util.HashMap) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 10 with SysExpressionVO

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);
}
Also used : HashMap(java.util.HashMap) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Aggregations

SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)19 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)8 HashMap (java.util.HashMap)6 SysExprJobVO (com.netsteadfast.greenstep.vo.SysExprJobVO)4 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)3 SysVO (com.netsteadfast.greenstep.vo.SysVO)3 Transactional (org.springframework.transaction.annotation.Transactional)3 ExpressionJobObj (com.netsteadfast.greenstep.model.ExpressionJobObj)2 TbSysExprJob (com.netsteadfast.greenstep.po.hbm.TbSysExprJob)2 TbSysExpression (com.netsteadfast.greenstep.po.hbm.TbSysExpression)2 ISysExprJobService (com.netsteadfast.greenstep.service.ISysExprJobService)2 ISysExpressionService (com.netsteadfast.greenstep.service.ISysExpressionService)2 SysBeanHelpVO (com.netsteadfast.greenstep.vo.SysBeanHelpVO)2 SysExprJobLogVO (com.netsteadfast.greenstep.vo.SysExprJobLogVO)2 LinkedHashMap (java.util.LinkedHashMap)2 TbSysBeanHelpExpr (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExpr)1 TbSysBeanHelpExprMap (com.netsteadfast.greenstep.po.hbm.TbSysBeanHelpExprMap)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1