4 files added
5 files modified
| | |
| | | @Resource |
| | | private DeviceRoadService deviceRoadService; |
| | | |
| | | |
| | | @Resource |
| | | private ScreenVersionService screenVersionService; |
| | | /** |
| | | * Screen login. 大屏登录 |
| | | * |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @GetMapping("report_alarm_datas") |
| | | public ResultBean<List<Map<String, Object>>> getAlarmData(HttpServletRequest request) throws Exception { |
| | | Map<String, Object> parameters = getParametersStartingWith(request, null); |
| | |
| | | |
| | | List<Map<String, Object>> monitorList = historyMinutelyService.getMonitorPointOrDeviceAvgData(parameters); |
| | | List<Map<String, Object>> areaList = hangzhouAqiService.getAreaAvgDataByAreaCode(parameters); |
| | | |
| | | if (areaList.isEmpty() && monitorList.isEmpty()) { |
| | | return new ResultBean<List<Map<String, Object>>>(resultList); |
| | | } else if (areaList.isEmpty()) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/windAndDeviceData") |
| | | @ResponseBody |
| | | public List windAndDeviceData(String monitorPointId) { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/contrastFactor") |
| | | @ApiOperation(value = "因子对比", notes = "因子对比") |
| | | @ApiImplicitParams(value = { |
| | |
| | | return alarmData; |
| | | } |
| | | |
| | | /* @GetMapping("/lianxian") |
| | | @ApiOperation(value = "连线", notes = "连线" ) |
| | | @GetMapping("multiDeviceSensor") |
| | | @ApiOperation(value = "多设备因子对比", notes = "多设备因子对比") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "lonAndLat", value = "经纬度", required = true, paramType = "query", dataType = "String")}) |
| | | public ModelAndView lianxian(HttpServletRequest request,ModelAndView model) throws Exception { |
| | | @ApiImplicitParam(name = "monitorPoint", value = "监控站id", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "macs", value = "设备mac,如有多个用逗号分隔", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "sensorKey", value = "传感器key", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time", value = "时间,日期(格式:2018-03-12)", required = true, paramType = "query", dataType = "String"),}) |
| | | public ResultBean<List<Map<String, Object>>> multiDeviceSensor(HttpServletRequest request) throws Exception { |
| | | Map<String, Object> parameters = getParametersStartingWith(request, null); |
| | | String mac= (String) parameters.get("lonAndLat"); |
| | | String[] ll= mac.split(","); |
| | | ParameterUtils.getTimeType4Time(parameters); |
| | | List<Map<String, Object>> multiDeviceSensorData = historyMinutelyService.getMultiDeviceSensorData(parameters); |
| | | return new ResultBean<List<Map<String, Object>>>(multiDeviceSensorData); |
| | | } |
| | | |
| | | JSONObject params = new JSONObject(); |
| | | params.put("ll",ll); |
| | | Double[] array= {116.885217,38.299148}; |
| | | Double[] array1= {116.87061,38.322828}; |
| | | Double[] array2= {116.855206,38.325162}; |
| | | Double distance1=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.885217,38.299148); |
| | | Double distance2=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.87061,38.322828); |
| | | Double distance3=mapUtils.getDistance(Double.parseDouble(ll[0]),Double.parseDouble(ll[1]),116.855206,38.325162); |
| | | |
| | | params.put("mt",distance1); |
| | | params.put("mt1",distance2); |
| | | params.put("mt2",distance3); |
| | | model.addObject("params", params); |
| | | model.setViewName("lianxian"); |
| | | return model; |
| | | }*/ |
| | | @GetMapping("screenVersion") |
| | | public Map<String, Object> getScreenVersion(HttpServletRequest request) { |
| | | Map<String, Object> parameters = getParametersStartingWith(request, null); |
| | | String version = parameters.get("version").toString(); |
| | | return screenVersionService.getScreenVersion(version); |
| | | } |
| | | } |
| | |
| | | |
| | | Map<String,Object> get5MiutesOrHalfHourByDay(Map<String, Object> parameters); |
| | | |
| | | List<Map<String, Object>> getMultiDeviceSensorData(Map<String, Object> parameters); |
| | | } |
New file |
| | |
| | | package com.moral.mapper; |
| | | |
| | | import java.util.Map; |
| | | |
| | | import com.moral.common.mapper.BaseMapper; |
| | | import com.moral.entity.Area; |
| | | |
| | | public interface ScreenVersionMapper extends BaseMapper<Area> { |
| | | |
| | | Map<String,Object> getScreenVersion(String version); |
| | | |
| | | } |
| | |
| | | |
| | | List<Map<String, Object>> getMonitorPointOrDeviceAvgData(Map<String, Object> parameters) throws Exception; |
| | | |
| | | List<Map<String, Object>> get(Map<String, Object> parameters) throws Exception; |
| | | |
| | | |
| | | Map<String, Object> getMonthAverageBySensor(Map<String, Object> parameters); |
| | | |
| | | Map<String, Object> getAverageBySensor(Map<String, Object> parameters); |
| | |
| | | |
| | | List<Map<String,Object>> get5MinutesOrHalfHour(Map<String, Object> parameters) throws ParseException; |
| | | |
| | | List<Map<String, Object>> getMultiDeviceSensorData(Map<String, Object> parameters) throws Exception; |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | public interface ScreenVersionService { |
| | | |
| | | Map<String, Object> getScreenVersion(String version); |
| | | |
| | | } |
New file |
| | |
| | | package com.moral.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.moral.mapper.ScreenVersionMapper; |
| | | import com.moral.service.ScreenVersionService; |
| | | |
| | | @Service |
| | | public class ScreenVersionImpl implements ScreenVersionService { |
| | | |
| | | @Resource |
| | | private ScreenVersionMapper screenVersionMapper; |
| | | |
| | | @Override |
| | | public Map<String, Object> getScreenVersion(String version) { |
| | | Map<String, Object> data = screenVersionMapper.getScreenVersion(version); |
| | | Map<String, Object> map = (Map<String, Object>) JSON.parse(data.get("content").toString()); |
| | | Map<String, Object> resultMap = new HashMap<>(); |
| | | List<String> values = new ArrayList<>(); |
| | | for (String key : map.keySet()) { |
| | | values.add(map.get(key).toString()); |
| | | } |
| | | resultMap.put("data", values); |
| | | return resultMap; |
| | | } |
| | | } |
| | |
| | |
|
| | | if (rhour == nowHour) {
|
| | | Map<String, Object> sumO3Map = hangzhouAqiMapper.getSumO3(hashMap);
|
| | | if (sumO3Map != null) {
|
| | | double v = value - Double.valueOf(sumO3Map.get("O3Sum").toString());
|
| | | resultMap.put("goodValue", v);
|
| | | }
|
| | | } else if (rhour == nowHour + 1) {
|
| | | Map<String, Object> sumO3Map = hangzhouAqiMapper.getSumO3(hashMap);
|
| | | if (sumO3Map != null) {
|
| | | double v = (value - Double.valueOf(sumO3Map.get("O3Sum").toString())) / 2;
|
| | | resultMap.put("goodValue", String.valueOf(Math.round(v)));
|
| | | }
|
| | | } else if (rhour == nowHour + 2) {
|
| | | Map<String, Object> sumO3Map = hangzhouAqiMapper.getSumO3(hashMap);
|
| | | if (sumO3Map != null) {
|
| | | double v = (value - Double.valueOf(sumO3Map.get("O3Sum").toString())) / 3;
|
| | | resultMap.put("goodValue", String.valueOf(Math.round(v)));
|
| | | }
|
| | | } else if (rhour == nowHour + 3) {
|
| | | Map<String, Object> sumO3Map = hangzhouAqiMapper.getSumO3(hashMap);
|
| | | if (sumO3Map != null) {
|
| | | double v = (value - Double.valueOf(sumO3Map.get("O3Sum").toString())) / 4;
|
| | | resultMap.put("goodValue", String.valueOf(Math.round(v)));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //地理特征
|
| | | Map<String, Object> geographyMap = shAreaMapper.getGeography(name);
|
| | |
| | | and h.time <![CDATA[<]]> #{end} |
| | | ORDER BY |
| | | h.time |
| | | </select> |
| | | |
| | | <select id="getMultiDeviceSensorData" resultType="java.util.Map"> |
| | | SELECT |
| | | DATE_FORMAT(time, #{typeFormat}) time, |
| | | <foreach collection="macs" separator="," item="mac" index="index"> |
| | | AVG(json->'$.${sensorKey}[0]') AS '${index}${sensorKey}' |
| | | </foreach> |
| | | FROM |
| | | history_${timeUnits} |
| | | WHERE |
| | | <foreach collection="macs" separator="," item="mac" index="index"> |
| | | mac = #{mac} |
| | | </foreach> |
| | | AND time >= #{start} |
| | | AND h.time <![CDATA[<]]> #{end} |
| | | GROUP BY |
| | | DATE_FORMAT(time, #{typeFormat}) |
| | | ORDER BY |
| | | time |
| | | </select> |
| | | |
| | | <select id="getMultiDeviceSensorData1" resultType="java.util.Map"> |
| | | SELECT * |
| | | from |
| | | <foreach collection="macs" separator="," item="mac" index="index"> |
| | | (SELECT |
| | | AVG(json->'$.${sensorKey}[0]') AS '${index}${sensorKey}', |
| | | DATE_FORMAT(time,'%Y-%m') as time |
| | | FROM history_${timeUnits} |
| | | WHERE mac=#{mac} |
| | | AND time >= #{start} |
| | | AND time <![CDATA[<]]> #{end} |
| | | GROUP BY DATE_FORMAT(time,#{typeFormat}) |
| | | ORDER BY |
| | | time) as t${index} |
| | | </foreach> |
| | | WHERE t1.time=t2.time |
| | | </select> |
| | | </mapper> |
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="com.moral.mapper.ScreenVersionMapper" > |
| | | <select id="getScreenVersion" resultType="java.util.Map"> |
| | | select content from screen_version |
| | | where version = #{version} |
| | | </select> |
| | | </mapper> |