Browse Source

气象 查询

develop
王兴琳 11 months ago
parent
commit
83c2e2522a
  1. 11
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 2
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  3. 7
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  4. 29
      zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

11
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -98,15 +98,12 @@ public class DcEventController extends BaseController
@ApiOperation("获取事件以及子类详细信息")
//@PreAuthorize("@ss.hasPermi('system:event:query')")
@GetMapping( "/eventSubclass/{eventType}/{id}")
@ApiImplicitParams({
@ApiImplicitParam(name = "eventType", value = "事件类型", dataType = "int"),
@ApiImplicitParam(name = "id", value = "事件id", dataType = "String"),
})
@GetMapping( "/eventSubclass/{id}")
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "事件id", dataType = "String"))
public AjaxResult getEventById(@PathVariable int eventType,@PathVariable("id") String id)
public AjaxResult getEventById(@PathVariable("id") String id)
{
DcEvent dcEvent = dcEventService.selectEventSubclassById(eventType,id);
DcEvent dcEvent = dcEventService.selectEventSubclassById(id);
return AjaxResult.success(dcEvent);
}

2
zc-business/src/main/java/com/zc/business/service/IDcEventService.java

@ -90,7 +90,7 @@ public interface IDcEventService
* @param id
* @return
*/
DcEvent selectEventSubclassById(int eventType, String id);
DcEvent selectEventSubclassById(String id);
Map<String,Object> selectCount();

7
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -682,7 +682,7 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
//事件来源校验*/
DcEvent oldEvent = selectEventSubclassById(dcEvent.getEventType().intValue(), dcEvent.getId());
DcEvent oldEvent = selectEventSubclassById(dcEvent.getId());
dcEvent.setUpdateTime(DateUtils.getNowDate());
int i7 = dcEventMapper.updateDcEvent(dcEvent);
if (i7 > 0) {
@ -850,14 +850,15 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
/**
* 获取事件以及子类详细信息
*
* @param eventType
* @param
* @param id
* @return
*/
@Override
public DcEvent selectEventSubclassById(int eventType, String id) {
public DcEvent selectEventSubclassById(String id) {
//
DcEvent dcEvent = dcEventMapper.selectDcEventById(id);
int eventType = Math.toIntExact(dcEvent.getEventType());
List<DcProcessConfig> processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(Math.toIntExact(dcEvent.getEventType()));
dcEvent.setProcessConfigList(processConfigList);
switch (eventType) {

29
zc-business/src/main/resources/mapper/business/DcMeteorologicalDetectorDataMapper.xml

@ -175,34 +175,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
date;
</select>
<select id="selectStatisticsTime" resultMap="countMap" resultType="map">
SELECT
h.time_slot,
DATE(dc.create_time) AS date,
COALESCE(ROUND(AVG(dc.temperature), 2), 0) AS avg_temperature,
COALESCE(ROUND(AVG(dc.visibility), 2), 0) AS avg_visibility
FROM
(
SELECT 0 AS time_slot UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4
UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9
UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12 UNION ALL SELECT 13
UNION ALL SELECT 14 UNION ALL SELECT 15 UNION ALL SELECT 16 UNION ALL SELECT 17
UNION ALL SELECT 18 UNION ALL SELECT 19 UNION ALL SELECT 20 UNION ALL SELECT 21
UNION ALL SELECT 22 UNION ALL SELECT 23
) AS h
LEFT JOIN
dc_meteorological_detector_data dc
ON
SELECT dc.visibility,dc.temperature,dc.create_time
FROM dc_meteorological_detector_data dc
<where>
<if test="specificDate != null and specificDate !=''">
DATE(dc.create_time) = #{specificDate}
</if>
<if test="specificDate == null or specificDate=='' ">
DATE(dc.create_time) = CURDATE()
</if>
AND HOUR(dc.create_time) = h.time_slot
AND dc.device_name = #{deviceName}
GROUP BY
h.time_slot,
date;
</where>
ORDER BY
dc.create_time ASC
</select>

Loading…
Cancel
Save