From 8d2d5103aea98fab6ad94acd1c8421c05d1108fa Mon Sep 17 00:00:00 2001
From: xufenglei <xufenglei>
Date: Wed, 18 Jul 2018 09:26:39 +0800
Subject: [PATCH] 优化
---
src/main/java/com/moral/controller/ScreenController.java | 49 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/moral/controller/ScreenController.java b/src/main/java/com/moral/controller/ScreenController.java
index 064270e..85745f8 100644
--- a/src/main/java/com/moral/controller/ScreenController.java
+++ b/src/main/java/com/moral/controller/ScreenController.java
@@ -9,8 +9,8 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
-import com.alibaba.fastjson.JSONReader;
-import com.alibaba.fastjson.TypeReference;
+import com.alibaba.fastjson.*;
+import com.moral.common.util.StringUtils;
import com.moral.entity.*;
import com.moral.entity.alarm.AlarmConfig;
import com.moral.entity.alarm.AlarmConfigValue;
@@ -28,18 +28,9 @@
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;
-import com.alibaba.fastjson.JSONObject;
import com.moral.common.bean.Constants;
import com.moral.common.bean.JsonData;
import com.moral.common.bean.PageResult;
@@ -58,7 +49,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 +101,10 @@
private OrganizationLayoutService orgLayoutService;
@Resource
private DeviceVersionService dviceVersionService;
+ @Resource
+ private OrganizationService organizationService;
+ @Resource
+ private DictionaryDataService dictionaryDataService;
/**
* Screen login. ������������
*
@@ -126,6 +121,30 @@
resultMap.put("accountId", -1);
} else {
resultMap = accountService.screenLogin(parameters);
+ // ������������������������������������������
+ Object orgId = resultMap.get("orgId");
+ if(resultMap.get("orgId")!=null && resultMap.get("orgId") instanceof Integer) {
+ StringBuilder areaNamesBuilder = new StringBuilder("������");
+ if((Integer) orgId != 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());
+ }
+ }
+ }
+ }
+ }
+ resultMap.put("mapPath",areaNamesBuilder.toString());
+ }
}
return resultMap;
}
@@ -594,7 +613,9 @@
DeviceVersion deviceVersion = deviceVersionService.queryVersionById(device.getDeviceVersionId());
rtdLayout = orgLayoutService.queryRtdLayoutWithUnit(orgId,deviceVersion.getVersion());
}else {
- return ResultBean.fail();
+ String errMsg = "device ���������������"+ JSON.toJSONString(device);
+ log.warn(errMsg);
+ return ResultBean.fail(errMsg);
}
} else {
--
Gitblit v1.8.0