已重命名7个文件
已修改8个文件
已添加12个文件
已删除1个文件
| | |
| | | |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.system.domain.ChatModel; |
| | | import org.ruoyi.domain.ChatModel; |
| | | import org.ruoyi.common.mybatis.core.domain.BaseEntity; |
| | | import io.github.linpeilie.annotations.AutoMapper; |
| | | import lombok.Data; |
| | |
| | | * éè¿æ¨¡ååç§°è·å模åä¿¡æ¯ |
| | | */ |
| | | ChatModelVo selectModelByName(String modelName); |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Collection; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * è天模åServiceä¸å¡å±å¤ç |
| | |
| | | public class ChatModelServiceImpl implements IChatModelService { |
| | | |
| | | private final ChatModelMapper baseMapper; |
| | | |
| | | |
| | | /** |
| | | * æ¥è¯¢è天模å |
| | |
| | | public ChatModelVo selectModelByName(String modelName) { |
| | | return baseMapper.selectVoOne(Wrappers.<ChatModel>lambdaQuery().eq(ChatModel::getModelName, modelName)); |
| | | } |
| | | |
| | | |
| | | } |
ÎļþÃû´Ó ruoyi-modules-api/ruoyi-chat-api/src/main/java/org/ruoyi/service/IChatConfigService.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.service; |
| | | package org.ruoyi.system.service; |
| | | |
| | | |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.system.domain.bo.ChatConfigBo; |
| | | import org.ruoyi.system.domain.vo.ChatConfigVo; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.ruoyi.common.core.service.ConfigService; |
| | | import org.ruoyi.common.core.utils.MapstructUtils; |
| | | import org.ruoyi.common.core.utils.StringUtils; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.system.domain.ChatConfig; |
| | | import org.ruoyi.system.domain.bo.ChatConfigBo; |
| | | import org.ruoyi.system.domain.vo.ChatConfigVo; |
| | | import org.ruoyi.system.mapper.ChatConfigMapper; |
| | | import org.ruoyi.system.service.IChatConfigService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Service |
| | | public class ChatConfigServiceImpl implements ConfigService { |
| | | public class ChatConfigServiceImpl implements ConfigService, IChatConfigService { |
| | | |
| | | private final ChatConfigMapper baseMapper; |
| | | |
| | |
| | | return chatConfigVo.getConfigValue(); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public ChatConfigVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é
置信æ¯å表 |
| | | */ |
| | | @Override |
| | | public TableDataInfo<ChatConfigVo> queryPageList(ChatConfigBo bo, PageQuery pageQuery) { |
| | | LambdaQueryWrapper<ChatConfig> lqw = buildQueryWrapper(bo); |
| | | Page<ChatConfigVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); |
| | | return TableDataInfo.build(result); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢é
置信æ¯å表 |
| | | */ |
| | | @Override |
| | | public List<ChatConfigVo> queryList(ChatConfigBo bo) { |
| | | LambdaQueryWrapper<ChatConfig> lqw = buildQueryWrapper(bo); |
| | | return baseMapper.selectVoList(lqw); |
| | | } |
| | | |
| | | private LambdaQueryWrapper<ChatConfig> buildQueryWrapper(ChatConfigBo bo) { |
| | | Map<String, Object> params = bo.getParams(); |
| | | LambdaQueryWrapper<ChatConfig> lqw = Wrappers.lambdaQuery(); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getCategory()), ChatConfig::getCategory, bo.getCategory()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getConfigName()), ChatConfig::getConfigName, bo.getConfigName()); |
| | | lqw.like(StringUtils.isNotBlank(bo.getConfigName()), ChatConfig::getConfigName, bo.getConfigName()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getConfigValue()), ChatConfig::getConfigValue, bo.getConfigValue()); |
| | | lqw.eq(StringUtils.isNotBlank(bo.getConfigDict()), ChatConfig::getConfigDict, bo.getConfigDict()); |
| | | return lqw; |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public Boolean insertByBo(ChatConfigBo bo) { |
| | | ChatConfig add = MapstructUtils.convert(bo, ChatConfig.class); |
| | | validEntityBeforeSave(add); |
| | | boolean flag = baseMapper.insert(add) > 0; |
| | | if (flag) { |
| | | bo.setId(add.getId()); |
| | | } |
| | | return flag; |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public Boolean updateByBo(ChatConfigBo bo) { |
| | | ChatConfig update = MapstructUtils.convert(bo, ChatConfig.class); |
| | | validEntityBeforeSave(update); |
| | | return baseMapper.updateById(update) > 0; |
| | | } |
| | | |
| | | /** |
| | | * ä¿ååçæ°æ®æ ¡éª |
| | | */ |
| | | private void validEntityBeforeSave(ChatConfig entity){ |
| | | //TODO åä¸äºæ°æ®æ ¡éª,å¦å¯ä¸çº¦æ |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @Override |
| | | public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { |
| | | if(isValid){ |
| | | //TODO åä¸äºä¸å¡ä¸çæ ¡éª,夿æ¯å¦éè¦æ ¡éª |
| | | } |
| | | return baseMapper.deleteBatchIds(ids) > 0; |
| | | } |
| | | |
| | | } |
| | |
| | | <module>ruoyi-generator</module> |
| | | </modules> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.ruoyi</groupId> |
| | | <artifactId>ruoyi-common-web</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.ruoyi</groupId> |
| | | <artifactId>ruoyi-common-idempotent</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | </project> |
| | |
| | | <artifactId>ruoyi-chat-api</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.ruoyi</groupId> |
| | | <artifactId>ruoyi-system-api</artifactId> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/ChatController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | |
| | | import jakarta.servlet.http.HttpServletRequest; |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/FaceController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.Api; |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/LumaController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.ApiOperation; |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/SubmitController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.Api; |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/SunoController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.ApiOperation; |
ÎļþÃû´Ó ruoyi-modules/ruoyi-chat/src/main/java/org/ruoyi/chat/controller/TaskController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.chat.controller; |
| | | package org.ruoyi.chat.controller.api; |
| | | |
| | | import cn.hutool.json.JSONUtil; |
| | | import io.swagger.annotations.Api; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.domain.bo.ChatAgentManageBo; |
| | | import org.ruoyi.service.IChatAgentManageService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | import org.ruoyi.system.domain.vo.ChatAgentManageVo; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * æºè½ä½ç®¡ç |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/agentManage") |
| | | public class ChatAgentManageController extends BaseController { |
| | | |
| | | private final IChatAgentManageService chatAgentManageService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æºè½ä½ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:agentManage:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatAgentManageVo> list(ChatAgentManageBo bo, PageQuery pageQuery) { |
| | | return chatAgentManageService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæºè½ä½ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:agentManage:export") |
| | | @Log(title = "æºè½ä½ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatAgentManageBo bo, HttpServletResponse response) { |
| | | List<ChatAgentManageVo> list = chatAgentManageService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "æºè½ä½ç®¡ç", ChatAgentManageVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæºè½ä½ç®¡ç详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:agentManage:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatAgentManageVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatAgentManageService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æºè½ä½ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:agentManage:add") |
| | | @Log(title = "æºè½ä½ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatAgentManageBo bo) { |
| | | return toAjax(chatAgentManageService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æºè½ä½ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:agentManage:edit") |
| | | @Log(title = "æºè½ä½ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatAgentManageBo bo) { |
| | | return toAjax(chatAgentManageService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿ºè½ä½ç®¡ç |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:agentManage:remove") |
| | | @Log(title = "æºè½ä½ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatAgentManageService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.domain.bo.ChatAppStoreBo; |
| | | import org.ruoyi.service.IChatAppStoreService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | import org.ruoyi.system.domain.vo.ChatAppStoreVo; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * åºç¨ååº |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/appStore") |
| | | public class ChatAppStoreController extends BaseController { |
| | | |
| | | private final IChatAppStoreService chatAppStoreService; |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¨ååºå表 |
| | | */ |
| | | @SaCheckPermission("system:appStore:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatAppStoreVo> list(ChatAppStoreBo bo, PageQuery pageQuery) { |
| | | return chatAppStoreService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåºç¨ååºå表 |
| | | */ |
| | | @SaCheckPermission("system:appStore:export") |
| | | @Log(title = "åºç¨ååº", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatAppStoreBo bo, HttpServletResponse response) { |
| | | List<ChatAppStoreVo> list = chatAppStoreService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "åºç¨ååº", ChatAppStoreVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·ååºç¨ååºè¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:appStore:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatAppStoreVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatAppStoreService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åºç¨ååº |
| | | */ |
| | | @SaCheckPermission("system:appStore:add") |
| | | @Log(title = "åºç¨ååº", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatAppStoreBo bo) { |
| | | return toAjax(chatAppStoreService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åºç¨ååº |
| | | */ |
| | | @SaCheckPermission("system:appStore:edit") |
| | | @Log(title = "åºç¨ååº", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatAppStoreBo bo) { |
| | | return toAjax(chatAppStoreService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åºç¨ååº |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:appStore:remove") |
| | | @Log(title = "åºç¨ååº", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatAppStoreService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.system.domain.bo.ChatConfigBo; |
| | | import org.ruoyi.system.domain.vo.ChatConfigVo; |
| | | import org.ruoyi.system.service.IChatConfigService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/config") |
| | | public class ChatConfigController extends BaseController { |
| | | |
| | | private final IChatConfigService chatConfigService; |
| | | |
| | | /** |
| | | * æ¥è¯¢é
置信æ¯å表 |
| | | */ |
| | | @SaCheckPermission("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatConfigVo> list(ChatConfigBo bo, PageQuery pageQuery) { |
| | | return chatConfigService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºé
置信æ¯å表 |
| | | */ |
| | | @SaCheckPermission("system:config:export") |
| | | @Log(title = "é
置信æ¯", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatConfigBo bo, HttpServletResponse response) { |
| | | List<ChatConfigVo> list = chatConfigService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "é
置信æ¯", ChatConfigVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åé
置信æ¯è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:config:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatConfigVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatConfigService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @SaCheckPermission("system:config:add") |
| | | @Log(title = "é
置信æ¯", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatConfigBo bo) { |
| | | return toAjax(chatConfigService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹é
ç½®ä¿¡æ¯ |
| | | */ |
| | | @SaCheckPermission("system:config:edit") |
| | | @Log(title = "é
置信æ¯", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatConfigBo bo) { |
| | | return toAjax(chatConfigService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:config:remove") |
| | | @Log(title = "é
置信æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatConfigService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatGptsBo; |
| | | import org.ruoyi.domain.vo.ChatGptsVo; |
| | | import org.ruoyi.service.IChatGptsService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * åºç¨ç®¡ç |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/gpts") |
| | | public class ChatGptsController extends BaseController { |
| | | |
| | | private final IChatGptsService chatGptsService; |
| | | |
| | | /** |
| | | * æ¥è¯¢åºç¨ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:gpts:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatGptsVo> list(ChatGptsBo bo, PageQuery pageQuery) { |
| | | return chatGptsService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåºç¨ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:gpts:export") |
| | | @Log(title = "åºç¨ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatGptsBo bo, HttpServletResponse response) { |
| | | List<ChatGptsVo> list = chatGptsService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "åºç¨ç®¡ç", ChatGptsVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·ååºç¨ç®¡ç详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:gpts:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatGptsVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatGptsService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢åºç¨ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:gpts:add") |
| | | @Log(title = "åºç¨ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatGptsBo bo) { |
| | | return toAjax(chatGptsService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹åºç¨ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:gpts:edit") |
| | | @Log(title = "åºç¨ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatGptsBo bo) { |
| | | return toAjax(chatGptsService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åºç¨ç®¡ç |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:gpts:remove") |
| | | @Log(title = "åºç¨ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatGptsService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatMessageBo; |
| | | import org.ruoyi.domain.vo.ChatMessageVo; |
| | | import org.ruoyi.service.IChatMessageService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * èå¤©æ¶æ¯ |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/message") |
| | | public class ChatMessageController extends BaseController { |
| | | |
| | | private final IChatMessageService chatMessageService; |
| | | |
| | | /** |
| | | * æ¥è¯¢èå¤©æ¶æ¯å表 |
| | | */ |
| | | @SaCheckPermission("system:message:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatMessageVo> list(ChatMessageBo bo, PageQuery pageQuery) { |
| | | return chatMessageService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºèå¤©æ¶æ¯å表 |
| | | */ |
| | | @SaCheckPermission("system:message:export") |
| | | @Log(title = "èå¤©æ¶æ¯", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatMessageBo bo, HttpServletResponse response) { |
| | | List<ChatMessageVo> list = chatMessageService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "èå¤©æ¶æ¯", ChatMessageVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åèå¤©æ¶æ¯è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:message:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatMessageVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatMessageService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢èå¤©æ¶æ¯ |
| | | */ |
| | | @SaCheckPermission("system:message:add") |
| | | @Log(title = "èå¤©æ¶æ¯", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatMessageBo bo) { |
| | | return toAjax(chatMessageService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹èå¤©æ¶æ¯ |
| | | */ |
| | | @SaCheckPermission("system:message:edit") |
| | | @Log(title = "èå¤©æ¶æ¯", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatMessageBo bo) { |
| | | return toAjax(chatMessageService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤èå¤©æ¶æ¯ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:message:remove") |
| | | @Log(title = "èå¤©æ¶æ¯", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatMessageService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.chat.service.chat.UserModelService; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatModelBo; |
| | | import org.ruoyi.domain.vo.ChatModelVo; |
| | | import org.ruoyi.service.IChatModelService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * è天模å |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/model") |
| | | public class ChatModelController extends BaseController { |
| | | |
| | | private final IChatModelService chatModelService; |
| | | |
| | | private final UserModelService modelService; |
| | | |
| | | /** |
| | | * æ¥è¯¢è天模åå表 |
| | | */ |
| | | @SaCheckPermission("system:model:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatModelVo> list(ChatModelBo bo, PageQuery pageQuery) { |
| | | return chatModelService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·æ¨¡åå表 |
| | | */ |
| | | @GetMapping("/modelList") |
| | | public R<List<ChatModelVo>> modelList(ChatModelBo bo) { |
| | | return R.ok(modelService.modelList(bo)); |
| | | } |
| | | |
| | | /** |
| | | * 导åºè天模åå表 |
| | | */ |
| | | @SaCheckPermission("system:model:export") |
| | | @Log(title = "è天模å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatModelBo bo, HttpServletResponse response) { |
| | | List<ChatModelVo> list = chatModelService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "è天模å", ChatModelVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åè天模å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:model:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatModelVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatModelService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢è天模å |
| | | */ |
| | | @SaCheckPermission("system:model:add") |
| | | @Log(title = "è天模å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatModelBo bo) { |
| | | return toAjax(chatModelService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹è天模å |
| | | */ |
| | | @SaCheckPermission("system:model:edit") |
| | | @Log(title = "è天模å", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatModelBo bo) { |
| | | return toAjax(chatModelService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤è天模å |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:model:remove") |
| | | @Log(title = "è天模å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatModelService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatPackagePlanBo; |
| | | import org.ruoyi.domain.vo.ChatPackagePlanVo; |
| | | import org.ruoyi.service.IChatPackagePlanService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * å¥é¤ç®¡ç |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/packagePlan") |
| | | public class ChatPackagePlanController extends BaseController { |
| | | |
| | | private final IChatPackagePlanService chatPackagePlanService; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¥é¤ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatPackagePlanVo> list(ChatPackagePlanBo bo, PageQuery pageQuery) { |
| | | return chatPackagePlanService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºå¥é¤ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:export") |
| | | @Log(title = "å¥é¤ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatPackagePlanBo bo, HttpServletResponse response) { |
| | | List<ChatPackagePlanVo> list = chatPackagePlanService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "å¥é¤ç®¡ç", ChatPackagePlanVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åå¥é¤ç®¡ç详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatPackagePlanVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatPackagePlanService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢å¥é¤ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:add") |
| | | @Log(title = "å¥é¤ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatPackagePlanBo bo) { |
| | | return toAjax(chatPackagePlanService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹å¥é¤ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:edit") |
| | | @Log(title = "å¥é¤ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatPackagePlanBo bo) { |
| | | return toAjax(chatPackagePlanService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤å¥é¤ç®¡ç |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:packagePlan:remove") |
| | | @Log(title = "å¥é¤ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatPackagePlanService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatPayOrderBo; |
| | | import org.ruoyi.domain.vo.ChatPayOrderVo; |
| | | import org.ruoyi.service.IChatPayOrderService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * æ¯ä»è®¢å |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/payOrder") |
| | | public class ChatPayOrderController extends BaseController { |
| | | |
| | | private final IChatPayOrderService chatPayOrderService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¯ä»è®¢åå表 |
| | | */ |
| | | @SaCheckPermission("system:payOrder:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatPayOrderVo> list(ChatPayOrderBo bo, PageQuery pageQuery) { |
| | | return chatPayOrderService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæ¯ä»è®¢åå表 |
| | | */ |
| | | @SaCheckPermission("system:payOrder:export") |
| | | @Log(title = "æ¯ä»è®¢å", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatPayOrderBo bo, HttpServletResponse response) { |
| | | List<ChatPayOrderVo> list = chatPayOrderService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "æ¯ä»è®¢å", ChatPayOrderVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¯ä»è®¢å详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:payOrder:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatPayOrderVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatPayOrderService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¯ä»è®¢å |
| | | */ |
| | | @SaCheckPermission("system:payOrder:add") |
| | | @Log(title = "æ¯ä»è®¢å", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatPayOrderBo bo) { |
| | | return toAjax(chatPayOrderService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¯ä»è®¢å |
| | | */ |
| | | @SaCheckPermission("system:payOrder:edit") |
| | | @Log(title = "æ¯ä»è®¢å", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatPayOrderBo bo) { |
| | | return toAjax(chatPayOrderService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å 餿¯ä»è®¢å |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:payOrder:remove") |
| | | @Log(title = "æ¯ä»è®¢å", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatPayOrderService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatPluginBo; |
| | | import org.ruoyi.domain.vo.ChatPluginVo; |
| | | import org.ruoyi.service.IChatPluginService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * æä»¶ç®¡ç |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/plugin") |
| | | public class ChatPluginController extends BaseController { |
| | | |
| | | private final IChatPluginService chatPluginService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æä»¶ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:plugin:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatPluginVo> list(ChatPluginBo bo, PageQuery pageQuery) { |
| | | return chatPluginService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * å¯¼åºæä»¶ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:plugin:export") |
| | | @Log(title = "æä»¶ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatPluginBo bo, HttpServletResponse response) { |
| | | List<ChatPluginVo> list = chatPluginService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "æä»¶ç®¡ç", ChatPluginVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶ç®¡ç详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:plugin:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatPluginVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatPluginService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æä»¶ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:plugin:add") |
| | | @Log(title = "æä»¶ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatPluginBo bo) { |
| | | return toAjax(chatPluginService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æä»¶ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:plugin:edit") |
| | | @Log(title = "æä»¶ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatPluginBo bo) { |
| | | return toAjax(chatPluginService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤æä»¶ç®¡ç |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:plugin:remove") |
| | | @Log(title = "æä»¶ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatPluginService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.common.mybatis.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatVoucherBo; |
| | | import org.ruoyi.domain.vo.ChatVoucherVo; |
| | | import org.ruoyi.service.IChatVoucherService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.common.mybatis.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | /** |
| | | * ç¨æ·å
æ¢è®°å½ |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-04-08 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/voucher") |
| | | public class ChatVoucherController extends BaseController { |
| | | |
| | | private final IChatVoucherService chatVoucherService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ç¨æ·å
æ¢è®°å½å表 |
| | | */ |
| | | @SaCheckPermission("system:voucher:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatVoucherVo> list(ChatVoucherBo bo, PageQuery pageQuery) { |
| | | return chatVoucherService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºç¨æ·å
æ¢è®°å½å表 |
| | | */ |
| | | @SaCheckPermission("system:voucher:export") |
| | | @Log(title = "ç¨æ·å
æ¢è®°å½", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatVoucherBo bo, HttpServletResponse response) { |
| | | List<ChatVoucherVo> list = chatVoucherService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "ç¨æ·å
æ¢è®°å½", ChatVoucherVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åç¨æ·å
æ¢è®°å½è¯¦ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:voucher:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatVoucherVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatVoucherService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ç¨æ·å
æ¢è®°å½ |
| | | */ |
| | | @SaCheckPermission("system:voucher:add") |
| | | @Log(title = "ç¨æ·å
æ¢è®°å½", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatVoucherBo bo) { |
| | | return toAjax(chatVoucherService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ç¨æ·å
æ¢è®°å½ |
| | | */ |
| | | @SaCheckPermission("system:voucher:edit") |
| | | @Log(title = "ç¨æ·å
æ¢è®°å½", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatVoucherBo bo) { |
| | | return toAjax(chatVoucherService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ç¨æ·å
æ¢è®°å½ |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:voucher:remove") |
| | | @Log(title = "ç¨æ·å
æ¢è®°å½", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatVoucherService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * æè¿°ï¼ |
| | | * |
| | | * @author ageerle@163.com |
| | | * date 2025/4/10 |
| | | */ |
| | | @Getter |
| | | public enum DisplayType { |
| | | HIDDEN("1", "䏿¾ç¤º"), |
| | | VISIBLE("0", "æ¾ç¤º"); |
| | | |
| | | private final String code; |
| | | private final String description; |
| | | |
| | | DisplayType(String code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | |
| | | public static DisplayType fromCode(String code) { |
| | | for (DisplayType type : values()) { |
| | | if (type.getCode().equals(code)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * @author ageer |
| | | */ |
| | | @Getter |
| | | public enum UserGradeType { |
| | | UNPAID("0", "æªä»è´¹"), // æªä»è´¹ç¨æ· |
| | | PAID("1", "å·²ä»è´¹"); // å·²ä»è´¹ç¨æ· |
| | | UNPAID("0", "æªä»è´¹"), |
| | | PAID("1", "å·²ä»è´¹"); |
| | | |
| | | private final String code; |
| | | private final String description; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.service.chat; |
| | | |
| | | import cn.dev33.satoken.stp.StpUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.ruoyi.chat.enums.DisplayType; |
| | | import org.ruoyi.chat.enums.UserGradeType; |
| | | import org.ruoyi.common.satoken.utils.LoginHelper; |
| | | import org.ruoyi.domain.bo.ChatModelBo; |
| | | import org.ruoyi.domain.bo.ChatPackagePlanBo; |
| | | import org.ruoyi.domain.vo.ChatModelVo; |
| | | import org.ruoyi.domain.vo.ChatPackagePlanVo; |
| | | import org.ruoyi.service.IChatModelService; |
| | | import org.ruoyi.service.IChatPackagePlanService; |
| | | import org.ruoyi.system.domain.vo.SysUserVo; |
| | | import org.ruoyi.system.service.ISysUserService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æè¿°ï¼ç¨æ·æ¨¡åä¿¡æ¯ |
| | | * |
| | | * @author ageerle@163.com |
| | | * date 2025/4/10 |
| | | */ |
| | | |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class UserModelService { |
| | | |
| | | private final IChatModelService chatModelService; |
| | | |
| | | private final ISysUserService userService; |
| | | |
| | | private final IChatPackagePlanService packagePlanService; |
| | | |
| | | public List<ChatModelVo> modelList(ChatModelBo bo) { |
| | | bo.setModelShow(DisplayType.VISIBLE.getCode()); |
| | | List<ChatModelVo> chatModelList = chatModelService.queryList(bo); |
| | | ChatPackagePlanBo sysPackagePlanBo = new ChatPackagePlanBo(); |
| | | if (StpUtil.isLogin()) { |
| | | Long userId = LoginHelper.getLoginUser().getUserId(); |
| | | SysUserVo sysUserVo = userService.selectUserById(userId); |
| | | if (UserGradeType.UNPAID.getCode().equals(sysUserVo.getUserGrade())){ |
| | | sysPackagePlanBo.setName("Free"); |
| | | ChatPackagePlanVo chatPackagePlanVo = packagePlanService.queryList(sysPackagePlanBo).get(0); |
| | | List<String> array = new ArrayList<>(Arrays.asList(chatPackagePlanVo.getPlanDetail().split(","))); |
| | | chatModelList.removeIf(model -> !array.contains(model.getModelName())); |
| | | } |
| | | }else { |
| | | sysPackagePlanBo.setName("Visitor"); |
| | | ChatPackagePlanVo sysPackagePlanVo = packagePlanService.queryList(sysPackagePlanBo).get(0); |
| | | List<String> array = new ArrayList<>(Arrays.asList(sysPackagePlanVo.getPlanDetail().split(","))); |
| | | chatModelList.removeIf(model -> !array.contains(model.getModelName())); |
| | | } |
| | | return new ArrayList<>(chatModelList); |
| | | } |
| | | |
| | | } |
| | |
| | | import org.ruoyi.chat.enums.BillingType; |
| | | import org.ruoyi.chat.enums.UserGradeType; |
| | | import org.ruoyi.chat.service.chat.IChatCostService; |
| | | import org.ruoyi.common.chat.domain.request.ChatRequest; |
| | | import org.ruoyi.common.chat.request.ChatRequest; |
| | | import org.ruoyi.common.chat.utils.TikTokensUtil; |
| | | import org.ruoyi.common.core.domain.model.LoginUser; |
| | | import org.ruoyi.common.core.exception.ServiceException; |