Search in sources :

Example 1 with TbSysCode

use of com.netsteadfast.greenstep.po.hbm.TbSysCode in project bamboobsc by billchen198318.

the class PdcaType method loadMapData.

private static void loadMapData() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("type", CODE_TYPE);
    Map<String, String> orderParams = new HashMap<String, String>();
    orderParams.put("code", "ASC");
    try {
        List<TbSysCode> codes = sysCodeService.findListByParams(params, null, orderParams);
        for (TbSysCode code : codes) {
            if (code.getCode().equals(PLAN_CODE)) {
                pdcaMap.put(PLAN, code.getName());
            }
            if (code.getCode().equals(DO_CODE)) {
                pdcaMap.put(DO, code.getName());
            }
            if (code.getCode().equals(CHECK_CODE)) {
                pdcaMap.put(CHECK, code.getName());
            }
            if (code.getCode().equals(ACTION_CODE)) {
                pdcaMap.put(ACTION, code.getName());
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 2 with TbSysCode

use of com.netsteadfast.greenstep.po.hbm.TbSysCode in project bamboobsc by billchen198318.

the class FormulaMode method loadReturnModeMapData.

private static void loadReturnModeMapData() {
    returnModeMap.clear();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("type", CODE_TYPE);
    Map<String, String> orderParams = new HashMap<String, String>();
    orderParams.put("code", "ASC");
    try {
        List<TbSysCode> codes = sysCodeService.findListByParams(params, null, orderParams);
        for (TbSysCode code : codes) {
            if (MODE_DEFAULT_CODE.equals(code.getCode())) {
                returnModeMap.put(MODE_DEFAULT, code.getName());
            }
            if (MODE_CUSTOM_CODE.equals(code.getCode())) {
                returnModeMap.put(MODE_CUSTOM, code.getName());
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    if (returnModeMap.size() != 2) {
        returnModeMap.clear();
        returnModeMap.put(MODE_DEFAULT, MODE_DEFAULT);
        returnModeMap.put(MODE_CUSTOM, MODE_CUSTOM);
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Example 3 with TbSysCode

use of com.netsteadfast.greenstep.po.hbm.TbSysCode in project bamboobsc by billchen198318.

the class ReportPropertySaveOrUpdateAction method updateSysCode.

private void updateSysCode(String code, String value) throws ServiceException, Exception {
    TbSysCode sysCode = new TbSysCode();
    sysCode.setCode(code);
    sysCode.setType(BscReportCode.CODE_TYPE);
    sysCode = this.sysCodeService.findByEntityUK(sysCode);
    if (null == sysCode || StringUtils.isBlank(sysCode.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    sysCode.setParam1(value);
    this.sysCodeService.update(sysCode);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode)

Example 4 with TbSysCode

use of com.netsteadfast.greenstep.po.hbm.TbSysCode in project bamboobsc by billchen198318.

the class SysMessageUtil method get.

public static String get(String code) {
    if (code == null || "".equals(code)) {
        return "";
    }
    if (sysMsgMap.get(code) != null) {
        return sysMsgMap.get(code);
    }
    init();
    if (jdbcTemplate == null) {
        return "";
    }
    String message = null;
    TbSysCode sysCode = new TbSysCode();
    sysCode.setCode(code);
    Map<String, Object> queryMap = getQuery(sysCode);
    if (queryMap == null) {
        return "";
    }
    try {
        message = jdbcTemplate.queryForObject(((String) queryMap.get(SqlGenerateUtil.RETURN_SQL)), (Object[]) queryMap.get(SqlGenerateUtil.RETURN_PARAMS), String.class);
        if (message != null) {
            sysMsgMap.put(code, message);
        }
    } catch (EmptyResultDataAccessException eda) {
        System.out.println(eda.getMessage().toString());
    } catch (Exception e) {
        e.printStackTrace();
    }
    return message == null ? code : message;
}
Also used : TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode) EmptyResultDataAccessException(org.springframework.dao.EmptyResultDataAccessException) EmptyResultDataAccessException(org.springframework.dao.EmptyResultDataAccessException)

Example 5 with TbSysCode

use of com.netsteadfast.greenstep.po.hbm.TbSysCode in project bamboobsc by billchen198318.

the class BscMeasureDataFrequency method loadMapData.

private static void loadMapData() {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("type", CODE_TYPE);
    Map<String, String> orderParams = new HashMap<String, String>();
    orderParams.put("code", "ASC");
    try {
        List<TbSysCode> codes = sysCodeService.findListByParams(params, null, orderParams);
        for (TbSysCode code : codes) {
            if (code.getCode().equals(FREQUENCY_DAY_CODE)) {
                frequencyMap.put(FREQUENCY_DAY, code.getName());
            }
            if (code.getCode().equals(FREQUENCY_WEEK_CODE)) {
                frequencyMap.put(FREQUENCY_WEEK, code.getName());
            }
            if (code.getCode().equals(FREQUENCY_MONTH_CODE)) {
                frequencyMap.put(FREQUENCY_MONTH, code.getName());
            }
            if (code.getCode().equals(FREQUENCY_QUARTER_CODE)) {
                frequencyMap.put(FREQUENCY_QUARTER, code.getName());
            }
            if (code.getCode().equals(FREQUENCY_HALF_OF_YEAR_CODE)) {
                frequencyMap.put(FREQUENCY_HALF_OF_YEAR, code.getName());
            }
            if (code.getCode().equals(FREQUENCY_YEAR_CODE)) {
                frequencyMap.put(FREQUENCY_YEAR, code.getName());
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) TbSysCode(com.netsteadfast.greenstep.po.hbm.TbSysCode) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException)

Aggregations

TbSysCode (com.netsteadfast.greenstep.po.hbm.TbSysCode)7 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)5 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 EmptyResultDataAccessException (org.springframework.dao.EmptyResultDataAccessException)1