| | |
| | | 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.io.*;
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.alibaba.fastjson.JSONReader;
|
| | | import com.alibaba.fastjson.TypeReference;
|
| | | import com.moral.entity.*;
|
| | | import com.moral.entity.alarm.AlarmConfig;
|
| | | import com.moral.entity.alarm.AlarmConfigValue;
|
| | | import com.moral.entity.charts.DataSortCondition;
|
| | | import org.apache.commons.collections.CollectionUtils;
|
| | | import org.apache.commons.net.ftp.FTPClient;
|
| | | import org.apache.log4j.Logger;
|
| | |
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import org.springframework.web.servlet.ModelAndView;
|
| | | import org.xml.sax.InputSource;
|
| | |
|
| | | import com.alibaba.fastjson.JSONArray;
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.moral.common.bean.Constants;
|
| | |
| | | import com.moral.common.bean.ResultBean;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.common.xml.Version;
|
| | | import com.moral.entity.Account;
|
| | | import com.moral.entity.Device;
|
| | | import com.moral.entity.MapBounds;
|
| | | import com.moral.entity.MonitorPoint;
|
| | | import com.moral.entity.alarm.AlarmConfigValue;
|
| | | import com.moral.entity.alarm.AlarmSensorLevel;
|
| | | import com.moral.service.AccountService;
|
| | | import com.moral.service.AlarmConfigService;
|
| | |
| | | private MachineActivateService machineActivateService;
|
| | |
|
| | | /** The resource. */
|
| | | @Value(value = "classpath:system/alarmLevels.json")
|
| | | private org.springframework.core.io.Resource resource;
|
| | | // @Value(value = "classpath:system/alarmLevels.json")
|
| | | // private org.springframework.core.io.Resource resource;
|
| | |
|
| | | /** The redis template. */
|
| | | @Resource
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | | * @param dataSortCondition 数据排名查询条件
|
| | | * @return
|
| | | */
|
| | | public ResultBean<Map<String,Object>> getOrderData(DataSortCondition dataSortCondition) {
|
| | | ResultBean resultBean = new ResultBean();
|
| | | if(dataSortCondition.getCode()==null){
|
| | | resultBean.setCode(ResultBean.FAIL);
|
| | | resultBean.setMessage("code can't be null");
|
| | | } else if(dataSortCondition.getStyle()==null){
|
| | | resultBean.setCode(ResultBean.FAIL);
|
| | | resultBean.setMessage("style can't be null");
|
| | | }
|
| | | String code = dataSortCondition.getCode().toString();
|
| | | Region region = Region.create(code);
|
| | | if(region == null) {
|
| | | resultBean.setCode(ResultBean.FAIL);
|
| | | resultBean.setMessage("code is not in the correct format");
|
| | | }
|
| | | // todo
|
| | | return null;
|
| | | }
|
| | | /**
|
| | | * Gets the day AQI by sensor.设备昨日的AQI指标
|
| | | *
|
| | |
| | | List<Map<String, Object>> list = historyService.getRegionRankingData(parameters);
|
| | | return new ResultBean<List<Map<String, Object>>>(list);
|
| | | }
|
| | | // todo
|
| | | @Value(value = "classpath:system/realTimeMonitorLayout.json")
|
| | | private org.springframework.core.io.Resource resource;
|
| | | @ApiOperation(value = "获取实时监控页面布局", notes = "")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "primaryKey",defaultValue = "898607b0101730391967", value = "值为:设备mac或监控站id", required = true, paramType = "query", dataType = "String"),
|
| | | @ApiImplicitParam(name = "type", defaultValue = "device",value = "值为:'monitorPoint'或'device'", required = true, paramType = "query", dataType = "String"),
|
| | | })
|
| | | @GetMapping("rtm-layout")
|
| | | public ResultBean realTimeMonitorLayout(String primaryKey,String type){
|
| | | InputStreamReader reader = null;
|
| | | Map<String,Object> map = null;
|
| | | try {
|
| | | reader = new InputStreamReader(resource.getInputStream());
|
| | | map = new JSONReader(reader).readObject(new TypeReference<Map<String,Object>>() {});
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return new ResultBean(map);
|
| | | }
|
| | |
|
| | | }
|