diff --git a/src/main/java/com/project/ding/utils/DingUtil.java b/src/main/java/com/project/ding/utils/DingUtil.java
index b8336e8..b8ee1dd 100644
--- a/src/main/java/com/project/ding/utils/DingUtil.java
+++ b/src/main/java/com/project/ding/utils/DingUtil.java
@@ -21,8 +21,6 @@ import com.project.ding.config.DingProperties;
import com.project.ding.domain.dto.DepartmentDTO;
import com.project.ding.domain.dto.DingUserDTO;
import com.project.ding.domain.dto.UserDTO;
-import com.project.ding.domain.entity.UserEntity;
-import com.project.ding.domain.service.UserBaseService;
import io.vavr.control.Try;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,7 +34,6 @@ import com.aliyun.dingtalkoauth2_1_0.models.CreateJsapiTicketHeaders;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
-import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
@@ -56,10 +53,6 @@ public class DingUtil {
@Autowired
private Client dingTalkClient; // 之前创建好的新版 SDK Client
- @Autowired
- private UserBaseService userBaseService;
-
-
@Autowired
private DingProperties dingTalkProperties;
@@ -271,18 +264,12 @@ public class DingUtil {
}
/**
- * 发送工作通知
+ * 发送审批工作通知
*/
@Async("asycExecutor")
public void sendWorkNotice(AppealDTO appealDTO) throws DtErrorException {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- UserEntity user = userBaseService.getById(appealDTO.getUserId());
- if (user == null || StrUtil.isBlank(user.getDeptIdStr()) || !user.getDeptIdStr().contains("10549213")) {
- return;
- }
-
-
boolean approved = appealDTO.getStatus() != null && appealDTO.getStatus() == 2;
StringBuilder markdown = new StringBuilder();
markdown.append(String.format("### 【%s】中第%d题的申诉结果如下:\n\n" , appealDTO.getTaskName(),appealDTO.getQuestionSort()))
diff --git a/src/main/java/com/project/exam/domain/service/impl/NotifyExamRecordDomainServiceImpl.java b/src/main/java/com/project/exam/domain/service/impl/NotifyExamRecordDomainServiceImpl.java
index a029539..8963f96 100644
--- a/src/main/java/com/project/exam/domain/service/impl/NotifyExamRecordDomainServiceImpl.java
+++ b/src/main/java/com/project/exam/domain/service/impl/NotifyExamRecordDomainServiceImpl.java
@@ -1,13 +1,10 @@
package com.project.exam.domain.service.impl;
-import cn.hutool.core.util.StrUtil;
import com.github.tingyugetc520.ali.dingtalk.api.DtService;
import com.github.tingyugetc520.ali.dingtalk.bean.message.DtCorpConversationMessage;
import com.github.tingyugetc520.ali.dingtalk.bean.message.DtCorpConversationMsgSendResult;
import com.github.tingyugetc520.ali.dingtalk.bean.message.DtMessage;
import com.project.ding.config.DingProperties;
-import com.project.ding.domain.entity.UserEntity;
-import com.project.ding.domain.service.UserBaseService;
import com.project.ding.utils.SecurityUtils;
import com.project.exam.domain.dto.ExamRecordDTO;
import com.project.exam.domain.service.NotifyExamRecordDomainService;
@@ -27,20 +24,10 @@ public class NotifyExamRecordDomainServiceImpl implements NotifyExamRecordDomain
@Autowired
private DingProperties dingProperties;
- @Autowired
- private UserBaseService userBaseService;
-
@Override
public void notifyExamRecord(ExamRecordDTO dto) {
String userId = SecurityUtils.getUserId();
- UserEntity user = userBaseService.getById(userId);
- if(userId.equals("17456316000834265")){
-
- }else if (user == null || StrUtil.isBlank(user.getDeptIdStr()) || !user.getDeptIdStr().contains("10549213")) {
- return;
- }
-
// 不阻碍正常业务
try {
String markdown = String.format("### 【%s】考试成绩已公布,请留意查收\n\n", dto.getTaskDTO().getName()) +
diff --git a/src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java b/src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java
index 3f7b016..bd7691b 100644
--- a/src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java
+++ b/src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java
@@ -10,8 +10,6 @@ import com.github.tingyugetc520.ali.dingtalk.bean.message.DtCorpConversationMsgS
import com.github.tingyugetc520.ali.dingtalk.bean.message.DtMessage;
import com.github.tingyugetc520.ali.dingtalk.error.DtErrorException;
import com.project.ding.config.DingProperties;
-import com.project.ding.domain.entity.UserEntity;
-import com.project.ding.mapper.UserMapper;
import com.project.information.application.ProductLineApplicationService;
import com.project.task.domain.dto.TaskDTO;
import com.project.task.domain.entity.TaskEntity;
@@ -21,7 +19,6 @@ import com.project.task.domain.service.NotifyTaskDomainService;
import com.project.task.mapper.TaskMapper;
import com.project.task.mapper.TaskUserMapper;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -29,7 +26,6 @@ import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import java.util.stream.Collectors;
@Service
@Slf4j
@@ -47,9 +43,6 @@ public class NotifyTaskDomainServiceImpl implements NotifyTaskDomainService {
@Autowired
private DingProperties dingTalkProperties;
- @Autowired
- private UserMapper userMapper;
-
private final SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
@@ -70,12 +63,7 @@ public class NotifyTaskDomainServiceImpl implements NotifyTaskDomainService {
.eq(TaskUserEntity::getTaskId, task.getId()))
.stream().map(TaskUserEntity::getUserId).toList();
- List userIdFilter = userMapper.selectBatchIds(userIds).stream()
- .filter(user -> ObjectUtils.isNotEmpty(user.getDeptIdStr()))
- .filter(user -> user.getDeptIdStr().contains("10549213") || user.getId().equals("17456316000834265"))
- .map(UserEntity::getId)
- .toList();
- sendBatchNewTasks(userIdFilter , task);
+ sendBatchNewTasks(userIds , task);
}
}
@Override
@@ -93,12 +81,7 @@ public class NotifyTaskDomainServiceImpl implements NotifyTaskDomainService {
.eq(TaskUserEntity::getTaskId, task.getId()))
.stream().map(TaskUserEntity::getUserId).toList();
- List userIdFilter = userMapper.selectBatchIds(userIds).stream()
- .filter(user -> ObjectUtils.isNotEmpty(user.getDeptIdStr()))
- .filter(user -> user.getDeptIdStr().contains("10549213") || user.getId().equals("17456316000834265"))
- .map(UserEntity::getId)
- .toList();
- sendBatchDeadlineTasks(userIdFilter , task);
+ sendBatchDeadlineTasks(userIds , task);
}
}
private void sendBatchNewTasks(List userIds , TaskDTO taskDTO) {
diff --git a/src/test/java/com/project/interaction/controller/InteractionControllerTest.java b/src/test/java/com/project/interaction/controller/InteractionControllerTest.java
new file mode 100644
index 0000000..f644004
--- /dev/null
+++ b/src/test/java/com/project/interaction/controller/InteractionControllerTest.java
@@ -0,0 +1,46 @@
+package com.project.interaction.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.project.information.domain.dto.KnowledgePointDTO;
+import com.project.information.domain.entity.KnowledgePointEntity;
+import com.project.information.domain.service.KnowledgePointBaseService;
+import com.project.interaction.application.AlgorithmApplicationService;
+import org.junit.jupiter.api.Test;
+import org.junit.runner.RunWith;
+import org.mockito.internal.util.collections.Sets;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+@SpringBootTest
+@RunWith(SpringRunner.class)
+@ActiveProfiles("test")
+class InteractionControllerTest {
+
+ @Autowired
+ private AlgorithmApplicationService algorithmApplicationService;
+ @Autowired
+ private KnowledgePointBaseService knowledgePointBaseService;
+
+ @Test
+ public void test(){
+ Set idSet = Sets.newSet(
+ 708018904630296576L
+);
+ for (Long id : idSet) {
+ List list = knowledgePointBaseService.lambdaQuery()
+ .eq(KnowledgePointEntity::getInformationId, id).list().stream()
+ .map(entity -> entity.toDTO(KnowledgePointDTO::new)).toList();
+ if (CollUtil.isNotEmpty(list)) {
+ algorithmApplicationService.postToClusteringByInformationId(id , list);
+ }
+ }
+ }
+
+}
\ No newline at end of file