| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import com.alibaba.fastjson.*;
|
| | | import com.moral.common.util.BeanUtils;
|
| | | import com.moral.common.util.ParameterUtils;
|
| | | import com.moral.common.util.StringUtils;
|
| | | import com.moral.entity.*;
|
| | |
| | | import com.moral.entity.layout.RealTimeDeviceLayout;
|
| | | import com.moral.service.*;
|
| | | import org.apache.commons.collections.CollectionUtils;
|
| | | import org.apache.commons.lang.math.NumberUtils;
|
| | | import org.apache.commons.net.ftp.FTPClient;
|
| | | import org.apache.log4j.Logger;
|
| | | import org.dom4j.Document;
|
| | |
| | | import com.moral.common.bean.PageResult;
|
| | | import com.moral.common.bean.ResultBean;
|
| | | import com.moral.common.util.ValidateUtil;
|
| | | import com.moral.common.util.WebUtils;
|
| | | import com.moral.common.xml.Version;
|
| | | import com.moral.entity.alarm.AlarmSensorLevel;
|
| | |
|
| | |
| | | private OrganizationService organizationService;
|
| | | @Resource
|
| | | private DictionaryDataService dictionaryDataService;
|
| | | |
| | | @Resource
|
| | | private WeatherService weatherService;
|
| | | |
| | | @Resource |
| | | private QualityDailyService qualityDailyService;
|
| | |
|
| | | /**
|
| | | * Screen login. 大屏登录
|
| | | *
|
| | |
| | | StringBuilder areaNamesBuilder = new StringBuilder("中国");
|
| | | if(!((Integer) orgId).equals(dictionaryDataService.querySupperOrgId())) {
|
| | | Organization organization = organizationService.getOrganizationById((Integer) orgId);
|
| | | if(organization.getAreaNames()!=null){
|
| | | AreaNames areaNames = organization.getAreaNames();
|
| | | if(!StringUtils.isNullOrEmpty(areaNames.getProvinceName())){
|
| | | areaNamesBuilder.append("/");
|
| | | areaNamesBuilder.append(areaNames.getProvinceName());
|
| | | if(!StringUtils.isNullOrEmpty(areaNames.getCityName())){
|
| | | areaNamesBuilder.append("/");
|
| | | areaNamesBuilder.append(areaNames.getCityName());
|
| | | if(!StringUtils.isNullOrEmpty(areaNames.getAreaName())){
|
| | | areaNamesBuilder.append("/");
|
| | | areaNamesBuilder.append(areaNames.getAreaName());
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if(organization.getAreaNames()!=null){
|
| | | Map<String,String> areaNameMap = BeanUtils.beanToMap(organization.getAreaNames());
|
| | | List<String> names = areaNameMap.entrySet().stream().filter(item -> {
|
| | | return item.getValue()!=null;
|
| | | }).map(item -> {
|
| | | return item.getValue();
|
| | | }).collect(Collectors.toList());
|
| | | AreaNames areaNames = organization.getAreaNames();
|
| | | areaNamesBuilder.append("/");
|
| | | areaNamesBuilder.append(String.join("/",names));
|
| | | }
|
| | | // 企业用户
|
| | | if(organization.getRank()!=null && organization.getRank() == 0) {
|
| | | resultMap.put("type","enterprise");
|
| | | }else{
|
| | | resultMap.put("type","government");
|
| | | }
|
| | | Number mapAreaCode = null;
|
| | | if(organization.getVillageCode()!=null){
|
| | | mapAreaCode = organization.getVillageCode();
|
| | | }else if (organization.getTownCode()!=null){
|
| | | mapAreaCode = organization.getTownCode();
|
| | | }else if(organization.getAreaCode()!=null) {
|
| | | mapAreaCode = organization.getAreaCode();
|
| | | }else if(organization.getCityCode()!=null) {
|
| | | mapAreaCode = organization.getCityCode();
|
| | | }else if(organization.getProvinceCode()!=null) {
|
| | | mapAreaCode = organization.getProvinceCode();
|
| | | }
|
| | | resultMap.put("mapAreaCode",mapAreaCode.toString() );
|
| | | }
|
| | | resultMap.put("mapPath",areaNamesBuilder.toString());
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | @RequestMapping(value = "/map-page", method = RequestMethod.GET)
|
| | | public ModelAndView map(ModelAndView model, @RequestParam("areaCode")int code, @RequestParam("accountId")int accountId){
|
| | | public ModelAndView map(ModelAndView model, @RequestParam("areaCode")long code, @RequestParam("accountId")int accountId){
|
| | | Account account = accountService.getAccountById(accountId);
|
| | | String regionName = areaService.queryFullNameByCode(code);
|
| | | if(account!=null&®ionName!=null){
|
| | |
| | | @GetMapping("report_alarm_datas")
|
| | | public ResultBean<List<Map<String, Object>>> getAlarmData(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | parameters.put("type", "month");
|
| | | ParameterUtils.getTimeType4Time(parameters);
|
| | | //parameters.put("type", "month");
|
| | | String sensorKey = "list";
|
| | | if (ObjectUtils.isEmpty(parameters.get("sensorKey"))) {
|
| | | parameters.put("description", "description");
|
| | |
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "orgid",defaultValue = "5",value = "组织id", required = true, paramType = "query", dataType = "Integer"),
|
| | | })
|
| | | public ResultBean<List<Map>> getAqi24HoursNC(@RequestParam("orgid") Integer organizationId) {
|
| | | public ResultBean<List<Map<String,Object>>> getAqi24HoursNC(@RequestParam("orgid") Integer organizationId) {
|
| | | return new ResultBean<>(hangzhouAqiService.queryAqi24Hours(organizationId));
|
| | | }
|
| | | @GetMapping("mpt-dev-summary")
|
| | |
| | | result.put("device",deviceSummary);
|
| | | return new ResultBean<>(result);
|
| | | }
|
| | | |
| | | @GetMapping("weather")
|
| | | @ApiOperation(value = "获取区域天气情况", notes = "获取区域天气情况")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "organizationId",defaultValue = "5", value = "登录账号的组织id", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<Map<String, Object>> getWeatherDataByRegion(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | Map<String, Object> map = weatherService.getWeatherDataByRegion(parameters);
|
| | | return new ResultBean<Map<String,Object>>(map);
|
| | | }
|
| | |
|
| | | @GetMapping("actual")
|
| | | @ApiOperation(value = "获取监测因子实时最大值", notes = "获取监测因子实时最大值")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "accountId",defaultValue = "1", value = "登录账号的id", required = true, paramType = "query", dataType = "String"),
|
| | | @ApiImplicitParam(name = "sensorKey",defaultValue = "e1,e2,e3", value = "传感器key,如有多个用逗号分隔", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "time",defaultValue = "", value = "时间(long类型时间)", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "interval",defaultValue = "30", value = "时间间隔(秒)", required = true, paramType = "query", dataType = "Integer"),
|
| | | })
|
| | | public ResultBean<Map<String, Object>> getActualDataByRegion(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | Map<String, Object> map = historyService.getActualDataByRegion(parameters);
|
| | | return new ResultBean<Map<String, Object>>(map);
|
| | | }
|
| | |
|
| | | @GetMapping("quality")
|
| | | @ApiOperation(value = "获取优良天数", notes = "获取优良天数")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "organizationId",defaultValue = "5", value = "登录账号的组织id", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<Map<String, Object>> getQualityCountDayByRegion(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = getParametersStartingWith(request, null);
|
| | | Map<String, Object> map = qualityDailyService.getQualityCountDayByRegion(parameters);
|
| | | return new ResultBean<Map<String, Object>>(map);
|
| | | }
|
| | |
|
| | | @GetMapping("monitorpoints-devices")
|
| | | @ApiOperation(value = "获取监控点以及设备", notes = "获取监控点以及设备")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "organizationId",defaultValue = "8", value = "登录账号的组织id", required = true, paramType = "query", dataType = "Integer"),
|
| | | @ApiImplicitParam(name = "regionCode",defaultValue = "320583", value = "区域码", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<List<MonitorPoint>> getMonitorPointsAndDevicesByRegion(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
|
| | | List<MonitorPoint> monitorPoints= monitorPointService.getMonitorPointsAndDevicesByRegion(parameters);
|
| | | return new ResultBean<List<MonitorPoint>>(monitorPoints);
|
| | | }
|
| | |
|
| | |
|
| | | @GetMapping("devices-state")
|
| | | @ApiOperation(value = "刷新设备状态", notes = "刷新设备状态")
|
| | | @ApiImplicitParams(value = {
|
| | | @ApiImplicitParam(name = "organizationId",defaultValue = "8", value = "登录账号的组织id", required = true, paramType = "query", dataType = "Integer"),
|
| | | @ApiImplicitParam(name = "regionCode",defaultValue = "320583", value = "区域码", required = true, paramType = "query", dataType = "String")
|
| | | })
|
| | | public ResultBean<Collection<Object>> getDevicesStateByRegion(HttpServletRequest request) throws Exception {
|
| | | Map<String, Object> parameters = WebUtils.getParametersStartingWith(request, null);
|
| | | Collection<Object> monitorPoints= monitorPointService.getDevicesStateByRegion(parameters);
|
| | | return new ResultBean<Collection<Object>>(monitorPoints);
|
| | | }
|
| | | }
|