Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
aserver
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
15所TongWeb
aserver
Commits
88b7daa6
Commit
88b7daa6
authored
Dec 01, 2020
by
李德才
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加Redis支持
parent
0ed72236
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
SnService.java
src/main/java/com/archser/aserver/service/SnService.java
+16
-1
SN.properties
src/main/webapp/SN.properties
+2
-2
No files found.
src/main/java/com/archser/aserver/service/SnService.java
View file @
88b7daa6
...
@@ -4,6 +4,8 @@ package com.archser.aserver.service;
...
@@ -4,6 +4,8 @@ package com.archser.aserver.service;
import
com.archser.aserver.util.PropertyUtil
;
import
com.archser.aserver.util.PropertyUtil
;
import
com.jfinal.kit.PathKit
;
import
com.jfinal.kit.PathKit
;
import
com.jfinal.kit.PropKit
;
import
com.jfinal.kit.PropKit
;
import
com.jfinal.kit.StrKit
;
import
com.jfinal.plugin.redis.Redis
;
import
java.io.File
;
import
java.io.File
;
...
@@ -13,6 +15,7 @@ import java.io.File;
...
@@ -13,6 +15,7 @@ import java.io.File;
public
class
SnService
{
public
class
SnService
{
private
static
String
FILE_PATH
;
private
static
String
FILE_PATH
;
private
static
final
String
PREFIX
=
"SN_"
;
static
{
static
{
FILE_PATH
=
PathKit
.
getWebRootPath
()
+
File
.
separator
+
"SN.properties"
;
FILE_PATH
=
PathKit
.
getWebRootPath
()
+
File
.
separator
+
"SN.properties"
;
...
@@ -26,7 +29,15 @@ public class SnService {
...
@@ -26,7 +29,15 @@ public class SnService {
* @return
* @return
*/
*/
public
String
getPropertiesValue
(
String
cupCode
)
{
public
String
getPropertiesValue
(
String
cupCode
)
{
return
PropKit
.
use
(
new
File
(
FILE_PATH
)).
get
(
cupCode
);
Object
redisSnCode
=
Redis
.
use
().
get
(
PREFIX
+
cupCode
);
if
(
redisSnCode
!=
null
)
{
return
redisSnCode
.
toString
();
}
String
fileSnCode
=
PropertyUtil
.
getProperty
(
cupCode
,
FILE_PATH
);
if
(
StrKit
.
notBlank
(
fileSnCode
))
{
saveSnToRedis
(
PREFIX
+
cupCode
,
fileSnCode
);
}
return
fileSnCode
;
}
}
...
@@ -40,5 +51,9 @@ public class SnService {
...
@@ -40,5 +51,9 @@ public class SnService {
PropertyUtil
.
setProperty
(
cupCode
,
snCode
,
FILE_PATH
);
PropertyUtil
.
setProperty
(
cupCode
,
snCode
,
FILE_PATH
);
}
}
public
String
saveSnToRedis
(
String
cpuCode
,
String
snCode
)
{
return
Redis
.
use
().
set
(
cpuCode
,
snCode
);
}
}
}
src/main/webapp/SN.properties
View file @
88b7daa6
#Tue Dec 01 16:
02:5
9 CST 2020
#Tue Dec 01 16:
30:0
9 CST 2020
AAAAAAAAAAAAAAA
=
cdcd
cdc
dcdc
AAAAAAAAAAAAAAA
=
cdcd
scdscs
dcdc
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