From 50443e5ae8b60631522e934cbcc18c5826d9986d Mon Sep 17 00:00:00 2001 From: bynt Date: Thu, 6 Jan 2022 13:52:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B6=88=E6=81=AF=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=20=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=87=8F=E5=AF=BC?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad-platform-common/pom.xml | 11 ++++++ .../com/baiye/feign/FeignConfiguration.java | 32 ++++++++++++++++ .../src/main/resources/bootstrap.yml | 2 +- .../com/baiye/model/dto/UserFavorOfExcel.java | 38 +++++++++++++++++++ .../com/baiye/feign/SendMessageClient.java | 8 ++++ .../com/baiye/feign/SendMessageFallback.java | 5 +++ .../security/config/SpringSecurityConfig.java | 9 +++-- .../system/domain/MessageNotification.java | 18 ++++++--- .../modules/system/domain/UserMessage.java | 8 ++++ .../MessageNotificationRepository.java | 12 ++++++ .../repository/UserMessageRepository.java | 13 +++++++ .../rest/MessageNotificationController.java | 8 ++++ .../modules/system/rest/UserController.java | 25 ++++++++++++ .../system/rest/UserMessageController.java | 8 +++- .../service/MessageNotificationService.java | 9 +++++ .../system/service/UserMessageService.java | 10 +++++ .../service/dto/UserMessageQueryCriteria.java | 3 ++ .../impl/MessageNotificationServiceImpl.java | 19 ++++++---- .../service/impl/UserMessageServiceImpl.java | 12 +++++- .../module/controller/ClueController.java | 1 + .../src/main/resources/application.yml | 2 +- 21 files changed, 231 insertions(+), 22 deletions(-) create mode 100644 ad-platform-common/src/main/java/com/baiye/feign/FeignConfiguration.java create mode 100644 ad-platform-pojo/src/main/java/com/baiye/model/dto/UserFavorOfExcel.java diff --git a/ad-platform-common/pom.xml b/ad-platform-common/pom.xml index cb4cf5e0..b53c3293 100644 --- a/ad-platform-common/pom.xml +++ b/ad-platform-common/pom.xml @@ -113,6 +113,17 @@ yauaa + + org.springframework.cloud + spring-cloud-starter-openfeign + + + + org.springframework.security + spring-security-web + + + diff --git a/ad-platform-common/src/main/java/com/baiye/feign/FeignConfiguration.java b/ad-platform-common/src/main/java/com/baiye/feign/FeignConfiguration.java new file mode 100644 index 00000000..17f7f87e --- /dev/null +++ b/ad-platform-common/src/main/java/com/baiye/feign/FeignConfiguration.java @@ -0,0 +1,32 @@ +package com.baiye.feign; + +import com.baiye.constant.SecurityConstants; +import feign.RequestInterceptor; +import feign.RequestTemplate; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author Enzo + * @date : 2022/1/4 + */ +@Configuration +@Slf4j +public class FeignConfiguration implements RequestInterceptor { + @Override + public void apply(RequestTemplate requestTemplate) { + ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + HttpServletRequest request = attributes.getRequest(); + // HeaderConstants.TOKEN_HEADER_NAME 替换为自己的请求头名称,下同 + String token = request.getHeader(SecurityConstants.AUTHORIZATION); + if(token == null){ + log.info("--请求中未携带token......."); + return; + } + requestTemplate.header(SecurityConstants.AUTHORIZATION, token); + } +} diff --git a/ad-platform-gateway/src/main/resources/bootstrap.yml b/ad-platform-gateway/src/main/resources/bootstrap.yml index 8b55abe7..be05edf4 100644 --- a/ad-platform-gateway/src/main/resources/bootstrap.yml +++ b/ad-platform-gateway/src/main/resources/bootstrap.yml @@ -3,7 +3,7 @@ server: spring: application: - name: ad-platform-gateways + name: @artifactId@ cloud: nacos: discovery: diff --git a/ad-platform-pojo/src/main/java/com/baiye/model/dto/UserFavorOfExcel.java b/ad-platform-pojo/src/main/java/com/baiye/model/dto/UserFavorOfExcel.java new file mode 100644 index 00000000..104f4e13 --- /dev/null +++ b/ad-platform-pojo/src/main/java/com/baiye/model/dto/UserFavorOfExcel.java @@ -0,0 +1,38 @@ +package com.baiye.model.dto; + +import lombok.Data; + +/** + * @author Enzo + * @date : 2022/1/6 + */ +@Data +public class UserFavorOfExcel { + + /** + * 昵称 + */ + private String nickName; + + /** + * 邮箱 + */ + private String email; + + + /** + * 号码 + */ + private String phone; + + /** + * 性别 + */ + private String gender; + + /** + * 密码 + */ + private String password; + +} diff --git a/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageClient.java b/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageClient.java index 6f581c88..3a8e1d6d 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageClient.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageClient.java @@ -22,4 +22,12 @@ public interface SendMessageClient { */ @PostMapping(API_PREFIX + "/websocket/message") CommonResponse sendWebSocket(@RequestBody SendWebSocketDTO sendWebSocketDTO); + + /** + * 发送websocket 消息 + * @param sendWebSocketDTO dto + * @return 返回消息 + */ + @PostMapping(API_PREFIX + "/websocket/save") + CommonResponse saveMessage(@RequestBody SendWebSocketDTO sendWebSocketDTO); } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageFallback.java b/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageFallback.java index 28aef5e2..1f4eb986 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageFallback.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/feign/SendMessageFallback.java @@ -14,4 +14,9 @@ public class SendMessageFallback implements SendMessageClient { public CommonResponse sendWebSocket(SendWebSocketDTO sendWebSocketDTO) { return null; } + + @Override + public CommonResponse saveMessage(SendWebSocketDTO sendWebSocketDTO) { + return null; + } } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/security/config/SpringSecurityConfig.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/security/config/SpringSecurityConfig.java index 0be4f6c7..e2e5ff07 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/security/config/SpringSecurityConfig.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/security/config/SpringSecurityConfig.java @@ -122,12 +122,13 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/file/**").permitAll() // 阿里巴巴 druid .antMatchers("/druid/**").permitAll() - .antMatchers("/api/task/saveTask").permitAll() // 放行OPTIONS请求 .antMatchers(HttpMethod.OPTIONS, "/**").permitAll() - .antMatchers( "/api/users/admin").permitAll() - .antMatchers( "/api/task/query").permitAll() - .antMatchers( "/api/organize/queryAll").permitAll() + // TODO 权限待测试 Enzo + /*.antMatchers("/api/task/saveTask").permitAll() + .antMatchers( "/api/users/admin").permitAll() + .antMatchers( "/api/task/query").permitAll() + .antMatchers( "/api/organize/queryAll").permitAll()*/ // 自定义匿名访问所有url放行:允许匿名和带Token访问,细腻化到每个 Request 类型 // GET .antMatchers(HttpMethod.GET, anonymousUrls.get(RequestMethodEnum.GET.getType()).toArray(new String[0])).permitAll() diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/MessageNotification.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/MessageNotification.java index 3fb2adf6..0afa6023 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/MessageNotification.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/MessageNotification.java @@ -35,6 +35,8 @@ import java.sql.Timestamp; @Table(name="tb_message_notification") public class MessageNotification implements Serializable { + private static final long serialVersionUID = 5340902902914777841L; + @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -57,13 +59,17 @@ public class MessageNotification implements Serializable { @ApiModelProperty(value = "是否使用") private Boolean isEnable; - @Column(name = "start_time") - @ApiModelProperty(value = "开始时间") - private Timestamp startTime; + @Column(name = "is_top") + @ApiModelProperty(value = "是否使用") + private Boolean isTop; + + @Column(name = "type") + @ApiModelProperty(value = "类型 1公告 2自提醒") + private Integer type; - @Column(name = "end_time") - @ApiModelProperty(value = "结束时间") - private Timestamp endTime; + @Column(name = "point_time") + @ApiModelProperty(value = "时间点") + private Integer pointTime; @Column(name = "create_by") @ApiModelProperty(value = "创建者") diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/UserMessage.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/UserMessage.java index 74c42596..0b956f0c 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/UserMessage.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/domain/UserMessage.java @@ -47,6 +47,10 @@ public class UserMessage implements Serializable { @ApiModelProperty(value = "消息id") private Long messageId; + @Column(name = "type") + @ApiModelProperty(value = "消息状态") + private Integer type; + @Column(name = "is_read") @ApiModelProperty(value = "是否已读") private Boolean isRead = Boolean.TRUE; @@ -67,6 +71,10 @@ public class UserMessage implements Serializable { @ApiModelProperty(value = "消息内容") private String messageContext; + @Column(name = "is_top") + @ApiModelProperty(value = "是否置顶") + private Boolean isTop; + @Column(name = "level") @ApiModelProperty(value = "消息等级") private Integer level; diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/MessageNotificationRepository.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/MessageNotificationRepository.java index 2c379eed..6e96de0a 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/MessageNotificationRepository.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/MessageNotificationRepository.java @@ -18,6 +18,8 @@ package com.baiye.modules.system.repository; import com.baiye.modules.system.domain.MessageNotification; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; /** * @website https://el-admin.vip @@ -25,4 +27,14 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; * @date 2021-12-30 **/ public interface MessageNotificationRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 修改状态 + * @param flag + * @param messageId + * @return + */ + @Modifying + @Query(value = "update MessageNotification set isEnable = ?1 where id = ?2") + int updateMessageEnableByMessage(Boolean flag, Long messageId); } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/UserMessageRepository.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/UserMessageRepository.java index 78616d72..493420d8 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/UserMessageRepository.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/repository/UserMessageRepository.java @@ -18,6 +18,8 @@ package com.baiye.modules.system.repository; import com.baiye.modules.system.domain.UserMessage; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; /** * @website https://el-admin.vip @@ -25,4 +27,15 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor; * @date 2021-12-30 **/ public interface UserMessageRepository extends JpaRepository, JpaSpecificationExecutor { + + /** + * 删除消息 + * + * @param num + * @param messageId + * @return + */ + @Modifying + @Query(value = "update UserMessage set type = ?1 where messageId = ?1") + Boolean deleteUserMessageByMessageId(Integer num, Long messageId); } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/MessageNotificationController.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/MessageNotificationController.java index a9b5dd10..fb744d8a 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/MessageNotificationController.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/MessageNotificationController.java @@ -63,6 +63,8 @@ public class MessageNotificationController { return new ResponseEntity<>(messageNotificationService.create(messageNotificationDto),HttpStatus.CREATED); } + + @PutMapping @ApiOperation("修改message") public ResponseEntity update(@Validated @RequestBody MessageNotificationDto messageNotificationDto){ @@ -76,4 +78,10 @@ public class MessageNotificationController { messageNotificationService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } + + @GetMapping("/changeMessage") + @ApiOperation("撤销消息") + public ResponseEntity withdrawMessage(Boolean flag,Long messageId){ + return new ResponseEntity<>(messageNotificationService.withdrawMessage(flag,messageId),HttpStatus.OK); + } } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserController.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserController.java index dff4a1d9..083a2934 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserController.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserController.java @@ -15,10 +15,15 @@ */ package com.baiye.modules.system.rest; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.poi.excel.ExcelReader; +import cn.hutool.poi.excel.ExcelUtil; import com.baiye.config.properties.RsaProperties; import com.baiye.constant.RoleNumberConstants; import com.baiye.exception.BadRequestException; +import com.baiye.model.dto.UserFavorOfExcel; import com.baiye.modules.system.domain.Dept; import com.baiye.modules.system.domain.User; import com.baiye.modules.system.domain.vo.UserPassVo; @@ -134,6 +139,26 @@ public class UserController { return new ResponseEntity<>(HttpStatus.NO_CONTENT); } + @ApiOperation("导入用户") + @PostMapping(value = "importUsers") + public ResponseEntity indexConvert(@RequestParam("file") MultipartFile file) throws IOException { + + ExcelReader reader = ExcelUtil.getReader(file.getInputStream()); + List list = reader.readAll(UserFavorOfExcel.class); + if (CollUtil.isNotEmpty(list)) { + User user; + for (UserFavorOfExcel userFavorOfExcel : list) { + user = new User(); + BeanUtil.copyProperties(userFavorOfExcel, user); + if (user.getPassword() == null) { + user.setPassword(passwordEncoder.encode("123456")); + } + userService.create(user); + } + } + return new ResponseEntity<>(HttpStatus.OK); + } + @ApiOperation("删除用户") @DeleteMapping @PreAuthorize("@el.check('user:del')") diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserMessageController.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserMessageController.java index c7b3d2e8..27270bec 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserMessageController.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/rest/UserMessageController.java @@ -1,9 +1,8 @@ package com.baiye.modules.system.rest; +import com.baiye.constant.DefaultNumberConstants; import com.baiye.modules.system.domain.UserMessage; import com.baiye.modules.system.service.UserMessageService; -import com.baiye.modules.system.service.dto.MessageNotificationDto; -import com.baiye.modules.system.service.dto.UserMessageDto; import com.baiye.modules.system.service.dto.UserMessageQueryCriteria; import com.baiye.util.SecurityUtils; import io.swagger.annotations.Api; @@ -25,9 +24,11 @@ import org.springframework.web.bind.annotation.*; public class UserMessageController { private final UserMessageService userMessageService; + @ApiOperation("查询任务(分页)") @GetMapping("/queryAll") public ResponseEntity queryAll(UserMessageQueryCriteria criteria){ + criteria.setType(DefaultNumberConstants.ONE_NUMBER); criteria.setUserId(SecurityUtils.getCurrentUserId()); return new ResponseEntity<>(userMessageService.queryAll(criteria), HttpStatus.OK); } @@ -39,4 +40,7 @@ public class UserMessageController { userMessageService.update(userMessage); return new ResponseEntity<>(HttpStatus.NO_CONTENT); } + + + } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/MessageNotificationService.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/MessageNotificationService.java index e1aa7fe3..f630d66f 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/MessageNotificationService.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/MessageNotificationService.java @@ -80,4 +80,13 @@ public interface MessageNotificationService { * @throws IOException / */ void download(List all, HttpServletResponse response) throws IOException; + + /** + * 撤销消息 + * + * @param flag + * @param messageId + * @return + */ + Boolean withdrawMessage(Boolean flag, Long messageId); } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/UserMessageService.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/UserMessageService.java index cce9818c..5652d616 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/UserMessageService.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/UserMessageService.java @@ -90,4 +90,14 @@ public interface UserMessageService { * @return */ Boolean createUserMessage(List longList, MessageNotification messageNotification); + + /** + * 删除消息 + * + * @param num + * @param messageId + * @return + */ + Boolean deleteAllByMessageId(Integer num, Long messageId); + } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/dto/UserMessageQueryCriteria.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/dto/UserMessageQueryCriteria.java index ce1cf22d..311e0bfe 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/dto/UserMessageQueryCriteria.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/dto/UserMessageQueryCriteria.java @@ -28,4 +28,7 @@ public class UserMessageQueryCriteria{ @Query private Long userId; + + @Query + private Integer type; } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/MessageNotificationServiceImpl.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/MessageNotificationServiceImpl.java index a8ec9f58..f54c0730 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/MessageNotificationServiceImpl.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/MessageNotificationServiceImpl.java @@ -91,11 +91,8 @@ public class MessageNotificationServiceImpl implements MessageNotificationServic Long userId = SecurityUtils.getCurrentUserId(); UserDto userDto = JSONUtil.toBean(SecurityUtils.getUser(), UserDto.class); messageNotificationDto.setUserId(userId); - if (messageNotificationDto.getIsTop() != null - && messageNotificationDto.getIsTop()) { - longList.add(userId); - messageNotificationDto.setLevel(DefaultNumberConstants.FOUR_NUMBER); - } + longList.add(userId); + messageNotificationDto.setLevel(DefaultNumberConstants.FOUR_NUMBER); // 级别进行排序 if (Boolean.TRUE.equals(userDto.getIsGroup())) { @@ -152,8 +149,6 @@ public class MessageNotificationServiceImpl implements MessageNotificationServic map.put("消息内容", messageNotificationDto.getMessageContext()); map.put("0表示置顶 1超级管理员 2管理员 3组长消息", messageNotificationDto.getLevel()); map.put("是否使用", messageNotificationDto.getIsEnable()); - map.put("开始时间", messageNotificationDto.getStartTime()); - map.put("结束时间", messageNotificationDto.getEndTime()); map.put("创建者", messageNotificationDto.getCreateBy()); map.put("更新者", messageNotificationDto.getUpdateBy()); map.put("创建日期", messageNotificationDto.getCreateTime()); @@ -162,4 +157,14 @@ public class MessageNotificationServiceImpl implements MessageNotificationServic } FileUtil.downloadExcel(list, response); } + + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean withdrawMessage(Boolean flag, Long messageId) { + messageNotificationRepository + .updateMessageEnableByMessage(flag, messageId); + + return userMessageService.deleteAllByMessageId(Boolean.TRUE.equals(flag) + ? DefaultNumberConstants.ONE_NUMBER : DefaultNumberConstants.MINUS_ONE_NUMBER, messageId); + } } diff --git a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserMessageServiceImpl.java b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserMessageServiceImpl.java index d69ed047..4b08f5a6 100644 --- a/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserMessageServiceImpl.java +++ b/manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserMessageServiceImpl.java @@ -72,6 +72,8 @@ public class UserMessageServiceImpl implements UserMessageService { @Override public List queryAll(UserMessageQueryCriteria criteria){ Sort sort = Sort.by(Sort.Direction.ASC, "level"). + and(Sort.by(Sort.Direction.DESC, "type")). + and(Sort.by(Sort.Direction.DESC, "isRead")). and(Sort.by(Sort.Direction.DESC, "createTime")); return userMessageMapper.toDto(userMessageRepository.findAll( (root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), sort)); @@ -135,10 +137,12 @@ public class UserMessageServiceImpl implements UserMessageService { userMessage = new UserMessage(); BeanUtil.copyProperties(messageNotification, userMessage); userMessage.setMessageId(messageNotification.getId()); + userMessage.setType(DefaultNumberConstants.ONE_NUMBER); userMessage.setUserId(aLong); userMessageRepository.save(userMessage); } } + // TODO发送消息 SendWebSocketDTO sendWebSocketDTO = new SendWebSocketDTO(); sendWebSocketDTO.setUserIds(longList); SendWebSocketDTO.SendMessage sendMessage = new SendWebSocketDTO.SendMessage(); @@ -146,7 +150,13 @@ public class UserMessageServiceImpl implements UserMessageService { sendMessage.setCode(DefaultNumberConstants.TEN_NUMBER); sendMessage.setMessage(messageNotification.getMessageContext()); sendWebSocketDTO.setData(sendMessage); - sendMessageClient.sendWebSocket(sendWebSocketDTO); + sendMessageClient.saveMessage(sendWebSocketDTO); return Boolean.TRUE; } + + @Override + public Boolean deleteAllByMessageId(Integer num, Long messageId) { + return userMessageRepository.deleteUserMessageByMessageId(num, messageId); + } + } diff --git a/services/ad-platform-source/src/main/java/com/baiye/module/controller/ClueController.java b/services/ad-platform-source/src/main/java/com/baiye/module/controller/ClueController.java index 2b5792e2..466ec5db 100644 --- a/services/ad-platform-source/src/main/java/com/baiye/module/controller/ClueController.java +++ b/services/ad-platform-source/src/main/java/com/baiye/module/controller/ClueController.java @@ -8,6 +8,7 @@ import com.baiye.model.dto.DistributeResponseDTO; import com.baiye.module.entity.ClueMiddle; import com.baiye.module.service.ClueService; import com.baiye.module.service.dto.ClueRecordCriteria; +import com.baiye.util.SecurityUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; diff --git a/services/ad-platform-source/src/main/resources/application.yml b/services/ad-platform-source/src/main/resources/application.yml index 1ab15b83..1053f29a 100644 --- a/services/ad-platform-source/src/main/resources/application.yml +++ b/services/ad-platform-source/src/main/resources/application.yml @@ -34,4 +34,4 @@ spring: #hutool雪花算法 snowflake: workerId: 9 - datacenterId: 9 \ No newline at end of file + datacenterId: 9