Commit e7fcf812 authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/master'

parents 701f1ed3 6b3e1f42
......@@ -49,7 +49,7 @@
<profiles.active>test</profiles.active>
<profiles.server.debug>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5513</profiles.server.debug>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.req.json.check>true</profiles.req.json.check>
<profiles.req.json.check>false</profiles.req.json.check>
<profiles.trustedReferer>192.168.0.98,localhost</profiles.trustedReferer>
</properties>
</profile>
......
......@@ -21,8 +21,8 @@ import java.net.URL;
import java.util.List;
@Slf4j
@Component
@Profile({"yanyuan", "test"})
//@Component
//@Profile({"yanyuan", "test"})
public class SameSiteCookieFilter implements Filter {
@Autowired
......
......@@ -20,8 +20,8 @@ public class AreaMatchCodeUtil {
if (AreaLevelEnum.地市州.getValue() == areaLevel) {
matchCode=StrUtil.sub(matchCode, 0, 3);
return StrUtil.padAfter(matchCode, 3, "0");
matchCode=StrUtil.sub(matchCode, 0, 4);
return StrUtil.padAfter(matchCode, 4, "0");
} else if (AreaLevelEnum.区县.getValue() == areaLevel) {
//510921174000
matchCode=StrUtil.sub(matchCode, 0, 6);
......
......@@ -395,8 +395,14 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
userService.updateUserList(list.getData().getData());
Rest<RespData<List<UserPdu>>> userRest = userFeign.list(userPdu);
if(YesNoEnum.YES.getValue()==userRest.getCode()){
if(!ObjectUtils.isEmpty(userRest.getData())
&&!ObjectUtils.isEmpty(userRest.getData().getData())) {
userService.updateUserList(userRest.getData().getData());
}
}
}
super.removeAfter(ids, context, result);
}
......
......@@ -18,7 +18,7 @@
<property name="showSql" value="MySql" />
</plugin>
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="true" />
<property name="enableExecutorTime" value="false" />
<property name="showSql" value="false" />
</plugin>
......
......@@ -54,7 +54,7 @@ POST {{baseUrl}}/base/area/genSubAreaByAreaName
Content-Type: application/json
{
"areaCode": "510714000000"
"areaCode": "511900000000"
}
......
......@@ -46,7 +46,7 @@
<profiles.active>test</profiles.active>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.trustedReferer>192.168.0.98,localhost,192.168.0.252</profiles.trustedReferer>
<profiles.req.json.check>true</profiles.req.json.check>
<profiles.req.json.check>false</profiles.req.json.check>
</properties>
</profile>
......@@ -96,7 +96,6 @@
<profiles.active>yanyuan</profiles.active>
<profiles.nacos.server-addr>172.16.30.245:8848</profiles.nacos.server-addr>
<profiles.trustedReferer>127.0.0.1,localhost,10.233.82.175,172.16.30.245,172.16.30.246,172.16.30.247,172.16.30.248</profiles.trustedReferer>
<profiles.req.json.check>true</profiles.req.json.check>
</properties>
</profile>
......
......@@ -22,10 +22,9 @@ public class CorsConfig implements WebMvcConfigurer {
//初始化配置对象
CorsConfiguration configuration = new CorsConfiguration();
//允许跨域访问的域名
//configuration.addAllowedOrigin("*");
// configuration.addAllowedOrigin("http://192.168.0.98");
configuration.addAllowedOrigin("*");
configuration.setAllowCredentials(true); //运行携带cookie
// configuration.addAllowedMethod("*"); //代表所有请求方法
configuration.addAllowedMethod("*"); //代表所有请求方法
configuration.addAllowedHeader("*"); //允许携带任何头信息
//初始化cors配置源对象
......@@ -40,7 +39,7 @@ public class CorsConfig implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowCredentials(true)
//.allowedOrigins("*")
.allowedOrigins("*")
.allowedMethods(new String[] { "GET", "POST","PUT","DELETE"})
.allowedHeaders("*")
.exposedHeaders("*");
......
......@@ -16,14 +16,11 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
@Slf4j
@Component
@Profile({"yanyuan", "test"})
//@Component
//@Profile({"yanyuan"})
public class SameSiteCookieFilter implements Filter {
......@@ -52,10 +49,25 @@ public class SameSiteCookieFilter implements Filter {
httpResponse.setHeader("Access-Control-Expose-Headers", "*");
}
}
// addSameSiteAttribute((HttpServletResponse) response);
chain.doFilter(request, response);
}
private void addSameSiteAttribute(HttpServletResponse response) {
Collection<String> headers = response.getHeaders("Set-Cookie");
boolean firstHeader = true;
for (String header : headers) {
if (firstHeader) {
response.setHeader("Set-Cookie", String.format("%s; %s", header, "SameSite=Strict"));
firstHeader = false;
continue;
}
response.addHeader("Set-Cookie", String.format("%s; %s", header, "SameSite=Strict"));
}
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
......
......@@ -27,6 +27,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
......@@ -93,6 +94,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
}
}
}
//Origin
......
......@@ -7,7 +7,6 @@
*/
package com.mortals.xhx.base.system.resource.model;
import java.util.List;
/**
* <p>Title: 资源信息</p>
......
......@@ -19,11 +19,11 @@ import com.mortals.xhx.base.system.resource.dao.ResourceDao;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.model.ResourceQuery;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.model.RoleAuthEntity;
import com.mortals.xhx.base.system.role.model.RoleAuthQuery;
import com.mortals.xhx.base.system.role.service.RoleAuthService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.ControllerScanUtil;
import com.mortals.xhx.module.role.model.RoleAuthEntity;
import com.mortals.xhx.module.role.model.RoleAuthQuery;
import com.mortals.xhx.module.role.service.RoleAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
......@@ -73,14 +73,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
@Override
public Set<String> findUrlSetByUserId(Long userId) throws AppException {
Set<String> urls = new HashSet<>();
List<ResourceEntity> resList = new ArrayList<>();
if (1L == userId) {
//管理员
resList = this.find(new ResourceQuery());
} else {
resList = this.findListByUserId(userId);
}
List<ResourceEntity> resList = this.findListByUserId(userId);
for (ResourceEntity res : resList) {
String url = res.getUrl();
if (StringUtils.isEmpty(url)) {
......@@ -101,7 +94,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
public Rest<String> refreshResourceUrl(String packageName, Context context) {
List<Class<?>> classList = ControllerScanUtil.getAllClassByPackageName(packageName);
//System.out.println(classList); //获取到了所有的类
List<ResourceEntity> newResourcelist = ControllerScanUtil.getAnnotationInfo(classList).stream().filter(f -> !ObjectUtils.isEmpty(f.getUrl())).collect(Collectors.toList());
List<ResourceEntity> newResourcelist = ControllerScanUtil.getAnnotationInfo(classList).stream().filter(f->!ObjectUtils.isEmpty(f.getUrl())).collect(Collectors.toList());
Map<String, List<ResourceEntity>> localResourceMap = this.find(new ResourceQuery()).stream().collect(Collectors.groupingBy(x -> x.getName()));
Map<String, List<ResourceEntity>> newResourceMap = newResourcelist.stream().collect(Collectors.groupingBy(x -> x.getName()));
......@@ -191,14 +184,12 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
}
private void updateUserMenuUrlCache() {
cacheService.del(RedisKey.KEY_USER_MENU_CACHE);
/* //更新用户菜单
//更新用户菜单
Set<String> hkeys = cacheService.hkeys(RedisKey.KEY_USER_MENU_CACHE);
for (String userId : hkeys) {
Set<String> urls = this.findUrlSetByUserId(DataUtil.converStr2Long(userId, 0L));
String menuUrlCode = generateMenuUrlCode(urls);
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userId, menuUrlCode);
}*/
}
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
......@@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
......@@ -67,7 +69,7 @@ public class ResourceController extends BaseCRUDJsonBodyMappingController<Resour
@Override
protected void doListBefore(ResourceEntity query, Map<String, Object> model, Context context) throws AppException {
query.setOrderColList(Arrays.asList(new OrderCol("sourceType")));
super.doListBefore(query, model, context);
}
......
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