Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tax-sys-nacos
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
caoxiaohong
tax-sys-nacos
Commits
5b9e7f23
Commit
5b9e7f23
authored
May 01, 2025
by
ddx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
64a8f4c2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
15 deletions
+50
-15
tax-token/token-common/src/main/java/com/tax/token/utils/CleanCookieUtil.java
+31
-7
tax-token/token-service/src/main/java/com/tax/token/service/api/TkTokenService.java
+1
-1
tax-token/token-service/src/main/java/com/tax/token/service/impl/TkTokenServiceImpl.java
+8
-3
tax-token/token-web/src/main/java/com/tax/token/web/controller/TokenController.java
+8
-4
tax-token/token-web/src/test/java/com/yxcheng/token/web/controller/test/TokenUnitTest.java
+2
-0
No files found.
tax-token/token-common/src/main/java/com/tax/token/utils/CleanCookieUtil.java
View file @
5b9e7f23
...
@@ -3,6 +3,7 @@ package com.tax.token.utils;
...
@@ -3,6 +3,7 @@ package com.tax.token.utils;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Maps
;
import
com.tax.token.constants.TokenConstants
;
import
com.tax.token.constants.TokenConstants
;
import
com.tax.token.model.CleanCookieVo
;
import
com.tax.token.model.CleanCookieVo
;
import
com.tax.token.model.CookieReq
;
import
com.tax.token.model.CookieReq
;
...
@@ -20,6 +21,22 @@ public class CleanCookieUtil {
...
@@ -20,6 +21,22 @@ public class CleanCookieUtil {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CleanCookieUtil
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
CleanCookieUtil
.
class
);
public
static
Map
<
String
,
String
>
cleanTypeMap
=
Maps
.
newHashMap
();
static
{
//对外的 cleanType 1.清app 2.清电子税局 3.清app+电子税局
//对内的 cleanType 13.清app 2.清电子税局 14.清app+电子税局
cleanTypeMap
.
put
(
"1"
,
"13"
);
cleanTypeMap
.
put
(
"2"
,
"2"
);
cleanTypeMap
.
put
(
"3"
,
"14"
);
}
public
static
String
transfarCleanType
(
String
oldCleanType
)
{
if
(
StringUtil
.
isEmpty
(
oldCleanType
)
||
!
cleanTypeMap
.
containsKey
(
oldCleanType
))
{
oldCleanType
=
"2"
;
}
return
cleanTypeMap
.
get
(
oldCleanType
);
}
public
static
CleanCookieVo
cleanCookie
(
String
uuIdFlag
,
CookieReq
cookieReq
,
String
cleanType
)
throws
IOException
,
HttpException
{
public
static
CleanCookieVo
cleanCookie
(
String
uuIdFlag
,
CookieReq
cookieReq
,
String
cleanType
)
throws
IOException
,
HttpException
{
CleanCookieVo
cleanCookieVo
=
new
CleanCookieVo
();
CleanCookieVo
cleanCookieVo
=
new
CleanCookieVo
();
String
taxno
=
cookieReq
.
getTaxno
();
String
taxno
=
cookieReq
.
getTaxno
();
...
@@ -36,15 +53,22 @@ public class CleanCookieUtil {
...
@@ -36,15 +53,22 @@ public class CleanCookieUtil {
}
}
}
else
{
}
else
{
if
(
StringUtil
.
isNotEmpty
(
cookieReq
.
getUserInfo
()))
{
if
(
StringUtil
.
isNotEmpty
(
cookieReq
.
getUserInfo
()))
{
JSONArray
jsonArray
=
new
JSONArray
();
if
(
cleanType
.
equals
(
"13"
)
||
cleanType
.
equals
(
"14"
))
{
if
(
cleanType
.
equals
(
"3"
))
{
JSONObject
loginInfoJson
=
new
JSONObject
();
jsonArray
.
add
(
cookieReq
.
getZoneCode
()
+
":"
+
cookieReq
.
getUserInfo
());
loginInfoJson
.
put
(
"taxno"
,
cookieReq
.
getTaxno
());
}
else
if
(
cleanType
.
equals
(
"13"
))
{
loginInfoJson
.
put
(
"dqdm"
,
cookieReq
.
getZoneCode
());
jsonArray
.
add
(
cookieReq
.
getLoginName
()
+
":"
+
cookieReq
.
getUserInfo
());
loginInfoJson
.
put
(
"userName"
,
cookieReq
.
getLoginName
());
loginInfoJson
.
put
(
"session"
,
cookieReq
.
getUserInfo
());
json
.
put
(
"loginInfoJson"
,
loginInfoJson
);
}
else
{
}
else
{
jsonArray
.
add
(
cookieReq
.
getZoneCode
()
+
":"
+
taxno
+
":"
+
cookieReq
.
getUserInfo
());
JSONArray
jsonArray
=
new
JSONArray
();
if
(
cleanType
.
equals
(
"3"
))
{
jsonArray
.
add
(
cookieReq
.
getZoneCode
()
+
":"
+
cookieReq
.
getUserInfo
());
}
else
{
jsonArray
.
add
(
cookieReq
.
getZoneCode
()
+
":"
+
taxno
+
":"
+
cookieReq
.
getUserInfo
());
}
json
.
put
(
"keyList"
,
jsonArray
);
}
}
json
.
put
(
"keyList"
,
jsonArray
);
}
else
{
}
else
{
if
(
null
!=
cookieReq
.
getUserInfoJson
())
{
if
(
null
!=
cookieReq
.
getUserInfoJson
())
{
JSONObject
loginInfoJson
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
cookieReq
.
getUserInfoJson
()));
JSONObject
loginInfoJson
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
cookieReq
.
getUserInfoJson
()));
...
...
tax-token/token-service/src/main/java/com/tax/token/service/api/TkTokenService.java
View file @
5b9e7f23
...
@@ -46,7 +46,7 @@ public interface TkTokenService {
...
@@ -46,7 +46,7 @@ public interface TkTokenService {
JsonResult
<
String
>
selectErrorTokenList
(
String
userCode
,
Integer
pageId
);
JsonResult
<
String
>
selectErrorTokenList
(
String
userCode
,
Integer
pageId
);
JsonResult
<
String
>
cleanCookie
(
String
uuId
,
CookieReq
cookieReq
,
String
cleanType
);
JsonResult
<
String
>
cleanCookie
(
String
uuId
,
CookieReq
cookieReq
);
JsonResult
<
String
>
cleanGroupCookie
(
String
uuId
,
CookieReq
cookieReq
);
JsonResult
<
String
>
cleanGroupCookie
(
String
uuId
,
CookieReq
cookieReq
);
...
...
tax-token/token-service/src/main/java/com/tax/token/service/impl/TkTokenServiceImpl.java
View file @
5b9e7f23
...
@@ -900,11 +900,16 @@ public class TkTokenServiceImpl implements TkTokenService {
...
@@ -900,11 +900,16 @@ public class TkTokenServiceImpl implements TkTokenService {
}
}
public
JsonResult
<
String
>
cleanCookie
(
String
uuId
,
CookieReq
cookieReq
,
String
cleanType
)
{
public
JsonResult
<
String
>
cleanCookie
(
String
uuId
,
CookieReq
cookieReq
)
{
JsonResult
result
=
new
JsonResult
();
JsonResult
result
=
new
JsonResult
();
String
taxno
=
cookieReq
.
getTaxno
();
String
taxno
=
cookieReq
.
getTaxno
();
Date
reqDate
=
DateUtils
.
getDate
();
Date
reqDate
=
DateUtils
.
getDate
();
String
oldCleanType
=
cookieReq
.
getCleanType
();
String
cleanType
=
CleanCookieUtil
.
transfarCleanType
(
oldCleanType
);
logger
.
info
(
uuId
+
" cleanCookie taxno is "
+
taxno
+
" oldCleanType "
+
oldCleanType
+
" to newCleanType "
+
cleanType
);
CleanCookieVo
resMap
=
null
;
CleanCookieVo
resMap
=
null
;
try
{
try
{
String
newUserInfo
=
""
;
String
newUserInfo
=
""
;
...
@@ -917,7 +922,7 @@ public class TkTokenServiceImpl implements TkTokenService {
...
@@ -917,7 +922,7 @@ public class TkTokenServiceImpl implements TkTokenService {
String
cookieString
=
EncryptUtil
.
decryptAesCk
(
cookie
);
String
cookieString
=
EncryptUtil
.
decryptAesCk
(
cookie
);
logger
.
info
(
uuId
+
" cleanCookie taxno is "
+
taxno
+
", cookieString is "
+
cookieString
);
logger
.
info
(
uuId
+
" cleanCookie taxno is "
+
taxno
+
", cookieString is "
+
cookieString
);
JSONObject
cookieJson
=
JSON
.
parseObject
(
cookieString
);
JSONObject
cookieJson
=
JSON
.
parseObject
(
cookieString
);
if
(
cleanType
.
equals
(
"13"
))
{
if
(
cleanType
.
equals
(
"13"
)
||
cleanType
.
equals
(
"14"
)
)
{
if
(
cookieJson
.
containsKey
(
"session"
)
&&
cookieJson
.
containsKey
(
"userGroupName"
))
{
if
(
cookieJson
.
containsKey
(
"session"
)
&&
cookieJson
.
containsKey
(
"userGroupName"
))
{
newUserInfo
=
cookieJson
.
getString
(
"session"
);
newUserInfo
=
cookieJson
.
getString
(
"session"
);
loginName
=
cookieJson
.
getString
(
"userGroupName"
);
loginName
=
cookieJson
.
getString
(
"userGroupName"
);
...
@@ -928,7 +933,7 @@ public class TkTokenServiceImpl implements TkTokenService {
...
@@ -928,7 +933,7 @@ public class TkTokenServiceImpl implements TkTokenService {
}
}
}
}
}
else
{
}
else
{
if
(
cleanType
.
equals
(
"13"
))
{
if
(
cleanType
.
equals
(
"13"
)
||
cleanType
.
equals
(
"14"
)
)
{
if
(
cookieInfoJson
.
containsKey
(
"session"
)
&&
cookieInfoJson
.
containsKey
(
"userGroupName"
))
{
if
(
cookieInfoJson
.
containsKey
(
"session"
)
&&
cookieInfoJson
.
containsKey
(
"userGroupName"
))
{
newUserInfo
=
cookieInfoJson
.
getString
(
"session"
);
newUserInfo
=
cookieInfoJson
.
getString
(
"session"
);
loginName
=
cookieInfoJson
.
getString
(
"userGroupName"
);
loginName
=
cookieInfoJson
.
getString
(
"userGroupName"
);
...
...
tax-token/token-web/src/main/java/com/tax/token/web/controller/TokenController.java
View file @
5b9e7f23
...
@@ -4,6 +4,8 @@ import com.tax.token.constants.TokenConstants;
...
@@ -4,6 +4,8 @@ import com.tax.token.constants.TokenConstants;
import
com.tax.token.integration.user.UserClient
;
import
com.tax.token.integration.user.UserClient
;
import
com.tax.token.model.*
;
import
com.tax.token.model.*
;
import
com.tax.token.service.api.TkTokenService
;
import
com.tax.token.service.api.TkTokenService
;
import
com.tax.token.service.impl.TkTokenServiceImpl
;
import
com.tax.token.utils.CleanCookieUtil
;
import
com.yxcheng.token.common.annotation.LogT
;
import
com.yxcheng.token.common.annotation.LogT
;
import
com.yxcheng.token.common.controller.BaseClientController
;
import
com.yxcheng.token.common.controller.BaseClientController
;
import
com.yxcheng.token.common.enumutil.ResultEnum
;
import
com.yxcheng.token.common.enumutil.ResultEnum
;
...
@@ -14,6 +16,8 @@ import com.yxcheng.token.utils.ObjectUtil;
...
@@ -14,6 +16,8 @@ import com.yxcheng.token.utils.ObjectUtil;
import
com.yxcheng.token.utils.StringUtil
;
import
com.yxcheng.token.utils.StringUtil
;
import
com.yxcheng.token.utils.UUIDGenerator
;
import
com.yxcheng.token.utils.UUIDGenerator
;
import
com.yxcheng.token.utils.ZoneUtil
;
import
com.yxcheng.token.utils.ZoneUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -28,6 +32,8 @@ import java.util.List;
...
@@ -28,6 +32,8 @@ import java.util.List;
@ComponentScan
(
basePackages
=
{
"com.tax.token.service"
})
@ComponentScan
(
basePackages
=
{
"com.tax.token.service"
})
public
class
TokenController
extends
BaseClientController
{
public
class
TokenController
extends
BaseClientController
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TokenController
.
class
);
@Autowired
@Autowired
private
TkTokenService
tokenService
;
private
TkTokenService
tokenService
;
@Autowired
@Autowired
...
@@ -198,10 +204,8 @@ public class TokenController extends BaseClientController {
...
@@ -198,10 +204,8 @@ public class TokenController extends BaseClientController {
}
}
cookieReq
.
setUserCode
(
cookieReq
.
getAccessKeyID
());
cookieReq
.
setUserCode
(
cookieReq
.
getAccessKeyID
());
String
uuId
=
UUIDGenerator
.
generate
();
String
uuId
=
UUIDGenerator
.
generate
();
if
(
StringUtil
.
isEmpty
(
cookieReq
.
getCleanType
()))
{
cookieReq
.
setCleanType
(
"2"
);
JsonResult
<
String
>
jsonResult
=
tokenService
.
cleanCookie
(
uuId
,
cookieReq
);
}
JsonResult
<
String
>
jsonResult
=
tokenService
.
cleanCookie
(
uuId
,
cookieReq
,
cookieReq
.
getCleanType
());
return
jsonResult
;
return
jsonResult
;
}
}
...
...
tax-token/token-web/src/test/java/com/yxcheng/token/web/controller/test/TokenUnitTest.java
View file @
5b9e7f23
...
@@ -233,6 +233,8 @@ public class TokenUnitTest {
...
@@ -233,6 +233,8 @@ public class TokenUnitTest {
param
.
put
(
"taxno"
,
"914404003980391901"
);
param
.
put
(
"taxno"
,
"914404003980391901"
);
param
.
put
(
"zoneCode"
,
"4400"
);
param
.
put
(
"zoneCode"
,
"4400"
);
param
.
put
(
"cleanType"
,
"3"
);
Map
userparam
=
new
HashMap
<>();
Map
userparam
=
new
HashMap
<>();
//
//
// userparam.put("loginType","b");
// userparam.put("loginType","b");
...
...
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