...
This commit is contained in:
parent
6b98b44d48
commit
4aee184562
|
@ -1,8 +1,5 @@
|
|||
package io.renren.modules.monitor.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.renren.modules.monitor.dto.*;
|
||||
import io.renren.modules.monitor.entity.*;
|
||||
import io.renren.modules.monitor.mapper.*;
|
||||
|
@ -19,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -604,6 +600,20 @@ public class Controller {
|
|||
queryMap.replace("pageNum", (pageNum - 1) * pageSize);
|
||||
queryMap.replace("pageSize", pageSize);
|
||||
}
|
||||
if (StringUtils.isNotBlank(queryMap.get("gpsY").toString())) {
|
||||
String gpsY = queryMap.get("gpsY").toString();
|
||||
String gpsX = queryMap.get("gpsX").toString();
|
||||
if (gpsY.length() > 15) {
|
||||
gpsY = gpsY.substring(0, gpsY.length() - 1);
|
||||
}
|
||||
if (gpsX.length() > 15) {
|
||||
gpsX = gpsX.substring(0, gpsX.length() - 1);
|
||||
}
|
||||
double[] gps84 = CGS2000ToWGS84(Double.parseDouble(gpsY), Double.parseDouble(gpsX));
|
||||
queryMap.replace("gpsY", String.valueOf(gps84[0]));
|
||||
queryMap.replace("gpsX", String.valueOf(gps84[1]));
|
||||
|
||||
}
|
||||
List<String> list1 = null;
|
||||
if (null != labelCodes && labelCodes.length > 0) {
|
||||
list1 = Arrays.asList(labelCodes);
|
||||
|
@ -622,6 +632,46 @@ public class Controller {
|
|||
|
||||
}
|
||||
|
||||
//2000转84
|
||||
public static double[] CGS2000ToWGS84(double X, double Y) {
|
||||
double L0 = 120.19;//中央子午线需根据实际情况设置
|
||||
double lat ,lon;
|
||||
Y-=500000;
|
||||
double [] result = new double[2];
|
||||
double iPI = 0.0174532925199433;//pi/180
|
||||
double a = 6378137.0; //长半轴 m
|
||||
double b = 6356752.31414; //短半轴 m
|
||||
double f = 1/298.257222101;//扁率 a-b/a
|
||||
double e = 0.0818191910428; //第一偏心率 Math.sqrt(5)
|
||||
double ee = Math.sqrt(a*a-b*b)/b; //第二偏心率
|
||||
double bf = 0; //底点纬度
|
||||
double a0 = 1+(3*e*e/4) + (45*e*e*e*e/64) + (175*e*e*e*e*e*e/256) + (11025*e*e*e*e*e*e*e*e/16384) + (43659*e*e*e*e*e*e*e*e*e*e/65536);
|
||||
double b0 = X/(a*(1-e*e)*a0);
|
||||
double c1 = 3*e*e/8 +3*e*e*e*e/16 + 213*e*e*e*e*e*e/2048 + 255*e*e*e*e*e*e*e*e/4096;
|
||||
double c2 = 21*e*e*e*e/256 + 21*e*e*e*e*e*e/256 + 533*e*e*e*e*e*e*e*e/8192;
|
||||
double c3 = 151*e*e*e*e*e*e*e*e/6144 + 151*e*e*e*e*e*e*e*e/4096;
|
||||
double c4 = 1097*e*e*e*e*e*e*e*e/131072;
|
||||
bf = b0 + c1*Math.sin(2*b0) + c2*Math.sin(4*b0) +c3*Math.sin(6*b0) + c4*Math.sin(8*b0); // bf =b0+c1*sin2b0 + c2*sin4b0 + c3*sin6b0 +c4*sin8b0 +...
|
||||
double tf = Math.tan(bf);
|
||||
double n2 = ee*ee*Math.cos(bf)*Math.cos(bf); //第二偏心率平方成bf余弦平方
|
||||
double c = a*a/b;
|
||||
double v=Math.sqrt(1+ ee*ee*Math.cos(bf)*Math.cos(bf));
|
||||
double mf = c/(v*v*v); //子午圈半径
|
||||
double nf = c/v;//卯酉圈半径
|
||||
|
||||
//纬度计算
|
||||
lat=bf-(tf/(2*mf)*Y)*(Y/nf) * (1-1/12*(5+3*tf*tf+n2-9*n2*tf*tf)*(Y*Y/(nf*nf))+1/360*(61+90*tf*tf+45*tf*tf*tf*tf)*(Y*Y*Y*Y/(nf*nf*nf*nf)));
|
||||
//经度偏差
|
||||
lon=1/(nf*Math.cos(bf))*Y -(1/(6*nf*nf*nf*Math.cos(bf)))*(1+2*tf*tf +n2)*Y*Y*Y + (1/(120*nf*nf*nf*nf*nf*Math.cos(bf)))*(5+28*tf*tf+24*tf*tf*tf*tf)*Y*Y*Y*Y*Y;
|
||||
result[0] =formatby6(lat/iPI);
|
||||
result[1] =formatby6(L0+lon/iPI);
|
||||
return result;
|
||||
}
|
||||
|
||||
private static double formatby6(double num) {
|
||||
return Double.parseDouble(String.format("%.6f", num));
|
||||
}
|
||||
|
||||
/**
|
||||
* 摄像头按照市区进行聚合查询
|
||||
*/
|
||||
|
@ -636,7 +686,7 @@ public class Controller {
|
|||
* 事件版的保存区域组织信息
|
||||
*/
|
||||
@GetMapping("/saveOrgenizationEvent")
|
||||
public Result saveOrgenizationEvent() throws Exception{
|
||||
public Result saveOrgenizationEvent() {
|
||||
monitorService.getAndSaveOrgenization();
|
||||
return Result.success();
|
||||
}
|
||||
|
|
|
@ -728,14 +728,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
});
|
||||
} while (page.getRecords().size() < 9);
|
||||
//for (int i = 0; page.getRecords().size() < 9; i++) {
|
||||
// for (int j = 0; j < page.getRecords().size(); j++) {
|
||||
// if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) {
|
||||
// page.getRecords().add(resultPage.getRecords().get(i));
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return page;
|
||||
} else {
|
||||
|
@ -959,16 +951,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<Map> typeList = new ArrayList<>();
|
||||
final Long[] maxTypeCount = {0L};
|
||||
final String[] maxTypeString = new String[1];
|
||||
typeListOld.forEach(map -> {
|
||||
typeList.add(new HashMap() {{
|
||||
put("type", map.get("type"));
|
||||
put("total", map.get("count"));
|
||||
if (Long.parseLong(map.get("count").toString()) > maxTypeCount[0]) {
|
||||
maxTypeCount[0] = Long.parseLong(map.get("count").toString());
|
||||
maxTypeString[0] = map.get("type").toString();
|
||||
}
|
||||
}});
|
||||
});
|
||||
typeListOld.forEach(map -> typeList.add(new HashMap() {{
|
||||
put("type", map.get("type"));
|
||||
put("total", map.get("count"));
|
||||
if (Long.parseLong(map.get("count").toString()) > maxTypeCount[0]) {
|
||||
maxTypeCount[0] = Long.parseLong(map.get("count").toString());
|
||||
maxTypeString[0] = map.get("type").toString();
|
||||
}
|
||||
}}));
|
||||
resultMap.put("typeList", typeList);
|
||||
HashMap<String, Object> maxdeptMap = new HashMap<>();
|
||||
if (maxTypeCount[0] > 0) {
|
||||
|
@ -976,12 +966,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if ("基础设施".equals(maxTypeString[0])) {
|
||||
List<Map> resourceList = new ArrayList<>();
|
||||
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
|
||||
infrastructureList.forEach((k, v) -> {
|
||||
resourceList.add(new HashMap() {{
|
||||
put("id", k + v + "项");
|
||||
put("name", k + v + "项");
|
||||
}});
|
||||
});
|
||||
infrastructureList.forEach((k, v) -> resourceList.add(new HashMap() {{
|
||||
put("id", k + v + "项");
|
||||
put("name", k + v + "项");
|
||||
}}));
|
||||
maxdeptMap.put("resourceList", resourceList);
|
||||
} else if ("数据资源".equals(maxTypeString[0])) {
|
||||
GetDataResourceListDto dto = new GetDataResourceListDto();
|
||||
|
@ -1058,7 +1046,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
|
||||
ArrayList cameraList = new ArrayList();
|
||||
applicationEntities.forEach(index -> {
|
||||
//List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index.getCameraList().replaceAll("\"", ""));
|
||||
CameraChannelDto1 channelDto1s = JSON.toJavaObject(JSON.parseObject(index.getCameraList()), CameraChannelDto1.class);
|
||||
if (ObjectUtils.allNotNull(channelDto1s)) {
|
||||
cameraList.add(channelDto1s);
|
||||
|
@ -1072,12 +1059,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if ("基础设施".equals(type)) {
|
||||
List<Map> resourceList = new ArrayList<>();
|
||||
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
|
||||
infrastructureList.forEach((k, v) -> {
|
||||
resourceList.add(new HashMap() {{
|
||||
put("id", k + v + "项");
|
||||
put("name", k + v + "项");
|
||||
}});
|
||||
});
|
||||
infrastructureList.forEach((k, v) -> resourceList.add(new HashMap() {{
|
||||
put("id", k + v + "项");
|
||||
put("name", k + v + "项");
|
||||
}}));
|
||||
return resourceList;
|
||||
} else if ("数据资源".equals(type)) {
|
||||
GetDataResourceListDto dto = new GetDataResourceListDto();
|
||||
|
@ -1173,7 +1158,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
Request gatewayRequest = new Request.Builder().url(gateway).post(signFormBody.build()).build();
|
||||
Response gatewayResponse = client.newCall(gatewayRequest).execute();
|
||||
String gatewayResult = gatewayResponse.body().string();
|
||||
logger.info("{}分页数据:" + gatewayResult, page);
|
||||
logger.info("{}分页数据:{}", page, gatewayResult);
|
||||
JSONObject gatewayJsonObject = JSON.parseObject(gatewayResult);
|
||||
JSONObject gatewayData = JSON.parseObject(gatewayJsonObject.get("data").toString());
|
||||
JSONArray infos = gatewayData.getJSONObject("data").getJSONArray("infos");
|
||||
|
@ -1195,7 +1180,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
}, executor).thenAcceptAsync(list -> {
|
||||
logger.info("知识库数据量:{}", list.size());
|
||||
if (list.size() < 1) {
|
||||
if (list.isEmpty()) {
|
||||
end.set(false);
|
||||
}
|
||||
list.parallelStream().filter(resource -> {
|
||||
|
@ -1278,16 +1263,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
public PageData<Map<String, Object>> resourceBusinessDetails(Map<String, Object> params) {
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
|
||||
List<Map> deptList = new ArrayList<>();//保存部门 发布总数 访问量
|
||||
// params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()));
|
||||
// params.put("pageSize", params.get("limit"));
|
||||
|
||||
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
|
||||
Integer pageSize = Integer.parseInt(params.get("limit").toString());
|
||||
|
||||
Object[] pas = {params.get("id"), params.get("id")};
|
||||
|
||||
List<Map<String, Object>> result2 = new ArrayList<>();
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" +
|
||||
"SUM(a.visits) AS resourceVisits \n" +
|
||||
|
@ -1305,7 +1286,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
if (result2.size() > 0) {
|
||||
if (!result2.isEmpty()) {
|
||||
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
|
||||
result.addAll(partition.get(page));
|
||||
} else {
|
||||
|
@ -1368,18 +1349,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02, voidCompletableFuture03, voidCompletableFuture04, voidCompletableFuture05);
|
||||
all.join();
|
||||
|
||||
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size());
|
||||
return pageData;
|
||||
return new PageData<>(result, result2.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageData<Map<String, Object>> resourceApplicationDetails(Map<String, Object> params) {
|
||||
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
|
||||
List<Map<String, Object>> result;
|
||||
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
|
||||
Integer pageSize = Integer.parseInt(params.get("limit").toString());
|
||||
Object[] pas = {params.get("id"), params.get("id")};
|
||||
|
||||
List<Map<String, Object>> result2 = new ArrayList<>();
|
||||
List<Map<String, Object>> result2;
|
||||
if (Long.parseLong(params.get("id").toString()) == 0) {
|
||||
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
|
||||
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
|
||||
|
@ -1395,16 +1375,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
"ORDER BY a.dept_id,b.name\n", pas);
|
||||
}
|
||||
|
||||
if (result2.size() > 0) {
|
||||
if (!result2.isEmpty()) {
|
||||
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
|
||||
result.addAll(partition.get(page));
|
||||
result = new CopyOnWriteArrayList<>(partition.get(page));
|
||||
} else {
|
||||
return new PageData<>(result2, result2.size());
|
||||
return new PageData<>(result2, 0);
|
||||
}
|
||||
|
||||
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> { //应用浏览数量
|
||||
result.forEach(r -> {
|
||||
Object[] qu = {r.get("deptId")};
|
||||
Integer integer = baseDao.selectResourceBrowseNum(params);
|
||||
r.put("resourceBrowseNum", integer);
|
||||
});
|
||||
|
@ -1412,7 +1391,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { //应用收藏量
|
||||
result.forEach(r -> {
|
||||
Object[] qu = {r.get("deptId")};
|
||||
Integer integer = baseDao.selectResourceCollectionNum(params);
|
||||
r.put("resourceCollectionNum", integer);
|
||||
});
|
||||
|
@ -1421,8 +1399,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
|
||||
all.join();
|
||||
|
||||
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size());
|
||||
return pageData;
|
||||
return new PageData<>(result, result2.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1430,8 +1407,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
List<Map<String, Object>> result;
|
||||
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
|
||||
Integer pageSize = Integer.parseInt(params.get("limit").toString());
|
||||
Object[] pas = {params.get("id"), params.get("id")};
|
||||
|
||||
List<Map<String, Object>> result2;
|
||||
result2 = resourceDao.resourceInstallationOrDataResourceDetails(params);
|
||||
|
||||
|
@ -1985,7 +1960,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
if (map.get(attr.getAttrValue()) != null) {
|
||||
map.get(attr.getAttrValue()).add(it);
|
||||
} else {
|
||||
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
|
||||
map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
|
||||
add(it);
|
||||
}}));
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
|
|||
@Override
|
||||
protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
|
||||
String sessionId = WebUtils.toHttp(request).getHeader(HEADER_TOKEN_NAME);
|
||||
log.error("获取的sessionId为------>{}", sessionId);
|
||||
if (StringUtils.isEmpty(sessionId)) {
|
||||
return super.getSessionId(request, response);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue