fengxiang
2018-07-16 a6ea3af4f8e917f1c19204bbaa5a75a4a86716ac
src/main/java/com/moral/controller/ScreenController.java
@@ -28,14 +28,7 @@
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.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.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.xml.sax.InputSource;
import com.alibaba.fastjson.JSONArray;
@@ -58,9 +51,9 @@
 */
@RestController
@RequestMapping("/screen")
//@CrossOrigin(origins = "*", maxAge = 3600)
@CrossOrigin(origins = "*", maxAge = 3600)
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
@Api(tags = "Screen", description = "大屏相关")
@Api(tags = "Screen", description = "大屏接口")
public class ScreenController {
   public  static Logger log = Logger.getLogger(ScreenController.class);
    @Resource
@@ -110,6 +103,8 @@
   private OrganizationLayoutService orgLayoutService;
   @Resource
   private  DeviceVersionService dviceVersionService;
   @Resource
    private  OrganizationService organizationService;
   /**
    * Screen login. 大屏登录
    * 
@@ -126,6 +121,15 @@
         resultMap.put("accountId", -1);
      } else {
         resultMap = accountService.screenLogin(parameters);
         Object orgId = resultMap.get("orgId");
         if(resultMap.get("orgId")!=null && resultMap.get("orgId") instanceof Integer) {
                  Organization organization = organizationService.getOrganizationById((Integer) orgId);
                  if( organization.getAreaNames()!=null){
                      AreaNames areaNames =  organization.getAreaNames();
                      resultMap.put("mapPath ","中国/"+areaNames.getProvinceName()+"/"
                      +areaNames.getCityName()+"/"+areaNames.getAreaName());
                  }
            }
      }
      return resultMap;
   }
@@ -626,7 +630,12 @@
   })
   public ResultBean<List<Map<String, Object>>> getMonitorPointOrDeviceAvgDataBySensorKey(HttpServletRequest request) throws Exception {
      Map<String, Object> parameters = getParametersStartingWith(request, null);
      parameters.put("type", "month");
      int length = ((String)parameters.get("time")).split("-").length;
      if (length == 2) {
         parameters.put("type", "month");
      } else if (length == 3){
         parameters.put("type", "day");
      }
      parameters.put("monitorPointId", parameters.remove("monitorPoint"));
      String[] sensorKeys = parameters.remove("sensorKey").toString().split(",");
      parameters.put("sensors", Arrays.asList(sensorKeys));