Skip to content

Commit

Permalink
xx
Browse files Browse the repository at this point in the history
  • Loading branch information
shuigedeng committed Aug 20, 2024
1 parent 3400a78 commit ad0e5be
Show file tree
Hide file tree
Showing 26 changed files with 255 additions and 183 deletions.
81 changes: 1 addition & 80 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ plugins {

//smart-doc gradle 插件
// https://plugins.gradle.org/plugin/com.ly.smart-doc
id "com.ly.smart-doc" version "3.0.6"
id "com.ly.smart-doc" version "3.0.7-release"

//OWASP 依赖检查插件。
//https://plugins.gradle.org/plugin/org.owasp.dependencycheck
Expand Down Expand Up @@ -323,23 +323,6 @@ allprojects {
}


import org.apache.tools.ant.filters.ReplaceTokens


def getProperty(String key, String defaultValue) {
def keyValue = findProperty(key) ?: System.getenv(key)
if (keyValue != null) {
return keyValue;
}
// 加载根路径自定义配置属性
Properties envProps = new Properties()
envProps.load(new FileInputStream("${rootProject.projectDir.absolutePath}${File.separator}release.properties"))

keyValue = envProps.getProperty(key, defaultValue)
println("打包profile环境==============" + keyValue)
return keyValue
}

subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
Expand Down Expand Up @@ -430,69 +413,7 @@ subprojects {
jvmArgs += enablePreview
}

//多项目分环境打包
//gradle构建过程中的默认任务processResources,重写
//gradle build -x test -Pprofile=dev
//gradle -x test clean bootJar -Pprofile=dev
processResources {
doFirst {
//过滤器会将用 @var@ 包裹的变量,替换为指定的值。
filter ReplaceTokens, tokens: [activeProfile: getProperty("profile", "dev")]


//${profile}变量
//filesMatching("**/*.yml"){
// expand(project.properties)
//}

//inputs.property('version', version)

//filesMatching("**/version.properties") {
// expand version: version
//}
}
}

tasks.register('createProperties') {
dependsOn processResources
doLast {
def fileDir = new File("${project.layout.buildDirectory.asFile.get()}/resources/main");
if (fileDir.exists() && fileDir.isDirectory()) {
def pro = ["application.properties", "bootstrap.properties"]
pro.forEach(item -> {
new File("${project.layout.buildDirectory.asFile.get()}/resources/main/$item").withWriter { w ->
def projectProperties = project.properties
Properties p = new Properties()
projectProperties.each { entry ->
p[entry.key.toString()] = entry.value.toString()
}

p.store w, null
}
})
}
}
}

classes {
dependsOn 'createProperties'
}

task bootJarTest {
dependsOn 'clean'
doFirst {
System.setProperty("profile", "test")
}
finalizedBy("bootJar")
}

task bootJarProduction {
dependsOn 'clean'
doFirst {
System.setProperty("profile", "prod")
}
finalizedBy("bootJar")
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@

package com.taotao.cloud.ddd.api.dubbo;

import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_07;
import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_08;

import com.taotao.cloud.common.support.info.Caller;
import com.taotao.cloud.common.support.info.Create;
import com.taotao.cloud.common.support.info.RpcInfo;
import com.taotao.cloud.common.support.info.Update;
import com.taotao.cloud.ddd.api.dubbo.response.DictRpcResponse;

/**
Expand All @@ -27,12 +34,23 @@
*/
public interface DictRpcService {

/**
* 字典code查询
*
* @param code 代码
* @return {@link DictRpcResponse }
* @since 2022-06-29 21:45:44
*/
DictRpcResponse findByCode(Integer code);
/**
* 字典code查询
*
* @param code 代码
* @return {@link DictRpcResponse }
* @since 2022-06-29 21:45:44
*/
@RpcInfo(
create = @Create(version = V2022_07, date = "2022-07-01 17:11:55"),
update = {
@Update(version = V2022_07, content = "主要修改了配置信息的接口查询", date = "2022-07-01 17:11:55"),
@Update(version = V2022_08, content = "主要修改了配置信息的接口查询08", date = "2022-07-08 15:12:55")
},
caller = {
@Caller(contacts = "张三", desc = "支付系统", sys = "支付系统", use = "调用字典查询获取详情"),
@Caller(contacts = "李四", desc = "后台管理-字典管理-添加页面", sys = "后台管理", use = "查询字典")
}
)
DictRpcResponse findByCode(Integer code);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@

package com.taotao.cloud.ddd.api.feign;

import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_07;
import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_08;

import com.taotao.cloud.common.constant.ServiceName;
import com.taotao.cloud.openfeign.annotation.ApiInfo;
import com.taotao.cloud.openfeign.annotation.ApiInfo.Create;
import com.taotao.cloud.openfeign.annotation.ApiInfo.Update;
import com.taotao.cloud.openfeign.annotation.FeignInner;
import com.taotao.cloud.openfeign.annotation.FeignRetry;
import com.taotao.cloud.common.support.info.ApiInfo;
import com.taotao.cloud.common.support.info.Caller;
import com.taotao.cloud.common.support.info.Create;
import com.taotao.cloud.common.support.info.Update;
import com.taotao.cloud.ddd.api.feign.fallback.DictApiFallback;
import com.taotao.cloud.ddd.api.feign.response.DictApiResponse;
import com.taotao.cloud.openfeign.annotation.FeignInner;
import com.taotao.cloud.openfeign.annotation.FeignRetry;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static com.taotao.cloud.openfeign.annotation.ApiVersionEnum.V2022_07;
import static com.taotao.cloud.openfeign.annotation.ApiVersionEnum.V2022_08;


/**
* 远程调用后台用户模块
Expand All @@ -39,6 +40,7 @@
* @since 2020/5/2 16:42
*/
@FeignClient(
contextId = "DictApi",
name = ServiceName.TAOTAO_CLOUD_SYS,
fallbackFactory = DictApiFallback.class)
public interface DictApi {
Expand All @@ -54,9 +56,13 @@ public interface DictApi {
create = @Create(version = V2022_07, date = "2022-07-01 17:11:55"),
update = {
@Update(version = V2022_07, content = "主要修改了配置信息的接口查询", date = "2022-07-01 17:11:55"),
@Update(version = V2022_08, content = "主要修改了配置信息的接口查询08", date = "2022-07-01 17:11:55")
@Update(version = V2022_08, content = "主要修改了配置信息的接口查询08", date = "2022-07-08 15:12:55")
},
caller = {
@Caller(contacts = "张三", desc = "支付系统", sys = "支付系统", use = "调用字典查询获取详情"),
@Caller(contacts = "李四", desc = "后台管理-字典管理-添加页面", sys = "后台管理", use = "查询字典")
})
@FeignRetry(maxAttempt= 6, backoff = @FeignRetry.Backoff(delay = 500L, maxDelay = 20000L, multiplier = 4))
@FeignRetry(maxAttempt = 6, backoff = @FeignRetry.Backoff(delay = 500L, maxDelay = 20000L, multiplier = 4))
@FeignInner
@GetMapping("/sys/feign/dict/code")
DictApiResponse findByCode(@RequestParam(value = "code") String code);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package com.taotao.cloud.ddd.api.feign;


import static com.taotao.cloud.openfeign.annotation.ApiVersionEnum.V2022_07;
import static com.taotao.cloud.openfeign.annotation.ApiVersionEnum.V2022_08;
import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_07;
import static com.taotao.cloud.common.support.info.ApiVersionEnum.V2022_08;

import com.taotao.cloud.common.constant.ServiceName;
import com.taotao.cloud.openfeign.annotation.ApiInfo;
import com.taotao.cloud.openfeign.annotation.ApiInfo.Create;
import com.taotao.cloud.openfeign.annotation.ApiInfo.Update;
import com.taotao.cloud.common.support.info.ApiInfo;
import com.taotao.cloud.common.support.info.Create;
import com.taotao.cloud.common.support.info.Update;
import com.taotao.cloud.ddd.api.feign.fallback.FileApiFallback;
import com.taotao.cloud.ddd.api.feign.response.FileApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
Expand All @@ -37,24 +37,25 @@
* @since 2020/5/2 16:42
*/
@FeignClient(
name = ServiceName.TAOTAO_CLOUD_FILE,
contextId = "feignDictApi",
fallbackFactory = FileApiFallback.class)
name = ServiceName.TAOTAO_CLOUD_FILE,
contextId = "FileApi",
fallbackFactory = FileApiFallback.class)
public interface FileApi {

/**
* 字典列表code查询
*
* @param code 代码
* @return {@link FileApiResponse }
* @since 2022-06-29 21:40:21
*/
@ApiInfo(
create = @Create(version = V2022_07, date = "2022-07-01 17:11:55"),
update = {
@Update(version = V2022_07, content = "主要修改了配置信息的接口查询", date = "2022-07-01 17:11:55"),
@Update(version = V2022_08, content = "主要修改了配置信息的接口查询08", date = "2022-07-01 17:11:55")
})
@GetMapping("/file/feign/file/code")
FileApiResponse findByCode(@RequestParam(value = "code") String code);
/**
* 字典列表code查询
*
* @param code 代码
* @return {@link FileApiResponse }
* @since 2022-06-29 21:40:21
*/
@ApiInfo(
create = @Create(version = V2022_07, date = "2022-07-01 17:11:55"),
update = {
@Update(version = V2022_07, content = "主要修改了配置信息的接口查询", date = "2022-07-01 17:11:55"),
@Update(version = V2022_08, content = "主要修改了配置信息的接口查询08", date = "2022-07-01 17:11:55")
}
)
@GetMapping("/file/feign/file/code")
FileApiResponse findByCode(@RequestParam(value = "code") String code);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
*/
@FeignClient(
name = ServiceName.TAOTAO_CLOUD_SYS,
contextId = "IFeignLogisticsApi",
contextId = "LogisticsApi",
fallbackFactory = LogisticsApiFallback.class)
public interface LogisticsApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
@FeignClient(
name = ServiceName.TAOTAO_CLOUD_SYS,
contextId = "IFeignMenuApi",
contextId = "MenuApi",
fallbackFactory = MenuApiFallback.class)
public interface MenuApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
* @author shuigedeng
* @since 2020/5/2 16:42
*/
@FeignClient(value = ServiceName.TAOTAO_CLOUD_JOB, fallbackFactory = QuartzJobApiFallback.class)
@FeignClient(
contextId = "QuartzJobApi",
value = ServiceName.TAOTAO_CLOUD_JOB,
fallbackFactory = QuartzJobApiFallback.class)
public interface QuartzJobApi {

@PostMapping("/job/addQuartzJobDTOTestSeata")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
@FeignClient(
name = ServiceName.TAOTAO_CLOUD_SYS,
contextId = "IFeignRoleApi",
contextId = "RoleApi",
fallbackFactory = RoleApiFallback.class)
public interface RoleApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
*/
@FeignClient(
name = ServiceName.TAOTAO_CLOUD_SYS,
contextId = "IFeignSettingApi",
contextId = "SettingApi",
fallbackFactory = SettingApiFallback.class)
public interface SettingApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@FeignClient(
name = ServiceName.TAOTAO_CLOUD_LOG,
contextId = "feignDictApi",
contextId = "SysLogApi",
fallbackFactory = SysLogApiFallback.class)
public interface SysLogApi {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@FeignClient(
name = ServiceName.TAOTAO_CLOUD_LOG,
contextId = "feignDictApi",
contextId = "SysLogLoginApi",
fallbackFactory = SysLogLoginApiFallback.class)
public interface SysLogLoginApi {

Expand Down
Loading

0 comments on commit ad0e5be

Please sign in to comment.