Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
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
吴学德
gdtel-gztel-school-center
Commits
0a2fb603
Commit
0a2fb603
authored
Feb 14, 2022
by
伍思炜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
85f20b69
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
186 deletions
+10
-186
common/pom.xml
+4
-4
common/src/main/java/com/winsun/utils/AccLoginUtil.java
+0
-176
service-manager/src/main/java/com/winsun/controller/OrderController.java
+5
-5
task/src/main/java/com/winsun/TimingTask/OrderTask.java
+1
-1
No files found.
common/pom.xml
View file @
0a2fb603
...
...
@@ -125,10 +125,10 @@
<artifactId>
unirest-java
</artifactId>
<version>
3.13.6
</version>
</dependency>
<dependency
>
<groupId>
com.winsun.framework
</groupId
>
<artifactId>
winsun-core-service
</artifactId
>
</dependency
>
<!-- <dependency>--
>
<!-- <groupId>com.winsun.framework</groupId>--
>
<!-- <artifactId>winsun-core-service</artifactId>--
>
<!-- </dependency>--
>
<!-- <dependency>-->
<!-- <groupId>com.github.ulisesbocchio</groupId>-->
<!-- <artifactId>jasypt-spring-boot-starter</artifactId>-->
...
...
common/src/main/java/com/winsun/utils/AccLoginUtil.java
deleted
100644 → 0
View file @
85f20b69
package
com
.
winsun
.
utils
;
import
java.io.Serializable
;
import
java.util.HashMap
;
import
java.util.Queue
;
import
java.util.concurrent.TimeUnit
;
import
com.winsun.auth.core.base.tips.ErrorTip
;
import
com.winsun.auth.core.shiro.ShiroUser
;
import
com.winsun.auth.model.user.User
;
import
com.winsun.item.core.shiro.ShiroKit
;
import
org.apache.commons.collections4.map.PassiveExpiringMap
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.session.Session
;
import
org.apache.shiro.subject.Subject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
com.winsun.item.core.common.constant.cache.RedisCacheKey
;
import
com.winsun.item.core.common.exception.PasswordErrorException
;
import
com.winsun.item.core.log.LogManager
;
import
com.winsun.item.core.log.factory.LogTaskFactory
;
import
com.winsun.item.core.shiro.CustomToken
;
import
static
com
.
winsun
.
auth
.
core
.
support
.
HttpKit
.
getIp
;
public
class
AccLoginUtil
{
private
static
final
int
MAX_SESSION_SIZE
=
5
;
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
AccLoginUtil
.
class
);
public
static
String
msg
=
"账号或密码或验证码错误,若重复多次错误请联系管理员。"
;
/**
* 普通登录
* @param subStaffId
* @param staffPwd
* @param user
* @return
* @throws Exception
*/
public
static
Object
normalLogin
(
String
subStaffId
,
String
staffPwd
,
User
user
,
String
ipAddr
,
RedisTemplate
<
String
,
Object
>
redisTemplate
,
String
exprie
){
try
{
Integer
ipValue
=
(
Integer
)
redisTemplate
.
opsForValue
().
get
(
RedisCacheKey
.
PASSWORD_ERROR_KEY
+
subStaffId
);
if
(
ipValue
!=
null
&&
ipValue
>=
4
)
{
throw
new
PasswordErrorException
();
}
if
(!
user
.
getPassword
().
equals
(
ShiroKit
.
md5
(
staffPwd
,
user
.
getSalt
())))
{
Long
ipProhibition
=
ipProhibition
(
subStaffId
,
redisTemplate
,
exprie
);
//return new ErrorTip(500, "账号密码错误"+ ipProhibition +"次!连续输入错误5次,将被冻结!");
return
new
ErrorTip
(
500
,
msg
);
}
CustomToken
adminPasswordToken
=
new
CustomToken
(
subStaffId
,
staffPwd
);
return
subjectLogin
(
adminPasswordToken
,
ipAddr
);
}
catch
(
PasswordErrorException
e
)
{
//return new ErrorTip(500, "账号密码连续输入错误5次,已被冻结!");
return
new
ErrorTip
(
500
,
msg
);
}
catch
(
Exception
e
)
{
//return new ErrorTip(500, e.getMessage());
return
new
ErrorTip
(
500
,
msg
);
}
}
/**
* 登录操作
* @param token
* @return
* @throws Exception
*/
public
static
HashMap
<
String
,
Object
>
subjectLogin
(
CustomToken
token
,
String
ipAddr
)
throws
Exception
{
Subject
currentUser
=
ShiroKit
.
getSubject
();
currentUser
.
login
(
token
);
Serializable
sessionId
=
ShiroKit
.
getSession
().
getId
();
ShiroUser
shiroUser
=
ShiroKit
.
getUser
();
if
(
StringUtils
.
isNoneBlank
(
ipAddr
))
{
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
loginLog
(
shiroUser
.
getId
(),
ipAddr
));
}
else
{
LogManager
.
me
().
executeLog
(
LogTaskFactory
.
loginLog
(
shiroUser
.
getId
(),
getIp
()));
}
//LogManager.me().executeLog(LogTaskFactory.loginLog(shiroUser.getId(), getIp()));
ShiroKit
.
getSession
().
setAttribute
(
"sessionFlag"
,
true
);
HashMap
<
String
,
Object
>
result
=
new
HashMap
<>();
/*
String account = shiroUser.getAccount();
Queue<Session> queue = sessionMapQueue.get(account);
if (queue == null) {
queue = new LinkedList<>();
queue.offer(ShiroKit.getSession());
sessionMapQueue.put(account,queue);
} else {
if (queue.size() == MAX_SESSION_SIZE) {
Session pollSession = queue.poll();
pollSession.setTimeout(1);
}
queue.offer(ShiroKit.getSession());
}
*/
result
.
put
(
"sessionId"
,
sessionId
.
toString
());
result
.
put
(
"currentUser"
,
shiroUser
.
getName
());
result
.
put
(
"phone"
,
shiroUser
.
getPhone
());
result
.
put
(
"account"
,
shiroUser
.
getAccount
());
result
.
put
(
"dept"
,
shiroUser
.
getDeptName
());
result
.
put
(
"deptId"
,
shiroUser
.
getDeptId
());
result
.
put
(
"substName"
,
shiroUser
.
getSubstName
());
result
.
put
(
"role"
,
shiroUser
.
getRoleNames
());
result
.
put
(
"subType"
,
shiroUser
.
getSubTypeList
());
result
.
put
(
"salestaffId"
,
shiroUser
.
getSalestaffId
());
if
(
shiroUser
.
getXfyfJson
()
!=
null
)
{
result
.
put
(
"xfyf"
,
shiroUser
.
getXfyfJson
());
}
if
(
shiroUser
.
getYfpqJson
()
!=
null
)
{
result
.
put
(
"yfpq"
,
shiroUser
.
getYfpqJson
());
}
if
(
shiroUser
.
getOperatorsList
()!=
null
&&
shiroUser
.
getOperatorsList
().
size
()!=
0
)
{
result
.
put
(
"operators"
,
shiroUser
.
getOperatorsList
());
}
result
.
put
(
"code"
,
200
);
result
.
put
(
"message"
,
"登陆成功!"
);
return
result
;
}
public
static
Long
ipProhibition
(
String
account
,
RedisTemplate
<
String
,
Object
>
redisTemplate
,
String
exprie
)
throws
PasswordErrorException
,
Exception
{
synchronized
(
account
)
{
Integer
ipValue
=
(
Integer
)
redisTemplate
.
opsForValue
().
get
(
RedisCacheKey
.
PASSWORD_ERROR_KEY
+
account
);
if
(
ipValue
==
null
)
{
redisTemplate
.
opsForValue
().
set
(
RedisCacheKey
.
PASSWORD_ERROR_KEY
+
account
,
1
,
Long
.
valueOf
(
exprie
),
TimeUnit
.
SECONDS
);
return
(
long
)
1
;
}
else
{
Long
increment
=
redisTemplate
.
opsForValue
().
increment
(
RedisCacheKey
.
PASSWORD_ERROR_KEY
+
account
,
1
);
if
(
ipValue
.
intValue
()
>=
5
)
{
throw
new
PasswordErrorException
();
}
return
increment
;
}
}
}
public
static
Long
imageProhibition
(
String
account
,
RedisTemplate
<
String
,
Object
>
redisTemplate
)
throws
PasswordErrorException
,
Exception
{
synchronized
(
account
)
{
Integer
ipValue
=
(
Integer
)
redisTemplate
.
opsForValue
().
get
(
RedisCacheKey
.
VALID_IMAGE_ERROR_KEY
+
account
);
if
(
ipValue
==
null
)
{
redisTemplate
.
opsForValue
().
set
(
RedisCacheKey
.
VALID_IMAGE_ERROR_KEY
+
account
,
1
,
Long
.
valueOf
(
60
),
TimeUnit
.
SECONDS
);
return
(
long
)
1
;
}
else
{
Long
increment
=
redisTemplate
.
opsForValue
().
increment
(
RedisCacheKey
.
VALID_IMAGE_ERROR_KEY
+
account
,
1
);
if
(
ipValue
.
intValue
()
>=
3
)
{
throw
new
PasswordErrorException
();
}
return
increment
;
}
}
}
}
service-manager/src/main/java/com/winsun/controller/OrderController.java
View file @
0a2fb603
...
...
@@ -308,14 +308,14 @@ public class OrderController extends BaseController {
map1
.
put
(
"idCardUrl3"
,
order
.
getIdCardzs
().
replace
(
"manager"
,
"app"
));
map1
.
put
(
"cardType"
,
order
.
getKapin
());
if
(
order
.
getPackageId
().
equals
(
"49"
))
{
//
map1.put("userName", order.getParentName());
if
(
"49"
.
equals
(
order
.
getPackageId
()
))
{
map1
.
put
(
"userName"
,
order
.
getParentName
());
map1
.
put
(
"idCardUrl4"
,
order
.
getIdCardzs
().
replace
(
"manager"
,
"app"
));
map1
.
put
(
"idCardUrl4"
,
order
.
getIdCardzs
());
//
map1.put("idCardUrl4", order.getIdCardzs());
}
else
{
//
map1.put("userName", order.getCustomerName());
map1
.
put
(
"userName"
,
order
.
getCustomerName
());
map1
.
put
(
"idCardUrl4"
,
order
.
getStudenCard
().
replace
(
"manager"
,
"app"
));
map1
.
put
(
"idCardUrl4"
,
order
.
getStudenCard
());
//
map1.put("idCardUrl4", order.getStudenCard());
}
map1
.
put
(
"linkPhone"
,
order
.
getContactNumber
());
map1
.
put
(
"idCard"
,
order
.
getIdCard
());
...
...
task/src/main/java/com/winsun/TimingTask/OrderTask.java
View file @
0a2fb603
...
...
@@ -140,7 +140,7 @@ public class OrderTask {
log
.
info
(
"更新预制卡状态完成"
);
}
@Scheduled
(
cron
=
"0 0/4 * * * ?"
)
//
@Scheduled(cron = "0 0/4 * * * ?")
public
void
updateMobileCardStatus2
()
{
log
.
info
(
"更新预制卡状态开始"
);
// 有卡品id,并且未审核中的状态
...
...
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