Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

yh 2 дней назад
Родитель
Сommit
98c45fab8a

+ 54 - 4
fs-admin/src/main/java/com/fs/qw/controller/QwUserController.java

@@ -650,11 +650,44 @@ public class QwUserController extends BaseController {
     public R sync(@PathVariable String corpId)
     {
         List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(getLoginUser().getUser().getCompanyId());
+        Long tenantId = SecurityUtils.getTenantId();
         for (String string : strings) {
-
             if (string.equals(corpId)){
-                qwUserService.syncQwUser(string);
-                qwDeptService.insertOrUpdateQwDept(string);
+                // 远程调用 fs-qw-api 同步企微用户
+                String syncUserUrl = OpenQwConfig.baseApi + "/getSyncQwUser?tenantId=" + tenantId + "&corpId=" + corpId;
+                try {
+                    HttpResponse response = HttpRequest.post(syncUserUrl)
+                            .timeout(apiTimeout * 1000)
+                            .execute();
+                    if (response.getStatus() != 200) {
+                        log.error("同步企微用户失败,HTTP状态码: {}", response.getStatus());
+                        return R.error("同步企微用户失败,服务返回状态码: " + response.getStatus());
+                    }
+                } catch (Exception e) {
+                    log.error("同步企微用户异常, url={}", syncUserUrl, e);
+                    if (e.getCause() instanceof SocketTimeoutException) {
+                        return R.error("同步企微用户超时,请稍后重试");
+                    }
+                    return R.error("同步企微用户失败: " + e.getMessage());
+                }
+
+                // 远程调用 fs-qw-api 同步企微部门
+                String syncDeptUrl = OpenQwConfig.baseApi + "/getSyncQwDept?tenantId=" + tenantId + "&corpId=" + corpId;
+                try {
+                    HttpResponse response = HttpRequest.post(syncDeptUrl)
+                            .timeout(apiTimeout * 1000)
+                            .execute();
+                    if (response.getStatus() != 200) {
+                        log.error("同步企微部门失败,HTTP状态码: {}", response.getStatus());
+                        return R.error("同步企微部门失败,服务返回状态码: " + response.getStatus());
+                    }
+                } catch (Exception e) {
+                    log.error("同步企微部门异常, url={}", syncDeptUrl, e);
+                    if (e.getCause() instanceof SocketTimeoutException) {
+                        return R.error("同步企微部门超时,请稍后重试");
+                    }
+                    return R.error("同步企微部门失败: " + e.getMessage());
+                }
                 logger.info("同步完成");
             }
         }
@@ -667,9 +700,26 @@ public class QwUserController extends BaseController {
     public R syncName(@PathVariable String corpId)
     {
         List<String> strings = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(getLoginUser().getUser().getCompanyId());
+        Long tenantId = SecurityUtils.getTenantId();
         for (String string : strings) {
             if (string.equals(corpId)){
-                qwUserService.syncQwUserName(string);
+                // 远程调用 fs-qw-api 同步企微用户名称
+                String syncNameUrl = OpenQwConfig.baseApi + "/getSyncName?tenantId=" + tenantId + "&corpId=" + corpId;
+                try {
+                    HttpResponse response = HttpRequest.post(syncNameUrl)
+                            .timeout(apiTimeout * 1000)
+                            .execute();
+                    if (response.getStatus() != 200) {
+                        log.error("同步企微用户名称失败,HTTP状态码: {}", response.getStatus());
+                        return R.error("同步企微用户名称失败,服务返回状态码: " + response.getStatus());
+                    }
+                } catch (Exception e) {
+                    log.error("同步企微用户名称异常, url={}", syncNameUrl, e);
+                    if (e.getCause() instanceof SocketTimeoutException) {
+                        return R.error("同步企微用户名称超时,请稍后重试");
+                    }
+                    return R.error("同步企微用户名称失败: " + e.getMessage());
+                }
             }
         }
         return R.ok();

+ 10 - 0
fs-company/src/main/java/com/fs/company/controller/fastGpt/FastGptRoleController.java

@@ -7,6 +7,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.course.domain.FsUserCourseVideo;
 import com.fs.fastGpt.domain.FastGptRole;
@@ -15,6 +16,8 @@ import com.fs.fastGpt.vo.FastGptRoleVO;
 import com.fs.framework.security.LoginUser;
 import com.fs.framework.service.TokenService;
 import com.fs.his.vo.OptionsVO;
+import com.fs.system.domain.SysConfig;
+import com.fs.system.service.ISysConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
@@ -36,6 +39,8 @@ public class FastGptRoleController extends BaseController
 
     @Autowired
     private TokenService tokenService;
+    @Autowired
+    private ISysConfigService sysConfigService;
 
 
     /**
@@ -110,6 +115,11 @@ public class FastGptRoleController extends BaseController
 //        dto.setMedia_id(fastGptRole.getKfMediaId());
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         fastGptRole.setCompanyId(loginUser.getCompany().getCompanyId());
+        SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("aiKeyword");
+        if (sysConfig == null || StringUtils.isEmpty(sysConfig.getConfigValue())) {
+            return R.error("请先配置ai权限关键字!");
+        }
+        fastGptRole.setUserInfo(sysConfig.getConfigValue());
         if(fastGptRoleService.insertFastGptRole(fastGptRole)>0){
 
             return R.ok();

+ 3 - 2
fs-service/src/main/java/com/fs/fastGpt/domain/FastGptChatConversation.java

@@ -1,13 +1,14 @@
 package com.fs.fastGpt.domain;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.Data;
 
 @Data
 public class FastGptChatConversation {
     private JSONObject userInfo;
-    private JSONObject aiInfo;
-    private JSONObject history;
+    private String aiInfo;
+    private JSONArray history;
     private String isRepository;
     private String userContent;
     private String aiContent;

+ 19 - 10
fs-service/src/main/java/com/fs/fastGpt/service/impl/AiHookServiceImpl.java

@@ -1633,9 +1633,12 @@ public class AiHookServiceImpl implements AiHookService {
     private void addPromptWordNew(List<ChatParam.Message> messageList,String count,Long extId,FastGptRole role,FastGptChatSession fastGptChatSession){
 
         FastGptChatConversation conversation = new FastGptChatConversation();
-        conversation.setAiInfo(new com.alibaba.fastjson.JSONObject());
         conversation.setUserInfo(new com.alibaba.fastjson.JSONObject());
-        conversation.setHistory(new com.alibaba.fastjson.JSONObject());
+        conversation.setHistory(new com.alibaba.fastjson.JSONArray());
+
+        if(role.getReminderWords() != null && !role.getReminderWords().isEmpty()){
+            conversation.setAiInfo(role.getReminderWords());
+        }
 
         //组装客户信息
         String sessionUserInfo = fastGptChatSession.getUserInfo();
@@ -1666,7 +1669,7 @@ public class AiHookServiceImpl implements AiHookService {
 
         List<FastGptChatMsg> msgs=fastGptChatMsgService.selectFastGptChatMsgByMsgSessionIdAndExtId(fastGptChatSession.getSessionId(),extId);
         if (!msgs.isEmpty()){
-            com.alibaba.fastjson.JSONObject history = conversation.getHistory();
+            com.alibaba.fastjson.JSONArray historyArray = new com.alibaba.fastjson.JSONArray();
             Collections.reverse(msgs);
             msgs.remove(msgs.size() - 1);
             for (FastGptChatMsg msg : msgs) {
@@ -1677,9 +1680,12 @@ public class AiHookServiceImpl implements AiHookService {
                         continue;
                     }
                 }
-                history.put(sendType==1?"user":"ai",content);
+                com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
+                msgObj.put("role", sendType==1?"user":"ai");
+                msgObj.put("content", content);
+                historyArray.add(msgObj);
             }
-            conversation.setHistory(history);
+            conversation.setHistory(historyArray);
         }
 
         if (count!=null&& !count.isEmpty()){
@@ -1698,9 +1704,8 @@ public class AiHookServiceImpl implements AiHookService {
     private void addPromptWord(List<ChatParam.Message> messageList,String count,Long extId,String words,String countInfo,Long sessionId){
 
         FastGptChatConversation conversation = new FastGptChatConversation();
-        conversation.setAiInfo(new com.alibaba.fastjson.JSONObject());
         conversation.setUserInfo(new com.alibaba.fastjson.JSONObject());
-        conversation.setHistory(new com.alibaba.fastjson.JSONObject());
+        conversation.setHistory(new com.alibaba.fastjson.JSONArray());
 
 
         // 这里获取后台的提示词进行匹配
@@ -1756,19 +1761,23 @@ public class AiHookServiceImpl implements AiHookService {
 
         List<FastGptChatMsg> msgs=fastGptChatMsgService.selectFastGptChatMsgByMsgSessionIdAndExtId(sessionId,extId);
         if (!msgs.isEmpty()){
-            com.alibaba.fastjson.JSONObject history = conversation.getHistory();
+            com.alibaba.fastjson.JSONArray historyArray = new com.alibaba.fastjson.JSONArray();
             Collections.reverse(msgs);
             msgs.remove(msgs.size() - 1);
             for (FastGptChatMsg msg : msgs) {
                 Integer sendType = msg.getSendType();
                 String content = msg.getContent();
                 if(sendType!=1){
-                    if (content!=null&&content.length()>150){
+                    if (content!=null&&content.length()>500){
                         continue;
                     }
                 }
-                history.put(sendType==1?"user":"ai",content);
+                com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
+                msgObj.put("role", sendType==1?"user":"ai");
+                msgObj.put("content", content);
+                historyArray.add(msgObj);
             }
+            conversation.setHistory(historyArray);
         }
 
         if (count!=null&& !count.isEmpty()){

+ 2 - 1
fs-service/src/main/java/com/fs/system/service/impl/SysConfigServiceImpl.java

@@ -8,6 +8,7 @@ import com.fs.common.core.text.Convert;
 import com.fs.common.enums.DataSourceType;
 import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.StringUtils;
+import com.fs.config.saas.ProjectConfig;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
 import com.fs.system.service.ISysConfigService;
@@ -239,7 +240,7 @@ public class SysConfigServiceImpl implements ISysConfigService
     }
 
     @Override
-    public com.fs.config.saas.ProjectConfig getProjectConfig() {
+    public ProjectConfig getProjectConfig() {
         SysConfig sysConfig = configMapper.selectConfigByConfigKey("projectConfig");
         if (sysConfig == null || StringUtils.isEmpty(sysConfig.getConfigValue())) {
             return null;

+ 17 - 1
fs-service/src/main/resources/db/tenant-initData.sql

@@ -5648,4 +5648,20 @@ INSERT INTO `fs_city` VALUES (3712, '460400114000', '排浦镇', '海南省 儋
 INSERT INTO `fs_city` VALUES (3713, '460400115000', '东成镇', '海南省 儋州市 东成镇', '460400000000', NULL, NULL, NULL, NULL, NULL, NULL);
 INSERT INTO `fs_city` VALUES (3714, '460400116000', '新州镇', '海南省 儋州市 新州镇', '460400000000', NULL, NULL, NULL, NULL, NULL, NULL);
 INSERT INTO `fs_city` VALUES (3715, '460400499000', '洋浦经济开发区', '海南省 儋州市 洋浦经济开发区', '460400000000', NULL, NULL, NULL, NULL, NULL, NULL);
-INSERT INTO `fs_city` VALUES (3716, '460400500000', '华南热作学院', '海南省 儋州市 华南热作学院', '460400000000', NULL, NULL, NULL, NULL, NULL, NULL);
+INSERT INTO `fs_city` VALUES (3716, '460400500000', '华南热作学院', '海南省 儋州市 华南热作学院', '460400000000', NULL, NULL, NULL, NULL, NULL, NULL);
+
+
+
+
+INSERT INTO fastgpt_role_type
+(id, name, contact_info)
+VALUES(1, '客服', 'name,sex,age,address,disease,consultProduct,course,courseStatus,study,talk');
+INSERT INTO fastgpt_role_type
+(id, name, contact_info)
+VALUES(2, '伴学助手', 'name,sex,age,address,disease,consultProduct,course,courseStatus,study,talk');
+INSERT INTO fastgpt_role_type
+(id, name, contact_info)
+VALUES(3, 'Ai医生', 'name,sex,age,address,disease,consultProduct,course,courseStatus,study,talk');
+INSERT INTO fastgpt_role_type
+(id, name, contact_info)
+VALUES(4, '医生工作室', 'name,sex,age,address,sweat,toilet,eat,constitution,coldBody,isCold,disease,course,courseStatus,study,product_talk');

+ 63 - 58
fs-service/src/main/resources/db/tenant-initTable.sql

@@ -3506,37 +3506,37 @@ CREATE TABLE `fastgpt_chat_replace_words`
 -- Table structure for fastgpt_chat_session
 -- ----------------------------
 DROP TABLE IF EXISTS `fastgpt_chat_session`;
-CREATE TABLE `fastgpt_chat_session`
-(
-    `session_id`    bigint NOT NULL AUTO_INCREMENT COMMENT '会话ID',
-    `chat_id`       varchar(255)   NULL DEFAULT NULL COMMENT '会话标识',
-    `user_id`       varchar(200)   NULL DEFAULT NULL COMMENT '客户ID uid',
-    `qw_ext_id`     bigint NULL DEFAULT NULL COMMENT '外部联系人id',
-    `qw_user_id`    bigint NULL DEFAULT NULL COMMENT '企微userId',
-    `kf_id`         varchar(200)   NULL DEFAULT NULL COMMENT '客服ID 应用id?',
-    `status`        tinyint(1) NULL DEFAULT NULL COMMENT '状态 1会话中 2已结束',
-    `company_id`    bigint NULL DEFAULT NULL COMMENT '公司ID',
-    `is_look`       tinyint NULL DEFAULT 0 COMMENT '是否查看',
-    `user_type`     tinyint(1) NULL DEFAULT 1 COMMENT '用户类型 1微信用户 2小程序用户 3销售用户',
-    `nick_name`     varchar(200)   NULL DEFAULT NULL COMMENT '客户昵称',
-    `avatar`        varchar(200)   NULL DEFAULT NULL COMMENT '头像',
-    `is_artificial` int NULL DEFAULT NULL COMMENT '是否转人工',
-    `create_time`   datetime NULL DEFAULT NULL COMMENT '创建时间',
-    `update_time`   datetime NULL DEFAULT NULL COMMENT '结束时间',
-    `remind_time`   datetime NULL DEFAULT NULL COMMENT '需要提醒时间',
-    `remind_status` int NULL DEFAULT NULL COMMENT '0 不需要提醒 1 需要提醒',
-    `remind_count`  int NULL DEFAULT NULL COMMENT '提醒次数',
-    `last_time`     datetime NULL DEFAULT NULL COMMENT '时间',
-    `is_reply`      int NULL DEFAULT 0 COMMENT '转人工是否回复',
+CREATE TABLE `fastgpt_chat_session` (
+    `session_id` bigint NOT NULL AUTO_INCREMENT COMMENT '会话ID',
+    `chat_id` varchar(255) DEFAULT NULL COMMENT '会话标识',
+    `user_id` varchar(200) DEFAULT NULL COMMENT '客户ID uid',
+    `qw_ext_id` bigint DEFAULT NULL COMMENT '外部联系人id',
+    `qw_user_id` bigint DEFAULT NULL COMMENT '企微userId',
+    `kf_id` varchar(200) DEFAULT NULL COMMENT '客服ID 应用id?',
+    `status` tinyint(1) DEFAULT NULL COMMENT '状态 1会话中 2已结束',
+    `company_id` bigint DEFAULT NULL COMMENT '公司ID',
+    `is_look` tinyint DEFAULT '0' COMMENT '是否查看',
+    `user_type` tinyint(1) DEFAULT '1' COMMENT '用户类型 1微信用户 2小程序用户 3销售用户',
+    `nick_name` varchar(200) DEFAULT NULL COMMENT '客户昵称',
+    `avatar` varchar(200) DEFAULT NULL COMMENT '头像',
+    `is_artificial` int DEFAULT NULL COMMENT '是否转人工',
+    `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+    `update_time` datetime DEFAULT NULL COMMENT '结束时间',
+    `remind_time` datetime DEFAULT NULL COMMENT '需要提醒时间',
+    `remind_status` int DEFAULT NULL COMMENT '0 不需要提醒 1 需要提醒',
+    `remind_count` int DEFAULT NULL COMMENT '提醒次数',
+    `last_time` datetime DEFAULT NULL COMMENT '时间',
+    `is_reply` int DEFAULT '0' COMMENT '转人工是否回复',
+    `user_info` varchar(100) DEFAULT NULL COMMENT '用户信息',
     PRIMARY KEY (`session_id`) USING BTREE,
-    INDEX           `user_id`(`user_id` ASC) USING BTREE,
-    INDEX           `qw_ext_id`(`qw_ext_id` ASC) USING BTREE,
-    INDEX           `qw_user_id`(`qw_user_id` ASC) USING BTREE,
-    INDEX           `kf_id`(`kf_id` ASC) USING BTREE,
-    INDEX           `status`(`status` ASC) USING BTREE,
-    INDEX           `is_artificial`(`is_artificial` ASC) USING BTREE,
-    INDEX           `remind_status`(`remind_status` ASC) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 481524 COMMENT = '对话关系表' ROW_FORMAT = DYNAMIC;
+    KEY `user_id` (`user_id`) USING BTREE,
+    KEY `qw_ext_id` (`qw_ext_id`) USING BTREE,
+    KEY `qw_user_id` (`qw_user_id`) USING BTREE,
+    KEY `kf_id` (`kf_id`) USING BTREE,
+    KEY `status` (`status`) USING BTREE,
+    KEY `is_artificial` (`is_artificial`) USING BTREE,
+    KEY `remind_status` (`remind_status`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=481526 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='对话关系表';
 
 -- ----------------------------
 -- Table structure for fastgpt_chat_voice_homo
@@ -3776,33 +3776,33 @@ CREATE TABLE `fastgpt_push_token_total`
 -- Table structure for fastgpt_role
 -- ----------------------------
 DROP TABLE IF EXISTS `fastgpt_role`;
-CREATE TABLE `fastgpt_role`
-(
-    `role_id`            bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
-    `role_name`          varchar(200)   NULL DEFAULT NULL COMMENT '客服名称',
-    `company_id`         bigint NULL DEFAULT NULL COMMENT '所属公司',
-    `create_time`        datetime NULL DEFAULT NULL COMMENT '创建时间',
-    `update_time`        datetime NULL DEFAULT NULL COMMENT '更新时间',
-    `role_type`          tinyint(1) NULL DEFAULT NULL COMMENT '角色类型 1 AI客服',
-    `mode_config_json`   varchar(2000)   NULL DEFAULT NULL COMMENT '模型JSON',
-    `mode`               tinyint(1) NULL DEFAULT NULL COMMENT '模型 2 fastGpt',
-    `avatar`             varchar(500)   NULL DEFAULT NULL COMMENT '客服头像',
-    `kf_id`              varchar(50)   NULL DEFAULT NULL COMMENT '客服ID',
-    `kf_url`             varchar(200)   NULL DEFAULT NULL COMMENT '客服URL',
-    `kf_media_id`        varchar(100)   NULL DEFAULT NULL,
-    `reminder_words`     varchar(2000)   NULL DEFAULT NULL COMMENT '提示词',
-    `bind_corp_id`       varchar(255)   NULL DEFAULT NULL COMMENT '绑定的公司',
-    `contact_info`       varchar(255)   NULL DEFAULT NULL,
-    `channel_type`       varchar(255)   NULL DEFAULT NULL COMMENT '渠道类型',
-    `logistics`          tinyint(1) NULL DEFAULT 0 COMMENT '是否开启物流提醒',
-    `forbid_send_start`  time NULL DEFAULT '00:00:00' COMMENT '禁止起始时间',
-    `forbid_send_end`    time NULL DEFAULT '04:59:59' COMMENT '禁止结束时间',
-    `forbid_status`      tinyint(1) NULL DEFAULT 1 COMMENT '是否禁止时段回复 0是不开启禁止  1是开启禁止 默认为1',
-    `status`             tinyint(1) NULL DEFAULT 0 COMMENT '角色状态 默认为0 0为启用 1为禁用',
-    `send_course_status` tinyint(1) NULL DEFAULT NULL COMMENT '是否发送新客先导课',
-    `course_id`          bigint NULL DEFAULT NULL COMMENT '课程id',
-    PRIMARY KEY (`role_id`) USING BTREE
-) ENGINE = InnoDB AUTO_INCREMENT = 1215 COMMENT = '应用表' ROW_FORMAT = DYNAMIC;
+CREATE TABLE `fastgpt_role` (
+  `role_id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ID',
+  `role_name` varchar(200) DEFAULT NULL COMMENT '客服名称',
+  `company_id` bigint DEFAULT NULL COMMENT '所属公司',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `role_type` tinyint(1) DEFAULT NULL COMMENT '角色类型 1 AI客服',
+  `mode_config_json` varchar(2000) DEFAULT NULL COMMENT '模型JSON',
+  `mode` tinyint(1) DEFAULT NULL COMMENT '模型 2 fastGpt',
+  `avatar` varchar(500) DEFAULT NULL COMMENT '客服头像',
+  `kf_id` varchar(50) DEFAULT NULL COMMENT '客服ID',
+  `kf_url` varchar(200) DEFAULT NULL COMMENT '客服URL',
+  `kf_media_id` varchar(100) DEFAULT NULL,
+  `reminder_words` varchar(2000) DEFAULT NULL COMMENT '提示词',
+  `bind_corp_id` varchar(255) DEFAULT NULL COMMENT '绑定的公司',
+  `contact_info` varchar(255) DEFAULT NULL,
+  `channel_type` varchar(255) DEFAULT NULL COMMENT '渠道类型',
+  `logistics` tinyint(1) DEFAULT '0' COMMENT '是否开启物流提醒',
+  `forbid_send_start` time DEFAULT '00:00:00' COMMENT '禁止起始时间',
+  `forbid_send_end` time DEFAULT '04:59:59' COMMENT '禁止结束时间',
+  `forbid_status` tinyint(1) DEFAULT '1' COMMENT '是否禁止时段回复 0是不开启禁止  1是开启禁止 默认为1',
+  `status` tinyint(1) DEFAULT '0' COMMENT '角色状态 默认为0 0为启用 1为禁用',
+  `send_course_status` tinyint(1) DEFAULT NULL COMMENT '是否发送新客先导课',
+  `course_id` bigint DEFAULT NULL COMMENT '课程id',
+  `user_info` varchar(500) DEFAULT '昵称,性别,联系方式,预算范围,行程时长,预计出行时间,同行关系,核心需求,意向套餐' COMMENT '用户信息',
+  PRIMARY KEY (`role_id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1216 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='应用表';
 
 -- ----------------------------
 -- Table structure for fastgpt_role_tag
@@ -14380,6 +14380,10 @@ CREATE TABLE `qw_external_contact`
                            _utf8mb4'[^0-9]', _utf8mb4'') as char(20) charset utf8mb4)) VIRTUAL NULL,
     `join_group`             int NULL DEFAULT NULL COMMENT '是否被邀请进群0否1是',
     `trace_id`               varchar(500)   NULL DEFAULT NULL COMMENT '广告链路id',
+    `application_external_user_id` varchar(100)   NULL DEFAULT NULL COMMENT '原始userId',
+    `qw_open_user_id` varchar(100)   NULL DEFAULT NULL,
+
+
     PRIMARY KEY (`id`) USING BTREE,
     INDEX                    `external_user_id`(`external_user_id` ASC) USING BTREE,
     INDEX                    `user_id`(`user_id` ASC) USING BTREE,
@@ -15795,7 +15799,8 @@ CREATE TABLE `qw_user`
     `send_msg_type`    int NULL DEFAULT 0 COMMENT '发送消息类型0侧边栏1pad',
     `is_auto`          char(2)   NULL DEFAULT '00' COMMENT '是否自动发课 00、禁用,01、启用',
     `video_get_status` int NULL DEFAULT 1 COMMENT '是否获取视频号消息(0否1是)',
-    `ai_status`        tinyint(1) NULL DEFAULT 0 COMMENT '角色状态 默认为0 0为启用 1为禁用',
+    `ai_status`        tinyint(1) NULL DEFAULT 0 COMMENT '角色状态 默认为0 0为启用 1为禁用',    `qw_open_user_id` varchar(100)   NULL DEFAULT NULL,
+
     PRIMARY KEY (`id`) USING BTREE,
     UNIQUE INDEX `5`(`qw_user_id` ASC, `corp_id` ASC) USING BTREE,
     INDEX              `1`(`id` ASC) USING BTREE,

+ 5 - 1
fs-service/src/main/resources/mapper/fastGpt/FastGptRoleMapper.xml

@@ -27,12 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="forbidStatus"    column="forbid_status"    />
         <result property="sendCourseStatus"    column="send_course_status"    />
         <result property="courseId"    column="course_id"    />
+        <result property="userInfo"    column="user_info"    />
     </resultMap>
 
     <sql id="selectFastGptRoleVo">
         select role_id, role_name,contact_info,company_id, create_time, update_time, role_type, mode_config_json,
                mode, kf_id, kf_url, avatar, kf_media_id,reminder_words, bind_corp_id,channel_type,logistics,forbid_send_start,
-               forbid_send_end,forbid_status,send_course_status,course_id
+               forbid_send_end,forbid_status,send_course_status,course_id,user_info
         from fastgpt_role
     </sql>
 
@@ -111,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reminderWords != null">reminder_words,</if>
             <if test="bindCorpId != null">bind_corp_id,</if>
             <if test="contactInfo != null">contact_info,</if>
+            <if test="userInfo != null">user_info,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="roleName != null">#{roleName},</if>
@@ -127,6 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="reminderWords != null">#{reminderWords},</if>
             <if test="bindCorpId != null">#{bindCorpId},</if>
             <if test="contactInfo != null">#{contactInfo},</if>
+            <if test="userInfo != null">#{userInfo},</if>
         </trim>
     </insert>
 
@@ -152,6 +155,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="forbidStatus != null">forbid_status = #{forbidStatus},</if>
             <if test="sendCourseStatus != null">send_course_status = #{sendCourseStatus},</if>
             <if test="courseId != null">course_id = #{courseId},</if>
+            <if test="userInfo != null">user_info = #{userInfo},</if>
         </trim>
         where role_id = #{roleId}
     </update>

+ 2 - 0
fs-service/src/main/resources/mapper/qw/QwCompanyMapper.xml

@@ -113,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="shareAppId != null">share_app_id,</if>
             <if test="shareAgentId != null">share_agent_id,</if>
             <if test="shareSchema != null">share_schema,</if>
+            <if test="permanentCode != null">permanent_code,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="corpId != null">#{corpId},</if>
@@ -142,6 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="shareAppId != null">#{shareAppId},</if>
             <if test="shareAgentId != null">#{shareAgentId},</if>
             <if test="shareSchema != null">#{shareSchema},</if>
+            <if test="permanentCode != null">#{permanentCode},</if>
          </trim>
     </insert>