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
121dc2b4
Commit
121dc2b4
authored
Dec 25, 2024
by
ddx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
请求404推送异常信息
parent
719a1c3d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
12 deletions
+127
-12
tax-common/src/main/java/com/yxcheng/token/utils/JSONHelper.java
+11
-0
tax-token/token-common/src/main/java/com/tax/token/constants/TokenConstants.java
+12
-0
tax-token/token-common/src/main/java/com/tax/token/thirdService/impl/GetTokenFromEleJsonTax.java
+2
-0
tax-token/token-common/src/main/java/com/tax/token/utils/DingdingUtil.java
+98
-0
tax-token/token-web/src/main/java/com/tax/token/web/controller/TokenController.java
+0
-8
tax-token/token-web/src/test/java/com/yxcheng/token/web/controller/test/TokenUnitTest.java
+4
-4
No files found.
tax-common/src/main/java/com/yxcheng/token/utils/JSONHelper.java
View file @
121dc2b4
...
...
@@ -509,4 +509,15 @@ public final class JSONHelper {
}
return
invList
;
}
public
static
boolean
isJSONObject
(
String
str
)
{
boolean
isJSONObject
=
false
;
if
(
StringUtil
.
isNotEmpty
(
str
))
{
str
=
str
.
trim
();
if
(
str
.
startsWith
(
"{"
)
&&
str
.
endsWith
(
"}"
))
{
isJSONObject
=
true
;
}
}
return
isJSONObject
;
}
}
tax-token/token-common/src/main/java/com/tax/token/constants/TokenConstants.java
View file @
121dc2b4
...
...
@@ -73,6 +73,9 @@ public class TokenConstants {
public
static
String
NUONUO_TOKEN
=
"7176fb23bbca56e0d822ef0vwiatikls"
;
public
static
String
NUONUO_TAXNUM
=
"339901123456789"
;
public
static
String
LOGIN_DING_URL
=
null
;
public
static
String
LOGIN_KEYWORDS
=
null
;
static
{
urlMap
=
new
HashMap
<
String
,
String
>();
urlMap
.
put
(
"1100"
,
"https://fpdk.bjsat.gov.cn/"
);
...
...
@@ -204,6 +207,15 @@ public class TokenConstants {
PUSH_COOKIE_URL
=
pushCookieUrl
;
}
@Value
(
"${token.loginDingUrl}"
)
public
void
setLoginDingUrl
(
String
loginDingUrl
)
{
LOGIN_DING_URL
=
loginDingUrl
;
}
@Value
(
"${token.loginKeywords}"
)
public
void
setLoginKeywords
(
String
loginKeywords
)
{
LOGIN_KEYWORDS
=
loginKeywords
;
}
/**用户类型 0-小号 1-正常 2-人工 start*/
/**
...
...
tax-token/token-common/src/main/java/com/tax/token/thirdService/impl/GetTokenFromEleJsonTax.java
View file @
121dc2b4
...
...
@@ -6,6 +6,7 @@ import com.tax.token.model.TkServer;
import
com.tax.token.model.TkToken
;
import
com.tax.token.model.TkZoneInfo
;
import
com.tax.token.thirdService.TokenThirdServiceI
;
import
com.tax.token.utils.DingdingUtil
;
import
com.yxcheng.token.utils.*
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.http.HttpException
;
...
...
@@ -49,6 +50,7 @@ public class GetTokenFromEleJsonTax implements TokenThirdServiceI {
ResponseContent
ret
=
HttpHelper
.
postJsonEntity
(
url
,
json
.
toString
(),
30000
,
90000
);
String
resultStr
=
ret
.
getContent
();
logger
.
info
(
uuIdFlag
+
" GetTokenFromEleJsonTax taxno is "
+
taxno
+
",result is "
+
resultStr
);
DingdingUtil
.
sendLoginErrorNotice
(
uuIdFlag
,
tokenEntity
,
resultStr
);
if
(
StringUtils
.
isNotEmpty
(
resultStr
))
{
Map
<
String
,
Object
>
resultStrMap
=
JSONHelper
.
parserToMap
(
resultStr
);
resultMap
.
put
(
"code"
,
ObjectUtil
.
fixNull
(
resultStrMap
.
get
(
"code"
)));
...
...
tax-token/token-common/src/main/java/com/tax/token/utils/DingdingUtil.java
0 → 100644
View file @
121dc2b4
package
com
.
tax
.
token
.
utils
;
import
com.alibaba.fastjson.JSONObject
;
import
com.tax.token.constants.TokenConstants
;
import
com.tax.token.model.TkToken
;
import
com.yxcheng.token.utils.HttpHelper
;
import
com.yxcheng.token.utils.JSONHelper
;
import
com.yxcheng.token.utils.ResponseContent
;
import
com.yxcheng.token.utils.StringUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
@Component
public
class
DingdingUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DingdingUtil
.
class
);
public
static
String
monitorLoginDingUrl
=
TokenConstants
.
LOGIN_DING_URL
;
public
static
String
monitorKeywords
=
TokenConstants
.
LOGIN_KEYWORDS
;
public
static
String
sendDingInfo
(
String
url
,
String
content
)
{
String
result
=
""
;
JSONObject
dingJson
=
new
JSONObject
();
dingJson
.
put
(
"msgtype"
,
"text"
);
JSONObject
contJson
=
new
JSONObject
();
contJson
.
put
(
"content"
,
content
);
JSONObject
atJson
=
new
JSONObject
();
atJson
.
put
(
"atMobiles"
,
new
String
[]{});
atJson
.
put
(
"isAtAll"
,
false
);
dingJson
.
put
(
"text"
,
contJson
);
dingJson
.
put
(
"at"
,
atJson
);
try
{
ResponseContent
res
=
HttpHelper
.
postJsonEntity
(
url
,
dingJson
.
toString
());
result
=
res
.
getContent
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
content
+
" send message is error!"
+
e
.
getMessage
());
}
return
result
;
}
public
static
void
sendLoginErrorNotice
(
String
uuIdFlag
,
TkToken
tokenEntity
,
String
content
)
{
try
{
String
result
=
""
;
if
(
StringUtil
.
isNotEmpty
(
content
)
&&
!
JSONHelper
.
isJSONObject
(
content
))
{
CheckResult
checkResult
=
checkContentErrorFlag
(
content
);
if
(
checkResult
.
getNoticeFlag
())
{
String
sendContent
=
"【登录异常】:"
+
tokenEntity
.
getUserCode
()
+
","
+
tokenEntity
.
getTaxno
()
+
","
+
uuIdFlag
+
",异常关键字:"
+
checkResult
.
getNoticeKeyword
();
result
=
sendDingInfo
(
monitorLoginDingUrl
,
sendContent
);
logger
.
info
(
uuIdFlag
+
" sendContent "
+
sendContent
+
" send message result is "
+
result
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
uuIdFlag
+
" sendLoginErrorNotice is error!"
+
e
.
getMessage
());
}
}
public
static
CheckResult
checkContentErrorFlag
(
String
content
)
{
CheckResult
checkResult
=
new
CheckResult
();
String
[]
keywordArr
=
monitorKeywords
.
split
(
","
);
for
(
String
keyword:
keywordArr
)
{
if
(
content
.
contains
(
keyword
))
{
checkResult
.
setNoticeFlag
(
true
);
checkResult
.
setNoticeKeyword
(
keyword
);
break
;
}
}
return
checkResult
;
}
static
class
CheckResult
{
private
boolean
noticeFlag
=
false
;
private
String
noticeKeyword
;
public
boolean
getNoticeFlag
()
{
return
noticeFlag
;
}
public
void
setNoticeFlag
(
boolean
noticeFlag
)
{
this
.
noticeFlag
=
noticeFlag
;
}
public
String
getNoticeKeyword
()
{
return
noticeKeyword
;
}
public
void
setNoticeKeyword
(
String
noticeKeyword
)
{
this
.
noticeKeyword
=
noticeKeyword
;
}
}
}
tax-token/token-web/src/main/java/com/tax/token/web/controller/TokenController.java
View file @
121dc2b4
...
...
@@ -65,15 +65,7 @@ public class TokenController extends BaseClientController {
if
(
cookieReq
.
checkParamNull
()
||
!
ZoneUtil
.
dqList
.
contains
(
cookieReq
.
getZoneCode
()))
{
return
JsonResult
.
errorResult
(
ResultEnum
.
param_error
.
getCode
(),
ResultEnum
.
param_error
.
getMessage
());
}
// if (tokenService.checkTokenRealRequestCount(cookieReq.getAccessKeyID(), cookieReq.getTaxno())) {
// int realRequestCount = tokenService.getTokenRealRequestCount(cookieReq.getAccessKeyID(), cookieReq.getTaxno());
// if(realRequestCount>60) {
// return JsonResult.errorResult(ResultEnum.system_error.getCode(), "请求太频繁,请20分钟后重试!");
// }
// }
String
uuId
=
UUIDGenerator
.
generate
();
// tokenService.setTokenRealRequestCount(cookieReq.getAccessKeyID(), cookieReq.getTaxno());
return
tokenService
.
getRealCookie
(
uuId
,
cookieReq
.
getTaxno
(),
cookieReq
.
getZoneCode
(),
cookieReq
.
getAccessKeyID
(),
true
,
TokenConstants
.
FUNCTION_NO_FPY
,
cookieReq
.
getUserInfoJson
(),
cookieReq
.
getCheckType
(),
cookieReq
.
getSite
(),
cookieReq
.
getTarget
());
}
...
...
tax-token/token-web/src/test/java/com/yxcheng/token/web/controller/test/TokenUnitTest.java
View file @
121dc2b4
...
...
@@ -12,9 +12,9 @@ import java.util.Map;
public
class
TokenUnitTest
{
// static String host = "http://47.94.208.133
:8762";
static
String
host
=
"http://127.0.0.1
:8762"
;
// static String host = "https://api.taxservices.cn";
static
String
host
=
"https://api.xfapiao.com"
;
//
static String host = "https://api.xfapiao.com";
String
accessKeyID
=
"eyongyou"
;
static
String
accessKeySecret
=
"yongyou!@#566ccd"
;
...
...
@@ -131,8 +131,8 @@ public class TokenUnitTest {
param
.
put
(
"timeStamp"
,
timeStamp
);
param
.
put
(
"version"
,
"1.0"
);
param
.
put
(
"signature"
,
getSign
(
signStr
));
param
.
put
(
"taxno"
,
"92
37
0203MA3R2F3Q03"
);
param
.
put
(
"zoneCode"
,
"
3702
"
);
param
.
put
(
"taxno"
,
"92
22
0203MA3R2F3Q03"
);
param
.
put
(
"zoneCode"
,
"
2200
"
);
// param.put("userInfo",Base64Util.encode("刘志怡021323[a%b@q]Lzy672672[a%b@q]"));
Map
userparam
=
new
HashMap
<>();
...
...
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