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

今正总后台新增
-企业标签
-ai 会话记录,聊天记录
-好友欢迎语

lk 6 дней назад
Родитель
Сommit
49945c6a13

+ 16 - 0
fs-admin/src/main/java/com/fs/company/controller/CompanyUserController.java

@@ -9,10 +9,12 @@ import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.his.vo.OptionsVO;
 import com.fs.qw.dto.UserProjectDTO;
+import com.fs.qw.vo.QwUserVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -198,4 +200,18 @@ public class CompanyUserController extends BaseController
         List<OptionsVO> companyUserList = companyUserService.selectCompanyUserListByMap(params);
         return R.ok().put("data", new PageInfo<>(companyUserList));
     }
+    @GetMapping("/getQwAllUserList/{id}/{companyId}")
+    public R getQwAllUserList(@PathVariable("id") String corpId,@PathVariable("companyId") Long companyId)
+    {
+
+        List<QwUserVO> list = companyUserService.selectCompanyQwUserList(corpId,companyId);
+        return  R.ok().put("data",list);
+    }
+    @GetMapping("/getCompanyList/{id}")
+    public R getCompanyList(@PathVariable("id") String corpId)
+    {
+
+        List<Company> list = companyUserService.getCompanyList(corpId);
+        return  R.ok().put("data",list);
+    }
 }

+ 133 - 0
fs-admin/src/main/java/com/fs/fastGpt/FastGptChatMsgController.java

@@ -0,0 +1,133 @@
+package com.fs.fastGpt;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.fastGpt.domain.FastGptChatMsg;
+import com.fs.fastGpt.param.FastGptChatMsgListCParam;
+import com.fs.fastGpt.service.IFastGptChatMsgLogsService;
+import com.fs.fastGpt.service.IFastGptChatMsgService;
+import com.fs.fastGpt.vo.FastGptChatMsgListCVO;
+//import com.fs.framework.security.LoginUser;
+//import com.fs.framework.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 聊天记录Controller
+ *
+ * @author fs
+ * @date 2024-10-10
+ */
+@RestController
+@RequestMapping("/fastGpt/fastGptChatMsg")
+public class FastGptChatMsgController extends BaseController
+{
+    @Autowired
+    private IFastGptChatMsgService fastGptChatMsgService;
+
+//    @Autowired
+//    private TokenService tokenService;
+
+    @Autowired
+    private IFastGptChatMsgLogsService iFastGptChatMsgLogsService;
+
+    /**
+     * 查询聊天记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FastGptChatMsgListCParam param)
+    {
+        startPage();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        param.setCompanyId(loginUser.getCompany().getCompanyId());
+
+        List<FastGptChatMsgListCVO> list = fastGptChatMsgService.selectFastGptChatMsgListCVO(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出聊天记录列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:export')")
+    @Log(title = "聊天记录", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FastGptChatMsg fastGptChatMsg)
+    {
+        List<FastGptChatMsg> list = fastGptChatMsgService.selectFastGptChatMsgList(fastGptChatMsg);
+        ExcelUtil<FastGptChatMsg> util = new ExcelUtil<FastGptChatMsg>(FastGptChatMsg.class);
+        return util.exportExcel(list, "聊天记录数据");
+    }
+
+    /**
+     * 获取聊天记录详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:query')")
+    @GetMapping(value = "/{msgId}")
+    public AjaxResult getInfo(@PathVariable("msgId") Long msgId)
+    {
+        return AjaxResult.success(fastGptChatMsgService.selectFastGptChatMsgVOByMsgId(msgId));
+    }
+
+//    /**
+//     * 新增聊天记录
+//     */
+//    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:add')")
+//    @Log(title = "聊天记录", businessType = BusinessType.INSERT)
+//    @PostMapping
+//    public AjaxResult add(@RequestBody FastGptChatMsg fastGptChatMsg)
+//    {
+//        return toAjax(fastGptChatMsgService.insertFastGptChatMsg(fastGptChatMsg));
+//    }
+
+//    /**
+//     * 修改聊天记录
+//     */
+//    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:edit')")
+//    @Log(title = "聊天记录", businessType = BusinessType.UPDATE)
+//    @PutMapping
+//    public AjaxResult edit(@RequestBody FastGptChatMsg param)
+//    {
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        FastGptChatMsg fastGptChatMsg = fastGptChatMsgService.selectFastGptChatMsgByMsgId(param.getMsgId());
+//
+//        FastGptChatMsgLogs logs = new FastGptChatMsgLogs();
+//
+//        logs.setMsgId(param.getMsgId());
+//        logs.setLogsType(2);
+//        if (param.getContent()!=null&&!param.getContent().equals("")){
+//            logs.setContent(param.getContent());
+//        }
+//        if (param.getStatus()!=null){
+//            logs.setLogsType(1);
+//        }
+//        String userContent = fastGptChatMsgService.selectUserContent(fastGptChatMsg.getMsgId(), fastGptChatMsg.getUserId(),fastGptChatMsg.getRoleId());
+//        logs.setSContent(fastGptChatMsg.getContent());
+//        logs.setUserContent(userContent);
+//        logs.setCompanyUserId(loginUser.getUser().getUserId());
+//        logs.setCreateBy(loginUser.getUser().getNickName());
+//        logs.setCompanyId(loginUser.getCompany().getCompanyId());
+//
+//        iFastGptChatMsgLogsService.insertFastGptChatMsgLogs(logs);
+//
+//        return toAjax(fastGptChatMsgService.updateFastGptChatMsg(param));
+//    }
+
+//    /**
+//     * 删除聊天记录
+//     */
+//    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsg:remove')")
+//    @Log(title = "聊天记录", businessType = BusinessType.DELETE)
+//	@DeleteMapping("/{msgIds}")
+//    public AjaxResult remove(@PathVariable Long[] msgIds)
+//    {
+//        return toAjax(fastGptChatMsgService.deleteFastGptChatMsgByMsgIds(msgIds));
+//    }
+}

+ 116 - 0
fs-admin/src/main/java/com/fs/fastGpt/FastGptChatMsgLogsController.java

@@ -0,0 +1,116 @@
+package com.fs.fastGpt;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.fastGpt.domain.FastGptChatMsgLogs;
+import com.fs.fastGpt.param.FastGptChatMsgLogsListParam;
+import com.fs.fastGpt.service.IFastGptChatMsgLogsService;
+import com.fs.fastGpt.vo.FastGptChatMsgLogsListCVO;
+import com.fs.fastGpt.vo.FastGptChatMsgLogsVO;
+//import com.fs.framework.security.LoginUser;
+//import com.fs.framework.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 聊天记录日志Controller
+ *
+ * @author fs
+ * @date 2024-10-10
+ */
+@RestController
+@RequestMapping("/fastGpt/fastGptChatMsgLogs")
+public class FastGptChatMsgLogsController extends BaseController
+{
+    @Autowired
+    private IFastGptChatMsgLogsService fastGptChatMsgLogsService;
+
+//    @Autowired
+//    private TokenService tokenService;
+
+    /**
+     * 查询聊天记录日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FastGptChatMsgLogs fastGptChatMsgLogs)
+    {
+        startPage();
+        List<FastGptChatMsgLogsVO> list = fastGptChatMsgLogsService.selectFastGptChatMsgLogsListVO(fastGptChatMsgLogs);
+        return getDataTable(list);
+    }
+
+//    @GetMapping("/logsList")
+//    public R list(FastGptChatMsgLogsListParam param)
+//    {
+//        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        param.setCompanyId(loginUser.getCompany().getCompanyId());
+//
+//        List<FastGptChatMsgLogsListCVO> list= fastGptChatMsgLogsService.selectFastGptChatMsgLogsListCVO(param);
+//        PageInfo<FastGptChatMsgLogsListCVO> listPageInfo=new PageInfo<>(list);
+//        return R.ok().put("data",listPageInfo);
+//    }
+    /**
+     * 导出聊天记录日志列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:export')")
+    @Log(title = "聊天记录日志", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FastGptChatMsgLogsListParam param)
+    {
+        List<FastGptChatMsgLogsListCVO> list = fastGptChatMsgLogsService.selectFastGptChatMsgLogsListCVO(param);
+        ExcelUtil<FastGptChatMsgLogsListCVO> util = new ExcelUtil<FastGptChatMsgLogsListCVO>(FastGptChatMsgLogsListCVO.class);
+        return util.exportExcel(list, "聊天记录日志数据");
+    }
+
+    /**
+     * 获取聊天记录日志详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:query')")
+    @GetMapping(value = "/{logsId}")
+    public AjaxResult getInfo(@PathVariable("logsId") Long logsId)
+    {
+        return AjaxResult.success(fastGptChatMsgLogsService.selectFastGptChatMsgLogsByLogsId(logsId));
+    }
+
+    /**
+     * 新增聊天记录日志
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:add')")
+    @Log(title = "聊天记录日志", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FastGptChatMsgLogs fastGptChatMsgLogs)
+    {
+        return toAjax(fastGptChatMsgLogsService.insertFastGptChatMsgLogs(fastGptChatMsgLogs));
+    }
+
+    /**
+     * 修改聊天记录日志
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:edit')")
+    @Log(title = "聊天记录日志", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FastGptChatMsgLogs fastGptChatMsgLogs)
+    {
+        return toAjax(fastGptChatMsgLogsService.updateFastGptChatMsgLogs(fastGptChatMsgLogs));
+    }
+
+    /**
+     * 删除聊天记录日志
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatMsgLogs:remove')")
+    @Log(title = "聊天记录日志", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{logsIds}")
+    public AjaxResult remove(@PathVariable Long[] logsIds)
+    {
+        return toAjax(fastGptChatMsgLogsService.deleteFastGptChatMsgLogsByLogsIds(logsIds));
+    }
+}

+ 121 - 0
fs-admin/src/main/java/com/fs/fastGpt/FastGptChatSessionController.java

@@ -0,0 +1,121 @@
+package com.fs.fastGpt;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+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.poi.ExcelUtil;
+import com.fs.fastGpt.domain.FastGptChatSession;
+import com.fs.fastGpt.param.FastGptChatSessionParam;
+import com.fs.fastGpt.service.IFastGptChatMsgService;
+import com.fs.fastGpt.service.IFastGptChatSessionService;
+import com.fs.fastGpt.vo.FastGptChatMsgCVO;
+import com.fs.fastGpt.vo.FastGptChatSessionCVO;
+import com.fs.fastGpt.vo.FastGptChatSessionListCVO;
+//import com.fs.framework.security.LoginUser;
+//import com.fs.framework.service.TokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 对话关系Controller
+ *
+ * @author fs
+ * @date 2024-10-10
+ */
+@RestController
+@RequestMapping("/fastGpt/fastGptChatSession")
+public class FastGptChatSessionController extends BaseController
+{
+    @Autowired
+    private IFastGptChatSessionService fastGptChatSessionService;
+
+//    @Autowired
+//    private TokenService tokenService;
+
+    @Autowired
+    private IFastGptChatMsgService fastGptChatMsgService;
+
+
+    /**
+     * 查询对话关系列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FastGptChatSessionParam param)
+    {
+        startPage();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        param.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<FastGptChatSessionListCVO> list = fastGptChatSessionService.selectFastGptChatSessionListCVO(param);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出对话关系列表
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:export')")
+    @Log(title = "对话关系", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FastGptChatSession fastGptChatSession)
+    {
+        List<FastGptChatSession> list = fastGptChatSessionService.selectFastGptChatSessionList(fastGptChatSession);
+        ExcelUtil<FastGptChatSession> util = new ExcelUtil<FastGptChatSession>(FastGptChatSession.class);
+        return util.exportExcel(list, "对话关系数据");
+    }
+
+    /**
+     * 获取对话关系详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:query')")
+    @GetMapping(value = "/{sessionId}")
+    public R getInfo(@PathVariable("sessionId") Long sessionId)
+    {
+        FastGptChatSessionCVO sessionCVO = fastGptChatSessionService.selectFastGptChatSessionCVOBySessionId(sessionId);
+
+        List<FastGptChatMsgCVO> list = fastGptChatMsgService.selectFastGptChatMsgCVOBySessionId(sessionId,sessionCVO.getUserId());
+
+        return R.ok().put("data",sessionCVO).put("list",list);
+    }
+
+    /**
+     * 新增对话关系
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:add')")
+    @Log(title = "对话关系", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FastGptChatSession fastGptChatSession)
+    {
+        return toAjax(fastGptChatSessionService.insertFastGptChatSession(fastGptChatSession));
+    }
+
+    /**
+     * 修改对话关系
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:edit')")
+    @Log(title = "对话关系", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FastGptChatSession fastGptChatSession)
+    {
+        FastGptChatSession session = new FastGptChatSession();
+        session.setSessionId(fastGptChatSession.getSessionId());
+        session.setIsArtificial(fastGptChatSession.getIsArtificial());
+        return toAjax(fastGptChatSessionService.updateFastGptChatSession(session));
+    }
+
+    /**
+     * 删除对话关系
+     */
+    @PreAuthorize("@ss.hasPermi('fastGpt:fastGptChatSession:remove')")
+    @Log(title = "对话关系", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{sessionIds}")
+    public AjaxResult remove(@PathVariable Long[] sessionIds)
+    {
+        return toAjax(fastGptChatSessionService.deleteFastGptChatSessionBySessionIds(sessionIds));
+    }
+}

+ 83 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwTagGroupController.java

@@ -1,12 +1,19 @@
 package com.fs.qw.controller;
 
+import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+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.poi.ExcelUtil;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.service.IQwTagGroupService;
+import com.fs.qw.vo.QwTagGroupAddParam;
 import com.fs.qw.vo.QwTagGroupListVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -50,4 +57,80 @@ public class QwTagGroupController extends BaseController
         List<QwTagGroupListVO> list = qwTagGroupService.selectQwTagGroupListVO(qwTagGroup);
         return getDataTable(list);
     }
+
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:sync')")
+    @Log(title = "同步标签", businessType = BusinessType.INSERT)
+    @PostMapping("/syncTag/{corpId}")
+    public R syncTag(@PathVariable("corpId") String corpId)
+    {
+
+        return qwTagGroupService.syncQwTagGroup(corpId);
+    }
+    /**
+     * 查询企微客户标签组列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwTagGroup qwTagGroup)
+    {
+        startPage();
+
+        List<QwTagGroupListVO> list = qwTagGroupService.selectQwTagGroupListVO(qwTagGroup);
+        return getDataTable(list);
+    }
+    /**
+     * 获取企微客户标签组详细信息
+     */
+//    @PreAuthorize("@ss.hasPermi('qw:tagGroup:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwTagGroupService.selectQwTagGroupByIdVO(id));
+    }
+    /**
+     * 删除企微客户标签组
+     */
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:remove')")
+    @Log(title = "企微客户标签组", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public R remove(@PathVariable Long[] ids)
+    {
+
+        return qwTagGroupService.deleteQwTagGroupByIds(ids);
+    }
+    /**
+     * 新增企微客户标签组
+     */
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:add')")
+    @Log(title = "企微客户标签组", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwTagGroupAddParam qwTagGroup)
+    {
+
+        return toAjax(qwTagGroupService.insertQwTagGroupParam(qwTagGroup));
+    }
+    /**
+     * 修改企微客户标签组
+     */
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:edit')")
+    @Log(title = "企微客户标签组", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwTagGroupAddParam qwTagGroup)
+    {
+
+        return toAjax(qwTagGroupService.updateQwTagGroupParam(qwTagGroup));
+    }
+    /**
+     * 导出企微客户标签组列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:export')")
+    @Log(title = "企微客户标签组", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(QwTagGroup qwTagGroup)
+    {
+
+        List<QwTagGroup> list = qwTagGroupService.selectQwTagGroupList(qwTagGroup);
+        ExcelUtil<QwTagGroup> util = new ExcelUtil<QwTagGroup>(QwTagGroup.class);
+        return util.exportExcel(list, "企微客户标签组数据");
+    }
 }

+ 3 - 0
fs-service/src/main/java/com/fs/company/mapper/CompanyMapper.java

@@ -250,4 +250,7 @@ public interface CompanyMapper
             " `status` != 0   " +
             " and is_del != 1 ")
     List<CompanyVO> getCompanyDropList();
+
+    @Select("select company_id,company_name from company where FIND_IN_SET( company_id , (select company_ids from qw_company where corp_id = #{corpId})) ")
+    List<Company> getCompanyList(@Param("corpId") String corpId);
 }

+ 3 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyUserService.java

@@ -1,6 +1,7 @@
 package com.fs.company.service;
 
 import com.fs.common.core.domain.R;
+import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.param.CompanyUserAreaParam;
 import com.fs.company.param.CompanyUserCodeParam;
@@ -273,4 +274,6 @@ public interface ICompanyUserService {
      * @return
      */
     List<CompanyUser> getDataScopeCompanyUser(Long companyUserId);
+
+    List<Company> getCompanyList(String corpId);
 }

+ 8 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyUserServiceImpl.java

@@ -127,6 +127,8 @@ public class CompanyUserServiceImpl implements ICompanyUserService
 
     @Autowired
     private CompanyRoleMapper companyRoleMapper;
+    @Autowired
+    private CompanyMapper companyMapper;
 
 
     /**
@@ -1120,4 +1122,10 @@ public class CompanyUserServiceImpl implements ICompanyUserService
         }
         return companyUsers;
     }
+
+    @Override
+    public List<Company> getCompanyList(String corpId) {
+        return companyMapper.getCompanyList(corpId);
+
+    }
 }