Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
8timerv2
8timerapiv200
Commits
0a58c443
Commit
0a58c443
authored
Apr 29, 2020
by
dengshichuan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dsc' into 'develop'
Dsc See merge request 8timerv2/8timerapiv200!60
parents
fce27486
b22105bf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
320 additions
and
97 deletions
+320
-97
pom.xml
+12
-0
src/main/java/cn/timer/api/controller/LoginController.java
+110
-74
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
+14
-19
src/main/java/cn/timer/api/controller/qyzx/QyzxBusinessController.java
+29
-3
src/main/java/cn/timer/api/utils/QRCode/LogoUtil.java
+68
-0
src/main/java/cn/timer/api/utils/QRCode/ZXingUtil.java
+83
-0
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+1
-1
src/main/resources/application-dev.yml
+1
-0
src/main/resources/application-pro.yml
+1
-0
src/main/resources/application-test.yml
+1
-0
No files found.
pom.xml
View file @
0a58c443
...
...
@@ -372,6 +372,18 @@
<artifactId>
UserAgentUtils
</artifactId>
<version>
1.2.4
</version>
</dependency>
<!-- Zxing-二维码 -->
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
core
</artifactId>
<version>
3.3.0
</version>
</dependency>
<dependency>
<groupId>
com.google.zxing
</groupId>
<artifactId>
javase
</artifactId>
<version>
3.3.0
</version>
</dependency>
</dependencies>
...
...
src/main/java/cn/timer/api/controller/LoginController.java
View file @
0a58c443
...
...
@@ -3,9 +3,12 @@ package cn.timer.api.controller;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Stream
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -58,58 +62,87 @@ public class LoginController {
@Value
(
"${config-8timer.register-free-time}"
)
public
Integer
offset
;
// 系统赠送时间
/*
* @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String PROJECT_NAME;
*
* @Value("${config-8timer.Aliyun.REGION_ID}") private String REGION_ID;
*
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String ACCESSKEY_ID;
*
* @Value("${config-8timer.Aliyun.SECRET}") private String SECRET;
*
* public static String host; public static String PROJECT_ID; public static
* String PROJECT_SECRET;
*
* @Value("${config-8timer.esign.host}") private String host_s;
*
* @Value("${config-8timer.esign.PROJECT_ID}") private String PROJECT_ID_s;
*
* @Value("${config-8timer.esign.PROJECT_SECRET}") private String
* PROJECT_SECRET_s;
*
* @PostConstruct public void init() { host = host_s; PROJECT_ID = PROJECT_ID_s;
* PROJECT_SECRET = PROJECT_SECRET_s; }
*
* @Value("${config-8timer.Aliyun.PROJECT_NAME}") private String endpoint;
*
* @Value("${config-8timer.Aliyun.ACCESSKEY_ID}") private String accessKeyId;
*
* @Value("${config-8timer.Aliyun.SECRET}") private String accessKeySecret;
*
* @Value("${config-8timer.Aliyun.bucketName}") private String bucketName;
*
* @Value("${config-8timer.Aliyun.bucketName_pri}") private String
* bucketName_pri;
*
* @Value("${config-8timer.Aliyun.project_package}") private String
* project_package;
*
* @Value("${config-8timer.Aliyun.expirationTime}") private String
* expirationTime;
*
* @Value("${config-8timer.Aliyun.expirationTime_pri}") private String
* expirationTime_pri;
*
* @GetMapping(value = "/test") public Map<String, Object> test() { Map<String,
* Object> map = new HashMap<String, Object>(); map.put("1", offset);
* map.put("2", PROJECT_NAME); map.put("3", REGION_ID); map.put("4",
* ACCESSKEY_ID); map.put("5", SECRET); map.put("6", host); map.put("7",
* PROJECT_ID); map.put("8", PROJECT_SECRET); map.put("9", endpoint);
* map.put("10", accessKeyId); map.put("11", accessKeySecret); map.put("12",
* bucketName); map.put("13", bucketName_pri); map.put("14", project_package);
* map.put("15", expirationTime); map.put("16", expirationTime_pri); return map;
* }
*/
@Value
(
"${config-8timer.register-company-max-num}"
)
public
Integer
max
;
@Value
(
"${config-8timer.Aliyun.PROJECT_NAME}"
)
private
String
PROJECT_NAME
;
@Value
(
"${config-8timer.Aliyun.REGION_ID}"
)
private
String
REGION_ID
;
@Value
(
"${config-8timer.Aliyun.ACCESSKEY_ID}"
)
private
String
ACCESSKEY_ID
;
@Value
(
"${config-8timer.Aliyun.SECRET}"
)
private
String
SECRET
;
public
static
String
host
;
public
static
String
PROJECT_ID
;
public
static
String
PROJECT_SECRET
;
@Value
(
"${config-8timer.esign.host}"
)
private
String
host_s
;
@Value
(
"${config-8timer.esign.PROJECT_ID}"
)
private
String
PROJECT_ID_s
;
@Value
(
"${config-8timer.esign.PROJECT_SECRET}"
)
private
String
PROJECT_SECRET_s
;
@PostConstruct
public
void
init
()
{
host
=
host_s
;
PROJECT_ID
=
PROJECT_ID_s
;
PROJECT_SECRET
=
PROJECT_SECRET_s
;
}
@Value
(
"${config-8timer.Aliyun.PROJECT_NAME}"
)
private
String
endpoint
;
@Value
(
"${config-8timer.Aliyun.ACCESSKEY_ID}"
)
private
String
accessKeyId
;
@Value
(
"${config-8timer.Aliyun.SECRET}"
)
private
String
accessKeySecret
;
@Value
(
"${config-8timer.Aliyun.bucketName}"
)
private
String
bucketName
;
@Value
(
"${config-8timer.Aliyun.bucketName_pri}"
)
private
String
bucketName_pri
;
@Value
(
"${config-8timer.Aliyun.project_package}"
)
private
String
project_package
;
@Value
(
"${config-8timer.Aliyun.expirationTime}"
)
private
String
expirationTime
;
@Value
(
"${config-8timer.Aliyun.expirationTime_pri}"
)
private
String
expirationTime_pri
;
@GetMapping
(
value
=
"/test"
)
public
Map
<
String
,
Object
>
test
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"1"
,
offset
);
map
.
put
(
"2"
,
PROJECT_NAME
);
map
.
put
(
"3"
,
REGION_ID
);
map
.
put
(
"4"
,
ACCESSKEY_ID
);
map
.
put
(
"5"
,
SECRET
);
map
.
put
(
"6"
,
host
);
map
.
put
(
"7"
,
PROJECT_ID
);
map
.
put
(
"8"
,
PROJECT_SECRET
);
map
.
put
(
"9"
,
endpoint
);
map
.
put
(
"10"
,
accessKeyId
);
map
.
put
(
"11"
,
accessKeySecret
);
map
.
put
(
"12"
,
bucketName
);
map
.
put
(
"13"
,
bucketName_pri
);
map
.
put
(
"14"
,
project_package
);
map
.
put
(
"15"
,
expirationTime
);
map
.
put
(
"16"
,
expirationTime_pri
);
map
.
put
(
"test1"
,
max
);
return
map
;
}
@Autowired
private
HttpSession
session
;
...
...
@@ -138,10 +171,14 @@ public class LoginController {
public
Result
<
String
>
sendCode
(
@RequestBody
EntRegisterDto
entRegisterDto
)
{
String
phone
=
entRegisterDto
.
getPhone
();
if
(
phone
==
null
||
StrUtil
.
hasBlank
(
phone
))
{
return
ResultUtil
.
error
(
"请输入手机号"
);
}
Integer
orgCode
=
null
;
if
(
entRegisterDto
.
getTc
()
!=
4
)
{
// 如果不是注册,则判断
orgCode
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
)).
getOrgId
();
QyzxEmpLogin
qyzxEmpLogin
=
QyzxEmpLogin
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpLogin
>().
eq
(
QyzxEmpLogin:
:
getPhone
,
phone
));
orgCode
=
qyzxEmpLogin
.
getOrgId
();
QyzxRemainingQuantity
quantity
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>()
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
orgCode
).
eq
(
QyzxRemainingQuantity:
:
getPmid
,
1
)
...
...
@@ -153,7 +190,7 @@ public class LoginController {
date
=
quantity
.
getExpireDate
();
}
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
if
(
remainder
==
null
||
remainder
<=
0
)
{
// 判断充了钱没
return
ResultUtil
.
error
(
"请充值后使用短信功能!"
);
}
if
(
date
!=
null
&&
date
.
getTime
()
<=
new
Date
().
getTime
())
{
...
...
@@ -409,17 +446,16 @@ public class LoginController {
* TransactionStatus status = transactionManager.getTransaction(def);
*/
try
{
String
username
=
entRegisterDto
.
getUsername
();
String
phone
=
entRegisterDto
.
getPhone
();
if
(
phone
==
null
||
phone
.
equals
(
""
)
&&
username
==
null
||
username
.
equals
(
""
))
{
return
ResultUtil
.
error
(
"请输入手机号和用户名!"
);
}
if
(
phone
==
null
||
phone
.
equals
(
""
))
phone
=
username
;
if
(
username
==
null
||
username
.
equals
(
""
))
username
=
phone
;
String
username
=
entRegisterDto
.
getUsername
();
String
name
=
entRegisterDto
.
getName
();
String
pw
=
entRegisterDto
.
getPw
();
if
((
phone
==
null
||
StrUtil
.
hasBlank
(
phone
))
||
(
username
==
null
||
StrUtil
.
hasBlank
(
username
))
||
(
name
==
null
||
StrUtil
.
hasBlank
(
name
))
||
(
pw
==
null
||
StrUtil
.
hasBlank
(
pw
)))
{
return
ResultUtil
.
error
(
"用户信息不能为空"
);
}
QyzxEmpLogin
login
=
new
LambdaQueryChainWrapper
<
QyzxEmpLogin
>(
qyzxEmpLoginMapper
)
.
eq
(!
StrUtil
.
hasBlank
(
phone
),
QyzxEmpLogin:
:
getPhone
,
phone
).
one
();
if
(
login
!=
null
)
{
...
...
@@ -427,7 +463,7 @@ public class LoginController {
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
login
.
getId
())
.
eq
(
QyzxEmpEntAsso:
:
getUserType
,
CommonEnum
.
U_TYPE_ADMIN
.
getType
()).
count
();
if
(
count
>
0
)
{
if
(
count
>
max
)
{
return
ResultUtil
.
error
(
"已注册过企业"
);
}
}
...
...
@@ -458,18 +494,17 @@ public class LoginController {
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败2"
);
}
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyzxEntInfoM
.
getId
()).
empNum
(
qyzxEmpLogin
.
getId
())
.
name
(
username
).
build
().
insert
();
if
(!
b4
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败3"
);
}
}
boolean
b4
=
YgglMainEmp
.
builder
().
orgCode
(
qyzxEntInfoM
.
getId
()).
empNum
(
login
.
getId
())
.
name
(
username
).
build
().
insert
();
if
(!
b4
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
ResultUtil
.
error
(
"注册企业失败3"
);
}
// 员工企业关联表
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
empNum
(
login
.
getId
()).
orgCode
(
qyzxEntInfoM
.
getId
())
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
empNum
(
login
.
getId
()).
orgCode
(
qyzxEntInfoM
.
getId
())
.
status
(
1
)
.
userType
(
CommonEnum
.
U_TYPE_ADMIN
.
getType
()).
build
();
boolean
b3
=
qyzxEmpEntAsso
.
insert
();
if
(!
b3
)
{
...
...
@@ -523,7 +558,8 @@ public class LoginController {
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
List
<
QysDto
>
qys
=
qyzxEmpLoginMapper
.
getQys
(
qyzxEmpLogin1
.
getId
());
List
<
QysDto
>
qys
=
qyzxEmpLoginMapper
.
getQys
(
qyzxEmpLogin1
.
getId
()
);
if
(
qys
.
size
()
==
0
)
return
ResultUtil
.
error
(
"没有任何公司可以查看!"
);
qyzxEmpLogin1
.
setQys
(
qys
);
...
...
src/main/java/cn/timer/api/controller/qyxx/CmsController.java
View file @
0a58c443
...
...
@@ -134,9 +134,8 @@ public class CmsController {
@ApiOperation
(
value
=
"分类内容获取"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getType
(
@CurrentUser
UserBean
userBean
)
{
// 分类模块信息
List
<
CmsContentModular
>
list
=
CmsContentModular
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CmsContentModular
>()
.
eq
(
"is_open"
,
0
)
//是否开启
List
<
CmsContentModular
>
list
=
CmsContentModular
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CmsContentModular
>().
eq
(
"is_open"
,
0
)
// 是否开启
// .eq("organization_id", userBean.getOrgCode())
);
List
<
List
<
CmsContent
>>
o
=
new
ArrayList
<
List
<
CmsContent
>>();
...
...
@@ -160,11 +159,9 @@ public class CmsController {
@GetMapping
(
value
=
"/xxfl"
)
@ApiOperation
(
value
=
"获取分类"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getxxfl
(
@CurrentUser
UserBean
userBean
)
{
return
ResultUtil
.
data
(
CmsContentModular
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CmsContentModular
>()
return
ResultUtil
.
data
(
CmsContentModular
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CmsContentModular
>()
// .eq("organization_id", userBean.getOrgCode())
.
eq
(
"is_open"
,
0
)),
"查询分类成功!"
);
.
eq
(
"is_open"
,
0
)),
"查询分类成功!"
);
}
/**
...
...
@@ -298,16 +295,13 @@ public class CmsController {
qyxxQueryDto
.
getTotalPage
()
==
null
?
10
:
qyxxQueryDto
.
getTotalPage
());
QueryWrapper
<
CmsContent
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"organization_id"
,
userBean
.
getOrgCode
())
.
eq
(
"status"
,
1
).
eq
(
t
!=
null
&&
t
>
-
1
,
"modularid"
,
t
)
.
eq
(
r
!=
null
&&
r
>
-
1
,
"releasestate"
,
r
)
.
between
(!
StrUtil
.
hasBlank
(
s
)
&&
!
StrUtil
.
hasBlank
(
e
),
"releasetime"
,
queryWrapper
.
eq
(
"organization_id"
,
userBean
.
getOrgCode
()).
eq
(
"status"
,
1
)
.
eq
(
t
!=
null
&&
t
>
-
1
,
"modularid"
,
t
).
eq
(
r
!=
null
&&
r
>
-
1
,
"releasestate"
,
r
)
.
between
(!
StrUtil
.
hasBlank
(
s
)
&&
!
StrUtil
.
hasBlank
(
e
),
"releasetime"
,
!
StrUtil
.
hasBlank
(
s
)
?
s
:
"1000-01-01 00:00:00"
,
!
StrUtil
.
hasBlank
(
e
)
?
e
:
"9999-01-01 00:00:00"
)
.
and
(!
StrUtil
.
hasBlank
(
q
),
wq
->
wq
.
like
(
"userid"
,
q
)
.
or
().
like
(
"author"
,
q
).
or
().
like
(
"title"
,
q
))
.
orderByDesc
(
"addeddate"
);
.
and
(!
StrUtil
.
hasBlank
(
q
),
wq
->
wq
.
like
(
"userid"
,
q
).
or
().
like
(
"author"
,
q
).
or
().
like
(
"title"
,
q
))
.
orderByDesc
(
"addeddate"
);
IPage
<
CmsContent
>
cmsContentPage
=
CmsContent
.
builder
().
build
().
selectPage
(
page
,
queryWrapper
);
List
<
CmsContent
>
cmsContents
=
cmsContentPage
.
getRecords
();
cmsContentPage
.
getCurrent
();
...
...
@@ -355,8 +349,7 @@ public class CmsController {
qyxxQueryDto
.
getTotalPage
()
==
null
?
10
:
qyxxQueryDto
.
getTotalPage
());
// 查询条件
QueryWrapper
<
CmsContent
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"organization_id"
,
userBean
.
getOrgCode
())
queryWrapper
.
eq
(
"organization_id"
,
userBean
.
getOrgCode
())
.
select
(
"id"
,
"auditopinion"
,
"modularid"
,
"status"
,
"title"
,
"releasetime"
,
"addeddate"
,
"author"
,
"summary"
,
"releasetype"
,
"fmtpath"
)
.
ne
(
"status"
,
1
).
eq
(
t
!=
null
&&
t
>
-
1
,
"modularid"
,
t
)
...
...
@@ -492,6 +485,7 @@ public class CmsController {
qyxxQueryDto
.
getCurrentPage
()
==
null
?
1
:
qyxxQueryDto
.
getCurrentPage
(),
qyxxQueryDto
.
getTotalPage
()
==
null
?
10
:
qyxxQueryDto
.
getTotalPage
());
QueryWrapper
<
CmsAnnouncement
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"org_code"
,
userBean
.
getOrgCode
());
queryWrapper
.
between
(!
StrUtil
.
hasBlank
(
s
)
&&
!
StrUtil
.
hasBlank
(
e
),
"fbtime"
,
!
StrUtil
.
hasBlank
(
s
)
?
s
:
"1000-01-01 00:00:00"
,
!
StrUtil
.
hasBlank
(
e
)
?
e
:
"9999-01-01 00:00:00"
)
.
and
(!
StrUtil
.
hasBlank
(
q
),
wq
->
wq
.
like
(
"title"
,
q
).
or
().
like
(
"fbnr"
,
q
)).
orderByDesc
(
"fbtime"
);
...
...
@@ -509,10 +503,11 @@ public class CmsController {
* 查询默认轮播信息
*/
@GetMapping
(
value
=
"/defaultCarousel"
)
@ApiOperation
(
value
=
"查询轮播信息"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"查询轮播信息
(默认)
"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
defaultCarousel
(
@CurrentUser
UserBean
userBean
)
{
return
ResultUtil
.
data
(
CmsAnnouncement
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
CmsAnnouncement
>().
eq
(
"is_default"
,
1
)),
CmsAnnouncement
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
CmsAnnouncement
>().
eq
(
"is_default"
,
1
).
eq
(
"org_code"
,
userBean
.
getOrgCode
())),
"查询成功"
);
}
...
...
src/main/java/cn/timer/api/controller/qyzx/QyzxBusinessController.java
View file @
0a58c443
...
...
@@ -8,6 +8,7 @@
package
cn
.
timer
.
api
.
controller
.
qyzx
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -29,9 +30,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.timer.api.bean.qyzx.QyzxEntInfoM
;
import
cn.timer.api.bean.qyzx.businessService.QyzxBuyRecord
;
import
cn.timer.api.bean.qyzx.businessService.QyzxInvoiceData
;
import
cn.timer.api.bean.qyzx.businessService.QyzxOrderRecord
;
...
...
@@ -74,7 +78,7 @@ public class QyzxBusinessController {
@GetMapping
(
value
=
"/getQuantity"
)
@ApiOperation
(
value
=
"获取套餐余量信息(数量)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
Map
<
String
,
Object
>>>
getQuantity
(
@CurrentUser
UserBean
userBean
)
{
public
Result
<
List
<
Map
<
String
,
Integer
>>>
getQuantity
(
@CurrentUser
UserBean
userBean
)
{
List
<
QyzxRemainingQuantity
>
qyzxRemainingQuantitys1
=
QyzxRemainingQuantity
.
builder
().
build
()
.
selectList
(
new
LambdaQueryWrapper
<
QyzxRemainingQuantity
>().
eq
(
QyzxRemainingQuantity:
:
getIsDelete
,
0
)
.
eq
(
QyzxRemainingQuantity:
:
getOrgCode
,
userBean
.
getOrgCode
())
...
...
@@ -89,16 +93,38 @@ public class QyzxBusinessController {
Integer
sum2
=
qyzxRemainingQuantitys2
.
stream
()
.
collect
(
Collectors
.
summingInt
(
QyzxRemainingQuantity:
:
getRemainder
));
Map
<
String
,
Object
>
map1
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Integer
>
map1
=
new
HashMap
<
String
,
Integer
>();
map1
.
put
(
"message"
,
sum1
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Integer
>
map2
=
new
HashMap
<
String
,
Integer
>();
map2
.
put
(
"contract"
,
sum2
);
List
<
Map
<
String
,
Integer
>>
list
=
new
ArrayList
<
Map
<
String
,
Integer
>>();
list
.
add
(
map1
);
list
.
add
(
map2
);
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
@GetMapping
(
value
=
"/getQuantity/System"
)
@ApiOperation
(
value
=
"获取系统剩余天数、版本"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getSystemQuantity
(
@CurrentUser
UserBean
userBean
)
{
QyzxEntInfoM
qyzxEntInfoM
=
QyzxEntInfoM
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEntInfoM
>().
eq
(
QyzxEntInfoM:
:
getId
,
userBean
.
getOrgCode
()));
Date
endTime
=
qyzxEntInfoM
.
getEndTime
();
Long
day
=
DateUtil
.
between
(
new
Date
(),
endTime
,
DateUnit
.
DAY
,
false
);
Integer
level
=
qyzxEntInfoM
.
getLevel
();
Map
<
String
,
Object
>
map1
=
new
HashMap
<
String
,
Object
>();
map1
.
put
(
"betweenDay"
,
day
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<
String
,
Object
>();
map2
.
put
(
"level"
,
level
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<
Map
<
String
,
Object
>>();
list
.
add
(
map1
);
list
.
add
(
map2
);
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
@GetMapping
(
value
=
"/getPayList/Contract"
)
...
...
src/main/java/cn/timer/api/utils/QRCode/LogoUtil.java
0 → 100644
View file @
0a58c443
/**
* <p>Title: LogoUtil.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
package
cn
.
timer
.
api
.
utils
.
QRCode
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.geom.RoundRectangle2D
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.IOException
;
/**
* <p>
* Title: LogoUtil.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
public
class
LogoUtil
{
// 传入logo、二维码 ->带logo的二维码
public
static
BufferedImage
logoMatrix
(
BufferedImage
matrixImage
,
String
logo
)
throws
IOException
{
// 在二维码上画logo:产生一个 二维码画板
Graphics2D
g2
=
matrixImage
.
createGraphics
();
// 画logo: String->BufferedImage(内存)
BufferedImage
logoImg
=
ImageIO
.
read
(
new
File
(
logo
));
int
height
=
matrixImage
.
getHeight
();
int
width
=
matrixImage
.
getWidth
();
// 纯logo图片
g2
.
drawImage
(
logoImg
,
width
*
2
/
5
,
height
*
2
/
5
,
width
*
1
/
5
,
height
*
1
/
5
,
null
);
// 产生一个 画 白色圆角正方形的 画笔
BasicStroke
stroke
=
new
BasicStroke
(
5
,
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_ROUND
);
// 将画板-画笔 关联
g2
.
setStroke
(
stroke
);
// 创建一个正方形
RoundRectangle2D
.
Float
round
=
new
RoundRectangle2D
.
Float
(
width
*
2
/
5
,
height
*
2
/
5
,
width
*
1
/
5
,
height
*
1
/
5
,
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_ROUND
);
g2
.
setColor
(
Color
.
WHITE
);
g2
.
draw
(
round
);
// 灰色边框
BasicStroke
stroke2
=
new
BasicStroke
(
1
,
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_ROUND
);
g2
.
setStroke
(
stroke2
);
// 创建一个正方形
RoundRectangle2D
.
Float
round2
=
new
RoundRectangle2D
.
Float
(
width
*
2
/
5
+
2
,
height
*
2
/
5
+
2
,
width
*
1
/
5
-
4
,
height
*
1
/
5
-
4
,
BasicStroke
.
CAP_ROUND
,
BasicStroke
.
JOIN_ROUND
);
// Color color = new Color(128,128,128) ;
g2
.
setColor
(
Color
.
GRAY
);
g2
.
draw
(
round2
);
g2
.
dispose
();
matrixImage
.
flush
();
return
matrixImage
;
}
}
src/main/java/cn/timer/api/utils/QRCode/ZXingUtil.java
0 → 100644
View file @
0a58c443
/**
* <p>Title: QRCodeUtil.java</p>
* <p>Description: </p>
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
package
cn
.
timer
.
api
.
utils
.
QRCode
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.util.Hashtable
;
import
javax.imageio.ImageIO
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
;;
/**
* <p>
* Title: QRCodeUtil.java
* </p>
* <p>
* Description:
* </p>
*
* @author dsc
* @date 2020年4月28日
* @version 1.0
*/
public
class
ZXingUtil
{
/**
* @param imgPath 保存路径
* @param format 图片格式
* @param content 保存内容
* @param width 宽
* @param height 高
* @param logo logo图片路径
* @throws Exception
*/
public
static
void
encodeImg
(
String
imgPath
,
String
format
,
String
content
,
int
width
,
int
height
,
String
logo
)
throws
Exception
{
Hashtable
<
EncodeHintType
,
Object
>
hints
=
new
Hashtable
<
EncodeHintType
,
Object
>();
// 排错率 L<M<Q<H
hints
.
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
H
);
// 编码
hints
.
put
(
EncodeHintType
.
CHARACTER_SET
,
"utf-8"
);
// 外边距:margin
hints
.
put
(
EncodeHintType
.
MARGIN
,
1
);
/*
* content : 需要加密的 文字 BarcodeFormat.QR_CODE:要解析的类型(二维码) hints:加密涉及的一些参数:编码、排错率
*/
BitMatrix
bitMatrix
=
new
MultiFormatWriter
().
encode
(
content
,
BarcodeFormat
.
QR_CODE
,
width
,
height
,
hints
);
// 内存中的一张图片:此时需要的图片 是二维码-> 需要一个boolean[][] ->BitMatrix
BufferedImage
image
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
image
.
setRGB
(
x
,
y
,
(
bitMatrix
.
get
(
x
,
y
)
?
0
:
16777215
));
// TODO
}
}
// 画logo
image
=
LogoUtil
.
logoMatrix
(
image
,
logo
);
// string->file
File
file
=
new
File
(
imgPath
);
// 生成图片
ImageIO
.
write
(
image
,
format
,
file
);
}
/*
* public static void main(String[] args) { String imgPath =
* "C:\\Users\\Lenovo\\Desktop\\8timer.png"; String content = "8timer.cn";
* String logo = "C:\\Users\\Lenovo\\Pictures\\Saved Pictures\\生气.jpg"; //
* 加密:文字信息->二维码 try { ZXingUtil.encodeImg(imgPath, "png", content, 430, 430,
* logo); } catch (Exception e) { e.printStackTrace(); } }
*/
}
\ No newline at end of file
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
0a58c443
...
...
@@ -86,7 +86,7 @@ public class AliyunSMS {
Date
date
=
quantity
.
getExpireDate
();
orderNo
=
quantity
.
getOrderNo
();
if
(
quantity
==
null
||
remainder
==
null
||
remainder
<=
0
)
{
if
(
remainder
==
null
||
remainder
<=
0
)
{
System
.
err
.
println
(
"企业 "
+
orgCode
+
" :套餐余额不足,请充钱"
);
return
null
;
}
...
...
src/main/resources/application-dev.yml
View file @
0a58c443
...
...
@@ -151,6 +151,7 @@ logging:
config-8timer
:
register-free-time
:
90
#系统赠送时间
register-company-max-num
:
100
Aliyun
:
# 阿里云
PROJECT_NAME
:
8小时人事管家
REGION_ID
:
cn-shenzhen
...
...
src/main/resources/application-pro.yml
View file @
0a58c443
...
...
@@ -127,6 +127,7 @@ logging:
config-8timer
:
register-free-time
:
90
#系统赠送时间
register-company-max-num
:
100
Aliyun
:
# 阿里云
PROJECT_NAME
:
8小时人事管家
REGION_ID
:
cn-shenzhen
...
...
src/main/resources/application-test.yml
View file @
0a58c443
...
...
@@ -127,6 +127,7 @@ logging:
config-8timer
:
register-free-time
:
90
#系统赠送时间
register-company-max-num
:
100
Aliyun
:
# 阿里云
PROJECT_NAME
:
8小时人事管家
REGION_ID
:
cn-shenzhen
...
...
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