fix: 第一版bug修复

master
李小林 7 months ago
parent 542d11370c
commit 2f4cc28e83
  1. 2
      pom.xml
  2. 7
      src/main/java/com/bellmann/common/result/ResultCode.java
  3. 103
      src/main/java/com/bellmann/config/WebSocketConfig.java
  4. 24
      src/main/java/com/bellmann/controller/DeviceStaticController.java
  5. 3
      src/main/java/com/bellmann/controller/DeviceTypeController.java
  6. 1
      src/main/java/com/bellmann/controller/DeviceTypeVerController.java
  7. 8
      src/main/java/com/bellmann/controller/OperateTask2Controller.java
  8. 6
      src/main/java/com/bellmann/controller/OrderInfoController.java
  9. 22
      src/main/java/com/bellmann/controller/SysUserController.java
  10. 2
      src/main/java/com/bellmann/controller/Tr069VerController.java
  11. 61
      src/main/java/com/bellmann/controller/WebsocketController.java
  12. 4
      src/main/java/com/bellmann/mapper/OperateTask2Mapper.java
  13. 7
      src/main/java/com/bellmann/mapper/SysUserMapper.java
  14. 14
      src/main/java/com/bellmann/model/form/PwdForm.java
  15. 24
      src/main/java/com/bellmann/model/vo/OperateTaskResultVO.java
  16. 3
      src/main/java/com/bellmann/service/OperateTask2Service.java
  17. 3
      src/main/java/com/bellmann/service/SysUserService.java
  18. 3
      src/main/java/com/bellmann/service/impl/AuthServiceImpl.java
  19. 1
      src/main/java/com/bellmann/service/impl/HistoryQueryServiceImpl.java
  20. 10
      src/main/java/com/bellmann/service/impl/OperateTask2ServiceImpl.java
  21. 19
      src/main/java/com/bellmann/service/impl/SysUserServiceImpl.java
  22. 13
      src/main/resources/mapper/DeviceStaticMapper.xml
  23. 16
      src/main/resources/mapper/OperateTask2Mapper.xml
  24. 25
      src/test/java/com/bellmann/DemoTest.java

@ -19,7 +19,7 @@
<hutool.version>5.8.5</hutool.version>
<postgresql.version>42.6.0</postgresql.version>
<postgresql.version>42.2.27</postgresql.version>
<druid.version>1.2.16</druid.version>
<mybatis-plus.version>3.5.3.2</mybatis-plus.version>

@ -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() {

@ -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");
}
/**
* 配置客户端入站通道拦截器
* <p>
* 添加 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);
}
});
}
}

@ -122,6 +122,7 @@ public class DeviceStaticController {
@PostMapping("/remote/unbinding")
@Operation(summary = "远程操作-解绑LogicID")
@PreAuthorize("@ss.hasPerm('remote:detail:unbinding::logicId')")
public Result<String> 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<List<DeviceLinkVO>> 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<List<ServiceCompareVO>> 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<List<FTTRInfoVO>> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<String> 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<RemoteOperateResult> 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<String> 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<String> 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<String> 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<String> 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<String> 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<List<OptionTree<String>>> getNodeChildNodes(@PathVariable Long devId,@RequestParam String nodePath){
List<OptionTree<String>> 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<OptionTree<String>> getParameterValues(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree<String> 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<String> 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<OptionTree<String>> getParameterAttributes(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree<String> 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<String> 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<OptionTree<String>> remoteAddInstanceNode(@PathVariable Long devId,@RequestParam String nodePath){
OptionTree<String> 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<String> remoteDeleteInstanceNode(@PathVariable Long devId,@RequestParam String nodePath){
boolean result = deviceStaticService.deleteInstanceNode(devId, nodePath);

@ -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<String> deleteByIds(@RequestBody ArrayList<Long> 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<String> addDeviceType(@RequestBody DeviceTypeForm form){
deviceTypeService.addDeviceType(form);
return Result.success();

@ -144,6 +144,7 @@ public class DeviceTypeVerController {
}
@Operation(summary = "新增设备类型软件版本信息")
@PostMapping("/add-type-ver/{devTypeId}")
@PreAuthorize("@ss.hasPerm('device:type:ver:add')")
public Result<Integer> addTypeVer(@RequestBody DeviceTypeVerForm form, @PathVariable Long devTypeId){
int rows = deviceTypeVerService.addTypeVer(form,devTypeId);
return Result.success(rows);

@ -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<OperateTask2TableVO> taskPage(@RequestBody BasePageQuery query){
return operateTask2Service.taskPage(query);
}
@GetMapping("/task-result/{taskId}")
@Operation(summary = "设备任务详细信息")
public Result<OperateTaskResultVO> taskResult(@PathVariable Long taskId){
return Result.success(operateTask2Service.taskResult(taskId));
}
}

@ -35,6 +35,7 @@ public class OrderInfoController {
private final OrderInfoService orderInfoService;
@PostMapping("page")
@PreAuthorize("@ss.hasPerm('order:index:query')")
@Operation(summary = "工单管理表格分页")
public PageResult<OrderInfoTableVO> 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<String> 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<String> 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<OrderInfoTableVO> deviceOrderPage(@RequestBody DeviceOrderQuery query){
Page<OrderInfoTableVO> page = orderInfoService.deviceOrderPage(query);
@ -93,6 +96,7 @@ public class OrderInfoController {
@PostMapping("/merger-order")
@Operation(summary = "合并工单")
@PreAuthorize("@ss.hasPerm('')")
public Result<String> mergeOrder(@RequestBody MergeOrderForm form){
return orderInfoService.mergeOrder(form);
}

@ -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<String> updateUserPwd(@RequestBody PwdForm form){
boolean result = userService.updateUserPwd(form);
return Result.judge(result);
}
}

@ -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<Integer> addTr069Form(@RequestBody Tr069VerForm editTr069Form){
return Result.success(tr069VerService.addTr069Form(editTr069Form));
}

@ -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;
}
/**
* 点对点发送消息
* <p>
* 模拟 张三 李四 发送消息场景
*
* @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));
}
}

@ -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> {
OperateTask2 getLatestTaskByOperateName(@Param("devId") Long devId, @Param("operateName") String operateName);
Page<OperateTask2TableBO> taskPage(Page<OperateTask2TableBO> page);
OperateTaskResultVO taskResult(@Param("taskId") Long taskId);
}

@ -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;

@ -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;
}

@ -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;
}

@ -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;
/**
* <p>
@ -17,4 +18,6 @@ public interface OperateTask2Service {
PageResult<OperateTask2TableVO> page(Long devId, BasePageQuery query);
PageResult<OperateTask2TableVO> taskPage(BasePageQuery query);
OperateTaskResultVO taskResult(Long taskId);
}

@ -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<SysUser> {
* @return
*/
UserInfoVO getCurrentUserInfo();
boolean updateUserPwd(PwdForm form);
}

@ -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;

@ -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;

@ -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<OperateTask2TableBO> 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;
}
}

@ -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<SysUserMapper, SysUser> 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;
}
}

@ -34,7 +34,7 @@
and s.dev_ad_no = #{value}
</if>
<if test="column=='devSno' and column!=null and column!=''">
and s.dev_sno = #{value}
and REVERSE(s.dev_sno) LIKE CONCAT('',reverse(#{value}),'%')
</if>
<if test="column=='customName' and column!=null and column!=''">
and itms_customer.cust_name = #{value}
@ -236,11 +236,20 @@
and s.dev_ad_no = #{value}
</if>
<if test="column=='devSno' and column!=null and column!=''">
and s.dev_sno = #{value}
and REVERSE(s.dev_sno) LIKE CONCAT('',reverse(#{value}),'%')
</if>
<if test="column=='customName' and column!=null and column!=''">
and itms_customer.cust_name = #{value}
</if>
<if test="column=='devIp' and column!=null and column!=''">
and dy.DEV_IP = #{value}
</if>
<if test="column=='pppoeAccount' and column!=null and column!=''">
and s.DEV_PPPOE = #{value}
</if>
<if test="column=='logicId' and column!=null and column!=''">
and s.DEV_REMARK4 LIKE CONCAT('%',#{value},'^%')
</if>
</where>
</select>

@ -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
</select>
<select id="taskResult" resultType="com.bellmann.model.vo.OperateTaskResultVO">
SELECT
aa.oper_task_id,
aa.oper_task_create_time,
aa.user_name,
bb.error_desc,
bb.oper_start_time,
bb.oper_end_time,
bb.result_state
FROM
itms_oper_task_2 aa
INNER JOIN itms_oper_result_2 bb ON aa.oper_task_id = bb.oper_task_id
WHERE
aa.oper_task_id = #{taskId}
</select>
</mapper>

@ -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<SysUser>()
.set(SysUser::getPassword,passwordEncoder.encode("bm2024!#*")));
}
}

Loading…
Cancel
Save