Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server

This commit is contained in:
wst 2024-11-03 21:45:59 +08:00
commit 5c4a130fbc
5 changed files with 14 additions and 29 deletions

View file

@ -5,8 +5,11 @@
package com.skyeye.key.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skyeye.common.enumeration.EnableEnum;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import com.skyeye.key.dao.AiApiKeyDao;
import com.skyeye.key.entity.AiApiKey;
import com.skyeye.key.service.AiApiKeyService;
@ -44,17 +47,17 @@ public class AiApiKeyServiceImpl extends SkyeyeBusinessServiceImpl<AiApiKeyDao,
public void validatorEntity(AiApiKey aiApiKey) {
super.validatorEntity(aiApiKey);
//判断RoleId是否存在
if (ObjectUtil.isNotNull(aiApiKey.getRoleId())) {
if (StrUtil.isNotEmpty(aiApiKey.getRoleId())) {
Role role = roleService.selectById(aiApiKey.getRoleId());
//判断RoleId是否为空如果为空则抛出异常
if (role.getId() == null) {
if (StrUtil.isNotEmpty(role.getId())) {
throw new CustomException("角色不存在: " + aiApiKey.getRoleId());
}
}
}
/**
* 获取全部API配置
* 获取已启用的API配置
*
* @param inputObject 入参以及用户信息等获取对象
* @return
@ -62,6 +65,7 @@ public class AiApiKeyServiceImpl extends SkyeyeBusinessServiceImpl<AiApiKeyDao,
@Override
public List<Map<String, Object>> queryDataList(InputObject inputObject) {
QueryWrapper<AiApiKey> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(AiApiKey::getEnabled), EnableEnum.ENABLE_USING.getKey());
List<AiApiKey> beans = list(queryWrapper);
return JSONUtil.toList(JSONUtil.toJsonStr(beans), null);
}

View file

@ -92,7 +92,7 @@ public class RoleController{
* @param inputObject 入参以及用户信息等获取对象
* @param outputObject 出参以及提示信息的返回值对象
*/
@ApiOperation(id = "queryRoleList", value = "获取广告位管理信息", method = "POST", allUse = "0")
@ApiOperation(id = "queryRoleList", value = "获取AI角色", method = "POST", allUse = "0")
@RequestMapping("/post/roleController/queryRoleList")
public void queryRoleList(InputObject inputObject, OutputObject outputObject) {
roleService.queryList(inputObject, outputObject);

View file

@ -18,5 +18,5 @@ import java.util.List;
* 注意本内容仅限购买后使用.禁止私自外泄以及用于其他的商业目的
*/
public interface RoleService extends SkyeyeBusinessService<Role> {
List<Role> queryRoleList(String id);
}

View file

@ -4,7 +4,6 @@
package com.skyeye.role.service.impl;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skyeye.role.dao.RoleDao;
@ -12,7 +11,6 @@ import com.skyeye.role.entity.Role;
import com.skyeye.role.service.RoleService;
import com.skyeye.annotation.service.SkyeyeService;
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
import com.skyeye.common.entity.search.CommonPageInfo;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import org.springframework.stereotype.Service;
@ -31,28 +29,14 @@ import java.util.Map;
@Service
@SkyeyeService(name = "AI角色", groupName = "AI角色")
public class RoleServiceImpl extends SkyeyeBusinessServiceImpl<RoleDao, Role> implements RoleService {
/**
* 分页查询AI角色信息
* @param commonPageInfo
* @return
*/
@Override
public QueryWrapper<Role> getQueryWrapper(CommonPageInfo commonPageInfo) {
QueryWrapper<Role> queryWrapper = super.getQueryWrapper(commonPageInfo);
String keyword = commonPageInfo.getKeyword();
if (StrUtil.isNotEmpty(keyword)) {
queryWrapper.like(MybatisPlusUtil.toColumns(Role::getName), keyword);
}
return queryWrapper;
}
/**
* 获取全部AI角色信息
*
* @param inputObject 入参以及用户信息等获取对象
* @return
*/
@Override
public List<Map<String, Object>> queryDataList(InputObject inputObject) {
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
@ -60,10 +44,4 @@ public class RoleServiceImpl extends SkyeyeBusinessServiceImpl<RoleDao, Role> im
return JSONUtil.toList(JSONUtil.toJsonStr(beans), null);
}
@Override
public List<Role> queryRoleList(String id){
QueryWrapper<Role> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(Role::getId), id);
return list(queryWrapper);
}
}

View file

@ -12,8 +12,10 @@ import com.skyeye.adsense.service.AdsenseService;
import com.skyeye.annotation.service.SkyeyeService;
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
import com.skyeye.common.constans.CommonCharConstants;
import com.skyeye.common.enumeration.EnableEnum;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@ -41,6 +43,7 @@ public class AdsenseServiceImpl extends SkyeyeBusinessServiceImpl<AdsenseDao, Ad
@Override
public List<Map<String, Object>> queryDataList(InputObject inputObject) {
QueryWrapper<Adsense> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(MybatisPlusUtil.toColumns(Adsense::getEnabled), EnableEnum.ENABLE_USING.getKey());
List<Adsense> beans = list(queryWrapper);
return JSONUtil.toList(JSONUtil.toJsonStr(beans), null);
}