Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
徐少华
midjourney-proxy
Commits
d1039273
Commit
d1039273
authored
Sep 19, 2022
by
桂前礼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug: [none] ERROR日志处理 数字格式化异常
parent
e0ba61e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
29 deletions
+20
-29
Cookie.java
.../src/main/java/com/pcloud/common/utils/cookie/Cookie.java
+20
-29
No files found.
pcloud-common/src/main/java/com/pcloud/common/utils/cookie/Cookie.java
View file @
d1039273
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
package
com
.
pcloud
.
common
.
utils
.
cookie
;
package
com
.
pcloud
.
common
.
utils
.
cookie
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -164,14 +164,12 @@ public class Cookie {
...
@@ -164,14 +164,12 @@ public class Cookie {
if
(
userInfoArry
[
i
].
contains
(
"channelId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"channelId"
))
{
String
[]
channel
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
channel
=
userInfoArry
[
i
].
split
(
"="
);
String
channelId
=
channel
[
channel
.
length
-
1
];
String
channelId
=
channel
[
channel
.
length
-
1
];
userInfos
.
put
(
"channelId"
,
StringUtil
.
isEmpty
(
channelId
)
||
"undefined"
.
equalsIgnoreCase
(
channelId
)
userInfos
.
put
(
"channelId"
,
parseLong
(
channelId
));
||
"null"
.
equalsIgnoreCase
(
channelId
)
?
null
:
NumberUtil
.
toLong
(
channelId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"officialAccountsId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"officialAccountsId"
))
{
String
[]
wechat
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
wechat
=
userInfoArry
[
i
].
split
(
"="
);
String
officialAccountsId
=
wechat
[
wechat
.
length
-
1
];
String
officialAccountsId
=
wechat
[
wechat
.
length
-
1
];
userInfos
.
put
(
"officialAccountsId"
,
StringUtil
.
isEmpty
(
officialAccountsId
)
||
"undefined"
.
equalsIgnoreCase
(
officialAccountsId
)
userInfos
.
put
(
"officialAccountsId"
,
parseLong
(
officialAccountsId
));
||
"null"
.
equalsIgnoreCase
(
officialAccountsId
)
?
null
:
NumberUtil
.
toLong
(
officialAccountsId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"wechatUserId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"wechatUserId"
))
{
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
...
@@ -183,16 +181,14 @@ public class Cookie {
...
@@ -183,16 +181,14 @@ public class Cookie {
if
(
userInfoArry
[
i
].
contains
(
"partyId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"partyId"
))
{
String
[]
party
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
party
=
userInfoArry
[
i
].
split
(
"="
);
String
partyId
=
party
[
party
.
length
-
1
];
String
partyId
=
party
[
party
.
length
-
1
];
userInfos
.
put
(
"partyId"
,
StringUtil
.
isEmpty
(
partyId
)
||
"undefined"
.
equalsIgnoreCase
(
partyId
)
||
"null"
.
equalsIgnoreCase
(
partyId
)
userInfos
.
put
(
"partyId"
,
parseLong
(
partyId
));
?
null
:
NumberUtil
.
toLong
(
partyId
));
}
}
// editBy TC cookie里面需要带上顾问,systemCode,是否系统,场景值
// editBy TC cookie里面需要带上顾问,systemCode,是否系统,场景值
// modify by songx at 2017-05-17 如果值为undefined或者null直接跳过
// modify by songx at 2017-05-17 如果值为undefined或者null直接跳过
if
(
userInfoArry
[
i
].
contains
(
"adviserId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"adviserId"
))
{
String
[]
adviser
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
adviser
=
userInfoArry
[
i
].
split
(
"="
);
String
adviserId
=
adviser
[
adviser
.
length
-
1
];
String
adviserId
=
adviser
[
adviser
.
length
-
1
];
userInfos
.
put
(
"adviserId"
,
StringUtil
.
isEmpty
(
adviserId
)
||
"undefined"
.
equalsIgnoreCase
(
adviserId
)
||
"null"
.
equalsIgnoreCase
(
adviserId
)
userInfos
.
put
(
"adviserId"
,
parseLong
(
adviserId
));
?
null
:
NumberUtil
.
toLong
(
adviserId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"systemCode"
))
{
if
(
userInfoArry
[
i
].
contains
(
"systemCode"
))
{
String
[]
systemCode
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
systemCode
=
userInfoArry
[
i
].
split
(
"="
);
...
@@ -208,26 +204,22 @@ public class Cookie {
...
@@ -208,26 +204,22 @@ public class Cookie {
if
(
userInfoArry
[
i
].
contains
(
"sceneId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"sceneId"
))
{
String
[]
scene
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
scene
=
userInfoArry
[
i
].
split
(
"="
);
String
sceneId
=
scene
[
scene
.
length
-
1
];
String
sceneId
=
scene
[
scene
.
length
-
1
];
userInfos
.
put
(
"sceneId"
,
StringUtil
.
isEmpty
(
sceneId
)
||
"undefined"
.
equalsIgnoreCase
(
sceneId
)
||
"null"
.
equalsIgnoreCase
(
sceneId
)
?
null
userInfos
.
put
(
"sceneId"
,
parseLong
(
sceneId
));
:
NumberUtil
.
toLong
(
sceneId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"userId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"userId"
))
{
String
[]
userLogin
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
userLogin
=
userInfoArry
[
i
].
split
(
"="
);
String
userId
=
userLogin
[
userLogin
.
length
-
1
];
String
userId
=
userLogin
[
userLogin
.
length
-
1
];
userInfos
.
put
(
"userId"
,
StringUtil
.
isEmpty
(
userId
)
||
"undefined"
.
equalsIgnoreCase
(
userId
)
||
"null"
.
equalsIgnoreCase
(
userId
)
?
null
userInfos
.
put
(
"userId"
,
parseLong
(
userId
));
:
NumberUtil
.
toLong
(
userId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"merchantMemberId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"merchantMemberId"
))
{
String
[]
merchant
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
merchant
=
userInfoArry
[
i
].
split
(
"="
);
String
merchantMemberId
=
merchant
[
merchant
.
length
-
1
];
String
merchantMemberId
=
merchant
[
merchant
.
length
-
1
];
userInfos
.
put
(
"merchantMemberId"
,
StringUtil
.
isEmpty
(
merchantMemberId
)
||
"undefined"
.
equalsIgnoreCase
(
merchantMemberId
)
userInfos
.
put
(
"merchantMemberId"
,
parseLong
(
merchantMemberId
));
||
"null"
.
equalsIgnoreCase
(
merchantMemberId
)
?
null
:
NumberUtil
.
toLong
(
merchantMemberId
));
}
}
if
(
userInfoArry
[
i
].
contains
(
"agentMemberId"
))
{
if
(
userInfoArry
[
i
].
contains
(
"agentMemberId"
))
{
String
[]
merchant
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
merchant
=
userInfoArry
[
i
].
split
(
"="
);
String
agentMemberId
=
merchant
[
merchant
.
length
-
1
];
String
agentMemberId
=
merchant
[
merchant
.
length
-
1
];
userInfos
.
put
(
"agentMemberId"
,
StringUtil
.
isEmpty
(
agentMemberId
)
||
"undefined"
.
equalsIgnoreCase
(
agentMemberId
)
userInfos
.
put
(
"agentMemberId"
,
parseLong
(
agentMemberId
));
||
"null"
.
equalsIgnoreCase
(
agentMemberId
)
?
null
:
NumberUtil
.
toLong
(
agentMemberId
));
}
}
// add by gaop
// add by gaop
if
(
userInfoArry
[
i
].
contains
(
PREVIEW_TYPE
))
{
if
(
userInfoArry
[
i
].
contains
(
PREVIEW_TYPE
))
{
...
@@ -250,40 +242,35 @@ public class Cookie {
...
@@ -250,40 +242,35 @@ public class Cookie {
if
(
userInfoArry
[
i
].
contains
(
FIRST_TD
))
{
if
(
userInfoArry
[
i
].
contains
(
FIRST_TD
))
{
String
[]
firstTD
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
firstTD
=
userInfoArry
[
i
].
split
(
"="
);
String
code
=
firstTD
[
firstTD
.
length
-
1
];
String
code
=
firstTD
[
firstTD
.
length
-
1
];
userInfos
.
put
(
FIRST_TD
,
StringUtil
.
isEmpty
(
code
)
||
"undefined"
.
equalsIgnoreCase
(
code
)
||
"null"
.
equalsIgnoreCase
(
code
)
?
null
userInfos
.
put
(
FIRST_TD
,
parseLong
(
code
));
:
NumberUtil
.
toLong
(
code
));
}
}
if
(
userInfoArry
[
i
].
contains
(
SECOND_TD
))
{
if
(
userInfoArry
[
i
].
contains
(
SECOND_TD
))
{
String
[]
secondTD
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
secondTD
=
userInfoArry
[
i
].
split
(
"="
);
String
code
=
secondTD
[
secondTD
.
length
-
1
];
String
code
=
secondTD
[
secondTD
.
length
-
1
];
userInfos
.
put
(
SECOND_TD
,
StringUtil
.
isEmpty
(
code
)
||
"undefined"
.
equalsIgnoreCase
(
code
)
||
"null"
.
equalsIgnoreCase
(
code
)
?
null
userInfos
.
put
(
SECOND_TD
,
parseLong
(
code
));
:
NumberUtil
.
toLong
(
code
));
}
}
// add by gaop at 2019年5月6日16:23:32
// add by gaop at 2019年5月6日16:23:32
if
(
userInfoArry
[
i
].
contains
(
BOOK_GROUP_ID
))
{
if
(
userInfoArry
[
i
].
contains
(
BOOK_GROUP_ID
))
{
String
[]
bookGroupId
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
bookGroupId
=
userInfoArry
[
i
].
split
(
"="
);
String
code
=
bookGroupId
[
bookGroupId
.
length
-
1
];
String
code
=
bookGroupId
[
bookGroupId
.
length
-
1
];
userInfos
.
put
(
BOOK_GROUP_ID
,
StringUtil
.
isEmpty
(
code
)
||
"undefined"
.
equalsIgnoreCase
(
code
)
||
"null"
.
equalsIgnoreCase
(
code
)
?
null
userInfos
.
put
(
BOOK_GROUP_ID
,
parseLong
(
code
));
:
NumberUtil
.
toLong
(
code
));
}
}
if
(
userInfoArry
[
i
].
contains
(
CLASSIFY_ID
))
{
if
(
userInfoArry
[
i
].
contains
(
CLASSIFY_ID
))
{
String
[]
classifyId
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
classifyId
=
userInfoArry
[
i
].
split
(
"="
);
String
code
=
classifyId
[
classifyId
.
length
-
1
];
String
code
=
classifyId
[
classifyId
.
length
-
1
];
userInfos
.
put
(
CLASSIFY_ID
,
StringUtil
.
isEmpty
(
code
)
||
"undefined"
.
equalsIgnoreCase
(
code
)
||
"null"
.
equalsIgnoreCase
(
code
)
?
null
userInfos
.
put
(
CLASSIFY_ID
,
parseLong
(
code
));
:
NumberUtil
.
toLong
(
code
));
}
}
if
(
userInfoArry
[
i
].
contains
(
QRCODE_ID
))
{
if
(
userInfoArry
[
i
].
contains
(
QRCODE_ID
))
{
String
[]
qrcodeId
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
qrcodeId
=
userInfoArry
[
i
].
split
(
"="
);
String
code
=
qrcodeId
[
qrcodeId
.
length
-
1
];
String
code
=
qrcodeId
[
qrcodeId
.
length
-
1
];
userInfos
.
put
(
QRCODE_ID
,
StringUtil
.
isEmpty
(
code
)
||
"undefined"
.
equalsIgnoreCase
(
code
)
||
"null"
.
equalsIgnoreCase
(
code
)
?
null
userInfos
.
put
(
QRCODE_ID
,
parseLong
(
code
));
:
NumberUtil
.
toLong
(
code
));
}
}
if
(
userInfoArry
[
i
].
contains
(
MAIN_USER_ID
))
{
if
(
userInfoArry
[
i
].
contains
(
MAIN_USER_ID
))
{
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
String
mainUserId
=
user
[
user
.
length
-
1
];
String
mainUserId
=
user
[
user
.
length
-
1
];
userInfos
.
put
(
"mainUserId"
,
StringUtil
.
isEmpty
(
mainUserId
)
||
"undefined"
.
equalsIgnoreCase
(
mainUserId
)
userInfos
.
put
(
"mainUserId"
,
StringUtil
.
isEmpty
(
mainUserId
)
||
"undefined"
.
equalsIgnoreCase
(
mainUserId
)
||
"null"
.
equalsIgnoreCase
(
mainUserId
)
?
null
:
(!
mainUserId
.
equals
(
"-1"
)
?
NumberUtil
.
toLong
(
mainUserId
)
:
-
1
));
||
"null"
.
equalsIgnoreCase
(
mainUserId
)
||
!
NumberUtil
.
isDigits
(
mainUserId
)
?
null
:
(!
mainUserId
.
equals
(
"-1"
)
?
NumberUtil
.
toLong
(
mainUserId
)
:
-
1
));
}
}
if
(
userInfoArry
[
i
].
contains
(
USER_LABEL
))
{
if
(
userInfoArry
[
i
].
contains
(
USER_LABEL
))
{
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
String
[]
user
=
userInfoArry
[
i
].
split
(
"="
);
...
@@ -298,6 +285,10 @@ public class Cookie {
...
@@ -298,6 +285,10 @@ public class Cookie {
return
userInfos
;
return
userInfos
;
}
}
private
static
Long
parseLong
(
String
channelId
)
{
return
StringUtil
.
isBlank
(
channelId
)
||
!
NumberUtil
.
isDigits
(
channelId
)
?
null
:
NumberUtil
.
toLong
(
channelId
);
}
/**
/**
* 获取对应的ID值
* 获取对应的ID值
* @param userInfo
* @param userInfo
...
@@ -310,7 +301,7 @@ public class Cookie {
...
@@ -310,7 +301,7 @@ public class Cookie {
if
(
Cookie
.
_WECHAT_USER_ID
.
equalsIgnoreCase
(
type
)
&&
StringUtil
.
isEmpty
(
value
)){
if
(
Cookie
.
_WECHAT_USER_ID
.
equalsIgnoreCase
(
type
)
&&
StringUtil
.
isEmpty
(
value
)){
throw
PermissionException
.
PERMISSION_USER_NOT_LOGIN
;
throw
PermissionException
.
PERMISSION_USER_NOT_LOGIN
;
}
}
return
StringUtil
.
isEmpty
(
value
)
||
"undefined"
.
equalsIgnoreCase
(
value
)
||
"null"
.
equalsIgnoreCase
(
value
)
?
null
:
NumberUtil
.
to
Long
(
value
);
return
parse
Long
(
value
);
}
}
/**
/**
...
...
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