|  |  |  | 
|---|
|  |  |  | package com.moral.controller; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static com.moral.common.util.ResourceUtil.getValue; | 
|---|
|  |  |  | import static com.moral.common.util.WebUtils.getParametersStartingWith; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.io.BufferedReader; | 
|---|
|  |  |  | import java.io.ByteArrayInputStream; | 
|---|
|  |  |  | import java.io.InputStream; | 
|---|
|  |  |  | import java.io.InputStreamReader; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.Arrays; | 
|---|
|  |  |  | import java.util.Collection; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.LinkedHashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Map; | 
|---|
|  |  |  | import java.util.Optional; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletRequest; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.apache.commons.collections.CollectionUtils; | 
|---|
|  |  |  | import org.apache.commons.net.ftp.FTPClient; | 
|---|
|  |  |  | import org.apache.log4j.Logger; | 
|---|
|  |  |  | import org.dom4j.Document; | 
|---|
|  |  |  | import org.dom4j.Element; | 
|---|
|  |  |  | import org.dom4j.io.SAXReader; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.cglib.beans.BeanMap; | 
|---|
|  |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.CrossOrigin; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMethod; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.ResponseBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.servlet.ModelAndView; | 
|---|
|  |  |  | import org.xml.sax.InputSource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.moral.common.util.ValidateUtil; | 
|---|
|  |  |  | import com.moral.common.util.WebUtils; | 
|---|
|  |  |  | import com.moral.common.xml.Version; | 
|---|
|  |  |  | import com.moral.entity.Account; | 
|---|
|  |  |  | import com.moral.entity.AreaNames; | 
|---|
|  |  |  | import com.moral.entity.Device; | 
|---|
|  |  |  | import com.moral.entity.DeviceVersion; | 
|---|
|  |  |  | import com.moral.entity.MapBounds; | 
|---|
|  |  |  | import com.moral.entity.MonitorPoint; | 
|---|
|  |  |  | import com.moral.entity.Organization; | 
|---|
|  |  |  | import com.moral.entity.Region; | 
|---|
|  |  |  | import com.moral.entity.*; | 
|---|
|  |  |  | import com.moral.entity.alarm.AlarmConfig; | 
|---|
|  |  |  | import com.moral.entity.alarm.AlarmConfigValue; | 
|---|
|  |  |  | import com.moral.entity.alarm.AlarmSensorLevel; | 
|---|
|  |  |  | import com.moral.entity.charts.DataSortCondition; | 
|---|
|  |  |  | import com.moral.entity.layout.RealTimeDeviceLayout; | 
|---|
|  |  |  | import com.moral.service.AccountService; | 
|---|
|  |  |  | import com.moral.service.AlarmConfigService; | 
|---|
|  |  |  | import com.moral.service.AlarmDailyService; | 
|---|
|  |  |  | import com.moral.service.AreaService; | 
|---|
|  |  |  | import com.moral.service.DeviceService; | 
|---|
|  |  |  | import com.moral.service.DeviceVersionService; | 
|---|
|  |  |  | import com.moral.service.DictionaryDataService; | 
|---|
|  |  |  | import com.moral.service.HangzhouAqiService; | 
|---|
|  |  |  | import com.moral.service.HistoryDailyService; | 
|---|
|  |  |  | import com.moral.service.HistoryMinutelyService; | 
|---|
|  |  |  | import com.moral.service.HistoryService; | 
|---|
|  |  |  | import com.moral.service.MachineActivateService; | 
|---|
|  |  |  | import com.moral.service.MonitorPointService; | 
|---|
|  |  |  | import com.moral.service.OrganizationLayoutService; | 
|---|
|  |  |  | import com.moral.service.OrganizationService; | 
|---|
|  |  |  | import com.moral.service.QualityDailyService; | 
|---|
|  |  |  | import com.moral.service.SensorService; | 
|---|
|  |  |  | import com.moral.service.WeatherService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.moral.service.*; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.commons.collections.CollectionUtils; | 
|---|
|  |  |  | import org.apache.commons.net.ftp.FTPClient; | 
|---|
|  |  |  | import org.apache.log4j.Logger; | 
|---|
|  |  |  | import org.dom4j.Document; | 
|---|
|  |  |  | import org.dom4j.Element; | 
|---|
|  |  |  | import org.dom4j.io.SAXReader; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.cglib.beans.BeanMap; | 
|---|
|  |  |  | import org.springframework.data.redis.core.RedisTemplate; | 
|---|
|  |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
|---|
|  |  |  | import org.springframework.util.ObjectUtils; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  | import org.springframework.web.servlet.ModelAndView; | 
|---|
|  |  |  | import org.xml.sax.InputSource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  | import javax.servlet.http.HttpServletRequest; | 
|---|
|  |  |  | import java.io.BufferedReader; | 
|---|
|  |  |  | import java.io.ByteArrayInputStream; | 
|---|
|  |  |  | import java.io.InputStream; | 
|---|
|  |  |  | import java.io.InputStreamReader; | 
|---|
|  |  |  | import java.util.*; | 
|---|
|  |  |  | import java.util.stream.Collectors; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static com.moral.common.util.ResourceUtil.getValue; | 
|---|
|  |  |  | import static com.moral.common.util.WebUtils.getParametersStartingWith; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * The Class ScreenController.大屏接口 | 
|---|
|  |  |  | 
|---|
|  |  |  | String mac = parameters.get("mac").toString(); | 
|---|
|  |  |  | String sensorKey = parameters.get("sensorKey").toString(); | 
|---|
|  |  |  | String time = parameters.get("time").toString(); | 
|---|
|  |  |  | Long code = monitorPoint.getAreaCode().longValue(); | 
|---|
|  |  |  | String regionName = areaService.queryFullNameByCode(code); | 
|---|
|  |  |  | Device device = deviceService.getDeviceByMac(mac, false); | 
|---|
|  |  |  | if (monitorPoint != null && mac != null && sensorKey != null && time != null) { | 
|---|
|  |  |  | Map<String, Double> resultMap = historyDailyService.getTraceabilityData(parameters); | 
|---|
|  |  |  | JSONObject params = new JSONObject(); | 
|---|
|  |  |  | Long code = monitorPoint.getAreaCode().longValue(); | 
|---|
|  |  |  | String regionName = areaService.queryFullNameByCode(code); | 
|---|
|  |  |  | Device device = deviceService.getDeviceByMac(mac, false); | 
|---|
|  |  |  | params.put("sensorInfo", resultMap); | 
|---|
|  |  |  | params.put("regionCode", code); | 
|---|
|  |  |  | params.put("regionName", regionName); | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | StringBuilder msg = new StringBuilder(); | 
|---|
|  |  |  | msg.append(" param[0] monitorPointId:"); | 
|---|
|  |  |  | msg.append(monitorPointId.toString()); | 
|---|
|  |  |  | msg.append(monitorPointId); | 
|---|
|  |  |  | msg.append(" param[0] mac:"); | 
|---|
|  |  |  | msg.append(mac); | 
|---|
|  |  |  | msg.append(" param[0] sensorKey:"); | 
|---|