9个文件已修改
2个文件已添加
243 ■■■■■ 已修改文件
PlateFormFile/直流电源智慧平台需求规格书2.0.docx 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/constant/AnalysisEnum.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/BattCompareController.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/RealContoller.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_param/AlmAnalysisParam.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/pojo/db_param/AlmSummaryParam.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/AlmAnalysisParamService.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/BatttestdataInfService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/PwrdevHistorydataIdService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/SubTablePageInfoService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PlateFormFile/Ö±Á÷µçÔ´ÖÇ»ÛÆ½Ì¨ÐèÇ󹿏ñÊé2.0.docx
Binary files differ
src/main/java/com/whyc/constant/AnalysisEnum.java
New file
@@ -0,0 +1,49 @@
package com.whyc.constant;
import java.util.HashMap;
import java.util.Map;
public enum AnalysisEnum {
    ALARM_1(1,"直流电源"),
    ALARM_2(2,"通信电源"),
    ALARM_3(3,"配网电源"),
    ALARM_4(4,"蓄电池组"),
    ALARM_5(5,"设备"),
    ALARM_6(6,"ups电源"),
    ;
    private Integer stateId;
    private String stateName;
    AnalysisEnum(Integer stateId, String stateName) {
        this.stateId = stateId;
        this.stateName = stateName;
    }
    public Integer getStateId() {
        return stateId;
    }
    public String getStateName() {
        return stateName;
    }
    public static String getValue(Integer stateId) {
        if(stateId==null){
            return "";
        }
        for (AnalysisEnum ele : values()) {
            if(ele.getStateId().equals(stateId)) {
                return ele.getStateName();
            }
        }
        return null;
    }
    public static Map<Integer,String> getOpInfo() {
        Map<Integer,String> map=new HashMap<>();
        for (AnalysisEnum logOpEnum : AnalysisEnum.values()) {
            map.put(logOpEnum.getStateId(),logOpEnum.getStateName());
        }
        return map;
    }
}
src/main/java/com/whyc/controller/BattCompareController.java
New file
@@ -0,0 +1,48 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.dto.Statistic.BattCompareStic;
import com.whyc.pojo.db_user.User;
import com.whyc.service.BatttestdataInfService;
import com.whyc.util.ActionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "蓄电池对比分析管理")
@RequestMapping("compare")
public class BattCompareController {
    @Autowired
    private BatttestdataInfService battTinfService;
    @ApiOperation(value = "蓄电池组对比分析界面(同一品牌同一时间)(1.2.15)")
    @PostMapping("getBattCompare15Statistic")
    public Response getBattCompare15Statistic(@RequestBody BattCompareStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getBattCompare15Statistic(stic);
    }
    @ApiOperation(value = "蓄电池组对比分析界面(不同品牌同一时间)(1.2.16)")
    @PostMapping("getBattCompare16Statistic")
    public Response getBattCompare16Statistic(@RequestBody BattCompareStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getBattCompare16Statistic(stic);
    }
    @ApiOperation(value = "蓄电池组对比分析界面(同一品牌不同时间)(1.2.17)")
    @PostMapping("getBattCompare17Statistic")
    public Response getBattCompare17Statistic(@RequestBody BattCompareStic stic){
        User uinf= ActionUtil.getUser();
        stic.setUid(uinf.getId());
        return battTinfService.getBattCompare17Statistic(stic);
    }
}
src/main/java/com/whyc/controller/RealContoller.java
@@ -62,10 +62,16 @@
        return tdataIdService.getTinfDataWithTestRecordCount(battgroupId,testRecordCount,recordNum,granularity);
    }
    @ApiOperation(value = "历史实时查询")
    @ApiOperation(value = "电池历史实时查询")
    @GetMapping("getBattRealDataHis")
    public Response getBattRealDataHis(@RequestParam Integer battgroupId,@RequestParam Integer granularity
            ,@RequestParam String startTime,@RequestParam String  endTime) throws ParseException, InterruptedException {
        return battRealdataIdService.getBattRealDataHis(battgroupId,granularity,startTime,endTime);
    }
    @ApiOperation(value = "电源历史实时查询")
    @GetMapping("getPwrRealDataHis")
    public Response getPwrRealDataHis(@RequestParam Integer powerId,@RequestParam Integer granularity
            ,@RequestParam String startTime,@RequestParam String  endTime) throws ParseException, InterruptedException {
        return pwrdevHistorydataIdService.getPwrRealDataHis(powerId,granularity,startTime,endTime);
    }
}
src/main/java/com/whyc/pojo/db_param/AlmAnalysisParam.java
@@ -1,6 +1,7 @@
package com.whyc.pojo.db_param;
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;
@@ -41,11 +42,17 @@
    @ApiModelProperty(value = "主字段类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer mainFieldType;
    @TableField(exist = false)
    private String mainFieldTypeName;
    @ApiModelProperty(value = "次要字段1参考配置")
    private String minorField1;
    @ApiModelProperty(value = "字段1类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer minorField1Type;
    @TableField(exist = false)
    private String minorField1TypeName;
    @ApiModelProperty(value = "次要字段2参考配置")
    private String minorField2;
@@ -53,17 +60,26 @@
    @ApiModelProperty(value = "字段2类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer minorField2Type;
    @TableField(exist = false)
    private String minorField2TypeName;
    @ApiModelProperty(value = "次要字段3参考配置")
    private String minorField3;
    @ApiModelProperty(value = "字段3类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer minorField3Type;
    @TableField(exist = false)
    private String minorField3TypeName;
    @ApiModelProperty(value = "次要字段4参考配置")
    private String minorField4;
    @ApiModelProperty(value = "字段4类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer minorField4Type;
    @TableField(exist = false)
    private String minorField4TypeName;
}
src/main/java/com/whyc/pojo/db_param/AlmSummaryParam.java
@@ -1,6 +1,7 @@
package com.whyc.pojo.db_param;
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;
@@ -35,6 +36,10 @@
    @ApiModelProperty(value = "字段类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    private Integer fieldType;
    @ApiModelProperty(value = "字段类型[1:直流,2:通信,3配网  4:电池 5:设备]")
    @TableField(exist = false)
    private String fieldTypeName;
    @ApiModelProperty(value = "字段属性")
    private String fieldName;
src/main/java/com/whyc/service/AlmAnalysisParamService.java
@@ -1,6 +1,7 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.constant.AnalysisEnum;
import com.whyc.dto.AnalysisAlm.AnalysisChangeRes;
import com.whyc.dto.AnalysisAlm.ResAnalysis;
import com.whyc.dto.Real.RealDateDTO;
@@ -47,6 +48,13 @@
        wrapper.eq("alm_id",almId);
        wrapper.last("limit 1");
        AlmAnalysisParam param= mapper.selectOne(wrapper);
        if(param!=null){
            param.setMainFieldTypeName(AnalysisEnum.getValue(param.getMainFieldType()));
            param.setMinorField1TypeName(AnalysisEnum.getValue(param.getMinorField1Type()));
            param.setMinorField2TypeName(AnalysisEnum.getValue(param.getMinorField2Type()));
            param.setMinorField3TypeName(AnalysisEnum.getValue(param.getMinorField3Type()));
            param.setMinorField4TypeName(AnalysisEnum.getValue(param.getMinorField4Type()));
        }
        return param;
    }
@@ -67,6 +75,7 @@
        if(almAnalysisParam==null||almAnalysisParam.getMainFieldType()==null){
            return new Response().set(1,false,"无对应分析属性");
        }else{
            //分组查看需要查询电源/电池实时表的哪些数据
            Map<String,  Map<String,Object>> groupmap=groupPwrAndBatt(almAnalysisParam);
            Map<String,Object> battMap=groupmap.get("batt");
@@ -86,7 +95,7 @@
                    map.put("pwr",pwrHislist);
                }
            }
            return new Response().setIII(1,true, map,mainMap,"预警分析管理-电源主属性和分析属性");
            return new Response().setIIII(1,true, map,mainMap,almAnalysisParam,"预警分析管理-电源主属性和分析属性");
        }
    }
    //分组查看需要查询电源/电池实时表的哪些数据
@@ -243,7 +252,7 @@
                map.put("pwr",pwrHislist);
            }
        }
        return new Response().setIII(1,true, map,mainMap,"预警分析管理-切换时间间隔和副属性");
        return new Response().setIIII(1,true, map,mainMap,almAnalysisParam,"预警分析管理-切换时间间隔和副属性");
    }
    //将属性拷贝至almAnalysisParam中
    private void copyProperties(AlmAnalysisParam almAnalysisParam, AnalysisChangeRes res) {
@@ -262,6 +271,9 @@
    public Response getAlmSummaryParam() {
        //总的属性配置
        List<AlmSummaryParam> summaryList=summaryParamService.getInfo();
        summaryList.forEach(item->{
            item.setFieldTypeName(AnalysisEnum.getValue(item.getFieldType()));
        });
        return new Response().setII(1,true,summaryList,"预警分析管理-查询所有的属性对应关系");
    }
}
src/main/java/com/whyc/service/BatttestdataInfService.java
@@ -278,7 +278,6 @@
                if(param.getParamNamePsx().equals("batt_mon_damage_val")){
                    damageValue=param.getParamValue();
                }
            }
        }
        //1查询符合条件的电池组
src/main/java/com/whyc/service/PwrdevHistorydataIdService.java
@@ -261,4 +261,44 @@
            return PwrCapperformanceEnum.PWRSTATE_4.getStateId();
        }
    }
    //电源历史实时查询
    public Response getPwrRealDataHis(Integer powerId, Integer granularity, String startTime, String endTime) throws InterruptedException, ParseException {
        //获取两个时间分割多少张表
        List<List<Date>> monthTimeList = DateUtil.getMonthTime(ThreadLocalUtil.parse(startTime,1),ThreadLocalUtil.parse(endTime,1));
        List<PwrHisRealDcoutInDto> dataList = new LinkedList<>();
        ThreadPoolExecutor pool = ThreadPoolExecutorFactory.getPoolExecutor();
        CountDownLatch latch = new CountDownLatch(monthTimeList.size());
        for (int i = 0; i < monthTimeList.size(); i++) {
            int finalI = i;
            Integer finalGranularity = granularity;
            pool.execute(() -> {
                int finalII = finalI;
                Date recordDatetime=monthTimeList.get(finalII).get(0);
                Date recordDatetime1=monthTimeList.get(finalII).get(1);
                String table = powerId + "_" + ThreadLocalUtil.format(recordDatetime,2);
                String tableName="db_data_history.tb_pwrdev_historydata_"+table;
                //判断表是否存在
                int tableNum = subTablePageInfoService.judgeTable_pwrhis(table);
                List<PwrHisRealDcoutInDto> list = new ArrayList();
                if (tableNum > 0) {
                    //获取指定时间段内最大最小recordNum确保数据的完整
                    List recordNums= subTablePageInfoService.getPwrMaxAndMinRecordNum(tableName,recordDatetime,recordDatetime1);
                    Integer maxRecordNum= 0;
                    Integer minRecordNum= 0;
                    if(recordNums.size()>0){
                        maxRecordNum=(Integer)recordNums.get(0);
                        minRecordNum=(Integer)recordNums.get(1);
                    }
                    list=subTablePageInfoService.getPwrRealDataHis(tableName, finalGranularity,recordDatetime,recordDatetime1,maxRecordNum,minRecordNum);
                }
                dataList.addAll(list);
                latch.countDown();
            });
            sleep(200);
        }
        latch.await(10, TimeUnit.MINUTES);
        List dataListSorted = dataList.stream().sorted(Comparator.comparing(PwrHisRealDcoutInDto::getRecordDatetime)).collect(Collectors.toList());
        return new Response().setII(1,dataList.size()>0,dataListSorted,"获取半小时内直流输出统计");
    }
}
src/main/java/com/whyc/service/SubTablePageInfoService.java
@@ -680,6 +680,60 @@
        });
        return list;
    }
    //电源历史实时
    public List<PwrHisRealDcoutInDto> getPwrRealDataHis(String tableName,Integer granularity,Date recordDatetime,Date recordDatetime1,Integer maxRecordNum,Integer minRecordNum) {
        String sql="select  distinct * " +
                " from "+tableName+" where record_datetime>='"+ActionUtil.sdf.format(recordDatetime)+"'" +
                "                    and record_datetime<='"+ActionUtil.sdf.format(recordDatetime1)+
                "' and (record_num-"+minRecordNum+")%"+granularity+"=0 or record_num="+minRecordNum+" or record_num="+maxRecordNum;
        sql+=" order by record_datetime asc";
        List<PwrHisRealDcoutInDto> list = sqlExecuteService.executeQuery_call(sql, new CallBack() {
            @Override
            public List getResults(ResultSet rs) throws SQLException {
                List<PwrHisRealDcoutInDto> list=new ArrayList<>();
                while (rs.next()){
                    PwrHisRealDcoutInDto data=new PwrHisRealDcoutInDto();
                    data.setRecordDatetime(rs.getTimestamp("record_datetime"));
                    data.setMOutputvol(rs.getFloat("m_outputvol"));
                    data.setM1Outcurr(rs.getFloat("m1_outcurr"));
                    data.setM2Outcurr(rs.getFloat("m2_outcurr"));
                    data.setM3Outcurr(rs.getFloat("m3_outcurr"));
                    data.setM4Outcurr(rs.getFloat("m4_outcurr"));
                    data.setM5Outcurr(rs.getFloat("m5_outcurr"));
                    data.setM6Outcurr(rs.getFloat("m6_outcurr"));
                    data.setM7Outcurr(rs.getFloat("m7_outcurr"));
                    data.setM8Outcurr(rs.getFloat("m8_outcurr"));
                    data.setM9Outcurr(rs.getFloat("m9_outcurr"));
                    data.setM10Outcurr(rs.getFloat("m10_outcurr"));
                    data.setM11Outcurr(rs.getFloat("m11_outcurr"));
                    data.setM12Outcurr(rs.getFloat("m12_outcurr"));
                    data.setM13Outcurr(rs.getFloat("m13_outcurr"));
                    data.setM14Outcurr(rs.getFloat("m14_outcurr"));
                    data.setM15Outcurr(rs.getFloat("m15_outcurr"));
                    data.setM16Outcurr(rs.getFloat("m16_outcurr"));
                    data.setM1OutVol(rs.getFloat("m1_out_vol"));
                    data.setM2OutVol(rs.getFloat("m2_out_vol"));
                    data.setM3OutVol(rs.getFloat("m3_out_vol"));
                    data.setM4OutVol(rs.getFloat("m4_out_vol"));
                    data.setM5OutVol(rs.getFloat("m5_out_vol"));
                    data.setM6OutVol(rs.getFloat("m6_out_vol"));
                    data.setM7OutVol(rs.getFloat("m7_out_vol"));
                    data.setM8OutVol(rs.getFloat("m8_out_vol"));
                    data.setM9OutVol(rs.getFloat("m9_out_vol"));
                    data.setM10OutVol(rs.getFloat("m10_out_vol"));
                    data.setM11OutVol(rs.getFloat("m11_out_vol"));
                    data.setM12OutVol(rs.getFloat("m12_out_vol"));
                    data.setM13OutVol(rs.getFloat("m13_out_vol"));
                    data.setM14OutVol(rs.getFloat("m14_out_vol"));
                    data.setM15OutVol(rs.getFloat("m15_out_vol"));
                    data.setM16OutVol(rs.getFloat("m16_out_vol"));
                    list.add(data);
                }
                return list;
            }
        });
        return list;
    }
    //历史测试记录具体某一次放电数据详情
    public List<BatttestdataId> getTinfDataWithTestRecordCount(String tableName, Integer testRecordCount, Integer recordNum, Integer granularity) {
        String sql="select distinct * from "+tableName+" "+
src/main/resources/mapper/BattInfMapper.xml
@@ -231,6 +231,12 @@
            <if test="stic.product!=null">
                and tb_batt_inf.product=#{stic.product}
            </if>
            <if test="stic.inuseStartTime!=null">
                and tb_batt_inf.inuse_time>=#{stic.inuseStartTime}
            </if>
            <if test="stic.inuseEndTime!=null">
                and tb_batt_inf.inuse_time&lt;=#{stic.inuseEndTimee}
            </if>
            <if test="stic.uid>100">
                and tb_batt_inf.station_id in(
                select distinct station_id from db_user.tb_baojigroup_power,db_user.tb_baojigroup_usr