From 0099e6c9db0c858cb6905477830c79305dca39bb Mon Sep 17 00:00:00 2001
From: 于紫祥_1901 <email@yuzixiang_1910>
Date: Fri, 06 Nov 2020 13:42:27 +0800
Subject: [PATCH] 校准值
---
src/main/java/com/moral/controller/ScreenController.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index da6a8cc..fcf8f30 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -2,6 +2,7 @@
import java.io.*;
import java.lang.reflect.Array;
+import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
@@ -166,6 +167,9 @@
@Resource
private ScreenVersionService screenVersionService;
+
+ @Resource
+ private DeviceAdjustValueTimingService deviceAdjustValueTimingService;
/**
* Screen login. ������������
@@ -1060,7 +1064,34 @@
public ResultBean<List<MonitorPoint>> getMonitorPointsAndDevicesByRegion(HttpServletRequest request)
throws Exception {
Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+ String regionCode = parameters.get("regionCode").toString();
List<MonitorPoint> monitorPoints = monitorPointService.getMonitorPointsAndDevicesByRegion(parameters);
+
+ //������������������������������
+ if (regionCode.startsWith("1309")) {
+ List<Integer> orgIds = new ArrayList<>();
+ Collections.addAll(orgIds, 60, 65, 159, 165, 166);
+ Iterator<MonitorPoint> iter = monitorPoints.iterator();
+ while (iter.hasNext()) {
+ MonitorPoint next = iter.next();
+ Integer mpId = next.getId();
+ Integer orgId = next.getOrganizationId();
+ if (!orgIds.contains(orgId)) {
+ iter.remove();
+ } else {
+ if (orgId == 60) {
+ if (mpId != 56) {
+ iter.remove();
+ }
+ } else if (orgId == 65) {
+ if (mpId != 83 && mpId != 84) {
+ iter.remove();
+ }
+ }
+ }
+ }
+ }
+
//������������monitorPoint������������������device.getName()������������
for (MonitorPoint monitorPoint : monitorPoints) {
List<Device> deviceList = monitorPoint.getDevices();
@@ -1996,7 +2027,7 @@
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MINUTE, (calendar.get(Calendar.MINUTE) - 2));
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- String time = df.format(calendar.getTime()) + ":00";
+ //String time = df.format(calendar.getTime()) + ":00";
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
String mon;
@@ -2006,7 +2037,7 @@
mon = "" + month;
}
String table = "history_minutely_" + year + mon;
- List list = deviceService.byMonitorIdGetDeviceAndWind(monitorPointId, time, table);
+ List list = deviceService.byMonitorIdGetDeviceAndWind(monitorPointId,table);
return list;
}
@@ -2027,7 +2058,7 @@
mon = "" + month;
}
String table = "history_minutely_" + year + mon;
- List list = deviceService.byMonitorIdGetDeviceAndWindSpecial(monitorPointId, time, table);
+ List list = deviceService.byMonitorIdGetDeviceAndWindSpecial(monitorPointId,table);
return list;
}
@@ -2520,8 +2551,66 @@
@ApiImplicitParam(name = "endTime", value = "������������(���������2020-08-04)", required = false, paramType = "query", dataType = "String")})
public ResultBean<List<Map<String, Object>>> getAllDeviceDataToExcel(HttpServletRequest request) throws Exception {
Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
- ParameterUtils.getTimeType4Time(parameters);
List<Map<String, Object>> list = historyMinutelyService.getAllDeviceDataToExcel(parameters);
return new ResultBean<List<Map<String, Object>>>(list);
}
+
+ /*@PostMapping("insertAdjustValue")
+ @ApiOperation(value = "���������������������������������", notes = "���������������������������������")
+ @ApiImplicitParams(value = {
+ @ApiImplicitParam(name = "id", value = "������id", required = true, paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "time", value = "���������������08:30:00���", required = true, paramType = "query", dataType = "String"),
+ @ApiImplicitParam(name = "dataArray", value = "������", required = false, paramType = "query", dataType = "String")})
+ public void insertAdjustValue(HttpServletRequest request) throws Exception {
+ Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
+ int device_id = Integer.parseInt(parameters.get("id").toString());
+ String hour_minute_second = parameters.get("time").toString();
+ String[] arr = hour_minute_second.split(":");
+ int seconds = Integer.parseInt(arr[0])*3600+Integer.parseInt(arr[1])*60+Integer.parseInt(arr[2]);
+ String value = parameters.get("dataArray").toString();
+ deviceAdjustValueTimingService.insertData(device_id,seconds,value);;
+ }*/
+
+ @PostMapping("insertAdjustValue")
+ public int insertAdjustValue(@RequestBody HashMap map){
+ try{
+ int device_id = Integer.parseInt(map.get("id").toString());
+ String time = map.get("time").toString();
+ String[] arr = time.split(":");
+ int seconds = Integer.parseInt(arr[0])*3600+Integer.parseInt(arr[1])*60+Integer.parseInt(arr[2]);
+ //String t = URLEncoder.encode(������,"UTF-8")
+ List list = (List) map.get("dataArray");
+ String val="";
+ for (int i = 0; i <list.size() ; i++) {
+ if (i==0){
+ val=val+list.get(i);
+ }else {
+ val=val+","+list.get(i);
+ }
+ }
+ String value = "{"+val+"}";
+ deviceAdjustValueTimingService.insertData(device_id,seconds,value);
+ return 1;
+ }catch (Exception e){
+ log.warn(e);
+ }
+ return 0;
+ }
+
+ @RequestMapping("/biaozhun")
+ @ResponseBody
+ public List<Device> queryDevice(String macOrName){
+ List<Device> deviceList = new ArrayList<>();
+ if (!macOrName.equals("")){
+ deviceList= deviceService.getDevice(macOrName);
+ }
+ return deviceList;
+ }
+
+ @RequestMapping("/getSensor")
+ @ResponseBody
+ public List<Map<String, Object>> getSensor(String id){
+ List<Map<String, Object>> allSensors = sensorService.getSensorByDeviceId(id);
+ return allSensors;
+ }
}
\ No newline at end of file
--
Gitblit v1.8.0