Commit 7eb8d908 by gonglei

加入框架代码

1 parent 4a9ef0ee
......@@ -14,6 +14,7 @@ import org.springframework.security.authorization.AuthorizationManager;
import org.springframework.security.config.ObjectPostProcessor;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
import org.springframework.security.web.AuthenticationEntryPoint;
......@@ -34,6 +35,8 @@ public class SecurityConfig {
"/payment**"
};
private final String[] publicUrls = {"/rest/account/accountTagQrCode**"};
/**
*
*/
......@@ -76,6 +79,8 @@ public class SecurityConfig {
http.headers(httpSecurityHeadersConfigurer -> httpSecurityHeadersConfigurer.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin).disable());
http
.authorizeHttpRequests((authorize) -> authorize
// 配置不受管理的 URL,允许所有访问
.requestMatchers(publicUrls).permitAll()
.requestMatchers(protectedUrls).access(authorManagerImpl)
.anyRequest().permitAll()
)
......@@ -112,6 +117,11 @@ public class SecurityConfig {
return http.build();
}
// @Bean
// public WebSecurityCustomizer webSecurityCustomizer() {
// return (web) -> web.ignoring().requestMatchers("/ignore/**", "/public/**");
// }
// // 跟踪/查询会话所需
// @Bean
// public SessionRegistry sessionRegistry() {
......
package com.glsx.usedcar.web.rest.account;
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import com.glsx.usedcar.export.AccountBean;
import com.glsx.usedcar.export.ExcelExporter;
import com.glsx.usedcar.module.account.domain.*;
......@@ -22,8 +24,10 @@ import jakarta.persistence.criteria.Predicate;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException;
import org.springframework.data.domain.Page;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
......@@ -60,6 +64,8 @@ public class AccountController {
private BidService bidService;
@Resource
private DepositService depositService;
@Resource
private WxMaService wxMaService;
/**
* 分页查询个人账户
......@@ -288,4 +294,15 @@ public class AccountController {
List<AccountBean> vehicleBeans = vehicles.stream().map(AccountBean::new).toList();
ExcelExporter.exportExcel(response, "用户列表", "用户列表", AccountBean.class, vehicleBeans);
}
@GetMapping("accountTagQrCode")
public ResponseEntity<byte[]> accountTagQrCode(@RequestParam String code, HttpServletResponse response) throws WxErrorException {
WxMaQrcodeService qrcodeService = wxMaService.getQrcodeService();
byte[] releases = qrcodeService.createWxaCodeUnlimitBytes(code, "pages/tabbar/HomePage", false, "release", 430, true, null, false);
//设置页面不缓存
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
return ResponseEntity.ok(releases);
}
}
\ No newline at end of file
......@@ -32,6 +32,9 @@
{{ record.accountCount }}
</router-link>
</template>
<template v-if="column.key === 'qrcode'">
<a-image :src="$apiUrl+'account/accountTagQrCode?code='+record.recommendCode" width="80"></a-image>
</template>
</template>
<!--用户分组列表end-->
......@@ -69,6 +72,8 @@ export default class AccountTagPage extends PaginationComponent<AccountTag> {
{title: '标签颜色', dataIndex: 'color', key: 'color', align: 'center', width: 120, resizable: true, ellipsis: true, sorter: true},
{title: '标签名称', dataIndex: 'tagName', key: 'tagName', resizable: true, ellipsis: true, sorter: true},
{title: '标签说明', dataIndex: 'remark', key: 'remark', resizable: true, ellipsis: true, sorter: true},
{title: '小程序二维码', dataIndex: 'qrcode', key: 'qrcode', align: 'center', width: 110, resizable: true, ellipsis: true, sorter: false},
{title: '关联用户数', dataIndex: 'accountCount', key: 'accountCount', align: 'right', width: 130, resizable: true, ellipsis: true, sorter: true},
{title: '推荐码', dataIndex: 'recommendCode', key: 'recommendCode', align: 'center', width: 100, resizable: true, ellipsis: true, sorter: true},
{title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170, resizable: true, ellipsis: true, sorter: true},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!