| | |
| | | //管理员首页统计测试信息 |
| | | public Map<String, Integer> analysisTestData(List<BatttestdataInf> list) { |
| | | Map<String, Integer> map = new HashMap<>(); |
| | | int disNum = 0;//放电 |
| | | int chNum = 0;//充电 |
| | | /*int disNum = 0;//放电 |
| | | int chNum = 0;//充电*/ |
| | | int hrdisNum = 0;//核容放电 |
| | | int hrchNum = 0;//核容充电 |
| | | Map<Integer, List<BatttestdataInf>> listDisMap = list.stream().collect(Collectors.groupingBy(tinf -> tinf.getTestType())); |
| | | /*Map<Integer, List<BatttestdataInf>> listDisMap = list.stream().collect(Collectors.groupingBy(tinf -> tinf.getTestType())); |
| | | for (Integer dis : listDisMap.keySet()) { |
| | | //放电 |
| | | if (dis == 3) { |
| | |
| | | if (dis == 2) { |
| | | chNum = listDisMap.get(dis).size(); |
| | | } |
| | | } |
| | | }*/ |
| | | Map<String, List<BatttestdataInf>> listMap = list.stream().collect(Collectors.groupingBy(tinf -> tinf.getTestType() + "_" + tinf.getTestStarttype())); |
| | | for (String type : listMap.keySet()) { |
| | | //核容放电 |
| | | //核容放电(正常核容测试为前提,满足单体下限到,组端下限到,测试容量到,放电时间到且超过2小时的数据为一笔) |
| | | // and test_stoptype in (3, 4, 6) |
| | | // or (test_stoptype=2 and test_timelong>=7200) |
| | | if (type.equals("3_3")) { |
| | | hrdisNum = listMap.get(type).size(); |
| | | |
| | | for (BatttestdataInf tinf : listMap.get("3_3")) { |
| | | if ((tinf.getTestStoptype() == 3 || tinf.getTestStoptype() == 4 || tinf.getTestStoptype() == 6) || |
| | | (tinf.getTestStoptype() == 2 && tinf.getTestTimelong() >= 7200)) { |
| | | hrdisNum += 1; |
| | | } |
| | | } |
| | | } |
| | | //核容充电 |
| | | if (type.equals("2_3")) { |
| | |
| | | } |
| | | map.put("hrdisNum", hrdisNum); |
| | | map.put("hrchNum", hrchNum); |
| | | map.put("jcdisNum", disNum - hrdisNum); |
| | | map.put("jcchNum", chNum - hrchNum); |
| | | /* map.put("jcdisNum", disNum - hrdisNum); |
| | | map.put("jcchNum", chNum - hrchNum);*/ |
| | | return map; |
| | | } |
| | | |
| | |
| | | |
| | | <select id="getTestInfList" resultMap="Map_BatttestdataInf"> |
| | | <choose> |
| | | <!--充电,放电,在线监测--> |
| | | <!--充电,放电,在线监测(核容放电(正常核容测试为前提,满足单体下限到,组端下限到,测试容量到,放电时间到且超过2小时的数据为一笔) |
| | | // and test_stoptype in (3, 4, 6) |
| | | // or (test_stoptype=2 and test_timelong>=7200))--> |
| | | <when test="testType==2 or testType==3 or testType==9"> |
| | | SELECT |
| | | t.BattgroupId, |
| | |
| | | <when test="dischargeType==0||dischargeType==null"> |
| | | AND test_starttype != 100 |
| | | </when> |
| | | <when test="dischargeType==3 and testType==3"> |
| | | AND test_starttype =3 and (test_stoptype in (3, 4, 6) or (test_stoptype=2 and test_timelong>=7200)) |
| | | </when> |
| | | <otherwise> |
| | | AND test_starttype = #{dischargeType} |
| | | </otherwise> |
| | |
| | | group by stationId |
| | | </select> |
| | | <select id="selectMonth" resultType="com.whyc.pojo.BatttestdataInf"> |
| | | SELECT test_type, test_starttype |
| | | SELECT test_type, test_starttype, test_stoptype, test_timelong |
| | | From db_batt_testdata.tb_batttestdata_inf |
| | | where DATE_FORMAT(test_starttime, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m') |
| | | and BattGroupId in (select distinct db_battinf.tb_battinf.BattGroupId |
| | |
| | | and db_user.tb_user_inf.uid = #{userId}) |
| | | </select> |
| | | <select id="selectQuarter" resultType="com.whyc.pojo.BatttestdataInf"> |
| | | SELECT test_type, test_starttype |
| | | SELECT test_type, test_starttype, test_stoptype, test_timelong |
| | | From db_batt_testdata.tb_batttestdata_inf |
| | | where QUARTER(test_starttime) = QUARTER(NOW()) AND YEAR (test_starttime) = YEAR (NOW()) |
| | | and BattGroupId in ( |
| | |
| | | and db_user.tb_user_inf.uid = #{userId}) |
| | | </select> |
| | | <select id="selectYear" resultType="com.whyc.pojo.BatttestdataInf"> |
| | | SELECT test_type, test_starttype |
| | | SELECT test_type, test_starttype, test_stoptype, test_timelong |
| | | FROM db_batt_testdata.tb_batttestdata_inf |
| | | WHERE YEAR (test_starttime)= YEAR (NOW()) |
| | | and BattGroupId in (select distinct db_battinf.tb_battinf.BattGroupId |
| | |
| | | YEAR (test_starttime) = YEAR (NOW()) |
| | | and test_type=3 |
| | | and test_starttype=3 |
| | | and test_stoptype in (3, 4, 6) |
| | | or (test_stoptype=2 and test_timelong>=7200) |
| | | and (test_stoptype in (3, 4, 6) |
| | | or (test_stoptype=2 and test_timelong>=7200)) |
| | | and BattGroupId in ( |
| | | select distinct db_battinf.tb_battinf.BattGroupId |
| | | from db_battinf.tb_battinf |
| | |
| | | where tb_batttestdata_inf.BattGroupId = tb_battinf.BattGroupId |
| | | and test_starttype = 3 |
| | | and test_type = 3 |
| | | and test_stoptype in (2, 3, 4, 6) |
| | | and (test_stoptype in (3, 4, 6) |
| | | or (test_stoptype = 2 and test_timelong >= 7200)) |
| | | and YEAR ( |
| | | test_starttime) = YEAR (NOW()) |
| | | and tb_batttestdata_inf.battgroupid in ( |