ke
2024-08-19 c5f6f451fcd2a5257315590c5a256766fa68e433
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/word/service/impl/SjztmdServiceImpl.java
@@ -14,6 +14,7 @@
import cn.gistack.sm.sjztmd.word.vo.*;
import cn.gistack.sm.sjztods.constant.ZtApiUrlConstant;
import cn.gistack.sm.sjztods.constant.ZtConfigConstant;
import com.alibaba.excel.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@@ -202,7 +203,7 @@
      tableMap.put("totalCap", tbAttResStagChar==null || tbAttResStagChar.getTotalCap()==null?"":WordUtil.removeTrailingZero(tbAttResStagChar.getTotalCap().toString()));
      tableMap.put("desFlStag", tbAttResStagChar==null || tbAttResStagChar.getDesFlStag()==null?"":tbAttResStagChar.getDesFlStag());
      tableMap.put("flprCap", tbAttResStagChar==null || tbAttResStagChar.getFlprCap()==null?"":WordUtil.removeTrailingZero(tbAttResStagChar.getFlprCap().toString()));
      tableMap.put("flConTopStag", tbAttResStagChar==null || tbAttResStagChar.getFlConTopStag()==null?"":tbAttResStagChar.getFlConTopStag());
      tableMap.put("flConTopStag", tbAttResStagChar==null || tbAttResStagChar.getFlConTopStag()==null?"":String.format("%.2f",tbAttResStagChar.getFlConTopStag()));
      tableMap.put("flSortCap", tbAttResStagChar==null || tbAttResStagChar.getFlStorCap()==null?"":tbAttResStagChar.getFlStorCap());
      tableMap.put("corNormStag", tbAttResStagChar==null || tbAttResStagChar.getCorNormStag()==null?"":String.format("%.2f",tbAttResStagChar.getCorNormStag()));
      tableMap.put("adjustStorCap", tbAttResStagChar==null || tbAttResStagChar.getAdjustStorCap()==null?"":WordUtil.removeTrailingZero(tbAttResStagChar.getAdjustStorCap().toString()));
@@ -222,12 +223,21 @@
      String afe = tbAttResStagChar==null?"":tbAttResStagChar.getAfterFloodEnd() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getAfterFloodEnd()) : "";
      tableMap.put("beforeFloodStart", bfs);
      tableMap.put("beforeFloodEnd", bfe);
      if (!StringUtils.isEmpty(bfs) && !StringUtils.isEmpty(bfe)) {
         tableMap.put("beforeFloodDataInfo", bfs + "-" + bfe);
      }
      tableMap.put("midFloodStart", mfs);
      tableMap.put("midFloodEnd", mfe);
      if (!StringUtils.isEmpty(mfs) && !StringUtils.isEmpty(mfe)) {
         tableMap.put("midFloodDataInfo", mfs + "-" + mfe);
      }
      tableMap.put("afterFloodStart", afs);
      tableMap.put("afterFloodEnd", afe);
      tableMap.put("desFloodFlowMax", tbAttResStagChar==null || tbAttResStagChar.getDesFloodFlowMax()==null?"":tbAttResStagChar.getDesFloodFlowMax());
      tableMap.put("checFloodFlowMax", tbAttResStagChar==null || tbAttResStagChar.getChecFloodFlowMax()==null?"":tbAttResStagChar.getChecFloodFlowMax());
      if (!StringUtils.isEmpty(afs) && !StringUtils.isEmpty(afe)) {
         tableMap.put("afterFloodDataInfo", afs + "-" + afe);
      }
      tableMap.put("desFloodFlowMax", tbAttResStagChar==null || tbAttResStagChar.getDesFloodFlowMax()==null?"":WordUtil.removeTrailingZero(tbAttResStagChar.getDesFloodFlowMax().toString()));
      tableMap.put("checFloodFlowMax", tbAttResStagChar==null || tbAttResStagChar.getChecFloodFlowMax()==null?"":WordUtil.removeTrailingZero(tbAttResStagChar.getChecFloodFlowMax().toString()));;
      String mainDamType = "";
      String mainDamMainFoundation = "";
@@ -288,7 +298,7 @@
      tableMap.put("mainUpDamProtectType", mainUpDamProtectType);
      tableMap.put("mainDownDamProtectType", mainDownDamProtectType);
      tableMap.put("damMainBodyType", damMainBodyType);
      tableMap.put("damMainBodyTopElevation", damMainBodyTopElevation);
      tableMap.put("damMainBodyTopElevation", StringUtil.isNotBlank(damMainBodyTopElevation)?String.format("%.2f",Double.parseDouble(damMainBodyTopElevation)):"");
      tableMap.put("damMainDrainType", damMainDrainType);
      tableMap.put("mainDamBodyType", mainDamBodyType);
      int subDamNumNew = tbAttResWaterBlockList.size() - 1;
@@ -332,15 +342,25 @@
      if (tbAttResRsbNorspiList != null && tbAttResRsbNorspiList.size() > 0 && tbAttResRsbNorspiList.get(0).getNum() != null && tbAttResRsbNorspiList.get(0).getNum() > 0) {
         TbAttResRsbNorspi tbAttResRsbNorspi = tbAttResRsbNorspiList.get(0);
         norSpillwayType = SpillwayTypeEnum.find(tbAttResRsbNorspi.getSpillwayType()).getLabel();
         if (tbAttResRsbNorspi.getSpillwayType().indexOf("9") > -1) {
            String [] spillwayTypeStrs = tbAttResRsbNorspi.getSpillwayType().split(",");
            if (spillwayTypeStrs.length > 1) {
               norSpillwayType = spillwayTypeStrs[1];
            } else {
               norSpillwayType = SpillwayTypeEnum.find(tbAttResRsbNorspi.getSpillwayType()).getLabel();
            }
         } else {
            norSpillwayType = SpillwayTypeEnum.find(tbAttResRsbNorspi.getSpillwayType()).getLabel();
         }
         isLocDamBody = tbAttResRsbNorspi.getIsLocDamBody();
         norWeirTopElevation = isNullObject(tbAttResRsbNorspi.getWeirTopElevation());
         norWeirTopWidth = isNullObject(tbAttResRsbNorspi.getWeirTopWidth());
         if (tbAttResRsbNorspi.getIsGate() == "否") {
         if (null != tbAttResRsbNorspi.getIsGate() && tbAttResRsbNorspi.getIsGate().equals("否")) {
            norWorkingGateType = "无闸控制";
         } else if (tbAttResRsbNorspi.getIsGate() == "是") {
         } else if (null != tbAttResRsbNorspi.getIsGate() && tbAttResRsbNorspi.getIsGate().equals("是")) {
            // 平板闸门,3X3
            String typeName = RsbWorkingGateEnum.find(tbAttResRsbNorspi.getWorkingGateType().toString()).getLabel();
            String norwgtStr = "";
@@ -349,9 +369,9 @@
            }
            if (null != tbAttResRsbNorspi.getGateWide()) {
               if (StringUtil.isNotBlank(typeName)) {
                  norwgtStr += "," + tbAttResRsbNorspi.getGateWide() + "×" + tbAttResRsbNorspi.getGateLength();
                  norwgtStr += "," + tbAttResRsbNorspi.getGateNum() + "-" + tbAttResRsbNorspi.getGateWide() + "×" + tbAttResRsbNorspi.getGateLength();
               } else {
                  norwgtStr += tbAttResRsbNorspi.getGateWide() + "×" + tbAttResRsbNorspi.getGateLength();
                  norwgtStr += tbAttResRsbNorspi.getGateNum() + "-" +  tbAttResRsbNorspi.getGateWide() + "×" + tbAttResRsbNorspi.getGateLength();
               }
            }
//            norWorkingGateType = StringUtil.format("{},{}X{}", typeName, tbAttResRsbNorspi.getGateWide(), tbAttResRsbNorspi.getGateLength());
@@ -376,12 +396,12 @@
         if (StringUtil.isNotBlank(tbAttResRsbNorspi.getOcPower())) {
            list.add(tbAttResRsbNorspi.getOcPower());
         }
         norOc = String.join(",", list);
         norOc = String.join(",", list);
      }
      tableMap.put("norSpillwayType", norSpillwayType);
      tableMap.put("isLocDamBody", isLocDamBody);
      tableMap.put("norWeirTopElevation", norWeirTopElevation);
      tableMap.put("norWeirTopElevation", StringUtils.isEmpty(norWeirTopElevation)?norWeirTopElevation:String.format("%.2f", Double.parseDouble(norWeirTopElevation)));
      tableMap.put("norWeirTopWidth", norWeirTopWidth);
      tableMap.put("norWorkingGateType", norWorkingGateType);
      tableMap.put("norCheckingFloodDischarge", norCheckingFloodDischarge);
@@ -422,7 +442,7 @@
      String rsbWorkingGateType = "";
      String rsbOc = "";
      if (tbAttResRsbSpillwayList != null && tbAttResRsbSpillwayList.size() > 0 && tbAttResRsbSpillwayList.get(0).getNum() > 0) {
      if (tbAttResRsbSpillwayList != null && tbAttResRsbSpillwayList.size() > 0) {
         TbAttResRsbSpillway tbAttResRsbSpillway = tbAttResRsbSpillwayList.get(0);
         //类型为其他,有补充说明
@@ -432,21 +452,26 @@
         coveLength = isNullObject(tbAttResRsbSpillway.getCoveLength());
         rsbThresholdElevation = isNullObject(tbAttResRsbSpillway.getThresholdElevation());
         rsbExportElevation = isNullObject(tbAttResRsbSpillway.getExportElevation());
         rsbSection = StringUtil.format("{}×{}", tbAttResRsbSpillway.getSectionWide(), tbAttResRsbSpillway.getSectionLength());
         ;
         if (null != tbAttResRsbSpillway.getSectionWide() && null != tbAttResRsbSpillway.getSectionLength())
            rsbSection = StringUtil.format("{}×{}", tbAttResRsbSpillway.getSectionWide(), tbAttResRsbSpillway.getSectionLength());
         checkFlDisCharge = isNullObject(tbAttResRsbSpillway.getCheckFlDisCharge());
         List<String> list = new ArrayList<>();
         list.add(convertType(tbAttResRsbSpillway.getOcType(), "OcTypeEnum"));
         list.add(tbAttResRsbSpillway.getOcPower());
         rsbOc = String.join(",", list);
         if (StringUtil.isNotBlank(convertType(tbAttResRsbSpillway.getOcType(), "OcTypeEnum")) &&
         StringUtil.isNotBlank(tbAttResRsbSpillway.getOcPower())) {
            rsbOc = String.join(",", list);
         }
      }
      tableMap.put("rsbSpillwayType", rsbSpillwayType);
      tableMap.put("coveLength", coveLength);
      tableMap.put("rsbThresholdElevation", rsbThresholdElevation);
      tableMap.put("rsbThresholdElevation", StringUtils.isEmpty(rsbThresholdElevation)?rsbThresholdElevation:String.format("%.2f",Double.parseDouble(rsbThresholdElevation)));
      tableMap.put("rsbExportElevation", rsbExportElevation);
      tableMap.put("rsbSection", rsbSection);
      tableMap.put("checkFlDisCharge", checkFlDisCharge);
@@ -480,17 +505,17 @@
         else
            deliverSection = StringUtil.format("φ{}", tbAttResWaterDelivery.getSectionWide());
         designFlow = isNullObject(tbAttResWaterDelivery.getDesignFlow());
         workingGateType = tbAttResWaterDelivery.getWorkingGateType();
         workingGateType = convertType(tbAttResWaterDelivery.getWorkingGateType(), "RsbWorkingGateEnum");
         List<String> list = new ArrayList<>();
         list.add(tbAttResWaterDelivery.getOcType());
         list.add(tbAttResWaterDelivery.getOcPower());
         deliverOc = String.join(",", list);
         list.add(convertType(tbAttResWaterDelivery.getOcType(), "SpillwayHoleType"));
         list.add(convertType(tbAttResWaterDelivery.getOcPower(), "SpillwayHoleType"));
         deliverOc = String.join(",", list);
         if (i == 0) {
            tableMap.put("输水建筑物名称1", StringUtil.isBlank(tbAttResWaterDelivery.getName())?"输水建筑物":tbAttResWaterDelivery.getName());
            tableMap.put("aqueductType1", aqueductType);
            tableMap.put("aqueductLength1", aqueductLength);
            tableMap.put("thresholdElevation1", thresholdElevation);
            tableMap.put("thresholdElevation1",  StringUtils.isEmpty(thresholdElevation)?thresholdElevation:String.format("%.2f",Double.parseDouble(thresholdElevation)));
            tableMap.put("exportElevation1", exportElevation);
            tableMap.put("deliverSection1", deliverSection);
            tableMap.put("designFlow1", designFlow);
@@ -501,7 +526,7 @@
            tableMap.put("输水建筑物名称2", StringUtil.isBlank(tbAttResWaterDelivery.getName())?"输水建筑物":tbAttResWaterDelivery.getName());
            tableMap.put("aqueductType2", aqueductType);
            tableMap.put("aqueductLength2", aqueductLength);
            tableMap.put("thresholdElevation2", thresholdElevation);
            tableMap.put("thresholdElevation2",  StringUtils.isEmpty(thresholdElevation)?thresholdElevation:String.format("%.2f",Double.parseDouble(thresholdElevation)));
            tableMap.put("exportElevation2", exportElevation);
            tableMap.put("deliverSection2", deliverSection);
            tableMap.put("designFlow2", designFlow);
@@ -512,12 +537,12 @@
            tableMap.put("输水建筑物名称3", StringUtil.isBlank(tbAttResWaterDelivery.getName())?"输水建筑物":tbAttResWaterDelivery.getName());
            tableMap.put("aqueductType3", aqueductType);
            tableMap.put("aqueductLength3", aqueductLength);
            tableMap.put("thresholdElevation3", thresholdElevation);
            tableMap.put("thresholdElevation3",  StringUtils.isEmpty(thresholdElevation)?thresholdElevation:String.format("%.2f",Double.parseDouble(thresholdElevation)));
            tableMap.put("exportElevation3", exportElevation);
            tableMap.put("deliverSection3", deliverSection);
            tableMap.put("designFlow3", designFlow);
            tableMap.put("workingGateType3", workingGateType);
            tableMap.put("deliverOc", deliverOc);
            tableMap.put("deliverOc3", deliverOc);
         }
      }
@@ -553,7 +578,7 @@
      //水电站
      String plantLayoutType = "";
      double installedCapacity = 0d;
      String installedCapacity = "";
      String yearAvgHour = "";
      //当电站列表不为空 且 电站列表数量大于0 且num大于0  -- 2024-07-18修改,展示多个
//      if (tbAttResPowerStationList != null && tbAttResPowerStationList.size() > 0 && tbAttResPowerStationList.get(0).getNum()!=null && tbAttResPowerStationList.get(0).getNum() > 0) {
@@ -573,7 +598,11 @@
            plantLayoutType = plantLayoutType + "、" + PlantLayoutTypeEnum.find(tbAttResPowerStation.getPlantLayoutType()).getLabel();
         }
         installedCapacity = installedCapacity + tbAttResPowerStation.getInstalledCapacity();
         if (StringUtil.isBlank(installedCapacity)) {
            installedCapacity = WordUtil.removeTrailingZero(isNullObject(tbAttResPowerStation.getInstalledCapacity()));
         } else {
            installedCapacity = installedCapacity + "+" + WordUtil.removeTrailingZero(isNullObject(tbAttResPowerStation.getInstalledCapacity()));
         }
         if (StringUtil.isBlank(yearAvgHour)) {
            yearAvgHour = WordUtil.removeTrailingZero(isNullObject(tbAttResPowerStation.getYearAvgHour()));
@@ -583,8 +612,8 @@
      }
      tableMap.put("plantLayoutType", plantLayoutType);
      tableMap.put("installedCapacity", WordUtil.removeTrailingZero(installedCapacity + ""));
      tableMap.put("yearAvgHour", yearAvgHour);
      tableMap.put("installedCapacity", !installedCapacity.equals("0")?installedCapacity:"");
      tableMap.put("yearAvgHour", !yearAvgHour.equals("0")?yearAvgHour:"");
      //水库效益
      List<String> protectList = new ArrayList<>();
@@ -624,13 +653,13 @@
         tableMap.put("protect", String.join("、", protectList));
      }
      double person = 0;
      if (tbAttResEngBene !=null && tbAttResEngBene.getFlControlPerson() != null) {
      if (tbAttResEngBene !=null && tbAttResEngBene.getFlControlPerson() != null && tbAttResEngBene.getFlControlPerson() > 0 ) {
         person = tbAttResEngBene.getFlControlPerson() / 10000.0;
         tableMap.put("flControlPerson", WordUtil.removeTrailingZero(String.format("%.2f", person)));
      } else {
         tableMap.put("flControlPerson", "");
      }
      tableMap.put("flControlLand", tbAttResEngBene==null?"":tbAttResEngBene.getFlControlLand()==null?"":
      tableMap.put("flControlLand", tbAttResEngBene==null?"":tbAttResEngBene.getFlControlLand()==null || tbAttResEngBene.getFlControlLand() <= 0?"":
         WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand() / 10000)));
      tableMap.put("irrObject", tbAttResEngBene==null?"":tbAttResEngBene.getIrrObject()==null?"":tbAttResEngBene.getIrrObject());
      tableMap.put("moyearIrrAvg", tbAttResEngBene==null?"":tbAttResEngBene.getMoyearIrrAvg() == null?"":
@@ -650,7 +679,7 @@
//      }
      tableMap.put("supplyPopulation", tbAttResEngBene.getSupplyPopulation());
      tableMap.put("supplyPopulation", tbAttResEngBene==null?"":tbAttResEngBene.getSupplyPopulation()==null?"":tbAttResEngBene.getSupplyPopulation());
      tableMap.put("moyearSupplyAvg", tbAttResEngBene==null?"":tbAttResEngBene.getMoyearSupplyAvg()==null?"":tbAttResEngBene.getMoyearSupplyAvg());
      tableMap.put("moyearPowerAvg", tbAttResEngBene==null?"":tbAttResEngBene.getMoyearPowerAvg()==null?"":tbAttResEngBene.getMoyearPowerAvg());
      tableMap.put("ecologicalFlow", tbAttResEngBene==null?"":tbAttResEngBene.getEcologicalFlow()==null?"":tbAttResEngBene.getEcologicalFlow());
@@ -1230,6 +1259,10 @@
   private String convertType(String type, String enumName) {
      if (StringUtil.isBlank(type)) {
         return "";
      }
      String text = "";
      List<String> typeList = Arrays.asList(type.split(","));