whycrzg
2021-02-01 067d0541cbd3a423132d695f4c434cc9a3513947
src/main/java/com/fgkj/services/BattInfServices.java
@@ -558,9 +558,9 @@
    * battgroupnum 中存放统计方式:年度统计为0 季度统计为1
    * moncount中存放统计季度:一季度为1 以此类推
    * monnum 中存放年份*/
   public ServiceModel serchBeyondTime(Object obj){
   public ServiceModel serchBeyondTime(BattInf binf){
      ServiceModel model = new ServiceModel();
      System.out.println(1111111111);
      BattInf binf=(BattInf) obj;
      int year=binf.getMonNum();//获取年份
      int firstMonth=0;//获取起始月份
      int lastMonth=0;//获取结束月份
@@ -592,54 +592,103 @@
         dateLast=ActionUtil.getLastDayOfMonth(year,lastMonth);//结束时间
         binf.setBattInUseDate1(DateUtil.sdf.parse(dateLast));
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      int level = Integer.parseInt(binf.getStationId());
      List<BattInf> listFalse=mapper.serchBylevel(level);
      //求总数
      List<BattInf> list=mapper.serchByMonVolStdGroup(binf);
      List<BattInf> listB=BattinfGroupFactory.finishMonvol(list);
      List<BattInf> listL=BattinfGroupFactory.delMonvol(listB);
      //求超期服役的数量
      List<BattInf> listB=null;
      try {
         year=(new Date()).getYear()+1900-3;//当前时间减去年限
         //System.out.println(year);
         dateFirst=ActionUtil.getFirstDayOfMonth(year,firstMonth);//起始时间
         binf.setBattInUseDate(DateUtil.sdf.parse(dateFirst));
         //System.out.println(binf.getBattInUseDate());
      } catch (ParseException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
      List<BattInf> listY=mapper.serchBeyondTime(binf);//超期服役的电池组数
      List<BattInf> listBY=BattinfGroupFactory.finishMonvol(listY);
      List<BattInf> listLY=BattinfGroupFactory.delMonvol(listBY);
         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> listL=null;
         if (listB!=null&&listB.size()>0){
            listL=BattinfGroupFactory.delMonvol(listB);
         }else{
            model.setCode(0);
            model.setData(listFalse);
            model.setMsg("查询失败!");
            return model;
         }
         //求超期服役的数量
         try {
            year=(new Date()).getYear()+1900-3;//当前时间减去年限
            //System.out.println(year);
            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> listBY=null;
         if (listY!=null&&listY.size()>0){
            listBY=BattinfGroupFactory.finishMonvol(listY);
         }else{
            model.setCode(0);
            model.setData(listFalse);
            model.setMsg("查询失败!");
            return model;
         }
         List<BattInf> listLY=null;
         if (listBY!=null&&listBY.size()>0){
            listLY=BattinfGroupFactory.delMonvol(listBY);
         }else{
            model.setCode(0);
            model.setData(listFalse);
            model.setMsg("查询失败!");
            return model;
         }
      /*for (BattInf b : listBY) {
         System.out.println("0 "+b.getBattGroupNum()+" "+
                  "2v: "+b.getBattGroupId()+" "+
                  "6v: "+b.getMonCount()+" "+
                  "12v: "+b.getMonNum());
      }*/
      int level = Integer.parseInt(binf.getStationId());
      List<BattInf> listFalse=mapper.serchBylevel(level);
//      int level = Integer.parseInt(binf.getStationId());
//      List<BattInf> listFalse=mapper.serchBylevel(level);
     /* for (BattInf b : listL) {
         System.out.println("1 "+b.getBattGroupNum()+" "+
            "2v: "+b.getBattGroupId()+" "+
            "6v: "+b.getMonCount()+" "+
            "12v: "+b.getMonNum());
      }*/
      List<BattInf> listEnd=BattinfGroupFactory.countAll(listL, listLY);
       for (BattInf b : listEnd) {
            System.out.println("2 "+b.getBattGroupNum()+" "+
               "2v: "+b.getBattGroupId()+" 超过2v: "+b.getMonCapStd()+" "+
               "6v: "+b.getMonCount()+"         超过6v: "+b.getMonResStd()+" "+
               "12v: "+b.getMonNum()+"     超过12v: "+b.getMonSerStd());
         if(listL!=null&&listL.size()>0) {
            List<BattInf> listEnd = BattinfGroupFactory.countAll(listL, listLY);
            for (BattInf b : listEnd) {
               System.out.println("2 " + b.getBattGroupNum() + " " +
                     "2v: " + b.getBattGroupId() + " 超过2v: " + b.getMonCapStd() + " " +
                     "6v: " + b.getMonCount() + "         超过6v: " + b.getMonResStd() + " " +
                     "12v: " + b.getMonNum() + "     超过12v: " + b.getMonSerStd());
            }
            model.setCode(1);
            model.setData(listEnd);
            model.setMsg("查询成功!");
         }else{
            model.setCode(0);
            model.setData(listFalse);
            System.out.println(listFalse.size());
            model.setMsg("查询失败!");
         }
      if(listL!=null&&listL.size()>0){
         model.setCode(1);
         model.setData(listEnd);
         model.setMsg("查询成功!");
      }else{
      } catch (Exception e) {
         e.printStackTrace();
         model.setCode(0);
         model.setData(listFalse);
         System.out.println(listFalse.size());