Procházet zdrojové kódy

错误改到了全局的config变量

tsurumure před 3 měsíci
rodič
revize
9a3b8bb13d
48 změnil soubory, kde provedl 532 přidání a 1633 odebrání
  1. 0 27
      src/main/java/com/backendsys/config/HttpExchange/__HttpActuatorDTO.java
  2. 0 32
      src/main/java/com/backendsys/config/HttpExchange/__HttpActuatorService.java
  3. 0 60
      src/main/java/com/backendsys/config/Interceptor/TranslationInterceptor.java
  4. 1 1
      src/main/java/com/backendsys/config/Kaptcha/KaptchaConfig.java
  5. 0 22
      src/main/java/com/backendsys/config/Serializer/JsonConfig.java
  6. 0 42
      src/main/java/com/backendsys/config/Serializer/MyBeanSerializerModifier.java
  7. 4 4
      src/main/java/com/backendsys/exception/DuplicateKeyExceptionHandler.java
  8. 1 1
      src/main/java/com/backendsys/modules/TestController.java
  9. 1 1
      src/main/java/com/backendsys/modules/ai/media/entity/MediaTtv.java
  10. 2 2
      src/main/java/com/backendsys/modules/ai/media/service/impl/MediaTtvServiceImpl.java
  11. 39 0
      src/main/java/com/backendsys/modules/common/Filter/WebClientFilter.java
  12. 1 1
      src/main/java/com/backendsys/modules/common/config/redis/RedissonConfig.java
  13. 0 66
      src/main/java/com/backendsys/modules/common/config/security/CorsConfig.java
  14. 0 1
      src/main/java/com/backendsys/modules/common/config/security/SecurityConfig.java
  15. 1 1
      src/main/java/com/backendsys/modules/common/config/security/annotations/AnonymousProperties.java
  16. 0 33
      src/main/java/com/backendsys/modules/common/config/security/handler/__CustomLogoutHandler.java
  17. 0 40
      src/main/java/com/backendsys/modules/common/config/security/service/impl/CustomUserDetailsServiceImpl.java
  18. 0 122
      src/main/java/com/backendsys/modules/common/config/security/utils/PermissionUtil.java
  19. 0 224
      src/main/java/com/backendsys/modules/common/utils/WebClientUtil.java
  20. 3 3
      src/main/java/com/backendsys/modules/sdk/baidu/bce/service/impl/BaiduBceMediaServiceImpl.java
  21. 1 1
      src/main/java/com/backendsys/modules/sdk/deepseek/controller/DeepSeekController.java
  22. 55 4
      src/main/java/com/backendsys/modules/sdk/klingai/controller/KLingDemoController.java
  23. 19 1
      src/main/java/com/backendsys/modules/sdk/klingai/entity/KLGenerationImageParams.java
  24. 24 0
      src/main/java/com/backendsys/modules/sdk/klingai/entity/KLImage2VideoParams.java
  25. 20 0
      src/main/java/com/backendsys/modules/sdk/klingai/entity/KLText2VideoParams.java
  26. 23 0
      src/main/java/com/backendsys/modules/sdk/klingai/entity/KLVideoCameraControl.java
  27. 17 0
      src/main/java/com/backendsys/modules/sdk/klingai/entity/KLVideoCameraControlConfig.java
  28. 21 4
      src/main/java/com/backendsys/modules/sdk/klingai/service/KLingService.java
  29. 252 12
      src/main/java/com/backendsys/modules/sdk/klingai/service/impl/KLingServiceImpl.java
  30. 22 0
      src/main/java/com/backendsys/modules/sdk/klingai/utils/KLingUtil.java
  31. 1 0
      src/main/java/com/backendsys/modules/system/service/impl/SysAuthServiceImpl.java
  32. 0 19
      src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodService.java
  33. 0 175
      src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodServiceImpl.java
  34. 0 14
      src/main/java/com/backendsys/service/Ai/Aizn/AiznImageIncantationService.java
  35. 0 55
      src/main/java/com/backendsys/service/Ai/Aizn/AiznImageIncantationServiceImpl.java
  36. 0 17
      src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskService.java
  37. 0 193
      src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskServiceImpl.java
  38. 0 27
      src/main/java/com/backendsys/service/Ai/Aizn/AiznModelService.java
  39. 0 326
      src/main/java/com/backendsys/service/Ai/Aizn/AiznModelServiceImpl.java
  40. 0 11
      src/main/java/com/backendsys/service/Ai/Aizn/AiznService.java
  41. 0 67
      src/main/java/com/backendsys/service/Ai/Aizn/AiznServiceImpl.java
  42. 5 5
      src/main/java/com/backendsys/service/SDKService/SDKBaidu/SDKBaiduAiGenerateVideoServiceImpl.java
  43. 9 9
      src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentCOSServiceImpl.java
  44. 1 1
      src/main/java/com/backendsys/utils/CommonUtil.java
  45. 2 2
      src/main/resources/application-dev.yml
  46. 2 2
      src/main/resources/application-local.yml
  47. 2 2
      src/main/resources/application-prod.yml
  48. 3 3
      src/main/resources/application.yml

+ 0 - 27
src/main/java/com/backendsys/config/HttpExchange/__HttpActuatorDTO.java

@@ -1,27 +0,0 @@
-//package com.backendsys.KLingConfig.HttpExchange;
-//
-//import jakarta.validation.constraints.NotNull;
-//import lombok.Data;
-//import org.hibernate.validator.constraints.Range;
-//
-//@Data
-//public class __HttpActuatorDTO {
-//
-////    public static interface createGroup{}
-////    public static interface updateGroup{}
-//
-////    @NotNull(groups = {updateGroup.class, createGroup.class}, message = "用户id不能为空")
-//    @NotNull(message = "用户id不能为空")
-////    @Max(value = 99999999, message = "id长度不超过{value}")
-//    @Range(min = 0, max = 999, message = "id范围在{min}~{max}")
-//    private Long userId;
-//
-////    @NotNull(groups = {updateGroup.class}, message = "id不能为空")
-//    private Integer id;
-//
-////    @NotBlank(groups = {updateGroup.class, createGroup.class}, message = "标题不能为空")
-////    @NotBlank(message = "标题不能为空")
-//    private String title;
-//
-//    private Boolean completed;
-//}

+ 0 - 32
src/main/java/com/backendsys/config/HttpExchange/__HttpActuatorService.java

@@ -1,32 +0,0 @@
-//package com.backendsys.KLingConfig.HttpExchange;
-//
-//import org.springframework.http.MediaType;
-//import org.springframework.web.bind.aspect.PathVariable;
-//import org.springframework.web.bind.aspect.RequestBody;
-//import org.springframework.web.service.aspect.GetExchange;
-//import org.springframework.web.service.aspect.HttpExchange;
-//import org.springframework.web.service.aspect.PostExchange;
-//import org.springframework.web.service.aspect.PutExchange;
-//
-//import java.util.List;
-//
-//@HttpExchange(accept = "application/json;charset=UTF-8", contentType = "application/json;charset=UTF-8")
-//public interface HttpActuatorService {
-//
-//    @GetExchange("/todos")
-//    List<HttpActuatorDTO> getTodos();
-//
-//    @GetExchange("/todos/{id}")
-//    HttpActuatorDTO getTodoById(@PathVariable("id") Long id);
-//
-//    @PostExchange(value = "/todos/", accept = MediaType.APPLICATION_JSON_VALUE)
-//    HttpActuatorDTO createTodo(@RequestBody HttpActuatorDTO httpActuatorDTO);
-//
-//    @PutExchange("/todos/{id}")
-//    HttpActuatorDTO updateTodo(@PathVariable("id") Integer id, @RequestBody HttpActuatorDTO httpActuatorDTO);
-//
-//    /*
-//    @PostExchange ("/zlp-charity-ows/rest")
-//    String getRest(@RequestParam("method") String method, @RequestBody WordbookDTO wordbookDTO);
-//    */
-//}

+ 0 - 60
src/main/java/com/backendsys/config/Interceptor/TranslationInterceptor.java

@@ -1,60 +0,0 @@
-// package com.backendsys.KLingConfig.Interceptor;
-
-// import com.backendsys.modules.common.KLingConfig.Security.utils.TokenUtil;
-// import jakarta.servlet.http.Cookie;
-// import jakarta.servlet.http.HttpServletRequest;
-// import jakarta.servlet.http.HttpServletResponse;
-// import org.springframework.beans.factory.annotation.Autowired;
-// import org.springframework.beans.factory.annotation.Value;
-// import org.springframework.data.redis.core.StringRedisTemplate;
-// import org.springframework.stereotype.Component;
-// import org.springframework.web.servlet.HandlerInterceptor;
-
-// import java.util.concurrent.TimeUnit;
-
-// @Component
-// public class TranslationInterceptor implements HandlerInterceptor {
-
-//    @Autowired
-//    private TokenUtil tokenService;
-
-//    @Autowired
-//    private StringRedisTemplate stringRedisTemplate;
-
-//    @Value("${TOKEN_DURATION_MEMBER}")
-//    private Long TOKEN_DURATION_MEMBER;
-
-//    @Value("${DEFAULT_LANGUAGE}")
-//    private String DEFAULT_LANGUAGE;
-
-//    @Override
-//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
-//        // 获取 Cookie 中的 lang 值
-//        String lang = getLangFromCookie(request.getCookies());
-
-//        // 将 lang 存入线程本地变量,以便后续使用
-//        // LocaleContextHolder.setLocale(new Locale(lang));
-//        // request.setAttribute("lang", lang);
-
-//        // 将 lang 存入 Redis
-//        String langRedisKey = "lang:" + tokenService.getLoginUUID();
-
-//        System.out.println("langRedisKey = " + langRedisKey);
-
-//        stringRedisTemplate.opsForValue().set(langRedisKey, lang, TOKEN_DURATION_MEMBER, TimeUnit.MILLISECONDS);
-
-//        return true;
-//    }
-
-//    // 获取 Cookie 中的 lang 值
-//    private String getLangFromCookie(Cookie[] cookies) {
-//        if (cookies != null) {
-//            for (Cookie cookie : cookies) {
-//                if ("lang".equals(cookie.getName())) {
-//                    return cookie.getValue();
-//                }
-//            }
-//        }
-//        return DEFAULT_LANGUAGE; // 默认语言 (application.yml - DEFAULT_LANGUAGE)
-//    }
-// }

+ 1 - 1
src/main/java/com/backendsys/config/Kaptcha/KaptchaConfig.java

@@ -76,7 +76,7 @@ public class KaptchaConfig extends HttpServlet {
         // 文字距离
         // properties.setProperty("kaptcha.textproducer.char.space","16");
         // 自定义验证码背景
-        properties.setProperty("kaptcha.background.impl", "com.backendsys.KLingConfig.Kaptcha.KaptchaNoBackhround");
+        properties.setProperty("kaptcha.background.impl", "com.backendsys.config.Kaptcha.KaptchaNoBackhround");
 
         Config config = new Config(properties);
         // 使用默认的图形验证码实现,当然也可以自定义实现

+ 0 - 22
src/main/java/com/backendsys/config/Serializer/JsonConfig.java

@@ -1,22 +0,0 @@
-//package com.backendsys.KLingConfig.Serializer;
-//
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import org.springframework.context.aspect.Bean;
-//import org.springframework.context.aspect.Configuration;
-//import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-//
-///**
-// * 处理返回值中的null值
-// */
-//@Configuration
-//public class JsonConfig {
-//    @Bean
-//    public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
-//        final MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
-//        System.out.println(converter);
-//        ObjectMapper mapper = converter.getObjectMapper();
-//        // 为mapper注册一个带有SerializerModifier的Factory,此modifier主要做的事情为:当序列化类型为array,list、set时,当值为空时,序列化成[]
-//        mapper.setSerializerFactory(mapper.getSerializerFactory().withSerializerModifier(new MyBeanSerializerModifier()));
-//        return converter;
-//    }
-//}

+ 0 - 42
src/main/java/com/backendsys/config/Serializer/MyBeanSerializerModifier.java

@@ -1,42 +0,0 @@
-//package com.backendsys.KLingConfig.Serializer;
-//
-//import com.fasterxml.jackson.databind.BeanDescription;
-//import com.fasterxml.jackson.databind.JsonSerializer;
-//import com.fasterxml.jackson.databind.SerializationConfig;
-//import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
-//import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
-//
-//import java.util.List;
-//import java.util.Set;
-//
-//public class MyBeanSerializerModifier extends BeanSerializerModifier {
-//
-//    //  数组类型
-//    private JsonSerializer _nullArrayJsonSerializer = new MyNullArrayJsonSerializer();
-//    // 字符串等类型
-//    private JsonSerializer _nullJsonSerializer = new MyNullJsonSerializer();
-//
-//    @Override
-//    public List<BeanPropertyWriter> changeProperties(SerializationConfig KLingConfig, BeanDescription beanDesc,
-//                                                     List beanProperties) {
-//        //循环所有的beanPropertyWriter
-//        for (int i = 0; i < beanProperties.size(); i++) {
-//            BeanPropertyWriter writer = (BeanPropertyWriter) beanProperties.get(i);
-//            //判断字段的类型,如果是array,list,set则注册nullSerializer
-//            if (isArrayType(writer)) {
-//                //给writer注册一个自己的nullSerializer
-//                writer.assignNullSerializer(this._nullArrayJsonSerializer);
-//            } else {
-//                writer.assignNullSerializer(this._nullJsonSerializer);
-//            }
-//        }
-//        return beanProperties;
-//    }
-//
-//    //判断是什么类型
-//    protected boolean isArrayType(BeanPropertyWriter writer) {
-//        Class clazz = writer.getPropertyType();
-//        return clazz.isArray() || clazz.equals(List.class) || clazz.equals(Set.class);
-//    }
-//
-//}

+ 4 - 4
src/main/java/com/backendsys/exception/DuplicateKeyExceptionHandler.java

@@ -27,9 +27,9 @@ public class DuplicateKeyExceptionHandler {
 
         //// [yml] 读取配置文件中的字段名和友好提示的对应关系
         //Yaml yaml = new Yaml();
-        //Map<String, Object> KLingConfig = null;
+        //Map<String, Object> config = null;
         //try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream("application.yml")) {
-        //    KLingConfig = yaml.load(inputStream);
+        //    config = yaml.load(inputStream);
         //} catch (IOException ex) {
         //    // 处理配置文件读取错误
         //    ex.printStackTrace();
@@ -37,8 +37,8 @@ public class DuplicateKeyExceptionHandler {
 
         //// [friendlyMessage] 获得自定义友好提示 (application.yml -> fieldMappings)
         //String friendlyMessage = null;
-        //if (KLingConfig != null && KLingConfig.containsKey("fieldMappings")) {
-        //    Map<String, Object> fieldMappings = (Map<String, Object>) KLingConfig.get("fieldMappings");
+        //if (config != null && config.containsKey("fieldMappings")) {
+        //    Map<String, Object> fieldMappings = (Map<String, Object>) config.get("fieldMappings");
         //    for (Map.Entry<String, Object> entry : fieldMappings.entrySet()) {
         //        String fieldKey = entry.getKey();
         //        if (errorMessage.contains(fieldKey)) {

+ 1 - 1
src/main/java/com/backendsys/modules/TestController.java

@@ -642,7 +642,7 @@ public class TestController {
 //        String sk = "WlRZMk5qRTJOR1ZrTURnMk5EVmhZVGc1TmpVeE4yUTJNelkzWXpVeU1XVQ==";
 //
 //        BusinessSecurityService businessSecurityService = BusinessSecurityServiceImpl.getInstance();
-//        // call below method if you dont set ak and sk in ~/.volc/KLingConfig
+//        // call below method if you dont set ak and sk in ~/.volc/config
 //
 //        businessSecurityService.setAccessKey(ak);
 //        businessSecurityService.setSecretKey(sk);

+ 1 - 1
src/main/java/com/backendsys/modules/ai/media/entity/MediaTtv.java

@@ -41,7 +41,7 @@ public class MediaTtv {
     @NotEmpty(message = "source 不能为空", groups = { Generate.class })
     private List<MediaTtvSource> source;
     @TableField(exist = false)
-    @NotNull(message = "KLingConfig 不能为空", groups = { Generate.class })
+    @NotNull(message = "config 不能为空", groups = { Generate.class })
     private MediaTtvConfig config;
 
     private String request_params;

+ 2 - 2
src/main/java/com/backendsys/modules/ai/media/service/impl/MediaTtvServiceImpl.java

@@ -104,9 +104,9 @@ public class MediaTtvServiceImpl implements MediaTtvService {
         }
         detail.setSource(source);
 
-        // KLingConfig
+        // config
         MediaTtvConfig config = new MediaTtvConfig();
-        JSONObject request_params_config = JSONUtil.parseObj(request_params_json.get("KLingConfig"));
+        JSONObject request_params_config = JSONUtil.parseObj(request_params_json.get("config"));
         config.setTts_voice_type(Convert.toInt(request_params_config.get("ttsPer")));
         config.setResolution(Convert.toIntArray(request_params_config.get("resolution")));
         detail.setConfig(config);

+ 39 - 0
src/main/java/com/backendsys/modules/common/Filter/WebClientFilter.java

@@ -0,0 +1,39 @@
+package com.backendsys.modules.common.Filter;
+
+import org.springframework.core.io.buffer.DataBuffer;
+import org.springframework.core.io.buffer.DataBufferUtils;
+import org.springframework.core.io.buffer.DefaultDataBufferFactory;
+import org.springframework.web.reactive.function.client.*;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+import java.nio.charset.StandardCharsets;
+
+public class WebClientFilter {
+
+    // 请求/响应拦截器
+    public static ExchangeFilterFunction logFilter = (request, next) -> {
+        System.out.println("[logRequestFilter] Request: " + request.method() + " " + request.url());
+        return next.exchange(request).flatMap(response -> {
+
+            // 读取并缓存整个响应体
+            return DataBufferUtils.join(response.bodyToFlux(DataBuffer.class))
+                .flatMap(dataBuffer -> {
+                    // 提取字节数组并释放缓冲区
+                    byte[] bodyBytes = new byte[dataBuffer.readableByteCount()];
+                    dataBuffer.read(bodyBytes);
+                    DataBufferUtils.release(dataBuffer);
+
+                    // 记录响应体
+                    String bodyStr = new String(bodyBytes, StandardCharsets.UTF_8);
+                    System.out.println("[logRequestFilter] Response Body: " + bodyStr);
+
+                    // 重新构建完整的响应
+                    return Mono.just(ClientResponse.create(response.statusCode())
+                        .headers(headers -> headers.addAll(response.headers().asHttpHeaders()))
+                        .body(Flux.just(DefaultDataBufferFactory.sharedInstance.wrap(bodyBytes)))
+                        .build());
+                });
+        });
+    };
+}

+ 1 - 1
src/main/java/com/backendsys/modules/common/config/redis/RedissonConfig.java

@@ -28,7 +28,7 @@ public class RedissonConfig {
         try {
             // 创建配置 指定redis地址及节点信息
             Config config = new Config();
-            //KLingConfig.useSingleServer().setAddress("XXX.XX.XX.X(redis地址):端口").setPassword("xxxxxxxxx");
+            // config.useSingleServer().setAddress("XXX.XX.XX.X(redis地址):端口").setPassword("xxxxxxxxx");
             config.useSingleServer().setAddress("redis://" + redisHost + ":" + redisPort).setPassword(redisPassword);
             // 根据config创建出RedissonClient实例
             RedissonClient redissonClient = Redisson.create(config);

+ 0 - 66
src/main/java/com/backendsys/modules/common/config/security/CorsConfig.java

@@ -1,66 +0,0 @@
-//package com.backendsys.modules.common.KLingConfig.security;
-//
-//import com.backendsys.KLingConfig.Interceptor.PreAuthorizeInterceptor;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.boot.web.servlet.FilterRegistrationBean;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.core.Ordered;
-//import org.springframework.web.cors.CorsConfiguration;
-//import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-//import org.springframework.web.filter.CorsFilter;
-//import org.springframework.web.servlet.KLingConfig.annotation.CorsRegistry;
-//import org.springframework.web.servlet.KLingConfig.annotation.InterceptorRegistry;
-//import org.springframework.web.servlet.KLingConfig.annotation.WebMvcConfigurer;
-//
-//@Configuration
-//public class CorsConfig implements WebMvcConfigurer {
-//
-////    @Autowired
-////    private TranslationInterceptor translationInterceptor;
-////
-////    @Override
-////    public void addInterceptors(InterceptorRegistry registry) {
-////        registry.addInterceptor(translationInterceptor).addPathPatterns("/**");
-////    }
-//
-////    @Autowired
-////    private PreAuthorizeInterceptor preAuthorizeInterceptor;
-//
-////    @Override
-////    public void addInterceptors(InterceptorRegistry registry) {
-////        registry.addInterceptor(preAuthorizeInterceptor)
-////            .addPathPatterns("/**")
-////            .excludePathPatterns("/swagger-ui/**")
-////            .excludePathPatterns("/images/**")
-////            .excludePathPatterns("/favicon.ico")
-////        ;
-////    }
-//
-//    @Override
-//    public void addCorsMappings(CorsRegistry registry) {
-//        registry.addMapping("/**")
-//            .allowedOriginPatterns("*")
-//            .allowedMethods("GET", "POST", "PUT", "DELETE")
-//            .allowedHeaders("*")
-//            .allowCredentials(true)
-//            .maxAge(3600)
-//            .exposedHeaders("Authorization");
-//    }
-//
-//    @Bean
-//    public FilterRegistrationBean<CorsFilter> corsFilter() {
-//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
-//        CorsConfiguration KLingConfig = new CorsConfiguration();
-//        KLingConfig.addAllowedOriginPattern("*");
-//        KLingConfig.addAllowedHeader("*");
-//        KLingConfig.addAllowedMethod("*");
-//        KLingConfig.setAllowCredentials(true);
-//        KLingConfig.setMaxAge(3600L);
-//        source.registerCorsConfiguration("/**", KLingConfig);
-//        FilterRegistrationBean<CorsFilter> bean = new FilterRegistrationBean<>(new CorsFilter(source));
-//        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
-//        return bean;
-//    }
-//}

+ 0 - 1
src/main/java/com/backendsys/modules/common/config/security/SecurityConfig.java

@@ -1,7 +1,6 @@
 package com.backendsys.modules.common.config.security;
 
 import cn.hutool.core.util.ArrayUtil;
-//import com.backendsys.modules.common.KLingConfig.security.filter.AnonymousFilter;
 import com.backendsys.modules.common.config.security.annotations.AnonymousProperties;
 import com.backendsys.modules.common.config.security.filter.CaptchaVerficationFilter;
 import com.backendsys.modules.common.config.security.filter.JwtAuthenticationFilter;

+ 1 - 1
src/main/java/com/backendsys/modules/common/config/security/annotations/AnonymousProperties.java

@@ -23,7 +23,7 @@ import java.util.regex.Pattern;
 import cn.hutool.core.util.ReUtil;
 
 // 编辑注释权限
-// src/main/java/com/backendsys/modules/common/KLingConfig/security/filter/JwtAuthenticationFilter.java
+// src/main/java/com/backendsys/modules/common/config/security/filter/JwtAuthenticationFilter.java
 @Configuration
 public class AnonymousProperties implements InitializingBean, ApplicationContextAware {
 

+ 0 - 33
src/main/java/com/backendsys/modules/common/config/security/handler/__CustomLogoutHandler.java

@@ -1,33 +0,0 @@
-//package com.backendsys.modules.common.KLingConfig.Security.handler;
-//
-//import jakarta.servlet.http.HttpServletRequest;
-//import jakarta.servlet.http.HttpServletResponse;
-//import org.springframework.security.core.Authentication;
-//import org.springframework.security.web.authentication.logout.LogoutHandler;
-//import org.springframework.stereotype.Component;
-//
-//@Component
-//public class __CustomLogoutHandler implements LogoutHandler {
-//    @Override
-//    public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
-//
-//        // 访问 http://localhost:48080/api/auth/logout 时
-//        System.out.println("进入 CustomLogoutHandler");
-//        System.out.println(authentication);
-//        return ;
-//
-////        if(authentication != null)
-////        {
-////            username = SecurityUtils.getUsername(authentication);
-////            System.out.println("获得当前登录用户名:"+username);
-////            //...操作数据库的代码省略
-////        }
-////        else
-////        {
-////            System.out.println("authentication is null");
-////            return;
-////        }
-//
-//
-//    }
-//}

+ 0 - 40
src/main/java/com/backendsys/modules/common/config/security/service/impl/CustomUserDetailsServiceImpl.java

@@ -1,40 +0,0 @@
-//package com.backendsys.modules.common.KLingConfig.Security;
-//
-//import org.springframework.beans.factory.aspect.Autowired;
-//import org.springframework.security.core.authority.AuthorityUtils;
-//import org.springframework.security.core.userdetails.User;
-//import org.springframework.security.core.userdetails.UserDetails;
-//import org.springframework.security.core.userdetails.UserDetailsService;
-//import org.springframework.security.core.userdetails.UsernameNotFoundException;
-//import org.springframework.security.crypto.password.PasswordEncoder;
-//import org.springframework.stereotype.Service;
-//
-///**
-// * 登录鉴权的实现类
-// */
-//@Service
-//public class CustomUserDetailsServiceImpl implements UserDetailsService {
-//
-//    @Autowired
-//    private PasswordEncoder passwordEncoder;
-//
-//    @Override
-//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
-//
-//        System.out.println("CustomUserDetailsServiceImpl!");
-//
-//        // 1.查询数据库,判断用户名是否存在,如果不存在就抛出 UsernameNotFoundException 异常
-//        if (!"admin".equals(username)) {
-//            throw new UsernameNotFoundException("用户名不存在");
-//        }
-//        // 2.把查询出来的密码 (注册时加密过) 进行解析,或者把密码放入构造方法
-//        String password = passwordEncoder.encode("123456");
-//
-//        User u = new User(username, password,
-//                AuthorityUtils.commaSeparatedStringToAuthorityList("admin, normal"));
-//
-//        // System.out.println("isCredentialsNonExpired: " + u.isCredentialsNonExpired());
-//
-//        return u;
-//    }
-//}

+ 0 - 122
src/main/java/com/backendsys/modules/common/config/security/utils/PermissionUtil.java

@@ -1,122 +0,0 @@
-//package com.backendsys.modules.common.KLingConfig.security.utils;
-//
-//import com.backendsys.exception.CustException;
-//import com.backendsys.modules.common.KLingConfig.redis.utils.RedisUtil;
-//import com.backendsys.modules.common.KLingConfig.security.entity.SecurityUserInfo;
-//import com.backendsys.utils.response.ResultEnum;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.stereotype.Service;
-//import org.springframework.util.CollectionUtils;
-//import org.springframework.util.StringUtils;
-//
-//import java.util.*;
-//
-///**
-// * 即将弃用
-// * 自定义权限 @PreAuthorize("@sr.hasPermission('3.2.3') && @ss.isSuper()")
-// */
-//@Service("ss")
-//public class PermissionUtil {
-//    //private static final String ALL_PERMISSION = "*:*:*";
-//
-//    @Value("${REDIS_LOGIN_TOKEN_PREFIX}")
-//    private String REDIS_LOGIN_TOKEN_PREFIX;
-//    @Value("${REDIS_LOGIN_PERMISSION_PREFIX}")
-//    private String REDIS_LOGIN_PERMISSION_PREFIX;
-//
-//    @Autowired
-//    private RedisUtil redisUtil;
-//
-//    /**
-//     * 验证用户是否具备权限
-//     * @param permi 权限字符串
-//     * @return boolean
-//     */
-////    public boolean hasPermi(String permi) {
-//    public boolean hasPermi(Collection<String> permi) {
-//
-//        if (CollectionUtils.isEmpty(permi)) return false;
-//
-//        SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//        // 如果是超级管理员,则直接通过
-//        if (securityUserInfo.getIs_super() == 1) return true;
-//
-//        // 没有 permission_ids 即不是系统用户,即没有访问后台的权限
-//        if (securityUserInfo != null) {
-//
-////            String uuid = securityUserInfo.getLast_login_uuid();
-////            String redis_key = REDIS_LOGIN_PERMISSION_PREFIX + uuid;
-////            String permission_ids_str = redisUtil.getCacheObject(redis_key);
-////            List<String> permission_ids = Arrays.asList(permission_ids_str.split(","));
-//
-//            List<String> permission_ids = securityUserInfo.getPermission_ids();
-//
-//            if (permission_ids != null && !permission_ids.isEmpty()) {
-//                Set<String> dataSet = new HashSet<>();
-//                for (String permission_id : permission_ids) {
-//                    dataSet.add(permission_id);
-//                }
-//                for (String permission : permi) {
-//                    if (hasPermissions(dataSet, permission)) {
-//                        return true;
-//                    }
-//                }
-//                // return hasPermissions(modulesSet, permission);
-//            }
-//        }
-//        return false;
-//    }
-//    public boolean hasPermissions(Set<String> permi, String permission) {
-//        return permi.contains(StringUtils.trimAllWhitespace(permission));
-//    }
-//
-//    // 是否超级管理员
-//    public boolean isSuper() {
-//        SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//        return securityUserInfo.getIs_super() == 1;
-//    }
-//
-//    // 是否超级管理员 (首位)
-//    public boolean isFirstSuper() {
-//        SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//        return securityUserInfo.getUser_id() == 1;
-//    }
-//
-//    // 是否会员
-//    public boolean isMember() {
-//        SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//        return "Member".equals(securityUserInfo.getTarget());
-//    }
-//
-//
-//    /**
-//     * 判断是否匹配当前 {用户ID} 与 {用户权限},不是则抛出错误
-//     * - 匹配,通过
-//     * - 不匹配,再次检查权限
-//     *    - 匹配,通过
-//     *    - 不匹配,抛出错误
-//     * permissionService.checkUserIdAndPermission(sysUserDTO.getUser_id(), "3.2.1");
-//     */
-//    public void checkUserIdAndPermission(long user_id, Collection<String> permis) {
-//        SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//        if (securityUserInfo.getUser_id() != user_id) {
-//            if (!hasPermi(permis)) {
-//                throw new CustException(ResultEnum.AUTH_ROLE_ERROR.getMessage(), ResultEnum.AUTH_ROLE_ERROR.getCode());
-//            }
-//        }
-//    }
-//
-//    /**
-//     * 判断是否 首位超级管理员 (id:1),不是则抛出错误
-//     */
-//    public void checkSuperAdminOfFirst(long user_id) {
-//        if (user_id == 1) {
-//            SecurityUserInfo securityUserInfo = SecurityUtil.getUserInfo();
-//            if (securityUserInfo.getUser_id() != 1) {
-//                throw new CustException(ResultEnum.AUTH_USER_ERROR.getMessage(), ResultEnum.AUTH_USER_ERROR.getCode());
-//            }
-//        }
-//    }
-//
-//}

+ 0 - 224
src/main/java/com/backendsys/modules/common/utils/WebClientUtil.java

@@ -1,224 +0,0 @@
-package com.backendsys.modules.common.utils;
-
-import org.reactivestreams.Publisher;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.buffer.DataBuffer;
-import org.springframework.core.io.buffer.DataBufferUtils;
-import org.springframework.core.io.buffer.DefaultDataBufferFactory;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.reactive.function.BodyInserters;
-import org.springframework.web.reactive.function.client.*;
-import org.springframework.web.util.UriComponentsBuilder;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-
-public class WebClientUtil {
-
-    // 请求/响应拦截器
-    static ExchangeFilterFunction logFilter = (request, next) -> {
-        System.out.println("[logRequestFilter] Request: " + request.method() + " " + request.url());
-
-        // 为什么不能更简单?根本原因是响应式流的 单次消费原则
-        // 在响应式编程中处理请求体内容相对复杂,因为请求体是一个只能被消费一次的流
-        // 所以,这里不做参数拦截
-
-
-//        // 获取请求方法
-//        HttpMethod method = request.method();
-
-//        // 对于 GET 请求,记录 URL 参数
-//        if (method.equals(HttpMethod.GET)) {
-//            String query = request.url().getQuery();
-//            if (query != null) {
-//                Map<String, List<String>> queryParams = new LinkedHashMap<>();
-//                for (String param : query.split("&")) {
-//                    String[] pair = param.split("=");
-//                    String key = URLDecoder.decode(pair[0], StandardCharsets.UTF_8);
-//                    String value = pair.length > 1 ? URLDecoder.decode(pair[1], StandardCharsets.UTF_8) : "";
-//                    queryParams.computeIfAbsent(key, k -> new ArrayList<>()).add(value);
-//                }
-//                System.out.println("[logRequestFilter] Request Url Params: " + queryParams);
-//            }
-//        }
-
-//        // 对于 POST、PUT、DELETE 请求,记录 JSON 正文
-//        if (method.equals(HttpMethod.POST) || method.equals(HttpMethod.PUT) || method.equals(HttpMethod.DELETE)) {
-//            request.bodyToMono(String.class)
-//                .doOnNext(body -> System.out.println("[Request Body] " + body))
-//                .subscribe(); // 重要:单独订阅
-//        }
-
-        return next.exchange(request).flatMap(response -> {
-
-            // 读取并缓存整个响应体
-            return DataBufferUtils.join(response.bodyToFlux(DataBuffer.class))
-                .flatMap(dataBuffer -> {
-                    // 提取字节数组并释放缓冲区
-                    byte[] bodyBytes = new byte[dataBuffer.readableByteCount()];
-                    dataBuffer.read(bodyBytes);
-                    DataBufferUtils.release(dataBuffer);
-
-                    // 记录响应体
-                    String bodyStr = new String(bodyBytes, StandardCharsets.UTF_8);
-                    System.out.println("[logRequestFilter] Response Body: " + bodyStr);
-
-                    // 重新构建完整的响应
-                    return Mono.just(ClientResponse.create(response.statusCode())
-                        .headers(headers -> headers.addAll(response.headers().asHttpHeaders()))
-                        .body(Flux.just(DefaultDataBufferFactory.sharedInstance.wrap(bodyBytes)))
-                        .build());
-                });
-
-        });
-
-    };
-
-    // 实例化 WebClient
-    private static final WebClient webClient = WebClient.builder()
-            .filter(logFilter)  // 确保 logFilter 在缓冲后使用
-            .build();
-
-    // 默认的响应类型
-    private static final Class<Object> DEFAULT_RESPONSE_TYPE = Object.class;
-
-    // [Get] 公共逻辑 (参数示例)
-    // - 自定义头部: Consumer<HttpHeaders> httpHeaders = (headers) -> { headers.add("Authorization", "Bearer " + getToken()); };
-    // - 自定义返回类型: Class<T> responseType = JSONObject.class;
-    private static <T> Mono<T> doGetInternal(String url, MultiValueMap<String, String> params, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        String uri = UriComponentsBuilder.fromUriString(url).queryParams(params).toUriString();
-        return webClient.get().uri(uri).headers(httpHeaders).accept(MediaType.APPLICATION_JSON).retrieve().bodyToMono(responseType);
-    }
-    private static <T> Mono<T> doPostInternal(String url, MultiValueMap<String, String> requestBody, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        return webClient.post().uri(url).headers(httpHeaders).accept(MediaType.APPLICATION_JSON).bodyValue(requestBody).retrieve().bodyToMono(responseType);
-    }
-
-    /**
-     * Mono<JSONObject> responseMono = WebClientUtil.doGet(url);
-     * Mono<JSONObject> responseMono = WebClientUtil.doGet(url, JSONObject.class);
-     * Mono<JSONObject> responseMono = WebClientUtil.doGet(url, params, JSONObject.class);
-     * Mono<JSONObject> responseMono = WebClientUtil.doGet(config.URL + "/v1/images/generations", params, kLingUtil.getHttpHeaders(), JSONObject.class);
-     * 同步调用示例:
-     * return JSONUtil.parseObj(responseMono.block());
-     * 异步调用示例:
-     * responseMono.subscribe(response -> System.out.println("Response: " + response));
-     */
-
-    // 无参数、无自定义头、无响应类型
-    public static Mono<Object> doGet(String url) {
-        return doGetInternal(url, null, null, DEFAULT_RESPONSE_TYPE);
-    }
-    // 无参数、无自定义头
-    public static <T> Mono<T> doGet(String url, Class<T> responseType) {
-        return doGetInternal(url, null, null, responseType);
-    }
-    // 无参数、有自定义头、无响应类型
-    public static Mono<Object> doGet(String url, Consumer<HttpHeaders> httpHeaders) {
-        return doGetInternal(url, null, httpHeaders, DEFAULT_RESPONSE_TYPE);
-    }
-    // 无参数、有自定义头、有响应类型
-    public static <T> Mono<T> doGet(String url, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        return doGetInternal(url, null, httpHeaders, responseType);
-    }
-    // 有参数、无自定义头、无响应类型
-    public static Mono<Object> doGet(String url, MultiValueMap<String, String> params) {
-        return doGetInternal(url, params, null, DEFAULT_RESPONSE_TYPE);
-    }
-    // 有参数、无自定义头、有响应类型
-    public static <T> Mono<T> doGet(String url, MultiValueMap<String, String> params, Class<T> responseType) {
-        return doGetInternal(url, params, null, responseType);
-    }
-    // 有参数、有自定义头、无响应类型
-    public static Mono<Object> doGet(String url, MultiValueMap<String, String> params, Consumer<HttpHeaders> httpHeaders) {
-        return doGetInternal(url, params, httpHeaders, DEFAULT_RESPONSE_TYPE);
-    }
-    // 有参数、有自定义头、有响应类型
-    public static <T> Mono<T> doGet(String url, MultiValueMap<String, String> params, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        return doGetInternal(url, params, httpHeaders, responseType);
-    }
-
-
-
-    // 无参数、无自定义头、无响应类型
-    public static Mono<Object> doPost(String url) {
-        return doPostInternal(url, null, null, Object.class);
-    }
-
-    // 无参数、无自定义头、有响应类型
-    public static <T> Mono<T> doPost(String url, Class<T> responseType) {
-        return doPostInternal(url, null, null, responseType);
-    }
-
-    // 无参数、有自定义头、无响应类型
-    public static Mono<Object> doPost(String url, Consumer<HttpHeaders> httpHeaders) {
-        return doPostInternal(url, null, httpHeaders, Object.class);
-    }
-
-    // 无参数、有自定义头、有响应类型
-    public static <T> Mono<T> doPost(String url, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        return doPostInternal(url, null, httpHeaders, responseType);
-    }
-
-    // 有参数、无自定义头、无响应类型
-    public static Mono<Object> doPost(String url, MultiValueMap<String, String> params) {
-        return doPostInternal(url, params, null, Object.class);
-    }
-
-    // 有参数、无自定义头、有响应类型
-    public static <T> Mono<T> doPost(String url, MultiValueMap<String, String> params, Class<T> responseType) {
-        return doPostInternal(url, params, null, responseType);
-    }
-
-    // 有参数、有自定义头、无响应类型
-    public static Mono<Object> doPost(String url, MultiValueMap<String, String> params, Consumer<HttpHeaders> httpHeaders) {
-        return doPostInternal(url, params, httpHeaders, Object.class);
-    }
-
-    // 有参数、有自定义头、有响应类型
-    public static <T> Mono<T> doPost(String url, MultiValueMap<String, String> params, Consumer<HttpHeaders> httpHeaders, Class<T> responseType) {
-        return doPostInternal(url, params, httpHeaders, responseType);
-    }
-
-
-
-
-
-
-
-
-    public static <T> Mono<T> doPut(String url, Object request, Class<T> responseType) {
-        return webClient.put()
-            .uri(url)
-            .contentType(MediaType.APPLICATION_JSON)
-            .accept(MediaType.APPLICATION_JSON)
-            .bodyValue(request)
-            .retrieve()
-            .bodyToMono(responseType);
-    }
-
-    public static Mono<Void> doDelete(String url) {
-        return webClient.delete()
-            .uri(url)
-            .retrieve()
-            .bodyToMono(Void.class);
-    }
-
-}

+ 3 - 3
src/main/java/com/backendsys/modules/sdk/baidu/bce/service/impl/BaiduBceMediaServiceImpl.java

@@ -66,7 +66,7 @@ public class BaiduBceMediaServiceImpl implements BaiduBceMediaService {
                     { "type": "text", "content": "云渺修仙历经千年,实力超凡,却因身世之谜未解,毅然成为摆渡人。" },
                     { "type": "image", "content": "http://43.138.151.228:3001/2cut_compress.png" }
                 ],
-                "KLingConfig": {
+                "config": {
                     "tts_voice_type": 4144,
                     "resolution": [1024, 576]
                 }
@@ -83,7 +83,7 @@ public class BaiduBceMediaServiceImpl implements BaiduBceMediaService {
 
 //        String source = mediaTtv.getSource();
 
-//        // KLingConfig: 视频生产配置
+//        // config: 视频生产配置
 //        Integer ttsPer = 4144;                // 支持基础音库、甄选音库,默认4144:度姗姗-女;【基础音库】0:度小美-女、1:度小宇-男、3:度小云-男、4:度小丫-女童、5:度小娇-女、103:度小朵-女童、106:度小博-男、110:度小童-男童、111:度小萌-女、5003:度小遥-男、5118:度小婷-女、4003:度小耀-男、4100:度小雯-女、4103:度小米-男童、4105:度小灵-女、4106:度小文-男、4115:度小贤-男、4117:度小乔-女、4119:度小鹿-女;【甄选音库】4144:度姗姗-女、4140:度小新-女、4143:度清风-男、4129:度小彦-男、4278:度小贝-女、4254:度小清-女、4149:度星河-男
 //        String resolution = "[1024,576]";     // 分辨率,横屏支持[1920,1080]、[1280,720]、[1024,576]、竖屏支持[1080,1920]、[720,1280]、[576,1024]
 
@@ -136,7 +136,7 @@ public class BaiduBceMediaServiceImpl implements BaiduBceMediaService {
 
         String params = "{" +
             "\"source\":{\"structs\":" + structs + "}," +
-            "\"KLingConfig\":{" +
+            "\"config\":{" +
                 "\"productType\":\"video\"," +
                 "\"ttsPer\":" + ttsPer + "," +
                 "\"resolution\":[" + resolution[0] + "," + resolution[1] + "]" +

+ 1 - 1
src/main/java/com/backendsys/modules/sdk/deepseek/controller/DeepSeekController.java

@@ -4,7 +4,7 @@
 //import com.backendsys.modules.sdk.deepseek.service.DeepSeekClient;
 //import com.backendsys.modules.sdk.deepseek.service.impl.DeepSeekClientImpl;
 //import com.backendsys.modules.sdk.deepseek.utils.OllamaUtil;
-//import com.backendsys.modules.common.KLingConfig.security.utils.SecurityUtil;
+//import com.backendsys.modules.common.config.security.utils.SecurityUtil;
 //import com.backendsys.modules.common.utils.Result;
 //import io.swagger.v3.oas.annotations.Operation;
 //import io.swagger.v3.oas.annotations.tags.Tag;

+ 55 - 4
src/main/java/com/backendsys/modules/sdk/klingai/controller/KLingDemoController.java

@@ -4,7 +4,9 @@ import cn.hutool.json.JSONUtil;
 import com.backendsys.modules.common.config.security.annotations.Anonymous;
 import com.backendsys.modules.common.utils.Result;
 import com.backendsys.modules.sdk.klingai.entity.KLGenerationImageParams;
+import com.backendsys.modules.sdk.klingai.entity.KLImage2VideoParams;
 import com.backendsys.modules.sdk.klingai.entity.KLResponse;
+import com.backendsys.modules.sdk.klingai.entity.KLText2VideoParams;
 import com.backendsys.modules.sdk.klingai.service.KLingService;
 import com.backendsys.modules.sdk.klingai.utils.KLingUtil;
 import io.swagger.v3.oas.annotations.Operation;
@@ -29,7 +31,17 @@ public class KLingDemoController {
         return kLingUtil.getToken();
     }
 
-    @Operation(summary = "[图像生成] 创建任务 (同步)")
+    @Operation(summary = "6-1 查询账号下资源包列表及余量")
+    @GetMapping("/api/klingai/queryAccountCosts")
+    public Result queryAccountCosts() {
+        Mono<KLResponse> responseMono = klingService.queryAccountCosts();
+        KLResponse response = responseMono.block();
+        System.out.println("同步结果: " + response);
+        System.out.println("同步结果 (data): " + response.getData());
+        return Result.success().put("data", response);
+    }
+
+    @Operation(summary = "2-1【图像生成】创建任务 (同步)")
     @PostMapping("/api/klingai/generationImage")
     public Result generationImage(@RequestBody KLGenerationImageParams params) {
         Mono<KLResponse> responseMono = klingService.generationImage(params);
@@ -39,7 +51,7 @@ public class KLingDemoController {
         return Result.success().put("data", response);
     }
 
-    @Operation(summary = "[图像生成] 查询任务(单个)(同步)")
+    @Operation(summary = "2-2【图像生成】查询任务(单个)(同步)")
     @GetMapping("/api/klingai/queryImageTask")
     public Result queryImageTask(String task_id) {
         Mono<KLResponse> responseMono = klingService.queryImageTask(task_id);
@@ -48,8 +60,7 @@ public class KLingDemoController {
         System.out.println("同步结果 (data): " + response.getData());
         return Result.success().put("data", response);
     }
-
-    @Operation(summary = "[图像生成] 查询任务(单个)(异步)")
+    @Operation(summary = "2-2【图像生成】查询任务(单个)(异步)")
     @GetMapping("/api/klingai/queryImageTaskAsync")
     public Result queryImageTaskAsync(String task_id) {
         Mono<KLResponse> responseMono = klingService.queryImageTask(task_id);
@@ -60,4 +71,44 @@ public class KLingDemoController {
         return Result.success();
     }
 
+
+    @Operation(summary = "3-1【文生视频】创建任务 (同步)")
+    @PostMapping("/api/klingai/text2Video")
+    public Result text2Video(@RequestBody KLText2VideoParams params) {
+        Mono<KLResponse> responseMono = klingService.text2Video(params);
+        KLResponse response = responseMono.block();
+        System.out.println("同步结果: " + response);
+        System.out.println("同步结果 (data): " + response.getData());
+        return Result.success().put("data", response);
+    }
+    @Operation(summary = "3-2【文生视频】查询任务(单个)")
+    @GetMapping("/api/klingai/queryText2VideoTask")
+    public Result queryText2VideoTask(String task_id) {
+        Mono<KLResponse> responseMono = klingService.queryText2VideoTask(task_id);
+        KLResponse response = responseMono.block();
+        System.out.println("同步结果: " + response);
+        System.out.println("同步结果 (data): " + response.getData());
+        return Result.success().put("data", response);
+    }
+
+
+    @Operation(summary = "3-4【图生视频】创建任务")
+    @PostMapping("/api/klingai/image2Video")
+    public Result image2Video(@RequestBody KLImage2VideoParams params) {
+        Mono<KLResponse> responseMono = klingService.image2Video(params);
+        KLResponse response = responseMono.block();
+        System.out.println("同步结果: " + response);
+        System.out.println("同步结果 (data): " + response.getData());
+        return Result.success().put("data", response);
+    }
+    @Operation(summary = "3-5【图生视频】查询任务(单个)")
+    @GetMapping("/api/klingai/queryImage2VideoTask")
+    public Result queryImage2VideoTask(String task_id) {
+        Mono<KLResponse> responseMono = klingService.queryImage2VideoTask(task_id);
+        KLResponse response = responseMono.block();
+        System.out.println("同步结果: " + response);
+        System.out.println("同步结果 (data): " + response.getData());
+        return Result.success().put("data", response);
+    }
+
 }

+ 19 - 1
src/main/java/com/backendsys/modules/sdk/klingai/entity/KLGenerationImageParams.java

@@ -8,5 +8,23 @@ import lombok.Data;
  */
 @Data
 public class KLGenerationImageParams {
-    private String prompt;  // 正向文本提示词 (不能超过2500个字符)
+    private String model_name;              // 模型名称 (默认值:kling-v1) (kling-v1, kling-v1-5, kling-v2)
+    private String prompt;                  // (必填) 正向文本提示词 (不能超过2500个字符)
+    private String negative_prompt;         // 负向文本提示词 (不能超过2500个字符) (图生图(即image字段不为空时)场景下,不支持负向提示词)
+    private String image;                   // 参考图片 (支持传入图片Base64编码或图片URL(确保可访问))
+
+    /*
+        图片参考类型:
+        - 枚举值:subject(角色特征参考), face(人物长相参考)
+        - 使用face(人物长相参考)时,上传图片需仅含1张人脸。
+        - 使用kling-v1-5且image参数不为空时,当前参数必填
+     */
+    private String image_reference;
+
+    private Float image_fidelity;           // 生成过程中对用户上传图片的参考强度 (取值范围:[0,1],数值越大参考强度越大) (仅 kling-v1, kling-v1-5 支持当前参数)
+    private Float human_fidelity;           // 面部参考强度,即参考图中人物五官相似度 (取值范围:[0,1],数值越大参考强度越大) (仅 image_reference 参数为subject时生效)
+    private String resolution;              // 生成图片的清晰度 (枚举值:1k, 2k)
+    private Integer n;                      // 生成图片数量,取值范围:[1,9]
+    private String aspect_ratio;            // 生成图片的画面纵横比 (宽:高) (枚举值:16:9, 9:16, 1:1, 4:3, 3:4, 3:2, 2:3, 21:9)
+    private String callback_url;            // 本次任务结果回调通知地址,如果配置,服务端会在任务状态发生变更时主动通知 (具体通知的消息 schema 见 “Callback协议”)
 }

+ 24 - 0
src/main/java/com/backendsys/modules/sdk/klingai/entity/KLImage2VideoParams.java

@@ -0,0 +1,24 @@
+package com.backendsys.modules.sdk.klingai.entity;
+
+import lombok.Data;
+
+/**
+ * 3-4【图生视频】创建任务
+ * https://docs.qingque.cn/d/home/eZQAyImcbaS0fz-8ANjXvU5ed?identityId=1oEG9JKKMFv#section=h.vu7fo8cz94fv
+ */
+@Data
+public class KLImage2VideoParams {
+    private String model_name;                      // 模型名称 (默认值:kling-v1) (kling-v1, kling-v1-6, kling-v2-master)
+    private String image;                           // 参考图像:支持传入图片Base64编码或图片URL
+    private String image_tail;                      // 参考图像-尾帧控制:支持传入图片Base64编码或图片URL
+
+    private String prompt;                          // (可选) 正向文本提示词 (不能超过2500个字符)
+    private String negative_prompt;                 // 正向文本提示词 (不能超过2500个字符)
+
+    private Float cfg_scale;                        // 生成视频的自由度;值越大,模型自由度越小,与用户输入的提示词相关性越强 (取值范围:[0, 1]) (默认值 0.5)
+    private String mode;                            // 生成视频的模式 (枚举值:std,pro)(默认值:std)
+    private KLVideoCameraControl camera_control;
+    private String aspect_ratio;                    // 生成视频的画面纵横比(宽:高)(枚举值:16:9, 9:16, 1:1)(默认值:16:9)
+    private String duration;                        // 生成视频时长,单位s (枚举值:5,10) (默认值:5)
+    private String callback_url;                    // 本次任务结果回调通知地址,如果配置,服务端会在任务状态发生变更时主动通知
+}

+ 20 - 0
src/main/java/com/backendsys/modules/sdk/klingai/entity/KLText2VideoParams.java

@@ -0,0 +1,20 @@
+package com.backendsys.modules.sdk.klingai.entity;
+
+import lombok.Data;
+
+/**
+ * 3-1【文生视频】创建任务
+ * https://docs.qingque.cn/d/home/eZQAyImcbaS0fz-8ANjXvU5ed?identityId=1oEG9JKKMFv#section=h.81c0oj4l9efl
+ */
+@Data
+public class KLText2VideoParams {
+    private String model_name;                      // 模型名称 (默认值:kling-v1) (kling-v1, kling-v1-6, kling-v2-master)
+    private String prompt;                          // (必填) 正向文本提示词 (不能超过2500个字符)
+    private String negative_prompt;                 // 负向文本提示词 (不能超过2500个字符) (图生图(即image字段不为空时)场景下,不支持负向提示词)
+    private Float cfg_scale;                        // 生成视频的自由度;值越大,模型自由度越小,与用户输入的提示词相关性越强 (取值范围:[0, 1]) (默认值 0.5)
+    private String mode;                            // 生成视频的模式 (枚举值:std,pro)(默认值:std)
+    private KLVideoCameraControl camera_control;
+    private String aspect_ratio;                    // 生成视频的画面纵横比(宽:高)(枚举值:16:9, 9:16, 1:1)(默认值:16:9)
+    private String duration;                        // 生成视频时长,单位s (枚举值:5,10) (默认值:5)
+    private String callback_url;                    // 本次任务结果回调通知地址,如果配置,服务端会在任务状态发生变更时主动通知
+}

+ 23 - 0
src/main/java/com/backendsys/modules/sdk/klingai/entity/KLVideoCameraControl.java

@@ -0,0 +1,23 @@
+package com.backendsys.modules.sdk.klingai.entity;
+
+import lombok.Data;
+
+/**
+ * 3-1【文生视频】创建任务
+ * https://docs.qingque.cn/d/home/eZQAyImcbaS0fz-8ANjXvU5ed?identityId=1oEG9JKKMFv#section=h.81c0oj4l9efl
+ */
+@Data
+public class KLVideoCameraControl {
+
+    /*
+        预定义的运镜类型:
+            枚举值:"simple", "down_back", "forward_up", "right_turn_forward", "left_turn_forward"
+            simple:简单运镜,此类型下可在"config"中六选一进行运镜
+            down_back:镜头下压并后退 ➡️ 下移拉远,此类型下config参数无需填写
+            forward_up:镜头前进并上仰 ➡️ 推进上移,此类型下config参数无需填写
+            right_turn_forward:先右旋转后前进 ➡️ 右旋推进,此类型下config参数无需填写
+            left_turn_forward:先左旋并前进 ➡️ 左旋推进,此类型下config参数无需填写
+     */
+    private String type;
+    private KLVideoCameraControlConfig config;
+}

+ 17 - 0
src/main/java/com/backendsys/modules/sdk/klingai/entity/KLVideoCameraControlConfig.java

@@ -0,0 +1,17 @@
+package com.backendsys.modules.sdk.klingai.entity;
+
+import lombok.Data;
+
+/**
+ * 3-1【文生视频】创建任务
+ * https://docs.qingque.cn/d/home/eZQAyImcbaS0fz-8ANjXvU5ed?identityId=1oEG9JKKMFv#section=h.81c0oj4l9efl
+ */
+@Data
+public class KLVideoCameraControlConfig {
+    private Float horizontal;
+    private Float vertical;
+    private Float pan;
+    private Float tilt;
+    private Float roll;
+    private Float zoom;
+}

+ 21 - 4
src/main/java/com/backendsys/modules/sdk/klingai/service/KLingService.java

@@ -2,14 +2,31 @@ package com.backendsys.modules.sdk.klingai.service;
 
 import cn.hutool.json.JSONObject;
 import com.backendsys.modules.sdk.klingai.entity.KLGenerationImageParams;
+import com.backendsys.modules.sdk.klingai.entity.KLImage2VideoParams;
 import com.backendsys.modules.sdk.klingai.entity.KLResponse;
+import com.backendsys.modules.sdk.klingai.entity.KLText2VideoParams;
 import reactor.core.publisher.Mono;
 
 public interface KLingService {
 
-    // 【图像生成】创建任务
-    Mono<KLResponse> generationImage(KLGenerationImageParams requestBody);
+    // 6-1 查询账号下资源包列表及余量
+    Mono<KLResponse> queryAccountCosts();
 
-    // 【图像生成】查询任务(单个)
-    Mono<KLResponse> queryImageTask(String taskId);
+
+    // 2-1【图像生成】创建任务
+    Mono<KLResponse> generationImage(KLGenerationImageParams params);
+    // 2-2【图像生成】查询任务(单个)
+    Mono<KLResponse> queryImageTask(String task_id);
+
+
+    // 3-1【文生视频】创建任务
+    Mono<KLResponse> text2Video(KLText2VideoParams params);
+    // 3-2【文生视频】查询任务(单个)
+    Mono<KLResponse> queryText2VideoTask(String task_id);
+
+
+    // 3-4【图生视频】创建任务
+    Mono<KLResponse> image2Video(KLImage2VideoParams params);
+    // 3-5【图生视频】查询任务(单个)
+    Mono<KLResponse> queryImage2VideoTask(String task_id);
 }

+ 252 - 12
src/main/java/com/backendsys/modules/sdk/klingai/service/impl/KLingServiceImpl.java

@@ -1,20 +1,31 @@
 package com.backendsys.modules.sdk.klingai.service.impl;
 
-import cn.hutool.json.JSONObject;
-import com.backendsys.modules.common.utils.WebClientUtil;
+import cn.hutool.core.convert.Convert;
+import com.backendsys.modules.common.Filter.WebClientFilter;
 import com.backendsys.modules.sdk.klingai.config.KLingConfig;
 import com.backendsys.modules.sdk.klingai.entity.KLGenerationImageParams;
+import com.backendsys.modules.sdk.klingai.entity.KLImage2VideoParams;
 import com.backendsys.modules.sdk.klingai.entity.KLResponse;
+import com.backendsys.modules.sdk.klingai.entity.KLText2VideoParams;
 import com.backendsys.modules.sdk.klingai.service.KLingService;
 
 import com.backendsys.modules.sdk.klingai.utils.KLingUtil;
-import com.backendsys.utils.ConvertToUtil;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
+import org.springframework.web.reactive.function.client.WebClient;
+import org.springframework.web.util.UriComponentsBuilder;
 import reactor.core.publisher.Mono;
 
+/**
+ * 可灵 - 接口费用
+ * https://app.klingai.com/cn/dev/document-api/productBilling/prePaidResourcePackage
+ * 可灵 - 购买链接
+ * - 图片:https://klingai.com/cn/dev/model/image
+ * - 视频:https://klingai.com/cn/dev/model/video
+ */
 @Service
 public class KLingServiceImpl implements KLingService {
 
@@ -24,32 +35,261 @@ public class KLingServiceImpl implements KLingService {
     @Autowired
     private KLingUtil kLingUtil;
 
+    private WebClient webClient;
+    public WebClient getWebClient() {
+        if (webClient == null) {
+            webClient = WebClient.builder().baseUrl(config.URL).filter(WebClientFilter.logFilter).build();
+        }
+        return webClient;
+    }
+
+
     /**
-     * 【图像生成】创建任务
+     * 6-1 查询账号下资源包列表及余量
      */
     @Override
-    public Mono<KLResponse> generationImage(KLGenerationImageParams params) {
+    public Mono<KLResponse> queryAccountCosts() {
 
-        MultiValueMap<String, String> multiValueParams = new LinkedMultiValueMap<>();
-        ConvertToUtil.convertToMultiValueMap(params, multiValueParams);
-        System.out.println("multiValueParams = " + multiValueParams);
+        // 获取当前时间的 Unix 时间戳(单位:毫秒)
+//        long endTime = System.currentTimeMillis();
+        long endTime = 1749198917406L;
+        // 计算一小时前的时间戳(单位:毫秒)(1 小时 = 3600000 毫秒)
+//        long startTime = endTime - 3600000;
+        long startTime = 1749195317406L;
 
-        return WebClientUtil.doPost(config.URL + "/v1/images/generations", multiValueParams, kLingUtil.getHttpHeaders(), KLResponse.class);
+        MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
+        params.add("start_time", Convert.toStr(startTime));          // Unix时间戳、单位ms
+        params.add("end_time", Convert.toStr(endTime));
+
+        System.out.println("params = " + params);
+        // params = {start_time=[1749195317406], end_time=[1749198917406]}
+
+        String url = "/account/costs";
+        String uri = UriComponentsBuilder.fromUriString(url).queryParams(params).toUriString();
+        WebClient webClient = getWebClient();
+        return webClient.get()
+                .uri(uri)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+//                .retrieve()
+//                .bodyToMono(KLResponse.class);
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+
+        /*
+            返回值:{
+                "code": 0,
+                "msg": "success",
+                "resource_pack_subscribe_infos": [
+                    {
+                        "resource_pack_name": "试用-视频生成-100-3并发-1个月",
+                        "resource_pack_id": "754492101828186181",
+                        "resource_pack_type": "decreasing_total",
+                        "total_quantity": 100.0,
+                        "remaining_quantity": 100.0,
+                        "purchase_time": 1749197892513,
+                        "effective_time": 1749197892509,
+                        "invalid_time": 1751789892509,
+                        "status": "online"
+                    }
+                ]
+            }
+         */
     }
 
     /**
-     * 【图像生成】查询任务(单个)
+     * 2-1【图像生成】创建任务
+     */
+    @Override
+    public Mono<KLResponse> generationImage(KLGenerationImageParams params) {
+        String url = "/v1/images/generations";
+        WebClient webClient = getWebClient();
+        return webClient.post()
+                .uri(url)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .bodyValue(params)
+//                .retrieve()
+//                .bodyToMono(KLResponse.class);
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+    }
+
+    /**
+     * 2-2【图像生成】查询任务(单个)
      * Mono<Object> responseMono = klingService.queryImageTask(task_id);
      * responseMono.block();                                                // 同步发起订阅
      * responseMono.subscribe(response -> System.out.println(response));    // 异步发起订阅
-     * responseMono.subscribe().dispose();                                  // 中断/取消订阅
+     * responseMono.subscribe().dispose();                                  // 异步中断/取消订阅
      */
     public Mono<KLResponse> queryImageTask(String task_id) {
+        //
         MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
         params.add("task_id", task_id);
-        return WebClientUtil.doGet(config.URL + "/v1/images/generations", params, kLingUtil.getHttpHeaders(), KLResponse.class);
+        //
+        String url = "/v1/images/generations";
+        String uri = UriComponentsBuilder.fromUriString(url).queryParams(params).toUriString();
+        WebClient webClient = getWebClient();
+        return webClient.get()
+                .uri(uri)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+    }
+
+
+    /**
+     * 3-1【文生视频】创建任务
+     */
+    @Override
+    public Mono<KLResponse> text2Video(KLText2VideoParams params) {
+        String url = "/v1/videos/text2video";
+        WebClient webClient = getWebClient();
+        return webClient.post()
+                .uri(url)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .bodyValue(params)
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+        /*
+            {
+                "code": 0,
+                "message": "SUCCEED",
+                "request_id": "43baa609-8082-495a-b3a3-e5b45b03302b",
+                "data": {
+                    "task_id": "760138163112644666",
+                    "task_status": "submitted",
+                    "task_info": {},
+                    "created_at": 1749259579553,
+                    "updated_at": 1749259579553
+                }
+            }
+         */
     }
 
+    /**
+     * 3-2【文生视频】查询任务(单个)
+     */
+    @Override
+    public Mono<KLResponse> queryText2VideoTask(String task_id) {
+        String url = "/v1/videos/text2video/" + task_id;
+        String uri = UriComponentsBuilder.fromUriString(url).toUriString();
+        WebClient webClient = getWebClient();
+        return webClient.get()
+                .uri(uri)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+        /*
+            生成中:{
+                "code": 0,
+                "message": "SUCCEED",
+                "request_id": "bfe78281-13cb-41f9-9a90-dda55dbeaeb6",
+                "data": {
+                    "task_id": "760138163112644666",
+                    "task_status": "processing",
+                    "task_info": {},
+                    "task_result": {},
+                    "task_status_msg": "",
+                    "created_at": 1749259579553,
+                    "updated_at": 1749259580965
+                }
+            }
+            生成成功:
+            {
+                "code": 0,
+                "message": "SUCCEED",
+                "request_id": "b48d2799-63ac-435d-a546-01bf7c8f315d",
+                "data": {
+                    "task_id": "760138163112644666",
+                    "task_status": "succeed",
+                    "task_info": {},
+                    "task_result": {
+                        "videos": [
+                            {
+                                "id": "760138163221712948",
+                                "url": "https://v2-kling.kechuangai.com/bs2/upload-ylab-stunt/special-effect/output/KLingMuse_77918a74-5665-4e50-9cbc-fd9f02f33d31/6566829430832074447/output.mp4?x-kcdn-pid=112452",
+                                "duration": "5.1"
+                            }
+                        ]
+                    },
+                    "task_status_msg": "",
+                    "created_at": 1749259579553,
+                    "updated_at": 1749259891298
+                }
+            }
+         */
+    }
 
 
+    /**
+     * 3-4【图生视频】创建任务
+     */
+    @Override
+    public Mono<KLResponse> image2Video(KLImage2VideoParams params) {
+        String url = "/v1/videos/image2video";
+        WebClient webClient = getWebClient();
+        return webClient.post()
+                .uri(url)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .bodyValue(params)
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+    }
+
+    /**
+     * 3-5【图生视频】查询任务(单个)
+     */
+    @Override
+    public Mono<KLResponse> queryImage2VideoTask(String task_id) {
+        String url = "/v1/videos/image2video/" + task_id;
+        String uri = UriComponentsBuilder.fromUriString(url).toUriString();
+        WebClient webClient = getWebClient();
+        return webClient.get()
+                .uri(uri)
+                .headers(kLingUtil.getHttpHeaders())
+                .accept(MediaType.APPLICATION_JSON)
+                .exchangeToMono(response -> {
+                    if (response.statusCode().is2xxSuccessful()) {
+                        return response.bodyToMono(KLResponse.class); // 成功响应
+                    } else {
+                        return response.bodyToMono(KLResponse.class).map(e -> KLingUtil.mapErrorResponse(e));
+                    }
+                });
+    }
+
 }

+ 22 - 0
src/main/java/com/backendsys/modules/sdk/klingai/utils/KLingUtil.java

@@ -5,9 +5,12 @@ import com.auth0.jwt.JWT;
 import com.auth0.jwt.algorithms.Algorithm;
 import com.backendsys.modules.common.config.redis.utils.RedisUtil;
 import com.backendsys.modules.sdk.klingai.config.KLingConfig;
+import com.backendsys.modules.sdk.klingai.entity.KLResponse;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpHeaders;
 import org.springframework.stereotype.Component;
+import org.springframework.web.reactive.function.client.ClientResponse;
+import reactor.core.publisher.Mono;
 
 import java.util.Date;
 import java.util.HashMap;
@@ -28,6 +31,9 @@ public class KLingUtil {
      */
     public String sign() {
         try {
+
+            System.out.println("[sign] accessKey: " + config.ACCESS_KEY + ", secretKey: " + config.SECRET_KEY);
+
             Date expiredAt = new Date(System.currentTimeMillis() + 1800*1000); // 有效时间,此处示例代表当前时间+1800s(30min)
             Date notBefore = new Date(System.currentTimeMillis() - 5*1000); //开始生效的时间,此处示例代表当前时间-5秒
             Algorithm algo = Algorithm.HMAC256(config.SECRET_KEY);
@@ -73,4 +79,20 @@ public class KLingUtil {
         };
         return httpHeaders;
     }
+
+    /**
+     * 封装错误响应的映射逻辑
+     * @param originalResponse 原始的 KLResponse 对象
+     * @return 新的 KLResponse 对象,包含统一的错误信息
+     */
+    public static KLResponse mapErrorResponse(KLResponse originalResponse) {
+        // 构建统一错误响应
+        KLResponse errorResponse = new KLResponse();
+        errorResponse.setCode(originalResponse.getCode());
+        errorResponse.setMessage(originalResponse.getMessage());
+        errorResponse.setRequest_id(originalResponse.getRequest_id());
+        errorResponse.setData(originalResponse.getData());
+        return errorResponse;
+    }
+
 }

+ 1 - 0
src/main/java/com/backendsys/modules/system/service/impl/SysAuthServiceImpl.java

@@ -97,6 +97,7 @@ public class SysAuthServiceImpl implements SysAuthService {
         response.setHeader("Pragma", "no-cache");
         response.setDateHeader("Expires", 0);
         response.setContentType("image/jpeg");
+
         ServletOutputStream responseOutputStream = response.getOutputStream();
         responseOutputStream.write(captchaChallengeAsJpeg);
         responseOutputStream.flush();

+ 0 - 19
src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodService.java

@@ -1,19 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodCompoundTask.AiznGoodCompoundTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodReplaceTask.AiznGoodReplaceTaskDTO;
-//
-//import java.util.Map;
-//
-///**
-// * AI商品合成 / 商品替换
-// */
-//public interface AiznGoodService {
-//
-//    // [紫鸟] 商品合成 (发起任务)
-//    Map<String, Object> makeGoodCompoundTask(AiznGoodCompoundTaskDTO aiznGoodCompoundTaskDTO);
-//
-//    // [紫鸟] 商品替换 (发起任务)
-//    Map<String, Object> makeGoodReplaceTask(AiznGoodReplaceTaskDTO aiznGoodReplaceTaskDTO);
-//
-//}

+ 0 - 175
src/main/java/com/backendsys/service/Ai/Aizn/AiznGoodServiceImpl.java

@@ -1,175 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.core.convert.Convert;
-//import cn.hutool.json.JSONObject;
-//import cn.hutool.json.JSONUtil;
-//import com.backendsys.aspect.HttpRequestAspect;
-//import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodCompoundTask.AiznGoodCompoundTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznGood.AiznGoodReplaceTask.AiznGoodReplaceTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
-//import com.backendsys.exception.CustException;
-//import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
-//import com.backendsys.service.System.SysResourceService;
-//import com.backendsys.utils.MapUtil;
-//import com.fzzixun.openapi.sdk.client.OpenClient;
-//import com.fzzixun.openapi.sdk.common.RequestMethod;
-//import com.fzzixun.openapi.sdk.request.CommonRequest;
-//import com.fzzixun.openapi.sdk.response.CommonResponse;
-//import org.redisson.api.RLock;
-//import org.redisson.api.RedissonClient;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.LinkedHashMap;
-//import java.util.Map;
-//import java.util.concurrent.TimeUnit;
-//
-//@Service
-//public class AiznGoodServiceImpl implements AiznGoodService {
-//
-//    @Lazy
-//    @Autowired
-//    RedissonClient redissonClient;
-//
-//    @Autowired
-//    private HttpRequestAspect httpRequestAspect;
-//
-//    @Autowired
-//    private AiznService aiznService;
-//
-//    @Autowired
-//    private AiznImageTaskMapper aiznImageTaskMapper;
-//
-//    @Autowired
-//    private SysResourceService sysResourceService;
-//
-//    /**
-//     * [紫鸟] 商品合成 (发起任务)
-//     */
-//    @Override
-//    public Map<String, Object> makeGoodCompoundTask(AiznGoodCompoundTaskDTO aiznGoodCompoundTaskDTO) {
-//        RLock lock = redissonClient.getLock("makeGoodCompoundTask");
-//        try { lock.tryLock(3, TimeUnit.SECONDS);
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("imageUrl", aiznGoodCompoundTaskDTO.getImage_url());
-////            object.set("style", aiznGoodCompoundTaskDTO.getStyle());
-////            object.set("subType", aiznGoodCompoundTaskDTO.getSub_type());
-//            object.set("ratio", aiznGoodCompoundTaskDTO.getRatio());
-//            object.set("outputNum", aiznGoodCompoundTaskDTO.getOutput_num());
-//
-//            Map<String, Object> extendFields = new LinkedHashMap<>();
-//            extendFields.put("imageSegUrl", aiznGoodCompoundTaskDTO.getExtend_fields().getImage_seg_url());
-//            extendFields.put("keepSegStruct", aiznGoodCompoundTaskDTO.getExtend_fields().getKeep_seg_struct());
-//            extendFields.put("segChangeWeight", aiznGoodCompoundTaskDTO.getExtend_fields().getSeg_change_weight());
-//            extendFields.put("originalImages", aiznGoodCompoundTaskDTO.getExtend_fields().getOriginal_images());
-//
-//            object.set("extendFields", extendFields);
-//
-//            System.out.println("Params:");
-//            System.out.println(object.toString());
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/create/11", RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-////                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                Map<String, Object> respData = Convert.toMap(String.class, Object.class, resp.get("data"));
-//                System.out.println(respData);
-//
-//                // -- 将制作结果插入到数据表 -----------------------------------------------------
-//                AiznImageTaskVO vo = new AiznImageTaskVO();
-//                vo.setTask_id((String) respData.get("id"));
-//                vo.setUser_id(httpRequestAspect.getUserId());
-//                vo.setTask_type("GOOD_COMPOUND");
-//                vo.setImage_url((String) respData.get("imageUrl"));
-//                vo.setTask_submit_json(JSONUtil.toJsonStr(respData));
-//                aiznImageTaskMapper.insertAiznImageTask(vo);
-//                // --------------------------------------------------------------------------
-//
-//                // -- 扣除对应的本地积分 (ZnGood, GoodCompound, 商品合成) ------------------------
-//                sysResourceService.consumptionPoint("ZnGood", "GoodCompound", null);
-//
-//                return MapUtil.convertToUnderscoreCase(respData);
-//
-//            } else {
-//                System.out.println(resp);
-//                throw new CustException((String) resp.get("msg"));
-//            }
-//
-//        } catch (InterruptedException e) { throw new RuntimeException(e);
-//        } finally { lock.unlock(); }
-//    }
-//
-//    /**
-//     * [紫鸟] 商品替换 (发起任务)
-//     */
-//    @Override
-//    public Map<String, Object> makeGoodReplaceTask(AiznGoodReplaceTaskDTO aiznGoodReplaceTaskDTO) {
-//        RLock lock = redissonClient.getLock("makeGoodCompoundTask");
-//        try { lock.tryLock(3, TimeUnit.SECONDS);
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("imageUrl", aiznGoodReplaceTaskDTO.getImage_url());
-//            object.set("outputNum", aiznGoodReplaceTaskDTO.getOutput_num());
-//
-//            Map<String, Object> extendFields = new LinkedHashMap<>();
-//            extendFields.put("denoiseStrength", aiznGoodReplaceTaskDTO.getExtend_fields().getDenoise_strength());
-//            extendFields.put("sourceImageUrl", aiznGoodReplaceTaskDTO.getExtend_fields().getSource_image_url());
-//            extendFields.put("targetImageUrl", aiznGoodReplaceTaskDTO.getExtend_fields().getTarget_image_url());
-//
-//            object.set("extendFields", extendFields);
-//
-//            System.out.println("Params:");
-//            System.out.println(object.toString());
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/create/12", RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-////                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                Map<String, Object> respData = Convert.toMap(String.class, Object.class, resp.get("data"));
-//                System.out.println(respData);
-//
-//                // -- 将制作结果插入到数据表 -----------------------------------------------------
-//                AiznImageTaskVO vo = new AiznImageTaskVO();
-//                vo.setTask_id((String) respData.get("id"));
-//                vo.setUser_id(httpRequestAspect.getUserId());
-//                vo.setTask_type("GOOD_REPLACE");
-//                vo.setImage_url((String) respData.get("imageUrl"));
-//                vo.setTask_submit_json(JSONUtil.toJsonStr(respData));
-//                aiznImageTaskMapper.insertAiznImageTask(vo);
-//                // --------------------------------------------------------------------------
-//
-//                // -- 扣除对应的本地积分 (ZnGood, GoodCompound, 商品合成) ------------------------
-//                sysResourceService.consumptionPoint("ZnGood", "GoodReplace", null);
-//
-//                return MapUtil.convertToUnderscoreCase(respData);
-//
-//            } else {
-//                System.out.println(resp);
-//                throw new CustException((String) resp.get("msg"));
-//            }
-//
-//        } catch (InterruptedException e) { throw new RuntimeException(e);
-//        } finally { lock.unlock(); }
-//    }
-//
-//}

+ 0 - 14
src/main/java/com/backendsys/service/Ai/Aizn/AiznImageIncantationService.java

@@ -1,14 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import com.backendsys.entity.Ai.Aizn.AiznImageIncantationDTO;
-//
-//import java.util.List;
-//import java.util.Map;
-//
-//public interface AiznImageIncantationService {
-//
-//    List<Map<String, Object>> getImageIncantationList(AiznImageIncantationDTO aiznImageIncantationDTO);
-//
-//    List<Map<String, Object>> getImageIncantationDescriptionList();
-//
-//}

+ 0 - 55
src/main/java/com/backendsys/service/Ai/Aizn/AiznImageIncantationServiceImpl.java

@@ -1,55 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.core.convert.Convert;
-//import com.backendsys.entity.Ai.Aizn.AiznImageIncantationDTO;
-//import com.backendsys.mapper.Ai.Aizn.AiznImageIncantationMapper;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.*;
-//
-//@Service
-//public class AiznImageIncantationServiceImpl implements AiznImageIncantationService {
-//
-//    @Autowired
-//    private AiznImageIncantationMapper aiznImageIncantationMapper;
-//
-//    @Override
-//    public List<Map<String, Object>> getImageIncantationList(AiznImageIncantationDTO aiznImageIncantationDTO) {
-//
-//        List<Map<String, Object>> resp = aiznImageIncantationMapper.queryAiznImageIncantation(aiznImageIncantationDTO);
-//
-//        Map<Integer, Map<String, Object>> groupedData = new LinkedHashMap<>();
-//
-//        for (Map<String, Object> item : resp) {
-//            int categoryId = Convert.toInt(item.get("category_id"));
-//            String categoryName = Convert.toStr(item.get("category_name"));
-//            String name = Convert.toStr(item.get("name"));
-//
-//            if (!groupedData.containsKey(categoryId)) {
-//                Map<String, Object> categoryData = new LinkedHashMap<>();
-//                categoryData.put("category_id", categoryId);
-//                categoryData.put("category_name", categoryName);
-//                categoryData.put("list", new ArrayList<>());
-//                groupedData.put(categoryId, categoryData);
-//            }
-//
-//            List<Map<String, Object>> list = (List<Map<String, Object>>) groupedData.get(categoryId).get("list");
-//            Map<String, Object> data = new LinkedHashMap<>();
-//            data.put("name", name);
-//            list.add(data);
-//        }
-//
-//        // 打印转换后的数据
-//        List<Map<String, Object>> result = new ArrayList<>(groupedData.values());
-//
-//        return result;
-//    }
-//
-//
-//    @Override
-//    public List<Map<String, Object>> getImageIncantationDescriptionList() {
-//        return aiznImageIncantationMapper.queryAiznImageIncantationDescription();
-//    }
-//
-//}

+ 0 - 17
src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskService.java

@@ -1,17 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
-//
-//import java.io.IOException;
-//import java.util.List;
-//import java.util.Map;
-//
-//public interface AiznImageTaskService {
-//    // [紫鸟] 查询任务进度 (通用) (progress_type: 3-智能抠图, 9-AI换模特, 11-商品合成, 12-商品合成 )
-//    Map<String, Object> getProgressOfTask(String id, Integer progress_type) throws IOException;
-//    List<Map<String, Object>> getProgressOfTaskArray(String ids, Integer progress_type) throws IOException;
-//    // 获得任务列表
-//    Map<String, Object> getImageTaskList(Integer pageNum, Integer pageSize, AiznImageTaskVO aiznImageTaskVO);
-//    // 获得任务详情
-//    Map<String, Object> getImageTaskDetail(AiznImageTaskVO aiznImageTaskVO);
-//}

+ 0 - 193
src/main/java/com/backendsys/service/Ai/Aizn/AiznImageTaskServiceImpl.java

@@ -1,193 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.core.convert.Convert;
-//import cn.hutool.core.util.StrUtil;
-//import cn.hutool.json.JSONObject;
-//import cn.hutool.json.JSONUtil;
-//import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
-//import com.backendsys.entity.Tencent.TencentCos.UploadOriginDTO;
-//import com.backendsys.entity.Tencent.TencentCos.UploadOriginResp;
-//import com.backendsys.exception.CustException;
-//import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
-//import com.backendsys.service.SDKService.SDKTencent.SDKTencentCOSService;
-//import com.backendsys.utils.MapUtil;
-//import com.backendsys.utils.response.PageInfoResult;
-//import com.fzzixun.openapi.sdk.client.OpenClient;
-//import com.fzzixun.openapi.sdk.common.RequestMethod;
-//import com.fzzixun.openapi.sdk.request.CommonRequest;
-//import com.fzzixun.openapi.sdk.response.CommonResponse;
-//import com.github.pagehelper.PageHelper;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.stereotype.Service;
-//
-//import java.io.IOException;
-//import java.util.*;
-//
-//@Service
-//public class AiznImageTaskServiceImpl implements AiznImageTaskService {
-//
-//    @Autowired
-//    private AiznService aiznService;
-//
-//    @Autowired
-//    private SDKTencentCOSService sdkTencentCOSService;
-//
-//    @Autowired
-//    private AiznImageTaskMapper aiznImageTaskMapper;
-//
-//
-//    /**
-//     * [紫鸟] 查询进度 (查询任务 -> 储存桶)
-//     * - 判断任务是否存在
-//     *   - 是:
-//     *     - 如果 status = 3,则返回数据库数据
-//     *     - 如果 status != 3,读取远程数据并更新数据库,并将结果图片上传储存桶
-//     */
-//    @Override
-//    public Map<String, Object> getProgressOfTask(String id, Integer progress_type) throws IOException {
-//
-//        // -- 查询详情 -----------------------------------------------------------------------
-//        AiznImageTaskVO aiznImageTaskVO = new AiznImageTaskVO();
-//        aiznImageTaskVO.setTask_id(id);
-//        Map<String, Object> detail = aiznImageTaskMapper.queryAiznImageTaskDetail(aiznImageTaskVO);
-//        if (detail == null) throw new CustException("任务ID不存在");
-//
-//        // -- 如果已有结果 (status = 3),则不必再查询/上传储存桶,仅返回原始数据 {task_result_json} --
-//        if ((Integer) detail.get("status") != 3) {
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("id", id);
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/info/" + progress_type, RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-////                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                Map<String, Object> respData = Convert.toMap(String.class, Object.class, resp.get("data"));
-//                Map<String, Object> respDataToCase = MapUtil.convertToUnderscoreCase(respData);
-//                System.out.println(respData);
-//
-//                // -- 将任务结果更新到数据表 -----------------------------------------------------
-//                AiznImageTaskVO vo = new AiznImageTaskVO();
-//                vo.setTask_id((String) respData.get("id"));
-//
-//                Integer status = (Integer) respData.get("status");
-//                vo.setStatus(status);
-//
-//                // -- 如果 status = 3 (SUCCESS) ---------------------------------------------
-//                if (status == 3) {
-//                    // 获取任务结果
-//                    List<Map<String, Object>> resultList = (List<Map<String, Object>>) respData.get("resultList");
-//                    List<Map<String, Object>> resultListToCase = (List<Map<String, Object>>) respDataToCase.get("result_list");
-//
-//                    // 转存 (result_image_url 字段保存转存后的链接,多张以逗号间隔)
-//                    List<String> resultImages = new ArrayList<>();
-//
-//                    for (int i = 0; i < resultList.size(); i++) {
-//                        Map<String, Object> result = resultList.get(i);
-//                        String resultUrl = (String) result.get("url");
-//                        // -- 将获得的结果图片,异步上传到对象储存桶 -----------------------------------
-//                        UploadOriginDTO uploadOriginDTO = new UploadOriginDTO();
-//                        uploadOriginDTO.setDir("temp");
-//                        uploadOriginDTO.setUrl(resultUrl);
-//                        UploadOriginResp uploadOriginResp = sdkTencentCOSService.uploadOrigin(uploadOriginDTO);
-//
-//                        // 将上传后的远程地址附加到返回值中
-//                        resultListToCase.get(i).put("url_remote", uploadOriginResp.getUrl());
-//                        resultListToCase.get(i).put("url_remote_thumb", uploadOriginResp.getUrl_thumb());
-//
-//                        resultImages.add(uploadOriginResp.getUrl());
-//                    }
-//
-//                    respDataToCase.put("result_list", resultListToCase);
-//
-//                    System.out.println("resultImages:");
-//                    System.out.println(resultImages);
-//
-//                    vo.setResult_image_url(String.join(",", resultImages));
-//                    vo.setTask_result_json(JSONUtil.toJsonStr(respDataToCase));
-//
-//                }
-//                aiznImageTaskMapper.updateAiznImageTask(vo);
-//                // --------------------------------------------------------------------------
-//
-//                // 从远程接口返回查询任务详情
-//                return respDataToCase;
-//
-//            } else {
-//                System.out.println(resp);
-//                throw new CustException((String) resp.get("msg"));
-//            }
-//
-//        } else {
-//            // 从数据库返回查询任务详情
-//            return JSONUtil.parseObj(detail.get("task_result_json"));
-//        }
-//    }
-//
-//    @Override
-//    public List<Map<String, Object>> getProgressOfTaskArray(String ids, Integer progress_type) throws IOException {
-//        List<String> idsArray = StrUtil.split(ids, ',');
-//
-//        if (idsArray.size() == 0 || idsArray.size() > 10) {
-//            throw new CustException("批量查询范围是: 1~10 条");
-//        }
-//
-//        String[] integerIdsArray = Convert.toStrArray(idsArray);
-//        List<Map<String, Object>> respGroup = new ArrayList<>();
-//        for (String id : integerIdsArray) {
-//            Map<String, Object> resp = getProgressOfTask(StrUtil.trim(id), progress_type);
-//            respGroup.add(resp);
-//        }
-//        return respGroup;
-//    }
-//
-//
-//    /**
-//     * 列表
-//     */
-//    @Override
-//    public Map<String, Object> getImageTaskList(Integer pageNum, Integer pageSize, AiznImageTaskVO aiznImageTaskVO) {
-//
-//        // 分页查询
-//        if (pageNum != null && pageSize != null) {
-//            PageHelper.startPage(pageNum, pageSize);
-//            PageHelper.getLocalPage().setPageSizeZero(true);
-//        }
-//
-//        // 分页输出 (自定义)
-//        List<Map<String, Object>> list = aiznImageTaskMapper.queryAiznImageTask(aiznImageTaskVO);
-//
-//        // 类型转换 数组 (result_image_url)
-//        for (Map<String, Object> item : list) {
-//            String imgUrls = (String) item.get("result_image_url");
-//            item.put("result_image_url", StrUtil.isEmpty(imgUrls) ? new String[0] : StrUtil.splitToArray((String) imgUrls, ','));
-//        }
-//
-//        PageInfoResult pageInfoResult = new PageInfoResult(list);
-//        return pageInfoResult.toMap();
-//    }
-//
-//    /**
-//     * 详情
-//     */
-//    @Override
-//    public Map<String, Object> getImageTaskDetail(AiznImageTaskVO aiznImageTaskVO) {
-//        Map<String, Object> resp = aiznImageTaskMapper.queryAiznImageTaskDetail(aiznImageTaskVO);
-//        if (resp == null) throw new CustException("任务ID不存在");
-//
-//        // result_image_url 转 数组类型
-//        String imgUrls = (String) resp.get("result_image_url");
-//        resp.put("result_image_url", StrUtil.isEmpty(imgUrls) ? new String[0] : StrUtil.splitToArray((String) imgUrls, ','));
-//
-//        return resp;
-//    }
-//}

+ 0 - 27
src/main/java/com/backendsys/service/Ai/Aizn/AiznModelService.java

@@ -1,27 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import com.backendsys.entity.Ai.Aizn.AiznImageStyleDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznIntelligentClipTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznInteractClipTask.AiznInteractClipTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznModel.AiznModelTaskDTO;
-//
-//import java.util.Map;
-//
-///**
-// * AI换模特
-// */
-//public interface AiznModelService {
-//
-//    // [紫鸟] 获取风格/场景配置数据
-//    Map<String, Object> getImageStyle(AiznImageStyleDTO aiznImageStyleDTO);
-//
-//    // [紫鸟] 智能抠图 (发起任务)
-//    Map<String, Object> makeIntelligentClipTask(AiznIntelligentClipTaskDTO aiznIntelligentClipTaskDTO);
-//
-//    // [紫鸟] 交互抠图 (直接返回结果)
-//    Map<String, Object> makeInteractClipTask(AiznInteractClipTaskDTO aiznInteractClipTaskDTO);
-//
-//    // [紫鸟] AI换模特 (发起任务)
-//    Map<String, Object> makeModelTask(AiznModelTaskDTO aiznModelTaskDTO);
-//
-//}

+ 0 - 326
src/main/java/com/backendsys/service/Ai/Aizn/AiznModelServiceImpl.java

@@ -1,326 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.core.util.StrUtil;
-//import cn.hutool.json.JSONObject;
-//import cn.hutool.json.JSONUtil;
-//import com.backendsys.aspect.HttpRequestAspect;
-//import com.backendsys.exception.CustException;
-//import com.backendsys.modules.common.KLingConfig.redis.utils.RedisUtil;
-//import com.backendsys.entity.Ai.Aizn.AiznImageStyleDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznIntelligentClipTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznImageTaskVO;
-//import com.backendsys.entity.Ai.Aizn.AiznInteractClipTask.AiznInteractClipTaskDTO;
-//import com.backendsys.entity.Ai.Aizn.AiznModel.AiznModelTaskDTO;
-//import com.backendsys.mapper.Ai.Aizn.AiznImageTaskMapper;
-//import com.backendsys.service.SDKService.SDKTencent.SDKTencentCOSService;
-//import com.backendsys.service.System.SysResourceService;
-//import com.backendsys.utils.ListUtil;
-//import com.backendsys.utils.MapUtil;
-//import com.fasterxml.jackson.databind.ObjectMapper;
-//import com.fzzixun.openapi.sdk.client.OpenClient;
-//import com.fzzixun.openapi.sdk.common.RequestMethod;
-//import com.fzzixun.openapi.sdk.request.CommonRequest;
-//import com.fzzixun.openapi.sdk.response.CommonResponse;
-//import org.redisson.api.RLock;
-//import org.redisson.api.RedissonClient;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.context.annotation.Lazy;
-//import org.springframework.stereotype.Service;
-//
-//import java.util.LinkedHashMap;
-//import java.util.List;
-//import java.util.Map;
-//import java.util.concurrent.TimeUnit;
-//import java.util.stream.Collectors;
-//
-//@Service
-//public class AiznModelServiceImpl implements AiznModelService {
-//
-//    @Lazy
-//    @Autowired
-//    RedissonClient redissonClient;
-//
-//    @Autowired
-//    private HttpRequestAspect httpRequestAspect;
-//
-//    @Autowired
-//    private AiznService aiznService;
-//    @Autowired
-//    private AiznImageTaskMapper aiznImageTaskMapper;
-//
-//    @Autowired
-//    private SysResourceService sysResourceService;
-//
-//    @Autowired
-//    private SDKTencentCOSService sdkTencentCOSService;
-//
-//    @Autowired
-//    private RedisUtil redisUtil;
-//
-//    /**
-//     * [紫鸟] 获取风格/场景配置数据 (https://open.ziniao.com/manage/apiTest/809)
-//     */
-//    @Override
-//    public Map<String, Object> getImageStyle(AiznImageStyleDTO aiznImageStyleDTO) {
-//
-//        Integer type = aiznImageStyleDTO.getType();
-//
-//        // -- 业务参数 -------------------------------------------------------------------
-//        JSONObject object = new JSONObject();
-//        object.set("showType", aiznImageStyleDTO.getShow_type());       // 展示类型 0.默认
-//        object.set("type", type);                                       // 类型 1.AI绘图
-//
-//        String redisKey = "getImageStyle-" + type;
-//        String redisCacheObject = redisUtil.getCacheObject(redisKey);
-//        if (StrUtil.isNotEmpty(redisCacheObject)) {
-//            // [缓存存在] 读取缓存
-//            Map<String, Object> result = new LinkedHashMap<>();
-//            try {
-//                System.out.println("[缓存存在] 读取缓存");
-//                ObjectMapper mapper = new ObjectMapper();
-//                List<Map<String, Object>> respData = mapper.readValue(redisCacheObject, List.class);
-//                result.put("type", type);
-//                result.put("total", respData.size());
-//                result.put("list", ListUtil.convertToUnderscoreCase(respData)); // 将返回结果:首字母大写命名 转换为 下划线命名
-//            } catch (Exception e) {
-//                e.printStackTrace();
-//            }
-//            return result;
-//
-//        } else {
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/style", RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-//                List<Map<String, Object>> respData = (List<Map<String, Object>>) resp.get("data");
-//                Map<String, Object> result = new LinkedHashMap<>();
-//                result.put("type", type);
-//                result.put("total", respData.size());
-//                result.put("list", ListUtil.convertToUnderscoreCase(respData)); // 将返回结果:首字母大写命名 转换为 下划线命名
-//
-//                // [缓存不存在] 加入缓存
-//                try {
-//                    System.out.println("[缓存不存在] 加入缓存 (30秒过期)");
-//                    ObjectMapper mapper = new ObjectMapper();
-//                    String respDataStr = mapper.writeValueAsString(respData);
-//                    System.out.println(respDataStr);
-//                    redisUtil.setCacheObject(redisKey, respDataStr, 30, TimeUnit.SECONDS);
-//                } catch (Exception e) {
-//                    e.printStackTrace();
-//                }
-//
-//                return result;
-//                // --------------------------------------------------------------------------
-//
-//            } else {
-//                System.out.println(resp);
-//                Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-//                throw new CustException("功能暂不可用,请联系管理员", code, resp);
-//            }
-//
-//        }
-//    }
-//
-//
-//
-//    /**
-//     * [紫鸟] 智能抠图 (发起任务) (创建任务记录) (扣积分)
-//     * (智能抠图:https://open.ziniao.com/manage/apiTest/810)
-//     */
-//    @Override
-//    public Map<String, Object> makeIntelligentClipTask(AiznIntelligentClipTaskDTO aiznIntelligentClipTaskDTO) {
-//
-//        RLock lock = redissonClient.getLock("makeModelTask");
-//        try { lock.tryLock(3, TimeUnit.SECONDS);
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("imageUrl", aiznIntelligentClipTaskDTO.getImage_url());      // 图片
-//            object.set("subType", aiznIntelligentClipTaskDTO.getSub_type());        // 子类型,1:通用,2:人像,3:商品 9:服饰
-//            object.set("outputNum", 1);                                             // 输出张数,固定 1
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/create/3", RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-//                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                System.out.println(respData);
-//
-//                // -- 将制作结果插入到数据表 -----------------------------------------------------
-//                AiznImageTaskVO vo = new AiznImageTaskVO();
-//                vo.setTask_id((String) respData.get("id"));
-//                vo.setUser_id(httpRequestAspect.getUserId());
-//                vo.setTask_type("INTELLIGENT_CLIP");
-//                vo.setImage_url((String) respData.get("imageUrl"));
-//                vo.setTask_submit_json(JSONUtil.toJsonStr(respData));
-//                aiznImageTaskMapper.insertAiznImageTask(vo);
-//                // --------------------------------------------------------------------------
-//
-//                // -- 扣除对应的本地积分 (ZnModel, IntelligentClip, 智能抠图) --------------------
-//                sysResourceService.consumptionPoint("ZnModel", "IntelligentClip", null);
-//
-//                return MapUtil.convertToUnderscoreCase(respData);
-//                // --------------------------------------------------------------------------
-//
-//            } else {
-//                System.out.println(resp);
-//                Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-//                throw new CustException("功能暂不可用,请联系管理员", code, resp);
-//            }
-//
-//        } catch (InterruptedException e) { throw new RuntimeException(e);
-//        } finally { lock.unlock(); }
-//    }
-//
-//    /**
-//     * [紫鸟] 交互抠图 (直接返回结果)
-//     * (交互抠图:https://open.ziniao.com/manage/apiTest/838)
-//     */
-//    @Override
-//    public Map<String, Object> makeInteractClipTask(AiznInteractClipTaskDTO aiznInteractClipTaskDTO) {
-//
-//        RLock lock = redissonClient.getLock("makeInteractClipTask");
-//        try { lock.tryLock(3, TimeUnit.SECONDS);
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("imageUrl", aiznInteractClipTaskDTO.getImage_url());         // 原图
-//
-//            // [参数命名转换] 下划线 转 小驼峰
-//            List<Map<String, Object>> pointList = aiznInteractClipTaskDTO.getPoint_list().stream().map(point -> {
-//                Map<String, Object> map = new LinkedHashMap<>();
-//                map.put("x", point.getX());
-//                map.put("y", point.getY());
-//                map.put("isSelect", point.getIs_select());
-//                return map;
-//            }).collect(Collectors.toList());
-//            // 点位操作列表
-//            object.set("pointList", pointList);
-//
-//            object.set("scoreUrl", aiznInteractClipTaskDTO.getScore_url());         // 概率图
-//            object.set("featureUrl", aiznInteractClipTaskDTO.getFeature_url());     // 全局分割图
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/process/interactCutout", RequestMethod.POST_JSON);
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-//                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                System.out.println(respData);
-//
-//                return MapUtil.convertToUnderscoreCase(respData);
-//                // --------------------------------------------------------------------------
-//
-//            } else {
-//                System.out.println(resp);
-//                Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-//                throw new CustException("功能暂不可用,请联系管理员", code, resp);
-//            }
-//
-//        } catch (InterruptedException e) { throw new RuntimeException(e);
-//        } finally { lock.unlock(); }
-//    }
-//
-//
-//
-//    /**
-//     * [紫鸟] AI换模特 (发起任务) (创建任务记录) (扣积分)
-//     */
-//    @Override
-//    public Map<String, Object> makeModelTask(AiznModelTaskDTO aiznModelTaskDTO) {
-//
-//        RLock lock = redissonClient.getLock("makeModelTask");
-//        try { lock.tryLock(3, TimeUnit.SECONDS);
-//
-////            // 自定义描述时 scene 字段不能跟 style 字段共存,
-////            if (aiznModelTaskDTO.getStyle() != null && aiznModelTaskDTO.getExtend_fields().getScene() != null) {
-////                throw new CustException("自定义描述时,style 与 extend_fields.scene 不能共存");
-////            }
-//
-//            // -- 业务参数 -------------------------------------------------------------------
-//            JSONObject object = new JSONObject();
-//            object.set("imageUrl", aiznModelTaskDTO.getImage_url());         // 原图
-//            object.set("style", aiznModelTaskDTO.getStyle());                // 模特类型 与自定义模特头部图必填其一 预设值 调用风格接口 type = 6
-//            object.set("outputNum", aiznModelTaskDTO.getOutput_num());      // 数量 (1~4)
-//
-//            Map<String, Object> extendFields = new LinkedHashMap<>();
-//            extendFields.put("imageSegUrl", aiznModelTaskDTO.getExtend_fields().getImage_seg_url());
-//            extendFields.put("imageSegSubType", aiznModelTaskDTO.getExtend_fields().getImage_seg_subtype());
-//            extendFields.put("scene", aiznModelTaskDTO.getExtend_fields().getScene());
-//            extendFields.put("modelPrompt", aiznModelTaskDTO.getExtend_fields().getModel_prompt());
-//
-//            Map<String, Object> customModel = new LinkedHashMap<>();
-//
-//            if (aiznModelTaskDTO.getExtend_fields().getCustom_model() != null) {
-//                customModel.put("modelHeadImageUrl", aiznModelTaskDTO.getExtend_fields().getCustom_model().getModel_head_image_url());
-//            }
-//            extendFields.put("customModel", customModel);
-//
-//            object.set("extendFields", extendFields);
-//
-//            System.out.println("Params:");
-//            System.out.println(object.toString());
-//
-//            // -- 实现方法 -------------------------------------------------------------------
-//            OpenClient client = aiznService.getOpenClient();
-//            CommonRequest request = new CommonRequest("/linkfox-ai/image/v1/make/create/9", RequestMethod.POST_JSON);
-//
-//            request.setBizContent(object.toString());
-//
-//            // -- 返回结果 -------------------------------------------------------------------
-//            CommonResponse response = client.executeAppToken(request, aiznService.getAppToken());
-//            JSONObject resp = aiznService.checkResponse(response);
-//            if ((Integer) resp.get("code") == 200) {
-//
-//                // -- 成功 ------------------------------------------------------------------
-//                Map<String, Object> respData = (Map<String, Object>) resp.get("data");
-//                System.out.println(respData);
-//
-//                // -- 将制作结果插入到数据表 -----------------------------------------------------
-//                AiznImageTaskVO vo = new AiznImageTaskVO();
-//                vo.setTask_id((String) respData.get("id"));
-//                vo.setUser_id(httpRequestAspect.getUserId());
-//                vo.setTask_type("MODEL");
-//                vo.setImage_url((String) respData.get("imageUrl"));
-//                vo.setTask_submit_json(JSONUtil.toJsonStr(respData));
-//                aiznImageTaskMapper.insertAiznImageTask(vo);
-//
-//                // -- 消耗积分 (查询对应积分,查询我的积分,更新我的积分,新增积分记录) --------------------------------
-//                sysResourceService.consumptionPoint("ZnModel", "MakeModel", aiznModelTaskDTO.getOutput_num());
-//                // -----------------------------------------------------------------------------------------
-//
-//                return MapUtil.convertToUnderscoreCase(respData);
-//                // --------------------------------------------------------------------------
-//
-//            } else {
-//                System.out.println(resp);
-//                Integer code = resp.get("code") != null ? (Integer) resp.get("code") : 6001;
-//                throw new CustException("功能暂不可用,请联系管理员", code, resp);
-//            }
-//
-//        } catch (InterruptedException e) { throw new RuntimeException(e);
-//        } finally { lock.unlock(); }
-//    }
-//
-//}

+ 0 - 11
src/main/java/com/backendsys/service/Ai/Aizn/AiznService.java

@@ -1,11 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.json.JSONObject;
-//import com.fzzixun.openapi.sdk.client.OpenClient;
-//import com.fzzixun.openapi.sdk.response.CommonResponse;
-//
-//public interface AiznService {
-//    String getAppToken();
-//    OpenClient getOpenClient();
-//    JSONObject checkResponse(CommonResponse response);
-//}

+ 0 - 67
src/main/java/com/backendsys/service/Ai/Aizn/AiznServiceImpl.java

@@ -1,67 +0,0 @@
-//package com.backendsys.service.Ai.Aizn;
-//
-//import cn.hutool.json.JSONObject;
-//import cn.hutool.json.JSONUtil;
-//import com.backendsys.exception.CustException;
-//import com.fzzixun.openapi.sdk.client.OpenClient;
-//import com.fzzixun.openapi.sdk.request.AppTokenRequest;
-//import com.fzzixun.openapi.sdk.response.AppTokenResponse;
-//import com.fzzixun.openapi.sdk.response.CommonResponse;
-//import org.springframework.stereotype.Service;
-//
-//@Service
-//public class AiznServiceImpl implements AiznService{
-//
-//    private String url = "https://sbappstoreapi.ziniao.com";
-//    private String appId = "202404231232292775081406464";
-//    private String privateKeyIsv = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCNl8AKGVm9WnO67gEeLXeHKE2MBp16h0BKmHWrhdurM8uu1fIfRgR4K6AguE97mGqfCYBSad8cfP1dbrA529cZPXXFegl7tSBMxciK7i3kPTqPRS3sUbLQZHHdceoxWXDGA6oa3xxl3I6MuqMIO8vzYrdkY+A5h7sKY59tiYl3uq/mhJnq+FylkiQt3BLy7ATXVWFqMybAt6Pznawlaj2pbCVdSbM7hIKD8StgorAd9a7AnnstiJH7NmtppGS720qXeLHmgkse1hHf8gIel3nbi9iB7XAdC2iM8it425BuWaDb1y0SYZ7EZmhu8f45bsCxUJdd9QEC1dDR90pW0rJFAgMBAAECggEAUEB3VwIBTAJtX8CwH4OToKZmNXw2W5E3DlCVOQ9YbxOfWUvnvHP56oaHbqQoYJwFqng/I/bfvwzUqdUnytNgeezMyI2fvF7vnLPpM11F43wUqcmC+tNfbx/PLbz4CNpxwbmn+y0DsnQs03ShHPSPZzZHTX4SQ2k7yOqoHPR8VsA5g8fIXcYJeVggSG3zJWMB8a7o4r3UvDVfeOVkMj/IOdmwBRRBPiG+JAWNKuGJH6iiSuFN+hVKs7zwdSkLWgQgBNdo9Uss9cm1NGH/4nxYhuM2T+ZyLgq9DCo0TlHb+QvBaex22vGU/IYZobRxWjo2CudxO03rOh4fLzTgWziAbQKBgQD0c7vbg8hVKsuWSkMh/mfEGPIkLgVdVCbObCpMFdNvtevU6x1dS2tXokZ19xbx7xrS7vZgNqfJ9WVGo0OwcFZ4Y6alYCxnVqmtRzEgFyvfd3kHn5Rib7V11vi+viiKbmSIMmPNH9/xMmmp5HCNp57OP//RNtpiYDQ9jI7tpdltCwKBgQCUSBf3Gxrj2IWpoAqT9dT3+yXSS7OONWGpQrDn071o4kPhRjGq9fFYG5v3LcY9zJd70yz382cV4WOIiqDZxBGfYbe5JD31lX/eKZepGviZAsvF1Cp9urMgR+NahGrgfOHNfnr/r2dmTqORnTBnfQI1N7Ig0xAgY5akgy3vez7P7wKBgQCs9KnIwa/fWl0bI8Xl6ls+qqvAH3OaOe0PBgbTOGoV0vBeAFARb0gug9k4o69vU851ya82GdWTlfWnCeLdlk4H9fG1dptULkP1HrbKTrqy7JQMacMR9pm8G3J5eo+yijLFDmoAevn2bMXH96IPB7bblPqJ6zaOfiTYG3gQ+tQgSwKBgHbhwg0Edy+bRbZ0MGbl3iQe//i1ZrSqCa2JYYnMEfyIA4IWI/X8Ds3j/MxUr66WXBETguccB1bciE9NTZ6p+rL8xi6yZtaBUK4OTKBwlkUen77w1kxNJhXIbPgCWCm5FdQKBpT9zPmSLMOu8cLWz7FZAQAeF7zP+1PUNDzfY8GTAoGAQG79mbMSMpxpneuksIPPK0/w+LRAd1bsExXbIWqdO45rGITTpspv42mTICnX1vqbMPDJezPNyYJHhtR5n9rZziOepr3cG2oLvWdUftMatH058tP1VKEi5VH338ND59rgbJGru/nWnjFZ/GnBIpXaGT+itQoNvwZ8jd+of6oM/F8=";
-//
-//    /**
-//     * 紫鸟浏览器 -> 紫鸟开放平台
-//     * https://open.ziniao.com/manage
-//     *
-//     * 应用管理 -> 创建企业自建应用 ->
-//     *      [应用] -> 权限管理 -> 接口权限申请 -> (权限名称:	AI图片) 开通权限
-//     *      [应用] -> 应用首页 -> 配置IP白名单
-//     */
-//
-//    /**
-//     * [Method] 8.3.1.3 获取应用token
-//     * https://open.ziniao.com/docSupport?docId=84#8.3.1.3%E8%8E%B7%E5%8F%96%E5%BA%94%E7%94%A8token27
-//     */
-//    public String getAppToken() {
-//        OpenClient client = new OpenClient(url, appId, privateKeyIsv);
-//        // 创建请求对象
-//        AppTokenRequest request = new AppTokenRequest();
-//        // 发送请求
-//        CommonResponse response = client.execute(request);
-//        if (response.isSuccess()) {
-//            AppTokenResponse appTokenResponse = response.getDataObj(AppTokenResponse.class);
-//            return appTokenResponse.getAppAuthToken();
-//        } else {
-//            throw new CustException(response.getErrorMsg());
-//        }
-//    }
-//
-//    public OpenClient getOpenClient() {
-//        return new OpenClient(url, appId, privateKeyIsv);
-//    }
-//
-//    /**
-//     * 返回值 结构体
-//     */
-//    public JSONObject checkResponse(CommonResponse response) {
-//        if (response.isSuccess()) {
-//            // 返回结果
-//            String data = response.getData();
-//            JSONObject resp = JSONUtil.parseObj(data);
-//            return resp;
-//            //
-//        } else {
-//            System.out.println(response.getBody());
-//            System.out.println(response.getErrorMsg());
-//            throw new CustException(response.getErrorMsg());
-//        }
-//    }
-//
-//}

+ 5 - 5
src/main/java/com/backendsys/service/SDKService/SDKBaidu/SDKBaiduAiGenerateVideoServiceImpl.java

@@ -122,12 +122,12 @@ public class SDKBaiduAiGenerateVideoServiceImpl implements SDKBaiduAiGenerateVid
         customDTO.setSource(sourceDTO);
         // -------------------------------------------------------------------------
 
-        // -- KLingConfig ---------------------------------------------------------------
+        // -- config ---------------------------------------------------------------
         configDTO.setResolution(aiGenerateVideoDTO.getResolution());
         configDTO.setProductType(aiGenerateVideoDTO.getProduct_type());
         configDTO.setTtsPer(aiGenerateVideoDTO.getTts_per());
         // -------------------------------------------------------------------------
-        // -- KLingConfig.bgMusic.mediaSource (背景图) -----------------------------------
+        // -- config.bgMusic.mediaSource (背景图) -----------------------------------
         String bg_music_url = aiGenerateVideoDTO.getBg_music_url();
         if (StrUtil.isNotBlank(bg_music_url)) {
             ConfigBgMusicDTO bgMusicDTO = new ConfigBgMusicDTO();
@@ -140,7 +140,7 @@ public class SDKBaiduAiGenerateVideoServiceImpl implements SDKBaiduAiGenerateVid
             configDTO.setBgMusic(bgMusicDTO);
         }
         // -------------------------------------------------------------------------
-        // -- KLingConfig.videoBegin.mediaSource (片头) ----------------------------------
+        // -- config.videoBegin.mediaSource (片头) ----------------------------------
         String video_begin_url = aiGenerateVideoDTO.getVideo_begin_url();
         if (StrUtil.isNotBlank(video_begin_url)) {
             ConfigVideoBeginDTO videoBeginDTO = new ConfigVideoBeginDTO();
@@ -153,7 +153,7 @@ public class SDKBaiduAiGenerateVideoServiceImpl implements SDKBaiduAiGenerateVid
             configDTO.setVideoBegin(videoBeginDTO);
         }
         // -------------------------------------------------------------------------
-        // -- KLingConfig.videoEnd.mediaSource (片尾) ------------------------------------
+        // -- config.videoEnd.mediaSource (片尾) ------------------------------------
         String video_end_url = aiGenerateVideoDTO.getVideo_end_url();
         if (StrUtil.isNotBlank(video_end_url)) {
             ConfigVideoEndDTO videoEndDTO = new ConfigVideoEndDTO();
@@ -166,7 +166,7 @@ public class SDKBaiduAiGenerateVideoServiceImpl implements SDKBaiduAiGenerateVid
             configDTO.setVideoEnd(videoEndDTO);
         }
         // -------------------------------------------------------------------------
-        // -- KLingConfig.videoLogo (LOGO) ----------------------------------------------
+        // -- config.videoLogo (LOGO) ----------------------------------------------
         String video_logo_url = aiGenerateVideoDTO.getVideo_logo_url();
         if (StrUtil.isNotBlank(video_logo_url)) {
             ConfigVideoLogoDTO videoLogoDTO = new ConfigVideoLogoDTO();

+ 9 - 9
src/main/java/com/backendsys/service/SDKService/SDKTencent/SDKTencentCOSServiceImpl.java

@@ -118,18 +118,18 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 //    @Override
 //    public TempCredentialsDTO getTempCredentials(String allowPrefix) {
 //
-//        TreeMap<String, Object> KLingConfig = new TreeMap<String, Object>();
+//        TreeMap<String, Object> config = new TreeMap<String, Object>();
 //        try {
 //
 //            // 密钥,使用子账号密钥,授权遵循最小权限指引
-//            KLingConfig.put("secretId", secretId);
-//            KLingConfig.put("secretKey", secretKey);
+//            config.put("secretId", secretId);
+//            config.put("secretKey", secretKey);
 //
 //            // 临时密钥有效时长,单位是秒,默认 120 秒,目前主账号最长 2 小时(即 7200 秒),子账号最长 36 小时(即 129600)秒
 //            Integer durationSeconds = 120;
-//            KLingConfig.put("durationSeconds", durationSeconds);
-//            KLingConfig.put("bucket", bucketName);
-//            KLingConfig.put("region", region);
+//            config.put("durationSeconds", durationSeconds);
+//            config.put("bucket", bucketName);
+//            config.put("region", region);
 //
 //            // 获取当前时间戳(毫秒)
 //            long nowDateTime = System.currentTimeMillis() / 1000L;
@@ -138,7 +138,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 //
 //            // 这里改成允许的路径前缀,可以根据自己网站的用户登录态判断允许上传的具体路径,例子:a.jpg 或者 a/* 或者 * 。
 //            // 如果填写了“*”,将允许用户访问所有资源;除非业务需要,否则请按照最小权限原则授予用户相应的访问权限范围。
-//            KLingConfig.put("allowPrefix", allowPrefix);
+//            config.put("allowPrefix", allowPrefix);
 //
 //            // 密钥的权限列表。简单上传、表单上传和分片上传需要以下的权限,其他权限列表请看 https://cloud.tencent.com/document/product/436/31923
 //            String[] allowActions = new String[] {
@@ -161,7 +161,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 //            };
 //            // "name/cos:*"
 //
-//            KLingConfig.put("allowActions", allowActions);
+//            config.put("allowActions", allowActions);
 //
 //            // -- 在后台 存储桶->设置策略 -------------------------------------------------------------
 //
@@ -171,7 +171,7 @@ public class SDKTencentCOSServiceImpl implements SDKTencentCOSService {
 //
 //
 //
-//            Response response = CosStsClient.getCredential(KLingConfig);
+//            Response response = CosStsClient.getCredential(config);
 //
 //            TempCredentialsDTO dto = new TempCredentialsDTO();
 //            dto.setRegion(region);

+ 1 - 1
src/main/java/com/backendsys/utils/CommonUtil.java

@@ -22,7 +22,7 @@ public class CommonUtil {
     //private static TokenUtil tokenService;
 
     // 以上引用会报错:
-    // Cannot invoke \"com.backendsys.modules.common.KLingConfig.Security.utils.TokenUtil.getTokenInfo(jakarta.servlet.http.HttpServletRequest)\" because \"com.backendsys.utils.CommonUtil.tokenService\" is null
+    // Cannot invoke \"com.backendsys.modules.common.config.Security.utils.TokenUtil.getTokenInfo(jakarta.servlet.http.HttpServletRequest)\" because \"com.backendsys.utils.CommonUtil.tokenService\" is null
     // 工具类无法直接用,得写 set 方法,如下:
 
     //private static TokenUtil tokenService;

+ 2 - 2
src/main/resources/application-dev.yml

@@ -185,6 +185,6 @@ wechat:
 # https://app.klingai.com/cn/dev/api-key
 klingai:
   url: https://api-beijing.klingai.com
-  access-key: AtCGNbbFpkAF8GECBfMD8ebfNHAgfn3G
-  secret-key: TGthayRmgATNgnpmhH8npLEeLHby8hAH
+  access-key: A9baBTPFLH8RfrAHGeb4mGagmRHhRHTg
+  secret-key: PQnT4E9TMYkPN93pb8JCHJC3dtFAtNPC
   token-duration-time: 10000

+ 2 - 2
src/main/resources/application-local.yml

@@ -198,6 +198,6 @@ wechat:
 # https://app.klingai.com/cn/dev/api-key
 klingai:
   url: https://api-beijing.klingai.com
-  access-key: AtCGNbbFpkAF8GECBfMD8ebfNHAgfn3G
-  secret-key: TGthayRmgATNgnpmhH8npLEeLHby8hAH
+  access-key: A9baBTPFLH8RfrAHGeb4mGagmRHhRHTg
+  secret-key: PQnT4E9TMYkPN93pb8JCHJC3dtFAtNPC
   token-duration-time: 10000

+ 2 - 2
src/main/resources/application-prod.yml

@@ -186,6 +186,6 @@ wechat:
 # https://app.klingai.com/cn/dev/api-key
 klingai:
   url: https://api-beijing.klingai.com
-  access-key: AtCGNbbFpkAF8GECBfMD8ebfNHAgfn3G
-  secret-key: TGthayRmgATNgnpmhH8npLEeLHby8hAH
+  access-key: A9baBTPFLH8RfrAHGeb4mGagmRHhRHTg
+  secret-key: PQnT4E9TMYkPN93pb8JCHJC3dtFAtNPC
   token-duration-time: 10000

+ 3 - 3
src/main/resources/application.yml

@@ -97,7 +97,7 @@ pagehelper:
 
 # 日志
 logging:
-  #  KLingConfig: classpath:log4j2.xml
+  #  config: classpath:log4j2.xml
   level:
     root: INFO # WARN
   pattern:
@@ -116,8 +116,8 @@ logging:
 # %n:平台的换行符
 
 # 接口/路径白名单 (JWT/OAuth2)
-# com/backendsys/KLingConfig/Security/filter/JwtAuthenticationFilter.java
-# com/backendsys/KLingConfig/Security/SecurityConfig.java
+# com/backendsys/config/Security/filter/JwtAuthenticationFilter.java
+# com/backendsys/config/Security/SecurityConfig.java
 whitelist:
   static:
     /,