whyclxw
2024-04-15 53a495d12ea68c34b40b8adee09ee98a39d9ba20
蓄电池组后评估
3个文件已修改
63 ■■■■■ 已修改文件
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BatttestdataInfMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BatttestdataInfMapper.java
@@ -21,7 +21,7 @@
    List<BatttestdataInf> searchDischargeTest(Integer battGroupId, Date recordStartTime, Date recordEndTime);
    //查往年的放电记录
    List<BatttestdataInf> searchDischargeTest_WJ(Integer battGroupId, Date recordStartTime, Date recordEndTime);
    List<BatttestdataInf> searchDischargeTest_WJ(Integer battGroupId, Date recordStartTime);
    //机房历史放电数据续航能力查询(实时)
    List<BattState> searchBattLifeNow(@Param("binf") Battinf binf);
@@ -81,9 +81,14 @@
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序(本年度)
    BatttestdataInf getGroupAnalysisQB(int BattGroupId);
    BatttestdataInf getGroupAnalysisQB_WJ(int BattGroupId,Date nowDateStart,Date nowDateEnd);
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度)
    BatttestdataInf getGroupAnalysisQBOld(int BattGroupId);
    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度)
    BatttestdataInf getGroupAnalysisQBOld_WJ(int BattGroupId,Date oldDate);
    //本年度上一次正常核容的放电记录编号
    BatttestdataInf searchHrYear(int battGroupId);
    //能效统计
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -17,6 +17,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.Year;
import java.util.*;
import java.util.stream.Collectors;
@@ -301,7 +302,7 @@
        Map<String, Object> map = new HashMap<>();
        if( list.size()==0){
            //查往年的放电记录
            list = mapper.searchDischargeTest_WJ(battGroupId, recordStartTime, recordEndTime);
            list = mapper.searchDischargeTest_WJ(battGroupId, recordStartTime);
            if( list.size()==0){
                map.put("wj", "N");
            }else{
@@ -756,6 +757,11 @@
                capAlarm = 0.8f;
                capChange = 0.6f;
            }
            //获取当前年
            int year = Year.now().getValue();
            Date nowDateStart=ThreadLocalUtil.parse(year+"-01-01 00:00:00",1);
            Date nowDateEnd=ThreadLocalUtil.parse(year+"-12-31 23:59:59",1);
            Date oldDate=ThreadLocalUtil.parse((year-1)+"-01-01 00:00:00",1);
            //小于capAlarm
            int alarmNum = 0;
            //小于capChange
@@ -788,9 +794,9 @@
                    int disNum = 0;
                    int olddisNum = 0;
                    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(本年度)
                    BatttestdataInf inf = mapper.getGroupAnalysisQB(battgroupId);
                    BatttestdataInf inf = mapper.getGroupAnalysisQB_WJ(battgroupId,nowDateStart,nowDateEnd);
                    //1.查出符合条件的电池组(核容数据)按照时间倒叙排序的第一个(上一年度)
                    BatttestdataInf oldinf = mapper.getGroupAnalysisQBOld(battgroupId);
                    BatttestdataInf oldinf = mapper.getGroupAnalysisQBOld_WJ(battgroupId,oldDate);
                    if (inf != null) {
                        disNum=1;
                        int hourRate = BattCapFactory.GetHourRate(monCapStd, inf.getTestCurr());
src/main/resources/mapper/BatttestdataInfMapper.xml
@@ -96,8 +96,8 @@
      <if test="battGroupId!=null">
        and battgroupid=#{battGroupId}
      </if>
      <if test="recordStartTime!=null and recordEndTime!=null">
        and record_time&lt;#{recordStartTime} and record_time>#{recordEndTime}
      <if test="recordStartTime!=null">
        and record_time&lt;#{recordStartTime}
      </if>
    </where>
    ORDER BY tb_batttestdata_inf.BattGroupId asc, test_starttime desc
@@ -572,6 +572,26 @@
      limit 1
  </select>
  <select id="getGroupAnalysisQB_WJ" 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 record_time>=#{nowDateStart} and record_time&lt;=#{nowDateEnd}
      and tb_batttestdata_inf.BattGroupId=#{battGroupId}
    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
@@ -591,6 +611,26 @@
    ORDER BY tb_batttestdata_inf.BattGroupId asc, test_starttime desc
      limit 1
  </select>
  <select id="getGroupAnalysisQBOld_WJ" 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 record_time&lt;#{oldDate}
      and tb_batttestdata_inf.BattGroupId=#{battGroupId}
    ORDER BY tb_batttestdata_inf.BattGroupId asc, test_starttime desc
      limit 1
  </select>
  <select id="getEnergyStatistics" resultType="GroupTestCapRes">
    SELECT DISTINCT
      stationId,IFNULL(test_starttime,0) as testStartTime,IFNULL(YEAR(test_starttime),0) AS yearTime