whycxzp
2023-08-28 ee0934f03c4af4967d1bfaf5dfbfcd28d5203d93
5种充放电类型统计过滤
4个文件已修改
101 ■■■■■ 已修改文件
src/main/java/com/whyc/dto/BattTestDataDTO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BattTestDataInf2Service.java 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattTestDataInf2Mapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/dto/BattTestDataDTO.java
@@ -1,5 +1,6 @@
package com.whyc.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Date;
@@ -27,6 +28,9 @@
    private Integer dischargeType;
    private Long uId;
    private Integer jcDischargeFilterTime;
    private Integer jcChargeFilterTime;
    public String getStationName1() {
        return stationName1;
@@ -91,4 +95,20 @@
    public void setUId(Long uId) {
        this.uId = uId;
    }
    public Integer getJcDischargeFilterTime() {
        return jcDischargeFilterTime;
    }
    public void setJcDischargeFilterTime(Integer jcDischargeFilterTime) {
        this.jcDischargeFilterTime = jcDischargeFilterTime;
    }
    public Integer getJcChargeFilterTime() {
        return jcChargeFilterTime;
    }
    public void setJcChargeFilterTime(Integer jcChargeFilterTime) {
        this.jcChargeFilterTime = jcChargeFilterTime;
    }
}
src/main/java/com/whyc/service/BattTestDataInf2Service.java
@@ -55,6 +55,13 @@
    /*新版接口不包含内阻数据
     * */
    public PageInfo<BatttestdataInf> calcTestData(BattTestDataDTO paramDto, Integer pageNum, Integer pageSize) {
        //获取充放电时间过滤参数
        List<PageParam> pageParamList = pageParamService.getList2ByCategoryId(14);
        int jcDischargeFilterTime = pageParamList.get(2).getStatus() * 60;
        int jcChargeFilterTime = pageParamList.get(3).getStatus() * 60;
        paramDto.setJcDischargeFilterTime(jcDischargeFilterTime);
        paramDto.setJcChargeFilterTime(jcChargeFilterTime);
        List<BatttestdataInf> calcDataList = new LinkedList<>();
        //查询电池组 电池信息或者电导信息
        PageHelper.startPage(pageNum, pageSize, true);
@@ -83,58 +90,7 @@
            calcDataList.add(battTestDataInf);
        });
        //获取充放电时间过滤参数
        List<PageParam> pageParamList = pageParamService.getList2ByCategoryId(14);
        //过滤
        List<BatttestdataInf> finalDataList = calcDataList.stream().filter(data -> {
            Integer testType = data.getTestType();
            Integer testStarttype = data.getTestStarttype();
            Integer testDatatype = data.getTestDatatype();
            Integer testTimeLong = data.getTestTimelong();
            if (testType == 3) {
                // 测试类型为放电
                if (testStarttype == 3) {
                    //核容放电
                    if (testTimeLong >= pageParamList.get(0).getStatus() * 60) {
                        return true;
                    } else {
                        return false;
                    }
                } else {
                    if (testDatatype == 1) {
                        //停电放电
                        return true;
                    } else {
                        //监测放电
                        if (testTimeLong >= pageParamList.get(2).getStatus() * 60) {
                            return true;
                        } else {
                            return false;
                        }
                    }
                }
            } else if (testType == 2) {
                // 测试类型为充电
                if (testStarttype == 3) {
                    //核容充电
                    if (testTimeLong >= pageParamList.get(1).getStatus() * 60) {
                        return true;
                    } else {
                        return false;
                    }
                } else {
                    //监测充电
                    if (testTimeLong >= pageParamList.get(3).getStatus() * 60) {
                        return true;
                    } else {
                        return false;
                    }
                }
            } else {
                return true;
            }
        }).collect(Collectors.toList());
        pageInfo.setList(finalDataList);
        pageInfo.setList(calcDataList);
        return pageInfo;
    }
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -416,6 +416,7 @@
        }
    }*/
    public Map<String, Integer> analysisTestData(List<BatttestdataInf> list) {
        List<PageParam> pageParamList = pageParamService.getList2ByCategoryId(14);
        Map<String, Integer> map = new HashMap<>();
        int hrdisNum = 0;//核容放电
        int jcdisNum = 0;//监测放电
@@ -436,7 +437,9 @@
                            dddisNum += 1;
                        }
                        if (tinf.getTestDatatype() == 0) {
                            jcdisNum += 1;
                            if(tinf.getTestTimelong()>=pageParamList.get(2).getStatus()*60) {
                                jcdisNum += 1;
                            }
                        }
                    }
                } else if (tinf.getTestType() == 2) {
@@ -444,7 +447,9 @@
                    if (tinf.getTestStarttype() == 3) {
                        hrchNum += 1;
                    } else {
                        jcchNum += 1;
                        if(tinf.getTestTimelong()>=pageParamList.get(3).getStatus()*60) {
                            jcchNum += 1;
                        }
                    }
                }
            }
src/main/resources/mapper/BattTestDataInf2Mapper.xml
@@ -218,6 +218,14 @@
            </if>
            <!--类型:0-全部;1-核容放电;2-核容充电;3-监测放电;4-监测充电;5-停电放电
            test_datatype: 0:监测放电;1停电放电-->
            <if test="dischargeType==0">
                and (t.test_type = 3 AND test_starttype =3 and (test_stoptype in (3, 4, 6) or (test_stoptype=2 and
                test_timelong>=7200)))
                or (t.test_type = 2 AND test_starttype =3)
                or (t.test_type = 3 AND test_starttype !=3 AND test_datatype=0 and test_timelong >=#{jcDischargeFilterTime})
                or (t.test_type = 2 AND test_starttype !=3 and and test_timelong >=#{jcChargeFilterTime})
                or (t.test_type = 3 AND test_starttype !=3 AND test_datatype=1)
            </if>
            <if test="dischargeType==1">
                AND t.test_type = 3 AND test_starttype =3 and (test_stoptype in (3, 4, 6) or (test_stoptype=2 and
                test_timelong>=7200))
@@ -226,10 +234,10 @@
                AND t.test_type = 2 AND test_starttype =3
            </if>
            <if test="dischargeType==3">
                AND t.test_type = 3 AND test_starttype !=3 AND test_datatype=0
                AND t.test_type = 3 AND test_starttype !=3 AND test_datatype=0 and test_timelong >=#{jcDischargeFilterTime}
            </if>
            <if test="dischargeType==4">
                AND t.test_type = 2 AND test_starttype !=3
                AND t.test_type = 2 AND test_starttype !=3 and and test_timelong >=#{jcChargeFilterTime}
            </if>
            <if test="dischargeType==5">
                AND t.test_type = 3 AND test_starttype !=3 AND test_datatype=1