From 2f4cc28e832f6b3739172c551aa49058de082fd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=8E=E5=B0=8F=E6=9E=97?= <320730042@qq.com>
Date: Wed, 14 Aug 2024 19:20:16 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AC=AC=E4=B8=80=E7=89=88bug=E4=BF=AE?=
=?UTF-8?q?=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../bellmann/common/result/ResultCode.java | 7 +-
.../com/bellmann/config/WebSocketConfig.java | 103 ------------------
.../controller/DeviceStaticController.java | 24 ++++
.../controller/DeviceTypeController.java | 3 +
.../controller/DeviceTypeVerController.java | 1 +
.../controller/OperateTask2Controller.java | 8 +-
.../controller/OrderInfoController.java | 6 +-
.../controller/SysUserController.java | 22 ++--
.../controller/Tr069VerController.java | 2 +
.../controller/WebsocketController.java | 61 -----------
.../bellmann/mapper/OperateTask2Mapper.java | 4 +
.../com/bellmann/mapper/SysUserMapper.java | 7 +-
.../java/com/bellmann/model/form/PwdForm.java | 14 +++
.../model/vo/OperateTaskResultVO.java | 24 ++++
.../bellmann/service/OperateTask2Service.java | 3 +
.../com/bellmann/service/SysUserService.java | 3 +
.../service/impl/AuthServiceImpl.java | 3 -
.../service/impl/HistoryQueryServiceImpl.java | 1 -
.../service/impl/OperateTask2ServiceImpl.java | 10 ++
.../service/impl/SysUserServiceImpl.java | 19 +++-
.../resources/mapper/DeviceStaticMapper.xml | 13 ++-
.../resources/mapper/OperateTask2Mapper.xml | 16 +++
src/test/java/com/bellmann/DemoTest.java | 25 +++++
24 files changed, 194 insertions(+), 187 deletions(-)
delete mode 100644 src/main/java/com/bellmann/config/WebSocketConfig.java
delete mode 100644 src/main/java/com/bellmann/controller/WebsocketController.java
create mode 100644 src/main/java/com/bellmann/model/form/PwdForm.java
create mode 100644 src/main/java/com/bellmann/model/vo/OperateTaskResultVO.java
diff --git a/pom.xml b/pom.xml
index c1d5db8..c124256 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
5.8.5
- 42.6.0
+ 42.2.27
1.2.16
3.5.3.2
diff --git a/src/main/java/com/bellmann/common/result/ResultCode.java b/src/main/java/com/bellmann/common/result/ResultCode.java
index f90841c..1e2116d 100644
--- a/src/main/java/com/bellmann/common/result/ResultCode.java
+++ b/src/main/java/com/bellmann/common/result/ResultCode.java
@@ -27,6 +27,7 @@ public enum ResultCode implements IResultCode, Serializable {
USER_ACCOUNT_INVALID("A0203", "用户账户已作废"),
USERNAME_OR_PASSWORD_ERROR("A0210", "用户名或密码错误"),
+
PASSWORD_ENTER_EXCEED_LIMIT("A0211", "用户输入密码次数超限"),
CLIENT_AUTHENTICATION_FAILED("A0212", "客户端认证失败"),
@@ -40,6 +41,7 @@ public enum ResultCode implements IResultCode, Serializable {
ACCESS_UNAUTHORIZED("A0301", "访问未授权"),
FORBIDDEN_OPERATION("A0302", "演示环境禁止新增、修改和删除数据,请本地部署后测试"),
+ THE_PASSWORD_IS_INCONSISTENT_TWICE("A0303", "两次密码不一致"),
PARAM_ERROR("A0400", "用户请求参数错误"),
RESOURCE_NOT_FOUND("A0401", "请求资源不存在"),
@@ -130,7 +132,10 @@ public enum ResultCode implements IResultCode, Serializable {
THE_DEVICE_IS_NOT_ONLINE("F0039","设备不在线"),
ADD_DEVICE_TYPE_FAIL("F0040","新增设备类型失败" ),
THE_SUPPLIER_OUI_CANNOT_BE_MODIFIED("F0041","该供应商OUI不能修改" ),
- THE_VENDOR_OUI_ALREADY_EXISTS("F0042","该供应商OUI已存在" );
+ THE_VENDOR_OUI_ALREADY_EXISTS("F0042","该供应商OUI已存在" ),
+
+ MUST_NOT_CONTAIN_KEY_SORTING_PASSWORDS("F0043","不得包含键盘排序密码"),
+ FAILED_TO_CHANGE_THE_PASSWORD("F0044","修改密码失败");
@Override
public String getCode() {
diff --git a/src/main/java/com/bellmann/config/WebSocketConfig.java b/src/main/java/com/bellmann/config/WebSocketConfig.java
deleted file mode 100644
index e6e4dbe..0000000
--- a/src/main/java/com/bellmann/config/WebSocketConfig.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.bellmann.config;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.jwt.JWTPayload;
-import com.bellmann.security.util.JwtUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpHeaders;
-import org.springframework.messaging.Message;
-import org.springframework.messaging.MessageChannel;
-import org.springframework.messaging.simp.config.ChannelRegistration;
-import org.springframework.messaging.simp.config.MessageBrokerRegistry;
-import org.springframework.messaging.simp.stomp.StompCommand;
-import org.springframework.messaging.simp.stomp.StompHeaderAccessor;
-import org.springframework.messaging.support.ChannelInterceptor;
-import org.springframework.messaging.support.MessageHeaderAccessor;
-import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
-import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
-import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
-
-/**
- * WebSocket 配置
- *
- *
- * @since 2.4.0
- */
-@Configuration
-@EnableWebSocketMessageBroker // 启用WebSocket消息代理功能和配置STOMP协议,实现实时双向通信和消息传递
-@Slf4j
-public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
-
- /**
- * 注册一个端点,客户端通过这个端点进行连接
- */
- @Override
- public void registerStompEndpoints(StompEndpointRegistry registry) {
- registry
- .addEndpoint("/ws") // 注册了一个 /ws 的端点
- .setAllowedOriginPatterns("*") // 允许跨域的 WebSocket 连接
- .withSockJS(); // 启用 SockJS (浏览器不支持WebSocket,SockJS 将会提供兼容性支持)
- registry.addEndpoint("/ws-app").setAllowedOriginPatterns("*"); // 注册了一个 /ws-app 的端点,支持 uni-app 的 ws 连接协议
- }
-
-
- /**
- * 配置消息代理
- */
- @Override
- public void configureMessageBroker(MessageBrokerRegistry registry) {
- // 客户端发送消息的请求前缀
- registry.setApplicationDestinationPrefixes("/app");
-
- // 客户端订阅消息的请求前缀,topic一般用于广播推送,queue用于点对点推送
- registry.enableSimpleBroker("/topic", "/queue");
-
- // 服务端通知客户端的前缀,可以不设置,默认为user
- registry.setUserDestinationPrefix("/user");
- }
-
-
- /**
- * 配置客户端入站通道拦截器
- *
- * 添加 ChannelInterceptor 拦截器,用于在消息发送前,从请求头中获取 token 并解析出用户信息(username),用于点对点发送消息给指定用户
- *
- * @param registration 通道注册器
- */
- @Override
- public void configureClientInboundChannel(ChannelRegistration registration) {
- registration.interceptors(new ChannelInterceptor() {
- @Override
- public Message> preSend(Message> message, MessageChannel channel) {
- StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
- // 如果是连接请求(CONNECT 命令),从请求头中取出 token 并设置到认证信息中
- if (accessor != null && StompCommand.CONNECT.equals(accessor.getCommand())) {
- // 从连接头中提取授权令牌
- String bearerToken = accessor.getFirstNativeHeader(HttpHeaders.AUTHORIZATION);
-
- // 验证令牌格式并提取用户信息
- if (StrUtil.isNotBlank(bearerToken) && bearerToken.startsWith("Bearer ")) {
- try {
- // 移除 "Bearer " 前缀,从令牌中提取用户信息(username), 并设置到认证信息中
-
- // 这里不应该用"name"
- // String username = JwtUtils.parseToken(bearerToken).get("name").toString();
- String username = JwtUtils.parseToken(bearerToken).get(JWTPayload.SUBJECT).toString();
-
- if (StrUtil.isNotBlank(username)) {
- accessor.setUser(() -> username);
- return message;
- }
- } catch (Exception e) {
- log.error("Failed to process authentication token.", e);
- }
- }
- }
- // 不是连接请求,直接放行
- return ChannelInterceptor.super.preSend(message, channel);
- }
- });
- }
-
-}
diff --git a/src/main/java/com/bellmann/controller/DeviceStaticController.java b/src/main/java/com/bellmann/controller/DeviceStaticController.java
index 48a7f56..33476cb 100644
--- a/src/main/java/com/bellmann/controller/DeviceStaticController.java
+++ b/src/main/java/com/bellmann/controller/DeviceStaticController.java
@@ -122,6 +122,7 @@ public class DeviceStaticController {
@PostMapping("/remote/unbinding")
@Operation(summary = "远程操作-解绑LogicID")
+ @PreAuthorize("@ss.hasPerm('remote:detail:unbinding::logicId')")
public Result unbindingLogicId(@RequestBody UnBindingForm form) {
return deviceStaticService.unbindingLogicId(form);
}
@@ -149,6 +150,7 @@ public class DeviceStaticController {
@GetMapping("/remote/device-link-info/{devId}")
@Operation(summary = "远程操作-获取设备链路信息")
+ @PreAuthorize("@ss.hasPerm('remote:detail:device:link')")
@PreventDuplicateSubmit
public Result> remoteDeviceLinkInfo(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId, SecurityUtils.getUsername(), RemoteOperateMsgEnum.BASIC_PARAMETER.getValue());
@@ -161,6 +163,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/compare-parameter/{devId}/{serviceId}/{serviceVerName}/{serviceName}")
@Operation(summary = "远程操作-业务参数对照")
+ @PreAuthorize("@ss.hasPerm('remote:detail:service:compare')")
@PreventDuplicateSubmit
public Result> compareParameter(@PathVariable Long devId, @PathVariable String serviceName, @PathVariable Long serviceId, @PathVariable String serviceVerName){
Long taskId = deviceStaticService.compareParameter(devId,serviceName,serviceId,serviceVerName);
@@ -174,6 +177,7 @@ public class DeviceStaticController {
@GetMapping("/remote/fttp-primary-gateway/{devId}")
@Operation(summary = "远程操作-刷新设备主网关信息")
+ @PreAuthorize("@ss.hasPerm('remote:detail:fttr:primary')")
@PreventDuplicateSubmit
public Result> remoteFTTRPrimaryGateway(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId, SecurityUtils.getUsername(), RemoteOperateMsgEnum.FTTR_CONFIG.getValue());
@@ -186,6 +190,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/fttp-sub-gateway/{devId}")
@Operation(summary = "远程操作-刷新设备子网关信息")
+ @PreAuthorize("@ss.hasPerm('remote:detail:fttr:sub')")
@PreventDuplicateSubmit
public Result remoteFTTRSubGateway(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId, SecurityUtils.getUsername(), RemoteOperateMsgEnum.FTTR_STATS.getValue());
@@ -194,6 +199,7 @@ public class DeviceStaticController {
}
@PostMapping("/remote/ip-ping")
@Operation(summary = "远程操作-设备Ping测试")
+ @PreAuthorize("@ss.hasPerm('family:remote:ping:test')")
@PreventDuplicateSubmit
public Result remoteIpPing(@RequestBody @Valid PingForm form) {
Long taskId = deviceStaticService.remoteIpPing(form);
@@ -202,6 +208,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/upload-log/{devId}")
@Operation(summary = "远程操作-获取设备日志文件")
+ @PreAuthorize("@ss.hasPerm('family:remote:terminal:log_file')")
@PreventDuplicateSubmit
public Result remoteUploadLog(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId,SecurityUtils.getUsername(),RemoteOperateMsgEnum.UPLOAD_LOG.getValue());
@@ -211,6 +218,7 @@ public class DeviceStaticController {
@GetMapping("/remote/upload-config/{devId}")
@Operation(summary = "远程操作-获取配置文件")
+ @PreAuthorize("@ss.hasPerm('family:remote:profiles:upload')")
@PreventDuplicateSubmit
public Result remoteUploadConfig(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId,SecurityUtils.getUsername(),RemoteOperateMsgEnum.UPLOAD_CONFIG.getValue());
@@ -219,6 +227,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/factory-reset/{devId}")
@Operation(summary = "远程操作-恢复设备出厂设置")
+ @PreAuthorize("@ss.hasPerm('family:remote:factory-reset')")
@PreventDuplicateSubmit
public Result remoteFactoryReset(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId,SecurityUtils.getUsername(),RemoteOperateMsgEnum.FACTORY_RESET.getValue());
@@ -227,6 +236,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/reboot/{devId}")
@Operation(summary = "远程操作-远程重启")
+ @PreAuthorize("@ss.hasPerm('family:remote:dev:reload')")
@PreventDuplicateSubmit
public Result remoteReboot(@PathVariable Long devId) {
Long taskId = remoteOperateTaskService.sendTaskByDevId(devId,SecurityUtils.getUsername(),RemoteOperateMsgEnum.REBOOT.getValue());
@@ -236,6 +246,7 @@ public class DeviceStaticController {
@PostMapping("/remote/device-monitor")
@Operation(summary = "远程操作-设备监控")
+ @PreAuthorize("@ss.hasPerm('family:remote:dev:monitor')")
@PreventDuplicateSubmit
public Result remoteDeviceMonitor(@RequestBody @Valid DeviceMonitorForm form) {
Long taskId = deviceStaticService.remoteDeviceMonitor(form);
@@ -257,6 +268,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/tr143-speed/{devId}")
@Operation(summary = "远程操作-测速")
+ @PreAuthorize("@ss.hasPerm('family:remote:speed:operation')")
@PreventDuplicateSubmit
public Result TR143Speed(@PathVariable Long devId,@RequestParam String downloadUrl) {
Long taskId = deviceStaticService.TR143Speed(devId,downloadUrl);
@@ -277,6 +289,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/soft-version-upgrade/{devId}/{fileId}")
@Operation(summary = "远程操作-软件版本升级")
+ @PreAuthorize("@ss.hasPerm('family:remote:soft_ver:upgrade')")
@PreventDuplicateSubmit
public Result remoteSoftVerUpgrade(@PathVariable Long devId,@PathVariable Long fileId){
Long taskId = remoteOperateTaskService.sendTaskByDevIdByFileId(devId, SecurityUtils.getUsername(), fileId, RemoteOperateMsgEnum.DOWNLOAD_SOFT_VER_FILE.getValue());
@@ -286,6 +299,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/register/{devId}")
@Operation(summary = "远程操作-开启终端注册页面")
+ @PreAuthorize("@ss.hasPerm('family:remote:terminal:registration')")
@PreventDuplicateSubmit
public Result remoteOpenRegister(@PathVariable Long devId){
Long taskId = deviceStaticService.remoteOpenRegister(devId);
@@ -295,6 +309,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/account-password/{devId}")
@Operation(summary = "远程操作-设备设置电信帐户密码")
+ @PreAuthorize("@ss.hasPerm('remote:detail:account:pwd')")
@PreventDuplicateSubmit
public Result setAccountPassword(@PathVariable Long devId){
Long taskId = deviceStaticService.setAccountPassword(devId);
@@ -303,6 +318,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/vendor-profile/{devId}/{fileId}")
@Operation(summary = "远程操作-厂商配置文件下发")
+ @PreAuthorize("@ss.hasPerm('family:remote:profiles:issued')")
@PreventDuplicateSubmit
public Result remoteVendorProfile(@PathVariable Long devId,@PathVariable Long fileId){
Long taskId = remoteOperateTaskService.sendTaskByDevIdByFileId(devId,SecurityUtils.getUsername(),fileId,RemoteOperateMsgEnum.DOWNLOAD_CONFIG.getValue());
@@ -312,6 +328,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/reset-service/{devId}/{serviceName}")
@Operation(summary = "远程操作-业务重置")
+ @PreAuthorize("@ss.hasPerm('remote:detail:service:reset')")
@PreventDuplicateSubmit(expire = 60)
public Result remoteResetService(@PathVariable Long devId,@PathVariable String serviceName){
deviceStaticService.remoteResetService(devId,serviceName);
@@ -326,6 +343,7 @@ public class DeviceStaticController {
@GetMapping("/remote/tree/infos/{devId}")
@Operation(summary = "远程操作-当前节点的所有子节点")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result>> getNodeChildNodes(@PathVariable Long devId,@RequestParam String nodePath){
List> nodeChildNodes = deviceStaticService.getNodeChildNodes(devId, nodePath);
@@ -333,6 +351,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/tree/param-value/{devId}")
@Operation(summary = "远程操作-获取参数")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result> getParameterValues(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree node = deviceStaticService.getParameterValues(devId, nodePath);
@@ -340,6 +359,7 @@ public class DeviceStaticController {
}
@PutMapping("/remote/tree/set-param-value/{devId}")
@Operation(summary = "远程操作-设置参数")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result setParameterValues(@PathVariable Long devId,@RequestParam String nodePath,@RequestParam String argValue){
boolean result = deviceStaticService.setParameterValues(devId, nodePath,argValue);
@@ -347,6 +367,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/tree/param-attribute/{devId}")
@Operation(summary = "远程操作-获取参数属性")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result> getParameterAttributes(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree node = deviceStaticService.getParameterAttributes(devId, nodePath);
@@ -354,6 +375,7 @@ public class DeviceStaticController {
}
@PutMapping("/remote/tree/set-param-attribute/{devId}")
@Operation(summary = "远程操作-设置参数属性")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result setParameterAttributes(@PathVariable Long devId,@RequestParam String nodePath,@RequestParam String argValue){
deviceStaticService.setParameterAttributes(devId, nodePath,argValue);
@@ -361,6 +383,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/tree/add-instance-node/{devId}")
@Operation(summary = "远程操作-增加实例")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result> remoteAddInstanceNode(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree node = deviceStaticService.addInstanceNode(devId, nodePath);
@@ -368,6 +391,7 @@ public class DeviceStaticController {
}
@GetMapping("/remote/tree/delete-instance-node/{devId}")
@Operation(summary = "远程操作-删除实例")
+ @PreAuthorize("@ss.hasPerm('family:remote:parameter:tree')")
@PreventDuplicateSubmit()
public Result remoteDeleteInstanceNode(@PathVariable Long devId,@RequestParam String nodePath){
boolean result = deviceStaticService.deleteInstanceNode(devId, nodePath);
diff --git a/src/main/java/com/bellmann/controller/DeviceTypeController.java b/src/main/java/com/bellmann/controller/DeviceTypeController.java
index 8f1287d..595c044 100644
--- a/src/main/java/com/bellmann/controller/DeviceTypeController.java
+++ b/src/main/java/com/bellmann/controller/DeviceTypeController.java
@@ -15,6 +15,7 @@ import com.bellmann.service.DeviceTypeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -70,6 +71,7 @@ public class DeviceTypeController {
@PostMapping("deletes")
@Operation(summary = "删除设备类型")
+ @PreAuthorize("@ss.hasPerm('device:type:delete')")
public Result deleteByIds(@RequestBody ArrayList ids){
return deviceTypeService.deleteByIds(ids);
@@ -90,6 +92,7 @@ public class DeviceTypeController {
}
@PostMapping("/add-device-type")
@Operation(summary = "新增设备类型")
+ @PreAuthorize("@ss.hasPerm('device:type:add')")
public Result addDeviceType(@RequestBody DeviceTypeForm form){
deviceTypeService.addDeviceType(form);
return Result.success();
diff --git a/src/main/java/com/bellmann/controller/DeviceTypeVerController.java b/src/main/java/com/bellmann/controller/DeviceTypeVerController.java
index a7c4819..c58c284 100644
--- a/src/main/java/com/bellmann/controller/DeviceTypeVerController.java
+++ b/src/main/java/com/bellmann/controller/DeviceTypeVerController.java
@@ -144,6 +144,7 @@ public class DeviceTypeVerController {
}
@Operation(summary = "新增设备类型软件版本信息")
@PostMapping("/add-type-ver/{devTypeId}")
+ @PreAuthorize("@ss.hasPerm('device:type:ver:add')")
public Result addTypeVer(@RequestBody DeviceTypeVerForm form, @PathVariable Long devTypeId){
int rows = deviceTypeVerService.addTypeVer(form,devTypeId);
return Result.success(rows);
diff --git a/src/main/java/com/bellmann/controller/OperateTask2Controller.java b/src/main/java/com/bellmann/controller/OperateTask2Controller.java
index ee8035a..0364c14 100644
--- a/src/main/java/com/bellmann/controller/OperateTask2Controller.java
+++ b/src/main/java/com/bellmann/controller/OperateTask2Controller.java
@@ -3,7 +3,9 @@ package com.bellmann.controller;
import com.bellmann.common.base.BasePageQuery;
import com.bellmann.common.result.PageResult;
+import com.bellmann.common.result.Result;
import com.bellmann.model.vo.OperateTask2TableVO;
+import com.bellmann.model.vo.OperateTaskResultVO;
import com.bellmann.service.OperateTask2Service;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -39,6 +41,10 @@ public class OperateTask2Controller {
public PageResult taskPage(@RequestBody BasePageQuery query){
return operateTask2Service.taskPage(query);
}
-
+ @GetMapping("/task-result/{taskId}")
+ @Operation(summary = "设备任务详细信息")
+ public Result taskResult(@PathVariable Long taskId){
+ return Result.success(operateTask2Service.taskResult(taskId));
+ }
}
diff --git a/src/main/java/com/bellmann/controller/OrderInfoController.java b/src/main/java/com/bellmann/controller/OrderInfoController.java
index df25367..2109d22 100644
--- a/src/main/java/com/bellmann/controller/OrderInfoController.java
+++ b/src/main/java/com/bellmann/controller/OrderInfoController.java
@@ -35,6 +35,7 @@ public class OrderInfoController {
private final OrderInfoService orderInfoService;
@PostMapping("page")
+ @PreAuthorize("@ss.hasPerm('order:index:query')")
@Operation(summary = "工单管理表格分页")
public PageResult page(@RequestBody SelectQuery query){
@@ -49,6 +50,7 @@ public class OrderInfoController {
}
@PutMapping("update-order-status/{orderId}/{orderStatus}")
@Operation(summary = "修改工单状态")
+ @PreAuthorize("@ss.hasPerm('order:detail:update:status')")
public Result updateOrderStatus(@PathVariable Long orderId, @PathVariable String orderStatus){
return orderInfoService.updateOrderStatus(orderId,orderStatus);
}
@@ -66,6 +68,7 @@ public class OrderInfoController {
@PostMapping("update-form")
@Operation(summary = "修改工单表单")
+ @PreAuthorize("@ss.hasPerm('order:detail:update')")
public Result updateForm(@RequestBody ModifyOrderForm form){
return orderInfoService.updateForm(form);
}
@@ -78,8 +81,8 @@ public class OrderInfoController {
}
@PostMapping("device-order/page")
- @PreAuthorize("@ss.hasPerm('family:operate:order:execute')")
@Operation(summary = "设备工单表格分页")
+ @PreAuthorize("@ss.hasPerm('remote:detail:device:order')")
public PageResult deviceOrderPage(@RequestBody DeviceOrderQuery query){
Page page = orderInfoService.deviceOrderPage(query);
@@ -93,6 +96,7 @@ public class OrderInfoController {
@PostMapping("/merger-order")
@Operation(summary = "合并工单")
+ @PreAuthorize("@ss.hasPerm('')")
public Result mergeOrder(@RequestBody MergeOrderForm form){
return orderInfoService.mergeOrder(form);
}
diff --git a/src/main/java/com/bellmann/controller/SysUserController.java b/src/main/java/com/bellmann/controller/SysUserController.java
index 2d27495..b1707ee 100644
--- a/src/main/java/com/bellmann/controller/SysUserController.java
+++ b/src/main/java/com/bellmann/controller/SysUserController.java
@@ -7,27 +7,25 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.bellmann.common.result.PageResult;
import com.bellmann.common.result.Result;
import com.bellmann.common.util.ExcelUtils;
-import com.bellmann.plugin.dupsubmit.annotation.PreventDuplicateSubmit;
-import com.bellmann.plugin.easyexcel.UserImportListener;
-import com.bellmann.model.vo.UserImportVO;
-import com.bellmann.model.form.UserForm;
import com.bellmann.model.entity.SysUser;
+import com.bellmann.model.form.PwdForm;
+import com.bellmann.model.form.UserForm;
import com.bellmann.model.query.UserPageQuery;
import com.bellmann.model.vo.UserExportVO;
+import com.bellmann.model.vo.UserImportVO;
import com.bellmann.model.vo.UserInfoVO;
import com.bellmann.model.vo.UserPageVO;
-import com.bellmann.security.util.SecurityUtils;
+import com.bellmann.plugin.dupsubmit.annotation.PreventDuplicateSubmit;
+import com.bellmann.plugin.easyexcel.UserImportListener;
import com.bellmann.service.SysUserService;
+import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springdoc.api.annotations.ParameterObject;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-
-
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
@@ -169,4 +167,12 @@ public class SysUserController {
.doWrite(exportUserList);
}
+ @PostMapping("/update-user-pwd")
+ @Operation(summary = "用户修改密码")
+ public Result updateUserPwd(@RequestBody PwdForm form){
+ boolean result = userService.updateUserPwd(form);
+ return Result.judge(result);
+
+ }
+
}
diff --git a/src/main/java/com/bellmann/controller/Tr069VerController.java b/src/main/java/com/bellmann/controller/Tr069VerController.java
index 2a4dae7..85d1b51 100644
--- a/src/main/java/com/bellmann/controller/Tr069VerController.java
+++ b/src/main/java/com/bellmann/controller/Tr069VerController.java
@@ -15,6 +15,7 @@ import com.bellmann.service.Tr069VerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.io.InputStream;
@@ -61,6 +62,7 @@ public class Tr069VerController {
}
@PostMapping("/add")
@Operation(summary = "新增tr069记录")
+ @PreAuthorize("@ss.hasPerm('tr069:index:add')")
public Result addTr069Form(@RequestBody Tr069VerForm editTr069Form){
return Result.success(tr069VerService.addTr069Form(editTr069Form));
}
diff --git a/src/main/java/com/bellmann/controller/WebsocketController.java b/src/main/java/com/bellmann/controller/WebsocketController.java
deleted file mode 100644
index 6e25dc8..0000000
--- a/src/main/java/com/bellmann/controller/WebsocketController.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.bellmann.controller;
-
-import com.bellmann.model.dto.ChatMessage;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.messaging.handler.annotation.DestinationVariable;
-import org.springframework.messaging.handler.annotation.MessageMapping;
-import org.springframework.messaging.handler.annotation.SendTo;
-import org.springframework.messaging.simp.SimpMessagingTemplate;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.security.Principal;
-
-/**
- * WebSocket 测试控制器
- *
- *
- * @since 2.3.0
- */
-@RestController
-@RequestMapping("/websocket")
-@RequiredArgsConstructor
-@Slf4j
-public class WebsocketController {
-
- private final SimpMessagingTemplate messagingTemplate;
-
-
- /**
- * 广播发送消息
- *
- * @param message 消息内容
- */
- @MessageMapping("/sendToAll")
- @SendTo("/topic/notice")
- public String sendToAll(String message) {
- return "服务端通知: " + message;
- }
-
- /**
- * 点对点发送消息
- *
- * 模拟 张三 给 李四 发送消息场景
- *
- * @param principal 当前用户
- * @param username 接收消息的用户
- * @param message 消息内容
- */
- @MessageMapping("/sendToUser/{username}")
- public void sendToUser(Principal principal, @DestinationVariable String username, String message) {
-
- String sender = principal.getName(); // 发送人
- String receiver = username; // 接收人
-
- log.info("发送人:{}; 接收人:{}", sender, receiver);
- // 发送消息给指定用户,拼接后路径 /user/{receiver}/queue/greeting
- messagingTemplate.convertAndSendToUser(receiver, "/queue/greeting", new ChatMessage(sender, message));
- }
-
-}
diff --git a/src/main/java/com/bellmann/mapper/OperateTask2Mapper.java b/src/main/java/com/bellmann/mapper/OperateTask2Mapper.java
index 48a09c0..e1657ae 100644
--- a/src/main/java/com/bellmann/mapper/OperateTask2Mapper.java
+++ b/src/main/java/com/bellmann/mapper/OperateTask2Mapper.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bellmann.model.bo.OperateTask2TableBO;
import com.bellmann.model.entity.OperateTask2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.bellmann.model.vo.OperateTaskResultVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -25,4 +26,7 @@ public interface OperateTask2Mapper extends BaseMapper {
OperateTask2 getLatestTaskByOperateName(@Param("devId") Long devId, @Param("operateName") String operateName);
Page taskPage(Page page);
+
+ OperateTaskResultVO taskResult(@Param("taskId") Long taskId);
+
}
diff --git a/src/main/java/com/bellmann/mapper/SysUserMapper.java b/src/main/java/com/bellmann/mapper/SysUserMapper.java
index 0336ac4..2afc5d0 100644
--- a/src/main/java/com/bellmann/mapper/SysUserMapper.java
+++ b/src/main/java/com/bellmann/mapper/SysUserMapper.java
@@ -2,14 +2,13 @@ package com.bellmann.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.bellmann.model.form.UserForm;
-import com.bellmann.plugin.mybatis.annotation.DataPermission;
import com.bellmann.model.bo.UserBO;
-import com.bellmann.model.entity.SysUser;
import com.bellmann.model.dto.UserAuthInfo;
+import com.bellmann.model.entity.SysUser;
+import com.bellmann.model.form.UserForm;
import com.bellmann.model.query.UserPageQuery;
import com.bellmann.model.vo.UserExportVO;
-import com.bellmann.security.model.SysUserDetails;
+import com.bellmann.plugin.mybatis.annotation.DataPermission;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
diff --git a/src/main/java/com/bellmann/model/form/PwdForm.java b/src/main/java/com/bellmann/model/form/PwdForm.java
new file mode 100644
index 0000000..44c4c9a
--- /dev/null
+++ b/src/main/java/com/bellmann/model/form/PwdForm.java
@@ -0,0 +1,14 @@
+package com.bellmann.model.form;
+
+import lombok.Data;
+
+@Data
+public class PwdForm {
+
+
+ private String oldPwd;
+
+ private String newPwd;
+
+ private String lastPwd;
+}
diff --git a/src/main/java/com/bellmann/model/vo/OperateTaskResultVO.java b/src/main/java/com/bellmann/model/vo/OperateTaskResultVO.java
new file mode 100644
index 0000000..ef16b68
--- /dev/null
+++ b/src/main/java/com/bellmann/model/vo/OperateTaskResultVO.java
@@ -0,0 +1,24 @@
+package com.bellmann.model.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class OperateTaskResultVO {
+
+ private Long operTaskId;
+
+ private String userName;
+
+ private String errorDesc;
+
+ private String resultState;
+
+ private Date operTaskCreateTime;
+
+ private Date operStartTime;
+
+ private Date operEndTime;
+
+}
diff --git a/src/main/java/com/bellmann/service/OperateTask2Service.java b/src/main/java/com/bellmann/service/OperateTask2Service.java
index 7d7ae3f..4b9e1f0 100644
--- a/src/main/java/com/bellmann/service/OperateTask2Service.java
+++ b/src/main/java/com/bellmann/service/OperateTask2Service.java
@@ -3,6 +3,7 @@ package com.bellmann.service;
import com.bellmann.common.base.BasePageQuery;
import com.bellmann.common.result.PageResult;
import com.bellmann.model.vo.OperateTask2TableVO;
+import com.bellmann.model.vo.OperateTaskResultVO;
/**
*
@@ -17,4 +18,6 @@ public interface OperateTask2Service {
PageResult page(Long devId, BasePageQuery query);
PageResult taskPage(BasePageQuery query);
+
+ OperateTaskResultVO taskResult(Long taskId);
}
diff --git a/src/main/java/com/bellmann/service/SysUserService.java b/src/main/java/com/bellmann/service/SysUserService.java
index 61ab46c..2c45564 100644
--- a/src/main/java/com/bellmann/service/SysUserService.java
+++ b/src/main/java/com/bellmann/service/SysUserService.java
@@ -4,6 +4,7 @@ package com.bellmann.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bellmann.model.entity.SysUser;
+import com.bellmann.model.form.PwdForm;
import com.bellmann.model.form.UserForm;
import com.bellmann.model.dto.UserAuthInfo;
import com.bellmann.model.query.UserPageQuery;
@@ -99,4 +100,6 @@ public interface SysUserService extends IService {
* @return
*/
UserInfoVO getCurrentUserInfo();
+
+ boolean updateUserPwd(PwdForm form);
}
diff --git a/src/main/java/com/bellmann/service/impl/AuthServiceImpl.java b/src/main/java/com/bellmann/service/impl/AuthServiceImpl.java
index b13a42a..c574b6e 100644
--- a/src/main/java/com/bellmann/service/impl/AuthServiceImpl.java
+++ b/src/main/java/com/bellmann/service/impl/AuthServiceImpl.java
@@ -10,8 +10,6 @@ import cn.hutool.jwt.JWTPayload;
import com.alibaba.fastjson.JSONObject;
import com.bellmann.common.constant.SecurityConstants;
import com.bellmann.common.enums.CaptchaTypeEnum;
-import com.bellmann.common.util.HttpClientResult;
-import com.bellmann.common.util.HttpClientUtil;
import com.bellmann.common.util.HttpUtil;
import com.bellmann.common.util.RSAUtils;
import com.bellmann.config.Config4A;
@@ -35,7 +33,6 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
diff --git a/src/main/java/com/bellmann/service/impl/HistoryQueryServiceImpl.java b/src/main/java/com/bellmann/service/impl/HistoryQueryServiceImpl.java
index 09cfb3c..17e9072 100644
--- a/src/main/java/com/bellmann/service/impl/HistoryQueryServiceImpl.java
+++ b/src/main/java/com/bellmann/service/impl/HistoryQueryServiceImpl.java
@@ -2,7 +2,6 @@ package com.bellmann.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.bellmann.common.result.PageResult;
import com.bellmann.mapper.DeviceLogicIdBindMapper;
import com.bellmann.model.entity.DeviceLogicIdBind;
import com.bellmann.model.query.SelectQuery;
diff --git a/src/main/java/com/bellmann/service/impl/OperateTask2ServiceImpl.java b/src/main/java/com/bellmann/service/impl/OperateTask2ServiceImpl.java
index b78e6d6..a75d9cf 100644
--- a/src/main/java/com/bellmann/service/impl/OperateTask2ServiceImpl.java
+++ b/src/main/java/com/bellmann/service/impl/OperateTask2ServiceImpl.java
@@ -2,11 +2,14 @@ package com.bellmann.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bellmann.common.base.BasePageQuery;
+import com.bellmann.common.base.IBaseEnum;
+import com.bellmann.common.enums.OperateTaskStateEnum;
import com.bellmann.common.result.PageResult;
import com.bellmann.converter.OperateTask2Converter;
import com.bellmann.mapper.OperateTask2Mapper;
import com.bellmann.model.bo.OperateTask2TableBO;
import com.bellmann.model.vo.OperateTask2TableVO;
+import com.bellmann.model.vo.OperateTaskResultVO;
import com.bellmann.service.OperateTask2Service;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -43,4 +46,11 @@ public class OperateTask2ServiceImpl implements OperateTask2Service {
Page boPage = operateTask2Mapper.taskPage(page);
return PageResult.success(operateTask2Converter.pageBo2PageVo(boPage));
}
+
+ @Override
+ public OperateTaskResultVO taskResult(Long taskId) {
+ OperateTaskResultVO result = operateTask2Mapper.taskResult(taskId);
+ result.setResultState(IBaseEnum.getLabelByValue(result.getResultState(), OperateTaskStateEnum.class));
+ return result;
+ }
}
diff --git a/src/main/java/com/bellmann/service/impl/SysUserServiceImpl.java b/src/main/java/com/bellmann/service/impl/SysUserServiceImpl.java
index 9992fee..d680775 100644
--- a/src/main/java/com/bellmann/service/impl/SysUserServiceImpl.java
+++ b/src/main/java/com/bellmann/service/impl/SysUserServiceImpl.java
@@ -9,8 +9,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bellmann.common.constant.SystemConstants;
+import com.bellmann.common.exception.BusinessException;
+import com.bellmann.common.result.ResultCode;
import com.bellmann.common.util.DateUtils;
import com.bellmann.converter.UserConverter;
+import com.bellmann.model.form.PwdForm;
import com.bellmann.security.util.SecurityUtils;
import com.bellmann.mapper.SysUserMapper;
import com.bellmann.model.dto.UserAuthInfo;
@@ -23,6 +26,7 @@ import com.bellmann.model.vo.UserInfoVO;
import com.bellmann.model.vo.UserPageVO;
import com.bellmann.security.service.PermissionService;
import com.bellmann.service.*;
+import com.zznode.cap.client.system.SecurityService;
import lombok.RequiredArgsConstructor;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
@@ -255,5 +259,18 @@ public class SysUserServiceImpl extends ServiceImpl impl
return userInfoVO;
}
-
+ @Override
+ public boolean updateUserPwd(PwdForm form) {
+ String newPwd = form.getNewPwd();
+ String lastPwd = form.getLastPwd();
+ String oldPwd = form.getOldPwd();
+ if (!lastPwd.equalsIgnoreCase(newPwd)){
+ throw new BusinessException(ResultCode.THE_PASSWORD_IS_INCONSISTENT_TWICE);
+ }
+ int result = SecurityService.changePwd(SecurityUtils.getUsername(),oldPwd,newPwd);
+ if (result<0){
+ throw new BusinessException(ResultCode.FAILED_TO_CHANGE_THE_PASSWORD);
+ }
+ return true;
+ }
}
diff --git a/src/main/resources/mapper/DeviceStaticMapper.xml b/src/main/resources/mapper/DeviceStaticMapper.xml
index 7df2d6c..e0eaf20 100644
--- a/src/main/resources/mapper/DeviceStaticMapper.xml
+++ b/src/main/resources/mapper/DeviceStaticMapper.xml
@@ -34,7 +34,7 @@
and s.dev_ad_no = #{value}
- and s.dev_sno = #{value}
+ and REVERSE(s.dev_sno) LIKE CONCAT('',reverse(#{value}),'%')
and itms_customer.cust_name = #{value}
@@ -236,11 +236,20 @@
and s.dev_ad_no = #{value}
- and s.dev_sno = #{value}
+ and REVERSE(s.dev_sno) LIKE CONCAT('',reverse(#{value}),'%')
and itms_customer.cust_name = #{value}
+
+ and dy.DEV_IP = #{value}
+
+
+ and s.DEV_PPPOE = #{value}
+
+
+ and s.DEV_REMARK4 LIKE CONCAT('%',#{value},'^%')
+
diff --git a/src/main/resources/mapper/OperateTask2Mapper.xml b/src/main/resources/mapper/OperateTask2Mapper.xml
index 8b358fe..d835731 100644
--- a/src/main/resources/mapper/OperateTask2Mapper.xml
+++ b/src/main/resources/mapper/OperateTask2Mapper.xml
@@ -117,4 +117,20 @@
INNER JOIN itms_device_static cc ON aa.dev_id = cc.dev_id
order by aa.oper_task_create_time desc
+
+
diff --git a/src/test/java/com/bellmann/DemoTest.java b/src/test/java/com/bellmann/DemoTest.java
index 2a67d91..92f9b2f 100644
--- a/src/test/java/com/bellmann/DemoTest.java
+++ b/src/test/java/com/bellmann/DemoTest.java
@@ -2,13 +2,19 @@ package com.bellmann;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.bellmann.common.util.RSAUtils;
import com.bellmann.config.Config4A;
+import com.bellmann.mapper.SysRoleMapper;
+import com.bellmann.mapper.SysUserMapper;
+import com.bellmann.mapper.SysUserRoleMapper;
+import com.bellmann.model.entity.SysUser;
import com.bellmann.model.login.BsOrCsResponeResult;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.security.crypto.password.PasswordEncoder;
@SpringBootTest
@Slf4j
@@ -18,6 +24,18 @@ public class DemoTest {
@Autowired
private Config4A config4A;
+ @Autowired
+ private SysUserMapper userMapper;
+
+ @Autowired
+ private SysUserRoleMapper userRoleMapper;
+
+ @Autowired
+ private SysRoleMapper roleMapper;
+
+ @Autowired
+ private PasswordEncoder passwordEncoder;
+
@Test
public void test1() {
BsOrCsResponeResult bsOrCsResponeResult = new BsOrCsResponeResult();
@@ -36,4 +54,11 @@ public class DemoTest {
}
log.info("token success : {}", token);
}
+
+ @Test
+ public void test2(){
+ userMapper.update(null,new LambdaUpdateWrapper()
+ .set(SysUser::getPassword,passwordEncoder.encode("bm2024!#*")));
+
+ }
}