mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
22
README.md
22
README.md
@@ -32,14 +32,14 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处
|
|||||||
public interface OpenPayment {
|
public interface OpenPayment {
|
||||||
|
|
||||||
@ApiOperation(
|
@ApiOperation(
|
||||||
value = "alipay.trade.wap.pay(手机网站支付接口2.0)",
|
value = "手机网站支付接口",
|
||||||
notes = "该接口是页面跳转接口,用于生成用户访问支付宝的跳转链接。" +
|
notes = "该接口是页面跳转接口,用于生成用户访问跳转链接。" +
|
||||||
"请在服务端执行支付宝SDK中pageExecute方法,读取响应中的body()结果。" +
|
"请在服务端执行SDK中pageExecute方法,读取响应中的body()结果。" +
|
||||||
"该结果用于跳转到支付宝页面,返回到用户浏览器渲染或重定向跳转到支付宝页面。" +
|
"该结果用于跳转到页面,返回到用户浏览器渲染或重定向跳转到页面。" +
|
||||||
"具体使用方法请参考 <a href=\"https://torna.cn\" target=\"_blank\">接入指南</a>"
|
"具体使用方法请参考 <a href=\"https://torna.cn\" target=\"_blank\">接入指南</a>"
|
||||||
)
|
)
|
||||||
@Open(value = "alipay.trade.wap.pay", version = "2.0")
|
@Open(value = "pay.trade.wap.pay", version = "1.0")
|
||||||
AlipayTradeWapPayResponse tradeWapPay(AlipayTradeWapPayRequest request);
|
PayTradeWapPayResponse tradeWapPay(PayTradeWapPayRequest request);
|
||||||
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -58,10 +58,10 @@ public interface OpenPayment {
|
|||||||
public class OpenPaymentImpl implements OpenPayment {
|
public class OpenPaymentImpl implements OpenPayment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlipayTradeWapPayResponse tradeWapPay(AlipayTradeWapPayRequest request) {
|
public PayTradeWapPayResponse tradeWapPay(PayTradeWapPayRequest request) {
|
||||||
AlipayTradeWapPayResponse alipayTradeWapPayResponse = new AlipayTradeWapPayResponse();
|
PayTradeWapPayResponse payTradeWapPayResponse = new PayTradeWapPayResponse();
|
||||||
alipayTradeWapPayResponse.setPageRedirectionData(UUID.randomUUID().toString());
|
payTradeWapPayResponse.setPageRedirectionData(UUID.randomUUID().toString());
|
||||||
return alipayTradeWapPayResponse;
|
return payTradeWapPayResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ public class OpenPaymentImpl implements OpenPayment {
|
|||||||
// 公共请求参数
|
// 公共请求参数
|
||||||
Map<String, String> params = new HashMap<String, String>();
|
Map<String, String> params = new HashMap<String, String>();
|
||||||
params.put("app_id", appId);
|
params.put("app_id", appId);
|
||||||
params.put("method", "alipay.trade.wap.pay");
|
params.put("method", "pay.trade.wap.pay");
|
||||||
params.put("format", "json");
|
params.put("format", "json");
|
||||||
params.put("charset", "utf-8");
|
params.put("charset", "utf-8");
|
||||||
params.put("sign_type", "RSA2");
|
params.put("sign_type", "RSA2");
|
||||||
|
5
pom.xml
5
pom.xml
@@ -123,6 +123,11 @@
|
|||||||
<artifactId>transmittable-thread-local</artifactId>
|
<artifactId>transmittable-thread-local</artifactId>
|
||||||
<version>2.14.5</version>
|
<version>2.14.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>32.1.3-jre</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- commons -->
|
<!-- commons -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
33
sop-admin/sop-admin-backend/.gitignore
vendored
33
sop-admin/sop-admin-backend/.gitignore
vendored
@@ -1,33 +0,0 @@
|
|||||||
HELP.md
|
|
||||||
target/
|
|
||||||
!.mvn/wrapper/maven-wrapper.jar
|
|
||||||
!**/src/main/**/target/
|
|
||||||
!**/src/test/**/target/
|
|
||||||
|
|
||||||
### STS ###
|
|
||||||
.apt_generated
|
|
||||||
.classpath
|
|
||||||
.factorypath
|
|
||||||
.project
|
|
||||||
.settings
|
|
||||||
.springBeans
|
|
||||||
.sts4-cache
|
|
||||||
|
|
||||||
### IntelliJ IDEA ###
|
|
||||||
.idea
|
|
||||||
*.iws
|
|
||||||
*.iml
|
|
||||||
*.ipr
|
|
||||||
|
|
||||||
### NetBeans ###
|
|
||||||
/nbproject/private/
|
|
||||||
/nbbuild/
|
|
||||||
/dist/
|
|
||||||
/nbdist/
|
|
||||||
/.nb-gradle/
|
|
||||||
build/
|
|
||||||
!**/src/main/**/build/
|
|
||||||
!**/src/test/**/build/
|
|
||||||
|
|
||||||
### VS Code ###
|
|
||||||
.vscode/
|
|
139
sop-admin/sop-admin-backend/backend-boot/pom.xml
Normal file
139
sop-admin/sop-admin-backend/backend-boot/pom.xml
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>sop-admin-backend</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>backend-boot</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>backend-web</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>website-web</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- nacos注册中心 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-nacos-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- provided -->
|
||||||
|
|
||||||
|
<!-- 仅在开发中使用 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo-dependencies-zookeeper-curator5</artifactId>
|
||||||
|
<version>${dubbo.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>aliyun</id>
|
||||||
|
<name>aliyun</name>
|
||||||
|
<url>https://maven.aliyun.com/repository/public</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<!-- 打包时跳过测试 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.12.4</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<source>${java.version}</source>
|
||||||
|
<target>${java.version}</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>3.3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>checkstyle.xml</configLocation>
|
||||||
|
<consoleOutput>true</consoleOutput>
|
||||||
|
<failsOnError>true</failsOnError>
|
||||||
|
<linkXRef>false</linkXRef>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>validate</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
93
sop-admin/sop-admin-backend/backend-common/pom.xml
Normal file
93
sop-admin/sop-admin-backend/backend-common/pom.xml
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>sop-admin-backend</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>backend-common</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>sop-service-support</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.gitee.durcframework</groupId>
|
||||||
|
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- json处理 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.fastjson2</groupId>
|
||||||
|
<artifactId>fastjson2</artifactId>
|
||||||
|
<version>2.0.52</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-codec</groupId>
|
||||||
|
<artifactId>commons-codec</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.commons</groupId>
|
||||||
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-fileupload</groupId>
|
||||||
|
<artifactId>commons-fileupload</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate</groupId>
|
||||||
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||||
|
<artifactId>jackson-dataformat-xml</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.auth0</groupId>
|
||||||
|
<artifactId>java-jwt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-crypto</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.oschina.durcframework</groupId>
|
||||||
|
<artifactId>http-helper</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@@ -0,0 +1,20 @@
|
|||||||
|
package com.gitee.sop.adminbackend.common.constants;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
public class YesOrNo {
|
||||||
|
public static final int YES = 1;
|
||||||
|
public static final int NO = 0;
|
||||||
|
|
||||||
|
public static boolean yes(Number value) {
|
||||||
|
return value != null && value.intValue() == YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int of(Boolean b) {
|
||||||
|
return Objects.equals(b, true) ? YES : NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
package com.gitee.sop.adminbackend.common.context;
|
package com.gitee.sop.adminbackend.common.context;
|
||||||
|
|
||||||
import com.auth0.jwt.interfaces.Claim;
|
import com.auth0.jwt.interfaces.Claim;
|
||||||
|
import com.gitee.sop.adminbackend.common.manager.UserCacheManager;
|
||||||
import com.gitee.sop.adminbackend.common.user.User;
|
import com.gitee.sop.adminbackend.common.user.User;
|
||||||
import com.gitee.sop.adminbackend.common.config.Configs;
|
import com.gitee.sop.adminbackend.common.config.Configs;
|
||||||
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
import com.gitee.sop.adminbackend.common.enums.ConfigKeyEnum;
|
||||||
@@ -8,7 +9,6 @@ import com.gitee.sop.adminbackend.common.exception.ErrorTokenException;
|
|||||||
import com.gitee.sop.adminbackend.common.exception.JwtErrorException;
|
import com.gitee.sop.adminbackend.common.exception.JwtErrorException;
|
||||||
import com.gitee.sop.adminbackend.common.exception.JwtExpiredException;
|
import com.gitee.sop.adminbackend.common.exception.JwtExpiredException;
|
||||||
import com.gitee.sop.adminbackend.common.exception.LoginFailureException;
|
import com.gitee.sop.adminbackend.common.exception.LoginFailureException;
|
||||||
import com.gitee.sop.adminbackend.service.sys.login.UserCacheManager;
|
|
||||||
import com.gitee.sop.adminbackend.common.util.JwtUtil;
|
import com.gitee.sop.adminbackend.common.util.JwtUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.math.NumberUtils;
|
import org.apache.commons.lang3.math.NumberUtils;
|
@@ -1,4 +1,4 @@
|
|||||||
package com.gitee.sop.adminbackend.service.sys.login;
|
package com.gitee.sop.adminbackend.common.manager;
|
||||||
|
|
||||||
import com.gitee.sop.adminbackend.common.user.User;
|
import com.gitee.sop.adminbackend.common.user.User;
|
||||||
|
|
33
sop-admin/sop-admin-backend/backend-dao/pom.xml
Normal file
33
sop-admin/sop-admin-backend/backend-dao/pom.xml
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>sop-admin-backend</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>backend-dao</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.gitee.durcframework</groupId>
|
||||||
|
<artifactId>fastmybatis-spring-boot-starter</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@@ -0,0 +1,58 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.entity;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.annotation.Pk;
|
||||||
|
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||||
|
import com.gitee.fastmybatis.annotation.Table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名:doc_content
|
||||||
|
* 备注:文档内容
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Table(name = "doc_content", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||||
|
@Data
|
||||||
|
public class DocContent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* doc_info.id
|
||||||
|
*/
|
||||||
|
private Long docInfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文档内容
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime addTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人id
|
||||||
|
*/
|
||||||
|
private Long addBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改人id
|
||||||
|
*/
|
||||||
|
private Long updateBy;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -30,7 +30,7 @@ public class DocInfo {
|
|||||||
private Long docAppId;
|
private Long docAppId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文档id
|
* 远程文档id
|
||||||
*/
|
*/
|
||||||
private Long docId;
|
private Long docId;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ public class DocInfo {
|
|||||||
private Integer isPublish;
|
private Integer isPublish;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 父节点id
|
* 父节点id, 对应docId
|
||||||
*/
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
@@ -0,0 +1,13 @@
|
|||||||
|
package com.gitee.sop.adminbackend.dao.mapper;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocContent;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface DocContentMapper extends BaseMapper<DocContent> {
|
||||||
|
|
||||||
|
}
|
44
sop-admin/sop-admin-backend/backend-service/pom.xml
Normal file
44
sop-admin/sop-admin-backend/backend-service/pom.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>sop-admin-backend</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<artifactId>backend-service</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>backend-common</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.gitee.sop</groupId>
|
||||||
|
<artifactId>backend-dao</artifactId>
|
||||||
|
<version>5.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.dubbo</groupId>
|
||||||
|
<artifactId>dubbo</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@@ -23,6 +23,8 @@ public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DocInfoService docInfoService;
|
private DocInfoService docInfoService;
|
||||||
|
@Autowired
|
||||||
|
private DocInfoSyncService docInfoSyncService;
|
||||||
|
|
||||||
public Long addDocApp(String token) {
|
public Long addDocApp(String token) {
|
||||||
TornaModuleDTO tornaModuleDTO = tornaClient.execute("module.get", null, token, TornaModuleDTO.class);
|
TornaModuleDTO tornaModuleDTO = tornaClient.execute("module.get", null, token, TornaModuleDTO.class);
|
||||||
@@ -37,7 +39,7 @@ public class DocAppService implements LambdaService<DocApp, DocAppMapper> {
|
|||||||
this.update(docApp);
|
this.update(docApp);
|
||||||
}
|
}
|
||||||
// 同步文档
|
// 同步文档
|
||||||
docInfoService.syncDocInfo(docApp);
|
docInfoSyncService.syncDocInfo(docApp, null);
|
||||||
return docApp.getId();
|
return docApp.getId();
|
||||||
}
|
}
|
||||||
|
|
@@ -0,0 +1,39 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.doc;
|
||||||
|
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocContent;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.DocContentMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DocContentService implements LambdaService<DocContent, DocContentMapper> {
|
||||||
|
|
||||||
|
public void saveContent(Long docInfoId, String content) {
|
||||||
|
DocContent docContent = this.get(DocContent::getDocInfoId, docInfoId);
|
||||||
|
boolean save = false;
|
||||||
|
if (docContent == null) {
|
||||||
|
save = true;
|
||||||
|
docContent = new DocContent();
|
||||||
|
}
|
||||||
|
docContent.setDocInfoId(docInfoId);
|
||||||
|
docContent.setContent(content);
|
||||||
|
if (save) {
|
||||||
|
this.save(docContent);
|
||||||
|
} else {
|
||||||
|
this.update(docContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent(Long docInfoId) {
|
||||||
|
return this.query()
|
||||||
|
.eq(DocContent::getDocInfoId, docInfoId)
|
||||||
|
.getValueOptional(DocContent::getContent)
|
||||||
|
.orElse("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,107 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.doc;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||||
|
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||||
|
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||||
|
import com.gitee.sop.adminbackend.common.exception.BizException;
|
||||||
|
import com.gitee.sop.adminbackend.common.util.CopyUtil;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.DocInfoMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoPublishUpdateDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.DocInfoTreeDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.TornaDocInfoViewDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DocInfoService implements LambdaService<DocInfo, DocInfoMapper> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DocAppMapper docAppMapper;
|
||||||
|
@Autowired
|
||||||
|
private DocContentService docContentService;
|
||||||
|
|
||||||
|
public List<DocInfo> listChildDoc(Long parentId) {
|
||||||
|
return this.list(DocInfo::getParentId, parentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DocInfoTreeDTO> listDocTree(Long docAppId) {
|
||||||
|
List<DocInfo> list = this.list(DocInfo::getDocAppId, docAppId);
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return new ArrayList<>(0);
|
||||||
|
}
|
||||||
|
List<DocInfoTreeDTO> docInfoTreeDTOS = CopyUtil.copyList(list, DocInfoTreeDTO::new);
|
||||||
|
return TreeUtil.convertTree(docInfoTreeDTOS, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int publish(DocInfoPublishUpdateDTO docInfoUpdateDTO) {
|
||||||
|
DocInfo docInfo = this.getById(docInfoUpdateDTO.getId());
|
||||||
|
Integer isPublish = docInfoUpdateDTO.getIsPublish();
|
||||||
|
|
||||||
|
// 如果是文件夹,发布下面所有的文档
|
||||||
|
int i;
|
||||||
|
if (YesOrNo.yes(docInfo.getIsFolder())) {
|
||||||
|
List<DocInfo> children = this.listChildDoc(docInfo.getDocId());
|
||||||
|
Set<Long> ids = children.stream().map(DocInfo::getId).collect(Collectors.toSet());
|
||||||
|
i = this.query()
|
||||||
|
.in(DocInfo::getId, ids)
|
||||||
|
.set(DocInfo::getIsPublish, isPublish)
|
||||||
|
.update();
|
||||||
|
} else {
|
||||||
|
// 发布单个文档
|
||||||
|
i = this.query()
|
||||||
|
.eq(DocInfo::getId, docInfoUpdateDTO.getId())
|
||||||
|
.set(DocInfo::getIsPublish, isPublish)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发布一个接口自动发布所属应用
|
||||||
|
Long docAppId = docInfo.getDocAppId();
|
||||||
|
if (YesOrNo.yes(isPublish)) {
|
||||||
|
docAppMapper.query()
|
||||||
|
.eq(DocApp::getId, docAppId)
|
||||||
|
.set(DocApp::getIsPublish, isPublish)
|
||||||
|
.update();
|
||||||
|
} else {
|
||||||
|
// 如果应用下的接口都未发布,应用也改成未发布
|
||||||
|
long count = this.query()
|
||||||
|
.eq(DocInfo::getDocAppId, docAppId)
|
||||||
|
.eq(DocInfo::getIsFolder, YesOrNo.NO)
|
||||||
|
.eq(DocInfo::getIsPublish, YesOrNo.YES)
|
||||||
|
.getCount();
|
||||||
|
if (count == 0) {
|
||||||
|
docAppMapper.query()
|
||||||
|
.eq(DocApp::getId, docAppId)
|
||||||
|
.set(DocApp::getIsPublish, YesOrNo.NO)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TornaDocInfoViewDTO getDocDetail(Long id) {
|
||||||
|
DocInfo docInfo = this.getById(id);
|
||||||
|
if (docInfo == null || !YesOrNo.yes(docInfo.getIsPublish())) {
|
||||||
|
throw new BizException("文档不存在");
|
||||||
|
}
|
||||||
|
String content = docContentService.getContent(docInfo.getId());
|
||||||
|
return JSON.parseObject(content, TornaDocInfoViewDTO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,218 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.doc;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.gitee.fastmybatis.core.util.TreeUtil;
|
||||||
|
import com.gitee.sop.adminbackend.common.constants.YesOrNo;
|
||||||
|
import com.gitee.sop.adminbackend.common.enums.DocSourceTypeEnum;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocApp;
|
||||||
|
import com.gitee.sop.adminbackend.dao.entity.DocInfo;
|
||||||
|
import com.gitee.sop.adminbackend.dao.mapper.DocAppMapper;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.DocIdParam;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.DocIdsParam;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.TornaDocDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.TornaDocInfoDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.TornaDocInfoViewDTO;
|
||||||
|
import com.gitee.sop.adminbackend.service.doc.dto.torna.TornaDocParamDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口信息同步
|
||||||
|
*
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class DocInfoSyncService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TornaClient tornaClient;
|
||||||
|
@Autowired
|
||||||
|
private DocAppMapper docAppMapper;
|
||||||
|
@Autowired
|
||||||
|
private DocInfoService docInfoService;
|
||||||
|
@Autowired
|
||||||
|
private DocContentService docContentService;
|
||||||
|
|
||||||
|
public void syncAppDoc(Long docAppId) {
|
||||||
|
DocApp docApp = docAppMapper.getById(docAppId);
|
||||||
|
this.syncDocInfo(docApp, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncDoc(Long docInfoId) {
|
||||||
|
DocInfo docInfo = docInfoService.getById(docInfoId);
|
||||||
|
DocApp docApp = docAppMapper.getById(docInfo.getDocAppId());
|
||||||
|
this.syncDocInfo(docApp, docInfoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncDocInfo(DocApp docApp, Long docInfoId) {
|
||||||
|
Long docAppId = docApp.getId();
|
||||||
|
Map<String, DocInfo> nameVersionMap = docInfoService.list(DocInfo::getDocAppId, docAppId)
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(docInfo -> docInfo.getDocName() + ":" + docInfo.getDocVersion(), Function.identity(), (v1, v2) -> v2));
|
||||||
|
|
||||||
|
String token = docApp.getToken();
|
||||||
|
// add doc
|
||||||
|
DocIdsParam docIdsParam = buildSearchParam(docInfoId);
|
||||||
|
TornaDocDTO tornaDocDTO = tornaClient.execute("doc.list", docIdsParam, token, TornaDocDTO.class);
|
||||||
|
List<TornaDocInfoDTO> docList = tornaDocDTO.getDocList();
|
||||||
|
if (CollectionUtils.isEmpty(docList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DocInfo> updateList = new ArrayList<>();
|
||||||
|
for (TornaDocInfoDTO tornaDocInfoDTO : docList) {
|
||||||
|
String key = buildKey(tornaDocInfoDTO);
|
||||||
|
DocInfo docInfo = nameVersionMap.get(key);
|
||||||
|
// 需要修改的文档
|
||||||
|
if (docInfo != null) {
|
||||||
|
docInfo.setDocId(tornaDocInfoDTO.getId());
|
||||||
|
docInfo.setDocTitle(tornaDocInfoDTO.getName());
|
||||||
|
docInfo.setDocCode("");
|
||||||
|
if (YesOrNo.yes(tornaDocInfoDTO.getIsFolder())) {
|
||||||
|
docInfo.setDocName(tornaDocInfoDTO.getName());
|
||||||
|
}
|
||||||
|
docInfo.setDocId(tornaDocInfoDTO.getId());
|
||||||
|
docInfo.setDocType(tornaDocInfoDTO.getType().intValue());
|
||||||
|
docInfo.setDescription(tornaDocInfoDTO.getDescription());
|
||||||
|
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
|
||||||
|
docInfo.setParentId(tornaDocInfoDTO.getParentId());
|
||||||
|
updateList.add(docInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (DocInfo docInfo : updateList) {
|
||||||
|
docInfoService.update(docInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增的文档
|
||||||
|
List<DocInfo> saveList = docList.stream()
|
||||||
|
.filter(tornaDocInfoDTO -> {
|
||||||
|
String key = buildKey(tornaDocInfoDTO);
|
||||||
|
return !nameVersionMap.containsKey(key);
|
||||||
|
})
|
||||||
|
.map(tornaDocInfoDTO -> {
|
||||||
|
DocInfo docInfo = new DocInfo();
|
||||||
|
docInfo.setDocAppId(docAppId);
|
||||||
|
docInfo.setDocId(tornaDocInfoDTO.getId());
|
||||||
|
docInfo.setDocTitle(tornaDocInfoDTO.getName());
|
||||||
|
docInfo.setDocCode("");
|
||||||
|
docInfo.setDocType(tornaDocInfoDTO.getType().intValue());
|
||||||
|
docInfo.setSourceType(DocSourceTypeEnum.TORNA.getValue());
|
||||||
|
if (YesOrNo.yes(tornaDocInfoDTO.getIsFolder())) {
|
||||||
|
docInfo.setIsPublish(YesOrNo.YES);
|
||||||
|
docInfo.setDocName(tornaDocInfoDTO.getName());
|
||||||
|
} else {
|
||||||
|
docInfo.setIsPublish(YesOrNo.NO);
|
||||||
|
docInfo.setDocName(tornaDocInfoDTO.getUrl());
|
||||||
|
}
|
||||||
|
docInfo.setDocVersion(tornaDocInfoDTO.getVersion());
|
||||||
|
docInfo.setDescription(tornaDocInfoDTO.getDescription());
|
||||||
|
docInfo.setIsFolder(tornaDocInfoDTO.getIsFolder().intValue());
|
||||||
|
docInfo.setParentId(tornaDocInfoDTO.getParentId());
|
||||||
|
return docInfo;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
docInfoService.saveBatch(saveList);
|
||||||
|
|
||||||
|
Set<Long> docIds = docList.stream().map(TornaDocInfoDTO::getId).collect(Collectors.toSet());
|
||||||
|
this.syncContent(docApp, docIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncContent(DocApp docApp, Set<Long> docIds) {
|
||||||
|
List<DocInfo> list = docInfoService.query()
|
||||||
|
.eq(DocInfo::getDocAppId, docApp.getId())
|
||||||
|
.in(DocInfo::getDocId, docIds)
|
||||||
|
.list();
|
||||||
|
|
||||||
|
Map<Long, String> docIdMap = this.getContentMap(docApp.getToken(), docIds);
|
||||||
|
for (DocInfo docInfo : list) {
|
||||||
|
String content = docIdMap.getOrDefault(docInfo.getDocId(), "");
|
||||||
|
docContentService.saveContent(
|
||||||
|
docInfo.getId(),
|
||||||
|
content
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量获取Torna文档内容
|
||||||
|
*
|
||||||
|
* @param token token
|
||||||
|
* @param docIds Torna文档id
|
||||||
|
* @return key:文档id, value:文档内容
|
||||||
|
*/
|
||||||
|
private Map<Long, String> getContentMap(String token, Collection<Long> docIds) {
|
||||||
|
// 获取torna文档信息
|
||||||
|
List<TornaDocInfoViewDTO> tornaDocInfoViewList = tornaClient.executeList(
|
||||||
|
"doc.details",
|
||||||
|
new DocIdsParam(docIds),
|
||||||
|
token,
|
||||||
|
TornaDocInfoViewDTO.class
|
||||||
|
);
|
||||||
|
for (TornaDocInfoViewDTO docInfoViewDTO : tornaDocInfoViewList) {
|
||||||
|
convertTree(docInfoViewDTO);
|
||||||
|
}
|
||||||
|
return tornaDocInfoViewList.stream()
|
||||||
|
.collect(Collectors.toMap(TornaDocInfoViewDTO::getId, JSON::toJSONString, (v1, v2) -> v1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getContent(String token, Long docId) {
|
||||||
|
// 获取torna文档信息
|
||||||
|
TornaDocInfoViewDTO tornaDocInfoViewDTO = tornaClient.execute(
|
||||||
|
"doc.detail",
|
||||||
|
new DocIdParam(docId),
|
||||||
|
token,
|
||||||
|
TornaDocInfoViewDTO.class
|
||||||
|
);
|
||||||
|
convertTree(tornaDocInfoViewDTO);
|
||||||
|
return JSON.toJSONString(tornaDocInfoViewDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void convertTree(TornaDocInfoViewDTO tornaDocInfoViewDTO) {
|
||||||
|
List<TornaDocParamDTO> requestParams = tornaDocInfoViewDTO.getRequestParams();
|
||||||
|
List<TornaDocParamDTO> responseParams = tornaDocInfoViewDTO.getResponseParams();
|
||||||
|
List<TornaDocParamDTO> requestTree = TreeUtil.convertTree(requestParams, 0L);
|
||||||
|
List<TornaDocParamDTO> responseTree = TreeUtil.convertTree(responseParams, 0L);
|
||||||
|
|
||||||
|
tornaDocInfoViewDTO.setRequestParams(requestTree);
|
||||||
|
tornaDocInfoViewDTO.setResponseParams(responseTree);
|
||||||
|
}
|
||||||
|
|
||||||
|
private DocIdsParam buildSearchParam(Long docInfoId) {
|
||||||
|
if (docInfoId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
DocIdsParam docIdsParam = new DocIdsParam();
|
||||||
|
DocInfo docInfo = docInfoService.getById(docInfoId);
|
||||||
|
List<Long> docIdList = new ArrayList<>();
|
||||||
|
docIdList.add(docInfo.getDocId());
|
||||||
|
// 如果是文件夹,找下面的子文档
|
||||||
|
if (YesOrNo.yes(docInfo.getIsFolder())) {
|
||||||
|
List<Long> docIds = this.listChildrenDocId(docInfo.getDocId());
|
||||||
|
docIdList.addAll(docIds);
|
||||||
|
}
|
||||||
|
docIdsParam.setDocIds(docIdList);
|
||||||
|
return docIdsParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Long> listChildrenDocId(Long parentId) {
|
||||||
|
return docInfoService.query()
|
||||||
|
.eq(DocInfo::getParentId, parentId)
|
||||||
|
.listValue(DocInfo::getDocId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildKey(TornaDocInfoDTO tornaDocInfoDTO) {
|
||||||
|
return YesOrNo.yes(tornaDocInfoDTO.getIsFolder()) ?
|
||||||
|
tornaDocInfoDTO.getName() + ":" + tornaDocInfoDTO.getVersion()
|
||||||
|
: tornaDocInfoDTO.getUrl() + ":" + tornaDocInfoDTO.getVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -9,9 +9,13 @@ import com.gitee.sop.adminbackend.common.exception.BizException;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.util.UriUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,14 +35,15 @@ public class TornaClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JSONObject request(String name, Object param, String token) {
|
private JSONObject request(String name, Object param, String token) {
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
params.put("name", name);
|
||||||
|
params.put("access_token", token);
|
||||||
|
if (param != null) {
|
||||||
|
String json = JSON.toJSONString(param);
|
||||||
|
params.put("data", UriUtils.encode(json, StandardCharsets.UTF_8));
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
HttpHelper httpHelper = HttpHelper.get(getTornaApiUrl())
|
String body = HttpHelper.postJson(getTornaApiUrl(), JSON.toJSONString(params))
|
||||||
.parameter("name", name)
|
|
||||||
.parameter("access_token", token);
|
|
||||||
if (param != null) {
|
|
||||||
httpHelper.parameter("data", JSON.toJSONString(param));
|
|
||||||
}
|
|
||||||
String body = httpHelper
|
|
||||||
.execute()
|
.execute()
|
||||||
.asString();
|
.asString();
|
||||||
JSONObject jsonObject = JSON.parseObject(body);
|
JSONObject jsonObject = JSON.parseObject(body);
|
@@ -13,6 +13,9 @@ public class DocInfoPublishUpdateDTO {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 1-发布,0-下线
|
||||||
|
*/
|
||||||
private Integer isPublish;
|
private Integer isPublish;
|
||||||
|
|
||||||
}
|
}
|
@@ -0,0 +1,22 @@
|
|||||||
|
package com.gitee.sop.adminbackend.service.doc.dto.torna;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 六如
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DocIdsParam {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Collection<Long> docIds;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user