lxw
2023-07-25 83f444474e3cbe076b805e5de1cc32b1b263bcaf
本年度蓄电池优劣分析修改
3个文件已修改
44 ■■■■■ 已修改文件
src/main/java/com/whyc/service/BatttestdataInfService.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattTestDataInf2Mapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -332,11 +332,11 @@
    //管理员首页统计测试信息
    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) {
@@ -346,13 +346,19 @@
            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")) {
@@ -361,8 +367,8 @@
        }
        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;
    }
src/main/resources/mapper/BattTestDataInf2Mapper.xml
@@ -31,7 +31,9 @@
    <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,
@@ -148,6 +150,9 @@
            <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>
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -223,7 +223,7 @@
    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
@@ -239,7 +239,7 @@
                            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 (
@@ -256,7 +256,7 @@
      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
@@ -313,8 +313,8 @@
      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
@@ -495,7 +495,8 @@
    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 (