whycrzg
2021-02-23 351b9a53cb9ecebdf8f79db0117f540d9c42c2a4
src/main/java/com/fgkj/controller/BattInfController.java
@@ -5,6 +5,7 @@
import com.fgkj.util.ActionUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.sun.xml.internal.bind.v2.TODO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@@ -12,6 +13,7 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@RequestMapping("battInf")
@@ -61,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());
@@ -94,7 +96,7 @@
   }
   @GetMapping("all")
   @ApiOperation(notes = "",value="all")
   @ApiOperation(notes = "查所有的电池组",value="all")
   public ServiceModel searchAll() {
      return service.searchAll();
   }
@@ -106,7 +108,7 @@
   }*/
   //根据电池id查询电池的基本信息
   @GetMapping("byBattGroupId")
   @PostMapping("searchBattBybattgroupId")
   @ApiOperation(notes = "",value="电池id查询电池的基本信息")
   public ServiceModel searchBattBybattgroupid(@RequestParam Integer battGroupId) {
      BattInf bif = new BattInf();
@@ -114,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(很重要**********)")
@@ -144,14 +155,14 @@
   //----------根据StationName1(维护区) 查不重复的StationName(站点)不包含91000000一期设备
   @PostMapping("byStationNameWithout91")
   @ApiOperation(notes = "",value="StationName1(维护区) 查不重复的StationName(站点)不包含91000000一期设备")
   public ServiceModelOnce serchByStationNameNot91(@RequestParam String stationName1) {
   public ServiceModelOnce serchByStationNameNot91(@ApiParam(value = "省",required = true) @RequestParam String stationName1) {
      BattInf bif = new BattInf();
      bif.setStationName1(stationName1);
      return service.serchByStationNameNot91(bif);
   }
//--查不重复的StationName1(维护区)
   @GetMapping("byStation")
   @ApiOperation(notes = "",value="查不重复的StationName1(维护区)")
   @ApiOperation(notes = "sum 集合长度",value="查不重复的StationName1(维护区)")
   public ServiceModelOnce serchByStation(){
      return service.serchByStation();
   }
@@ -170,8 +181,8 @@
   }
   // ----------查询所有的市
   @PostMapping("allStationName2")
   @ApiOperation(notes = "",value="查询所有的市")
   public ServiceModel serchAllStationName2(@RequestParam String stationName1) {
   @ApiOperation(notes = "模糊查询",value="查询所有的市")
   public ServiceModel serchAllStationName2(@ApiParam(value = "省",required = true) @RequestParam String stationName1) {
      BattInf binf = new BattInf();
      User_inf uinf=(User_inf) ActionUtil.getUser();
      binf.setNum(uinf.getuId());
@@ -191,7 +202,7 @@
   }
   //--查询所有的机房
   @PostMapping("allStationName")
   @ApiOperation(notes = "",value="查询所有的机房")
   @ApiOperation(notes = "",value="查询所有的机房—带参")
   public ServiceModel serchAllStationName(@ApiParam(value = "省",required = true) @RequestParam String stationName1,@ApiParam(value = "市",required = true) @RequestParam String stationName2,@ApiParam(value = "区",required = true) @RequestParam String stationName5) {
      BattInf binf = new BattInf();
      User_inf uinf = (User_inf) ActionUtil.getUser();
@@ -256,19 +267,10 @@
   //判断新增的电池组是否存在
   @PostMapping("judgeBatt")
   @ApiOperation(notes = "",value="判断新增的电池组是否存在")
   public ServiceModel judgeBatt(@RequestParam String stationName) {
   public ServiceModel judgeBatt(@ApiParam(value = "站点",required = true) @RequestParam String stationName) {
      BattInf binf = new BattInf();
      binf.setStationName(stationName);
      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查询不重复的单体编号
@@ -292,53 +294,121 @@
      return service.serchBatt(binf);
   }
   //TODO 数据不足待测
   //6.4.7按地域和标称电压分组统计蓄电池组服役超期的数量
         /*
       * 区域层次放在stationid中
       * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
       * moncount中存放统计季度:一季度为1 以此类推
       * monnum 中存放年份*/
   @GetMapping("beyondTime")
   @ApiOperation(notes = "区域层次放在stationid中 battgroupnum 中存放统计方式:年度统计为0 季度统计为1 moncount中存放统计季度:一季度为1 以此类推 monnum 中存放年份",value="按地域和标称电压分组统计蓄电池组服役超期的数量")
   public ServiceModel serchBeyondTime(@RequestBody BattInf bif){
      // bif=ActionUtil.getGson("yyyy-MM-dd").fromJson(result,BattInf.class);
      return service.serchBeyondTime(bif);
       * moncount中存放统计季度:一季度为1 以此类推 -3
       * monnum 中存放年份 -2020*/
   @PostMapping("beyondTime")
   @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);
      } catch (NumberFormatException e) {
         e.printStackTrace();
         model.setMsg("参数不合法");
         return model;
      }
      BattInf binf = new BattInf();
      binf.setStationId(stationId);
      binf.setBattGroupNum(battGroupNum);
      binf.setMonNum(monNum);
      binf.setMonCount(monCount);
      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);
   }
@@ -350,47 +420,70 @@
      return service.serchAllStation(u);
   }
   //搜索机房或电池组
   @GetMapping("stationOrBattGroup")
   @ApiOperation(notes = "",value="搜索机房或电池组")
   public ServiceModel serchStationOrBattgroup(@RequestBody BattInf binf){
      // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
   //搜索机房或电池组
   @PostMapping("stationOrBattGroup")
   @ApiOperation(notes = "num:1 机房;0电池组 两种状态 stationName9 模糊查询条件", value = "搜索机房或电池组")
   public ServiceModel serchStationOrBattgroup(@ApiParam(value = "1 机房;0 电池组",required = true) @RequestParam Integer num,@RequestParam String stationName9) {
      BattInf binf = new BattInf();
      binf.setNum(num);
      binf.setStationName9(stationName9);
      return service.serchStationOrBattgroup(binf);
   }
   //根据机房id查询机房下的电池组信息
   @GetMapping("battByStationId")
   @PostMapping("battByStationId")
   @ApiOperation(notes = "",value="机房id查询机房下的电池组信息")
   public ServiceModel serchBattByStation(@RequestBody BattInf binf){
      // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
      // result = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").toJson(model);
   public ServiceModel serchBattByStation(@RequestParam String stationId){
      ServiceModel model = new ServiceModel();
      BattInf binf = new BattInf();
      try {
         Integer.parseInt(stationId);
      } catch (NumberFormatException e) {
         e.printStackTrace();
         model.setMsg("参数不合法");
         return model;
      }
      binf.setStationId(stationId);
      return service.serchBattByStation(binf);
   }
   
   //查询所有的电池组数
   @GetMapping("battCount")
   @ApiOperation(notes = "",value="查询所有的电池组数")
   public ServiceModel serchAllBatt(){
   public ServiceModelOnce serchAllBatt(){
      User_inf u = (User_inf)ActionUtil.getUser();
      return service.serchAllBatt(u);
   }
   //查站点下的所有设备名称
   @GetMapping("devNameByStationName3")
   @ApiOperation(notes = "",value="查站点下的所有设备名称")
   public ServiceModel searchDevByStationName3(@RequestBody BattInf binf){
      // BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
   //查站点下的所有设备名称
   @PostMapping("devNameByStationName3")
   @ApiOperation(notes = "模糊查询", value = "查站点下的所有设备名称")
   public ServiceModel searchDevByStationName3(@ApiParam(value = "省", required = true) @RequestParam String stationName1, @ApiParam(value = "市", required = true) @RequestParam String stationName2,
                                    @ApiParam(value = "机房", required = true) @RequestParam String stationName3, @ApiParam(value = "区", required = true) @RequestParam String stationName5) {
      BattInf binf = new BattInf();
      binf.setStationName1(stationName1);
      binf.setStationName2(stationName2);
      binf.setStationName3(stationName3);
      binf.setStationName5(stationName5);
      return service.searchDevByStationName3(binf);
   }
   
   //首页上根据stationid查询电池组的机历卡
   @GetMapping("battAllInfoByStationId")
   @PostMapping("battAllInfoByStationId")
   @ApiOperation(notes = "",value="首页上根据stationid查询电池组的机历卡")
   public ServiceModel serchBattAllInfoByStationId(@RequestBody BattInf binf){
      // BattInf binf=getGson("yyyy-MM-dd HH:mm:ss").fromJson(json, BattInf.class);
   public ServiceModel serchBattAllInfoByStationId(@RequestParam String stationId){
      ServiceModel model = new ServiceModel();
      BattInf binf = new BattInf();
      try {
         Integer.parseInt(stationId);
      } catch (NumberFormatException e) {
         e.printStackTrace();
         model.setMsg("参数不合法");
         return model;
      }
      binf.setStationId(stationId);
      return service.serchBattAllInfoByStationId(binf);
   }
   //跨域访问获取所有电池组的信息<-------跨域----------->
@@ -403,7 +496,7 @@
   }
   //添加新的电池组
   @PostMapping("ky")
   @ApiOperation(notes = "",value="添加新的电池组")
   @ApiOperation(notes = "TODO",value="添加新的电池组TODO")
   public ServiceModel add_ky(@RequestBody List<BattInf> list) {
      // List<BattInf> list= getGson("yyyy-MM-dd").fromJson(json, new TypeToken<List<BattInf>>(){}.getType());
@@ -428,10 +521,10 @@
   
   //查询电池组信息<大屏显示>
   @GetMapping("battOnBigScreen")
   @ApiOperation(notes = "",value="查询电池组信息<大屏显示>")
   public ServiceModel serchBatt_DP(@RequestBody BattInf binf){
      // BattInf binf= getGson("yyyy-MM-dd").fromJson(json, BattInf.class);
   @ApiOperation(notes = "未使用参数查询",value="查询电池组信息<大屏显示>")
   public ServiceModel serchBatt_DP(){
      BattInf binf= new BattInf();
      return service.serchBatt_DP(binf);
   }
   //紫晶山西——---机房列表