whycrzg
2021-02-03 9948b3f9a8d2d471a608b169de946eeb7d08b4b5
update battInf# etc
14个文件已修改
761 ■■■■ 已修改文件
src/main/java/com/fgkj/controller/BattDischarge_paramController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/BattInfController.java 124 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/Batt_electricityController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/Batt_maintenance_infController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/Battalarm_dataController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattDischarge_paramService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattDischarge_planService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/BattInfServices.java 449 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/Batt_DevdischargeService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/Batt_electricityService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/services/Battalarm_dataService.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattAlarmDataMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattInfMapper.xml 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/fgkj/controller/BattDischarge_paramController.java
@@ -33,7 +33,7 @@
    public ServiceModel add(@RequestBody BattDischarge_param param){
        // BattDischarge_param param = getGson("yyyy-MM-dd").fromJson(json, BattDischarge_param.class);
        ServiceModel model = service.add(param);
        {
        if (model.getCode().equals(1)){
            String msg="添加"+param.getParam_name()+"放电计划参数";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
@@ -48,7 +48,7 @@
    public ServiceModel update(@RequestBody BattDischarge_param param){
        // BattDischarge_param param = getGson("yyyy-MM-dd").fromJson(json, BattDischarge_param.class);
        ServiceModel model = service.update(param);
        {
        if (model.getCode().equals(1)){
            String msg="修改"+param.getParam_name()+"放电计划参数";
            User_log ulog=UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
            uservice.add(ulog);//将用户的操作记录下来
src/main/java/com/fgkj/controller/BattInfController.java
@@ -63,7 +63,7 @@
    }
    //根据维护区和机房名称查询电池组信息
    @PostMapping("inform")
    @ApiOperation(notes = "stationName 为模糊查询条件",value="维护区和机房名称查询电池组信息")
    @ApiOperation(notes = "stationName1、2、3、5 为模糊查询条件",value="维护区和机房名称查询电池组信息")
    public ServiceModel searchInform(@ApiParam(value = "省",required = true) @RequestParam String stationName1, @ApiParam(value = "市",required = true)@RequestParam String stationName2, @ApiParam(value = "区",required = true)@RequestParam String stationName5, @ApiParam(value = "机房",required = true)@RequestParam String stationName3, @ApiParam(value = "页码",required = true)@RequestParam Integer pageNum, @ApiParam(value = "页面数量",required = true)@RequestParam Integer pageSize) {
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        bmd.setBinf(new BattInf());
@@ -108,7 +108,7 @@
    }*/
    //根据电池id查询电池的基本信息
    @GetMapping("byBattGroupId")
    @PostMapping("searchBattBybattgroupId")
    @ApiOperation(notes = "",value="电池id查询电池的基本信息")
    public ServiceModel searchBattBybattgroupid(@RequestParam Integer battGroupId) {
        BattInf bif = new BattInf();
@@ -116,7 +116,16 @@
        return service.searchBattBybattgroupid(bif);
    }
    @PostMapping("findByBattGroupId")
    @ApiOperation(notes = "",value="findByBattGroupId")
    public ServiceModel findByBattGroupId(@RequestParam Integer battGroupId){
        BattInf binf = new BattInf();
        binf.setBattGroupId(battGroupId);
        ServiceModel model=service.findByBattGroupId(binf);
        return model;
    }
    //查询出当前存在内存中最大的设备的id(很重要**********)
    @GetMapping("maxDevId")
    @ApiOperation(notes = "",value="查询出当前存在内存中最大的设备的id(很重要**********)")
@@ -264,15 +273,6 @@
        return service.judgeBatt(binf);
    }
    @PostMapping("byBattGroupId2")
    @ApiOperation(notes = "",value="byBattGroupId2")
    public ServiceModel findByBattGroupId(@RequestParam Integer battGroupId){
        BattInf binf = new BattInf();
        binf.setBattGroupId(battGroupId);
        ServiceModel model=service.findByBattGroupId(binf);
        return model;
    }
    //根据电池组id查询不重复的单体编号
    @PostMapping("monNumByBattGroupId")
    @ApiOperation(notes = "",value="电池组id查询不重复的单体编号")
@@ -302,8 +302,12 @@
         * moncount中存放统计季度:一季度为1 以此类推 -3
         * monnum 中存放年份 -2020*/
    @PostMapping("beyondTime")
    @ApiOperation(notes = "区域层次放在stationid中 battgroupnum 中存放统计方式:年度统计为0 季度统计为1 moncount中存放统计季度:一季度为1 以此类推 monnum 中存放年份",value="按地域和标称电压分组统计蓄电池组服役超期的数量")
    public ServiceModel serchBeyondTime(@ApiParam(value = "区域层次(字符串数字)",required = true) @RequestParam String stationId,@ApiParam(value = "统计方式:年度统计为0 季度统计为1",required = true) @RequestParam Integer battGroupNum,@ApiParam(value = "年份",required = true) @RequestParam Integer monNum,@ApiParam(value = "统计季度:一季度为1 以此类推",required = true) @RequestParam Integer monCount,@ApiParam(value = "",required = true) @RequestParam Date BattInUseDate,@ApiParam(value = "使用日期段 格式2021/02/01 08:16:35",required = true) @RequestParam Date BattInUseDate1) {
    @ApiOperation(notes = "TODO 待测",
            value="按地域和标称电压分组统计蓄电池组服役超期的数量")
    public ServiceModel serchBeyondTime(@ApiParam(value = "区域层次(字符串数字)",required = true) @RequestParam String stationId,
                                        @ApiParam(value = "年份",required = true) @RequestParam Integer monNum,
                                        @ApiParam(value = "统计方式:年度统计为0 季度统计为1",required = true) @RequestParam Integer battGroupNum,
                                        @ApiParam(value = "统计季度:一季度为1 以此类推",required = true) @RequestParam Integer monCount) {
        ServiceModel model= new ServiceModel();
        try {
            Integer.parseInt(stationId);
@@ -317,44 +321,94 @@
        binf.setBattGroupNum(battGroupNum);
        binf.setMonNum(monNum);
        binf.setMonCount(monCount);
        binf.setBattInUseDate(BattInUseDate);
        binf.setBattInUseDate1(BattInUseDate1);
        return service.serchBeyondTime(binf);
        model =service.serchBeyondTime(binf);
        return model;
    }
    
    //6.4.8按地域和标称电压分组统计蓄电池组的数量(蓄电池组数量统计)
    @GetMapping("battGroupCountByMonVolStdGroup")
    @ApiOperation(notes = "",value="按地域和标称电压分组统计蓄电池组的数量(蓄电池组数量统计)")
    public ServiceModel serchByMonVolStdGroup(@RequestBody BattInf bif){
        // bif=ActionUtil.getGson("yyyy-MM-dd").fromJson(result,BattInf.class);
        return service.serchByMonVolStdGroup(bif);
    @PostMapping("battGroupCountByMonVolStdGroup")
    @ApiOperation(notes = "TODO 待测",value="按地域和标称电压分组统计蓄电池组的数量(蓄电池组数量统计)")
    public ServiceModel serchByMonVolStdGroup(@ApiParam(value = "区域层次(字符串数字)",required = true) @RequestParam String stationId,
                                              @ApiParam(value = "获取年份",required = true) @RequestParam Integer monNum,
                                              @ApiParam(value = "存放统计方式:年度统计为0 季度统计为1",required = true) @RequestParam Integer battGroupNum,
                                              @ApiParam(value = "存放统计季度:一季度为1 以此类推",required = true) @RequestParam Integer monCount){
        ServiceModel model = new ServiceModel();
        BattInf bif = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        bif.setStationId(stationId);
        bif.setBattGroupNum(battGroupNum);
        bif.setMonNum(monNum);
        bif.setMonCount(monCount);
        model = service.serchByMonVolStdGroup(bif);
        return model;
    }
    
    //6.4.9按地域和标称电压分组统计蓄电池组品牌的数量(蓄电池供应商信息统计)
    @GetMapping("battProducerCountByBattProducerGroup")
    @PostMapping("battProducerCountByBattProducerGroup")
    @ApiOperation(notes = "",value="按地域和标称电压分组统计蓄电池组品牌的数量(蓄电池供应商信息统计)")
    public ServiceModel serchByBattProducerGroup(@RequestBody BattInf bif){
        // bif=ActionUtil.getGson("yyyy-MM-dd").fromJson(result,BattInf.class);
    public ServiceModel serchByBattProducerGroup(@ApiParam(value = "区域层次(字符串数字)",required = true) @RequestParam String stationId,
                                                 @ApiParam(value = "获取年份",required = true) @RequestParam Integer monNum,
                                                 @ApiParam(value = "存放统计方式:年度统计为0 季度统计为1",required = true) @RequestParam Integer battGroupNum,
                                                 @ApiParam(value = "存放统计季度:一季度为1 以此类推",required = true) @RequestParam Integer monCount){
        ServiceModel model = new ServiceModel();
        BattInf bif = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        bif.setStationId(stationId);
        bif.setBattGroupNum(battGroupNum);
        bif.setMonNum(monNum);
        bif.setMonCount(monCount);
        return service.serchByBattProducerGroup(bif);
    }
    
    //6.4.10按地域和标称电压分组统计蓄电池组使用时间(蓄电池投产年限统计)
    @GetMapping("battGroupTimeInUse")
    @PostMapping("battGroupTimeInUse")
    @ApiOperation(notes = "",value="按地域和标称电压分组统计蓄电池组使用时间(蓄电池投产年限统计)")
    public ServiceModel serchByBattInUseDateGroup(@RequestBody BattInf bif){
        // bif=ActionUtil.getGson("yyyy-MM-dd").fromJson(result,BattInf.class);
    public ServiceModel serchByBattInUseDateGroup(@ApiParam(value = "区域层次(字符串数字)",required = true) @RequestParam String stationId,
                                                  @ApiParam(value = "获取年份",required = true) @RequestParam Integer monNum,
                                                  @ApiParam(value = "存放统计方式:年度统计为0 季度统计为1",required = true) @RequestParam Integer battGroupNum,
                                                  @ApiParam(value = "存放统计季度:一季度为1 以此类推",required = true) @RequestParam Integer monCount){
        ServiceModel model = new ServiceModel();
        BattInf bif = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        bif.setStationId(stationId);
        bif.setBattGroupNum(battGroupNum);
        bif.setMonNum(monNum);
        bif.setMonCount(monCount);
        return service.serchByBattInUseDateGroup(bif);
    }
    
    //1 根据机房id查询电池组id排序最小值
    @GetMapping("byIdLow")
    @PostMapping("byIdLow")
    @ApiOperation(notes = "",value="机房id查询电池组id排序最小值")
    public ServiceModel serchByIdLow(@RequestBody BattInf bif){
        // bif=ActionUtil.getGson("yyyy-MM-dd").fromJson(result,BattInf.class);
    public ServiceModel serchByIdLow(@RequestParam String stationId){
        ServiceModel model = new ServiceModel();
        BattInf bif = new BattInf();
        try {
            Integer.parseInt(stationId);
        } catch (NumberFormatException e) {
            e.printStackTrace();
            model.setMsg("参数不合法");
            return model;
        }
        bif.setStationId(stationId);
        return service.serchByIdLow(bif);
    }
src/main/java/com/fgkj/controller/Batt_electricityController.java
@@ -31,7 +31,7 @@
    public ServiceModel add(@RequestBody Batt_electricity be){
        // Batt_electricity be = getGson().fromJson(json, Batt_electricity.class);
        ServiceModel model = service.add(be);
        {
        if (model.getCode().equals(1)){
            String msg="添加对"+be.getDev_name()+"设备的记录";
            User_log ulog= UinfDaoFactory.CreateULog(UinfDaoFactory.Increase, msg);
            uservice.add(ulog);//将用户的操作记录下来
src/main/java/com/fgkj/controller/Batt_maintenance_infController.java
@@ -24,7 +24,7 @@
    // private Batt_maintenance_inf bmi;
    @GetMapping("all")
    @ApiOperation(notes = "",value="查询所有")
    @ApiOperation(notes = "TODO Table 'db_battinf.tb_batt_maintenance_inf'",value="查询所有")
    public ServiceModel searchAll(){
        ServiceModel model=service.searchAll();
        return model;
src/main/java/com/fgkj/controller/Battalarm_dataController.java
@@ -39,7 +39,7 @@
    //3.2电池告警历史记录查询
    @PostMapping("byInfo")
    @ApiOperation(notes = "binf.stationName1&binf.stationName 模糊查询 { \"binf\": { \"stationName\": \"\", \"stationName1\": \"\", \"battGroupId\": 0 },\"mainf\": { \"num\": 0, \"battGroupId\": 0, \"fault_level\": 0, \"fault_type_id\": 0, \"record_uid\": 0, \"maint_type_id\": 0, \"maint_done\": 0, \"maint_close\": 0, \"master_audit\": 0, \"appoint_uid\": 0 },\"pageBean\": { \"pageSize\": 10, \"pageNum\": 0 },\"adata\": { \"alm_id\": 0, \"alm_signal_id\": 0, \"alm_start_time\": \"2021-01-29 09:40:11\", \"alm_start_time1\": \"2021-01-29 09:40:11\" } }", value = "电池告警历史记录查询")
    @ApiOperation(notes = "stationName、stationName模糊查询条件 binf.stationName1&binf.stationName 模糊查询 { \"binf\": { \"stationName\": \"\", \"stationName1\": \"\", \"battGroupId\": 0 },\"mainf\": { \"num\": 0, \"battGroupId\": 0, \"fault_level\": 0, \"fault_type_id\": 0, \"record_uid\": 0, \"maint_type_id\": 0, \"maint_done\": 0, \"maint_close\": 0, \"master_audit\": 0, \"appoint_uid\": 0 },\"pageBean\": { \"pageSize\": 10, \"pageNum\": 0 },\"adata\": { \"alm_id\": 0, \"alm_signal_id\": 0, \"alm_start_time\": \"2021-01-29 09:40:11\", \"alm_start_time1\": \"2021-01-29 09:40:11\" } }", value = "电池告警历史记录查询")
    public ServiceModel serchByInfo(@RequestBody Batt_Maint_Dealarm bmd) {
        // bmd = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(result, Batt_Maint_Dealarm.class);
        User_inf uinf = (User_inf) ActionUtil.getUser();
@@ -50,8 +50,8 @@
    //0.5查询实时告警数
    @PostMapping("alm")
    @ApiOperation(notes = "", value = "查询实时告警数")
    public ServiceModel serchAlm(@ApiParam(value = "binf.stationName", required = true) @RequestParam String stationName) {
    @ApiOperation(notes = "stationName 模糊查询", value = "查询实时告警数")
    public ServiceModel serchAlm(@ApiParam(value = "地址 模糊查询条件", required = true) @RequestParam String stationName) {
        Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm();
        User_inf uinf = (User_inf) ActionUtil.getUser();
        bmd.setUinf(uinf);
src/main/java/com/fgkj/mapper/impl/BattInfMapper.java
@@ -80,7 +80,7 @@
    public List<Integer> searchAll();
    //5.3添加选取电池组或者机房或者维护区
    public List serchBatt(BattInf obj);
    public List<BattInf> serchBatt(BattInf obj);
    
    //查询电池组左侧导航菜单(实时监测,历史数据查询)
    public List findMenu();
@@ -853,15 +853,16 @@
    //6.4.9按地域和标称电压分组统计蓄电池组品牌的数量(蓄电池供应商信息统计)
    /*
     * 区域层次放在stationid中*/
    public List serchByBattProducerGroup(Object obj);
    public List<BattInf> serchByBattProducerGroup(BattInf obj);
    
    //1 根据机房id查询电池组id排序最小值
    public List serchByIdLow(Object obj);
    @Select("select distinct  stationName,stationName1,stationName2,stationName3,stationName4,stationName5 from db_battinf.tb_battinf where stationid=#{stationId} order by battgroupid asc limit 1 ")
    public List<BattInf> serchByIdLow(BattInf obj);
    
    //6.4.10按地域和标称电压分组统计蓄电池组使用时间(蓄电池投产年限统计)
    /*
     * 区域层次放在stationid中*/
    public List serchByBattInUseDateGroup(Object obj);
    public List<BattInf> serchByBattInUseDateGroup(BattInf obj);
    
    //9.1根据stationid查询机房电池组数和每组电池组中单体的个数(机房信息内容画图)
    @Select(" select distinct db_battinf.tb_battinf.battgroupid,db_battinf.tb_battinf.battgroupname ,db_battinf.tb_battinf.moncount,db_battinf.tb_battinf.stationid,db_battinf.tb_battinf.moncapstd," +
@@ -927,7 +928,13 @@
    public List searchStationId(Object obj);
    //查询所有的机房
    public List serchAllStation(Object obj);
    @Select("select DISTINCT stationid,StationName,StationName1,StationName2,StationName3,StationName4,StationName5," +
            "StationName6,StationName7,StationName8,StationName9,fBSDeviceId   " +
            "FROM db_battinf.tb_battinf  where StationId " +
            "in( select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId " +
            "from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr " +
            "where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id  and db_user.tb_user_battgroup_baojigroup_usr.uId=#{uId} )")
    public List<BattInf> serchAllStation(User_inf obj);
    //根据机房id查询机房下的电池组信息
    public List serchBattByStation(Object obj);
src/main/java/com/fgkj/services/BattDischarge_paramService.java
@@ -18,7 +18,15 @@
    //8.1添加新的参数
    public ServiceModel add(BattDischarge_param obj){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.add(obj);
        Boolean bl= null;
        try {
            bl = mapper.add(obj);
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("添加失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
@@ -31,7 +39,15 @@
    //8.1修改参数信息
    public ServiceModel update(BattDischarge_param obj){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.update(obj);
        Boolean bl= null;
        try {
            bl = mapper.update(obj);
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("修改失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
src/main/java/com/fgkj/services/BattDischarge_planService.java
@@ -41,7 +41,15 @@
    
    public ServiceModel add(BattDischarge_plan plan){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.add(plan)>0;
        Boolean bl= null;
        try {
            bl = mapper.add(plan)>0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("添加失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
@@ -53,7 +61,15 @@
    }
    public ServiceModel update(BattDischarge_plan obj){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.update(obj)>0;
        Boolean bl= null;
        try {
            bl = mapper.update(obj)>0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("修改失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
@@ -76,6 +92,7 @@
                    bl = mapper.addPro(bdp) > 0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("添加失败!");
                    return model;
@@ -111,6 +128,7 @@
                    bl = mapper.updatePro(bdp) > 0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("添加失败!");
                    return model;
src/main/java/com/fgkj/services/BattInfServices.java
@@ -117,8 +117,14 @@
            for (int i = 0; i < list.size(); i++) {
                BattInf binf = list.get(i);
//                System.out.println("binf = " + binf);
                if (!(mapper.update(binf)>0)) {
                    flag = false;
                try {
                    flag = mapper.update(binf)>0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("修改失败!");
                    return model;
                }
                {
                    String msg = "修改" + binf.getStationName() + "机房" + binf.getBattGroupId() + "电池组的信息";
@@ -150,8 +156,16 @@
        ServiceModel model = new ServiceModel();
        //更新数据库备份标志表的标志
        boolean flag = backupmapper.updateBackupEn("tb_battinf") > 0;
        boolean b=mapper.updateIp(binf)>0;
        if(b){
        boolean b= false;
        try {
            b = mapper.updateIp(binf)>0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("修改失败!");
            return model;
        }
        if(b){
            boolean bl = fbs9100_setparamService.sendCmdToFBS9100Dev(binf.getNum(), 0, binf.getFbsDeviceId());
            if(bl){
                //将6185的服务设为重启
@@ -558,100 +572,128 @@
     * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
     * moncount中存放统计季度:一季度为1 以此类推
     * monnum 中存放年份*/
    public ServiceModel serchBeyondTime(BattInf binf){
    public ServiceModel serchBeyondTime(BattInf binf) {
        ServiceModel model = new ServiceModel();
        System.out.println(1111111111);
        int year=binf.getMonNum();//获取年份
        int firstMonth=0;//获取起始月份
        int lastMonth=0;//获取结束月份
        String dateFirst=""; //起始时间
        String dateLast="";  //结束时间
        int year = binf.getMonNum();//获取年份
        int firstMonth = 0;//获取起始月份
        int lastMonth = 0;//获取结束月份
        String dateFirst = ""; //起始时间
        String dateLast = "";  //结束时间
        //做时间判断
        if(binf.getBattGroupNum()==0){
             firstMonth=0;//获取起始月份
             lastMonth=11;//获取结束月份
        }else if(binf.getBattGroupNum()==1){
             if(binf.getMonCount()==1){
                 firstMonth=0;//获取起始月份
                 lastMonth=2;//获取结束月份
             }else if(binf.getMonCount()==2){
                 firstMonth=3;//获取起始月份
                 lastMonth=5;//获取结束月份
             }else if(binf.getMonCount()==3){
                 firstMonth=6;//获取起始月份
                 lastMonth=8;//获取结束月份
             }else if(binf.getMonCount()==4){
                 firstMonth=9;//获取起始月份
                 lastMonth=11;//获取结束月份
             }
        if (binf.getBattGroupNum() == 0) {
            firstMonth = 0;//获取起始月份
            lastMonth = 11;//获取结束月份
        } else if (binf.getBattGroupNum() == 1) {
            if (binf.getMonCount() == 1) {
                firstMonth = 0;//获取起始月份
                lastMonth = 2;//获取结束月份
            } else if (binf.getMonCount() == 2) {
                firstMonth = 3;//获取起始月份
                lastMonth = 5;//获取结束月份
            } else if (binf.getMonCount() == 3) {
                firstMonth = 6;//获取起始月份
                lastMonth = 8;//获取结束月份
            } else if (binf.getMonCount() == 4) {
                firstMonth = 9;//获取起始月份
                lastMonth = 11;//获取结束月份
            }
        }
        try {
            dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
            dateFirst = ActionUtil.getFirstDayOfMonth(year, firstMonth);//起始时间
            binf.setBattInUseDate(DateUtil.sdf.parse(dateFirst));
            //System.out.println(dateFirst.substring(0,10));
            dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
            dateLast = ActionUtil.getLastDayOfMonth(year, lastMonth);//结束时间
            binf.setBattInUseDate1(DateUtil.sdf.parse(dateLast));
        } catch (Exception e) {
            e.printStackTrace();
        }
        int level = Integer.parseInt(binf.getStationId());
        List<BattInf> listFalse=mapper.serchBylevel(level);
        List<BattInf> listFalse = mapper.serchBylevel(level);
        //求总数
        List<BattInf> list=mapper.serchByMonVolStdGroup(binf);
        List<BattInf> listB=null;
        try {
            if (list!=null&&list.size()>0){
                System.out.println("list.size() = " + list.size());
                System.out.println("list = " + list);
                listB=BattinfGroupFactory.finishMonvol(list);
            }else{
                model.setCode(0);
                model.setData(listFalse);
                model.setMsg("查询失败!");
                return model;
        List<BattInf> list = mapper.serchByMonVolStdGroup(binf);
        if (null != list && list.size() > 0) {
            String stationName1 = list.get(list.size() - 1).getStationName1();
            String stationName2 = list.get(list.size() - 1).getStationName2();
            String stationName3 = list.get(list.size() - 1).getStationName3();
            String stationName4 = list.get(list.size() - 1).getStationName4();
            int id = 0;//标志符号
            int battGroupNum = id;    //自增变量
            for (int i = 0; i < list.size(); i++) {
                BattInf srcb = list.get(i);
                if (binf.getStationId().equals("1")) {
                    if (srcb.getStationName1().equals(stationName1)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("2")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("3")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("4")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3) && srcb.getStationName4().equals(stationName4)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                }
            }
            List<BattInf> listL=null;
        }
        System.out.println("list = " + list);
        List<BattInf> listB = null;
        try {
            if (list != null && list.size() > 0) {
                listB = BattinfGroupFactory.finishMonvol(list);
            }
            List<BattInf> listL = null;
            if (listB!=null&&listB.size()>0){
                listL=BattinfGroupFactory.delMonvol(listB);
            }else{
                model.setCode(0);
                model.setData(listFalse);
                model.setMsg("查询失败!");
                return model;
            if (listB != null && listB.size() > 0) {
                System.out.println("listB = " + listB);
                listL = BattinfGroupFactory.delMonvol(listB);
            }
            //求超期服役的数量
            try {
                year=(new Date()).getYear()+1900-3;//当前时间减去年限
                year = (new Date()).getYear() + 1900 - 3;//当前时间减去年限
                //System.out.println(year);
                dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
                dateFirst = ActionUtil.getFirstDayOfMonth(year, firstMonth);//起始时间
                binf.setBattInUseDate(DateUtil.sdf.parse(dateFirst));
                //System.out.println(binf.getBattInUseDate());
            } catch (ParseException e) {
                e.printStackTrace();
            }
            List<BattInf> listY=mapper.serchBeyondTime(binf);//超期服役的电池组数
            System.out.println("超期服役的电池组数 listY.get(0) = " + listY.get(0));
            List<BattInf> listY = mapper.serchBeyondTime(binf);//超期服役的电池组数
            List<BattInf> listBY=null;
            if (listY!=null&&listY.size()>0){
                listBY=BattinfGroupFactory.finishMonvol(listY);
            }else{
            List<BattInf> listBY = null;
            if (listY != null && listY.size() > 0) {
                System.out.println("超期服役的电池组数 listY.get(0) = " + listY.get(0));
                listBY = BattinfGroupFactory.finishMonvol(listY);
            } else {
                model.setCode(0);
                model.setData(listFalse);
                model.setMsg("查询失败!");
                return model;
            }
            List<BattInf> listLY=null;
            List<BattInf> listLY = null;
            if (listBY!=null&&listBY.size()>0){
                listLY=BattinfGroupFactory.delMonvol(listBY);
            }else{
            if (listBY != null && listBY.size() > 0) {
                listLY = BattinfGroupFactory.delMonvol(listBY);
            } else {
                model.setCode(0);
                model.setData(listFalse);
                model.setMsg("查询失败!");
                return model;
            }
@@ -670,7 +712,7 @@
              "6v: "+b.getMonCount()+" "+
              "12v: "+b.getMonNum());
        }*/
            if(listL!=null&&listL.size()>0) {
            if (listL != null && listL.size() > 0) {
                List<BattInf> listEnd = BattinfGroupFactory.countAll(listL, listLY);
                for (BattInf b : listEnd) {
                    System.out.println("2 " + b.getBattGroupNum() + " " +
@@ -681,18 +723,16 @@
                model.setCode(1);
                model.setData(listEnd);
                model.setMsg("查询成功!");
            }else{
            } else {
                model.setCode(0);
                model.setData(listFalse);
                System.out.println(listFalse.size());
                model.setMsg("查询失败!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setData(listFalse);
            System.out.println(listFalse.size());
            model.setMsg("查询失败!");
            return model;
        }
        return model;
    }
@@ -702,61 +742,111 @@
         * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
         * moncount中存放统计季度:一季度为1 以此类推
         * monnum 中存放年份*/
    public ServiceModel serchByMonVolStdGroup(Object obj){
        BattInf binf=(BattInf) obj;
        int year=binf.getMonNum();//获取年份
        int firstMonth=0;//获取起始月份
        int lastMonth=0;//获取结束月份
        String dateFirst=""; //起始时间
        String dateLast="";  //结束时间
    public ServiceModel serchByMonVolStdGroup(BattInf binf) {
        ServiceModel model = new ServiceModel();
        int year = binf.getMonNum();//获取年份
        int firstMonth = 0;//获取起始月份
        int lastMonth = 0;//获取结束月份
        String dateFirst = ""; //起始时间
        String dateLast = "";  //结束时间
        //做时间判断
        if(binf.getBattGroupNum()==0){
             firstMonth=0;//获取起始月份
             lastMonth=11;//获取结束月份
        }else if(binf.getBattGroupNum()==1){
             if(binf.getMonCount()==1){
                 firstMonth=0;//获取起始月份
                 lastMonth=2;//获取结束月份
             }else if(binf.getMonCount()==2){
                 firstMonth=3;//获取起始月份
                 lastMonth=5;//获取结束月份
             }else if(binf.getMonCount()==3){
                 firstMonth=6;//获取起始月份
                 lastMonth=8;//获取结束月份
             }else if(binf.getMonCount()==4){
                 firstMonth=9;//获取起始月份
                 lastMonth=11;//获取结束月份
             }
        if (binf.getBattGroupNum() == 0) {
            firstMonth = 0;//获取起始月份
            lastMonth = 11;//获取结束月份
        } else if (binf.getBattGroupNum() == 1) {
            if (binf.getMonCount() == 1) {
                firstMonth = 0;//获取起始月份
                lastMonth = 2;//获取结束月份
            } else if (binf.getMonCount() == 2) {
                firstMonth = 3;//获取起始月份
                lastMonth = 5;//获取结束月份
            } else if (binf.getMonCount() == 3) {
                firstMonth = 6;//获取起始月份
                lastMonth = 8;//获取结束月份
            } else if (binf.getMonCount() == 4) {
                firstMonth = 9;//获取起始月份
                lastMonth = 11;//获取结束月份
            }
        }
        try {
            dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
            dateFirst = ActionUtil.getFirstDayOfMonth(year, firstMonth);//起始时间
            binf.setBattInUseDate(DateUtil.sdf.parse(dateFirst));
            //System.out.println(dateFirst.substring(0,10));
            dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
            dateLast = ActionUtil.getLastDayOfMonth(year, lastMonth);//结束时间
            binf.setBattInUseDate1(DateUtil.sdf.parse(dateLast));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("查询失败!");
            return model;
        }
        List<BattInf> list = mapper.serchByMonVolStdGroup(binf);
        List<BattInf> listB = null;
        List<BattInf> listL = null;
        if (null != list && list.size() > 0) {
            String stationName1 = list.get(list.size() - 1).getStationName1();
            String stationName2 = list.get(list.size() - 1).getStationName2();
            String stationName3 = list.get(list.size() - 1).getStationName3();
            String stationName4 = list.get(list.size() - 1).getStationName4();
            int id = 0;//标志符号
            int battGroupNum = id;    //自增变量
            for (int i = 0; i < list.size(); i++) {
                BattInf srcb = list.get(i);
                if (binf.getStationId().equals("1")) {
                    if (srcb.getStationName1().equals(stationName1)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("2")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("3")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("4")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3) && srcb.getStationName4().equals(stationName4)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                }
            }
        }
        List<BattInf> list=mapper.serchByMonVolStdGroup(binf);
        List<BattInf> listB=BattinfGroupFactory.finishMonvol(list);
        List<BattInf> listL=BattinfGroupFactory.delMonvol(listB);
//        battGroupNum 从list传过去
//        System.out.println("list = " + list);
        listB = BattinfGroupFactory.finishMonvol(list);//将同一stationame中的2v,6v,12v数据整合    battGroupNum 从这传过去
        if (null != listB && listB.size() > 0) {
//            System.out.println("listB.get(0) = " + listB.get(0));
            listL = BattinfGroupFactory.delMonvol(listB);//去除重复项 需要参数 battGroupNum
        }
        //没有数据时传分组情况
        int level = Integer.parseInt(binf.getStationId());
        List<BattInf> listFalse=mapper.serchBylevel(level);
        List<BattInf> listFalse = mapper.serchBylevel(level);
//        for (BattInf b : listL) {
//            System.out.println(b.getBattGroupNum()+" "+
//              "2v: "+b.getBattGroupId()+" "+
//              "6v: "+b.getMonCount()+" "+
//              "12v: "+b.getMonNum());
//        }
        if(listL!=null&&listL.size()>0){
        if (listL != null && listL.size() > 0) {
            model.setCode(1);
            model.setData(listL);
            model.setMsg("查询成功!");
        }else{
        } else {
            model.setCode(0);
            model.setData(listFalse);
            model.setMsg("查询失败!");
@@ -769,8 +859,8 @@
     * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
     * moncount中存放统计季度:一季度为1 以此类推
     * monnum 中存放年份*/
    public ServiceModel serchByBattProducerGroup(Object obj){
        BattInf binf=(BattInf) obj;
    public ServiceModel serchByBattProducerGroup(BattInf binf){
        ServiceModel model = new ServiceModel();
        int year=binf.getMonNum();//获取年份
        int firstMonth=0;//获取起始月份
        int lastMonth=0;//获取结束月份
@@ -802,8 +892,10 @@
            dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
            binf.setBattInUseDate1(DateUtil.sdf.parse(dateLast));
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("查询失败!");
            return model;
        }
@@ -812,6 +904,46 @@
        int level = Integer.parseInt(binf.getStationId());
        List<BattInf> listFalse=mapper.serchBylevel(level);
        if (null != list && list.size() > 0) {
            String stationName1 = list.get(list.size() - 1).getStationName1();
            String stationName2 = list.get(list.size() - 1).getStationName2();
            String stationName3 = list.get(list.size() - 1).getStationName3();
            String stationName4 = list.get(list.size() - 1).getStationName4();
            int id = 0;//标志符号
            int battGroupNum = id;    //自增变量
            for (int i = 0; i < list.size(); i++) {
                BattInf srcb = list.get(i);
                if (binf.getStationId().equals("1")) {
                    if (srcb.getStationName1().equals(stationName1)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("2")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("3")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("4")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3) && srcb.getStationName4().equals(stationName4)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                }
            }
        }
//            for (BattInf b : list) {
//                System.out.println(b.getNum()+" "+
//                                   b.getStationName1()+" "+
@@ -839,8 +971,8 @@
     * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
     * moncount中存放统计季度:一季度为1 以此类推
     * monnum 中存放年份*/
    public ServiceModel serchByBattInUseDateGroup(Object obj){
            BattInf binf=(BattInf) obj;
    public ServiceModel serchByBattInUseDateGroup(BattInf binf){
        ServiceModel model = new ServiceModel();
            int year=binf.getMonNum();//获取年份
            int firstMonth=0;//获取起始月份
            int lastMonth=0;//获取结束月份
@@ -872,8 +1004,10 @@
                dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
                binf.setBattInUseDate1(DateUtil.sdf.parse(dateLast));
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                model.setCode(0);
                model.setMsg("查询失败!");
                return model;
            }
            
            
@@ -882,7 +1016,47 @@
            //没有数据时传分组情况
            int level = Integer.parseInt(binf.getStationId());
            List<BattInf> listFalse=mapper.serchBylevel(level);
        if (null != list && list.size() > 0) {
            String stationName1 = list.get(list.size() - 1).getStationName1();
            String stationName2 = list.get(list.size() - 1).getStationName2();
            String stationName3 = list.get(list.size() - 1).getStationName3();
            String stationName4 = list.get(list.size() - 1).getStationName4();
            int id = 0;//标志符号
            int battGroupNum = id;    //自增变量
            for (int i = 0; i < list.size(); i++) {
                BattInf srcb = list.get(i);
                if (binf.getStationId().equals("1")) {
                    if (srcb.getStationName1().equals(stationName1)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("2")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("3")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                } else if (binf.getStationId().equals("4")) {
                    if (srcb.getStationName1().equals(stationName1) && srcb.getStationName2().equals(stationName2) && srcb.getStationName3().equals(stationName3) && srcb.getStationName4().equals(stationName4)) {
                        list.get(i).setBattGroupNum(battGroupNum++);
                    } else {
                        list.get(i).setBattGroupNum(id);
                        id += 1;
                    }
                }
            }
        }
//            for (BattInf b : list) {
//                System.out.println(b.getNum()+" "+
//                                   b.getStationName1()+" "+
@@ -905,13 +1079,14 @@
        }
    //1 根据机房id查询电池组id排序最小值
    public ServiceModel serchByIdLow(Object obj){
        List list=mapper.serchByIdLow(obj);
    public ServiceModel serchByIdLow(BattInf obj) {
        ServiceModel model = new ServiceModel();
        List list = mapper.serchByIdLow(obj);
        if (list != null && list.size() > 0) {
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
        }else{
        } else {
            model.setCode(0);
            model.setData(list);
            model.setMsg("查询失败!");
@@ -937,15 +1112,59 @@
        return model;
    }
    //查询所有的机房
    public ServiceModel serchAllStation(Object obj){
        List list=mapper.serchAllStation(obj);
    public ServiceModel serchAllStation(User_inf obj){
        ServiceModel model = new ServiceModel();
        List<BattInf> list=mapper.serchAllStation(obj);
        if (list != null && list.size() > 0) {
            String conStr = "-";//连接机房名称的符号
            for (int i = 0; i < list.size(); i++) {
                BattInf battInf = list.get(i);
                String stationName = "";
                if (!battInf.getStationName1().trim().equals("")) {
                    stationName += battInf.getStationName1();
                }
                if (!battInf.getStationName2().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName2();
                }
                if (!battInf.getStationName3().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName3();
                }
                if (!battInf.getStationName4().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName4();
                }
                if (!battInf.getStationName5().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName5();
                }
                if (!battInf.getStationName6().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName6();
                }
                if (!battInf.getStationName7().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName7();
                }
                if (!battInf.getStationName8().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName8();
                }
                if (!battInf.getStationName9().trim().equals("")) {
                    stationName += conStr;
                    stationName += battInf.getStationName9();
                }
                list.get(i).setStationName(stationName);
                list.get(i).setStationId(battInf.getStationId());
                list.get(i).setFbsDeviceId(battInf.getFbsDeviceId());
            }
            model.setCode(1);
            model.setData(list);
            model.setMsg("查询成功!");
        }else{
            model.setCode(0);
            model.setData(list);
            model.setMsg("查询失败!");
        }
        //System.out.println(model);
src/main/java/com/fgkj/services/Batt_DevdischargeService.java
@@ -20,7 +20,15 @@
    public ServiceModel add(Batt_Devdischarge bd){
    ServiceModel model = new ServiceModel();
        Boolean bl=mapper.add(bd)>0;
        Boolean bl= null;
        try {
            bl = mapper.add(bd)>0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("添加失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
src/main/java/com/fgkj/services/Batt_electricityService.java
@@ -22,7 +22,15 @@
    
    public ServiceModel add(Batt_electricity obj){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.add(obj)>0;
        Boolean bl= null;
        try {
            bl = mapper.add(obj)>0;
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("添加失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("添加成功!");
@@ -34,7 +42,15 @@
    }
    public ServiceModel update(Batt_electricity obj){
        ServiceModel model = new ServiceModel();
        Boolean bl=mapper.update(obj);
        Boolean bl= null;
        try {
            bl = mapper.update(obj);
        } catch (Exception e) {
            e.printStackTrace();
            model.setCode(0);
            model.setMsg("修改失败!");
            return model;
        }
        if(bl){
            model.setCode(1);
            model.setMsg("修改成功!");
src/main/java/com/fgkj/services/Battalarm_dataService.java
@@ -43,7 +43,7 @@
    TransactionDefinition transactionDefinition;
    
    public ServiceModel add(Object obj) {
        Boolean bl=mapper.add(obj);
        if(bl){
            model.setCode(1);
@@ -90,8 +90,14 @@
                if (!bl) {
                    continue;
                }
                if (!(mapper.updatePro(adata)>0)){
                    bl = false;
                try {
                    bl = mapper.updatePro(adata)>0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("确认失败!");
                    return model;
                }
                {                    //机房和电池组名称            //告警的类型
                    String msg = "确认" + adata.getStationname() + "的" + adata.getNote() + "告警";
@@ -146,7 +152,7 @@
    
    // 3.1电池容量告警实时查询
    public ServiceModel serchCapAlarm(Batt_Maint_Dealarm obj){
        model=new ServiceModel();
        ServiceModel model=new ServiceModel();
        List<Batt_Maint_Dealarm> list=mapper.serchByCondition(obj);
        String name="未知";//存放告警名称
        String type="未知";//存放告警等级
@@ -224,7 +230,7 @@
                type=AlarmDaoFactory.getAlarmType(adata.getAlm_level());
                list.get(i).getBinf().setStationName8(name);
                list.get(i).getBinf().setStationName9(type);
                System.out.println("StationName9 = " + list.get(i).getBinf().getStationName9());
//                System.out.println("StationName9 = " + list.get(i).getBinf().getStationName9());
            }
            PageInfo<Batt_Maint_Dealarm> pageInfo = new PageInfo<>(list);
            model.setCode(1);
@@ -335,7 +341,7 @@
        ServiceModelOnce model = new ServiceModelOnce();
        List<Battalarm_data> list=mapper.serchRealTime(obj);
        if(list.size()>0&&list!=null){
            System.out.println("list.get(0) = " + list.get(0));
//            System.out.println("list.get(0) = " + list.get(0));
            model.setCode(1);
             model.setSum(list.get(0).getNum());
        }else{
@@ -419,8 +425,14 @@
                if (!bl) {
                    continue;
                }
                if (!(mapper.cancelalarmPro(adata)>0)) {
                    bl = false;
                try {
                    bl = mapper.cancelalarmPro(adata) > 0;
                } catch (Exception e) {
                    e.printStackTrace();
                    dataSourceTransactionManager.rollback(transactionStatus);
                    model.setCode(0);
                    model.setMsg("取消失败!");
                    return model;
                }
                String msg = "取消" + adata.getStationname() + "的" + adata.getNote() + "告警";
                User_log ulog = UinfDaoFactory.CreateULog(UinfDaoFactory.Alter, msg);
src/main/resources/mapper/BattAlarmDataMapper.xml
@@ -2064,7 +2064,7 @@
        select
        distinct(db_alarm.tb_battalarm_data.BattGroupId),db_alarm.tb_battalarm_data.num,alm_signal_id,db_alarm.tb_battalarm_data.monnum,alm_value,alm_level,alm_is_confirmed,alm_confirmed_time,alm_start_time,alm_end_time,
        stationname,battgroupname from db_alarm.tb_battalarm_data,db_battinf.tb_battinf
        <!--where alm_id in(#{mainf.fault_type_id}, #{mainf.fault_level}, #{mainf.record_uid}, #{mainf.maint_type_id},
        where alm_id in(#{mainf.fault_type_id}, #{mainf.fault_level}, #{mainf.record_uid}, #{mainf.maint_type_id},
        #{mainf.maint_done},
        #{mainf.maint_close}) and
        alm_signal_id%2 in(#{adata.alm_id},#{adata.alm_signal_id}) and alm_level
@@ -2099,7 +2099,7 @@
        db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id
        and db_user.tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid and db_user.tb_user_inf.uid=#{uinf.uId}
        )
        order by db_alarm.tb_battalarm_data.alm_start_time desc,db_alarm.tb_battalarm_data.monnum asc-->
        order by db_alarm.tb_battalarm_data.alm_start_time desc,db_alarm.tb_battalarm_data.monnum asc
    </select>
    <select id="serchByInfo1" resultType="java.util.List"></select>
src/main/resources/mapper/BattInfMapper.xml
@@ -4655,15 +4655,60 @@
        </if>
    </select>
    <select id="serchByIdLow" resultType="java.util.List"></select>
    <select id="serchByBattProducerGroup" resultType="java.util.List"></select>
    <select id="serchByBattInUseDateGroup" resultType="java.util.List"></select>
<!--    <select id="serchByIdLow" resultType="java.util.List"></select>-->
    <select id="serchByBattProducerGroup" resultType="BattInf">
        select stationname1,stationname2,stationname3 ,stationname4,battproducer,count(distinct(battgroupid)) as num
        from db_battinf.tb_battinf where to_days(battinusedate)>to_days(#{battInUseDate}) and to_days(battinusedate) <![CDATA[<]]>
        to_days(#{battInUseDate1})
        <if test="stationId==1">
            group by stationname1,monvolstd order by stationname1,monvolstd
        </if>
        <if test="stationId==2">
            group by stationname2,stationname1,monvolstd order by stationname2,stationname1,monvolstd
        </if>
        <if test="stationId==3">
            group by stationname3,stationname2,stationname1,monvolstd order by
            stationname3,stationname2,stationname1,monvolstd
        </if>
        <if test="stationId==4">
            group by stationname4,stationname3,stationname2,stationname1,monvolstd order by
            stationname4,stationname3,stationname2,stationname1,monvolstd
        </if>
    </select>
    <select id="serchByBattInUseDateGroup" resultType="BattInf">
        select stationname1,stationname2,stationname3 ,stationname4,battinusedate,count(distinct(battgroupid)) as num
        from db_battinf.tb_battinf where to_days(battinusedate)>to_days(#{battInUseDate}) and to_days(battinusedate) <![CDATA[<]]>
        to_days(#{battInUseDate1})
        <if test="stationId==1">
            group by stationname1,monvolstd order by stationname1,monvolstd
        </if>
        <if test="stationId==2">
            group by stationname2,stationname1,monvolstd order by stationname2,stationname1,monvolstd
        </if>
        <if test="stationId==3">
            group by stationname3,stationname2,stationname1,monvolstd order by
            stationname3,stationname2,stationname1,monvolstd
        </if>
        <if test="stationId==4">
            group by stationname4,stationname3,stationname2,stationname1,monvolstd order by
            stationname4,stationname3,stationname2,stationname1,monvolstd
        </if>
    </select>
<!--    <select id="serchMonNum" resultType="java.util.List"></select>-->
<!--    <select id="serchByStationid" resultType="java.util.List"></select>-->
    <select id="searchBattByStationId" resultType="java.util.List"></select>
<!--    <select id="serchMonAll" resultType="java.lang.Integer"></select>-->
    <select id="searchStationId" resultType="java.util.List"></select>
    <select id="serchAllStation" resultType="java.util.List"></select>
<!--    <select id="serchAllStation" resultType="java.util.List"></select>-->
    <select id="serchBattByStation" resultType="java.util.List"></select>
    <select id="serchStationOrBattgroup" resultType="java.util.List"></select>
    <select id="serchAllBatt" resultType="java.lang.Integer"></select>