Browse Source

feat:工博会chatFile

master
郑贵龙 1 year ago
parent
commit
b65cc3b166
6 changed files with 54 additions and 31 deletions
  1. +10
    -12
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml
  2. +1
    -1
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java
  3. +8
    -9
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java
  4. +6
    -5
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java
  5. +4
    -4
      demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java
  6. +25
    -0
      doc/sql/app-20230703-ddl.sql

+ 10
- 12
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml View File

@ -5,21 +5,19 @@
<mapper namespace="com.digiwin.athena.app.chatFile.infra.repository.ChatFileRepository"> <mapper namespace="com.digiwin.athena.app.chatFile.infra.repository.ChatFileRepository">
<update id="updateBatch">
<foreach collection="list" item="item" index="index" separator=";" open="" close="">
<update id="updateBatch" parameterType="com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity">
UPDATE cim_chat_file UPDATE cim_chat_file
<set> <set>
`question` = #{item.question},
`question_source` = #{item.questionSource},
`question_type` = #{item.questionType},
`urgency` = #{item.urgency},
`question_complete_by` = #{item.questionCompleteBy},
`complete_explain` = #{item.completeExplain},
`complete_date` = #{item.completeDate},
`is_join` = #{item.isJoin},
`question` = #{question},
`question_source` = #{questionSource},
`question_type` = #{questionType},
`urgency` = #{urgency},
`question_complete_by` = #{questionCompleteBy},
`complete_explain` = #{completeExplain},
`complete_date` = #{completeDate},
`is_join` = #{isJoin}
</set> </set>
WHERE `id`=#{item.id}
</foreach>
WHERE `id`=#{id}
</update> </update>


+ 1
- 1
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java View File

@ -12,6 +12,6 @@ import java.util.List;
*/ */
public interface ChatFileRepository extends BaseRepository<ChatFileEntity> { public interface ChatFileRepository extends BaseRepository<ChatFileEntity> {
void updateBatch(@Param("list") List<ChatFileEntity> list);
void updateBatch(ChatFileEntity chatFile);
} }

+ 8
- 9
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java View File

@ -1,6 +1,7 @@
package com.digiwin.athena.app.chatFile.service.chatFile; package com.digiwin.athena.app.chatFile.service.chatFile;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.common.utils.StringUtils;
import com.digiwin.app.container.exceptions.DWBusinessException; import com.digiwin.app.container.exceptions.DWBusinessException;
import com.digiwin.app.service.DWEAIResult; import com.digiwin.app.service.DWEAIResult;
@ -15,6 +16,7 @@ import javax.annotation.Resource;
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;
/** /**
* @auther: zhenggl * @auther: zhenggl
@ -35,19 +37,16 @@ public class ChatFileCreateEAIService extends AbsEAIService {
@Override @Override
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
EAIRequest eaiRequest = EAIRequest.build(messageBody); EAIRequest eaiRequest = EAIRequest.build(messageBody);
List<ChatFileEntity> chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<List<ChatFileEntity>>(){});
ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<ChatFileEntity>(){});
Date date = new Date();
for (ChatFileEntity chatFileEntity : chatFileInfo) {
if (StringUtils.isEmpty(chatFileEntity.getQuestion())){
throw new DWBusinessException("问题描述不能为空");
}
//反馈时间
chatFileEntity.setFeedbackDate(date);
if (Objects.isNull(chatFileInfo)){
throw new DWBusinessException("缺少必要参数chat_file_info");
} }
//反馈时间
chatFileInfo.setFeedbackDate(new Date());
chatFileService.saveBatch(chatFileInfo);
chatFileService.save(chatFileInfo);
return buildOK("chat_file_info",chatFileInfo); return buildOK("chat_file_info",chatFileInfo);
} }


+ 6
- 5
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java View File

@ -2,6 +2,7 @@ package com.digiwin.athena.app.chatFile.service.chatFile;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.digiwin.app.container.exceptions.DWBusinessException;
import com.digiwin.app.service.DWEAIResult; import com.digiwin.app.service.DWEAIResult;
import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity;
import com.digiwin.athena.app.chatFile.infra.service.ChatFileService; import com.digiwin.athena.app.chatFile.infra.service.ChatFileService;
@ -15,6 +16,7 @@ import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
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;
/** /**
@ -38,16 +40,15 @@ public class ChatFileGetEAIService extends AbsEAIService {
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
EAIRequest eaiRequest = EAIRequest.build(messageBody); EAIRequest eaiRequest = EAIRequest.build(messageBody);
List<ChatFileEntity> chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<List<ChatFileEntity>>(){});
ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<ChatFileEntity>(){});
if (CollectionUtils.isEmpty(chatFileInfo)){
return buildOK(new HashMap<>());
if (Objects.isNull(chatFileInfo)){
throw new DWBusinessException("缺少必要参数chat_file_info");
} }
List<Long> idList = chatFileInfo.stream().map(ChatFileEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<ChatFileEntity> lmq = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ChatFileEntity> lmq = new LambdaQueryWrapper<>();
lmq.in(ChatFileEntity::getId,idList);
lmq.eq(ChatFileEntity::getId,chatFileInfo.getId());
List<ChatFileEntity> list = chatFileService.list(lmq); List<ChatFileEntity> list = chatFileService.list(lmq);
return buildOK("chat_file_info",list); return buildOK("chat_file_info",list);


+ 4
- 4
demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java View File

@ -35,11 +35,11 @@ public class ChatFileUpdateEAIService extends AbsEAIService {
public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception { public DWEAIResult execute(Map<String, String> headers, String messageBody) throws Exception {
EAIRequest eaiRequest = EAIRequest.build(messageBody); EAIRequest eaiRequest = EAIRequest.build(messageBody);
List<ChatFileEntity> chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<List<ChatFileEntity>>(){});
ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference<ChatFileEntity>(){});
chatFileInfo.setCompleteDate(new Date());
chatFileInfo.forEach(item -> {
item.setCompleteDate(new Date());
});
chatFileRepository.updateBatch(chatFileInfo); chatFileRepository.updateBatch(chatFileInfo);
return buildOK(new HashMap<>()); return buildOK(new HashMap<>());


+ 25
- 0
doc/sql/app-20230703-ddl.sql View File

@ -1 +1,26 @@
alter table cps_question_info Add column measures_from varchar(520) null default '' AFTER `knowledge_accumulation`, Add column accumulation_from varchar(520) null default '' AFTER `knowledge_accumulation`; alter table cps_question_info Add column measures_from varchar(520) null default '' AFTER `knowledge_accumulation`, Add column accumulation_from varchar(520) null default '' AFTER `knowledge_accumulation`;
CREATE TABLE `cim_chat_file` (
`id` bigint(20) NOT NULL COMMENT 'id',
`question` varchar(255) DEFAULT '' COMMENT '问题描述',
`feedback_person` varchar(255) DEFAULT '' COMMENT '反馈人',
`feedback_date` datetime DEFAULT NULL COMMENT '反馈时间',
`urgency` int(1) DEFAULT NULL COMMENT '紧急程度1:低,2中,3高',
`question_source` int(1) DEFAULT NULL COMMENT '问题来源',
`question_type` int(1) DEFAULT NULL COMMENT '问题分类',
`question_complete_by` varchar(255) DEFAULT '' COMMENT '问题处理人',
`complete_date` datetime DEFAULT NULL COMMENT '处理时间',
`complete_explain` varchar(255) DEFAULT '' COMMENT '处理说明',
`is_join` int(1) DEFAULT NULL COMMENT '是否加入知识库0否,1是',
`tab_status` int(1) DEFAULT NULL COMMENT '状态',
`tenantsid` bigint(20) DEFAULT NULL COMMENT '租户sid',
`tenant_id` varchar(20) DEFAULT NULL COMMENT '租户id',
`create_by` varchar(50) DEFAULT NULL COMMENT '创建者',
`create_date` datetime DEFAULT NULL COMMENT '创建时间',
`modified_by` varchar(50) DEFAULT NULL COMMENT '修改者',
`modified_date` datetime DEFAULT NULL COMMENT '修改时间',
`version` int(11) DEFAULT '0' COMMENT '版本',
`deleted` tinyint(255) DEFAULT '0' COMMENT '逻辑删除标志,默认0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Loading…
Cancel
Save