Commit 7dc79a33 authored by 王业雄's avatar 王业雄

fix

parent 2ef0e060
......@@ -46,11 +46,9 @@ public class CrosFilter implements Filter {
"Accept,Access-Token,Account,Account-Name,Referer,sec-ch-ua,sec-ch-ua-mobile,sec-ch-ua-platform,User-Agent";
response.setHeader("Access-Control-Allow-Headers", allowedHeaders);
response.setHeader("Access-Control-Max-Age", "3600");
log.info("doFilter | 前端请求过滤,请求方法{},请求路径{}",request.getMethod(),request.getRequestURI());
if (DISALLOWED_METHOD.contains(request.getMethod())) {
return;
}
log.info("doFilter | 前端请求过滤,请求方法{}",request.getMethod());
filterChain.doFilter(servletRequest, servletResponse);
}
......
......@@ -32,7 +32,6 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Override
public void addCorsMappings(CorsRegistry registry) {
log.info("addCorsMappings | 前端请求过滤");
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("HEAD", "GET", "POST")
......
......@@ -11,12 +11,12 @@ public interface IChannelRuleRepository extends JpaRepository<ChannelRuleEntity,
List<ChannelRuleEntity> getByChannelId(long channelId);
List<ChannelRuleEntity> getAllByEnableEquals(Byte enable);
List<ChannelRuleEntity> getAllByEnableEquals(Boolean enable);
List<ChannelRuleEntity> getAllByChannelIdEqualsAndEnableEquals(Long channelId,Byte enable);
List<ChannelRuleEntity> getAllByChannelIdEqualsAndEnableEquals(Long channelId,Boolean enable);
List<ChannelRuleEntity> getAllByIdIn(List<Long> ids);
void deleteAllByChannelIdEqualsAndEnableEquals(Long channelId,Byte enable);
void deleteAllByChannelIdEqualsAndEnableEquals(Long channelId,Boolean enable);
}
......@@ -54,7 +54,7 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.publishStatus.eq(channelRouteQueryVo.getPublishStatus()));
}
//只查有效数据
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.enable);
booleanExpression = booleanExpression.and(QChannelRuleEntity.channelRuleEntity.enable.eq(Boolean.TRUE));
//1.查询条件,2.索引和每页的大小,3.排序根据某个字段进行排序
//查询总条数
......@@ -98,7 +98,7 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
@Override
public List<Long> queryConfigChannelIds() {
List<ChannelRuleEntity> allByEnableEquals = channelRuleRepository.getAllByEnableEquals(Byte.valueOf("1"));
List<ChannelRuleEntity> allByEnableEquals = channelRuleRepository.getAllByEnableEquals(Boolean.TRUE);
List<Long> channelIds = new ArrayList<>();
allByEnableEquals.stream().forEach(channelRuleEntity -> {
if (!channelIds.contains(channelRuleEntity.getChannelId())){
......@@ -111,7 +111,7 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
@Override
public GlobalResponse queryConfigChannelInfo(Long channelId) {
List<ChannelConfigInfoVo> channelConfigInfoVos = new ArrayList<>();
List<ChannelRuleEntity> allByChannelIdEqualsaAndEnableEquals = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Byte.valueOf("1"));
List<ChannelRuleEntity> allByChannelIdEqualsaAndEnableEquals = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Boolean.TRUE);
if (CollectionUtils.isEmpty(allByChannelIdEqualsaAndEnableEquals)){
return GlobalResponse.error("该渠道没有对应的路由配置信息");
}else {
......@@ -176,7 +176,7 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
* 编辑时要去掉所有该渠道有效性为0的其他配置(覆盖之前的未更新编辑信息)
*/
if ( 0 != type ){
channelRuleRepository.deleteAllByChannelIdEqualsAndEnableEquals(channelRouteSaveVoList.get(0).getChannelId(),Byte.valueOf("0"));
channelRuleRepository.deleteAllByChannelIdEqualsAndEnableEquals(channelRouteSaveVoList.get(0).getChannelId(),Boolean.FALSE);
}
List<ChannelRuleEntity> channelRuleEntityList = getChannelRuleEntityList(channelRouteSaveVoList);
......@@ -210,7 +210,7 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
@Override
public void publishChannelConfig(Long channelId) {
List<ChannelRuleEntity> all = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Byte.valueOf("1"));
List<ChannelRuleEntity> all = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Boolean.TRUE);
all.stream().forEach(channelRuleEntity -> {
channelRuleEntity.setPublishStatus(1);
......@@ -221,8 +221,8 @@ public class ChannelRouteServiceImpl implements IChannelRouteService {
@Override
@Transactional
public void updateChannelConfig(Long channelId) {
channelRuleRepository.deleteAllByChannelIdEqualsAndEnableEquals(channelId, Byte.valueOf("1"));
List<ChannelRuleEntity> allByChannelIdEqualsAndEnableEquals = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Byte.valueOf("0"));
channelRuleRepository.deleteAllByChannelIdEqualsAndEnableEquals(channelId, Boolean.TRUE);
List<ChannelRuleEntity> allByChannelIdEqualsAndEnableEquals = channelRuleRepository.getAllByChannelIdEqualsAndEnableEquals(channelId, Boolean.FALSE);
allByChannelIdEqualsAndEnableEquals.stream().forEach(channelRuleEntity -> {
channelRuleEntity.setEnable(true);
channelRuleRepository.save(channelRuleEntity);
......
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