Search in sources :

Example 16 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemExpressionSaveOrUpdateAction method delete.

private void delete() throws ControllerException, AuthorityException, ServiceException, Exception {
    SysExpressionVO expression = new SysExpressionVO();
    this.transformFields2ValueObject(expression, new String[] { "oid" });
    DefaultResult<Boolean> result = this.systemExpressionLogicService.delete(expression);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null && result.getValue()) {
        this.success = IS_YES;
    }
}
Also used : SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 17 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class SystemExpressionSaveOrUpdateAction method updateContent.

private void updateContent() throws ControllerException, AuthorityException, ServiceException, Exception {
    String content = this.getFields().get("content");
    if (StringUtils.isBlank(content)) {
        super.throwMessage(this.getText("CORE_PROG003D0002A_exprId_msg2"));
    }
    if (content.length() > 8000) {
        super.throwMessage(this.getText("CORE_PROG003D0002A_exprId_msg3"));
    }
    SysExpressionVO expression = new SysExpressionVO();
    this.transformFields2ValueObject(expression, new String[] { "oid" });
    DefaultResult<SysExpressionVO> oldResult = this.sysExpressionService.findObjectByOid(expression);
    if (oldResult.getValue() == null) {
        throw new ServiceException(oldResult.getSystemMessage().getValue());
    }
    expression = oldResult.getValue();
    expression.setContent(content);
    DefaultResult<SysExpressionVO> result = this.sysExpressionService.updateObject(expression);
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() != null) {
        this.success = IS_YES;
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 18 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class BscReportSupportUtils method loadExpression.

public static void loadExpression(ThreadLocal<SysExpressionVO> exprThreadLocal, String exprId) throws ServiceException, Exception {
    if (exprThreadLocal.get() == null) {
        SysExpressionVO sysExpression = new SysExpressionVO();
        sysExpression.setExprId(exprId);
        DefaultResult<SysExpressionVO> result = sysExpressionService.findByUkCacheable(sysExpression);
        if (result.getValue() != null) {
            sysExpression = result.getValue();
            exprThreadLocal.set(sysExpression);
        }
    }
}
Also used : SysExpressionVO(com.netsteadfast.greenstep.vo.SysExpressionVO)

Example 19 with SysExpressionVO

use of com.netsteadfast.greenstep.vo.SysExpressionVO in project bamboobsc by billchen198318.

the class BscReportSupportUtils method getByteIconBase.

public static byte[] getByteIconBase(String mode, float target, float min, float score, String kpiCompareType, String kpiManagement, float kpiQuasiRange) throws Exception {
    byte[] datas = null;
    SysExpressionVO sysExpression = exprThreadLocal04.get();
    if (null == sysExpression) {
        return datas;
    }
    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);
    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)

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