From 87e9795eaed15db4b124e9a0cc9341babd721494 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Wed, 03 Apr 2024 11:23:10 +0800
Subject: [PATCH] fix:路径规划补充提交
---
screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java | 189 +++++++++++++++++++++++++++++++++++------------
1 files changed, 140 insertions(+), 49 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java
index 280c7fd..12b96f5 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/DataDisplayServiceImpl.java
@@ -1,9 +1,7 @@
package com.moral.api.service.impl;
import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.jhlabs.composite.AverageComposite;
import com.moral.api.entity.*;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HistoryMonthlyMapper;
@@ -23,7 +21,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
-import reactor.core.publisher.Flux;
import java.util.*;
import java.util.stream.Collectors;
@@ -407,26 +404,10 @@
map.put("start",startTime);
map.put("type","$."+ type);
- //������������������
- Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
- Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
- Integer organizationId = (Integer) orgInfo.get("id");
- //���������
ArrayList<Integer> list = new ArrayList<>();
- if (organizationId==24){
- LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
- wrapper.eq(Organization::getIsDelete,Constants.NOT_DELETE);
- wrapper.eq(Organization::getCityCode,code);
- List<Organization> organizations = organizationMapper.selectList(wrapper);
- List<Integer> collect = organizations.stream().map(organization -> organization.getId()).collect(Collectors.toList());
- list.addAll(collect);
- }else {
- list.add(organizationId);
- }
// ArrayList<Map<String, Object>> rsHeatMap = new ArrayList<>();
ArrayList<HeatMapDTO> rsHeatMap = new ArrayList<>();
-
if (form.equals("hour")){ //������
Date date1 = DateUtils.getDate(startTime, DateUtils.yyyy_MM_dd_HH_EN);
List<String> tableNames = MybatisPLUSUtils.getTableNamesByWrapper(date1, date1, SeparateTableType.MONTH);
@@ -455,46 +436,53 @@
HashMap<String, Object> map = new HashMap<>();
map.put("start",startTime);
map.put("type","$."+ type);
- //������������������
-// Map<String, Object> userInfo = (Map<String, Object>) TokenUtils.getUserInfo();
-// Map<String, Object> orgInfo = (Map<String, Object>) userInfo.get("organization");
-// Integer organizationId = (Integer) orgInfo.get("id");
- //���������
ArrayList<Integer> list = new ArrayList<>();
list.add(id);
-// if (organizationId==24){
-//// LambdaQueryWrapper<Organization> wrapper = new LambdaQueryWrapper<>();
-//// wrapper.eq(Organization::getIsDelete,Constants.NOT_DELETE);
-//// wrapper.eq(Organization::getId,id);
-//// List<Organization> organizations = organizationMapper.selectList(wrapper);
-//// List<Integer> collect = organizations.stream().map(organization -> organization.getId()).collect(Collectors.toList());
-//// list.addAll(collect);
-// list.add(id);
-// }else {
-// list.add(id);
-// }
-
-
ArrayList<HeatMapDTO> rsHeatMap = new ArrayList<>();
+/* ArrayList<String> list1 = new ArrayList<>();
+ list1.add("���������������");
+ list1.add("���������������");
+ list1.add("���������������");
+ list1.add("���������������");
+ list1.add("������������������");*/
if (form.equals("hour")){ //������
- log.info(""+startTime);
+// String[] split = startTime.split("-");
+// String s = "_" + split[0] + split[1];
String dateString = DateUtils.stringToDateString(startTime, DateUtils.yyyy_MM_dd_HH_EN, DateUtils.yyyyMM_EN);
-// Date date1 = DateUtils.getDate(startTime, DateUtils.yyyy_MM_dd_HH_EN);
- log.info(""+dateString);
map.put("organizationIds",list);
map.put("tableName","_"+dateString);
List<HeatMapDTO> heatMap = deviceMapper.getHeatMapV1(map);
- log.info(heatMap.size()+"");
-
+ //������������
List<HeatMapDTO> collect1 = heatMap.stream().filter(d -> d.getTime() != null).collect(Collectors.toList());
if (ObjectUtils.isEmpty(collect1)){
return null;
}
- getHeatMap(heatMap);
- rsHeatMap.addAll(heatMap);
+ for (HeatMapDTO heatMapDTO : heatMap) {
+// if (list1.contains(heatMapDTO.getName())){
+ if (type.equals("a34002") || type.equals("a21026")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?49.0:heatMapDTO.getCount());
+ }else if (type.equals("a34004")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?20.0:heatMapDTO.getCount());
+ }else if (type.equals("a21004")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?20.0:heatMapDTO.getCount());
+ }else if (type.equals("a21005")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?1.0:heatMapDTO.getCount());
+ }else if (type.equals("a05024")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?138.0:heatMapDTO.getCount());
+ }else {
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?0.2:heatMapDTO.getCount());
+ }
+// }else {
+// if (ObjectUtils.isEmpty(heatMapDTO.getCount())){
+// heatMapDTO.setCount(0.0);
+// }
+// }
+ }
+ getHeatMap(heatMap,type);
+ rsHeatMap.addAll(heatMap);
}else { //���
map.put("organizationIds",list);
List<HeatMapDTO> heatMap = deviceMapper.getHeatMapV1(map);
@@ -502,15 +490,107 @@
if (ObjectUtils.isEmpty(collect1)){
return null;
}
- getHeatMap(heatMap);
+ for (HeatMapDTO heatMapDTO : heatMap) {
+ if (type.equals("a34002") || type.equals("a21026")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?49.0:heatMapDTO.getCount());
+ }else if (type.equals("a34004")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?34.0:heatMapDTO.getCount());
+ }else if (type.equals("a21004")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?39.0:heatMapDTO.getCount());
+ }else if (type.equals("a21005")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?1.9:heatMapDTO.getCount());
+ }else if (type.equals("a05024")){
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?100.0:heatMapDTO.getCount());
+ }else {
+ heatMapDTO.setCount(ObjectUtils.isEmpty(heatMapDTO.getCount())?0.4:heatMapDTO.getCount());
+ }
+ }
+ getHeatMap(heatMap,type);
rsHeatMap.addAll(heatMap);
}
-
+ if (id==71){
+ for (int i = 0; i <6; i++) {
+ HeatMapDTO heatMapDTO = new HeatMapDTO();
+ heatMapDTO.setCount(0.0);
+ if (i==0){
+ heatMapDTO.setLat(40.590436);
+ heatMapDTO.setLng(122.861935);
+ heatMapDTO.setMac("1111");
+ heatMapDTO.setName("1111");
+ }else if (i==1){
+ heatMapDTO.setLat(40.636617);
+ heatMapDTO.setLng(123.101544);
+ heatMapDTO.setMac("2222");
+ heatMapDTO.setName("2222");
+ }else if (i==2){
+ heatMapDTO.setLat(40.890881);
+ heatMapDTO.setLng(122.910687);
+ heatMapDTO.setMac("3333");
+ heatMapDTO.setName("3333");
+ }else if (i==3){
+ heatMapDTO.setLat(40.682129);
+ heatMapDTO.setLng(123.105836);
+ heatMapDTO.setMac("4444");
+ heatMapDTO.setName("4444");
+ }else if (i==4){
+ heatMapDTO.setLat(40.890037);
+ heatMapDTO.setLng(123.021151);
+ heatMapDTO.setMac("5555");
+ heatMapDTO.setName("5555");
+ }else {
+ heatMapDTO.setLat(41.051333);
+ heatMapDTO.setLng(122.505864);
+ heatMapDTO.setMac("6666");
+ heatMapDTO.setName("6666");
+ }
+ rsHeatMap.add(heatMapDTO);
+ }
+ }
+ if (id==73){
+ //���������
+ double lat =33.414538;
+ double lng =120.066616;
+ for (int i = 0; i <11 ; i++) {
+ for (int j = 0; j < 20; j++) {
+ HeatMapDTO heatMapDTO = new HeatMapDTO();
+ heatMapDTO.setCount(0.0);
+ heatMapDTO.setLat(lat);
+ heatMapDTO.setLng(lng);
+ heatMapDTO.setName("1");
+ heatMapDTO.setMac(i+"1"+j);
+ rsHeatMap.add(heatMapDTO);
+ lng=lng+0.01;
+ if (j==19){
+ lng=120.066616;
+ }
+ }
+ lat =lat-0.01;
+ }
+ //���������
+ double lat1 =33.214555;
+ double lng1 =120.416805;
+ for (int i = 0; i < 11 ; i++) {
+ for (int j = 0; j < 10; j++) {
+ HeatMapDTO heatMapDTO = new HeatMapDTO();
+ heatMapDTO.setCount(0.0);
+ heatMapDTO.setLat(lat1);
+ heatMapDTO.setLng(lng1);
+ heatMapDTO.setName("2");
+ heatMapDTO.setMac(i+"2"+j);
+ rsHeatMap.add(heatMapDTO);
+ lng1=lng1+0.004;
+ if (j==9){
+ lng1=120.416805;
+ }
+ }
+ lat1 =lat1-0.0022;
+ }
+ }
return distrinList(rsHeatMap);
}
//������������
- private void getHeatMap(List<HeatMapDTO> heatMap) {
+ private void getHeatMap(List<HeatMapDTO> heatMap,String type) {
//������������
List<HeatMapDTO> collect1 = heatMap.stream().filter(d -> d.getGroupId() != null).collect(Collectors.toList());
if (ObjectUtils.isEmpty(collect1)){
@@ -528,7 +608,12 @@
GeoCoordinate geoCoordinate = new GeoCoordinate();
doubleArrayList.add(heatMapDTO.getCount());
// heatMapDTO.setCount(heatMapDTO.getCount());
- heatMapDTO.setCount(0.0);
+ if (type.equals("a21026")){
+ heatMapDTO.setCount(1.0);
+ }else {
+ heatMapDTO.setCount(0.0);
+ }
+
geoCoordinate.setLongitude(heatMapDTO.getLng());
geoCoordinate.setLatitude(heatMapDTO.getLat());
geoCoordinates.add(geoCoordinate);
@@ -539,10 +624,16 @@
double asDouble = doubleArrayList.stream().mapToDouble(Double::valueOf).max().getAsDouble();
//���������������
GeoCoordinate centerPoint = GetCenterPointFromListOfCoordinates.getCenterPoint(geoCoordinates);
- heatMapDTO.setCount(asDouble);
+// double rsCode = asDouble - (doubleArrayList.size()*10);
+ double rsCode = asDouble - doubleArrayList.size()-1;
+// log.info(asDouble+"-----"+rsCode);
+// heatMapDTO.setCount(rsCode);
+ heatMapDTO.setCount(rsCode);
+// heatMapDTO.setSum(asDouble);
heatMapDTO.setLng(centerPoint.getLongitude());
heatMapDTO.setLat(centerPoint.getLatitude());
heatMapDTO.setMac(i+"");
+ heatMapDTO.setName(integer+"");
heatMap.add(heatMapDTO);
i++;
}
--
Gitblit v1.8.0