Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
48dbd6e3fb
@ -83,7 +83,7 @@ public class LabelController {
|
||||
@Operation(summary = "获得标签管理列表所有")
|
||||
// @PreAuthorize("@ss.hasPermission('llm:label:query')")
|
||||
public CommonResult<List<LabelRespVO>> getLabelList() {
|
||||
List<LabelDO> list = labelService.getLabelList();
|
||||
List<LabelDO> list = labelService.getEnableLabelList();
|
||||
return success(BeanUtils.toBean(list, LabelRespVO.class));
|
||||
}
|
||||
|
||||
@ -101,4 +101,4 @@ public class LabelController {
|
||||
BeanUtils.toBean(list, LabelRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class LabelRespVO {
|
||||
|
||||
@Schema(description = "标签排序")
|
||||
@NotNull(message = "标签排序不能为空")
|
||||
@ExcelProperty("排序")
|
||||
private String sorted;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -118,4 +118,11 @@ public class LearningResourcesController {
|
||||
return success(aLong);
|
||||
}
|
||||
|
||||
@PutMapping("/videoViewsUpdate")
|
||||
@Operation(summary = "视频查看量更新")
|
||||
// @PreAuthorize("@ss.hasPermission('llm:learning-resources:update')")
|
||||
public CommonResult<Boolean> videoViewsUpdate(@Valid @RequestBody LearningResourcesSaveReqVO updateReqVO) {
|
||||
learningResourcesService.videoViewsUpdate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
|
@ -146,8 +146,8 @@ public class ModelServiceController {
|
||||
@GetMapping("/download")
|
||||
@Operation(summary = "下载模型")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public List<String> download(@RequestParam("id") Long id){
|
||||
return modelServiceService.getDownLoadList(id);
|
||||
public CommonResult<List<String>> download(@RequestParam("id") Long id){
|
||||
return success(modelServiceService.getDownLoadList(id));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,11 +77,13 @@ public class ApplicationServiceImpl implements ApplicationService {
|
||||
|
||||
//prompt使用量+1
|
||||
Long promptId = application.getPromptId();
|
||||
PromptTemplatesRespVO promptTemplates = promptTemplatesService.getPromptTemplates(promptId);
|
||||
PromptTemplatesDO promptTemplatesDO = new PromptTemplatesDO();
|
||||
promptTemplatesDO.setUseCount(promptTemplates.getUseCount() == null?1:promptTemplates.getUseCount() + 1);
|
||||
promptTemplatesDO.setId(promptTemplates.getId());
|
||||
promptTemplatesService.updatePromptTemplatesById(promptTemplatesDO);
|
||||
if(promptId != null){
|
||||
PromptTemplatesRespVO promptTemplates = promptTemplatesService.getPromptTemplates(promptId);
|
||||
PromptTemplatesDO promptTemplatesDO = new PromptTemplatesDO();
|
||||
promptTemplatesDO.setUseCount(promptTemplates.getUseCount() == null?1:promptTemplates.getUseCount() + 1);
|
||||
promptTemplatesDO.setId(promptTemplates.getId());
|
||||
promptTemplatesService.updatePromptTemplatesById(promptTemplatesDO);
|
||||
}
|
||||
// 返回
|
||||
return application.getId();
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package cn.iocoder.yudao.module.llm.service.label;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.*;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.LabelPageReqVO;
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.LabelSaveReqVO;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
@ -22,21 +22,21 @@ public interface LabelService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createLabel(@Valid LabelSaveReqVO createReqVO);
|
||||
Long createLabel (@Valid LabelSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新标签管理
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateLabel(@Valid LabelSaveReqVO updateReqVO);
|
||||
void updateLabel (@Valid LabelSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除标签管理
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteLabel(Long id);
|
||||
void deleteLabel (Long id);
|
||||
|
||||
/**
|
||||
* 获得标签管理
|
||||
@ -44,7 +44,7 @@ public interface LabelService {
|
||||
* @param id 编号
|
||||
* @return 标签管理
|
||||
*/
|
||||
LabelDO getLabel(Long id);
|
||||
LabelDO getLabel (Long id);
|
||||
|
||||
/**
|
||||
* 获得标签管理分页
|
||||
@ -52,8 +52,19 @@ public interface LabelService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 标签管理分页
|
||||
*/
|
||||
PageResult<LabelDO> getLabelPage(LabelPageReqVO pageReqVO);
|
||||
// 获取所有标签
|
||||
List<LabelDO> getLabelList();
|
||||
PageResult<LabelDO> getLabelPage (LabelPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取所有标签
|
||||
*
|
||||
* @return 标签列表
|
||||
*/
|
||||
List<LabelDO> getLabelList ();
|
||||
|
||||
/**
|
||||
* 获取所有已开启的标签
|
||||
*
|
||||
* @return 标签列表
|
||||
*/
|
||||
List<LabelDO> getEnableLabelList ();
|
||||
}
|
||||
|
@ -1,10 +1,13 @@
|
||||
package cn.iocoder.yudao.module.llm.service.label;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.label.vo.*;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.label.LabelDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -77,4 +80,20 @@ public class LabelServiceImpl implements LabelService {
|
||||
return labelMapper.selectList();
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取所有已开启的标签
|
||||
*
|
||||
* @return 标签列表
|
||||
*/
|
||||
@Override
|
||||
public List<LabelDO> getEnableLabelList () {
|
||||
List<LabelDO> labels = labelMapper.selectList();
|
||||
if (CollectionUtils.isEmpty(labels)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// status 0: 启用,1: 停用
|
||||
return labels.stream().filter(labelDO -> labelDO.getStatus() == 0).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,4 +54,11 @@ public interface LearningResourcesService {
|
||||
PageResult<LearningResourcesDO> getLearningResourcesPage(LearningResourcesPageReqVO pageReqVO);
|
||||
|
||||
String downLearningResources(Long id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 视频查看量更新
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void videoViewsUpdate (@Valid LearningResourcesSaveReqVO updateReqVO);
|
||||
}
|
||||
|
@ -1,30 +1,22 @@
|
||||
package cn.iocoder.yudao.module.llm.service.learningresources;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.dataset.DatasetDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.llm.controller.admin.learningresources.vo.*;
|
||||
import cn.iocoder.yudao.module.llm.dal.dataobject.learningresources.LearningResourcesDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.iocoder.yudao.module.llm.dal.mysql.learningresources.LearningResourcesMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.llm.enums.ErrorCodeConstants.*;
|
||||
import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
|
||||
|
||||
/**
|
||||
* 学习资源 Service 实现类
|
||||
@ -101,4 +93,28 @@ public class LearningResourcesServiceImpl implements LearningResourcesService {
|
||||
learningResourcesMapper.updateDownCount(learningResourcesDO);
|
||||
return learningResourcesDO.getFileUrl();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 视频查看量更新
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
@Override
|
||||
public void videoViewsUpdate(LearningResourcesSaveReqVO updateReqVO) {
|
||||
if (updateReqVO == null) {
|
||||
throw new IllegalArgumentException("传入的LearningResourcesSaveReqVO对象不能为空");
|
||||
}
|
||||
|
||||
Integer downCount = updateReqVO.getDownCount();
|
||||
|
||||
// 如果downCount为空或者小于等于0,则将downCount设置为0
|
||||
if (downCount == null|| downCount <= 0) {
|
||||
updateReqVO.setDownCount(0);
|
||||
}else {
|
||||
updateReqVO.setDownCount(downCount + 1);
|
||||
}
|
||||
|
||||
updateLearningResources(updateReqVO);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user