whyclxw
2024-01-05 9ee9f2e0e8b48ee09c0d2e184b3e23e7630bb6d7
领导层修改
3个文件已修改
94 ■■■■ 已修改文件
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -76,9 +76,12 @@
    List<BatttestdataInf> getGroupAnalysisZC(int userId);
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序(不要时间)
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序(本年度)
    BatttestdataInf getGroupAnalysisQB(int BattGroupId);
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度)
    BatttestdataInf getGroupAnalysisQBOld(int BattGroupId);
    //本年度上一次正常核容的放电记录编号
    BatttestdataInf searchHrYear(int battGroupId);
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -528,6 +528,17 @@
            int noHrDisNum = 0;
            //实际容量
            float cap = 0f;
            //去年的数据----------------
            //小于capAlarm
            int oldalarmNum = 0;
            //小于capChange
            int oldchangeNum = 0;
            //放电正常
            int oldgoodSum = 0;
            //未正常
            int oldnoHrDisNum = 0;
            //实际容量去年
            float oldcap = 0f;
            //0.查询所有的电池组
            List<Battinf> binfList = binfMapper.getBinfList(userId);
            if (binfList != null && binfList.size() > 0) {
@@ -537,19 +548,17 @@
                    float monVolstd = binf.getMonVolStd();
                    //放电次数
                    int disNum = 0;
                    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个
                    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(本年度)
                    BatttestdataInf inf = mapper.getGroupAnalysisQB(battgroupId);
                    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度)
                    BatttestdataInf oldinf = mapper.getGroupAnalysisQBOld(battgroupId);
                    if (inf != null) {
                        disNum = 1;
                        int hourRate = BattCapFactory.GetHourRate(monCapStd, inf.getTestCurr());
                        cap = (float) BattCapFactory.GetMonomerCap(monCapStd, hourRate, inf.getTestCap(), inf.getMaxMonvol(), inf.getMinMonvol(), monVolstd, BattCapFactory.CapType_Real);
                        /*float testcap = inf.getTestCap();
                        float maxMonvol = inf.getMaxMonvol();
                        float minMonvol = inf.getMinMonvol();
                        if (battgroupId == 1000145) {
                            System.out.println(battgroupId + " " + monCapStd + " " + hourRate + " " + testcap + " " + maxMonvol + " " + minMonvol + " " + monVolstd + " " + BattCapFactory.CapType_Real + " ");
                        }*/
                        int oldhourRate = BattCapFactory.GetHourRate(monCapStd, oldinf.getTestCurr());
                        oldcap = (float) BattCapFactory.GetMonomerCap(monCapStd, oldhourRate, oldinf.getTestCap(), oldinf.getMaxMonvol(), oldinf.getMinMonvol(), monVolstd, BattCapFactory.CapType_Real);
                    }
                    //查询电池告警(劣化:内阻过高重要,电压过低重要;损坏:内阻过高紧急,电压过低紧急)
                    List listALmSH = alarmDataMapper.getAlm(battgroupId, 3);
@@ -578,6 +587,31 @@
                    } else {
                        noHrDisNum += 1;
                    }
                    //去年-----------------的数据
                    //先判断是否损坏
                    if ((disNum != 0 && oldcap < capChange * monCapStd) || (listALmSH != null && listALmSH.size() > 0)) {
                        if (disNum == 0) {
                            oldnoHrDisNum += 1;
                        }
                       oldchangeNum = oldchangeNum + 1;
                    }//在判断是否劣化
                    else if (
                            (disNum != 0 && oldcap <= capAlarm * monCapStd && oldcap >= capChange * monCapStd
                            )
                                    || (listALmLH != null && listALmLH.size() > 0)) {
                        if (disNum == 0) {
                            oldnoHrDisNum += 1;
                        }
                        oldalarmNum = oldalarmNum + 1;
                    }//再判断是否放电正常
                    else if (disNum != 0 && oldcap > capAlarm * monCapStd) {
                        if (disNum == 0) {
                            oldnoHrDisNum += 1;
                        }
                        oldgoodSum = oldgoodSum + 1;
                    } else {
                        oldnoHrDisNum += 1;
                    }
                }
            }
            Map<String, Integer> numMap = new HashMap<>();
@@ -600,12 +634,29 @@
                6-组端电压下限到终止*/
            //int hrDisNum = mapper.getHrQuarterZC(userId);
            numMap.put("noHrDisNum", noHrDisNum);
            return new Response().setII(1, true, numMap, "蓄电池组优劣分析");
           //去年----------------------------统计
            Map<String, Integer> oldnumMap = new HashMap<>();
            oldnumMap.put("alarmNum", oldalarmNum);
            oldnumMap.put("changeNum", oldchangeNum);
            //总电池组(分类)
            oldnumMap.put("groupNum", groupNum);
            //蓄电池优良(已经放电数-告警数)
            oldnumMap.put("goodSum", oldgoodSum);
             /*本年度已核容放电电池组(testdate_inf中test_type=3,test_startType=3)
             int hrDisNum = testInfService.getHrQuarter(userId);
            * 修改为:领导层本年度已放数 仅需要统计放电正常停止的 正常停止的条件如下:
                stop_type:
                2-放电时间到终止并且放电时间超过2小时
                3-放电容量到终止
                4-单体电压下限到终止
                6-组端电压下限到终止*/
            oldnumMap.put("noHrDisNum", oldnoHrDisNum);
            return new Response().setIII(1, true, numMap,oldnumMap, "蓄电池组优劣分析");
        } catch (Exception e) {
            return new Response<>().set(1, false, "发生异常:" + e.getCause());
        }
    }
    //获取本年已核容放电电池组最新一次数据详情
    public Response getHrYeardisBattInfo() {
        int userId = Integer.parseInt(ActionUtil.getUser().getUId().toString());
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -552,4 +552,24 @@
    ORDER BY tb_batttestdata_inf.BattGroupId asc, test_starttime desc
      limit 1
  </select>
  <select id="getGroupAnalysisQBOld" resultType="batttestdataInf">
    select tb_batttestdata_inf.BattGroupId
         , test_curr
         , max_monvol
         , min_monvol
         , test_cap
         , test_starttime
         , test_timelong
         , test_stoptype
    from db_batt_testdata.tb_batttestdata_inf
    where db_batt_testdata.tb_batttestdata_inf.data_available = 1
      and test_type = 3
      and (test_stoptype in (3, 4, 6)
        or (test_stoptype = 2 and test_timelong >= 7200))
      and year(record_time)=year(date_sub(now(),interval 1 year))
      and tb_batttestdata_inf.BattGroupId=#{battGroupId}
    ORDER BY tb_batttestdata_inf.BattGroupId asc, test_starttime desc
      limit 1
  </select>
</mapper>