Browse Source

bug修复

master
luogw 1 month ago
parent
commit
145866d01c
  1. 1
      src/main/java/com/project/appeal/domain/dto/AppealDTO.java
  2. 2
      src/main/java/com/project/appeal/domain/service/Impl/SaveAppealDomainServiceImpl.java
  3. 2
      src/main/java/com/project/ding/utils/DingUtil.java
  4. 2
      src/main/java/com/project/interaction/config/WebClientConfig.java
  5. 17
      src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java
  6. 15
      src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java

1
src/main/java/com/project/appeal/domain/dto/AppealDTO.java

@ -25,6 +25,7 @@ public class AppealDTO extends BaseDTO {
private String appealUsername;
private Long examId;
private Long taskId;
private String taskName;
private String subLineName;//关联子产品线
private Long questionId;
private String questionContent; //题干

2
src/main/java/com/project/appeal/domain/service/Impl/SaveAppealDomainServiceImpl.java

@ -91,7 +91,7 @@ public class SaveAppealDomainServiceImpl implements SaveAppealDomainService {
appealDTO.setQuestionContent(questionSnapshotDTO.getQuestionContent());
appealDTO.setQuestionSort(index + 1);
appealDTO.setTaskName(examRecordDTO.getTaskName());
if (appealDTO.getStatus().equals(AppealStatusEnum.PENDING_REVIEW.getValue())) {

2
src/main/java/com/project/ding/utils/DingUtil.java

@ -274,7 +274,7 @@ public class DingUtil {
boolean approved = appealDTO.getStatus() != null && appealDTO.getStatus() == 2;
StringBuilder markdown = new StringBuilder();
markdown.append(String.format("### 【%s】中<font color=#64BCF2>第%d题</font>的申诉结果如下:\n\n" , "教育云平台知识考试",appealDTO.getQuestionSort()))
markdown.append(String.format("### 【%s】中<font color=#64BCF2>第%d题</font>的申诉结果如下:\n\n" , appealDTO.getTaskName(),appealDTO.getQuestionSort()))
.append(String.format("处理结果:%s\n\n" ,approved ? "同意" : "不同意"))
.append(String.format("处理理由:%s" , appealDTO.getReason()));

2
src/main/java/com/project/interaction/config/WebClientConfig.java

@ -22,7 +22,7 @@ public class WebClientConfig {
public WebClient algorithmWebClient() {
// 配置HTTP客户端,设置长超时以支持流式响应
HttpClient httpClient = HttpClient.create()
.responseTimeout(Duration.ofSeconds(30))
.responseTimeout(Duration.ofSeconds(60))
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)
.doOnConnected(conn -> conn
// 读超时

17
src/main/java/com/project/interaction/domain/service/impl/PostToGenerateQuestionDomainServiceImpl.java

@ -81,15 +81,16 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu
if (waitTime > 100) {
log.info(">>> [题目生成] 因限流等待了 {} ms, TaskId: {}", waitTime, taskId);
}
generateFallbackQuestions(dtoList, questionType, num);
//尝试调用算法服务生成题目
GenerateQuestionResponseDTO response = callAlgorithmService(dtoList, questionType, num, knowledgePoint.getParseName());
if (response != null && StringUtils.isNotBlank(response.getMessage()) && response.getMessage().contains("success")) {
log.info(">>> [题目生成] 算法服务接受任务成功, 任务: {}, 状态: {}, 信息:{}",
response.getTaskId(), response.getStatus(),response.getMessage());
return;
}
// GenerateQuestionResponseDTO response = callAlgorithmService(dtoList, questionType, num, knowledgePoint.getParseName());
//
// if (response != null && StringUtils.isNotBlank(response.getMessage()) && response.getMessage().contains("success")) {
// log.info(">>> [题目生成] 算法服务接受任务成功, 任务: {}, 状态: {}, 信息:{}",
// response.getTaskId(), response.getStatus(),response.getMessage());
// return;
// }
} catch (Exception e) {
log.warn(">>> [题目生成] 调用算法服务失败,启动熔断降级方案, TaskId: {}, 错误: {}",
@ -100,7 +101,7 @@ public class PostToGenerateQuestionDomainServiceImpl implements PostToGenerateQu
// log.info(">>> [题目生成] 启用熔断降级,生成默认题目");
// generateFallbackQuestions(dtoList, questionType, num);
//发送预警通知
notifyUtil.notify(taskId,clusterId);
// notifyUtil.notify(taskId,clusterId);
}
/**

15
src/main/java/com/project/task/domain/service/impl/NotifyTaskDomainServiceImpl.java

@ -10,6 +10,8 @@ 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.information.domain.entity.ProductLineEntity;
import com.project.information.domain.service.ProductLineBaseService;
import com.project.task.domain.dto.TaskDTO;
import com.project.task.domain.entity.TaskEntity;
import com.project.task.domain.entity.TaskUserEntity;
@ -36,6 +38,8 @@ public class NotifyTaskDomainServiceImpl implements NotifyTaskDomainService {
private TaskUserMapper taskUserMapper;
@Autowired
private DtService dtService;
@Autowired
private ProductLineBaseService productLineBaseService;
@Autowired
private DingProperties dingTalkProperties;
@ -85,9 +89,18 @@ public class NotifyTaskDomainServiceImpl implements NotifyTaskDomainService {
if (CollUtil.isEmpty(userIds)) {
return;
}
//获取子产品线名称
String subLineName = productLineBaseService.lambdaQuery()
.eq(ProductLineEntity::getId , taskDTO.getSubLineId())
.select(ProductLineEntity::getName)
.oneOpt()
.map(ProductLineEntity::getName)
.orElse("");
StringBuilder markdown = new StringBuilder();
markdown.append(String.format("### 【%s】已经<font color=#00b500>开始</font>,请按时完成\n\n" , taskDTO.getName()))
.append(String.format("产品线:%s\n\n" , taskDTO.getLineName()))
.append(String.format("产品线:%s\n\n" , subLineName))
.append(String.format("开考时间:%s\n\n" ,sdf.format(taskDTO.getStartTime())))
.append(String.format("截止时间:%s\n\n" , sdf.format(taskDTO.getEndTime())))
.append(String.format("注意事项:%s" , taskDTO.getNote()));

Loading…
Cancel
Save