| | |
| | | |
| | | import cn.gistack.nky.entity.AlarmGet; |
| | | import cn.gistack.nky.fegin.INkyClient; |
| | | import cn.gistack.nky.service.IAlarmGetService; |
| | | import cn.gistack.nky.service.IArimaPredictService; |
| | | import cn.gistack.nky.service.IHstPredictService; |
| | | import cn.gistack.nky.service.INkyService; |
| | | import cn.gistack.nky.resultpojo.BaseCd; |
| | | import cn.gistack.nky.resultpojo.NkyBindDetailResult; |
| | | import cn.gistack.nky.resultpojo.ResDamMonitorResult; |
| | | import cn.gistack.nky.service.*; |
| | | import cn.gistack.nky.vo.AlarmGetVO; |
| | | import cn.gistack.nky.vo.PageVO; |
| | | import cn.gistack.sm.patrol.feign.PatrolTaskClient; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @NonDS |
| | | @ApiIgnore |
| | |
| | | private final IHstPredictService hstPredictService; |
| | | private final IAlarmGetService alarmGetService; |
| | | private final PatrolTaskClient patrolTaskClient; |
| | | private final IZtApiService ztApiService; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(INIT_ALGORITHM) |
| | | public void initAlgorithm(List<String> resList) { |
| | | List<ResDamMonitorResult> resDamMonitorResultList = ztApiService.getResDamMonitor(); |
| | | //获取水库之后,根据标识是否有监测站请求测点 |
| | | resDamMonitorResultList.forEach(resDamMonitorResult -> { |
| | | String resGuid = resDamMonitorResult.getCode(); |
| | | if (resDamMonitorResult.getIs_sy().equals("1")){ |
| | | activeAlgorithm(resGuid,"sy","1"); |
| | | } |
| | | if (resDamMonitorResult.getIs_sl().equals("1")){ |
| | | activeAlgorithm(resGuid,"sl","2"); |
| | | } |
| | | if (resDamMonitorResult.getIs_wy().equals("1")){ |
| | | activeAlgorithm(resGuid,"wy","3,4,5"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | private void activeAlgorithm(String resGuid,String type,String nkyType){ |
| | | String taskCategory = "2107"; |
| | | List<BaseCd> cdList = ztApiService.getBaseCd(resGuid,type); |
| | | List<String> nkyTypeList = Arrays.asList(nkyType.split(",")); |
| | | |
| | | |
| | | cdList.forEach(baseCd -> { |
| | | String pointId = baseCd.getCd(); |
| | | |
| | | nkyTypeList.forEach(nkyTypeFlag->{ |
| | | |
| | | //请求测点之后,循环测点,判断算法绑定情况 |
| | | List<NkyBindDetailResult> nkyBindDetailResultList = nkyService.getBindDetail(baseCd.getRes_cd(),baseCd.getCd(),nkyTypeFlag); |
| | | //过滤出 多元线性回归预测模型异常判定 algorithmCategory: 2107 |
| | | List<NkyBindDetailResult> filterCollect = nkyBindDetailResultList.stream().filter(nkyBindDetailResult -> nkyBindDetailResult.getAlgorithmCategory().equals(taskCategory)).collect(Collectors.toList()); |
| | | |
| | | if (filterCollect.size() == 0){ |
| | | //如果是空的,说明没有启用该算法;先启用该算法 |
| | | // JSONObject bindEnableParams = new JSONObject(); |
| | | // |
| | | // bindEnableParams.put("status",1); |
| | | // bindEnableParams.put("taskCategory",taskCategory); |
| | | // bindEnableParams.put("damId",resGuid); |
| | | // bindEnableParams.put("pointId",pointId); |
| | | // bindEnableParams.put("type",nkyTypeFlag); |
| | | // boolean bindEnableRes = nkyService.bindEnable(bindEnableParams); |
| | | // //成功启用,设置值 |
| | | // if (bindEnableRes){ |
| | | // |
| | | // JSONObject bindParamParams = new JSONObject(); |
| | | // |
| | | // bindParamParams.put("damId",resGuid); |
| | | // bindParamParams.put("pointId",pointId); |
| | | // bindParamParams.put("type",nkyTypeFlag); |
| | | // bindParamParams.put("algorithmCategory",taskCategory); |
| | | // bindParamParams.put("reserve1","4,3.3,2.7,2"); |
| | | // |
| | | // boolean bindParamRes = nkyService.bindParam(bindParamParams); |
| | | // } |
| | | |
| | | } |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | } |