Ver código fonte

智能客服问题答案

jyc 2 meses atrás
pai
commit
944d70bded

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/store/AiIntelligentAssistant.java

@@ -29,6 +29,10 @@ public class AiIntelligentAssistant {
     @TableField("context")
     private String context;
 
+    @ApiModelProperty(value = "1平台使用/2商户运营")
+    @TableField("talk_source")
+    private Integer talkSource;
+
     @ApiModelProperty(value = "类型(0空数据/1输入的问题/2ai回答/3固定问题)")
     @TableField("type")
     private Integer type;

+ 2 - 0
alien-entity/src/main/resources/mapper/AiIntelligentAssistantMapper.xml

@@ -7,6 +7,7 @@
     <insert id="insertList">
         INSERT INTO ai_intelligent_assistant (
         context,
+        talk_source,
         type,
         reply_id,
         reply_date,
@@ -20,6 +21,7 @@
         <foreach collection="list" item="item" separator=",">
             (
             #{item.context},
+            #{item.talkSource},
             #{item.type},
             #{item.replyId},
             #{item.replyDate},

+ 4 - 3
alien-store/src/main/java/shop/alien/store/controller/StoreCustomerServiceController.java

@@ -111,10 +111,11 @@ public class StoreCustomerServiceController {
     @ApiOperation("查询聊天记录")
     @ApiOperationSupport(order = 2)
     @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id)", dataType = "String", paramType = "query", required = true)
-            , @ApiImplicitParam(name = "time", value = "时间", dataType = "String", paramType = "query", required = true)})
+            , @ApiImplicitParam(name = "time", value = "时间", dataType = "String", paramType = "query", required = true)
+            , @ApiImplicitParam(name = "talkSource", value = "1平台使用/2商户运营", dataType = "Integer", paramType = "query", required = true)})
     @GetMapping("/selectAiIntelligentAssistant")
-    public R<List<AiIntelligentAssistant>> selectAiIntelligentAssistant(@RequestParam String userId, @RequestParam String time) {
-        List<AiIntelligentAssistant> result = storeCustomerServiceService.selectAiIntelligentAssistant(userId,time);
+    public R<List<AiIntelligentAssistant>> selectAiIntelligentAssistant(@RequestParam String userId, @RequestParam String time,@RequestParam Integer talkSource) {
+        List<AiIntelligentAssistant> result = storeCustomerServiceService.selectAiIntelligentAssistant(userId,time,talkSource);
         return R.data(result);
     }
 }

+ 1 - 1
alien-store/src/main/java/shop/alien/store/service/StoreCustomerServiceService.java

@@ -31,5 +31,5 @@ public interface StoreCustomerServiceService extends IService<StoreCustomerServi
 
     List<AiIntelligentAssistant> saveAiIntelligentAssistant(List<AiIntelligentAssistant> aiIntelligentAssistants);
 
-    List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time);
+    List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time,Integer talkSource);
 }

+ 3 - 2
alien-store/src/main/java/shop/alien/store/service/impl/StoreCustomerServiceServiceImpl.java

@@ -98,11 +98,11 @@ public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerSe
     }
 
     @Override
-    public List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time) {
+    public List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time,Integer talkSource) {
         LambdaQueryWrapper<AiIntelligentAssistant> last = new LambdaQueryWrapper<AiIntelligentAssistant>()
                 .lt(AiIntelligentAssistant::getCreatedTime, time)
                 .eq(AiIntelligentAssistant::getDeleteFlag, 0)
-                .eq(AiIntelligentAssistant::getType, 0).eq(AiIntelligentAssistant::getUserId, userId).orderByDesc(AiIntelligentAssistant::getCreatedTime).last("limit 1");
+                .eq(AiIntelligentAssistant::getType, 0).eq(AiIntelligentAssistant::getTalkSource, talkSource).eq(AiIntelligentAssistant::getUserId, userId).orderByDesc(AiIntelligentAssistant::getCreatedTime).last("limit 1");
         AiIntelligentAssistant aiIntelligentAssistant = aiIntelligentAssistantMapper.selectOne(last);
         if (ObjectUtils.isNotEmpty(aiIntelligentAssistant)) {
             LambdaQueryWrapper<AiIntelligentAssistant> queryWrapper = new LambdaQueryWrapper<AiIntelligentAssistant>()
@@ -110,6 +110,7 @@ public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerSe
                     .lt(AiIntelligentAssistant::getCreatedTime, time)
                     .eq(AiIntelligentAssistant::getDeleteFlag, 0)
                     .eq(AiIntelligentAssistant::getUserId, userId)
+                    .eq(AiIntelligentAssistant::getTalkSource, talkSource)
                     .orderByAsc(AiIntelligentAssistant::getCreatedTime);
             return aiIntelligentAssistantMapper.selectList(queryWrapper);
         }