Commit e8449fa1 authored by helinlin's avatar helinlin

优化

parent 50cc60f1
...@@ -37,6 +37,7 @@ import java.util.Map; ...@@ -37,6 +37,7 @@ import java.util.Map;
/** /**
* controller层切面 用于用户数据缓存 供 sql自动填充使用 * controller层切面 用于用户数据缓存 供 sql自动填充使用
* (使用粒度过大的Aop会创建大量代理对象,影响性能,占用内存,考虑使用 WebMvcConfigurer#addInterceptors 添加拦截器 )
* *
* @author Admin * @author Admin
*/ */
...@@ -69,8 +70,8 @@ public class ControllerAop { ...@@ -69,8 +70,8 @@ public class ControllerAop {
String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText", String[] url = new String[]{"/api/user/selectInfo", "/api/user/save/curCompany", "/jcs/command/lookHtmlText",
"/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo"}; "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo"};
// 获取请求路径 // 获取请求路径
for(String uri : url) { for (String uri : url) {
if(request.getRequestURI().indexOf(uri) != -1) { if (request.getRequestURI().indexOf(uri) != -1) {
return; return;
} }
} }
...@@ -118,10 +119,10 @@ public class ControllerAop { ...@@ -118,10 +119,10 @@ public class ControllerAop {
CompanyBo company = new CompanyBo(); CompanyBo company = new CompanyBo();
DepartmentBo department = new DepartmentBo(); DepartmentBo department = new DepartmentBo();
RoleBo role = new RoleBo(); RoleBo role = new RoleBo();
CompanyModel companyM = user.getCompanys() != null ? user.getCompanys().get(0) : null ; CompanyModel companyM = user.getCompanys() != null ? user.getCompanys().get(0) : null;
Bean.copyExistPropertis(companyM, company); Bean.copyExistPropertis(companyM, company);
Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments(); Map<Long, List<DepartmentModel>> mapDepartments = user.getCompanyDepartments();
DepartmentModel departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null ; DepartmentModel departmentM = companyM != null ? mapDepartments.get(companyM.getSequenceNbr()).get(0) : null;
Bean.copyExistPropertis(departmentM, department); Bean.copyExistPropertis(departmentM, department);
Map<Long, List<RoleModel>> roles = user.getOrgRoles(); Map<Long, List<RoleModel>> roles = user.getOrgRoles();
Long sequenceNbr; Long sequenceNbr;
...@@ -132,7 +133,7 @@ public class ControllerAop { ...@@ -132,7 +133,7 @@ public class ControllerAop {
} }
RoleModel roleM = null; RoleModel roleM = null;
if (sequenceNbr == null) { if (sequenceNbr == null) {
roleM = companyM != null ?roles.get(companyM.getSequenceNbr()).get(0) : null; roleM = companyM != null ? roles.get(companyM.getSequenceNbr()).get(0) : null;
} else { } else {
roleM = roles.get(sequenceNbr).get(0); roleM = roles.get(sequenceNbr).get(0);
} }
......
...@@ -3,10 +3,10 @@ package com.yeejoin.equipmanage.config; ...@@ -3,10 +3,10 @@ package com.yeejoin.equipmanage.config;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class AddResourceHandlersConfig extends WebMvcConfigurerAdapter { public class AddResourceHandlersConfig implements WebMvcConfigurer {
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
......
package com.yeejoin.amos.fas.core.framework; package com.yeejoin.amos.fas.core.framework;
import java.io.File; import com.yeejoin.amos.fas.business.constants.FasConstant;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.io.File;
import com.yeejoin.amos.fas.business.constants.FasConstant;; ;
@Configuration @Configuration
public class FasApplicationConfig extends WebMvcConfigurerAdapter{ public class FasApplicationConfig implements WebMvcConfigurer {
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -27,6 +28,5 @@ public class FasApplicationConfig extends WebMvcConfigurerAdapter{ ...@@ -27,6 +28,5 @@ public class FasApplicationConfig extends WebMvcConfigurerAdapter{
} }
registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+FasConstant.UPLOAD_ROOT_PATH + File.separator); registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+FasConstant.UPLOAD_ROOT_PATH + File.separator);
// registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/"); // registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/");
super.addResourceHandlers(registry);
} }
} }
package com.yeejoin.amos.latentdanger.core.framework; package com.yeejoin.amos.latentdanger.core.framework;
import java.io.File; import com.yeejoin.amos.latentdanger.business.constants.Constants;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.yeejoin.amos.latentdanger.business.constants.Constants; import java.io.File;
@Configuration @Configuration
public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ public class PatrolApplicationConfig implements WebMvcConfigurer {
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ ...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{
} }
registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+ Constants.UPLOAD_ROOT_PATH + File.separator); registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+ Constants.UPLOAD_ROOT_PATH + File.separator);
// registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/"); // registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/");
super.addResourceHandlers(registry);
} }
} }
package com.yeejoin.amos.maintenance.core.framework; package com.yeejoin.amos.maintenance.core.framework;
import java.io.File; import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.yeejoin.amos.maintenance.business.constants.XJConstant; import java.io.File;
@Configuration @Configuration
public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ public class PatrolApplicationConfig implements WebMvcConfigurer {
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ ...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{
} }
registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator); registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator);
// registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/"); // registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/");
super.addResourceHandlers(registry);
} }
} }
package com.yeejoin.amos.patrol.core.framework; package com.yeejoin.amos.patrol.core.framework;
import java.io.File; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import java.io.File;
@Configuration @Configuration
public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ public class PatrolApplicationConfig implements WebMvcConfigurer {
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ ...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{
} }
registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator); registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator);
// registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/"); // registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/");
super.addResourceHandlers(registry);
} }
} }
package com.yeejoin.amos.supervision.core.framework; package com.yeejoin.amos.supervision.core.framework;
import java.io.File; import com.yeejoin.amos.supervision.business.constants.XJConstant;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.yeejoin.amos.supervision.business.constants.XJConstant; import java.io.File;
@Configuration @Configuration
public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ public class PatrolApplicationConfig implements WebMvcConfigurer {
@Value("${windows.img.path}") @Value("${windows.img.path}")
private String winImgPath; private String winImgPath;
...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{ ...@@ -27,6 +26,5 @@ public class PatrolApplicationConfig extends WebMvcConfigurerAdapter{
} }
registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator); registry.addResourceHandler("/upload/**").addResourceLocations("file:"+localPath.trim()+XJConstant.UPLOAD_ROOT_PATH + File.separator);
// registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/"); // registry.addResourceHandler("/upload/video/**").addResourceLocations("file:G:/upload/video/");
super.addResourceHandlers(registry);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment