Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
d5d1c336
Commit
d5d1c336
authored
May 27, 2022
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
4554fb06
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
470 additions
and
34 deletions
+470
-34
admin-server/pom.xml
+208
-0
admin-server/src/main/resources/application.yml
+132
-0
admin-server/src/main/resources/bootstrap.yml
+20
-0
pom.xml
+34
-33
xxx-common-utils/src/main/java/com/zq/common/utils/WeixinUtils.java
+34
-1
xxx-common-utils/src/main/java/com/zq/common/vo/weixin/GenerateSchemeVo.java
+42
-0
No files found.
admin-server/pom.xml
0 → 100644
View file @
d5d1c336
<?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"
>
<parent>
<artifactId>
cloud-backend
</artifactId>
<groupId>
com.zq
</groupId>
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
admin-server
</artifactId>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
<!-- oshi监控需要指定jna版本, 问题详见 https://github.com/oshi/oshi/issues/1040 -->
<jna.version>
5.8.0
</jna.version>
<mapstruct.version>
1.3.1.Final
</mapstruct.version>
<alipay.version>
4.9.153.ALL
</alipay.version>
<qiniu.version>
[7.2.0, 7.2.99]
</qiniu.version>
<configuration.version>
1.9
</configuration.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.zq
</groupId>
<artifactId>
xxx-common-utils
</artifactId>
<version>
1.0.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-netflix-eureka-client
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-config
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-security
</artifactId>
</dependency>
<!--Spring boot 核心-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<!-- Spring boot websocket -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-websocket
</artifactId>
</dependency>
<!-- generator模块依赖-模板引擎-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-freemarker
</artifactId>
</dependency>
<!-- generator模块依赖- https://mvnrepository.com/artifact/commons-configuration/commons-configuration -->
<dependency>
<groupId>
commons-configuration
</groupId>
<artifactId>
commons-configuration
</artifactId>
<version>
${configuration.version}
</version>
</dependency>
<!--数据库相关-->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.plus.version}
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${alibaba.druid.version}
</version>
</dependency>
<!-- quartz -->
<dependency>
<groupId>
org.quartz-scheduler
</groupId>
<artifactId>
quartz
</artifactId>
</dependency>
<!--JWT相关-->
<dependency>
<groupId>
io.jsonwebtoken
</groupId>
<artifactId>
jjwt
</artifactId>
<version>
${jjwt.version}
</version>
</dependency>
<!--支付宝依赖-->
<dependency>
<groupId>
com.alipay.sdk
</groupId>
<artifactId>
alipay-sdk-java
</artifactId>
<version>
${alipay.version}
</version>
</dependency>
<!--七牛云存储-->
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
${qiniu.version}
</version>
</dependency>
<!--mapStruct依赖-->
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct
</artifactId>
<version>
${mapstruct.version}
</version>
</dependency>
<dependency>
<groupId>
org.mapstruct
</groupId>
<artifactId>
mapstruct-processor
</artifactId>
<version>
${mapstruct.version}
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
javax.inject
</groupId>
<artifactId>
javax.inject
</artifactId>
<version>
1
</version>
</dependency>
<!-- Java图形验证码 -->
<dependency>
<groupId>
com.github.whvcse
</groupId>
<artifactId>
easy-captcha
</artifactId>
<version>
1.6.2
</version>
</dependency>
<!-- linux的管理 -->
<dependency>
<groupId>
ch.ethz.ganymed
</groupId>
<artifactId>
ganymed-ssh2
</artifactId>
<version>
build210
</version>
</dependency>
<dependency>
<groupId>
com.jcraft
</groupId>
<artifactId>
jsch
</artifactId>
<version>
0.1.55
</version>
</dependency>
<!-- 解析客户端操作系统、浏览器信息 -->
<dependency>
<groupId>
nl.basjes.parse.useragent
</groupId>
<artifactId>
yauaa
</artifactId>
<version>
5.23
</version>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>
com.github.oshi
</groupId>
<artifactId>
oshi-core
</artifactId>
<version>
5.7.1
</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi
</artifactId>
<version>
3.17
</version>
</dependency>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.17
</version>
</dependency>
<dependency>
<groupId>
xerces
</groupId>
<artifactId>
xercesImpl
</artifactId>
<version>
2.12.0
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
</plugins>
<!-- 使用@profiles.active@需要添加以下内容 -->
<resources>
<resource>
<directory>
src/main/resources
</directory>
<!--开启过滤,用指定的参数替换directory下的文件中的参数-->
<filtering>
true
</filtering>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
admin-server/src/main/resources/application.yml
0 → 100644
View file @
d5d1c336
server
:
port
:
${admin.port}
# 配置数据源
spring
:
freemarker
:
check-template-location
:
false
application
:
name
:
${admin.name}
redis
:
# 数据库索引
database
:
0
host
:
${redis.url}
port
:
${redis.port}
password
:
# 连接超时时间
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
${db.cloud.driver-class-name}
username
:
${db.cloud.username}
password
:
${db.cloud.password}
url
:
${db.cloud.url.cloud}
# 初始连接数
initial-size
:
5
# 最小连接数
min-idle
:
10
# 最大连接数
max-active
:
20
# 获取连接超时时间
max-wait
:
5000
# 连接有效性检测时间
time-between-eviction-runs-millis
:
60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis
:
300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis
:
900000
test-while-idle
:
true
test-on-borrow
:
false
test-on-return
:
false
# 检测连接是否有效
validation-query
:
select 1
# 配置监控统计
webStatFilter
:
enabled
:
true
stat-view-servlet
:
enabled
:
true
url-pattern
:
/druid/*
reset-enable
:
false
filter
:
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
1000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
#配置 Jpa
jpa
:
hibernate
:
ddl-auto
:
none
open-in-view
:
true
properties
:
hibernate
:
dialect
:
org.hibernate.dialect.MySQL5InnoDBDialect
#七牛云
qiniu
:
# 文件大小 /M
max-size
:
15
#邮箱验证码有效时间/秒
code
:
expiration
:
300
#密码加密传输,前端公钥加密,后端私钥解密
rsa
:
private_key
:
MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A==
# 登录相关配置
login
:
# 登录缓存
cache-enable
:
true
# 是否限制单用户登录
single-login
:
false
# 验证码
login-code
:
# 验证码类型配置 查看 LoginProperties 类
code-type
:
arithmetic
# 登录图形验证码有效时间/分钟
expiration
:
2
# 验证码高度
width
:
111
# 验证码宽度
height
:
36
# 内容长度
length
:
2
# 字体名称,为空则使用默认字体
font-name
:
# 字体大小
font-size
:
25
#是否允许生成代码,生产环境设置为false
generator
:
enabled
:
true
#是否开启 swagger-ui
swagger
:
enabled
:
true
# IP 本地解析
ip
:
local-parsing
:
true
# 文件存储路径
file
:
mac
:
path
:
~/file/
avatar
:
~/avatar/
linux
:
path
:
/home/eladmin/file/
avatar
:
/home/eladmin/avatar/
windows
:
path
:
C:\eladmin\file\
avatar
:
C:\eladmin\avatar\
# 文件大小 /M
maxSize
:
100
avatarMaxSize
:
5
\ No newline at end of file
admin-server/src/main/resources/bootstrap.yml
0 → 100644
View file @
d5d1c336
spring
:
profiles
:
active
:
@
profiles.active@
cloud
:
config
:
name
:
config
profile
:
${spring.profiles.active}
discovery
:
enabled
:
true
service-id
:
CONFIG-SERVER
eureka
:
instance
:
prefer-ip-address
:
true
lease-renewal-interval-in-seconds
:
2
#每间隔1s,向服务端发送一次心跳,证明自己依然"存活"
lease-expiration-duration-in-seconds
:
6
#告诉服务端,如果我2s之内没有给你发心跳,就代表我"死"了,将我踢出掉。
instance-id
:
${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client
:
service-url
:
defaultZone
:
@
eureka.server.url@
pom.xml
View file @
d5d1c336
...
...
@@ -41,41 +41,9 @@
<module>
file-server
</module>
<module>
api-server
</module>
<module>
user-server
</module>
<module>
admin-server
</module>
</modules>
<profiles>
<profile>
<!--本地开发环境-->
<id>
dev
</id>
<properties>
<profiles.active>
dev
</profiles.active>
<logging.level>
debug
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<profile>
<!--测试环境-->
<id>
test
</id>
<properties>
<profiles.active>
test
</profiles.active>
<logging.level>
debug
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
</profile>
<profile>
<!--生产环境-->
<id>
product
</id>
<properties>
<profiles.active>
product
</profiles.active>
<logging.level>
info
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
@@ -123,4 +91,37 @@
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<!--本地开发环境-->
<id>
dev
</id>
<properties>
<profiles.active>
dev
</profiles.active>
<logging.level>
debug
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<profile>
<!--测试环境-->
<id>
test
</id>
<properties>
<profiles.active>
test
</profiles.active>
<logging.level>
debug
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
</profile>
<profile>
<!--生产环境-->
<id>
product
</id>
<properties>
<profiles.active>
product
</profiles.active>
<logging.level>
info
</logging.level>
<eureka.server.url>
http://admin:123456@127.0.0.1:8800/eureka/
</eureka.server.url>
</properties>
</profile>
</profiles>
</project>
xxx-common-utils/src/main/java/com/zq/common/utils/WeixinUtils.java
View file @
d5d1c336
...
...
@@ -6,12 +6,15 @@ import cn.hutool.core.date.DatePattern;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.jfinal.weixin.sdk.kit.PaymentKit
;
import
com.jfinal.wxaapp.WxaConfig
;
import
com.jfinal.wxaapp.WxaConfigKit
;
import
com.jfinal.wxaapp.api.WxaAccessToken
;
import
com.jfinal.wxaapp.api.WxaAccessTokenApi
;
import
com.zq.common.vo.weixin.GenerateSchemeVo
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.http.HttpEntity
;
...
...
@@ -327,8 +330,38 @@ public class WeixinUtils {
params
.
put
(
"sign"
,
sign
);
return
params
;
}
/**
* 获取跳转微信小程序的链接
*
* @return
*/
public
static
String
generateScheme
(
String
accessToken
,
GenerateSchemeVo
vo
)
{
String
url
=
"https://api.weixin.qq.com/wxa/generatescheme?access_token="
+
accessToken
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"jump_wxa"
,
vo
.
getJumpWxa
());
params
.
put
(
"expire_type"
,
vo
.
getExpireType
());
params
.
put
(
"expire_time"
,
vo
.
getExpireTime
());
params
.
put
(
"expire_interval"
,
vo
.
getExpireInterval
());
HttpRequest
request
=
HttpUtil
.
createPost
(
url
)
.
body
(
JSONUtil
.
toJsonStr
(
params
));
log
.
info
(
"获取跳转微信小程序的链接请求:{}"
,
request
.
toString
());
cn
.
hutool
.
http
.
HttpResponse
response
=
request
.
execute
();
String
body
=
response
.
body
();
log
.
debug
(
"获取跳转微信小程序的链接响应 {} => {}"
,
response
.
getStatus
(),
body
);
cn
.
hutool
.
json
.
JSONObject
object
=
JSONUtil
.
parseObj
(
body
);
Integer
errcode
=
object
.
getInt
(
"errcode"
);
if
(
errcode
==
null
||
errcode
!=
0
)
{
log
.
error
(
"获取跳转连接失败:{}"
,
object
.
getStr
(
"errmsg"
));
}
return
object
.
getStr
(
"openlink"
);
}
}
xxx-common-utils/src/main/java/com/zq/common/vo/weixin/GenerateSchemeVo.java
0 → 100644
View file @
d5d1c336
package
com
.
zq
.
common
.
vo
.
weixin
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Map
;
/**
* @author wilmiam
* @since 2022/5/5 9:56
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
GenerateSchemeVo
{
@ApiModelProperty
(
"微信APPID"
)
private
String
appId
;
/**
* path:通过 scheme 码进入的小程序页面路径,必须是已经发布的小程序存在的页面,不可携带 query。path 为空时会跳转小程序主页。
* query:通过 scheme 码进入小程序时的 query,最大1024个字符,只支持数字,大小写英文以及部分特殊字符:`!#$&'()*+,/:;=?@-._~%``
* env_version:要打开的小程序版本。正式版为"release",体验版为"trial",开发版为"develop",仅在微信外打开时生效。
*/
@ApiModelProperty
(
"跳转到的目标小程序信息。"
)
private
Map
<
String
,
Object
>
jumpWxa
;
@ApiModelProperty
(
"到期失效的 scheme 码失效类型,失效时间:0,失效间隔天数:1"
)
private
Integer
expireType
;
@ApiModelProperty
(
"到期失效的 scheme 码的失效时间,为 Unix 时间戳。生成的到期失效 scheme 码在该时间前有效。最长有效期为30天。expire_type 为 0 时必填"
)
private
Long
expireTime
;
@ApiModelProperty
(
"到期失效的 scheme 码的失效间隔天数。生成的到期失效 scheme 码在该间隔时间到达前有效。最长间隔天数为30天。 expire_type 为 1 时必填"
)
private
Integer
expireInterval
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment