Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
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
civil
civil-bigdata
Commits
f3d0dfb3
Commit
f3d0dfb3
authored
Jun 30, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
f92630d8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
292 additions
and
52 deletions
+292
-52
portal-server/pom.xml
+1
-0
portal-server/src/main/java/com/zq/portal/task/StatsTimingTask.java
+0
-0
portal-server/src/main/resources/mapper/ShjzProvideStatsMapper.xml
+4
-7
sys-server/pom.xml
+7
-0
sys-server/src/main/resources/application.yml
+82
-42
user-server/pom.xml
+1
-0
user-server/src/main/java/com/zq/user/service/UserService.java
+3
-3
user-server/src/main/java/com/zq/user/utils/MobileSmsUtils.java
+194
-0
No files found.
portal-server/pom.xml
View file @
f3d0dfb3
...
...
@@ -60,6 +60,7 @@
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.plus.version}
</version>
</dependency>
<!--Mybatis plus多数据源-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
...
...
portal-server/src/main/java/com/zq/portal/task/StatsTimingTask.java
View file @
f3d0dfb3
This diff is collapsed.
Click to expand it.
portal-server/src/main/resources/mapper/ShjzProvideStatsMapper.xml
View file @
f3d0dfb3
...
...
@@ -4,11 +4,7 @@
<select
id=
"getFivesYearStats"
resultType=
"java.util.Map"
>
SELECT iscity,
ROUND(SUM(sum_year_2017)/10000) 's2017',
ROUND(SUM(sum_year_2018)/10000) 's2018',
ROUND(SUM(sum_year_2019)/10000) 's2019',
ROUND(SUM(sum_year_2020)/10000) 's2020',
ROUND(SUM(sum_year_2021)/10000) 's2021'
ROUND(SUM(sum_year_2017) / 10000) 's2017', ROUND(SUM(sum_year_2018) / 10000) 's2018', ROUND(SUM(sum_year_2019) / 10000) 's2019', ROUND(SUM(sum_year_2020) / 10000) 's2020', ROUND(SUM(sum_year_2021) / 10000) 's2021'
FROM `v_shjz_provide`
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)
...
...
@@ -17,10 +13,11 @@
</select>
<select
id=
"getStatsByYear"
resultType=
"java.util.Map"
>
SELECT get_upunitname 'city', ROUND(sum_year_${year}
/
10000) 'provideNum'
SELECT get_upunitname 'city', ROUND(sum_year_${year}
/
10000) 'provideNum'
FROM `v_shjz_provide`
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC
LIMIT 1)
AND iscity = '低保'
</select>
...
...
sys-server/pom.xml
View file @
f3d0dfb3
...
...
@@ -65,11 +65,18 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<!--Mybatis plus-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.plus.version}
</version>
</dependency>
<!--Mybatis plus多数据源-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
3.4.0
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
...
...
sys-server/src/main/resources/application.yml
View file @
f3d0dfb3
...
...
@@ -15,48 +15,89 @@ spring:
# 连接超时时间
timeout
:
5000
datasource
:
druid
:
db-type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
${jdbc.username}
password
:
${jdbc.password}
url
:
${jdbc.url}
# 初始连接数
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
:
dynamic
:
# mybatis plus多数据源插件
primary
:
master
#设置默认的数据源或者数据源组,默认值即为master
strict
:
false
#严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource
:
master
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
${jdbc.url}
username
:
${jdbc.username}
password
:
${jdbc.password}
driver-class-name
:
${jdbc.driver-class-name}
gxshzz
:
type
:
com.alibaba.druid.pool.DruidDataSource
url
:
jdbc:mysql://192.168.0.193:3306/shzz?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username
:
root
password
:
rooT123!321
driver-class-name
:
com.mysql.cj.jdbc.Driver
druid
:
# 初始连接数
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
filters
:
stat
stat
:
enabled
:
true
# 记录慢SQL
log-slow-sql
:
true
slow-sql-millis
:
1000
merge-sql
:
true
wall
:
config
:
multi-statement-allow
:
true
log-slow-sql
:
true
slow-sql-millis
:
2000
# druid:
# db-type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.cj.jdbc.Driver
# username: ${jdbc.username}
# password: ${jdbc.password}
# url: ${jdbc.url}
# # 初始连接数
# 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
:
properties
:
...
...
@@ -137,4 +178,4 @@ file:
avatar
:
C:\eladmin\avatar\
# 文件大小 /M
maxSize
:
100
avatarMaxSize
:
5
\ No newline at end of file
avatarMaxSize
:
5
user-server/pom.xml
View file @
f3d0dfb3
...
...
@@ -65,6 +65,7 @@
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.plus.version}
</version>
</dependency>
<!--Mybatis plus多数据源-->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
...
...
user-server/src/main/java/com/zq/user/service/UserService.java
View file @
f3d0dfb3
...
...
@@ -16,6 +16,7 @@ import com.zq.common.vo.ApiTokenVo;
import
com.zq.user.dao.PfuserDao
;
import
com.zq.user.dao.UserDao
;
import
com.zq.user.manager.CacheKeys
;
import
com.zq.user.utils.MobileSmsUtils
;
import
com.zq.user.vo.LoginVo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -39,10 +40,9 @@ public class UserService {
*/
public
void
sendCode
(
String
phone
)
{
String
code
=
RandomUtil
.
randomNumbers
(
6
);
code
=
"111111"
;
log
.
info
(
">> phone: {}, sendCode: {}"
,
phone
,
code
);
String
content
=
"您的验证码为:"
+
code
+
"(5分钟内有效)。为了保障信息安全,如非本人操作请忽略本短信。"
;
// TencentSmsUtils.sendSms(phone, code);
boolean
sendMsg
=
MobileSmsUtils
.
sendMsg
(
phone
,
content
);
log
.
info
(
">> phone: {}, sendCode: {}, success: {}"
,
phone
,
code
,
sendMsg
);
redisUtils
.
setStr
(
CacheKeys
.
authCodeKey
(
phone
),
code
,
5
);
}
...
...
user-server/src/main/java/com/zq/user/utils/MobileSmsUtils.java
0 → 100644
View file @
f3d0dfb3
package
com
.
zq
.
user
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
lombok.Data
;
import
org.apache.commons.codec.binary.Base64
;
import
org.springframework.util.DigestUtils
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStreamReader
;
import
java.io.OutputStreamWriter
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.nio.charset.StandardCharsets
;
public
class
MobileSmsUtils
{
/**
* 账号
*/
private
static
String
apId
=
"sjfx"
;
/**
* 密码
*/
private
static
String
secretKey
=
"Shujufenxi!2345"
;
/**
* 集团名称
*/
private
static
String
ecName
=
"广西壮族自治区民政厅"
;
/**
* 网关签名编码
*/
private
static
String
sign
=
"nMbQzvoRh"
;
/**
* 拓展码(可以为空)
*/
private
static
String
addSerial
=
""
;
/**
* url
*/
private
static
String
url
=
"http://112.35.1.155:1992/sms/norsubmit"
;
/**
* 多用户发送短信信息
*
* @param mobiles 手机号码逗号分隔
* @param content 短信内容
* @return 返回1表示成功,0表示失败
*/
public
static
boolean
sendMsg
(
String
mobiles
,
String
content
)
{
SendReq
sendReq
=
new
SendReq
();
sendReq
.
setApId
(
apId
);
sendReq
.
setEcName
(
ecName
);
sendReq
.
setSecretKey
(
secretKey
);
sendReq
.
setContent
(
content
);
sendReq
.
setMobiles
(
mobiles
);
sendReq
.
setAddSerial
(
addSerial
);
sendReq
.
setSign
(
sign
);
String
stringBuffer
=
sendReq
.
getEcName
()
+
sendReq
.
getApId
()
+
sendReq
.
getSecretKey
()
+
sendReq
.
getMobiles
()
+
sendReq
.
getContent
()
+
sendReq
.
getSign
()
+
sendReq
.
getAddSerial
();
sendReq
.
setMac
(
DigestUtils
.
md5DigestAsHex
(
stringBuffer
.
getBytes
()).
toLowerCase
());
String
reqText
=
JSON
.
toJSONString
(
sendReq
);
// BASE64编码
String
encode
=
Base64
.
encodeBase64String
(
reqText
.
getBytes
(
StandardCharsets
.
UTF_8
));
// System.out.println(encode);
String
resStr
=
sendPost
(
url
,
encode
);
// System.out.println("发送短信结果:" + resStr);
SendRes
sendRes
=
JSON
.
parseObject
(
resStr
,
SendRes
.
class
);
return
sendRes
.
getSuccess
()
&&
!
""
.
equals
(
sendRes
.
getMsgGroup
())
&&
"success"
.
equals
(
sendRes
.
getRspcod
());
}
/**
* main方法测试发送短信,返回1表示成功,0表示失败
*
* @param args
* @throws IOException
*/
public
static
void
main
(
String
[]
args
)
throws
IOException
{
String
msg
=
"这是发送短信的内容!"
;
sendMsg
(
"15224553696"
,
msg
);
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数
* @return 所代表远程资源的响应结果
*/
private
static
String
sendPost
(
String
url
,
String
param
)
{
OutputStreamWriter
out
=
null
;
BufferedReader
in
=
null
;
StringBuilder
result
=
new
StringBuilder
();
try
{
URL
realUrl
=
new
URL
(
url
);
URLConnection
conn
=
realUrl
.
openConnection
();
conn
.
setRequestProperty
(
"accept"
,
"*/*"
);
conn
.
setRequestProperty
(
"contentType"
,
"utf-8"
);
conn
.
setRequestProperty
(
"connection"
,
"Keep-Alive"
);
conn
.
setRequestProperty
(
"user-agent"
,
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"
);
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
out
=
new
OutputStreamWriter
(
conn
.
getOutputStream
());
out
.
write
(
param
);
out
.
flush
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
"\n"
).
append
(
line
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
ex
)
{
ex
.
printStackTrace
();
}
}
return
result
.
toString
();
}
@Data
public
static
class
SendReq
{
/**
* 集团客户名称
*/
private
String
ecName
;
/**
* 用户名
*/
private
String
apId
;
/**
* 密码
*/
private
String
secretKey
;
/**
* 手机号码逗号分隔。(如“1813728****,1813728****,1813728****”)
*/
private
String
mobiles
;
/**
* 发送短信内容
*/
private
String
content
;
/**
* 网关签名编码,必填,签名编码在中国移动集团开通帐号后分配,可以在云MAS网页端管理子系统-SMS接口管理功能中下载。
*/
private
String
sign
;
/**
* 扩展码,根据向移动公司申请的通道填写,如果申请的精确匹配通道,则填写空字符串(""),否则添加移动公司允许的扩展码。
*/
private
String
addSerial
;
/**
* 按文档要求加密后的mac
*/
private
String
mac
;
}
@Data
public
static
class
SendRes
{
/**
* 响应状态码
*/
private
String
rspcod
;
/**
* 消息批次号,由云MAS平台生成,用于验证短信提交报告和状态报告的一致性(取值msgGroup)注:如果数据验证不通过msgGroup为空
*/
private
String
msgGroup
;
/**
* 数据校验结果
*/
private
Boolean
success
;
}
}
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