Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
e024d474
Commit
e024d474
authored
Mar 09, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/MVP1.5.2' into MVP1.5.2
parents
770e03f4
a94cd822
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
481 additions
and
53 deletions
+481
-53
pom.xml
yifu-auth/pom.xml
+5
-0
CASAutoConfig.java
...om/yifu/cloud/plus/v1/yifu/auth/config/CASAutoConfig.java
+150
-0
CASproperties.java
...om/yifu/cloud/plus/v1/yifu/auth/config/CASproperties.java
+28
-0
AuthController.java
...fu/cloud/plus/v1/yifu/auth/controller/AuthController.java
+55
-0
SimpleUrlPatternMatcherStrategy.java
.../v1/yifu/auth/filter/SimpleUrlPatternMatcherStrategy.java
+50
-0
LoginUtils.java
...ava/com/yifu/cloud/plus/v1/yifu/auth/util/LoginUtils.java
+100
-0
ResultConstants.java
...ud/plus/v1/yifu/common/core/constant/ResultConstants.java
+1
-1
TDispatchInfoController.java
...us/v1/yifu/social/controller/TDispatchInfoController.java
+12
-2
TPaymentInfoController.java
...lus/v1/yifu/social/controller/TPaymentInfoController.java
+15
-3
TPreDispatchInfoController.java
...v1/yifu/social/controller/TPreDispatchInfoController.java
+30
-26
TPaymentInfoServiceImpl.java
.../v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
+35
-21
No files found.
yifu-auth/pom.xml
View file @
e024d474
...
@@ -75,6 +75,11 @@
...
@@ -75,6 +75,11 @@
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-log
</artifactId>
<artifactId>
yifu-common-log
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.jasig.cas.client
</groupId>
<artifactId>
cas-client-core
</artifactId>
<version>
3.6.4
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/config/CASAutoConfig.java
0 → 100644
View file @
e024d474
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
config
;
import
org.jasig.cas.client.authentication.AuthenticationFilter
;
import
org.jasig.cas.client.session.SingleSignOutFilter
;
import
org.jasig.cas.client.session.SingleSignOutHttpSessionListener
;
import
org.jasig.cas.client.util.HttpServletRequestWrapperFilter
;
import
org.jasig.cas.client.validation.Cas30ProxyReceivingTicketValidationFilter
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.ServletListenerRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
@Configuration
@Component
public
class
CASAutoConfig
{
/**
* SingleSignOutHttpSessionListener 添加监听器
* 用于单点退出,该过滤器用于实现单点登出功能,可选配置
*
* @author licancan
* @param
* @return {@link ServletListenerRegistrationBean<EventListener>}
*/
@Bean
public
ServletListenerRegistrationBean
<
EventListener
>
singleSignOutListenerRegistration
()
{
ServletListenerRegistrationBean
<
EventListener
>
registrationBean
=
new
ServletListenerRegistrationBean
<
EventListener
>();
registrationBean
.
setListener
(
new
SingleSignOutHttpSessionListener
());
registrationBean
.
setOrder
(
1
);
return
registrationBean
;
}
/**
* SingleSignOutFilter 登出过滤器
* 该过滤器用于实现单点登出功能,可选配置
*
* @author licancan
* @param
* @return {@link FilterRegistrationBean}
*/
@Bean
public
FilterRegistrationBean
filterSingleRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
registration
.
setFilter
(
new
SingleSignOutFilter
());
// 设定匹配的路径
registration
.
addUrlPatterns
(
"/*"
);
Map
<
String
,
String
>
initParameters
=
new
HashMap
();
initParameters
.
put
(
"casServerUrlPrefix"
,
CASproperties
.
CAS_SERVER_LOGIN_PATH
);
registration
.
setInitParameters
(
initParameters
);
// 设定加载的顺序
registration
.
setOrder
(
2
);
return
registration
;
}
/**
* AuthenticationFilter 授权过滤器
*
* @author licancan
* @param
* @return {@link FilterRegistrationBean}
*/
@Bean
public
FilterRegistrationBean
filterAuthenticationRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
Map
<
String
,
String
>
initParameters
=
new
HashMap
();
registration
.
setFilter
(
new
AuthenticationFilter
());
//registration.addUrlPatterns("*.html");
initParameters
.
put
(
"casServerLoginUrl"
,
CASproperties
.
CAS_SERVER_PATH
);
initParameters
.
put
(
"serverName"
,
CASproperties
.
CLIENT_SERVER_NAME
);
// 不拦截的请求
initParameters
.
put
(
"ignorePattern"
,
"^.*[.](js|css|gif|png|zip)$"
);
// 表示过滤所有
initParameters
.
put
(
"ignoreUrlPatternType"
,
"com.yifu.cloud.plus.v1.yifu.auth.filter.SimpleUrlPatternMatcherStrategy"
);
registration
.
setInitParameters
(
initParameters
);
// 设定加载的顺序
registration
.
setOrder
(
3
);
return
registration
;
}
/**
* Cas30ProxyReceivingTicketValidationFilter 验证过滤器
* 该过滤器负责对Ticket的校验工作,必须启用它
*
* @author licancan
* @param
* @return {@link FilterRegistrationBean}
*/
@Bean
public
FilterRegistrationBean
filterValidationRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
registration
.
setFilter
(
new
Cas30ProxyReceivingTicketValidationFilter
());
// 设定匹配的路径
//registration.addUrlPatterns("*.html");
Map
<
String
,
String
>
initParameters
=
new
HashMap
();
initParameters
.
put
(
"casServerUrlPrefix"
,
CASproperties
.
CAS_SERVER_PATH
);
initParameters
.
put
(
"serverName"
,
CASproperties
.
CLIENT_SERVER_NAME
);
// 是否对serviceUrl进行编码,默认true:设置false可以在302对URL跳转时取消显示;jsessionid=xxx的字符串
// 观察CommonUtils.constructServiceUrl方法可以看到
//initParameters.put("encodeServiceUrl", "false");
registration
.
setInitParameters
(
initParameters
);
// 设定加载的顺序
registration
.
setOrder
(
4
);
return
registration
;
}
/**
* 该过滤器用于单点登录功能 ,对HttpServletRequest请求包装, 可通过HttpServletRequest的getRemoteUser()方法获得登录用户的登录名
* @return
*/
@Bean
public
FilterRegistrationBean
casHttpServletRequestWrapperFilter
(){
FilterRegistrationBean
authenticationFilter
=
new
FilterRegistrationBean
();
authenticationFilter
.
setFilter
(
new
HttpServletRequestWrapperFilter
());
authenticationFilter
.
setOrder
(
5
);
List
<
String
>
urlPatterns
=
new
ArrayList
<>();
urlPatterns
.
add
(
"/*"
);
authenticationFilter
.
setUrlPatterns
(
urlPatterns
);
return
authenticationFilter
;
}
/**
* HttpServletRequestWrapperFilter wraper过滤器
* 该过滤器负责实现HttpServletRequest请求的包裹,
* 比如允许开发者通过HttpServletRequest的getRemoteUser()方法获得SSO登录用户的登录名,可选配置。
*
* @author licancan
* @param
* @return {@link FilterRegistrationBean}
*/
@Bean
public
FilterRegistrationBean
filterWrapperRegistration
()
{
FilterRegistrationBean
registration
=
new
FilterRegistrationBean
();
registration
.
setFilter
(
new
HttpServletRequestWrapperFilter
());
// 设定匹配的路径
registration
.
addUrlPatterns
(
"/*"
);
// 设定加载的顺序
registration
.
setOrder
(
6
);
return
registration
;
}
}
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/config/CASproperties.java
0 → 100644
View file @
e024d474
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
config
;
public
class
CASproperties
{
/**
* 当前应用程序的baseUrl(注意最后面的斜线)
*/
public
static
String
CLIENT_SERVER_NAME
=
"http://127.0.0.1:8888/"
;
/**
* 当前应用程序的登陆界面
*/
public
static
String
CLIENT_LOGIN_PAGE
=
"http://127.0.0.1:8888/login"
;
/**
* CAS服务器地址
*/
public
static
String
CAS_SERVER_PATH
=
"http://192.168.1.62:8443/cas"
;
/**
* CAS登陆服务器地址
*/
public
static
String
CAS_SERVER_LOGIN_PATH
=
"http://192.168.1.62:8443/cas/login"
;
/**
* CAS登出服务器地址
*/
public
static
String
CAS_SERVER_LOGOUT_PATH
=
"http://192.168.1.62:8443/cas/logout"
;
}
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/controller/AuthController.java
0 → 100644
View file @
e024d474
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
controller
;
import
com.yifu.cloud.plus.v1.yifu.auth.config.CASproperties
;
import
com.yifu.cloud.plus.v1.yifu.auth.util.LoginUtils
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.logging.Logger
;
/**
* @author huyc
* @since 1.6.0
*/
@RequiredArgsConstructor
@RestController
@RequestMapping
(
"/auth"
)
public
class
AuthController
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
AuthController
.
class
.
getName
());
@PostMapping
(
"/login"
)
public
String
login
(
HttpServletRequest
request
,
String
username
,
String
password
)
{
return
null
;
}
@PostMapping
(
value
=
"/logout"
)
public
void
logout
(
HttpServletRequest
request
)
{
request
.
getSession
().
invalidate
();
}
@PostMapping
(
value
=
"/check"
)
public
String
check
(
HttpServletRequest
request
,
String
username
,
String
password
)
{
String
st
=
LoginUtils
.
getTicket
(
CASproperties
.
CAS_SERVER_LOGOUT_PATH
,
username
,
password
,
CASproperties
.
CLIENT_LOGIN_PAGE
);
LOG
.
info
(
st
);
return
st
;
}
}
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/filter/SimpleUrlPatternMatcherStrategy.java
0 → 100644
View file @
e024d474
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
filter
;
import
org.jasig.cas.client.authentication.UrlPatternMatcherStrategy
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
SimpleUrlPatternMatcherStrategy
implements
UrlPatternMatcherStrategy
{
/**
* 判断是否匹配这个字符串
*
* @author licancan
* @param url 用户请求的连接
* @return {@link boolean} true:不拦截 false:必须得登录了
*/
@Override
public
boolean
matches
(
String
url
)
{
List
<
String
>
list
=
Arrays
.
asList
(
"/login"
,
"/restLogin"
);
String
name
=
url
.
substring
(
url
.
lastIndexOf
(
"/"
));
// String url = "http://127.0.0.1:8082/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb";
// 为了防止出现匹配中,忽略了后续参数的URL,出现比如:/login?service=http%3A%2F%2F127.0.0.1%3A8082%2Fb 现象
// 这种现象,会导致重定向过多异常,所以,不管什么url,只取出请求的最终 /login 即可
if
(
name
.
indexOf
(
"?"
)
!=
-
1
)
{
name
=
name
.
substring
(
0
,
name
.
indexOf
(
"?"
));
}
boolean
result
=
list
.
contains
(
name
);
if
(!
result
)
{
System
.
out
.
println
(
"拦截URL:"
+
url
);
}
return
result
;
}
/**
* 正则表达式的规则,这个地方可以是web传递过来的
*
* @author licancan
* @param pattern
* @return void
*/
@Override
public
void
setPattern
(
String
pattern
)
{
System
.
out
.
println
(
11111
);
}
}
yifu-auth/src/main/java/com/yifu/cloud/plus/v1/yifu/auth/util/LoginUtils.java
0 → 100644
View file @
e024d474
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
auth
.
util
;
import
org.springframework.http.*
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.logging.Logger
;
public
class
LoginUtils
{
private
static
final
Logger
LOG
=
Logger
.
getLogger
(
LoginUtils
.
class
.
getName
());
/**
* 登录
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param username 用户名
* @param password 密码
* @param service 需要跳转的应用地址
* @return {@link String}
*/
public
static
String
getTicket
(
final
String
server
,
final
String
username
,
final
String
password
,
final
String
service
)
{
//重定向
return
getServiceTicket
(
server
,
getTicketGrantingTicket
(
server
,
username
,
password
),
service
);
}
/**
* 获取ST
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param ticketGrantingTicket tgt
* @param service 需要跳转的应用地址
* @return {@link String}
*/
private
static
String
getServiceTicket
(
final
String
server
,
final
String
ticketGrantingTicket
,
final
String
service
)
{
if
(
ticketGrantingTicket
==
null
){
return
null
;
}
try
{
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
wholeForm
.
add
(
"service"
,
service
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
entity
=
new
HttpEntity
<>(
wholeForm
,
headers
);
ResponseEntity
<
String
>
obj
=
restTemplate
.
exchange
(
server
+
"/"
+
ticketGrantingTicket
,
HttpMethod
.
POST
,
entity
,
String
.
class
);
switch
(
obj
.
getStatusCode
().
value
())
{
case
200
:
LOG
.
info
(
"Successful service ticket request: "
+
obj
.
getBody
());
return
obj
.
getBody
();
default
:
LOG
.
warning
(
"Invalid response code ("
+
obj
.
getStatusCode
().
value
()
+
") from CAS server!"
);
LOG
.
info
(
"Response (1k): "
+
obj
.
getBody
());
break
;
}
}
catch
(
Exception
e
)
{
LOG
.
warning
(
e
.
getMessage
());
}
return
null
;
}
/**
* 获取 TGT
*
* @author licancan
* @param server cas服务端获取tgt地址
* @param username 用户名
* @param password 密码
* @return {@link String}
*/
private
static
String
getTicketGrantingTicket
(
final
String
server
,
final
String
username
,
final
String
password
)
{
try
{
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
wholeForm
.
add
(
"username"
,
username
);
wholeForm
.
add
(
"password"
,
password
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
entity
=
new
HttpEntity
<>(
wholeForm
,
headers
);
ResponseEntity
<
String
>
obj
=
restTemplate
.
exchange
(
server
,
HttpMethod
.
POST
,
entity
,
String
.
class
);
switch
(
obj
.
getStatusCode
().
value
())
{
case
201
:
LOG
.
info
(
"Successful ticket granting ticket request: "
+
obj
.
getBody
());
return
obj
.
getBody
();
default
:
LOG
.
warning
(
"Invalid response code ("
+
obj
.
getStatusCode
().
value
()
+
") from CAS server!"
);
LOG
.
info
(
"Response (1k): "
+
obj
.
getBody
());
break
;
}
}
catch
(
Exception
e
)
{
LOG
.
warning
(
e
.
getMessage
());
}
return
null
;
}
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/ResultConstants.java
View file @
e024d474
...
@@ -19,6 +19,6 @@ public class ResultConstants {
...
@@ -19,6 +19,6 @@ public class ResultConstants {
public
static
final
String
REQUEST_LOCK_FAIL
=
"获取锁失败"
;
public
static
final
String
REQUEST_LOCK_FAIL
=
"获取锁失败"
;
public
static
final
String
DATA_IMPORT_PARSING_RESULT
=
"数据导入解析!数据行数:"
;
public
static
final
String
DATA_IMPORT_PARSING_RESULT
=
"数据导入解析!数据行数:"
;
public
static
final
String
NO_SELECT_DATA
=
"请选择数据"
;
public
static
final
String
NO_SELECT_DATA
=
"请选择数据"
;
public
static
final
String
NO_GETLOCK_DATA
=
"
获取锁失败,10秒
后重试!"
;
public
static
final
String
NO_GETLOCK_DATA
=
"
当前用户操作处理中,请稍
后重试!"
;
public
static
final
String
NO_ID
=
"操作失败,id不能为空!"
;
public
static
final
String
NO_ID
=
"操作失败,id不能为空!"
;
}
}
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TDispatchInfoController.java
View file @
e024d474
...
@@ -328,7 +328,12 @@ public class TDispatchInfoController {
...
@@ -328,7 +328,12 @@ public class TDispatchInfoController {
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
try
{
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
//主动释放锁
return
tDispatchInfoService
.
importDiy
(
file
.
getInputStream
(),
orderId
);
return
tDispatchInfoService
.
importDiy
(
file
.
getInputStream
(),
orderId
);
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
}
finally
{
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
...
@@ -410,7 +415,12 @@ public class TDispatchInfoController {
...
@@ -410,7 +415,12 @@ public class TDispatchInfoController {
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
try
{
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
//主动释放锁
return
tDispatchInfoService
.
importReduceDiy
(
file
.
getInputStream
(),
orderId
);
return
tDispatchInfoService
.
importReduceDiy
(
file
.
getInputStream
(),
orderId
);
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
}
finally
{
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TPaymentInfoController.java
View file @
e024d474
...
@@ -168,7 +168,11 @@ public class TPaymentInfoController {
...
@@ -168,7 +168,11 @@ public class TPaymentInfoController {
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
try
{
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
return
tPaymentInfoService
.
importSocialDiy
(
file
.
getInputStream
());
return
tPaymentInfoService
.
importSocialDiy
(
file
.
getInputStream
());
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
}
finally
{
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
...
@@ -200,7 +204,11 @@ public class TPaymentInfoController {
...
@@ -200,7 +204,11 @@ public class TPaymentInfoController {
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
try
{
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
return
tPaymentInfoService
.
importSocialHeFeiDiy
(
file
.
getInputStream
(),
random
,
type
);
return
tPaymentInfoService
.
importSocialHeFeiDiy
(
file
.
getInputStream
(),
random
,
type
);
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
}
finally
{
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
...
@@ -232,7 +240,11 @@ public class TPaymentInfoController {
...
@@ -232,7 +240,11 @@ public class TPaymentInfoController {
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
try
{
try
{
if
(
Common
.
isNotNull
(
requestId
))
{
return
tPaymentInfoService
.
batchImportPaymentFundInfo
(
file
.
getInputStream
());
return
tPaymentInfoService
.
batchImportPaymentFundInfo
(
file
.
getInputStream
());
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
finally
{
}
finally
{
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/controller/TPreDispatchInfoController.java
View file @
e024d474
...
@@ -250,6 +250,7 @@ public class TPreDispatchInfoController {
...
@@ -250,6 +250,7 @@ public class TPreDispatchInfoController {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
}
if
(
Common
.
isNotNull
(
requestId
))
{
ExcelUtil
<
TPreDispatchInfo
>
util1
=
null
;
ExcelUtil
<
TPreDispatchInfo
>
util1
=
null
;
try
{
try
{
jsonString
=
URLDecoder
.
decode
(
jsonString
,
CommonConstants
.
UTF8
).
replace
(
"="
,
""
);
jsonString
=
URLDecoder
.
decode
(
jsonString
,
CommonConstants
.
UTF8
).
replace
(
"="
,
""
);
...
@@ -279,6 +280,9 @@ public class TPreDispatchInfoController {
...
@@ -279,6 +280,9 @@ public class TPreDispatchInfoController {
//主动释放锁
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
RedisDistributedLock
.
unlock
(
key
,
requestId
);
}
}
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
}
/**
/**
...
...
yifu-social/yifu-social-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/social/service/impl/TPaymentInfoServiceImpl.java
View file @
e024d474
...
@@ -38,7 +38,9 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
...
@@ -38,7 +38,9 @@ import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainSelectVo;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttributeConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ResultConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.redis.RedisDistributedLock
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.ErrorDetailVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.ErrorDetailVO
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
import
com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser
;
...
@@ -270,7 +272,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
...
@@ -270,7 +272,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
@Override
public
R
<
Boolean
>
removeInFoById
(
String
id
)
{
public
R
<
Boolean
>
removeInFoById
(
String
id
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
String
key
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CacheConstants
.
PAYMENT_SOCIAL_PUSH
;
String
key
=
CacheConstants
.
PAYMENT_SOCIAL_PUSH
+
CommonConstants
.
DOWN_LINE_STRING
+
user
.
getId
()
;
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
}
}
...
@@ -298,7 +300,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
...
@@ -298,7 +300,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
return
R
.
failed
(
CommonConstants
.
NO_DATA_TO_HANDLE
);
return
R
.
failed
(
CommonConstants
.
NO_DATA_TO_HANDLE
);
}
}
String
key
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CacheConstants
.
PAYMENT_SOCIAL_PUSH
;
String
key
=
CacheConstants
.
PAYMENT_SOCIAL_PUSH
+
CommonConstants
.
DOWN_LINE_STRING
+
user
.
getId
()
;
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
}
}
...
@@ -340,7 +342,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
...
@@ -340,7 +342,7 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
String
socialCreateMonth
,
String
socialPayMonth
)
{
String
socialCreateMonth
,
String
socialPayMonth
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
String
key
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CacheConstants
.
PAYMENT_SOCIAL_PUSH
;
String
key
=
CacheConstants
.
PAYMENT_SOCIAL_PUSH
+
CommonConstants
.
DOWN_LINE_STRING
+
user
.
getId
()
;
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
return
R
.
failed
(
"用户正在推送实缴数据中禁止删除!"
);
}
}
...
@@ -2814,13 +2816,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
...
@@ -2814,13 +2816,20 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
@Override
@Override
public
R
<
Boolean
>
pushPaymentSocialFundInfo
(
TPaymentInfoSearchVo
searchVo
)
{
public
R
<
Boolean
>
pushPaymentSocialFundInfo
(
TPaymentInfoSearchVo
searchVo
)
{
YifuUser
user
=
SecurityUtils
.
getUser
();
YifuUser
user
=
SecurityUtils
.
getUser
();
String
key
=
user
.
getId
()
+
CommonConstants
.
DOWN_LINE_STRING
+
CacheConstants
.
PAYMENT_SOCIAL_PUSH
;
String
key
=
CacheConstants
.
PAYMENT_SOCIAL_PUSH
+
CommonConstants
.
DOWN_LINE_STRING
+
user
.
getId
()
;
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
if
(
Common
.
isNotNull
(
redisUtil
.
get
(
key
)))
{
return
R
.
failed
(
"用户正在推送实缴数据中,禁止重复推送!"
);
return
R
.
failed
(
"用户正在推送实缴数据中,禁止重复推送!"
);
}
else
{
}
else
{
redisUtil
.
set
(
key
,
user
.
getId
(),
1200L
);
redisUtil
.
set
(
key
,
user
.
getId
(),
1200L
);
}
}
// 获取redis分布式事务锁
String
requestId
;
try
{
requestId
=
RedisDistributedLock
.
getLock
(
key
,
"10"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
ResultConstants
.
NO_GETLOCK_DATA
+
CommonConstants
.
DOWN_LINE_STRING
+
e
.
getMessage
());
}
if
(
Common
.
isNotNull
(
requestId
))
{
Map
<
String
,
TSettleDomainSelectVo
>
mapSelectVo
=
this
.
getSelectVoMap
();
Map
<
String
,
TSettleDomainSelectVo
>
mapSelectVo
=
this
.
getSelectVoMap
();
//手动推送未推送的社保公积金明细数据
//手动推送未推送的社保公积金明细数据
createPaymentSocialInfoReal
(
user
,
searchVo
,
mapSelectVo
);
createPaymentSocialInfoReal
(
user
,
searchVo
,
mapSelectVo
);
...
@@ -2838,7 +2847,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
...
@@ -2838,7 +2847,12 @@ public class TPaymentInfoServiceImpl extends ServiceImpl<TPaymentInfoMapper, TPa
redisUtil
.
remove
(
redisKey
);
redisUtil
.
remove
(
redisKey
);
}
}
redisUtil
.
remove
(
key
);
redisUtil
.
remove
(
key
);
//主动释放锁
RedisDistributedLock
.
unlock
(
key
,
requestId
);
return
R
.
ok
();
return
R
.
ok
();
}
else
{
return
R
.
failed
(
ResultConstants
.
NO_GETLOCK_DATA
);
}
}
}
@Override
@Override
...
...
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