From 38d8f9b345f43d242e3fe0e5037e3d49c6849f7f Mon Sep 17 00:00:00 2001 From: zhenggl Date: Thu, 7 Sep 2023 14:14:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=B7=A5=E5=8D=9A=E4=BC=9AchatFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatFile/infra/entity/ChatFileEntity.java | 66 +++++++++++++++++++ .../chatFile/infra/mapper/ChatFileMapper.xml | 26 ++++++++ .../infra/repository/ChatFileRepository.java | 17 +++++ .../infra/service/ChatFileService.java | 11 ++++ .../service/impl/ChatFileServiceImpl.java | 15 +++++ .../chatFile/provider/ChatFileEAIService.java | 24 +++++++ .../provider/impl/ChatFileEAIServiceImpl.java | 35 ++++++++++ .../chatFile/ChatFileCreateEAIService.java | 54 +++++++++++++++ .../chatFile/ChatFileGetEAIService.java | 55 ++++++++++++++++ .../chatFile/ChatFileUpdateEAIService.java | 47 +++++++++++++ .../service/chatFile/ChatFileUtil.java | 17 +++++ 11 files changed, 367 insertions(+) create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/entity/ChatFileEntity.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/ChatFileService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/impl/ChatFileServiceImpl.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/ChatFileEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/impl/ChatFileEAIServiceImpl.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUtil.java diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/entity/ChatFileEntity.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/entity/ChatFileEntity.java new file mode 100644 index 0000000..191bcaf --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/entity/ChatFileEntity.java @@ -0,0 +1,66 @@ +package com.digiwin.athena.app.chatFile.infra.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.digiwin.athena.opt.persistence.domain.BaseMgrEntity; +import com.google.gson.annotations.SerializedName; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +@TableName(value = "cim_chat_file", autoResultMap = true) +public class ChatFileEntity extends BaseMgrEntity { + + + @SerializedName(value = "question") + private String question; + + + @SerializedName(value = "feedback_person") + private String feedbackPerson; + + + @SerializedName(value = "feedback_date") + private Date feedbackDate; + + + @SerializedName(value = "urgency") + private Integer urgency; + + + @SerializedName(value = "question_type") + private Integer questionType; + + @SerializedName(value = "question_source") + private Integer questionSource; + + + @SerializedName(value = "question_complete_by") + private String questionCompleteBy; + + + @SerializedName(value = "complete_date") + private Date completeDate; + + + + @SerializedName(value = "complete_explain") + private String completeExplain; + + @SerializedName(value = "is_join") + private Integer isJoin; + + @SerializedName(value = "tab_status") + private Integer tabStatus; + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml new file mode 100644 index 0000000..b124bd8 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + UPDATE cim_chat_file + + `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}, + + WHERE `id`=#{item.id} + + + + + diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java new file mode 100644 index 0000000..2cd4550 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java @@ -0,0 +1,17 @@ +package com.digiwin.athena.app.chatFile.infra.repository; + +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +public interface ChatFileRepository extends BaseRepository { + + void updateBatch(@Param("list") List list); + +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/ChatFileService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/ChatFileService.java new file mode 100644 index 0000000..ecedf7d --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/ChatFileService.java @@ -0,0 +1,11 @@ +package com.digiwin.athena.app.chatFile.infra.service; + +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +public interface ChatFileService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/impl/ChatFileServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/impl/ChatFileServiceImpl.java new file mode 100644 index 0000000..bb046d5 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/service/impl/ChatFileServiceImpl.java @@ -0,0 +1,15 @@ +package com.digiwin.athena.app.chatFile.infra.service.impl; + +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.app.chatFile.infra.repository.ChatFileRepository; +import com.digiwin.athena.app.chatFile.infra.service.ChatFileService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +@Service +public class ChatFileServiceImpl extends AbsBaseService implements ChatFileService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/ChatFileEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/ChatFileEAIService.java new file mode 100644 index 0000000..3a464cb --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/ChatFileEAIService.java @@ -0,0 +1,24 @@ +package com.digiwin.athena.app.chatFile.provider; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.app.service.DWService; +import com.digiwin.app.service.eai.EAIService; +import com.digiwin.athena.app.chatFile.service.chatFile.ChatFileUtil; + +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +public interface ChatFileEAIService extends DWService { + + @EAIService(id = ChatFileUtil.CA_CHAT_FILE_INFO_GET) + DWEAIResult get(Map headers, String messageBody) throws Exception; + + @EAIService(id = ChatFileUtil.CA_CHAT_FILE_INFO_CREATE) + DWEAIResult create(Map headers, String messageBody) throws Exception; + + @EAIService(id = ChatFileUtil.CA_CHAT_FILE_INFO_UPDATE) + DWEAIResult update(Map headers, String messageBody) throws Exception; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/impl/ChatFileEAIServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/impl/ChatFileEAIServiceImpl.java new file mode 100644 index 0000000..0a66b82 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/provider/impl/ChatFileEAIServiceImpl.java @@ -0,0 +1,35 @@ +package com.digiwin.athena.app.chatFile.provider.impl; + +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.chatFile.provider.ChatFileEAIService; +import com.digiwin.athena.app.chatFile.service.chatFile.ChatFileUtil; +import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; + +import javax.annotation.Resource; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +public class ChatFileEAIServiceImpl implements ChatFileEAIService { + + + @Resource + private EAIServiceContext eaiServiceContext; + + @Override + public DWEAIResult get(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ChatFileUtil.CA_CHAT_FILE_INFO_GET,headers,messageBody); + } + + @Override + public DWEAIResult create(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ChatFileUtil.CA_CHAT_FILE_INFO_CREATE,headers,messageBody); + } + + @Override + public DWEAIResult update(Map headers, String messageBody) throws Exception { + return eaiServiceContext.execute(ChatFileUtil.CA_CHAT_FILE_INFO_UPDATE,headers,messageBody); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java new file mode 100644 index 0000000..50a2440 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java @@ -0,0 +1,54 @@ +package com.digiwin.athena.app.chatFile.service.chatFile; + +import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.StringUtils; +import com.digiwin.app.container.exceptions.DWBusinessException; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.app.chatFile.infra.service.ChatFileService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +@Service +@Log4j2 +public class ChatFileCreateEAIService extends AbsEAIService { + + @Resource + private ChatFileService chatFileService; + + @Override + public String getServiceName() { + return ChatFileUtil.CA_CHAT_FILE_INFO_CREATE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + + Date date = new Date(); + for (ChatFileEntity chatFileEntity : chatFileInfo) { + if (StringUtils.isEmpty(chatFileEntity.getQuestion())){ + throw new DWBusinessException("问题描述不能为空"); + } + //反馈时间 + chatFileEntity.setFeedbackDate(date); + } + + + chatFileService.saveBatch(chatFileInfo); + + return buildOK("chat_file_info",chatFileInfo); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java new file mode 100644 index 0000000..48d0a08 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java @@ -0,0 +1,55 @@ +package com.digiwin.athena.app.chatFile.service.chatFile; + +import com.alibaba.fastjson.TypeReference; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.app.chatFile.infra.service.ChatFileService; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import lombok.extern.log4j.Log4j2; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +@Service +@Log4j2 +public class ChatFileGetEAIService extends AbsEAIService { + + + @Resource + private ChatFileService chatFileService; + + @Override + public String getServiceName() { + return ChatFileUtil.CA_CHAT_FILE_INFO_GET; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + + if (CollectionUtils.isEmpty(chatFileInfo)){ + return buildOK(new HashMap<>()); + } + + List idList = chatFileInfo.stream().map(ChatFileEntity::getId).collect(Collectors.toList()); + + LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); + lmq.in(ChatFileEntity::getId,idList); + List list = chatFileService.list(lmq); + + return buildOK("chat_file_info",list); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java new file mode 100644 index 0000000..6e76f77 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java @@ -0,0 +1,47 @@ +package com.digiwin.athena.app.chatFile.service.chatFile; + +import com.alibaba.fastjson.TypeReference; +import com.digiwin.app.service.DWEAIResult; +import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; +import com.digiwin.athena.app.chatFile.infra.repository.ChatFileRepository; +import com.digiwin.athena.opt.common.eai.EAIRequest; +import com.digiwin.athena.opt.common.eai.service.AbsEAIService; +import lombok.extern.log4j.Log4j2; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +@Service +@Log4j2 +public class ChatFileUpdateEAIService extends AbsEAIService { + + @Resource + private ChatFileRepository chatFileRepository; + + @Override + public String getServiceName() { + return ChatFileUtil.CA_CHAT_FILE_INFO_UPDATE; + } + + @Override + public DWEAIResult execute(Map headers, String messageBody) throws Exception { + + EAIRequest eaiRequest = EAIRequest.build(messageBody); + List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + + chatFileInfo.forEach(item -> { + item.setCompleteDate(new Date()); + }); + + chatFileRepository.updateBatch(chatFileInfo); + return buildOK(new HashMap<>()); + } +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUtil.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUtil.java new file mode 100644 index 0000000..3bcd5de --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUtil.java @@ -0,0 +1,17 @@ +package com.digiwin.athena.app.chatFile.service.chatFile; + +/** + * @auther: zhenggl + * @date: 2023/9/7 + */ +public class ChatFileUtil { + + /*** + * 工博会chat_file + */ + public static final String CA_CHAT_FILE_INFO_CREATE = "demo.kcfr.chat.file.info.create"; + + public static final String CA_CHAT_FILE_INFO_UPDATE = "demo.kcfr.chat.file.info.update"; + + public static final String CA_CHAT_FILE_INFO_GET = "demo.kcfr.chat.file.info.get"; +} From b65cc3b1660ee7031368e238469e0af45a150044 Mon Sep 17 00:00:00 2001 From: zhenggl Date: Thu, 7 Sep 2023 14:29:04 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=E5=B7=A5=E5=8D=9A=E4=BC=9AchatFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chatFile/infra/mapper/ChatFileMapper.xml | 22 ++++++++-------- .../infra/repository/ChatFileRepository.java | 2 +- .../chatFile/ChatFileCreateEAIService.java | 17 ++++++------- .../chatFile/ChatFileGetEAIService.java | 11 ++++---- .../chatFile/ChatFileUpdateEAIService.java | 8 +++--- doc/sql/app-20230703-ddl.sql | 25 +++++++++++++++++++ 6 files changed, 54 insertions(+), 31 deletions(-) diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml index b124bd8..8b01e8e 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/mapper/ChatFileMapper.xml @@ -5,21 +5,19 @@ - - + UPDATE cim_chat_file - `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} - WHERE `id`=#{item.id} - + WHERE `id`=#{id} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java index 2cd4550..e3608c8 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/infra/repository/ChatFileRepository.java @@ -12,6 +12,6 @@ import java.util.List; */ public interface ChatFileRepository extends BaseRepository { - void updateBatch(@Param("list") List list); + void updateBatch(ChatFileEntity chatFile); } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java index 50a2440..34f90a9 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileCreateEAIService.java @@ -1,6 +1,7 @@ package com.digiwin.athena.app.chatFile.service.chatFile; import com.alibaba.fastjson.TypeReference; +import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.StringUtils; import com.digiwin.app.container.exceptions.DWBusinessException; import com.digiwin.app.service.DWEAIResult; @@ -15,6 +16,7 @@ import javax.annotation.Resource; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Objects; /** * @auther: zhenggl @@ -35,19 +37,16 @@ public class ChatFileCreateEAIService extends AbsEAIService { @Override public DWEAIResult execute(Map headers, String messageBody) throws Exception { EAIRequest eaiRequest = EAIRequest.build(messageBody); - List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference(){}); - 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); } diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java index 48d0a08..5f16bd5 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileGetEAIService.java @@ -2,6 +2,7 @@ package com.digiwin.athena.app.chatFile.service.chatFile; import com.alibaba.fastjson.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.digiwin.app.container.exceptions.DWBusinessException; import com.digiwin.app.service.DWEAIResult; import com.digiwin.athena.app.chatFile.infra.entity.ChatFileEntity; import com.digiwin.athena.app.chatFile.infra.service.ChatFileService; @@ -15,6 +16,7 @@ import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.stream.Collectors; /** @@ -38,16 +40,15 @@ public class ChatFileGetEAIService extends AbsEAIService { public DWEAIResult execute(Map headers, String messageBody) throws Exception { EAIRequest eaiRequest = EAIRequest.build(messageBody); - List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference(){}); - if (CollectionUtils.isEmpty(chatFileInfo)){ - return buildOK(new HashMap<>()); + if (Objects.isNull(chatFileInfo)){ + throw new DWBusinessException("缺少必要参数chat_file_info"); } - List idList = chatFileInfo.stream().map(ChatFileEntity::getId).collect(Collectors.toList()); LambdaQueryWrapper lmq = new LambdaQueryWrapper<>(); - lmq.in(ChatFileEntity::getId,idList); + lmq.eq(ChatFileEntity::getId,chatFileInfo.getId()); List list = chatFileService.list(lmq); return buildOK("chat_file_info",list); diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java index 6e76f77..9ab4307 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/chatFile/service/chatFile/ChatFileUpdateEAIService.java @@ -35,11 +35,11 @@ public class ChatFileUpdateEAIService extends AbsEAIService { public DWEAIResult execute(Map headers, String messageBody) throws Exception { EAIRequest eaiRequest = EAIRequest.build(messageBody); - List chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference>(){}); + ChatFileEntity chatFileInfo = eaiRequest.getObject("chat_file_info", new TypeReference(){}); + + + chatFileInfo.setCompleteDate(new Date()); - chatFileInfo.forEach(item -> { - item.setCompleteDate(new Date()); - }); chatFileRepository.updateBatch(chatFileInfo); return buildOK(new HashMap<>()); diff --git a/doc/sql/app-20230703-ddl.sql b/doc/sql/app-20230703-ddl.sql index b7a1b6a..6f39910 100644 --- a/doc/sql/app-20230703-ddl.sql +++ b/doc/sql/app-20230703-ddl.sql @@ -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`; + + +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;