|
|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
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.sun.org.apache.bcel.internal.generic.NEW;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -128,7 +129,16 @@ public class LawyerAiInteractionLogServiceImpl extends ServiceImpl<LawyerAiInter
|
|
|
public R<Map<String, Object>> saveChatLog(String queryText, String responseText, Integer clientUserId) {
|
|
|
log.info("LawyerAiInteractionLogServiceImpl.sendAIMessage?message={},responseText={},clientUserId={}", queryText, responseText, clientUserId);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
- LawyerAiInteractionLogVo log = new LawyerAiInteractionLogVo();
|
|
|
+// LawyerAiInteractionLogVo log = new LawyerAiInteractionLogVo();
|
|
|
+// log.setClientUserId(clientUserId);
|
|
|
+// log.setQueryText(queryText);
|
|
|
+// log.setResponseText(responseText);
|
|
|
+// log.setInteractionTime(new Date());
|
|
|
+// log.setDeleteFlag(0);
|
|
|
+// log.setCreatedTime(new Date());
|
|
|
+// log.setUpdatedTime(new Date());
|
|
|
+// int num =aiInteractionLogMapper.insertLog(log);
|
|
|
+ LawyerAiInteractionLog log = new LawyerAiInteractionLog();
|
|
|
log.setClientUserId(clientUserId);
|
|
|
log.setQueryText(queryText);
|
|
|
log.setResponseText(responseText);
|
|
|
@@ -136,13 +146,42 @@ public class LawyerAiInteractionLogServiceImpl extends ServiceImpl<LawyerAiInter
|
|
|
log.setDeleteFlag(0);
|
|
|
log.setCreatedTime(new Date());
|
|
|
log.setUpdatedTime(new Date());
|
|
|
- int num =aiInteractionLogMapper.insertLog(log);
|
|
|
- if (num > 0) {
|
|
|
+ //向表中插入一条新的数据,插入成功后获取插入该条数据的id
|
|
|
+ boolean A=this.save(log);
|
|
|
+ if (A) {
|
|
|
result.put("result","聊天记录保存成功");
|
|
|
+ result.put("log",log);
|
|
|
return R.data(result);
|
|
|
}
|
|
|
result.put("result","聊天记录保存失败");
|
|
|
return R.data(result);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R<Map<String, Object>> updatedLog(Integer id) {
|
|
|
+ log.info("LawyerAiInteractionLogController.updatedLog?id={}", id);
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ LawyerAiInteractionLogVo log = new LawyerAiInteractionLogVo();
|
|
|
+ log.setId(id);
|
|
|
+ log.setDeleteFlag(1);
|
|
|
+ log.setUpdatedTime(new Date());
|
|
|
+ int num=aiInteractionLogMapper.updateLog(log);
|
|
|
+ if (num>0) {
|
|
|
+ result.put("result","删除成功");
|
|
|
+ result.put("log",log);
|
|
|
+ return R.data(result);
|
|
|
+ }
|
|
|
+ result.put("result","删除失败");
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IPage<LawyerAiInteractionLog> getLogList(Integer page, Integer size , Integer clientUserId) {
|
|
|
+ List<LawyerAiInteractionLog> list = aiInteractionLogMapper.getLogList(page,size,clientUserId);
|
|
|
+ IPage<LawyerAiInteractionLog> pageResult = new Page<>(page, size);
|
|
|
+ pageResult.setRecords(list);
|
|
|
+ pageResult.setTotal(list.size());
|
|
|
+ return pageResult;
|
|
|
+ }
|
|
|
}
|
|
|
|