Search in sources :

Example 6 with KVPair

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

the class TjsEnforcementManagerImpl method sumByDateAndAreaAndIndustryTypeAndDocument.

@Override
public Map<String, Object> sumByDateAndAreaAndIndustryTypeAndDocument(String startDate, String endDate, String industryType, String province, String city, String companyId) {
    List<KVPair> kvList = new ArrayList<>();
    kvList.add(new KVPair("现场检查记录", "XCJCJL"));
    kvList.add(new KVPair("现场处理措施决定书", "SJSJFK"));
    kvList.add(new KVPair("责令限期整改指令书", "ZLXQZGZLS"));
    kvList.add(new KVPair("强制措施决定书", "QZCZJDS"));
    kvList.add(new KVPair("整改复查意见书", "ZGFCYJS"));
    kvList.add(new KVPair("立案审批表", "LASPB"));
    kvList.add(new KVPair("询问笔录", "XWBL"));
    kvList.add(new KVPair("行政(当场)处罚决定书(单位)(份)", "XZDCCFJDSDW"));
    kvList.add(new KVPair("行政(当场)处罚决定书(个人)(份)", "XZDCCFJDSGR"));
    kvList.add(new KVPair("行政处罚决定书(单位)(份)", "XZCFJDSDW"));
    kvList.add(new KVPair("行政处罚决定书(个人)(份)", "XZCFJDSGR"));
    kvList.add(new KVPair("其他文书", "QTWS"));
    return this.sumByDateAndAreaAndIndustryTypeAndProperty(startDate, endDate, industryType, province, city, companyId, kvList);
}
Also used : KVPair(com.topcom.tjs.vo.KVPair)

Example 7 with KVPair

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

the class TjsEnforcementManagerImpl method countByEnforcet.

@Override
public List<Kv> countByEnforcet(String startDate, String endDate, String industryType, String province, String city) {
    String[] keyArray = new String[] { "死亡人数", "事故起数", "执法次数", "违法行为" };
    // 执法行为  违法行为
    // 死亡人数  事故起数
    String sqlAcc = "select DATE_FORMAT(happenedTime, '%Y') as 年,DATE_FORMAT(happenedTime, '%m') as 月,sum(deathNumber) as 死亡人数,count(1) as 事故起数 " + "from tjs_accident as t1 INNER JOIN tjs_special_company as t2 " + "ON " + "t1.companyId = t2.ID ";
    boolean flag = false;
    if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) {
        sqlAcc += " WHERE happenedTime BETWEEN '" + startDate + "' AND '" + endDate + "' ";
        flag = true;
    }
    if (StringUtils.isNotBlank(industryType)) {
        if (flag) {
            sqlAcc += " AND ";
        } else {
            sqlAcc += " WHERE ";
            flag = true;
        }
        sqlAcc += " t2.industryType= '" + industryType + "'";
    }
    if (StringUtils.isNotBlank(province)) {
        if (flag) {
            sqlAcc += " AND ";
        } else {
            sqlAcc += " WHERE ";
            flag = true;
        }
        sqlAcc += " t2.province='" + province + "'";
    }
    if (StringUtils.isNotBlank(city)) {
        if (flag) {
            sqlAcc += " AND ";
        } else {
            sqlAcc += " WHERE ";
        }
        sqlAcc += " t2.city='" + city + "'";
    }
    sqlAcc = sqlAcc + "group by 年,月";
    // sqlAcc = connectSqlString(startDate, endDate, industryType, province, city, "", sqlAcc);
    List<JSONObject> acc = jdbcTemplate.query(sqlAcc, RowMappers.tjsAccidentDeathnumberByTime());
    String sqlEnforcet = "select DATE_FORMAT(ZFJCJZSJ, '%Y') as 年," + "DATE_FORMAT(ZFJCJZSJ, '%m') as 月," + "sum(CCAQSCWFWGXWX) as 违法行为," + "sum(CCYBSGYHX) as 一般隐患," + "sum(CCZDSGYHX) as 重大隐患," + "sum(ZFWF) as 执法次数 " + "from t_enforcement as t1 INNER JOIN tjs_special_company as t2 " + "ON " + "t1.companyId = t2.ID ";
    sqlEnforcet = connectSqlString(startDate, endDate, industryType, province, city, "", sqlEnforcet);
    sqlEnforcet = sqlEnforcet + "group by 年,月 ";
    List<JSONObject> enforcet = jdbcTemplate.query(sqlEnforcet, RowMappers.tjsZfyhByTime());
    List<KVPair> deathNumberKV = new ArrayList<>();
    List<KVPair> accNumber = new ArrayList<>();
    List<KVPair> zhifa = new ArrayList<>();
    List<KVPair> weifa = new ArrayList<>();
    List<KVPair> ybyh = new ArrayList<>();
    List<KVPair> zdyh = new ArrayList<>();
    for (int i = 0; i < acc.size(); i++) {
        JSONObject jsonObject = acc.get(i);
        String key = jsonObject.get("年") + "-" + jsonObject.get("月");
        deathNumberKV.add(new KVPair(key, jsonObject.get("死亡人数").toString()));
        accNumber.add(new KVPair(key, jsonObject.get("事故起数").toString()));
    }
    for (int i = 0; i < enforcet.size(); i++) {
        JSONObject jsonObject = enforcet.get(i);
        String key = jsonObject.get("年") + "-" + jsonObject.get("月");
        zhifa.add(new KVPair(key, jsonObject.get("违法行为").toString()));
        weifa.add(new KVPair(key, jsonObject.get("执法次数").toString()));
        ybyh.add(new KVPair(key, jsonObject.get("一般隐患").toString()));
        zdyh.add(new KVPair(key, jsonObject.get("重大隐患").toString()));
    }
    List<Kv> kvList = new ArrayList<>();
    kvList.add(new Kv("死亡人数", deathNumberKV));
    kvList.add(new Kv("事故起数", accNumber));
    kvList.add(new Kv("违法行为", zhifa));
    kvList.add(new Kv("执法次数", weifa));
    kvList.add(new Kv("一般隐患", ybyh));
    kvList.add(new Kv("重大隐患", zdyh));
    return kvList;
}
Also used : JSONObject(net.sf.json.JSONObject) KVPair(com.topcom.tjs.vo.KVPair) Kv(com.topcom.tjs.vo.Kv)

Example 8 with KVPair

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

the class TjsEnforcementManagerImpl method sumByDateAndAreaAndIndustryTypeAndFine.

@Override
public Map<String, Object> sumByDateAndAreaAndIndustryTypeAndFine(String startDate, String endDate, String industryType, String province, String city, String companyId) {
    List<KVPair> kvList = new ArrayList<>();
    kvList.add(new KVPair("罚款额(万元)", "FKE"));
    kvList.add(new KVPair("实际收缴罚款(万元)", "SJSJFK"));
    kvList.add(new KVPair("查处一般事故隐患(项)", "CCYBSGYHX"));
    kvList.add(new KVPair("查处重大事故隐患(项)", "CCZDSGYHX"));
    kvList.add(new KVPair("查处安全生产违法违规行为(项)", "CCAQSCWFWGXWX"));
    kvList.add(new KVPair("已整改安全生产违法违规行为(项)", "YZGAQSCWFWGXW"));
    kvList.add(new KVPair("已整改一般事故隐患(项)", "YZGYBSGYH"));
    kvList.add(new KVPair("已整改重大事故隐患(项)", "YZGZDSGYH"));
    kvList.add(new KVPair("已整改重大事故隐患(项)", "YZGZDSGYH"));
    kvList.add(new KVPair("其中:挂牌督办项(项)", "GPDBX"));
    return this.sumByDateAndAreaAndIndustryTypeAndProperty(startDate, endDate, industryType, province, city, companyId, kvList);
}
Also used : KVPair(com.topcom.tjs.vo.KVPair)

Example 9 with KVPair

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

the class RowMappers method kvPairHatRowMapper.

public static RowMapper<KVPair> kvPairHatRowMapper() {
    return new RowMapper<KVPair>() {

        @Override
        public KVPair mapRow(ResultSet resultSet, int i) throws SQLException {
            KVPair kvPair = new KVPair();
            kvPair.setName(resultSet.getString("keyName"));
            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 10 with KVPair

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

the class TjsEnforcementController method countByCompany.

@ApiOperation("企业违法违规、隐患、整改、统计")
@RequestMapping(value = { "countByCompany" }, method = { RequestMethod.GET }, produces = { "application/json" })
@ResponseBody
public List<KVPair> countByCompany(@RequestParam Long companyId, @RequestParam String startDate, @RequestParam String endDate) {
    // TODO:可改为一次查询,避免多次
    Map<String, String> map = new HashMap();
    map.put("查处一般事故隐患(项)", "CCYBSGYHX");
    map.put("查处重大事故隐患(项)", "CCZDSGYHX");
    map.put("查处安全生产违法违规行为(项)", "CCAQSCWFWGXWX");
    map.put("已整改安全生产违法违规行为(项)", "YZGAQSCWFWGXW");
    map.put("已整改一般事故隐患(项)", "YZGYBSGYH");
    map.put("已整改重大事故隐患(项)", "YZGZDSGYH");
    List<KVPair> kvPairList = new ArrayList<>();
    Set<String> keySet = map.keySet();
    Iterator<String> iterator = keySet.iterator();
    while (iterator.hasNext()) {
        String key = iterator.next();
        String value = map.get(key);
        KVPair kvPair = tjsEnforcementManager.countByCompanyIdAndDateAndProperty(companyId, startDate, endDate, key, value);
        kvPairList.add(kvPair);
    }
    return kvPairList;
}
Also used : KVPair(com.topcom.tjs.vo.KVPair) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

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