From fd353a54d1527126b08e5fdc27740b03e13b5f6f Mon Sep 17 00:00:00 2001 From: xiao-fajia <1665375861@qq.com> Date: Fri, 30 Aug 2024 16:21:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A1=A5=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/SysAnnouncementController.java | 12 +++---- .../admin/RescueInfoController.java | 5 ++- .../admin/UserAnnouncementSocket.java | 31 ++++++++++++------- .../module/rescue/domain/RescueInfo.java | 4 +-- .../YudaoWebSecurityConfigurerAdapter.java | 2 ++ 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/SysAnnouncementController.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/SysAnnouncementController.java index 6d8c6633..d9cd8ae2 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/SysAnnouncementController.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/appBase/controller/admin/SysAnnouncementController.java @@ -38,7 +38,7 @@ public class SysAnnouncementController extends BaseController /** * 查询系统通知列表 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:list')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:list')") @GetMapping("/list") public CommonResult list(SysAnnouncement sysAnnouncement) { @@ -50,7 +50,7 @@ public class SysAnnouncementController extends BaseController /** * 导出系统通知列表 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:export')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:export')") @PostMapping("/export") public void export(HttpServletResponse response, SysAnnouncement sysAnnouncement) { @@ -62,7 +62,7 @@ public class SysAnnouncementController extends BaseController /** * 获取系统通知详细信息 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:query')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:query')") @GetMapping(value = "/{id}") public CommonResult getInfo(@PathVariable("id") Long id) { @@ -72,7 +72,7 @@ public class SysAnnouncementController extends BaseController /** * 新增系统通知 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:add')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:add')") @PostMapping public CommonResult add(@RequestBody SysAnnouncement sysAnnouncement) { @@ -82,7 +82,7 @@ public class SysAnnouncementController extends BaseController /** * 修改系统通知 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:edit')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:edit')") @PutMapping public CommonResult edit(@RequestBody SysAnnouncement sysAnnouncement) { @@ -92,7 +92,7 @@ public class SysAnnouncementController extends BaseController /** * 删除系统通知 */ - @PreAuthorize("@ss.hasPermi('announcement:announcement:remove')") + @PreAuthorize("@ss.hasPermission('announcement:announcement:remove')") @DeleteMapping("/{ids}") public CommonResult remove(@PathVariable Long[] ids) { diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java index 62d45c73..2330b97d 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/RescueInfoController.java @@ -155,10 +155,9 @@ public class RescueInfoController extends BaseController { * 查询【请填写功能名称】列表 */ @GetMapping("/driverList") - public TableDataInfo driverList(DriverInfoDto driverInfoDto) { - startPage(); + public CommonResult driverList(DriverInfoDto driverInfoDto) { List list = rescueInfoService.driverListApp(driverInfoDto); - return getDataTable(list); + return success(list); } /** diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/UserAnnouncementSocket.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/UserAnnouncementSocket.java index a2b5bc32..84a9ac98 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/UserAnnouncementSocket.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/app/controller/admin/UserAnnouncementSocket.java @@ -12,7 +12,9 @@ import java.io.IOException; import java.util.concurrent.ConcurrentHashMap; -/**`1 +/** + * `1 + * * @Author: chuxia0811 * @Date: 2023/7/9 10:21 * @Description : @@ -25,9 +27,11 @@ public class UserAnnouncementSocket { public static ConcurrentHashMap sessionMap = new ConcurrentHashMap<>(); //关键代码,设置一个静态上下文属性appcontext private static ApplicationContext appcontext; + public static void setAppcontext(ApplicationContext appcontext) { UserAnnouncementSocket.appcontext = appcontext; } + public static ApplicationContext getAppcontext() { return appcontext; } @@ -36,12 +40,13 @@ public class UserAnnouncementSocket { /** * 创建连接 * 用于监听建立连接,当有客户端与该服务端点建立连接时,将会自回调该注解标注的方法 + * * @param session * @param userId */ @OnOpen public void onOpen(Session session, @PathParam(value = "userId") String userId) { - this.sessionMap.put(userId,session); + this.sessionMap.put(userId, session); log.info("用户{}已创建连接", userId); } @@ -49,26 +54,28 @@ public class UserAnnouncementSocket { /** * 用于监听客户端向服务端发送消息,当客户端与服务端发送消息时,将会回调该注解标注的方法 * { - * Stringitude:124.11, - * latitude:125.33, - * positionInfo:"山东省济南市市中区八一立交桥" + * Stringitude:124.11, + * latitude:125.33, + * positionInfo:"山东省济南市市中区八一立交桥" * } + * * @param msg * @param userId */ @OnMessage - public void onMessage(String msg,@PathParam(value = "userId") String userId){ - System.out.println("消息通知+"+userId); + public void onMessage(String msg, @PathParam(value = "userId") String userId) { + System.out.println("消息通知+" + userId); } /** * 用于监听连接关闭,当客户端与该服务端点断开连接时,将会回调该注解标注的方法 + * * @param session * @param userId */ @OnClose - public void onClose(Session session,@PathParam(value = "userId") String userId){ + public void onClose(Session session, @PathParam(value = "userId") String userId) { this.sessionMap.remove(userId); } @@ -76,24 +83,24 @@ public class UserAnnouncementSocket { /** * 用于监听该连接上的任何错误,当客户端与该服务端点的连接发生任何异常,都将回调该注解标注的方法 * 注意该方法的参数必选Throwable,可选Sessiion以及0-n个String参数,且String参数需要使用@PathParam注解标注 + * * @param throwable * @param driverId */ @OnError - public void onError(Throwable throwable,@PathParam(value = "driverId") String driverId){ + public void onError(Throwable throwable, @PathParam(value = "driverId") String driverId) { log.error("用户{}连接发生异常", driverId); } /** * 发送给指定的用户 + * * @param message */ public void sendMessage(String message, String userId) throws IOException { - if (sessionMap.containsKey(userId)){ + if (sessionMap.containsKey(userId)) { Session session = sessionMap.get(userId); session.getAsyncRemote().sendText(message); } } - - } diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java index e6723f26..ff3d97f3 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/domain/RescueInfo.java @@ -51,7 +51,7 @@ public class RescueInfo extends TenantBaseDO private String isAppointment; /** 救援时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone="GMT+8") @Excel(name = "救援时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm") private Date rescueTime; @@ -149,7 +149,7 @@ public class RescueInfo extends TenantBaseDO @Excel(name = "实付金额") private Double payMoneyYuan; @TableField(exist = false) - @JsonFormat(pattern = "yyyy-MM-dd HH:mm") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm",timezone="GMT+8") @Excel(name = "收款时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm") private Date payTime; @TableField(exist = false) diff --git a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java index 0c7c60e3..658ae02d 100644 --- a/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java +++ b/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java @@ -130,11 +130,13 @@ public class YudaoWebSecurityConfigurerAdapter { // 1.1 静态资源,可匿名访问 .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() + // 登录可以匿名访问 .antMatchers(HttpMethod.POST, "/admin-api/rescue/login", "/admin-api/rescue/loginApp", "/admin-api/rescue/wxLogin", "/admin-api/system/auth/loginApp", "/admin-api/rescue/driverLogin").anonymous() + // 1.2 设置 @PermitAll 无需认证 .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll() .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll()