fengxiang
2018-07-16 3bb54d86b0a80a13374b10b1a9d9d0f131a85f9d
src/main/java/com/moral/controller/ScreenController.java
@@ -11,6 +11,7 @@
import com.alibaba.fastjson.JSONReader;
import com.alibaba.fastjson.TypeReference;
import com.moral.common.util.StringUtils;
import com.moral.entity.*;
import com.moral.entity.alarm.AlarmConfig;
import com.moral.entity.alarm.AlarmConfigValue;
@@ -28,14 +29,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,7 +52,7 @@
 */
@RestController
@RequestMapping("/screen")
//@CrossOrigin(origins = "*", maxAge = 3600)
@CrossOrigin(origins = "*", maxAge = 3600)
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
@Api(tags = "Screen", description = "大屏接口") 
public class ScreenController {
@@ -110,6 +104,8 @@
   private OrganizationLayoutService orgLayoutService;
   @Resource
   private  DeviceVersionService dviceVersionService;
   @Resource
    private  OrganizationService organizationService;
   /**
    * Screen login. 大屏登录
    * 
@@ -126,6 +122,27 @@
         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);
                  StringBuilder areaNamesBuilder = new StringBuilder("中国");
                  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());
                              }
                          }
                      }
                  }
                  resultMap.put("mapPath",areaNamesBuilder.toString());
            }
      }
      return resultMap;
   }