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;
}
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;
}
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);
}
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;
}
};
}
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;
}
Aggregations