Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
e78f08fd
Commit
e78f08fd
authored
Mar 17, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sdk版本
parent
83299a7a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
ApplicationController.java
...c/haoban/manage/web/controller/ApplicationController.java
+41
-0
No files found.
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ApplicationController.java
View file @
e78f08fd
package
com
.
gic
.
haoban
.
manage
.
web
.
controller
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -26,6 +30,10 @@ public class ApplicationController extends WebBaseController{
private
ApplicationApiService
applicationApiService
;
@Autowired
private
ApplicationSettingApiService
applicationSettingApiService
;
private
static
final
String
SDKVERSION_KEY
=
"haoban-wx-sdk-version"
;
@RequestMapping
(
"application-list"
)
public
HaobanResponse
applicationList
(
String
wxEnterpriseId
)
{
...
...
@@ -63,4 +71,37 @@ public class ApplicationController extends WebBaseController{
}
@RequestMapping
(
"sdk-version-check"
)
public
HaobanResponse
sdkVersionCheck
(
String
skdVersion
)
{
if
(
StringUtils
.
isBlank
(
skdVersion
))
{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
Object
cache
=
RedisUtil
.
getCache
(
SDKVERSION_KEY
);
if
(
null
==
cache
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
String
limitSdkVersion
=
cache
.
toString
();
String
[]
limitSdk
=
limitSdkVersion
.
split
(
"."
);
String
[]
versionSplit
=
skdVersion
.
split
(
"."
);
int
checkFlag
=
checkNum
(
Integer
.
valueOf
(
limitSdk
[
0
]),
Integer
.
valueOf
(
versionSplit
[
0
]));
if
(
checkFlag
!=
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
checkFlag
>
0
?
true
:
false
);
}
checkFlag
=
checkNum
(
Integer
.
valueOf
(
limitSdk
[
1
]),
Integer
.
valueOf
(
versionSplit
[
1
]));
if
(
checkFlag
!=
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
checkFlag
>
0
?
true
:
false
);
}
checkFlag
=
checkNum
(
Integer
.
valueOf
(
limitSdk
[
2
]),
Integer
.
valueOf
(
versionSplit
[
2
]));
if
(
checkFlag
!=
0
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
checkFlag
>
0
?
true
:
false
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
private
int
checkNum
(
int
limit
,
int
cur
)
{
return
cur
>
limit
?
1
:
(
cur
==
limit
?
0
:
-
1
);
}
}
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