ke
2024-08-19 c5f6f451fcd2a5257315590c5a256766fa68e433
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/word/vo/TbWordVO.java
@@ -163,14 +163,20 @@
               List<AttResManagePerson> attResManagePeople) {
      //取设计流量大的进行描述
      List<TbAttResWaterDelivery> sortList =
         tbAttResWaterDeliveryList.stream()
            .sorted((a, b) -> {
               Optional<Double> flowA = Optional.ofNullable(a.getDesignFlow());
               Optional<Double> flowB = Optional.ofNullable(b.getDesignFlow());
               return flowA.isPresent() && flowB.isPresent() ? flowA.get().compareTo(flowB.get()) : (flowA.isPresent() ? 1 : (flowB.isPresent() ? -1 : 0));
            })
            .collect(Collectors.toList());
//      List<TbAttResWaterDelivery> sortList =
//         tbAttResWaterDeliveryList.stream()
//            .sorted((a, b) -> {
//               Optional<Double> flowA = Optional.ofNullable(a.getDesignFlow());
//               Optional<Double> flowB = Optional.ofNullable(b.getDesignFlow());
//               return flowA.isPresent() && flowB.isPresent() ? flowA.get().compareTo(flowB.get()) : (flowA.isPresent() ? 1 : (flowB.isPresent() ? -1 : 0));
//            })
//            .collect(Collectors.toList());
      List<TbAttResWaterDelivery> sortList = tbAttResWaterDeliveryList.stream()
         .sorted(Comparator.nullsLast(
            Comparator.comparingDouble(a -> a.getDesignFlow() == null ? Double.POSITIVE_INFINITY : a.getDesignFlow())
         ))
         .collect(Collectors.toList());
      formatTbAttResBase(tbAttResBase);
      formatTbAttResStagChar(tbAttResStagChar);
@@ -201,7 +207,7 @@
      //大坝数量
      int damCount = tbAttResWaterBlockList.size();
      if (damCount > 1) {
         buildingList.add(StringUtil.format("副坝({}座)", damCount - 1));
         buildingList.add(StringUtil.format("副坝({}座)", damCount - 1));
         //根据名字判断主坝
         List<TbAttResWaterBlock> mainDamList = tbAttResWaterBlockList.stream().filter(tbAttResWaterBlock -> tbAttResWaterBlock.getName().indexOf("主坝") > -1).collect(Collectors.toList());
@@ -242,10 +248,15 @@
      //输水建筑物
      if (tbAttResWaterDeliveryList.size()>0&&tbAttResWaterDeliveryList.get(0).getNum()  != null &&  tbAttResWaterDeliveryList.get(0).getNum() > 0) {
         tbAttResWaterDeliveryList.forEach(tbAttResWaterDelivery -> {
//            buildingList.add( convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum"));
//         tbAttResWaterDeliveryList.forEach(tbAttResWaterDelivery -> {
////            buildingList.add( convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum"));
//            buildingList.add("输水建筑物");
//         });
         if (tbAttResWaterDeliveryList.size() > 1) {
            buildingList.add(StringUtil.format("输水建筑物({}座)",tbAttResWaterDeliveryList.size()));
         } else {
            buildingList.add("输水建筑物");
         });
         }
      }
      //电站
@@ -294,6 +305,9 @@
    * @return
    */
   private String GenerateNorspiInfo(TbAttResRsbNorspi norspi) {
      if(null == norspi || StringUtil.isBlank(norspi.getName())) {
         return "";
      }
      /**
       * 溢洪道(第一座泄水建筑物为溢洪道)为正槽式溢洪道(溢洪道型式),
       * 有闸控制(溢洪道根据是否有闸控制确定,填有闸控制、无闸控制),堰顶高程XXm,堰顶净宽XXm,
@@ -301,6 +315,7 @@
       */
      String typeName = SpillwayTypeEnum.find(norspi.getSpillwayType()).getLabel();
//      String typeName = norspi.getName();
      if (StringUtil.isBlank(typeName) && norspi.getSpillwayType().indexOf(",") > -1) {
         String [] tmpSt = norspi.getSpillwayType().split(",");
         if (tmpSt[0].equals("9")) {
@@ -313,7 +328,7 @@
      if (norspi.getIsGate().equals("是")) {
         gateText = "有闸控制";
         String hole = norspi.getGateNum() == 1 ? "单" : String.valueOf(norspi.getGateNum());
         holeText = StringUtil.format(",设{}孔", hole);
         holeText = StringUtil.format(",{}孔", hole);
      } else {
         gateText = "无闸控制";
      }
@@ -518,7 +533,7 @@
         hydrologicalCharacteristicsList.add(StringUtil.format("死库容{}万m³", WordUtil.removeTrailingZero(tbAttResStagChar.getDeadCap().toString())));
      }
      if (tbAttResStagChar.getChecFlStag() != null) {
         hydrologicalCharacteristicsList2.add(StringUtil.format("校核洪水位{}m", String.format("%.2f",tbAttResStagChar.getChecFlStag())));
         hydrologicalCharacteristicsList2.add(StringUtil.format("水库校核洪水位{}m", String.format("%.2f",tbAttResStagChar.getChecFlStag())));
      }
      if (tbAttResStagChar.getDesFlStag() != null) {
         hydrologicalCharacteristicsList2.add(StringUtil.format("设计洪水位{}m", String.format("%.2f",tbAttResStagChar.getDesFlStag())));
@@ -546,15 +561,45 @@
         this.aqueductType = "水库采用";
      }
      this.aqueductType = this.aqueductType + convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum") + "输水";
      this.section = isNull(tbAttResWaterDelivery.getSectionWide()) + "×" + isNull(tbAttResWaterDelivery.getSectionHigh());
      this.thresholdElevation = String.format("%.2f",tbAttResWaterDelivery.getThresholdElevation());
      if (StringUtil.isNotBlank(tbAttResWaterDelivery.getAqueductType())) {
         this.aqueductType = this.aqueductType + convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum") + "输水";
      } else {
         this.aqueductType = "";
      }
      this.designFlow = WordUtil.removeTrailingZero(isNull(tbAttResWaterDelivery.getDesignFlow()));
      if (null != tbAttResWaterDelivery.getSectionWide()  && null != tbAttResWaterDelivery.getSectionHigh()) {
         if (StringUtil.isNotBlank(this.aqueductType)) {
            this.section = ",断面尺寸";
         }
         this.section = this.section + isNull(tbAttResWaterDelivery.getSectionWide()) + "×" + isNull(tbAttResWaterDelivery.getSectionHigh()) + "m";
      } else {
         if (null != tbAttResWaterDelivery.getSectionWide()) {
            if (StringUtil.isNotBlank(this.aqueductType)) {
               this.section = ",断面尺寸";
            }
            this.section = this.section + isNull(tbAttResWaterDelivery.getSectionWide()) + "m";
         } else {
            this.section = "";
         }
      }
      if (null != tbAttResWaterDelivery.getThresholdElevation()) {
         if (StringUtil.isNotBlank(this.aqueductType) || StringUtil.isNotBlank(this.section)) {
            this.thresholdElevation = ",进口底槛高程";
         }
         this.thresholdElevation = this.thresholdElevation + String.format("%.2f",tbAttResWaterDelivery.getThresholdElevation()) + "m";
      }
      if (null != tbAttResWaterDelivery.getDesignFlow()) {
         if (StringUtil.isNotBlank(this.aqueductType) || StringUtil.isNotBlank(this.section) || StringUtil.isNotBlank(this.thresholdElevation)) {
            this.designFlow = ",设计流量";
         }
         this.designFlow = this.designFlow + WordUtil.removeTrailingZero(isNull(tbAttResWaterDelivery.getDesignFlow())) + "m³/s。";
      }
   }
@@ -564,9 +609,9 @@
         return;
      }
      this.protectCity = tbAttResEngBene.getCity().equals("无")?tbAttResEngBene.getTown():tbAttResEngBene.getCity();
      this.protectCity = tbAttResEngBene.getCity().equals("无")?"保护下游" + tbAttResEngBene.getTown():"保护下游" + tbAttResEngBene.getCity();
      if (StringUtil.isBlank(this.protectCity)) {
         this.protectCity = tbAttResEngBene.getTown().equals("无")?"":tbAttResEngBene.getTown();
         this.protectCity = tbAttResEngBene.getTown().equals("无")?"":"保护下游" + tbAttResEngBene.getTown();
      }
      double person = tbAttResEngBene.getFlControlPerson() / 10000.0;
@@ -577,14 +622,15 @@
      if (tbAttResEngBene.getFlControlLand() > 0) {
         if (StringUtil.isBlank(this.protectPersonLand)) {
            this.protectPersonLand = WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand())) + "万亩耕地";
            this.protectPersonLand = WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand()/ 10000.0)) + "万亩耕地";
         } else {
            this.protectPersonLand = this.protectPersonLand + "、" + WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand())) + "万亩耕地";
            this.protectPersonLand = this.protectPersonLand + "、" + WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand()/ 10000.0)) + "万亩耕地";
         }
      }
      this.protectPersonLand =
         StringUtil.format("{}万人口、{}万亩耕地", WordUtil.removeTrailingZero(String.format("%.2f",person)) , WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand() / 1000)));
//      this.protectPersonLand =
//         StringUtil.format("{}万人口、{}万亩耕地", WordUtil.removeTrailingZero(String.format("%.2f",person)) , WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand() / 1000)));
      ////铁路、公路、管线、企业几个依次罗列,超过三个列出第二个后为“XX等”,后面不需罗列
      String railway = tbAttResEngBene.getRailway();
@@ -613,9 +659,19 @@
      //超过三个列出第二个后为“XX等”,后面不需罗列
      if (protectList.size() > 3) {
         List<String> sublist = protectList.subList(0, 2);
         this.protectThings = String.join(";", sublist) + "等";
         this.protectThings = "及" + String.join("、", sublist) + "等";
      } else if(protectList.size() >= 1 ){
         this.protectThings = "及" + String.join("、", protectList);
      } else {
         this.protectThings = String.join(";", protectList);
         this.protectThings = "";
      }
      if ((this.protectCity.equals("无") || StringUtil.isBlank(this.protectCity) || this.protectCity.equals("保护下游无")) &&
         StringUtil.isBlank(this.protectPersonLand) &&
         StringUtil.isBlank(this.protectThings)) {
         this.protectCity = "无防洪保护对象";
      } else {
         this.protectThings = this.protectThings  + "的防洪安全";
      }
      this.economicBenefit = "";
@@ -633,12 +689,16 @@
         if (StringUtils.isNotBlank(this.economicBenefit)) {
            this.economicBenefit = this.economicBenefit +
               StringUtil.format("此外,水库为{}{}万人提供生活用水,年均供水量{}万m³。",
                  tbAttResEngBene.getSupplyObject(),StringUtil.isBlank(tbAttResEngBene.getSupplyPopulation())?"":String.format("%.2f", Double.parseDouble(tbAttResEngBene.getSupplyPopulation())), tbAttResEngBene.getMoyearSupplyAvg());
                  tbAttResEngBene.getSupplyObject(),
                  StringUtil.isBlank(tbAttResEngBene.getSupplyPopulation())?"":String.format("%.2f", Double.parseDouble(tbAttResEngBene.getSupplyPopulation())),
                  tbAttResEngBene.getMoyearSupplyAvg());
         } else {
            //无灌溉有供水直接介绍供水
            this.economicBenefit =
               StringUtil.format("水库为{}{}万人提供生活用水,年均供水量{}万m³。",
                  tbAttResEngBene.getSupplyObject(),String.format("%.2f", StringUtil.isBlank(tbAttResEngBene.getSupplyPopulation())?"":Double.parseDouble(tbAttResEngBene.getSupplyPopulation())/ 10000), tbAttResEngBene.getMoyearSupplyAvg());
                  tbAttResEngBene.getSupplyObject(),
                  String.format("%.2f", StringUtil.isBlank(tbAttResEngBene.getSupplyPopulation())?"":Double.parseDouble(tbAttResEngBene.getSupplyPopulation())),
                  tbAttResEngBene.getMoyearSupplyAvg());
         }
      }
@@ -658,10 +718,10 @@
      //(若一类坝,不介绍问题,二、三类坝介绍)
      if (tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("1")) {
         this.safetyMonitorText = StringUtil.format("{},水库进行安全鉴定,鉴定结果为“{}”。",
            time, type);
      } else {
         this.safetyMonitorText = StringUtil.format("{},水库进行安全鉴定,鉴定结果为“{}”,工程主要存在问题为{}",
            time, type, surveyProblem);
            time, type).replaceAll("。。","。");
      } else if (tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("2") || tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("3")) {
         this.safetyMonitorText = StringUtil.format("{},水库进行安全鉴定,鉴定结果为“{}”,工程主要存在问题为{}。",
            time, type, surveyProblem).replaceAll("。。","。");
      }
   }
@@ -673,7 +733,7 @@
      this.mUnitName = tbAttResMgrSysB.getMUnitName();
      this.mUnitNature = tbAttResMgrSysB.getMUnitNature().replace("公益类","事业单位");
      this.mUnitPersonNumber = tbAttResMgrSysB.getMUnitPersonNumber().toString();
      this.mUnitPersonNumber = tbAttResMgrSysB.getMUnitPersonNumber() + "";
   }
   //对有补充说明的选项进行转换
@@ -690,7 +750,7 @@
      //key值表示其他
      if (StringUtil.isNotBlank(typeKey)) {
         if (typeKey.equals("9") || typeKey.equals("其他") || Integer.parseInt(typeKey) == 9 ) {
            text = explain;
            text = explain.trim();
         }else{
            switch (enumName) {
               case "AqueductTypeEnum":