From da0cb6ec9344641c5d1820e099131b58149b3fbc Mon Sep 17 00:00:00 2001
From: swb <jpy123456>
Date: Fri, 15 Nov 2024 08:44:30 +0800
Subject: [PATCH] fix:国控站显示提交
---
screen-api/src/main/java/com/moral/api/controller/HistoryFiveMinutelyController.java | 11 ++
screen-api/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java | 43 ++++++++
screen-api/src/main/java/com/moral/api/controller/GovMonitorPointController.java | 7 +
screen-api/src/main/java/com/moral/api/service/impl/GovMonitorPointServiceImpl.java | 25 +++++
screen-api/src/main/java/com/moral/api/service/GovMonitorPointService.java | 6 +
screen-api/src/main/java/com/moral/api/pojo/dto/historyAqi/HistoryAqiDto.java | 39 +++++++
screen-api/src/main/resources/mapper/HistoryAqiMapper.xml | 25 +++++
screen-api/src/main/java/com/moral/api/entity/HistoryAqi.java | 46 +++++++++
screen-api/src/main/java/com/moral/api/mapper/HistoryAqiMapper.java | 21 ++++
screen-api/src/main/java/com/moral/api/service/HistoryAqiService.java | 20 ++++
10 files changed, 243 insertions(+), 0 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/controller/GovMonitorPointController.java b/screen-api/src/main/java/com/moral/api/controller/GovMonitorPointController.java
index 71296df..d2401a3 100644
--- a/screen-api/src/main/java/com/moral/api/controller/GovMonitorPointController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/GovMonitorPointController.java
@@ -115,4 +115,11 @@
List<Map<String, Object>> response = govMonitorPointService.getGovMonitorPointsByOrganizationId(organizationId);
return ResultMessage.ok(response);
}
+
+ @GetMapping("getGovMonitorPoints")
+ @ApiOperation("���������������������")
+ public ResultMessage getGovMonitorPoints(){
+ List<GovMonitorPoint> govMonitorPoints = govMonitorPointService.selectPoint();
+ return ResultMessage.ok(govMonitorPoints);
+ }
}
diff --git a/screen-api/src/main/java/com/moral/api/controller/HistoryFiveMinutelyController.java b/screen-api/src/main/java/com/moral/api/controller/HistoryFiveMinutelyController.java
index f4e80b9..34499af 100644
--- a/screen-api/src/main/java/com/moral/api/controller/HistoryFiveMinutelyController.java
+++ b/screen-api/src/main/java/com/moral/api/controller/HistoryFiveMinutelyController.java
@@ -1,10 +1,12 @@
package com.moral.api.controller;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.moral.api.pojo.dto.historyAqi.HistoryAqiDto;
import com.moral.api.pojo.dto.historyFiveMinutely.DeviceAndFiveMinuteDataDTO;
import com.moral.api.pojo.form.historyFiveMinutely.QueryDeviceAndFiveMinuteDataForm;
import com.moral.api.pojo.vo.historyFiveMinutely.DeviceAndFiveMinuteDataVO;
import com.moral.api.pojo.vo.historyFiveMinutely.QueryFiveDataByMacVO;
+import com.moral.api.service.HistoryAqiService;
import com.moral.api.service.HistoryFiveMinutelyService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
@@ -45,6 +47,8 @@
@Autowired
HistoryFiveMinutelyService historyFiveMinutelyService;
+ @Autowired
+ private HistoryAqiService historyAqiService;
/**
* @Description: ���������������������������������������������������������������������
@@ -101,6 +105,13 @@
}
+ @GetMapping("historyAqi")
+ @ApiOperation("���������������������")
+ public ResultMessage historyAqiQuery(String guid){
+ List<HistoryAqiDto> reveal = historyAqiService.reveal(guid);
+ return ResultMessage.ok(reveal);
+ }
+
}
diff --git a/screen-api/src/main/java/com/moral/api/entity/HistoryAqi.java b/screen-api/src/main/java/com/moral/api/entity/HistoryAqi.java
new file mode 100644
index 0000000..91edcc6
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/entity/HistoryAqi.java
@@ -0,0 +1,46 @@
+package com.moral.api.entity;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+
+/**
+ * <p>
+ * ������aqi���������
+ * </p>
+ *
+ * @author moral
+ * @since 2024-11-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class HistoryAqi extends Model<HistoryAqi> {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * ������/������/������������id
+ */
+ private String guid;
+
+ /**
+ * ������
+ */
+ private Date time;
+
+ /**
+ * ������
+ */
+ private String value;
+
+
+ @Override
+ protected Serializable pkVal() {
+ return null;
+ }
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/mapper/HistoryAqiMapper.java b/screen-api/src/main/java/com/moral/api/mapper/HistoryAqiMapper.java
new file mode 100644
index 0000000..ed12e7d
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/mapper/HistoryAqiMapper.java
@@ -0,0 +1,21 @@
+package com.moral.api.mapper;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.moral.api.entity.HistoryAqi;
+import com.moral.api.pojo.dto.historyAqi.HistoryAqiDto;
+
+/**
+ * <p>
+ * ������aqi��������� Mapper ������
+ * </p>
+ *
+ * @author moral
+ * @since 2021-12-23
+ */
+public interface HistoryAqiMapper extends BaseMapper<HistoryAqi> {
+
+ List<HistoryAqiDto> query(String guid);
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/pojo/dto/historyAqi/HistoryAqiDto.java b/screen-api/src/main/java/com/moral/api/pojo/dto/historyAqi/HistoryAqiDto.java
new file mode 100644
index 0000000..5830a46
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/pojo/dto/historyAqi/HistoryAqiDto.java
@@ -0,0 +1,39 @@
+package com.moral.api.pojo.dto.historyAqi;
+
+import lombok.Data;
+
+/**
+ * Description //todo
+ *
+ * @author swb
+ * @ClassName HistoryAqiDto
+ * @date 2024.11.13 15:35
+ */
+@Data
+public class HistoryAqiDto {
+
+ //co
+ private Double a21005;
+ //o3
+ private Double a05024;
+ //no2
+ private Double a21004;
+ //so2
+ private Double a21026;
+ //pm10
+ private Double a34002;
+ //pm2.5
+ private Double a34004;
+ //������
+ private String dataTime;
+ //������
+ private Double a01007;
+ //������
+ private Double a01008;
+ //tvoc
+ private Double a99054;
+
+
+
+
+}
diff --git a/screen-api/src/main/java/com/moral/api/service/GovMonitorPointService.java b/screen-api/src/main/java/com/moral/api/service/GovMonitorPointService.java
index 2dde201..9389132 100644
--- a/screen-api/src/main/java/com/moral/api/service/GovMonitorPointService.java
+++ b/screen-api/src/main/java/com/moral/api/service/GovMonitorPointService.java
@@ -44,4 +44,10 @@
Map<String, Object> queryGovMonitorPointHoutlyDatyByGuidsAndOrgid(Map map);
List<Map<String, Object>> getGovMonitorPointsByOrganizationId(Integer organizationId);
+
+ /**
+ * ���������������������
+ * @return
+ */
+ List<GovMonitorPoint> selectPoint();
}
diff --git a/screen-api/src/main/java/com/moral/api/service/HistoryAqiService.java b/screen-api/src/main/java/com/moral/api/service/HistoryAqiService.java
new file mode 100644
index 0000000..cc81f4f
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/service/HistoryAqiService.java
@@ -0,0 +1,20 @@
+package com.moral.api.service;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.moral.api.entity.HistoryAqi;
+import com.moral.api.pojo.dto.historyAqi.HistoryAqiDto;
+
+/**
+ * <p>
+ * ������aqi��������� ���������
+ * </p>
+ *
+ * @author moral
+ * @since 2024-11-13
+ */
+public interface HistoryAqiService extends IService<HistoryAqi> {
+
+ List<HistoryAqiDto> reveal(String guid);
+}
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/GovMonitorPointServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/GovMonitorPointServiceImpl.java
index 2386fb9..66bab44 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/GovMonitorPointServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/GovMonitorPointServiceImpl.java
@@ -1,6 +1,7 @@
package com.moral.api.service.impl;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.Device;
@@ -19,6 +20,7 @@
import com.moral.pojo.AQI;
import com.moral.util.AQIUtils;
import com.moral.util.RegionCodeUtils;
+import com.moral.util.TokenUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@@ -710,4 +712,27 @@
.in("city_code", cityCodes);
return govMonitorPointMapper.selectMaps(govMonitorPointQueryWrapper);
}
+
+ /**
+ * ���������������������
+ *
+ * @return
+ */
+ @Override
+ public List<GovMonitorPoint> selectPoint() {
+ Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
+ Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
+ Integer orId =(Integer) orgInfo.get("id");
+ Integer code = null;
+ LambdaQueryWrapper<GovMonitorPoint> wrapper = new LambdaQueryWrapper<>();
+ wrapper.select(GovMonitorPoint::getGuid,GovMonitorPoint::getLatitude,GovMonitorPoint::getLongitude,GovMonitorPoint::getName);
+ if (orId!=24){
+ code = (Integer) orgInfo.get("locationLevelCode");
+ wrapper.eq(GovMonitorPoint::getAreaCode,code);
+ }
+ wrapper.eq(GovMonitorPoint::getIsDelete,Constants.NOT_DELETE);
+
+ List<GovMonitorPoint> govMonitorPoints = govMonitorPointMapper.selectList(wrapper);
+ return govMonitorPoints;
+ }
}
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
new file mode 100644
index 0000000..c704690
--- /dev/null
+++ b/screen-api/src/main/java/com/moral/api/service/impl/HistoryAqiServiceImpl.java
@@ -0,0 +1,43 @@
+package com.moral.api.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.util.List;
+import java.util.Map;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.moral.api.entity.HistoryAqi;
+import com.moral.api.mapper.HistoryAqiMapper;
+import com.moral.api.pojo.dto.historyAqi.HistoryAqiDto;
+import com.moral.api.service.HistoryAqiService;
+import com.moral.util.TokenUtils;
+
+/**
+ * <p>
+ * ������aqi��������� ���������������
+ * </p>
+ *
+ * @author moral
+ * @since 2024-11-13
+ */
+@Service
+public class HistoryAqiServiceImpl extends ServiceImpl<HistoryAqiMapper, HistoryAqi> implements HistoryAqiService {
+
+
+ @Autowired
+ private HistoryAqiMapper historyAqiMapper;
+ /**
+ * ���������������
+ * @return
+ */
+ @Override
+ public List<HistoryAqiDto> reveal(String guid) {
+ if (ObjectUtils.isEmpty(guid)){
+ return null;
+ }
+ List<HistoryAqiDto> query = historyAqiMapper.query(guid);
+ return query;
+ }
+}
diff --git a/screen-api/src/main/resources/mapper/HistoryAqiMapper.xml b/screen-api/src/main/resources/mapper/HistoryAqiMapper.xml
new file mode 100644
index 0000000..7e6f501
--- /dev/null
+++ b/screen-api/src/main/resources/mapper/HistoryAqiMapper.xml
@@ -0,0 +1,25 @@
+<?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="com.moral.api.mapper.HistoryAqiMapper">
+
+ <!-- ������������������������ -->
+ <resultMap id="BaseResultMap" type="com.moral.api.entity.HistoryAqi">
+ <result column="guid" property="guid"/>
+ <result column="time" property="time"/>
+ <result column="value" property="value"/>
+ </resultMap>
+
+
+ <select id="query" resultType="com.moral.api.pojo.dto.historyAqi.HistoryAqiDto">
+ SELECT `value` -> '$.co' as a21005,
+ `value` -> '$.o3' as a05024,
+ `value` -> '$.no2' as a21004,
+ `value` -> '$.so2' as a21026,
+ `value` -> '$.pm10' as a34002,
+ `value` -> '$.pm2_5' as a34004,
+ `value` -> '$.pubtime' as dataTime
+ FROM history_aqi where guid=#{guid} and history_aqi.time =(SELECT MAX(time) FROM history_aqi)
+ </select>
+</mapper>
+
+
--
Gitblit v1.8.0