Search in sources :

Example 1 with KVPair

use of com.topcom.tjs.vo.KVPair in project topcom-cloud by 545314690.

the class TjsAccidentManagerImpl method countByCFLB.

@Override
public List<KVPair> countByCFLB(String startDate, String endDate, String type, String province, String city, String industryType) {
    if (StringUtils.isBlank(type)) {
        type = "厅局级";
    }
    Map map = countByInperson(startDate, endDate, province, city, industryType);
    List<KVPair> result = new ArrayList<>();
    for (Object key : map.keySet()) {
        if (key.toString().contains(type.replaceAll("级", ""))) {
            result.add(new KVPair(key.toString(), String.valueOf(map.get(key))));
        }
    }
    return result;
}
Also used : KVPair(com.topcom.tjs.vo.KVPair)

Example 2 with KVPair

use of com.topcom.tjs.vo.KVPair in project topcom-cloud by 545314690.

the class TjsEnforcementManagerImpl method countByZFPZ.

@Override
public List<Kv> countByZFPZ(String startDate, String endDate, String industryType, String province, String city) {
    String sql = "select JFJCLB as name,count(1) as  value  from t_enforcement t1 INNER JOIN tjs_special_company t2 on t1.companyId=t2.ID ";
    sql = connectSqlString(startDate, endDate, industryType, province, city, "", sql);
    String sql_acc = sql + " and t2.id IN (SELECT companyId from tjs_accident acc GROUP BY companyId)  group by JFJCLB";
    String sql_not = sql + "and t2.id NOT IN (SELECT companyId from tjs_accident acc GROUP BY companyId)  group by JFJCLB";
    List<KVPair> accList = jdbcTemplate.query(sql_acc, RowMappers.kvPairRowMapper());
    List<KVPair> notList = jdbcTemplate.query(sql_acc, RowMappers.kvPairRowMapper());
    List<Kv> result = new ArrayList();
    result.add(new Kv("事故企业", accList));
    result.add(new Kv("非事故企业", notList));
    return result;
}
Also used : KVPair(com.topcom.tjs.vo.KVPair) Kv(com.topcom.tjs.vo.Kv)

Example 3 with KVPair

use of com.topcom.tjs.vo.KVPair in project topcom-cloud by 545314690.

the class TjsEnforcementManagerImpl method sumByDateAndAreaAndIndustryTypeAndProperty.

@Override
public Map<String, Object> sumByDateAndAreaAndIndustryTypeAndProperty(String startDate, String endDate, String industryType, String province, String city, String companyId, List<KVPair> kvPairList) {
    String sql = "select ";
    for (int i = 0; i < kvPairList.size(); i++) {
        KVPair kvPair = kvPairList.get(i);
        String name = kvPair.getName();
        String value = kvPair.getValue();
        sql += "sum(" + value + ") as '" + name + "'";
        if (i < kvPairList.size() - 1) {
            sql += " , ";
        }
    }
    sql += " FROM t_enforcement as t1 INNER JOIN tjs_special_company as t2 on t1.companyId=t2.id ";
    sql = connectSqlString(startDate, endDate, industryType, province, city, companyId, sql);
    return jdbcTemplate.queryForMap(sql);
}
Also used : KVPair(com.topcom.tjs.vo.KVPair)

Example 4 with KVPair

use of com.topcom.tjs.vo.KVPair in project topcom-cloud by 545314690.

the class RowMappers method kvPairRowMapper.

/**
 * kv 键值对RowMapper
 * @return
 */
public static RowMapper<KVPair> kvPairRowMapper() {
    return new RowMapper<KVPair>() {

        @Override
        public KVPair mapRow(ResultSet resultSet, int i) throws SQLException {
            KVPair kvPair = new KVPair();
            kvPair.setName(resultSet.getString("name"));
            kvPair.setValue(resultSet.getString("value"));
            return kvPair;
        }
    };
}
Also used : ResultSet(java.sql.ResultSet) KVPair(com.topcom.tjs.vo.KVPair) RowMapper(org.springframework.jdbc.core.RowMapper)

Example 5 with KVPair

use of com.topcom.tjs.vo.KVPair in project topcom-cloud by 545314690.

the class TjsAccidentManagerImpl method countByCFRY.

@Override
public List<KVPair> countByCFRY(String startDate, String endDate, String province, String city, String industryType) {
    List<KVPair> result = new ArrayList<>();
    Map<String, Long> resultMap = new HashMap<>();
    Map map = countByInperson(startDate, endDate, province, city, industryType);
    for (Object key : map.keySet()) {
        String JB = "";
        if (key.toString().contains("省")) {
            JB = "省部级";
        } else if (key.toString().contains("厅")) {
            JB = "厅局级";
        } else if (key.toString().contains("县")) {
            JB = "县处级";
        } else if (key.toString().contains("乡")) {
            JB = "乡科级";
        } else {
            JB = "其他";
        }
        if (resultMap.containsKey(JB)) {
            resultMap.put(JB, resultMap.get(JB) + Long.valueOf(map.get(key).toString()));
        } else {
            resultMap.put(JB, Long.valueOf(map.get(key).toString()));
        }
    }
    for (String key : resultMap.keySet()) {
        result.add(new KVPair(key, String.valueOf(resultMap.get(key))));
    }
    return result;
}
Also used : KVPair(com.topcom.tjs.vo.KVPair)

Aggregations

KVPair (com.topcom.tjs.vo.KVPair)10 Kv (com.topcom.tjs.vo.Kv)2 ResultSet (java.sql.ResultSet)2 RowMapper (org.springframework.jdbc.core.RowMapper)2 ApiOperation (io.swagger.annotations.ApiOperation)1 JSONObject (net.sf.json.JSONObject)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1