whyclxw
6 天以前 9e00ddb22f97d49567aaea7a228a39f89cef71de
历史测试数据详情
3个文件已修改
38 ■■■■■ 已修改文件
src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataIdService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_batt_testdata/BatttestdataId.java
@@ -1,6 +1,7 @@
package com.whyc.pojo.db_batt_testdata;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -82,5 +83,12 @@
    @ApiModelProperty(value = "单体内阻")
    private Float monRes;
    @TableField(exist = false)
    private Float realCap;
    @TableField(exist = false)
    private Float restCap;
    @TableField(exist = false)
    private String percentCap;
}
src/main/java/com/whyc/service/BatttestdataIdService.java
@@ -1,8 +1,13 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.factory.BattCapFactory;
import com.whyc.mapper.BatttestdataInfMapper;
import com.whyc.mapper.CommonMapper;
import com.whyc.pojo.db_batt_testdata.BatttestdataId;
import com.whyc.pojo.db_batt_testdata.BatttestdataInf;
import com.whyc.pojo.db_station.BattInf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -16,6 +21,11 @@
    @Resource
    private CommonMapper commonMapper;
    @Autowired
    private BatttestdataInfService tinfService;
    @Autowired
    private BattInfService binfService;
    //找这次放电的指定的一笔数据
    public List<BatttestdataId> getLastDataByBattgroupId(Integer battgroupId, Integer testRecordCount, Integer recordNum) {
        List<BatttestdataId> list=subTablePageInfoService.getLastDataByBattgroupId(battgroupId,  testRecordCount, recordNum);
@@ -29,6 +39,18 @@
            return new Response().set(1,false,battgroupId+"电池组找不到第"+testRecordCount+"次放电记录");
        }
        List<BatttestdataId> list=subTablePageInfoService.getTinfDataWithTestRecordCount(tableName,testRecordCount,recordNum,granularity);
        //获取电池组信息
        BattInf binf = binfService.getBinfByBattgroupId(battgroupId);
        //获取这一次的放电信息
        BatttestdataInf tinf=tinfService.getTinfByTestRecordCount(battgroupId,testRecordCount);
        int hourRate = BattCapFactory.GetHourRate(tinf.getTestCap(), tinf.getTestCurr());
        for (BatttestdataId data:list) {
            Float realCap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(),data.getMonVol() , tinf.getGroupVol(), BattCapFactory.CapType_Real);
            Float restcap = (float) BattCapFactory.GetMonomerCap(tinf.getTestCap(), hourRate, tinf.getTestCap(), tinf.getMaxMonvol(), tinf.getMinMonvol(), tinf.getGroupVol(), BattCapFactory.CapType_Rest);
            data.setRealCap(realCap);
            data.setRestCap(restcap);
            data.setPercentCap(String.format("%.5f",(realCap/binf.getMoncapstd()*100)));
        }
        return new Response().setII(1,list.size()>0,list,"获取历史测试记录数据详情");
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -997,4 +997,12 @@
    public int getHrDisCount(Integer userId, Date startTime, Date endTime) {
        return mapper.getHrDisCount(userId, startTime, endTime);
    }
    //获取这一次的放电信息
    public BatttestdataInf getTinfByTestRecordCount(Integer battgroupId, Integer testRecordCount) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("battgroup_id",battgroupId);
        wrapper.eq("test_record_count",testRecordCount);
        wrapper.last(" limit 1");
        return mapper.selectOne(wrapper);
    }
}