| | |
| | | |
| | | import cn.gistack.common.utils.SpringContextUtil; |
| | | import cn.gistack.sm.sjztmd.entity.*; |
| | | import cn.gistack.sm.sjztmd.vo.StationExport; |
| | | import cn.gistack.sm.sjztmd.vo.ZtResultInfo; |
| | | import cn.gistack.sm.sjztmd.vo.StationParams; |
| | | import cn.gistack.sm.sjztmd.mapper.SjztMdMapper; |
| | | import cn.gistack.sm.sjztmd.service.*; |
| | | import cn.gistack.sm.sjztmd.word.enums.*; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | | import cn.gistack.sm.sjztods.constant.ZtApiUrlConstant; |
| | |
| | | import com.alibaba.fastjson.parser.Feature; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | |
| | | private final String RIBAO_SHEET3_OVER_STAG_LIST_URL = "/services/1234567890ABCDEFGHIJKLMN/ribao/sheet3_over_stag_list/api?small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2"; |
| | | //省直管 |
| | | private final String SZ_INFO = "/services/1234567890ABCDEFGHIJKLMN/ribao/shengzh_new_rz/api"; |
| | | |
| | | private final String WATER_LEVEL_API = "/services/1234567890ABCDEFGHIJKLMN/water/device/detail/new?"; |
| | | private final String RAIN_FALL_API = "/services/1234567890ABCDEFGHIJKLMN/rain/device/21/api?"; |
| | | private final String VIDEO_STATION_API = "/services/1234567890ABCDEFGHIJKLMN/device_monitor_wmst_list/api?"; |
| | | private final String IMAGE_STATION_API = "/services/1234567890ABCDEFGHIJKLMN/device_monitor_image_list/api?"; |
| | | private final String OSMOTIC_API = "/services/1234567890ABCDEFGHIJKLMN/press/device/is_child/api?"; |
| | | private final String SEEPAGE_API = "/services/1234567890ABCDEFGHIJKLMN/sl/device/is_child/api?"; |
| | | private final String DISPLACEMENT_API = "/services/1234567890ABCDEFGHIJKLMN/wy/device/is_child/api?"; |
| | | private final String TERMITE_API = "/services/1234567890ABCDEFGHIJKLMN/termite/device/is_child/api?"; |
| | | |
| | | |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | |
| | | private final ITbAttResRsbNorspiService attResRsbNorspiService; |
| | | private final ITbAttResPowerStationService attResPowerStationService; |
| | | |
| | | private final ITbAttResProjectUtilizeService attResProjectUtilizeService; |
| | | private final ITbAttResInformationProjectService attResInformationProjectService; |
| | | |
| | | @Override |
| | | public TbWordVO getTbWordVO(String resCd) { |
| | | public HashMap<String, Object> getTbWordVO(String resCd) { |
| | | |
| | | |
| | | TbAttResBase tbAttResBase = attResBaseService.getDetailByGuid(resCd); |
| | | TbAttResStagChar tbAttResStagChar = attResStagCharService.getDetailByGuid(resCd); |
| | | List<TbAttResWaterDelivery> tbAttResWaterDeliveryList = attResWaterDeliveryService.getDetailByGuid(resCd); |
| | | //挡水建筑物 |
| | | List<TbAttResWaterBlock> tbAttResWaterBlockList = attResWaterBlockService.getDetailByGuid(resCd); |
| | | List<TbAttResWaterBlock> tbAttResWaterBlockList = attResWaterBlockService.getDetailByGuid(resCd); |
| | | |
| | | //正常溢洪道、泄洪洞、非常溢洪道 |
| | | Map<String, Object> resRsbNorsipiVerspiMionitorDetailByGuid = attResRsbNorspiService.getResRsbNorsipiVerspiMionitorDetailByGuid(resCd); |
| | | Map<String, Object> resRsbNorsipiVerspiMionitorDetailByGuid = attResRsbNorspiService.getResRsbNorsipiVerspiMionitorDetailByGuid(resCd); |
| | | |
| | | //电站 |
| | | List<TbAttResPowerStation> tbAttResPowerStationList = attResPowerStationService.getDetailByGuid(resCd); |
| | | |
| | | //工程运用 |
| | | TbAttResProjectUtilize tbAttResProjectUtilize = attResProjectUtilizeService.getDetailByGuid(resCd); |
| | | |
| | | //信息化建设 |
| | | TbAttResInformationProject tbAttResInformationProject = attResInformationProjectService.getDetailByGuid(resCd); |
| | | |
| | | TbAttResEngBene tbAttResEngBene = attResEngBeneService.getDetailByGuid(resCd); |
| | | TbAttResSafetyMonitor tbAttResSafetyMonitor = attResSafetyMonitorService.getDetailByGuid(resCd); |
| | |
| | | |
| | | String depart = attResManagePersonService.getCompetentDepart(resCd); |
| | | |
| | | TbWordVO tbWordVO = new TbWordVO(tbAttResBase, tbAttResStagChar, tbAttResWaterBlockList,resRsbNorsipiVerspiMionitorDetailByGuid,tbAttResPowerStationList, |
| | | tbAttResWaterDeliveryList, tbAttResEngBene,tbAttResSafetyMonitor,tbAttResMgrSysB,attResManagePeople); |
| | | TbWordVO tbWordVO = new TbWordVO(tbAttResBase, tbAttResStagChar, tbAttResWaterBlockList, resRsbNorsipiVerspiMionitorDetailByGuid, tbAttResPowerStationList, |
| | | tbAttResWaterDeliveryList, tbAttResEngBene, tbAttResSafetyMonitor, tbAttResMgrSysB, attResManagePeople); |
| | | tbWordVO.setCUnitName(depart); |
| | | |
| | | return tbWordVO; |
| | | Map<String, Object> tableMap = buildTableMap(tbAttResBase, tbAttResStagChar, tbAttResWaterBlockList, resRsbNorsipiVerspiMionitorDetailByGuid, tbAttResPowerStationList, |
| | | tbAttResWaterDeliveryList, tbAttResEngBene, tbAttResSafetyMonitor, tbAttResMgrSysB, tbAttResProjectUtilize, tbAttResInformationProject); |
| | | |
| | | |
| | | HashMap<String, Object> obj = new HashMap<>(); |
| | | obj.put("tbWordVO", tbWordVO); |
| | | obj.put("tableMap", tableMap); |
| | | |
| | | return obj; |
| | | } |
| | | |
| | | /** |
| | | * 创建表格参数 |
| | | * |
| | | * @param tbAttResBase 水库基础信息 |
| | | * @param tbAttResStagChar 水文特征 |
| | | * @param tbAttResWaterBlockList 挡水建筑物 |
| | | * @param resRsbNorsipiVerspiMionitorDetailByGuid 正常溢洪道、泄洪洞、非常溢洪道 |
| | | * @param tbAttResPowerStationList 电站 |
| | | * @param tbAttResWaterDeliveryList 输水建筑物 |
| | | * @param tbAttResEngBene 水库效益 |
| | | * @param tbAttResSafetyMonitor 安全鉴定 |
| | | * @param tbAttResMgrSysB 管理体制 |
| | | * @param tbAttResProjectUtilize 工程运用 |
| | | * @param tbAttResInformationProject 信息化建设 |
| | | * @return |
| | | */ |
| | | private Map<String, Object> buildTableMap(TbAttResBase tbAttResBase, TbAttResStagChar tbAttResStagChar, |
| | | List<TbAttResWaterBlock> tbAttResWaterBlockList, Map<String, Object> resRsbNorsipiVerspiMionitorDetailByGuid, |
| | | List<TbAttResPowerStation> tbAttResPowerStationList, List<TbAttResWaterDelivery> tbAttResWaterDeliveryList, |
| | | TbAttResEngBene tbAttResEngBene, TbAttResSafetyMonitor tbAttResSafetyMonitor, TbAttResMgrSysB tbAttResMgrSysB, |
| | | TbAttResProjectUtilize tbAttResProjectUtilize, TbAttResInformationProject tbAttResInformationProject) { |
| | | |
| | | Map<String, Object> tableMap = new HashMap<>(); |
| | | |
| | | tableMap.put("resName", tbAttResBase.getName()); |
| | | tableMap.put("resRegCode", tbAttResBase.getResRegCode()); |
| | | tableMap.put("engScal", ResScalEnum.find(tbAttResBase.getResScal()).getLabel()); |
| | | tableMap.put("engGrad", tbAttResBase.getEngGrad()); |
| | | tableMap.put("longitude", tbAttResBase.getLgtd()); |
| | | tableMap.put("latitude", tbAttResBase.getLttd()); |
| | | tableMap.put("elevationSystem", tbAttResBase.getElevationSystem()); |
| | | tableMap.put("region", tbAttResBase.getBuildAddress()); |
| | | tableMap.put("basName", BasCodeEnum.find(tbAttResBase.getBasCode()).getLabel()); |
| | | tableMap.put("locRvName", tbAttResBase.getLocRvName()); |
| | | |
| | | String st = tbAttResBase.getStartTime() != null ? new SimpleDateFormat("M月dd日").format(tbAttResBase.getStartTime()) : ""; |
| | | String wst = tbAttResBase.getWaterStorageTm() != null ? new SimpleDateFormat("M月dd日").format(tbAttResBase.getWaterStorageTm()) : ""; |
| | | tableMap.put("startTime", st); |
| | | tableMap.put("waterStorageTm", wst); |
| | | |
| | | |
| | | tableMap.put("reinforceTm", tbAttResSafetyMonitor.getReinforceTm()); |
| | | tableMap.put("completionTime", tbAttResSafetyMonitor.getCompletionTime()); |
| | | |
| | | String resFunc = tbAttResBase.getResFunc(); |
| | | if (StringUtil.isNotBlank(resFunc)) { |
| | | List<String> resFucList = Arrays.asList(tbAttResBase.getResFunc().split(",")); |
| | | List<String> resFucTextList = new ArrayList<>(); |
| | | for (int i = 0; i < resFucList.size(); i++) { |
| | | String key = resFucList.get(i); |
| | | ResFucEnum resFucEnum = ResFucEnum.find(key); |
| | | resFucTextList.add(resFucEnum.getLabel()); |
| | | } |
| | | resFunc = String.join(",", resFucTextList); |
| | | } |
| | | tableMap.put("resFunc", resFunc); |
| | | //水文特征 |
| | | tableMap.put("conArea", tbAttResStagChar.getConArea()); |
| | | tableMap.put("moyearRainAvg", tbAttResStagChar.getMoyearRainAvg()); |
| | | tableMap.put("moyearFlAvg", tbAttResStagChar.getMoyearFlAvg()); |
| | | tableMap.put("downWacoSafeDisc", tbAttResStagChar.getDownWacoSafeDisc()); |
| | | tableMap.put("desFlSta", tbAttResStagChar.getDesFlSta()); |
| | | tableMap.put("desFlFlow", tbAttResStagChar.getDesFlFlow()); |
| | | tableMap.put("desFl1dayCap", tbAttResStagChar.getDesFl1dayCap()); |
| | | tableMap.put("desFl3dayCap", tbAttResStagChar.getDesFl3dayCap()); |
| | | tableMap.put("checFlSta", tbAttResStagChar.getChecFlSta()); |
| | | tableMap.put("checFlFlow", tbAttResStagChar.getChecFlFlow()); |
| | | tableMap.put("checFl1dayCap", tbAttResStagChar.getChecFl1dayCap()); |
| | | tableMap.put("checFl3dayCap", tbAttResStagChar.getChecFl3dayCap()); |
| | | |
| | | //水库特征 |
| | | tableMap.put("adjustProp", AdjustPropEnum.find(tbAttResStagChar.getAdjustProp()).getLabel()); |
| | | tableMap.put("checFlStag", tbAttResStagChar.getChecFlStag()); |
| | | tableMap.put("totalCap", tbAttResStagChar.getTotalCap()); |
| | | tableMap.put("desFlStag", tbAttResStagChar.getDesFlStag()); |
| | | tableMap.put("flprCap", tbAttResStagChar.getFlprCap()); |
| | | tableMap.put("flConTopStag", tbAttResStagChar.getFlConTopStag()); |
| | | tableMap.put("flSortCap", tbAttResStagChar.getFlStorCap()); |
| | | tableMap.put("corNormStag", tbAttResStagChar.getCorNormStag()); |
| | | tableMap.put("adjustStorCap", tbAttResStagChar.getAdjustStorCap()); |
| | | tableMap.put("deadStag", tbAttResStagChar.getDeadStag()); |
| | | tableMap.put("deadCap", tbAttResStagChar.getDeadCap()); |
| | | tableMap.put("beforeFloodStag", tbAttResStagChar.getBeforeFloodStag()); |
| | | tableMap.put("midFloodStag", tbAttResStagChar.getMidFloodStag()); |
| | | tableMap.put("afterFloodStag", tbAttResStagChar.getAfterFloodStag()); |
| | | |
| | | //new SimpleDateFormat("yyyy年MM月").format(tbAttResBase.getStartTime()); |
| | | |
| | | String bfs = tbAttResStagChar.getBeforeFloodStart() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getBeforeFloodStart()) : ""; |
| | | String bfe = tbAttResStagChar.getBeforeFloodEnd() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getBeforeFloodEnd()) : ""; |
| | | String mfs = tbAttResStagChar.getMidFloodStart() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getMidFloodStart()) : ""; |
| | | String mfe = tbAttResStagChar.getMidFloodEnd() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getMidFloodEnd()) : ""; |
| | | String afs = tbAttResStagChar.getAfterFloodStart() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getAfterFloodStart()) : ""; |
| | | String afe = tbAttResStagChar.getAfterFloodEnd() != null ? new SimpleDateFormat("M月dd日").format(tbAttResStagChar.getAfterFloodEnd()) : ""; |
| | | tableMap.put("beforeFloodStart", bfs); |
| | | tableMap.put("beforeFloodEnd", bfe); |
| | | tableMap.put("midFloodStart", mfs); |
| | | tableMap.put("midFloodEnd", mfe); |
| | | tableMap.put("afterFloodStart", afs); |
| | | tableMap.put("afterFloodEnd", afe); |
| | | tableMap.put("desFloodFlow", tbAttResStagChar.getDesFloodFlowMax()); |
| | | tableMap.put("checFloodFlowMax", tbAttResStagChar.getChecFloodFlowMax()); |
| | | |
| | | String mainDamType = ""; |
| | | String mainDamMainFoundation = ""; |
| | | String mainDamTopElevation = ""; |
| | | String mainDamHeight = ""; |
| | | String mainDamTopLength = ""; |
| | | String mainDamWidth = ""; |
| | | String mainIsTraffic = ""; |
| | | String mainWaveWallTopElevation = ""; |
| | | String mainUpDamProtectType = ""; |
| | | String mainDownDamProtectType = ""; |
| | | String damMainBodyType = ""; |
| | | String damMainBodyTopElevation = ""; |
| | | String damMainDrainType = ""; |
| | | String mainDamBodyType = ""; |
| | | String subDamNum = ""; |
| | | String subDamTotLength = ""; |
| | | String subDamMaxHeight = ""; |
| | | String subDamTopWidth = ""; |
| | | |
| | | |
| | | if (tbAttResWaterBlockList != null && tbAttResWaterBlockList.size() > 0 && tbAttResWaterBlockList.get(0).getNum() > 0) { |
| | | //主坝 |
| | | TbAttResWaterBlock tbAttResWaterBlock = tbAttResWaterBlockList.get(0); |
| | | |
| | | mainDamType = DamTypeEnum.find(tbAttResWaterBlock.getDamType()).getLabel(); |
| | | mainDamMainFoundation = tbAttResWaterBlock.getDamMainFoundation(); |
| | | mainDamTopElevation = isNullObject(tbAttResWaterBlock.getDamTopElevation()); |
| | | mainDamHeight = isNullObject(tbAttResWaterBlock.getDamHeight()); |
| | | mainDamTopLength = isNullObject(tbAttResWaterBlock.getDamTopLength()); |
| | | mainDamWidth = isNullObject(tbAttResWaterBlock.getDamWidth()); |
| | | mainIsTraffic = tbAttResWaterBlock.getIsTraffic(); |
| | | mainWaveWallTopElevation = isNullObject(tbAttResWaterBlock.getWaveWallTopElevation()); |
| | | mainUpDamProtectType = convertType(tbAttResWaterBlock.getUpDamProtectType(), "Explain"); |
| | | mainDownDamProtectType = convertType(tbAttResWaterBlock.getDownDamProtectType(), "Explain"); |
| | | damMainBodyType = convertType(tbAttResWaterBlock.getDamMainBodyType(), "Explain"); |
| | | damMainBodyTopElevation = isNullObject(tbAttResWaterBlock.getDamTopElevation()); |
| | | damMainDrainType = convertType(tbAttResWaterBlock.getDamMainDrainType(), "Explain"); |
| | | mainDamBodyType = convertType(isNullObject(tbAttResWaterBlock.getDamBodyType()), "Explain"); |
| | | |
| | | //副坝 |
| | | subDamNum = isNullObject(tbAttResWaterBlock.getSubDamNum()); |
| | | subDamTotLength = isNullObject(tbAttResWaterBlock.getSubDamTotLength()); |
| | | subDamMaxHeight = isNullObject(tbAttResWaterBlock.getSubDamMaxHeight()); |
| | | subDamTopWidth = isNullObject(tbAttResWaterBlock.getSubDamTopWidth()); |
| | | |
| | | |
| | | } |
| | | |
| | | tableMap.put("mainDamType", mainDamType); |
| | | tableMap.put("mainDamMainFoundation", mainDamMainFoundation); |
| | | tableMap.put("mainDamTopElevation", mainDamTopElevation); |
| | | tableMap.put("mainDamHeight", mainDamHeight); |
| | | tableMap.put("mainDamTopLength", mainDamTopLength); |
| | | tableMap.put("mainDamWidth", mainDamWidth); |
| | | tableMap.put("mainIsTraffic", mainIsTraffic); |
| | | tableMap.put("mainWaveWallTopElevation", mainWaveWallTopElevation); |
| | | tableMap.put("mainUpDamProtectType", mainUpDamProtectType); |
| | | tableMap.put("mainDownDamProtectType", mainDownDamProtectType); |
| | | tableMap.put("damMainBodyType", damMainBodyType); |
| | | tableMap.put("damMainBodyTopElevation", damMainBodyTopElevation); |
| | | tableMap.put("damMainDrainType", damMainDrainType); |
| | | tableMap.put("mainDamBodyType", mainDamBodyType); |
| | | tableMap.put("subDamNum", subDamNum); |
| | | tableMap.put("subDamTotLength", subDamTotLength); |
| | | tableMap.put("subDamMaxHeight", subDamMaxHeight); |
| | | tableMap.put("subDamTopWidth", subDamTopWidth); |
| | | |
| | | //正常溢洪道 |
| | | List<TbAttResRsbNorspi> tbAttResRsbNorspiList = (List<TbAttResRsbNorspi>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbNorspiList"); |
| | | |
| | | String norSpillwayType = ""; |
| | | String isLocDamBody = ""; |
| | | String norWeirTopElevation = ""; |
| | | String norWeirTopWidth = ""; |
| | | String norWorkingGateType = ""; |
| | | String norCheckingFloodDischarge = ""; |
| | | String disEnergyType = ""; |
| | | String norOc = ""; |
| | | |
| | | if (tbAttResRsbNorspiList != null && tbAttResRsbNorspiList.size() > 0 && tbAttResRsbNorspiList.get(0).getNum() > 0) { |
| | | TbAttResRsbNorspi tbAttResRsbNorspi = tbAttResRsbNorspiList.get(0); |
| | | |
| | | norSpillwayType = SpillwayTypeEnum.find(tbAttResRsbNorspi.getSpillwayType()).getLabel(); |
| | | |
| | | isLocDamBody = tbAttResRsbNorspi.getIsLocDamBody(); |
| | | norWeirTopElevation = isNullObject(tbAttResRsbNorspi.getWeirTopElevation()); |
| | | norWeirTopWidth = isNullObject(tbAttResRsbNorspi.getWeirTopWidth()); |
| | | |
| | | if (tbAttResRsbNorspi.getIsGate() == "否") { |
| | | norWorkingGateType = "无闸控制"; |
| | | } else if (tbAttResRsbNorspi.getIsGate() == "是") { |
| | | // 平板闸门,3X3 |
| | | String typeName = RsbWorkingGateEnum.find(tbAttResRsbNorspi.getWorkingGateType().toString()).getLabel(); |
| | | norWorkingGateType = StringUtil.format("{},{}X{}", typeName, tbAttResRsbNorspi.getGateWide(), tbAttResRsbNorspi.getGateLength()); |
| | | } |
| | | |
| | | norCheckingFloodDischarge = isNullObject(tbAttResRsbNorspi.getCheckingFloodDischarge()); |
| | | disEnergyType = isNullObject(tbAttResRsbNorspi.getDisEnergyType()); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | |
| | | String ocType = OcTypeEnum.find(isNullObject(tbAttResRsbNorspi.getOcType())).getLabel(); |
| | | list.add(ocType); |
| | | list.add(tbAttResRsbNorspi.getOcPower()); |
| | | norOc = String.join(",", list); |
| | | } |
| | | |
| | | tableMap.put("norSpillwayType", norSpillwayType); |
| | | tableMap.put("isLocDamBody", isLocDamBody); |
| | | tableMap.put("norWeirTopElevation", norWeirTopElevation); |
| | | tableMap.put("norWeirTopWidth", norWeirTopWidth); |
| | | tableMap.put("norWorkingGateType", norWorkingGateType); |
| | | tableMap.put("norCheckingFloodDischarge", norCheckingFloodDischarge); |
| | | tableMap.put("disEnergyType", disEnergyType); |
| | | tableMap.put("norOc", norOc); |
| | | |
| | | |
| | | //非常溢洪道 |
| | | List<TbAttResRsbVerspi> tbAttResRsbVerspiList = (List<TbAttResRsbVerspi>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbVerspiList"); |
| | | |
| | | String verSpillwayType = ""; |
| | | String weirTopWidth = ""; |
| | | String enableStandar = ""; |
| | | String checkingFloodDischarge = ""; |
| | | |
| | | if (tbAttResRsbVerspiList != null && tbAttResRsbVerspiList.size() > 0 && tbAttResRsbVerspiList.get(0).getNum() > 0) { |
| | | TbAttResRsbVerspi tbAttResRsbVerspi = tbAttResRsbVerspiList.get(0); |
| | | |
| | | verSpillwayType = VerSpillwayTypeEnum.find(tbAttResRsbVerspi.getSpillwayType()).getLabel(); |
| | | weirTopWidth = isNullObject(tbAttResRsbVerspi.getWeirTopWidth()); |
| | | enableStandar = tbAttResRsbVerspi.getEnableStandards(); |
| | | checkingFloodDischarge = isNullObject(tbAttResRsbVerspi.getCheckingFloodDischarge()); |
| | | } |
| | | tableMap.put("verSpillwayType", verSpillwayType); |
| | | tableMap.put("weirTopWidth", weirTopWidth); |
| | | tableMap.put("enableStandar", enableStandar); |
| | | tableMap.put("checkingFloodDischarge", checkingFloodDischarge); |
| | | |
| | | //泄洪洞 |
| | | List<TbAttResRsbSpillway> tbAttResRsbSpillwayList = (List<TbAttResRsbSpillway>) resRsbNorsipiVerspiMionitorDetailByGuid.get("tbAttResRsbSpillwayList"); |
| | | |
| | | String rsbSpillwayType = ""; |
| | | String coveLength = ""; |
| | | String rsbThresholdElevation = ""; |
| | | String rsbExportElevation = ""; |
| | | String rsbSection = ""; |
| | | String checkFlDisCharge = ""; |
| | | String rsbWorkingGateType = ""; |
| | | String rsbOc = ""; |
| | | |
| | | if (tbAttResRsbSpillwayList != null && tbAttResRsbSpillwayList.size() > 0 && tbAttResRsbSpillwayList.get(0).getNum() > 0) { |
| | | TbAttResRsbSpillway tbAttResRsbSpillway = tbAttResRsbSpillwayList.get(0); |
| | | |
| | | //类型为其他,有补充说明 |
| | | rsbSpillwayType = convertType(tbAttResRsbSpillway.getSpillwayType(), "SpillwayHoleType"); |
| | | rsbWorkingGateType = convertType(tbAttResRsbSpillway.getWorkingGateType(), "RsbWorkingGateEnum"); |
| | | |
| | | coveLength = isNullObject(tbAttResRsbSpillway.getCoveLength()); |
| | | rsbThresholdElevation = isNullObject(tbAttResRsbSpillway.getThresholdElevation()); |
| | | rsbExportElevation = isNullObject(tbAttResRsbSpillway.getExportElevation()); |
| | | rsbSection = StringUtil.format("{}X{}", 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); |
| | | } |
| | | |
| | | |
| | | tableMap.put("rsbSpillwayType", rsbSpillwayType); |
| | | tableMap.put("coveLength", coveLength); |
| | | tableMap.put("rsbThresholdElevation", rsbThresholdElevation); |
| | | tableMap.put("rsbExportElevation", rsbExportElevation); |
| | | tableMap.put("rsbSection", rsbSection); |
| | | tableMap.put("checkFlDisCharge", checkFlDisCharge); |
| | | tableMap.put("rsbWorkingGateType", rsbWorkingGateType); |
| | | tableMap.put("rsbOc", rsbOc); |
| | | |
| | | //输水 |
| | | String aqueductType = ""; |
| | | String aqueductLength = ""; |
| | | String thresholdElevation = ""; |
| | | String exportElevation = ""; |
| | | String deliverSection = ""; |
| | | String designFlow = ""; |
| | | String workingGateType = ""; |
| | | String deliverOc = ""; |
| | | |
| | | if (tbAttResWaterDeliveryList != null && tbAttResWaterDeliveryList.size() > 0 && tbAttResWaterDeliveryList.get(0).getNum() > 0) { |
| | | //取设计流量大的进行描述 |
| | | List<TbAttResWaterDelivery> sortList = tbAttResWaterDeliveryList.stream().sorted((a, b) -> b.getDesignFlow().compareTo(a.getDesignFlow())).collect(Collectors.toList()); |
| | | TbAttResWaterDelivery tbAttResWaterDelivery = sortList.get(0); |
| | | |
| | | aqueductType = convertType(tbAttResWaterDelivery.getAqueductType(), "AqueductTypeEnum"); |
| | | aqueductLength = isNullObject(tbAttResWaterDelivery.getAqueductLength()); |
| | | thresholdElevation = isNullObject(tbAttResWaterDelivery.getThresholdElevation()); |
| | | exportElevation = isNullObject(tbAttResWaterDelivery.getExportElevation()); |
| | | deliverSection = StringUtil.format("{}X{}", tbAttResWaterDelivery.getSectionWide(), tbAttResWaterDelivery.getSectionHigh()); |
| | | designFlow = isNullObject(tbAttResWaterDelivery.getDesignFlow()); |
| | | workingGateType = tbAttResWaterDelivery.getWorkingGateType(); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(tbAttResWaterDelivery.getOcType()); |
| | | list.add(tbAttResWaterDelivery.getOcPower()); |
| | | deliverOc = String.join(",", list); |
| | | } |
| | | tableMap.put("aqueductType", aqueductType); |
| | | tableMap.put("aqueductLength", aqueductLength); |
| | | tableMap.put("thresholdElevation", thresholdElevation); |
| | | tableMap.put("exportElevation", exportElevation); |
| | | tableMap.put("deliverSection", deliverSection); |
| | | tableMap.put("designFlow", designFlow); |
| | | tableMap.put("workingGateType", workingGateType); |
| | | tableMap.put("deliverOc", deliverOc); |
| | | |
| | | |
| | | //水电站 |
| | | String plantLayoutType = ""; |
| | | String installedCapacity = ""; |
| | | String yearAvgHour = ""; |
| | | //当电站列表不为空 且 电站列表数量大于0 且num大于0 |
| | | if (tbAttResPowerStationList != null && tbAttResPowerStationList.size() > 0 && tbAttResPowerStationList.get(0).getNum() > 0) { |
| | | TbAttResPowerStation tbAttResPowerStation = tbAttResPowerStationList.get(0); |
| | | |
| | | //取第一个电站 |
| | | plantLayoutType = PlantLayoutTypeEnum.find(tbAttResPowerStation.getPlantLayoutType()).getLabel(); |
| | | installedCapacity = isNullObject(tbAttResPowerStation.getInstalledCapacity()); |
| | | yearAvgHour = isNullObject(tbAttResPowerStation.getYearAvgHour()); |
| | | } |
| | | tableMap.put("plantLayoutType", plantLayoutType); |
| | | tableMap.put("installedCapacity", installedCapacity); |
| | | tableMap.put("yearAvgHour", yearAvgHour); |
| | | |
| | | //水库效益 |
| | | List<String> protectList = new ArrayList<>(); |
| | | |
| | | if (!tbAttResEngBene.getCity().equals("无") ) { |
| | | protectList.add(tbAttResEngBene.getCity()); |
| | | |
| | | } |
| | | if (!tbAttResEngBene.getTown().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getTown()); |
| | | } |
| | | if (!tbAttResEngBene.getRailway().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getRailway()); |
| | | } |
| | | |
| | | if (!tbAttResEngBene.getHighway().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getHighway()); |
| | | } |
| | | |
| | | if (!tbAttResEngBene.getImportCommunication().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getImportCommunication()); |
| | | } |
| | | |
| | | if (!tbAttResEngBene.getImportFactory().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getImportFactory()); |
| | | } |
| | | |
| | | if (!tbAttResEngBene.getImportOtherFac().equals("无")) { |
| | | protectList.add(tbAttResEngBene.getImportOtherFac()); |
| | | } |
| | | //只留前四个 |
| | | if (protectList.size()>=4){ |
| | | List<String> subList = protectList.subList(0, 4); |
| | | tableMap.put("protect", String.join("、", subList)); |
| | | |
| | | }else { |
| | | tableMap.put("protect", String.join("、", protectList)); |
| | | } |
| | | double person = 0; |
| | | if (tbAttResEngBene.getFlControlPerson() != null) { |
| | | person = tbAttResEngBene.getFlControlPerson() / 10000.0; |
| | | } |
| | | |
| | | tableMap.put("flControlPerson", String.format("%.2f", person)); |
| | | tableMap.put("flControlLand", tbAttResEngBene.getFlControlLand()); |
| | | tableMap.put("irrObject", tbAttResEngBene.getIrrObject()); |
| | | tableMap.put("moyearIrrAvg", tbAttResEngBene.getMoyearIrrAvg()); |
| | | tableMap.put("desIrrArea", tbAttResEngBene.getDesIrrArea()); |
| | | tableMap.put("checIrrArea", tbAttResEngBene.getChecIrrArea()); |
| | | tableMap.put("supplyObject", tbAttResEngBene.getSupplyObject()); |
| | | |
| | | Double sup = 0.0; |
| | | String supS = ""; |
| | | if (StringUtil.isNotBlank(tbAttResEngBene.getSupplyPopulation())) { |
| | | sup = Double.parseDouble(tbAttResEngBene.getSupplyPopulation()) / 10000; |
| | | supS = String.format("%.2f", sup); |
| | | } |
| | | |
| | | |
| | | tableMap.put("supplyPopulation", supS); |
| | | tableMap.put("moyearSupplyAvg", tbAttResEngBene.getMoyearSupplyAvg()); |
| | | tableMap.put("moyearPowerAvg", tbAttResEngBene.getMoyearPowerAvg()); |
| | | tableMap.put("ecologicalFlow", tbAttResEngBene.getEcologicalFlow()); |
| | | |
| | | //工程管理 |
| | | tableMap.put("munitName", tbAttResMgrSysB.getMUnitName()); |
| | | tableMap.put("cunitName", tbAttResMgrSysB.getCUnitName()); |
| | | tableMap.put("mUnitNature", tbAttResMgrSysB.getMUnitNature()); |
| | | tableMap.put("mUnitPersonNumber", tbAttResMgrSysB.getMUnitPersonNumber()); |
| | | tableMap.put("personEconomicSource", tbAttResMgrSysB.getPersonEconomicSource()); |
| | | tableMap.put("maintenanceEconomicSource", tbAttResMgrSysB.getMaintenanceEconomicSource()); |
| | | |
| | | //工程运用 |
| | | tableMap.put("resMaxStag", tbAttResProjectUtilize.getResMaxStag()); |
| | | tableMap.put("resMinStag", tbAttResProjectUtilize.getResMinStag()); |
| | | tableMap.put("resMaxInFlow", tbAttResProjectUtilize.getResMaxInFlow()); |
| | | tableMap.put("resMaxOutFlow", tbAttResProjectUtilize.getResMaxOutFlow()); |
| | | //new SimpleDateFormat("yyyy-MM-dd").format(tbAttResProjectUtilize.getResMaxStagDate()) |
| | | |
| | | String resMaxStagDate = tbAttResProjectUtilize.getResMaxStagDate() != null ? new SimpleDateFormat("yyyy-MM-dd").format(tbAttResProjectUtilize.getResMaxStagDate()) : ""; |
| | | String resMinStagDate = tbAttResProjectUtilize.getResMinStagDate() != null ? new SimpleDateFormat("yyyy-MM-dd").format(tbAttResProjectUtilize.getResMinStagDate()) : ""; |
| | | String resMaxInFlowDate = tbAttResProjectUtilize.getResMaxInFlowDate() != null ? new SimpleDateFormat("yyyy-MM-dd").format(tbAttResProjectUtilize.getResMaxInFlowDate()) : ""; |
| | | String resMaxOutFlowDate = tbAttResProjectUtilize.getResMaxOutFlowDate() != null ? new SimpleDateFormat("yyyy-MM-dd").format(tbAttResProjectUtilize.getResMaxOutFlowDate()) : ""; |
| | | tableMap.put("resMaxStagDate", resMaxStagDate); |
| | | tableMap.put("resMinStagDate", resMinStagDate); |
| | | tableMap.put("resMaxInFlowDate", resMaxInFlowDate); |
| | | tableMap.put("resMaxOutFlowDate", resMaxOutFlowDate); |
| | | |
| | | //信息化建设 |
| | | tableMap.put("isRain", InfoBuildingEnum.find(tbAttResInformationProject.getIsRain()).getLabel()); |
| | | tableMap.put("isRsvr", InfoBuildingEnum.find(tbAttResInformationProject.getIsRsvr()).getLabel()); |
| | | tableMap.put("isGnssHorizontal", InfoBuildingEnum.find(tbAttResInformationProject.getIsGnssHorizontal()).getLabel()); |
| | | tableMap.put("isSppr", InfoBuildingEnum.find(tbAttResInformationProject.getIsSppr()).getLabel()); |
| | | tableMap.put("isSpqnmp", InfoBuildingEnum.find(tbAttResInformationProject.getIsSpqnmp()).getLabel()); |
| | | tableMap.put("isWmst", InfoBuildingEnum.find(tbAttResInformationProject.getIsWmst()).getLabel()); |
| | | tableMap.put("isTermites", InfoBuildingEnum.find(tbAttResInformationProject.getIsTermites()).getLabel()); |
| | | // |
| | | String tm = tbAttResSafetyMonitor.getSafetyAppraisalTime() != null ? new SimpleDateFormat("yyyy-MM-dd").format(tbAttResSafetyMonitor.getSafetyAppraisalTime()) : ""; |
| | | tableMap.put("safetyAppraisalTime", tm); |
| | | tableMap.put("safetyAppraisalResult", tbAttResSafetyMonitor.getSafetyAppraisalResult()); |
| | | |
| | | |
| | | return tableMap; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<TotalInfo> getTotalInfo(){ |
| | | public List<TotalInfo> getTotalInfo() { |
| | | JSONObject ztData = this.getZtData(null, RIBAO_SHEET1_TOTAL_URL); |
| | | JSONArray data = ztData.getJSONArray("data"); |
| | | List<TotalInfo> list = data.toJavaList(TotalInfo.class); |
| | |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<StationExport> getWaterLevelInfo(HttpServletResponse response, StationParams params, String exportFunc) { |
| | | String urlParam = buildParams(params); |
| | | String url = WATER_LEVEL_API + urlParam; |
| | | JSONObject ztData = getZtData(null, url); |
| | | JSONObject result = ztData.getJSONObject("data"); |
| | | JSONArray data = result.getJSONArray("data"); |
| | | List<ZtResultInfo> list = data.toJavaList(ZtResultInfo.class); |
| | | |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | //按水库主站导出 |
| | | if (exportFunc.equals("reservoir")) { |
| | | exportList = exportByReservoir(list); |
| | | } else if (exportFunc.equals("station")) { |
| | | //按测站导出 |
| | | exportList = exportByStation(list); |
| | | } |
| | | return exportList; |
| | | } |
| | | |
| | | /** |
| | | * 站点导出 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | private List<StationExport> exportByStation(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | return; |
| | | |
| | | } else { |
| | | //获取子集中所有站点的数据 |
| | | ztResultInfo.getChildren().forEach(e -> { |
| | | StationExport stationExport1 = buildStationExportWater(e); |
| | | exportList.add(stationExport1); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | return exportList; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 水库导出 |
| | | * |
| | | * @param list |
| | | * @return |
| | | */ |
| | | private List<StationExport> exportByReservoir(List<ZtResultInfo> list) { |
| | | |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | stationExport.setRes_cd(ztResultInfo.getRes_cd()); |
| | | stationExport.setRes_nm(ztResultInfo.getRes_nm()); |
| | | |
| | | } else { |
| | | //获取主站的站点 |
| | | List<HashMap<String, Object>> mainList = ztResultInfo.getChildren().stream().filter(e -> isNullValue("is_main_rsvr", e).equals(1)).collect(Collectors.toList()); |
| | | if (mainList != null && mainList.size() > 0) { |
| | | //获取主站数据 |
| | | stationExport = buildStationExportWater(mainList.get(0)); |
| | | } else { |
| | | //获取子集中第一个站点的数据 |
| | | stationExport = buildStationExportWater(ztResultInfo.getChildren().get(0)); |
| | | } |
| | | } |
| | | |
| | | exportList.add(stationExport); |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private StationExport buildStationExportWater(HashMap<String, Object> map) { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | stationExport.setRes_nm(isNullValue("res_nm", map)); |
| | | stationExport.setRes_reg_code(isNullValue("res_reg_code", map)); |
| | | stationExport.setRes_cd(isNullValue("res_cd", map)); |
| | | stationExport.setEng_scal(isNullValue("eng_scal", map)); |
| | | stationExport.setCity_nm(isNullValue("city_nm", map)); |
| | | stationExport.setCounty_nm(isNullValue("county_nm", map)); |
| | | stationExport.setTown_nm(isNullValue("town_nm", map)); |
| | | stationExport.setSt_nm(isNullValue("st_nm", map)); |
| | | stationExport.setFlag(isNullValue("flag", map)); |
| | | |
| | | String stationStatus = isNullValue("station_status", map); |
| | | |
| | | String stationStatusText = ""; |
| | | if (stationStatus.equals("1")) { |
| | | stationStatusText = "在线"; |
| | | } else if (stationStatus.equals("0")) { |
| | | stationStatusText = "离线"; |
| | | } |
| | | stationExport.setStation_status_text(stationStatusText); |
| | | |
| | | stationExport.setManufacturer(isNullValue("manufacturer", map)); |
| | | |
| | | //应报 |
| | | String shouldCnt = isNullValue("should_cnt", map); |
| | | //已报 |
| | | String actualCnt = isNullValue("actual_cnt", map); |
| | | |
| | | String shouldReportAndReport = StringUtil.format("{}/{}", shouldCnt, actualCnt); |
| | | stationExport.setShouldReportAndReport(shouldReportAndReport); |
| | | //到报率 |
| | | double reportRate = Double.parseDouble(isNullValue("report_rate", map)); |
| | | String rate = "0"; |
| | | if (reportRate * 100 == 100) { |
| | | rate = "100%"; |
| | | } else if (reportRate > 0) { |
| | | rate = String.format("%.2f", reportRate * 100) + "%"; |
| | | } |
| | | stationExport.setRate(rate); |
| | | return stationExport; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<StationExport> getRainfallInfo(HttpServletResponse response, StationParams params, String exportFunc) { |
| | | String urlParam = buildParams(params); |
| | | String url = RAIN_FALL_API + urlParam; |
| | | JSONObject ztData = getZtData(null, url); |
| | | JSONObject result = ztData.getJSONObject("data"); |
| | | JSONArray data = result.getJSONArray("data"); |
| | | List<ZtResultInfo> list = data.toJavaList(ZtResultInfo.class); |
| | | |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | //按水库主站导出 |
| | | if (exportFunc.equals("reservoir")) { |
| | | exportList = exportByReservoirRain(list); |
| | | } else if (exportFunc.equals("station")) { |
| | | //按测站导出 |
| | | exportList = exportByStationRain(list); |
| | | } |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private List<StationExport> exportByStationRain(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | return; |
| | | } else { |
| | | //获取子集中所有站点的数据 |
| | | ztResultInfo.getChildren().forEach(e -> { |
| | | StationExport stationExport1 = buildStationExportRain(e, ztResultInfo); |
| | | exportList.add(stationExport1); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private List<StationExport> exportByReservoirRain(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | stationExport.setRes_cd(ztResultInfo.getRes_cd()); |
| | | stationExport.setRes_nm(ztResultInfo.getRes_nm()); |
| | | stationExport.setRes_reg_code(ztResultInfo.getRes_reg_cd()); |
| | | stationExport.setEng_scal(ztResultInfo.getEng_scal()); |
| | | stationExport.setCity_nm(ztResultInfo.getCity_nm()); |
| | | stationExport.setCounty_nm(ztResultInfo.getCounty_nm()); |
| | | stationExport.setTown_nm(ztResultInfo.getTown_nm()); |
| | | |
| | | } else { |
| | | //获取主站的站点 |
| | | List<HashMap<String, Object>> mainList = ztResultInfo.getChildren().stream().filter(e -> isNullValue("is_main_rsvr", e).equals(1)).collect(Collectors.toList()); |
| | | if (mainList != null && mainList.size() > 0) { |
| | | //获取主站数据 |
| | | stationExport = buildStationExportRain(mainList.get(0), ztResultInfo); |
| | | } else { |
| | | //获取子集中第一个站点的数据 |
| | | stationExport = buildStationExportRain(ztResultInfo.getChildren().get(0), ztResultInfo); |
| | | } |
| | | } |
| | | |
| | | exportList.add(stationExport); |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private StationExport buildStationExportRain(HashMap<String, Object> map, ZtResultInfo ztResultInfo) { |
| | | |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | stationExport.setRes_nm(ztResultInfo.getRes_nm()); |
| | | stationExport.setRes_reg_code(ztResultInfo.getRes_reg_cd()); |
| | | stationExport.setRes_cd(ztResultInfo.getRes_cd()); |
| | | stationExport.setEng_scal(ztResultInfo.getEng_scal()); |
| | | stationExport.setCity_nm(ztResultInfo.getCity_nm()); |
| | | stationExport.setCounty_nm(ztResultInfo.getCounty_nm()); |
| | | stationExport.setTown_nm(ztResultInfo.getTown_nm()); |
| | | stationExport.setSt_nm(isNullValue("st_nm", map)); |
| | | stationExport.setFlag(isNullValue("flag", map)); |
| | | |
| | | String stationStatus = isNullValue("station_status", map); |
| | | |
| | | String stationStatusText = ""; |
| | | if (stationStatus.equals("1")) { |
| | | stationStatusText = "在线"; |
| | | } else if (stationStatus.equals("0")) { |
| | | stationStatusText = "离线"; |
| | | } |
| | | stationExport.setStation_status_text(stationStatusText); |
| | | |
| | | stationExport.setManufacturer(isNullValue("manufacturer", map)); |
| | | |
| | | //应报 |
| | | String shouldCnt = isNullValue("should_cnt", map); |
| | | //已报 |
| | | String actualCnt = isNullValue("actual_cnt", map); |
| | | |
| | | String shouldReportAndReport = StringUtil.format("{}/{}", shouldCnt, actualCnt); |
| | | stationExport.setShouldReportAndReport(shouldReportAndReport); |
| | | //到报率 |
| | | double reportRate = Double.parseDouble(isNullValue("report_rate", map)); |
| | | String rate = "0"; |
| | | if (reportRate * 100 == 100) { |
| | | rate = "100%"; |
| | | } else if (reportRate > 0) { |
| | | rate = String.format("%.2f", reportRate * 100) + "%"; |
| | | } |
| | | stationExport.setRate(rate); |
| | | return stationExport; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<StationExport> getVideoStationInfo(HttpServletResponse response, StationParams params, String exportFunc) { |
| | | |
| | | String urlParam = buildParams(params); |
| | | String url = VIDEO_STATION_API + urlParam; |
| | | JSONObject ztData = getZtData(null, url); |
| | | JSONObject result = ztData.getJSONObject("data"); |
| | | JSONArray data = result.getJSONArray("data"); |
| | | List<ZtResultInfo> list = data.toJavaList(ZtResultInfo.class); |
| | | |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | //按水库主站导出 |
| | | if (exportFunc.equals("reservoir")) { |
| | | exportList = exportByReservoirVideo(list); |
| | | } else if (exportFunc.equals("station")) { |
| | | //按测站导出 |
| | | exportList = exportByStationVideo(list); |
| | | } |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private List<StationExport> exportByStationVideo(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | return; |
| | | } else { |
| | | //获取子集中所有站点的数据 |
| | | ztResultInfo.getChildren().forEach(e -> { |
| | | StationExport stationExport1 = buildStationExportVideo(e, ztResultInfo); |
| | | exportList.add(stationExport1); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private List<StationExport> exportByReservoirVideo(List<ZtResultInfo> list) { |
| | | return null; |
| | | } |
| | | |
| | | private StationExport buildStationExportVideo(HashMap<String, Object> map, ZtResultInfo ztResultInfo) { |
| | | |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | stationExport.setRes_nm(ztResultInfo.getName()); |
| | | stationExport.setRes_reg_code(isNullValue("res_reg_code", map)); |
| | | stationExport.setRes_cd(ztResultInfo.getRes_guid()); |
| | | stationExport.setEng_scal(isNullValue("eng_scal", map)); |
| | | stationExport.setCity_nm(ztResultInfo.getCity_nm()); |
| | | stationExport.setCounty_nm(ztResultInfo.getCounty_nm()); |
| | | stationExport.setTown_nm(ztResultInfo.getTown_nm()); |
| | | stationExport.setSt_nm(isNullValue("st_nm", map)); |
| | | stationExport.setFlag(isNullValue("flag", map)); |
| | | |
| | | |
| | | stationExport.setStation_status_text(isNullValue("online", map)); |
| | | stationExport.setManufacturer(isNullValue("manufacturer", map)); |
| | | |
| | | return stationExport; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<StationExport> getImageStation(HttpServletResponse response, StationParams params, String exportFunc) { |
| | | |
| | | String urlParam = buildParams(params); |
| | | String url = IMAGE_STATION_API + urlParam; |
| | | JSONObject ztData = getZtData(null, url); |
| | | JSONObject result = ztData.getJSONObject("data"); |
| | | JSONArray data = result.getJSONArray("data"); |
| | | List<ZtResultInfo> list = data.toJavaList(ZtResultInfo.class); |
| | | |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | //按水库主站导出 |
| | | if (exportFunc.equals("reservoir")) { |
| | | exportList = exportByReservoirImage(list); |
| | | } else if (exportFunc.equals("station")) { |
| | | //按测站导出 |
| | | exportList = exportByStationImage(list); |
| | | } |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | |
| | | private List<StationExport> exportByStationImage(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | return; |
| | | |
| | | } else { |
| | | //获取子集中所有站点的数据 |
| | | ztResultInfo.getChildren().forEach(e -> { |
| | | StationExport stationExport1 = buildStationExportImage(e, ztResultInfo); |
| | | exportList.add(stationExport1); |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private List<StationExport> exportByReservoirImage(List<ZtResultInfo> list) { |
| | | List<StationExport> exportList = new ArrayList<>(); |
| | | |
| | | list.forEach(ztResultInfo -> { |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | if (ztResultInfo.getChildren() == null || ztResultInfo.getChildren().size() == 0) { |
| | | stationExport.setRes_cd(ztResultInfo.getRes_code()); |
| | | stationExport.setRes_nm(ztResultInfo.getRes_nm()); |
| | | stationExport.setCity_nm(ztResultInfo.getCity_nm()); |
| | | stationExport.setCounty_nm(ztResultInfo.getCounty_nm()); |
| | | stationExport.setTown_nm(ztResultInfo.getTown_nm()); |
| | | } else { |
| | | //获取子集第一个 |
| | | stationExport = buildStationExportImage(ztResultInfo.getChildren().get(0), ztResultInfo); |
| | | } |
| | | |
| | | exportList.add(stationExport); |
| | | }); |
| | | |
| | | return exportList; |
| | | } |
| | | |
| | | private StationExport buildStationExportImage(HashMap<String, Object> map, ZtResultInfo ztResultInfo) { |
| | | |
| | | StationExport stationExport = new StationExport(); |
| | | |
| | | stationExport.setRes_nm(ztResultInfo.getRes_name()); |
| | | stationExport.setRes_reg_code(isNullValue("res_reg_code", map)); |
| | | stationExport.setRes_cd(ztResultInfo.getRes_code()); |
| | | stationExport.setEng_scal(isNullValue("eng_scal", map)); |
| | | stationExport.setCity_nm(ztResultInfo.getCity_nm()); |
| | | stationExport.setCounty_nm(ztResultInfo.getCounty_nm()); |
| | | stationExport.setTown_nm(ztResultInfo.getTown_nm()); |
| | | stationExport.setSt_nm(isNullValue("st_nm", map)); |
| | | stationExport.setFlag(isNullValue("flag", map)); |
| | | |
| | | String stationStatus = isNullValue("station_status", map); |
| | | |
| | | String stationStatusText = ""; |
| | | if (stationStatus.equals("1")) { |
| | | stationStatusText = "在线"; |
| | | } else if (stationStatus.equals("0")) { |
| | | stationStatusText = "离线"; |
| | | } |
| | | stationExport.setStation_status_text(stationStatusText); |
| | | |
| | | stationExport.setManufacturer(isNullValue("manufacturer", map)); |
| | | |
| | | //应报 |
| | | String shouldCnt = isNullValue("should_cnt", map); |
| | | //已报 |
| | | String actualCnt = isNullValue("actual_cnt", map); |
| | | |
| | | String shouldReportAndReport = StringUtil.format("{}/{}", shouldCnt, actualCnt); |
| | | stationExport.setShouldReportAndReport(shouldReportAndReport); |
| | | //到报率 |
| | | double reportRate = Double.parseDouble(isNullValue("report_rate", map)); |
| | | String rate = "0"; |
| | | if (reportRate * 100 == 100) { |
| | | rate = "100%"; |
| | | } else if (reportRate > 0) { |
| | | rate = String.format("%.2f", reportRate * 100) + "%"; |
| | | } |
| | | stationExport.setRate(rate); |
| | | return stationExport; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<StationExport> getOsmotic(HttpServletResponse response, StationParams params, String exportFunc) { |
| | | return null; |
| | | } |
| | | |
| | | |
| | | private String isNullValue(String key, HashMap<String, Object> map) { |
| | | if (map.get(key) == null) { |
| | | return ""; |
| | | } else { |
| | | return map.get(key).toString(); |
| | | } |
| | | } |
| | | |
| | | private String isNullObject(Object value) { |
| | | if (value != null) { |
| | | return value.toString(); |
| | | } else { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | |
| | | 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 (typeKey.equals("9") || typeKey.equals("其他")) { |
| | | text = explain; |
| | | } else { |
| | | switch (enumName) { |
| | | case "AqueductTypeEnum": |
| | | text = AqueductTypeEnum.find(typeKey).getLabel(); |
| | | break; |
| | | case "RsbWorkingGateEnum": |
| | | text = RsbWorkingGateEnum.find(typeKey).getLabel(); |
| | | break; |
| | | case "OcTypeEnum": |
| | | text = OcTypeEnum.find(typeKey).getLabel(); |
| | | break; |
| | | case "SpillwayHoleType": |
| | | text = typeKey; |
| | | break; |
| | | case "Explain": |
| | | text = typeKey; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return text; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 调用接口获取中台数据 |
| | | */ |
| | | public JSONObject getZtData(String params, String url){ |
| | | public JSONObject getZtData(String params, String url) { |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")){ |
| | | if (activeProfile.equals("dev")) { |
| | | url = ZtApiUrlConstant.url_prefix_dev + url; |
| | | } |
| | | if (activeProfile.equals("prod")){ |
| | | if (activeProfile.equals("prod")) { |
| | | url = ZtApiUrlConstant.url_prefix_prod + url; |
| | | } |
| | | if (activeProfile.equals("test")){ |
| | | if (activeProfile.equals("test")) { |
| | | url = ZtApiUrlConstant.url_prefix_test + url; |
| | | } |
| | | //设置请求头 |
| | |
| | | return null; |
| | | } |
| | | |
| | | //根据参数对象构建url后的参数 |
| | | private String buildParams(StationParams params) { |
| | | List<String> list = new ArrayList<>(); |
| | | String text = ""; |
| | | Class<? extends StationParams> clazz = params.getClass(); |
| | | Arrays.stream(clazz.getDeclaredFields()) |
| | | .peek(field -> field.setAccessible(true)) |
| | | .forEach(field -> { |
| | | try { |
| | | Object value = field.get(params); |
| | | if (ObjectUtil.isNotEmpty(value)) { |
| | | list.add(StringUtil.format("{}={}", field.getName(), value.toString())); |
| | | } |
| | | |
| | | } catch (IllegalAccessException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | }); |
| | | |
| | | |
| | | text = String.join("&", list); |
| | | return text; |
| | | } |
| | | |
| | | |
| | | } |