Merge remote-tracking branch 'origin/jtdev' into jtdev
8 files modified
7 files added
| | |
| | | * 固定值 |
| | | */ |
| | | @ApiModelProperty("固定值") |
| | | private Double fixValue; |
| | | private String fixValue; |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | private String resCd = ""; |
| | | // private String resCd = ""; |
| | | |
| | | @Override |
| | | public void predictData(String type) { |
| | |
| | | //暂时筛选出这两个水库的数据 |
| | | List<DataResChildrenPo> collect = cdList.stream().filter(item -> item.getRes_cd().equals("42011640018") || item.getRes_cd().equals("42128140006")).collect(Collectors.toList()); |
| | | |
| | | predict(collect,type); |
| | | |
| | | if (type.equals("1")){ |
| | | //渗压 |
| | | collect.forEach(dataResChildrenPo -> { |
| | | //所有水库请求预报数据 |
| | | if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | //请求预报水位 |
| | | List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | resCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | // |
| | | // if (type.equals("1")) { |
| | | // //渗压 |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type, po); |
| | | // //循环预测请求 |
| | | // nkyService.hstPredict(arimaPredictReqPo); |
| | | // } |
| | | //// } |
| | | // }); |
| | | // } else if (type.equals("2")) { |
| | | // //渗流 |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type, po); |
| | | // //循环预测请求 |
| | | // nkyService.hstPredict(arimaPredictReqPo); |
| | | // } |
| | | //// } |
| | | // }); |
| | | // |
| | | // |
| | | // } else if (type.equals("3") || type.equals("4") || type.equals("5")) { |
| | | // collect.forEach(dataResChildrenPo -> { |
| | | // //所有水库请求预报数据 |
| | | //// if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | // //请求预报水位 |
| | | // List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | // resCd = dataResChildrenPo.getRes_cd(); |
| | | // if (future != null && future.size() > 0) { |
| | | // List<PredictWatersPo> po = new ArrayList<>(); |
| | | // future.forEach(item -> { |
| | | // PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | // //设置时间 |
| | | // predictWatersPo.setTime(item.get(0)); |
| | | // //设置预测水位 |
| | | // predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | // po.add(predictWatersPo); |
| | | // }); |
| | | // //循环预测请求(位移一起请求减少请求次数) |
| | | // HstPredictReqPo arimaPredictReqPoX = new HstPredictReqPo(dataResChildrenPo, "3", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoX); |
| | | // |
| | | // HstPredictReqPo arimaPredictReqPoY = new HstPredictReqPo(dataResChildrenPo, "4", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoY); |
| | | // |
| | | // HstPredictReqPo arimaPredictReqPoZ = new HstPredictReqPo(dataResChildrenPo, "5", po); |
| | | // nkyService.hstPredict(arimaPredictReqPoZ); |
| | | // } |
| | | //// } |
| | | // }); |
| | | |
| | | |
| | | |
| | | // } |
| | | // resCd = ""; |
| | | } |
| | | |
| | | private void predict(List<DataResChildrenPo> collect, String type) { |
| | | String resCd = ""; |
| | | //无数据直接返回 |
| | | if (collect.size() == 0){ |
| | | return; |
| | | } |
| | | List<List<String>> future = new ArrayList<>(); |
| | | if (type.equals("1") || type.equals("2")){ |
| | | |
| | | for (int i = 0; i < collect.size(); i++) { |
| | | DataResChildrenPo dataResChildrenPo = collect.get(i); |
| | | String currentResCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | //第一个水库 |
| | | if (future.size() == 0 && resCd.equals("")){ |
| | | future = hsybService.getFuture(currentResCd); |
| | | //当前水库 |
| | | resCd = currentResCd; |
| | | } else if (!resCd.equals(currentResCd)) { |
| | | //其他水库,获取新的预测数据 |
| | | future = hsybService.getFuture(currentResCd); |
| | | //更换为新水库 |
| | | resCd = currentResCd; |
| | | } |
| | | |
| | | //预测数据构造请求数据 |
| | | if (future != null && future.size() > 0) { |
| | | List<PredictWatersPo> po = new ArrayList<>(); |
| | | future.forEach(item -> { |
| | |
| | | //循环预测请求 |
| | | nkyService.hstPredict(arimaPredictReqPo); |
| | | } |
| | | } |
| | | }); |
| | | }else if (type.equals("2")){ |
| | | //渗流 |
| | | collect.forEach(dataResChildrenPo -> { |
| | | //所有水库请求预报数据 |
| | | if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | //请求预报水位 |
| | | List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | resCd = dataResChildrenPo.getRes_cd(); |
| | | if (future != null && future.size() > 0) { |
| | | List<PredictWatersPo> po = new ArrayList<>(); |
| | | future.forEach(item -> { |
| | | PredictWatersPo predictWatersPo = new PredictWatersPo(); |
| | | //设置时间 |
| | | predictWatersPo.setTime(item.get(0)); |
| | | //设置预测水位 |
| | | predictWatersPo.setValue(Double.parseDouble(item.get(2))); |
| | | po.add(predictWatersPo); |
| | | }); |
| | | HstPredictReqPo arimaPredictReqPo = new HstPredictReqPo(dataResChildrenPo, type,po); |
| | | //循环预测请求 |
| | | nkyService.hstPredict(arimaPredictReqPo); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | } |
| | | }else if (type.equals("3") || type.equals("4") || type.equals("5")){ |
| | | collect.forEach(dataResChildrenPo -> { |
| | | //所有水库请求预报数据 |
| | | if (!resCd.equals(dataResChildrenPo.getRes_cd())) { |
| | | //请求预报水位 |
| | | List<List<String>> future = hsybService.getFuture(dataResChildrenPo.getRes_cd()); |
| | | resCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | for (int i = 0; i < collect.size(); i++) { |
| | | DataResChildrenPo dataResChildrenPo = collect.get(i); |
| | | String currentResCd = dataResChildrenPo.getRes_cd(); |
| | | |
| | | //第一个水库 |
| | | if (future.size() == 0 && resCd.equals("")){ |
| | | future = hsybService.getFuture(currentResCd); |
| | | //当前水库 |
| | | resCd = currentResCd; |
| | | } else if (!resCd.equals(currentResCd)) { |
| | | //其他水库,获取新的预测数据 |
| | | future = hsybService.getFuture(currentResCd); |
| | | //更换为新水库 |
| | | resCd = currentResCd; |
| | | } |
| | | |
| | | //预测数据构造请求数据 |
| | | if (future != null && future.size() > 0) { |
| | | List<PredictWatersPo> po = new ArrayList<>(); |
| | | future.forEach(item -> { |
| | |
| | | nkyService.hstPredict(arimaPredictReqPoZ); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | resCd = ""; |
| | | } |
| | | |
| | | @Override |
| | |
| | | package cn.gistack.nky.service.impl; |
| | | |
| | | import cn.gistack.common.utils.CommonUtil; |
| | | import cn.gistack.common.utils.SpringContextUtil; |
| | | import cn.gistack.nky.resultpojo.HsybGetFuturePo; |
| | | import cn.gistack.nky.service.IHsybService; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class HsybServiceImpl implements IHsybService { |
| | | |
| | | private static String ONLINE = "http://10.42.7.148:50001"; |
| | | private static String LOCAL = "https://sk.hubeishuiyi.cn"; |
| | | private static String GET_FUTURE = ONLINE + "/hsybApi/api/fh-admin/skkr/getFuture"; |
| | | private static String GET_FUTURE = "/hsybApi/api/fh-admin/skkr/getFuture"; |
| | | |
| | | private static String AUTHORIZATION = "Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJBRE1JTiIsIlVzZXJJZCI6IjEiLCJzY29wZSI6WyJhbGwiXSwiVXNlclJlYWxOYW1lIjoi6LaF57qn566h55CG5ZGYIiwiVXNlclh6cWhkbSI6IjQyMDUiLCJleHAiOjI1MTk3NzIwMTAsImp0aSI6ImExNTcxYzk1LTBkNjMtNDkyYi1iOWEyLTE2ZTIzNTQ5ZTY1ZiIsImNsaWVudF9pZCI6InVzZXItc2VydmljZSJ9.ebNVZrw9LbhKaj2w6RR8b2wccQiDkhvBeq79SxxCK-yWiOlIFqBkotTN4TNJg8umcpyYvLILwvqXWRJhffEtgi25sX2y6MqLIWM4kMZ9d8ptdnSmTpBPhltSiQOM0KFa1kl5nSDCBwYOLn-pESJglam76cjpgZNoC88x3iNHacdiXDItY0rtY85HrQ26uyJu9UovKtmYmZRHsIbGMpDta5Q1p4vfaCIr-YUayDrCweZJiQDEEcOSpWJ7O7RMk3pRkX_4UmPHFzrOI2lMp1jQIhxnSTE7EVAz_4z8h8r46muSkpF54Ic4XSawHKqdSLHx8T05LB0MpvOzWMPS6c1uHA"; |
| | | |
| | |
| | | |
| | | public HsybGetFuturePo apiRequest(String url, String jsonparams) { |
| | | |
| | | // Long param = Long.parseLong(jsonparams); |
| | | System.out.println("请求参数:" + jsonparams); |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = ONLINE+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = ONLINE + url; |
| | | } |
| | | |
| | | |
| | | log.info("预测水位请求参数:" + jsonparams); |
| | | // 声明一个header变量 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 设置为json格式 |
| | |
| | | RestTemplate template = new RestTemplate(); |
| | | try { |
| | | HsybGetFuturePo hsybGetFuturePo = template.postForObject(url, httpEntity, HsybGetFuturePo.class); |
| | | System.out.println(hsybGetFuturePo.toString()); |
| | | log.info("预测水位返回结果:" + hsybGetFuturePo.toString()); |
| | | return hsybGetFuturePo; |
| | | } catch (Exception e) { |
| | | System.out.println(e); |
| | |
| | | package cn.gistack.nky.service.impl; |
| | | |
| | | import cn.gistack.common.utils.SpringContextUtil; |
| | | import cn.gistack.nky.entity.AlarmGet; |
| | | import cn.gistack.nky.entity.ArimaPredict; |
| | | import cn.gistack.nky.entity.HstPredict; |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.*; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.client.RestTemplate; |
| | |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | @Slf4j |
| | | public class NkyServiceImpl implements INkyService { |
| | | |
| | | |
| | | private static final String API_PREFIX = "http://10.42.7.146:9503/"; |
| | | private static final String LOCAL_API_PREFIX = "https://sk.hubeishuiyi.cn/warnIp/"; |
| | | // ARIMA预测接口URL |
| | | private static final String ARIMA_PREDICT = API_PREFIX + "predict/arimaPredict"; |
| | | private static final String ARIMA_PREDICT = "predict/arimaPredict"; |
| | | // ARIMA预测结果接口 |
| | | private static final String ARIMA_QUERY = API_PREFIX+"predict/arimaQuery"; |
| | | private static final String ARIMA_QUERY = "predict/arimaQuery"; |
| | | // HST预测接口URL |
| | | private static final String HST_PREDICT =API_PREFIX+ "predict/hstPredict"; |
| | | private static final String HST_PREDICT = "predict/hstPredict"; |
| | | // HST预测结果接口 |
| | | private static final String HST_QUERY =API_PREFIX+ "predict/hstQuery"; |
| | | private static final String HST_QUERY = "predict/hstQuery"; |
| | | |
| | | //按库传输数据接口 |
| | | private static final String ORIGIN_BATCHDATA = API_PREFIX + "origin/batchData"; |
| | | private static final String ORIGIN_BATCHDATA = "origin/batchData"; |
| | | |
| | | //判定异常 |
| | | private static final String ALARM_GET = API_PREFIX+"alarm/get"; |
| | | private static final String ALARM_GET = "alarm/get"; |
| | | |
| | | @Override |
| | | public Boolean arimaPredict(ArimaPredictReqPo po) { |
| | |
| | | * @return |
| | | */ |
| | | private JSONObject requestNkyApi(String url, String jsonparams) { |
| | | |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL_API_PREFIX+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = API_PREFIX+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = API_PREFIX + url; |
| | | } |
| | | |
| | | // 声明一个header变量 |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | // 设置为json格式 |
| | |
| | | headers.add("Accept", MediaType.APPLICATION_JSON.toString()); |
| | | |
| | | HttpEntity<String> httpEntity = new HttpEntity(jsonparams, headers); |
| | | System.out.println("请求参数:"+ jsonparams); |
| | | log.info("请求地址:"+ url); |
| | | log.info("请求参数:"+ jsonparams); |
| | | RestTemplate template = new RestTemplate(); |
| | | String resultStr = template.postForObject(url, httpEntity, String.class); |
| | | System.out.println(resultStr); |
| | | log.info("请求结果:"+ resultStr); |
| | | JSONObject jsonObject = JSONObject.parseObject(resultStr); |
| | | return jsonObject; |
| | | } |
| | |
| | | package cn.gistack.nky.service.impl; |
| | | |
| | | import cn.gistack.common.utils.SpringContextUtil; |
| | | import cn.gistack.nky.resultpojo.DataBigResultPojo; |
| | | import cn.gistack.nky.resultpojo.DataResChildrenPo; |
| | | import cn.gistack.nky.resultpojo.DataResPo; |
| | | import cn.gistack.nky.resultpojo.ZtResultPo; |
| | | import cn.gistack.nky.service.IZtApiService; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | * @DATE: 2023/7/28 17:16 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class ZtApiServiceImpl implements IZtApiService { |
| | | |
| | | //本地测试 |
| | |
| | | /** |
| | | * 实时渗压监测 |
| | | */ |
| | | private static final String LASTEST_OSMOTIC_PRESSURE =ONLINE + "/services/1234567890ABCDEFGHIJKLMN/monitor/lastest_osmotic_pressure/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String LASTEST_OSMOTIC_PRESSURE = "/services/1234567890ABCDEFGHIJKLMN/monitor/lastest_osmotic_pressure/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | /** |
| | | * 位移监测 |
| | | */ |
| | | private static final String WY_API =ONLINE+ "/services/1234567890ABCDEFGHIJKLMN/monitor/wy/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String WY_API ="/services/1234567890ABCDEFGHIJKLMN/monitor/wy/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | /** |
| | | * 渗流监测 |
| | | */ |
| | | private static final String SL_API =ONLINE + "/services/1234567890ABCDEFGHIJKLMN/monitor/sl/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | private static final String SL_API ="/services/1234567890ABCDEFGHIJKLMN/monitor/sl/api?res_nm=&cd=&city_cd=&county_cd=&pageNo=1&pageSize=9999"; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | private List<DataResChildrenPo> getData(String url, String type, Map<String, Object> params) { |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = ONLINE+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = ONLINE + url; |
| | | } |
| | | |
| | | HttpMethod method; |
| | | if (type.toLowerCase().equals("get".toLowerCase())) { |
| | | method = HttpMethod.GET; |
| | |
| | | HttpEntity<String> httpEntity = new HttpEntity(null, headers); |
| | | |
| | | RestTemplate template = new RestTemplate(); |
| | | log.info("请求的url为:{}", url); |
| | | ResponseEntity<ZtResultPo> ztResultPojoResponseEntity = template.exchange(url, method,httpEntity, ZtResultPo.class,params); |
| | | if (ztResultPojoResponseEntity.getStatusCodeValue() == 200) { |
| | | List<DataResChildrenPo> children = new ArrayList<>(); |
| | |
| | | } |
| | | |
| | | private List<DataResPo> getResData(String url, String type, Map<String, Object> params){ |
| | | |
| | | // 获取环境 |
| | | String activeProfile = SpringContextUtil.getActiveProfile(); |
| | | if (activeProfile.equals("dev")) { |
| | | url = LOCAL+ url ; |
| | | } |
| | | if (activeProfile.equals("prod")) { |
| | | url = ONLINE+ url ; |
| | | } |
| | | if (activeProfile.equals("test")) { |
| | | url = ONLINE + url; |
| | | } |
| | | |
| | | |
| | | HttpMethod method; |
| | | if (type.toLowerCase().equals("get".toLowerCase())) { |
| | | method = HttpMethod.GET; |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.controller; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManage; |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManageDetail; |
| | | import cn.gistack.sm.resDataCheck.service.IQualityManageDetailService; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * @Description: 数据规则校验 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "数据质量管理明细") |
| | | @RestController |
| | | @RequestMapping("/resDataCheck/qualityManageDetail") |
| | | @AllArgsConstructor |
| | | public class QualityManageDetailController extends BladeController { |
| | | |
| | | private IQualityManageDetailService qualityManageDetailService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-分页列表查询", notes = "数据规则校验-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public R queryPageList(Query query, QualityManageDetailVO qualityManageDetailVO) { |
| | | Object pageList = qualityManageDetailService.selectCustomizePage(Condition.getPage(query), qualityManageDetailVO); |
| | | return R.data(pageList); |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | | * @param qualityManageDetail |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-添加", notes = "数据规则校验-添加") |
| | | @PostMapping(value = "/add") |
| | | public R add(@RequestBody QualityManageDetail qualityManageDetail) { |
| | | return R.data(qualityManageDetailService.save(qualityManageDetail)); |
| | | } |
| | | |
| | | /** |
| | | * 编辑 |
| | | * |
| | | * @param QualityManageVO |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-编辑", notes = "数据规则校验-编辑") |
| | | @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public R edit(@RequestBody QualityManageDetail QualityManageVO) { |
| | | return R.data(qualityManageDetailService.updateById(QualityManageVO)); |
| | | } |
| | | |
| | | /** |
| | | * 通过id删除 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-通过id删除", notes = "数据规则校验-通过id删除") |
| | | @PostMapping(value = "/delete") |
| | | public R delete(@RequestParam(name = "id", required = true) String id) { |
| | | return R.data(qualityManageDetailService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "数据规则校验-批量删除", notes = "数据规则校验-批量删除") |
| | | @PostMapping(value = "/deleteBatch") |
| | | public R deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | return R.data(qualityManageDetailService.removeByIds(Arrays.asList(ids.split(",")))); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | |
| | | /** |
| | | * @Description: 水库数据质量管理明细表 |
| | | */ |
| | | @Data |
| | | @TableName("SM_RES_DATA_QUALITY_MANAGE_DETAIL") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | @ApiModel(value="SM_RES_DATA_QUALITY_MANAGE_DETAIL对象", description="水库数据质量管理明细表") |
| | | public class QualityManageDetail extends BaseEntity { |
| | | |
| | | /** |
| | | * 水库id |
| | | */ |
| | | @ApiModelProperty("水库id") |
| | | private String resId; |
| | | |
| | | //水库名称 |
| | | private String resName; |
| | | |
| | | /** |
| | | * 规则id |
| | | */ |
| | | @ApiModelProperty("规则id") |
| | | private String ruleId; |
| | | |
| | | //规则名称 |
| | | private String ruleName; |
| | | |
| | | //规则描述 |
| | | private String ruleDescription; |
| | | /** |
| | | * 值 |
| | | */ |
| | | @ApiModelProperty("值") |
| | | private String val; |
| | | |
| | | //是否有闸 |
| | | private String isGate; |
| | | |
| | | //水库规模 |
| | | private String engScal; |
| | | |
| | | //是否病险 |
| | | private String isDanger; |
| | | |
| | | //市编码 |
| | | private String cityCode; |
| | | private String cityName; |
| | | private String countyCode; |
| | | private String countyName; |
| | | private String townCode; |
| | | private String townName; |
| | | |
| | | //注册登记号 |
| | | private String resRegCode; |
| | | |
| | | //实时水位 |
| | | private String rz; |
| | | |
| | | //堰顶高程 |
| | | private String tbWeirTopElevation; |
| | | |
| | | //主汛期限制水位 |
| | | private String tbFlseLimStag; |
| | | |
| | | //正常蓄水位 |
| | | private String tbNormPoolStag; |
| | | |
| | | |
| | | //控制运行水位 |
| | | private String tbControlZ; |
| | | |
| | | |
| | | //设计洪水位 |
| | | private String tbDesFlStag; |
| | | |
| | | |
| | | //校核洪水位 |
| | | private String tbCheckFlStag; |
| | | |
| | | |
| | | //坝顶高程 |
| | | private String tbDamTopElevation; |
| | | |
| | | //死水位 |
| | | private String tbDeadStag; |
| | | |
| | | //备注 |
| | | private String remark; |
| | | } |
| | |
| | | String retStr = "-1"; |
| | | switch (key) { |
| | | case "EQUAL": //等于 |
| | | retStr = " is null OR = '' "; |
| | | retStr = " is null"; |
| | | break; |
| | | case "UNEQUAL": //不等于 |
| | | retStr = " is not null "; |
| | |
| | | varStr = "concat(" + varStr +") AS val"; |
| | | |
| | | if (StringUtil.isNotBlank(rules.getIsGate())) { |
| | | sqlStr += " and a.\"is_gate\" = " + rules.getIsGate(); |
| | | |
| | | String gateStr = rules.getIsGate().equals("1") ?"'有闸水库'":"'无闸水库'"; |
| | | |
| | | sqlStr += " and a.\"is_gate\" = " + gateStr; |
| | | } |
| | | |
| | | // 拼接条件有问题,不操作 |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.mapper; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManage; |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManageDetail; |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: 数据校验规则 |
| | | */ |
| | | public interface QualityManageDetailMapper extends BaseMapper<QualityManageDetail> { |
| | | |
| | | List<QualityManageDetailVO> selectCustomizePage(IPage<QualityManageDetailVO> page, @Param("vo") QualityManageDetailVO qualityManageDetailVO); |
| | | |
| | | |
| | | Integer saveQualityManageDetail(@Param("rule")Rules rules, @Param("varStr") String varStr, @Param("whereStr") String whereStr); |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.gistack.sm.resDataCheck.mapper.QualityManageDetailMapper"> |
| | | |
| | | |
| | | <insert id="saveQualityManageDetail"> |
| | | |
| | | insert into |
| | | SM_RES_DATA_QUALITY_MANAGE_DETAIL |
| | | ( |
| | | res_id,rule_id,rule_name,rule_description,create_time,update_time,val, |
| | | is_gate,eng_scal,is_danger,town_code,town_name,county_code,county_name,city_code,city_name, |
| | | res_reg_code,res_name,rz,tb_weir_top_elevation,tb_flse_lim_stag,tb_norm_pool_stag,tb_control_z,tb_des_fl_stag,tb_dam_top_elevation,tb_dead_stag,remark |
| | | ) |
| | | select |
| | | distinct |
| | | a."guid" as res_id, |
| | | ${rule.id} AS rule_id, |
| | | ${rule.name}AS rule_name, |
| | | ${rule.description}AS rule_description, |
| | | NOW() AS create_time, |
| | | NOW() AS update_time, |
| | | ${varStr}, |
| | | a."is_gate" AS is_gate, |
| | | a."eng_scal" AS eng_scal, |
| | | dria."is_danger_res" AS is_danger, |
| | | |
| | | case when town."ad_grad" = 4 THEN town."ad_code" ELSE NULL END AS town_code, |
| | | case when town."ad_grad" = 4 THEN town."ad_name" ELSE NULL END AS town_name, |
| | | |
| | | case when town."ad_grad" = 3 THEN town."ad_code" |
| | | when county."ad_grad" = 3 THEN county."ad_code" END AS county_code, |
| | | |
| | | case when town."ad_grad" = 3 THEN town."ad_name" |
| | | when county."ad_grad" = 3 THEN county."ad_name" END AS county_name, |
| | | |
| | | case when town."ad_grad" = 2 THEN town."ad_code" |
| | | when county."ad_grad" = 2 THEN county."ad_code" |
| | | ELSE city."ad_code" END AS city_code, |
| | | |
| | | case when town."ad_grad" = 2 THEN town."ad_name" |
| | | when county."ad_grad" = 2 THEN county."ad_name" |
| | | ELSE city."ad_name" END AS city_name, |
| | | |
| | | a."res_reg_code" as res_reg_code, |
| | | a."name" as res_name, |
| | | f."rz" as rz, |
| | | g."tb_weir_top_elevation", |
| | | d2."tb_flse_lim_stag", |
| | | c."tb_norm_pool_stag", |
| | | b."tb_control_z", |
| | | c."tb_des_fl_stag", |
| | | h."tb_dam_top_elevation", |
| | | c."tb_dead_stag", |
| | | ${rule.description} as remark |
| | | |
| | | from SJZT_MD."att_res_base" a |
| | | |
| | | LEFT JOIN SJZT_MD."att_ad_base" town ON town."guid" = a."interior_ad_guid" |
| | | LEFT JOIN SJZT_MD."att_ad_base" county ON county."guid" = town."p_ad_code" |
| | | LEFT JOIN SJZT_MD."att_ad_base" city ON city."guid" = county."p_ad_code" |
| | | |
| | | left join SJZT_DW."dim_res_info_a" dria ON (dria."guid" = a."guid") |
| | | left join SJZT_MD."att_res_danger_manage_special" b on (a."guid" = b."res_guid") |
| | | left join SJZT_MD."att_res_stag_char" c on (a."guid" = c."res_guid") |
| | | left join SJZT_MD."att_res_flse_lim" d1 on (a."guid" = d1."res_guid" and d1."flood_season_name" = '前汛期') |
| | | left join SJZT_MD."att_res_flse_lim" d2 on (a."guid" = d2."res_guid" and d2."flood_season_name" = '中汛期') |
| | | left join SJZT_MD."att_res_flse_lim" d3 on (a."guid" = d3."res_guid" and d3."flood_season_name" = '后汛期') |
| | | left join SJZT_MD."att_st_base" e on (a."guid" = e."res_guid" and e."is_main_rsvr" = '1') |
| | | left join SJZT_MD."st_rsvr_r_last" f on (e."code" = f."stcd") |
| | | left join (select tmp."res_guid",max(tmp."tb_weir_top_elevation") "tb_weir_top_elevation" from SJZT_MD."att_res_rsb_norspi" tmp group by tmp."res_guid") g on (a."guid" = g."res_guid") |
| | | left join (select tmp2."res_guid",max(tmp2."tb_dam_top_elevation") "tb_dam_top_elevation" from SJZT_MD."att_res_water_block" tmp2 group by tmp2."res_guid") h on (a."guid" = h."res_guid") |
| | | ${whereStr} |
| | | </insert> |
| | | |
| | | |
| | | |
| | | |
| | | <select id="selectCustomizePage" resultType="cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO"> |
| | | SELECT |
| | | MAX(id) id, |
| | | RES_ID, |
| | | MAX(is_gate) is_gate, |
| | | MAX(eng_scal) eng_scal, |
| | | MAX(is_danger) is_danger, |
| | | MAX(town_code) town_code, |
| | | MAX(town_name) town_name, |
| | | MAX(county_code)county_code, |
| | | MAX(county_name)county_name, |
| | | MAX(city_code) city_code, |
| | | MAX(city_name) city_name, |
| | | MAX(res_reg_code) res_reg_code, |
| | | MAX(res_name) res_name, |
| | | MAX(rz) rz, |
| | | MAX(tb_flse_lim_stag) tb_flse_lim_stag, |
| | | MAX(tb_weir_top_elevation) tb_weir_top_elevation, |
| | | MAX(tb_norm_pool_stag) tb_norm_pool_stag, |
| | | MAX(tb_control_z) tb_control_z, |
| | | MAX(tb_des_fl_stag) tb_des_fl_stag, |
| | | MAX(tb_dam_top_elevation) tb_dam_top_elevation, |
| | | MAX(tb_dead_stag) tb_dead_stag, |
| | | replace(wm_concat(remark),',',';') as remark, |
| | | MAX(create_time) create_time |
| | | from YWXT.SM_RES_DATA_QUALITY_MANAGE_DETAIL |
| | | where |
| | | 1=1 |
| | | <if test="vo.resId != null and vo.resId != ''"> |
| | | AND res_id = #{vo.resId} |
| | | </if> |
| | | <if test="vo.resName != null and vo.resName != ''"> |
| | | AND res_name LIKE CONCAT('%', #{vo.resName},'%') |
| | | </if> |
| | | <if test="vo.startTime != null and vo.startTime != ''"> |
| | | AND DATE_FORMAT(create_time,'%Y-%m-%d') >= #{vo.startTime} |
| | | </if> |
| | | <if test="vo.endTime != null and vo.endTime !='' "> |
| | | AND DATE_FORMAT(create_time,'%Y-%m-%d') <= #{vo.endTime} |
| | | </if> |
| | | <if test="vo.engScal != null and vo.engScal != ''"> |
| | | and eng_scal = #{vo.engScal} |
| | | </if> |
| | | <if test="vo.isDanger != null and vo.isDanger != ''"> |
| | | and is_danger = #{vo.isDanger} |
| | | </if> |
| | | <if test="vo.cityCode != null and vo.cityCode != ''"> |
| | | and city_code = #{vo.cityCode} |
| | | </if> |
| | | <if test="vo.countyCode != null and vo.countyCode != ''"> |
| | | and county_code = #{vo.countyCode} |
| | | </if> |
| | | <if test="vo.townCode != null and vo.townCode != ''"> |
| | | and town_code= #{vo.townCode} |
| | | </if> |
| | | GROUP BY |
| | | RES_ID |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <insert id="addQualityManage"> |
| | | insert into SM_RES_DATA_QUALITY_MANAGE (res_id,rule_id,create_time,update_time,val) |
| | | select a."guid" as res_id,${ruleId} AS rule_id,NOW() AS create_time,NOW() AS update_time, ${varStr} |
| | | select distinct a."guid" as res_id,${ruleId} AS rule_id,NOW() AS create_time,NOW() AS update_time, ${varStr} |
| | | from SJZT_MD."att_res_base" a |
| | | left join SJZT_MD."att_res_danger_manage_special" b on (a."guid" = b."res_guid") |
| | | left join SJZT_MD."att_res_stag_char" c on (a."guid" = c."res_guid") |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManage; |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManageDetail; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | |
| | | public interface IQualityManageDetailService extends BaseService<QualityManageDetail> { |
| | | Object selectCustomizePage(IPage<QualityManageDetailVO> page, QualityManageDetailVO qualityManageDetailVO); |
| | | |
| | | |
| | | Integer saveQualityManageDetail(Long ruleId, String varStr, String whereStr); |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.service.impl; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManageDetail; |
| | | import cn.gistack.sm.resDataCheck.entity.Rules; |
| | | import cn.gistack.sm.resDataCheck.mapper.QualityManageDetailMapper; |
| | | import cn.gistack.sm.resDataCheck.service.IQualityManageDetailService; |
| | | import cn.gistack.sm.resDataCheck.service.IRulesService; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageDetailVO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class QualityManageDetailServiceImpl extends BaseServiceImpl<QualityManageDetailMapper, QualityManageDetail> implements IQualityManageDetailService { |
| | | private final IRulesService rulesService; |
| | | |
| | | @Override |
| | | public Object selectCustomizePage(IPage<QualityManageDetailVO> page, QualityManageDetailVO qualityManageDetailVO) { |
| | | |
| | | if (qualityManageDetailVO.getIsExport() != null && qualityManageDetailVO.getIsExport().equals("1")){ |
| | | return baseMapper.selectCustomizePage(null,qualityManageDetailVO); |
| | | } |
| | | return page.setRecords(baseMapper.selectCustomizePage(page, qualityManageDetailVO)); |
| | | } |
| | | |
| | | @Override |
| | | public Integer saveQualityManageDetail(Long ruleId, String varStr, String whereStr) { |
| | | Rules rule = rulesService.getById(ruleId); |
| | | rule.setName(StringUtil.format("'{}'",rule.getName())); |
| | | rule.setDescription(StringUtil.format("'{}'",rule.getDescription())); |
| | | |
| | | return baseMapper.saveQualityManageDetail(rule, varStr, whereStr); |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManage; |
| | | import cn.gistack.sm.resDataCheck.mapper.QualityManageMapper; |
| | | import cn.gistack.sm.resDataCheck.service.IQualityManageDetailService; |
| | | import cn.gistack.sm.resDataCheck.service.IQualityManageService; |
| | | import cn.gistack.sm.resDataCheck.vo.QualityManageVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class QualityManageServiceImpl extends BaseServiceImpl<QualityManageMapper, QualityManage> implements IQualityManageService { |
| | | |
| | | private final IQualityManageDetailService qualityManageDetailService; |
| | | |
| | | @Override |
| | | public IPage<QualityManageVO> selectCustomizePage(IPage<QualityManageVO> page, QualityManageVO qualityManageVO) { |
| | | return page.setRecords(baseMapper.selectCustomizePage(page,qualityManageVO)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Integer addQualityManage(Long ruleId, String varStr, String whereStr) { |
| | | |
| | | qualityManageDetailService.saveQualityManageDetail(ruleId,varStr,whereStr); |
| | | |
| | | return baseMapper.addQualityManage(ruleId, varStr, whereStr); |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.resDataCheck.vo; |
| | | |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManage; |
| | | import cn.gistack.sm.resDataCheck.entity.QualityManageDetail; |
| | | import lombok.Data; |
| | | import org.bouncycastle.cms.PasswordRecipientId; |
| | | |
| | | @Data |
| | | public class QualityManageDetailVO extends QualityManageDetail { |
| | | private String startTime; |
| | | private String endTime; |
| | | |
| | | private String isExport; |
| | | |
| | | } |