|
|
@ -1,6 +1,7 @@ |
|
|
package com.heai.modules.taskmanage.service.impl; |
|
|
package com.heai.modules.taskmanage.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
|
|
import com.heai.common.constant.OssFileConstant; |
|
|
import com.heai.common.constant.OssFileConstant; |
|
|
import com.heai.common.utils.PageUtils; |
|
|
import com.heai.common.utils.PageUtils; |
|
|
import com.heai.common.utils.Query; |
|
|
import com.heai.common.utils.Query; |
|
|
@ -18,6 +19,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
|
|
|
import java.util.Objects; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
@ -28,6 +30,7 @@ import com.heai.modules.taskmanage.dao.ChatHistoryDao; |
|
|
import com.heai.modules.taskmanage.entity.ChatHistoryEntity; |
|
|
import com.heai.modules.taskmanage.entity.ChatHistoryEntity; |
|
|
import com.heai.modules.taskmanage.service.ChatHistoryService; |
|
|
import com.heai.modules.taskmanage.service.ChatHistoryService; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Service("chatHistoryService") |
|
|
@Service("chatHistoryService") |
|
|
@ -54,11 +57,24 @@ public class ChatHistoryServiceImpl extends ServiceImpl<ChatHistoryDao, ChatHist |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<ChatHistoryEntity> chatHistoryList(ChatHistoryEntity params) { |
|
|
public List<ChatHistoryEntity> chatHistoryList(ChatHistoryEntity params) { |
|
|
return lambdaQuery() |
|
|
|
|
|
.eq(ChatHistoryEntity::getSite,params.getSite()) |
|
|
|
|
|
.eq(ChatHistoryEntity::getTaskId,params.getTaskId()) |
|
|
|
|
|
.orderBy(true,false,ChatHistoryEntity::getCreateDate) |
|
|
|
|
|
.list(); |
|
|
|
|
|
|
|
|
if (Objects.isNull(params.getTaskId())){ |
|
|
|
|
|
throw new RuntimeException("任务编码不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
LambdaQueryChainWrapper<ChatHistoryEntity> wrapper = lambdaQuery() |
|
|
|
|
|
.eq(ChatHistoryEntity::getSite, params.getSite()) |
|
|
|
|
|
.orderByDesc(ChatHistoryEntity::getCreateDate); |
|
|
|
|
|
if (StringUtils.hasText(params.getAllOrOne()) && "Y".equals(params.getAllOrOne())){ |
|
|
|
|
|
// 根据id获取taskDetail |
|
|
|
|
|
TaskDetailEntity detail = taskDetailService.lambdaQuery().eq(TaskDetailEntity::getId, params.getTaskId()).one(); |
|
|
|
|
|
if (Objects.isNull(detail)){ |
|
|
|
|
|
throw new RuntimeException("任务编码不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
List<TaskDetailEntity> list = taskDetailService.lambdaQuery().eq(TaskDetailEntity::getTaskId, detail.getTaskId()).list(); |
|
|
|
|
|
List<Integer> ids = list.stream().map(TaskDetailEntity::getId).collect(Collectors.toList()); |
|
|
|
|
|
return wrapper.in(ChatHistoryEntity::getTaskId,ids).list(); |
|
|
|
|
|
} |
|
|
|
|
|
return wrapper.eq(ChatHistoryEntity::getTaskId,params.getTaskId()).list(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
|