package cn.gistack.sm.sjztmd.word.vo;
|
|
import cn.gistack.sm.sjztmd.entity.*;
|
import cn.gistack.sm.sjztmd.word.enums.*;
|
import cn.gistack.sm.sjztmd.word.util.WordUtil;
|
import com.alibaba.nacos.common.utils.StringUtils;
|
import lombok.Data;
|
import org.checkerframework.checker.formatter.qual.UnknownFormat;
|
import org.springblade.core.tool.utils.StringUtil;
|
|
import java.text.SimpleDateFormat;
|
import java.util.*;
|
import java.util.stream.Collectors;
|
|
@Data
|
public class TbWordVO {
|
|
//水库名称
|
private String resName;
|
|
//========================tb_att_res_base=======================
|
//市
|
private String cityName;
|
|
//区
|
private String countyName;
|
|
//镇
|
private String townName;
|
|
|
//河流名称(tb_att_res_base)
|
private String locRvName;
|
|
//水库功能 前端写死的(三个及三个以上需要加等综合)
|
private String resFuncText;
|
|
//工程等别
|
private String engGrad;
|
|
//工程始建时间
|
private String startTime;
|
|
//下闸蓄水时间
|
private String waterStorageTm;
|
|
//========================tb_att_res_stag_char=======================
|
|
//调节性能 前端写死
|
private String adjustPropText;
|
|
//水库坝址以上控制流域面积
|
private String conArea;
|
|
//流域多年平均降雨量
|
private String moyearRainAvg;
|
|
//多年平均年径流量
|
private String moyearFlAvg;
|
|
//设计洪水标准
|
private String desFlSta;
|
|
//校核洪水标准
|
private String checFlSta;
|
|
//总库容
|
private String totalCap;
|
|
//有就加,没有就不加
|
//水文特征(兴利库容,调洪库容,死库容,校核洪水位、设计洪水位,正常蓄水位,死水位)
|
private String hydrologicalCharacteristics;
|
|
//挡水建筑物数量(例:主坝、{{副坝}} 或 主坝、{{副坝(2座)}} )
|
private String buildingText;
|
|
|
//======================tb_att_res_water_block====================
|
|
//主坝信息 (主坝为粘土心墙坝,坝顶高程55.00m,最大坝高22m,坝长230m,坝顶宽5.5m)
|
private String mainDamInfo;
|
|
//副坝信息
|
private String subDamInfo;
|
|
//正常溢洪道信息
|
private String norspiInfo;
|
|
//泄洪洞信息
|
private String rsbSpillwayInfo;
|
|
//电站信息
|
private String powerStationInfo;
|
|
private String buildingInfo;
|
|
|
//===================tb_att_res_water_delivery”===================
|
// (输水建筑物)若有两个以上输水建筑物,则描述设计流量较大的,若只有一个输水建筑物则去掉“主要
|
|
//输水道形式
|
private String aqueductType;
|
|
//断面尺寸(sectionWide X sectionHigh)
|
private String section;
|
|
//进口底槛高程
|
private String thresholdElevation;
|
|
//设计流量
|
private String designFlow;
|
|
//===================tb_att_res_eng_bene”===================
|
//保护城市
|
private String protectCity;
|
|
//保护人口(万),耕地(亩)
|
private String protectPersonLand;
|
|
//铁路、公路、管线、企业几个依次罗列,超过三个列出第二个后为“XX等”,后面不需罗列
|
//保护铁路
|
private String protectThings;
|
|
//经济效益
|
private String economicBenefit;
|
|
|
//==========================tb_att_res_safety_monitor===================
|
|
private String safetyMonitorText;
|
|
|
//========================tb_att_res_mgr_sys_b======================
|
//管理单位名称
|
private String mUnitName;
|
|
//管理单位性质
|
private String mUnitNature;
|
|
//管理单位职工人数
|
private String mUnitPersonNumber;
|
|
//============================att_res_mgr_sys_b===============
|
//主管部门名称
|
private String cUnitName;
|
|
//==========================att_res_manage_person================
|
//主管部门责任人(2)
|
//主管部门责任人信息
|
private String competentDepartmentInfo;
|
|
//行政主管信息(1)
|
private String administrativeInfo;
|
|
//行政主管单位
|
private String administrativeUnit;
|
|
|
public TbWordVO(TbAttResBase tbAttResBase, TbAttResStagChar tbAttResStagChar,
|
List<TbAttResWaterBlock> tbAttResWaterBlockList, Map<String, Object> resRsbNorsipiVerspiMionitorDetailByGuid, List<TbAttResPowerStation> tbAttResPowerStationList,
|
List<TbAttResWaterDelivery> tbAttResWaterDeliveryList, TbAttResEngBene tbAttResEngBene,
|
TbAttResSafetyMonitor tbAttResSafetyMonitor, TbAttResMgrSysB tbAttResMgrSysB,
|
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(Comparator.nullsLast(
|
Comparator.comparingDouble(a -> a.getDesignFlow() == null ? Double.POSITIVE_INFINITY : a.getDesignFlow())
|
))
|
.collect(Collectors.toList());
|
|
formatTbAttResBase(tbAttResBase);
|
formatTbAttResStagChar(tbAttResStagChar);
|
|
formatMultiInfo(tbAttResWaterBlockList, sortList, resRsbNorsipiVerspiMionitorDetailByGuid, tbAttResPowerStationList);
|
|
|
formatTbAttResWaterDelivery(sortList);
|
formatTbAttResEngBene(tbAttResEngBene);
|
formatTbAttResSafetyMonitor(tbAttResSafetyMonitor);
|
formatTbAttResMgrSysB(tbAttResMgrSysB);
|
formatAttResManagePerson(attResManagePeople);
|
|
}
|
|
private void formatMultiInfo(List<TbAttResWaterBlock> tbAttResWaterBlockList, List<TbAttResWaterDelivery> tbAttResWaterDeliveryList, Map<String, Object> resRsbNorsipiVerspiMionitorDetailByGuid, List<TbAttResPowerStation> tbAttResPowerStationList) {
|
|
//正常溢洪道
|
List<TbAttResRsbNorspi> tbAttResRsbNorspiList = (List<TbAttResRsbNorspi>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbNorspiList");
|
//非常溢洪道
|
List<TbAttResRsbVerspi> tbAttResRsbVerspiList = (List<TbAttResRsbVerspi>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbVerspiList");
|
//泄洪洞
|
List<TbAttResRsbSpillway> tbAttResRsbSpillwayList = (List<TbAttResRsbSpillway>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbSpillwayList");
|
|
|
List<String> buildingList = new ArrayList<>();
|
this.subDamInfo = "";
|
//大坝数量
|
int damCount = tbAttResWaterBlockList.size();
|
if (damCount > 1) {
|
buildingList.add(StringUtil.format("副坝({}座)", damCount - 1));
|
|
//根据名字判断主坝
|
List<TbAttResWaterBlock> mainDamList = tbAttResWaterBlockList.stream().filter(tbAttResWaterBlock -> tbAttResWaterBlock.getName().indexOf("主坝") > -1).collect(Collectors.toList());
|
|
if (mainDamList.size() > 0) {
|
TbAttResWaterBlock mainDam = mainDamList.get(0);
|
this.mainDamInfo = GenerateDamInfo("主坝", mainDam);
|
}
|
|
TbAttResWaterBlock subDam = tbAttResWaterBlockList.get(1);
|
String subDamName = "";
|
if (subDam.getName().equals("")) {
|
subDamName = "副坝";
|
} else {
|
subDamName = subDam.getName();
|
}
|
|
this.subDamInfo = GenerateDamInfo(subDamName, subDam);
|
}else if (damCount == 1){
|
TbAttResWaterBlock mainDam = tbAttResWaterBlockList.get(0);
|
//第一个就是主坝
|
this.mainDamInfo = GenerateDamInfo("主坝", mainDam);
|
}
|
|
//正常溢洪道
|
if (tbAttResRsbNorspiList.size()>0&&tbAttResRsbNorspiList.get(0).getNum() != null && tbAttResRsbNorspiList.get(0).getNum() > 0) {
|
buildingList.add("正常溢洪道");
|
this.norspiInfo = "";
|
this.norspiInfo = GenerateNorspiInfo(tbAttResRsbNorspiList.get(0));
|
}
|
|
//泄洪洞
|
if (tbAttResRsbSpillwayList.size()>0&&tbAttResRsbSpillwayList.get(0).getNum() != null && tbAttResRsbSpillwayList.get(0).getNum() > 0) {
|
buildingList.add("泄洪洞");
|
this.rsbSpillwayInfo = "";
|
this.rsbSpillwayInfo = GenerateRsbSpillwayInfo(tbAttResRsbSpillwayList.get(0));
|
}
|
|
//输水建筑物
|
if (tbAttResWaterDeliveryList.size()>0&&tbAttResWaterDeliveryList.get(0).getNum() != null && tbAttResWaterDeliveryList.get(0).getNum() > 0) {
|
// tbAttResWaterDeliveryList.forEach(tbAttResWaterDelivery -> {
|
//// buildingList.add( convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum"));
|
// buildingList.add("输水建筑物");
|
// });
|
if (tbAttResWaterDeliveryList.size() > 1) {
|
buildingList.add(StringUtil.format("输水建筑物({}座)",tbAttResWaterDeliveryList.size()));
|
} else {
|
buildingList.add("输水建筑物");
|
}
|
}
|
|
//电站
|
if (tbAttResPowerStationList.size()>0&&tbAttResPowerStationList.get(0).getNum() != null && tbAttResPowerStationList.get(0).getNum() > 0) {
|
buildingList.add("水电站");
|
this.powerStationInfo = "";
|
this.powerStationInfo = GenerateStationPowerInfo(tbAttResPowerStationList.get(0));
|
}
|
|
//非常溢洪道
|
if (tbAttResRsbVerspiList.size()>0&&tbAttResRsbVerspiList.get(0).getNum() != null && tbAttResRsbVerspiList.get(0).getNum() > 0) {
|
buildingList.add("非常溢洪道");
|
}
|
|
//挡水建筑物泄洪建筑物正常溢洪道
|
this.buildingText = String.join("、", buildingList);
|
|
|
if (StringUtil.isNotBlank(this.norspiInfo)) {
|
this.buildingInfo = this.subDamInfo + this.norspiInfo;
|
} else {
|
this.buildingInfo = this.subDamInfo + this.rsbSpillwayInfo;
|
}
|
}
|
|
private String GenerateStationPowerInfo(TbAttResPowerStation stationPower) {
|
String text = "";
|
/**
|
* 水电站(若有)为坝后XX式(厂房布置型式),装机容量XXkW,年均利用小时XXh
|
*/
|
|
String type = PlantLayoutTypeEnum.find(stationPower.getPlantLayoutType()).getLabel();
|
String capacity = String.valueOf(stationPower.getInstalledCapacity());
|
String hour = String.valueOf(stationPower.getYearAvgHour());
|
|
text = StringUtil.format("水电站为{},装机容量{}kW,年均利用小时{}h。",
|
type,WordUtil.removeTrailingZero(capacity),WordUtil.removeTrailingZero(hour));
|
|
return text;
|
}
|
|
/**
|
* 生成正常溢洪道描述
|
*
|
* @param norspi 正常溢洪道对象
|
* @return
|
*/
|
private String GenerateNorspiInfo(TbAttResRsbNorspi norspi) {
|
if(null == norspi || StringUtil.isBlank(norspi.getName())) {
|
return "";
|
}
|
/**
|
* 溢洪道(第一座泄水建筑物为溢洪道)为正槽式溢洪道(溢洪道型式),
|
* 有闸控制(溢洪道根据是否有闸控制确定,填有闸控制、无闸控制),堰顶高程XXm,堰顶净宽XXm,
|
* 设X孔(溢洪道闸门数量,有闸控制写,无闸不写,1孔“设X孔”改为“单孔”),最大泄洪量XXm³/s。
|
*/
|
|
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")) {
|
typeName = tmpSt[1];
|
}
|
}
|
|
String gateText = "";
|
String holeText = "";
|
if (norspi.getIsGate().equals("是")) {
|
gateText = "有闸控制";
|
String hole = norspi.getGateNum() == 1 ? "单" : String.valueOf(norspi.getGateNum());
|
holeText = StringUtil.format(",{}孔", hole);
|
} else {
|
gateText = "无闸控制";
|
}
|
|
//堰顶高程
|
String weirTopElevation = isNull(norspi.getWeirTopElevation());
|
|
//堰顶净宽
|
String weirTopWidth = isNull(norspi.getWeirTopWidth());
|
|
String disCharge = isNull(norspi.getCheckingFloodDischarge());
|
|
String text = StringUtil.format("溢洪道为{},{},堰顶高程{}m,堰顶净宽{}m{},最大泄洪量{}m³/s。",
|
typeName, gateText, String.format("%.2f",norspi.getWeirTopElevation()), WordUtil.removeTrailingZero(weirTopWidth), holeText, WordUtil.removeTrailingZero(disCharge));
|
|
return text;
|
}
|
|
/**
|
* 生成泄洪洞描述
|
*
|
* @param tbAttResRsbSpillway
|
* @return
|
*/
|
private String GenerateRsbSpillwayInfo(TbAttResRsbSpillway tbAttResRsbSpillway) {
|
|
/**
|
* 泄洪洞(有溢洪道则不需介绍泄洪洞,无溢洪道则介绍泄洪洞)为XX(泄洪洞型式,若为“其他”,同上生成其他具体内容)泄洪洞,
|
* XX(泄洪洞个数,1个为“单”孔)孔,洞长XXm,进口底槛高程XXm,最大泄量(最大泄洪流量)XXm³/s。
|
*/
|
|
//需要对其他类型进行判断;
|
String type = tbAttResRsbSpillway==null?"":tbAttResRsbSpillway.getSpillwayType();
|
String holeNum = tbAttResRsbSpillway.getSectionNum()==null?"":tbAttResRsbSpillway.getSectionNum() == 1 ? "单" : String.valueOf(tbAttResRsbSpillway.getSectionNum());
|
String coveLength = tbAttResRsbSpillway==null?"":isNull(tbAttResRsbSpillway.getCoveLength());
|
String thresholdElevation = tbAttResRsbSpillway==null?"":isNull(tbAttResRsbSpillway.getThresholdElevation());
|
String chec = tbAttResRsbSpillway==null?"":isNull(tbAttResRsbSpillway.getCheckFlDisCharge());
|
|
String text = StringUtil.format("泄洪洞为{},{}孔,洞长{}m,进口底槛高程{}m,最大泄量(最大泄洪流量){}m³/s。",
|
type, holeNum, coveLength, thresholdElevation, chec);
|
|
return text;
|
}
|
|
/**
|
* 生成大坝描述
|
*
|
* @param name 名字
|
* @param tbAttResWaterBlock 大坝对象
|
* @return
|
*/
|
private String GenerateDamInfo(String name, TbAttResWaterBlock tbAttResWaterBlock) {
|
|
/**
|
* XX为XX坝(坝型,填“其他”则对应具体其他内容,下同),坝顶高程XXm,最大坝高XXm,坝长XXm,坝顶宽Xm。
|
*/
|
//坝型
|
String mainDamType = DamTypeEnum.find(tbAttResWaterBlock.getDamType()).getLabel();
|
//坝高
|
String mainDamTopElevation = isNull(tbAttResWaterBlock.getDamTopElevation());
|
//最大坝高
|
String mainDamHeight = isNull(tbAttResWaterBlock.getDamHeight());
|
//坝长
|
String mainDamTopLength = isNull(tbAttResWaterBlock.getDamTopLength());
|
//坝宽
|
String mainDamWidth = isNull(tbAttResWaterBlock.getDamWidth());
|
|
|
String info = StringUtil.format("{}为{},坝顶高程{}m,最大坝高{}m,坝长{}m,坝顶宽{}m。",
|
name, mainDamType, String.format("%.2f",tbAttResWaterBlock.getDamTopElevation()), mainDamHeight, WordUtil.removeTrailingZero(mainDamTopLength), WordUtil.removeTrailingZero(mainDamWidth));
|
|
return info;
|
}
|
|
|
private void formatAttResManagePerson(List<AttResManagePerson> attResManagePeople) {
|
for (int i = 0; i < attResManagePeople.size(); i++) {
|
AttResManagePerson attResManagePerson = attResManagePeople.get(i);
|
|
if (attResManagePerson.getType().equals("1")) {
|
//行政
|
this.administrativeInfo = StringUtil.format("{}({},{})",
|
attResManagePerson.getUserName(), attResManagePerson.getPosition(), attResManagePerson.getUserPhone());
|
|
this.administrativeUnit = attResManagePerson.getUserUnit();
|
}
|
|
if (attResManagePerson.getType().equals("3")) {
|
//主管
|
this.competentDepartmentInfo = StringUtil.format("{}({},{})",
|
attResManagePerson.getUserName(), attResManagePerson.getPosition(), attResManagePerson.getUserPhone());
|
|
}
|
}
|
}
|
|
|
private void formatTbAttResBase(TbAttResBase tbAttResBase) {
|
|
if (tbAttResBase == null){
|
return;
|
}
|
|
//水库名称
|
this.resName = tbAttResBase.getName();
|
//所在河流
|
this.locRvName = tbAttResBase.getLocRvName();
|
|
//行政区划 市、县、镇
|
if (StringUtil.isNotBlank(tbAttResBase.getBuildAddress())) {
|
List<String> regionList = Arrays.asList(tbAttResBase.getBuildAddress().split("-"));
|
if (regionList.size() == 4) {
|
this.cityName = regionList.get(1);
|
this.countyName = regionList.get(2);
|
this.townName = regionList.get(3);
|
}else if (regionList.size() == 3) {
|
this.cityName = regionList.get(1);
|
this.countyName = regionList.get(2);
|
this.townName = "";
|
} else if (regionList.size() == 2){
|
this.cityName = regionList.get(1);
|
this.countyName = "";
|
this.townName = "";
|
} else {
|
this.cityName = "";
|
this.countyName = "";
|
this.townName = "";
|
}
|
|
}
|
|
//水库功能
|
if (StringUtil.isNotBlank(tbAttResBase.getResFunc())) {
|
List<String> resFucList = Arrays.asList(tbAttResBase.getResFunc().split(","));
|
List<String> resFucTextList = new ArrayList<>();
|
for (int i = 0; i < resFucList.size(); i++) {
|
//最多三个,三个后加上等综合
|
if (i > 2) {
|
break;
|
}
|
String key = resFucList.get(i);
|
ResFucEnum resFucEnum = ResFucEnum.find(key);
|
resFucTextList.add(resFucEnum.getLabel());
|
}
|
|
String resFuncText = String.join("、", resFucTextList);
|
if (resFucList.size() >= 3) {
|
resFuncText = resFuncText + "等";
|
}
|
this.resFuncText = resFuncText;
|
|
}
|
|
//工程等别
|
if (tbAttResBase.getEngGrad() != null){
|
this.engGrad = tbAttResBase.getEngGrad();
|
}
|
|
if (tbAttResBase.getStartTime() != null){
|
//开工时间 (2022年9月)
|
this.startTime = new SimpleDateFormat("yyyy年MM月").format(tbAttResBase.getStartTime());
|
}
|
|
if (tbAttResBase.getWaterStorageTm() != null){
|
//蓄水时间(2022年9月)
|
this.waterStorageTm = new SimpleDateFormat("yyyy年MM月").format(tbAttResBase.getWaterStorageTm());
|
}
|
|
}
|
|
private void formatTbAttResStagChar(TbAttResStagChar tbAttResStagChar) {
|
if (tbAttResStagChar == null){
|
return;
|
}
|
|
//调节性能
|
this.adjustPropText = AdjustPropEnum.find(tbAttResStagChar.getAdjustProp()).getLabel();
|
|
this.conArea = isNull(tbAttResStagChar.getConArea());
|
|
this.moyearRainAvg = isNull(tbAttResStagChar.getMoyearRainAvg());
|
|
this.moyearFlAvg = isNull(tbAttResStagChar.getMoyearFlAvg());
|
|
this.desFlSta = DesFlStaEnum.find(tbAttResStagChar.getDesFlSta()).getLabel();
|
|
this.checFlSta = ChecFlStaEnum.find(tbAttResStagChar.getChecFlSta()).getLabel();
|
|
this.totalCap = isNull(tbAttResStagChar.getTotalCap());
|
//水文特征
|
List<String> hydrologicalCharacteristicsList = new ArrayList<>();
|
|
List<String> hydrologicalCharacteristicsList2 = new ArrayList<>();
|
|
if (tbAttResStagChar.getAdjustStorCap() != null) {
|
hydrologicalCharacteristicsList.add(StringUtil.format("兴利库容{}万m³", WordUtil.removeTrailingZero(tbAttResStagChar.getAdjustStorCap().toString())));
|
}
|
if (tbAttResStagChar.getFlprCap() != null) {
|
hydrologicalCharacteristicsList.add(StringUtil.format("调洪库容{}万m³", WordUtil.removeTrailingZero(tbAttResStagChar.getFlprCap().toString())));
|
}
|
if (tbAttResStagChar.getDeadCap() != null) {
|
hydrologicalCharacteristicsList.add(StringUtil.format("死库容{}万m³", WordUtil.removeTrailingZero(tbAttResStagChar.getDeadCap().toString())));
|
}
|
if (tbAttResStagChar.getChecFlStag() != null) {
|
hydrologicalCharacteristicsList2.add(StringUtil.format("水库校核洪水位{}m", String.format("%.2f",tbAttResStagChar.getChecFlStag())));
|
}
|
if (tbAttResStagChar.getDesFlStag() != null) {
|
hydrologicalCharacteristicsList2.add(StringUtil.format("设计洪水位{}m", String.format("%.2f",tbAttResStagChar.getDesFlStag())));
|
}
|
if (tbAttResStagChar.getCorNormStag() != null) {
|
hydrologicalCharacteristicsList2.add(StringUtil.format("正常蓄水位{}m", String.format("%.2f",tbAttResStagChar.getCorNormStag())));
|
}
|
if (tbAttResStagChar.getDeadStag() != null) {
|
hydrologicalCharacteristicsList2.add(StringUtil.format("死水位{}m", String.format("%.2f",tbAttResStagChar.getDeadStag())));
|
}
|
|
this.hydrologicalCharacteristics = String.join(",", hydrologicalCharacteristicsList) + "。" + String.join(",", hydrologicalCharacteristicsList2);
|
}
|
|
private void formatTbAttResWaterDelivery(List<TbAttResWaterDelivery> tbAttResWaterDeliveryList) {
|
if (tbAttResWaterDeliveryList.size() == 0){
|
return;
|
}
|
|
|
TbAttResWaterDelivery tbAttResWaterDelivery = tbAttResWaterDeliveryList.get(0);
|
if (tbAttResWaterDeliveryList.size() > 1) {
|
this.aqueductType = "水库主要采用";
|
} else {
|
this.aqueductType = "水库采用";
|
}
|
|
if (StringUtil.isNotBlank(tbAttResWaterDelivery.getAqueductType())) {
|
this.aqueductType = this.aqueductType + convertType(tbAttResWaterDelivery.getAqueductType(),"AqueductTypeEnum") + "输水";
|
} else {
|
this.aqueductType = "";
|
}
|
|
|
|
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。";
|
}
|
|
|
}
|
|
|
private void formatTbAttResEngBene(TbAttResEngBene tbAttResEngBene) {
|
if (tbAttResEngBene == null){
|
return;
|
}
|
|
this.protectCity = tbAttResEngBene.getCity().equals("无")?"保护下游" + tbAttResEngBene.getTown():"保护下游" + tbAttResEngBene.getCity();
|
if (StringUtil.isBlank(this.protectCity)) {
|
this.protectCity = tbAttResEngBene.getTown().equals("无")?"":"保护下游" + tbAttResEngBene.getTown();
|
}
|
|
double person = tbAttResEngBene.getFlControlPerson() / 10000.0;
|
|
if (person > 0) {
|
this.protectPersonLand = WordUtil.removeTrailingZero(String.format("%.2f",person)) + "万人口";
|
}
|
|
if (tbAttResEngBene.getFlControlLand() > 0) {
|
if (StringUtil.isBlank(this.protectPersonLand)) {
|
this.protectPersonLand = WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand())) + "万亩耕地";
|
} else {
|
this.protectPersonLand = this.protectPersonLand + "、" + WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand())) + "万亩耕地";
|
}
|
}
|
|
// this.protectPersonLand =
|
// StringUtil.format("{}万人口、{}万亩耕地", WordUtil.removeTrailingZero(String.format("%.2f",person)) , WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getFlControlLand() / 1000)));
|
|
////铁路、公路、管线、企业几个依次罗列,超过三个列出第二个后为“XX等”,后面不需罗列
|
|
String railway = tbAttResEngBene.getRailway();
|
String highway = tbAttResEngBene.getHighway();
|
String importCommunication = tbAttResEngBene.getImportCommunication();
|
String importFactory = tbAttResEngBene.getImportFactory();
|
|
List<String> protectList = new ArrayList<>();
|
|
if (StringUtil.isNotBlank(railway) && !railway.equals("无")) {
|
protectList.add(railway);
|
}
|
|
if (StringUtil.isNotBlank(highway)&& !highway.equals("无")) {
|
protectList.add(highway);
|
}
|
|
if (StringUtil.isNotBlank(importCommunication)&& !importCommunication.equals("无")) {
|
protectList.add(importCommunication);
|
}
|
|
if (StringUtil.isNotBlank(importFactory)&& !importFactory.equals("无")) {
|
protectList.add(importFactory);
|
}
|
this.protectThings = "";
|
//超过三个列出第二个后为“XX等”,后面不需罗列
|
if (protectList.size() > 3) {
|
List<String> sublist = protectList.subList(0, 2);
|
this.protectThings = "及" + String.join("、", sublist) + "等";
|
} else if(protectList.size() >= 1 ){
|
this.protectThings = "及" + String.join("、", protectList);
|
} else {
|
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 = "";
|
//若既有灌溉又有供水,则有“此外,”,
|
if (StringUtils.isNotBlank(tbAttResEngBene.getIrrObject())) {
|
this.economicBenefit =
|
StringUtil.format("水库为{}提供灌溉用水,设计灌溉面积{}万亩,有效灌溉面积{}万亩,多年平均灌溉水量{}万m³。",
|
tbAttResEngBene.getIrrObject(),
|
WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getDesIrrArea() / 10000)),
|
WordUtil.removeTrailingZero(String.format("%.2f", tbAttResEngBene.getChecIrrArea() / 10000)),
|
WordUtil.removeTrailingZero(tbAttResEngBene.getMoyearIrrAvg().toString()));
|
}
|
|
if (StringUtil.isNotBlank(tbAttResEngBene.getSupplyObject())) {
|
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());
|
} else {
|
//无灌溉有供水直接介绍供水
|
this.economicBenefit =
|
StringUtil.format("水库为{}{}万人提供生活用水,年均供水量{}万m³。",
|
tbAttResEngBene.getSupplyObject(),
|
String.format("%.2f", StringUtil.isBlank(tbAttResEngBene.getSupplyPopulation())?"":Double.parseDouble(tbAttResEngBene.getSupplyPopulation())),
|
tbAttResEngBene.getMoyearSupplyAvg());
|
}
|
}
|
|
|
}
|
|
private void formatTbAttResSafetyMonitor(TbAttResSafetyMonitor tbAttResSafetyMonitor) {
|
if (tbAttResSafetyMonitor ==null){
|
return;
|
}
|
String time = "";
|
if (tbAttResSafetyMonitor.getSafetyAppraisalTime() != null){
|
time = new SimpleDateFormat("yyyy年MM月").format(tbAttResSafetyMonitor.getSafetyAppraisalTime());
|
}
|
String type = SafetyAppraisalTypeEnum.find(tbAttResSafetyMonitor.getSafetyAppraisalResult()).getLabel();
|
String surveyProblem = tbAttResSafetyMonitor.getSurveyProblem();
|
//(若一类坝,不介绍问题,二、三类坝介绍)
|
if (tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("1")) {
|
this.safetyMonitorText = StringUtil.format("{},水库进行安全鉴定,鉴定结果为“{}”。",
|
time, type).replaceAll("。。","。");
|
} else if (tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("2") || tbAttResSafetyMonitor.getSafetyAppraisalResult().equals("3")) {
|
this.safetyMonitorText = StringUtil.format("{},水库进行安全鉴定,鉴定结果为“{}”,工程主要存在问题为{}。",
|
time, type, surveyProblem).replaceAll("。。","。");
|
}
|
}
|
|
private void formatTbAttResMgrSysB(TbAttResMgrSysB tbAttResMgrSysB) {
|
|
if (tbAttResMgrSysB == null){
|
return;
|
}
|
|
this.mUnitName = tbAttResMgrSysB.getMUnitName();
|
this.mUnitNature = tbAttResMgrSysB.getMUnitNature().replace("公益类","事业单位");
|
this.mUnitPersonNumber = tbAttResMgrSysB.getMUnitPersonNumber() + "";
|
}
|
|
//对有补充说明的选项进行转换
|
private String convertType(String type, String enumName) {
|
String text = "";
|
|
List<String> typeList = Arrays.asList(type.split(","));
|
String typeKey = typeList.get(0);
|
String explain ="";
|
if (typeList.size()>1){
|
explain = typeList.get(1);
|
}
|
|
//key值表示其他
|
if (StringUtil.isNotBlank(typeKey)) {
|
if (typeKey.equals("9") || typeKey.equals("其他") || Integer.parseInt(typeKey) == 9 ) {
|
text = explain.trim();
|
}else{
|
switch (enumName) {
|
case "AqueductTypeEnum":
|
text = AqueductTypeEnum.find(typeKey).getLabel();
|
break;
|
case "SpillwayHoleType":
|
text = typeKey;
|
break;
|
}
|
}
|
}
|
|
|
return text;
|
}
|
|
private String isNull(Double target) {
|
if (target == null) {
|
return "";
|
} else {
|
return target.toString();
|
}
|
}
|
|
|
}
|