| | |
| | | package cn.gistack.nky.feign; |
| | | |
| | | 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.vo.AlarmGetVO; |
| | | import cn.gistack.nky.vo.PageVO; |
| | | import cn.gistack.sm.patrol.feign.PatrolTaskClient; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.List; |
| | | |
| | | @NonDS |
| | | @ApiIgnore |
| | |
| | | private final IArimaPredictService arimaPredictService; |
| | | private final IHstPredictService hstPredictService; |
| | | private final IAlarmGetService alarmGetService; |
| | | private final PatrolTaskClient patrolTaskClient; |
| | | |
| | | |
| | | @Override |
| | |
| | | public void alarmGetData(String type) { |
| | | alarmGetService.alarmGetData(type); |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(GET_ALARM_DETAIL) |
| | | public List<AlarmGetVO> getAlarmDetail(AlarmGetVO alarmGet) { |
| | | return alarmGetService.getAlarmDetail(alarmGet); |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(GET_ALARM_DETAIL_PAGE) |
| | | public PageVO<AlarmGetVO> getAlarmDetailPage(Integer current, Integer size, AlarmGetVO alarmGet, |
| | | String ascs, |
| | | String descs) { |
| | | Query query = new Query(); |
| | | query.setCurrent(current); |
| | | query.setSize(size); |
| | | query.setAscs(ascs); |
| | | query.setDescs(descs); |
| | | IPage<AlarmGetVO> alarmDetailPage = alarmGetService.getAlarmDetailPage(Condition.getPage(query), alarmGet); |
| | | |
| | | PageVO<AlarmGetVO> pageVO = new PageVO(); |
| | | |
| | | pageVO.setData(alarmDetailPage.getRecords()); |
| | | pageVO.setTotal(alarmDetailPage.getTotal()); |
| | | pageVO.setCurrent(alarmDetailPage.getCurrent()); |
| | | pageVO.setSize(alarmDetailPage.getSize()); |
| | | |
| | | return pageVO; |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(UPDATE_ALARM_GET) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean updateAlarmGet(AlarmGetVO alarmGet) { |
| | | //修改处置状态 |
| | | AlarmGetVO byId = alarmGetService.getAlarmVO(alarmGet); |
| | | |
| | | String processDefinitionId = "c2d5326e-e27b-11ed-a04e-00ff0b362ee4"; |
| | | |
| | | //日常巡查 |
| | | String taskType = "1641037874390999041"; |
| | | |
| | | //杨树堰水库大坝预警巡查 |
| | | String title = StringUtil.format("{}大坝预警巡查",byId.getReservoirName()); |
| | | |
| | | //杨树堰水库在2023-11-29 17:41:19时监测到位移GN1测点,测点值为2.37,预警等级为三级 |
| | | |
| | | String resNm = byId.getReservoirName(); |
| | | String tm = DateUtil.format(byId.getTime(),"MM月dd日HH时mm分"); |
| | | String typeName = byId.getTypeName(); |
| | | String cdNm = byId.getCdName(); |
| | | String value = byId.getValue(); |
| | | String level =String.valueOf( byId.getLevel()); |
| | | |
| | | String content=StringUtil.format("{}在{}时监测到{}{}测点值为{},预警等级为{}级", |
| | | resNm,tm,typeName,cdNm,value,level); |
| | | String resCd = byId.getDamId(); |
| | | |
| | | //创建巡查任务 |
| | | String taskId = patrolTaskClient.createTask(processDefinitionId,taskType,title,content,resCd); |
| | | alarmGet.setTaskId(taskId); |
| | | return alarmGetService.updateById(alarmGet); |
| | | } |
| | | |
| | | @Override |
| | | @PostMapping(UPDATE_ALARM_GET_STATUS) |
| | | public Boolean updateStatus(AlarmGet alarmGet) { |
| | | return alarmGetService.updateById(alarmGet); |
| | | } |
| | | |
| | | @Override |
| | | @GetMapping(FINISH_TASK) |
| | | public Boolean finishTask(String taskId) { |
| | | |
| | | AlarmGet alarmGet = alarmGetService.getOne(new QueryWrapper<AlarmGet>().eq("TASK_ID", taskId)); |
| | | |
| | | if (alarmGet != null){ |
| | | //设置预警为已处理 |
| | | alarmGet.setStatus("1"); |
| | | Boolean aBoolean = updateStatus(alarmGet); |
| | | return aBoolean; |
| | | } |
| | | return false; |
| | | } |
| | | } |