Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
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
shenjunjie
brandkbs2
Commits
e288a59e
Commit
e288a59e
authored
Dec 18, 2024
by
shenjunjie
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' into 'master'
Release See merge request
!606
parents
cc336ddc
450d4453
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
127 additions
and
8 deletions
+127
-8
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
+28
-0
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
+6
-0
src/main/java/com/zhiwei/brandkbs2/service/impl/SearchWholeServiceImpl.java
+10
-8
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
+28
-0
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
+49
-0
src/main/resources/application-dev.properties
+2
-0
src/main/resources/application-local.properties
+2
-0
src/main/resources/application-prod.properties
+2
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/auth/AuthAspect.java
View file @
e288a59e
...
@@ -2,11 +2,13 @@ package com.zhiwei.brandkbs2.auth;
...
@@ -2,11 +2,13 @@ package com.zhiwei.brandkbs2.auth;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.enmus.RoleEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.CommonCodeEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.pojo.UserInfo
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
...
@@ -17,6 +19,7 @@ import org.aspectj.lang.annotation.Around;
...
@@ -17,6 +19,7 @@ import org.aspectj.lang.annotation.Around;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -26,10 +29,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
...
@@ -26,10 +29,13 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* @author sjj
* @author sjj
...
@@ -49,6 +55,9 @@ public class AuthAspect {
...
@@ -49,6 +55,9 @@ public class AuthAspect {
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
UserService
;
private
UserService
UserService
;
@Autowired
private
RedisUtil
redisUtil
;
@Pointcut
(
"execution(com.zhiwei.brandkbs2.model.ResponseResult com.zhiwei.brandkbs2.controller..*.*(..))"
)
@Pointcut
(
"execution(com.zhiwei.brandkbs2.model.ResponseResult com.zhiwei.brandkbs2.controller..*.*(..))"
)
// @Pointcut("within(com.zhiwei.brandkbs2.controller..*)")
// @Pointcut("within(com.zhiwei.brandkbs2.controller..*)")
public
void
auth
()
{
public
void
auth
()
{
...
@@ -82,6 +91,10 @@ public class AuthAspect {
...
@@ -82,6 +91,10 @@ public class AuthAspect {
log
.
error
(
"token解析异常,uri:{},methodName:{},token:{}"
,
uri
,
methodName
,
token
);
log
.
error
(
"token解析异常,uri:{},methodName:{},token:{}"
,
uri
,
methodName
,
token
);
}
else
{
}
else
{
String
uid
=
tokenInfo
.
get
(
GenericAttribute
.
USER_ID
).
toString
();
String
uid
=
tokenInfo
.
get
(
GenericAttribute
.
USER_ID
).
toString
();
// session单账号登录限制校验
// if (!checkSession(request, uid)){
// return joinPoint.proceed();
// }
UserInfo
userInfo
=
UserService
.
queryUserInfo
(
uid
,
request
.
getHeader
(
"pid"
));
UserInfo
userInfo
=
UserService
.
queryUserInfo
(
uid
,
request
.
getHeader
(
"pid"
));
if
(
null
==
userInfo
)
{
if
(
null
==
userInfo
)
{
userInfo
=
new
UserInfo
().
setUserId
(
uid
).
setProjectId
(
request
.
getHeader
(
"pid"
));
userInfo
=
new
UserInfo
().
setUserId
(
uid
).
setProjectId
(
request
.
getHeader
(
"pid"
));
...
@@ -100,6 +113,21 @@ public class AuthAspect {
...
@@ -100,6 +113,21 @@ public class AuthAspect {
return
joinPoint
.
proceed
();
return
joinPoint
.
proceed
();
}
}
private
Boolean
checkSession
(
HttpServletRequest
request
,
String
uid
)
{
// 小程序端不限制
if
(
request
.
getRequestURI
().
contains
(
"/brandkbs/mobile/"
)){
return
true
;
}
HttpSession
session
=
request
.
getSession
();
String
sessionId
=
session
.
getId
();
String
cacheSessionId
=
redisUtil
.
get
(
RedisKeyPrefix
.
userSessionKey
(
uid
));
if
(
null
==
cacheSessionId
)
{
redisUtil
.
setExpire
(
RedisKeyPrefix
.
userSessionKey
(
uid
),
sessionId
,
7
,
TimeUnit
.
DAYS
);
}
// 已登录状态
return
null
==
cacheSessionId
||
Objects
.
equals
(
sessionId
,
cacheSessionId
);
}
// @Around("auth()")
// @Around("auth()")
public
Object
aroundCheckToken
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
public
Object
aroundCheckToken
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
Signature
signature
=
joinPoint
.
getSignature
();
Signature
signature
=
joinPoint
.
getSignature
();
...
...
src/main/java/com/zhiwei/brandkbs2/common/RedisKeyPrefix.java
View file @
e288a59e
...
@@ -128,6 +128,8 @@ public class RedisKeyPrefix {
...
@@ -128,6 +128,8 @@ public class RedisKeyPrefix {
public
static
final
String
AI_SEARCH_QUESTION
=
"BRANDKBS:AI:SEARCH:QUESTION:"
;
public
static
final
String
AI_SEARCH_QUESTION
=
"BRANDKBS:AI:SEARCH:QUESTION:"
;
public
static
final
String
USER_SESSION
=
"BRANDKBS:USER:SESSION:"
;
public
static
String
projectWarnHotTopKeyAll
(
String
projectId
,
String
type
)
{
public
static
String
projectWarnHotTopKeyAll
(
String
projectId
,
String
type
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
PROJECT_WARN_HOT_TOP
,
projectId
,
Tools
.
concat
(
type
,
"*"
));
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
PROJECT_WARN_HOT_TOP
,
projectId
,
Tools
.
concat
(
type
,
"*"
));
}
}
...
@@ -168,6 +170,10 @@ public class RedisKeyPrefix {
...
@@ -168,6 +170,10 @@ public class RedisKeyPrefix {
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
HOT_SUPPLEMENT_WORD
,
projectId
);
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
HOT_SUPPLEMENT_WORD
,
projectId
);
}
}
public
static
String
userSessionKey
(
String
userId
)
{
return
RedisKeyPrefix
.
generateRedisKey
(
RedisKeyPrefix
.
USER_SESSION
,
userId
);
}
private
static
String
generateRedisKey
(
String
...
keys
)
{
private
static
String
generateRedisKey
(
String
...
keys
)
{
Objects
.
requireNonNull
(
keys
);
Objects
.
requireNonNull
(
keys
);
boolean
contains
=
keys
[
0
].
endsWith
(
":"
);
boolean
contains
=
keys
[
0
].
endsWith
(
":"
);
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/SearchWholeServiceImpl.java
View file @
e288a59e
...
@@ -889,16 +889,17 @@ public class SearchWholeServiceImpl implements SearchWholeService {
...
@@ -889,16 +889,17 @@ public class SearchWholeServiceImpl implements SearchWholeService {
long
count
=
bucket
.
getDocCount
();
long
count
=
bucket
.
getDocCount
();
res
.
add
(
new
LineVO
(
count
,
time
));
res
.
add
(
new
LineVO
(
count
,
time
));
});
});
List
<
LineVO
>
resLine
=
Tools
.
completeLine
(
res
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
// 由于结束点为开区间,将结束点数据补完
// 由于结束点为开区间,将结束点数据补完
if
(
CollectionUtils
.
isNotEmpty
(
res
)){
if
(
CollectionUtils
.
isNotEmpty
(
res
Line
)){
res
.
get
(
0
).
setDate
(
dto
.
getStartTime
());
//
res.get(0).setDate(dto.getStartTime());
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
searchFilterDTO
.
setEndTime
(
dto
.
getEndTime
()
+
1
);
searchFilterDTO
.
setEndTime
(
dto
.
getEndTime
()
+
1
);
Long
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
Long
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
res
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
res
Line
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
}
}
return
res
;
return
res
Line
;
}
}
/**
/**
...
@@ -966,9 +967,10 @@ public class SearchWholeServiceImpl implements SearchWholeService {
...
@@ -966,9 +967,10 @@ public class SearchWholeServiceImpl implements SearchWholeService {
platformLines
.
forEach
((
k1
,
v1
)
->
{
platformLines
.
forEach
((
k1
,
v1
)
->
{
List
<
LineVO
>
line
=
new
ArrayList
<>();
List
<
LineVO
>
line
=
new
ArrayList
<>();
v1
.
forEach
((
k2
,
v2
)
->
line
.
add
(
new
LineVO
(
v2
,
Long
.
valueOf
(
k2
))));
v1
.
forEach
((
k2
,
v2
)
->
line
.
add
(
new
LineVO
(
v2
,
Long
.
valueOf
(
k2
))));
List
<
LineVO
>
resLine
=
Tools
.
completeLine
(
line
,
dto
.
getStartTime
(),
dto
.
getEndTime
());
// 结束点数据补充完全
// 结束点数据补充完全
if
(
CollectionUtils
.
isNotEmpty
(
l
ine
)){
if
(
CollectionUtils
.
isNotEmpty
(
resL
ine
)){
line
.
get
(
0
).
setDate
(
dto
.
getStartTime
());
//
line.get(0).setDate(dto.getStartTime());
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
SearchFilterDTO
searchFilterDTO
=
Tools
.
convertMap
(
dto
,
SearchFilterDTO
.
class
);
searchFilterDTO
.
setPlatforms
(
Collections
.
singletonList
(
GlobalPojo
.
getPlatformIdByName
(
k1
)));
searchFilterDTO
.
setPlatforms
(
Collections
.
singletonList
(
GlobalPojo
.
getPlatformIdByName
(
k1
)));
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
searchFilterDTO
.
setStartTime
(
dto
.
getEndTime
());
...
@@ -978,9 +980,9 @@ public class SearchWholeServiceImpl implements SearchWholeService {
...
@@ -978,9 +980,9 @@ public class SearchWholeServiceImpl implements SearchWholeService {
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
count
=
esClientDao
.
count
(
indexes
,
searchWholeAnalyzeQuery
(
searchFilterDTO
),
null
);
}
catch
(
IOException
ignore
)
{
}
catch
(
IOException
ignore
)
{
}
}
l
ine
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
resL
ine
.
add
(
new
LineVO
(
count
,
dto
.
getEndTime
()));
}
}
res
.
put
(
k1
,
l
ine
);
res
.
put
(
k1
,
resL
ine
);
});
});
return
res
;
return
res
;
}
}
...
...
src/main/java/com/zhiwei/brandkbs2/service/impl/UserServiceImpl.java
View file @
e288a59e
...
@@ -3,7 +3,9 @@ package com.zhiwei.brandkbs2.service.impl;
...
@@ -3,7 +3,9 @@ package com.zhiwei.brandkbs2.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.auth.UserThreadLocal
;
import
com.zhiwei.brandkbs2.common.GenericAttribute
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.GlobalPojo
;
import
com.zhiwei.brandkbs2.common.RedisKeyPrefix
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.config.Constant
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.ProjectDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
import
com.zhiwei.brandkbs2.dao.UserDao
;
...
@@ -24,8 +26,10 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
...
@@ -24,8 +26,10 @@ import com.zhiwei.brandkbs2.pojo.vo.PageVO;
import
com.zhiwei.brandkbs2.service.UserCenterService
;
import
com.zhiwei.brandkbs2.service.UserCenterService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.service.UserService
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.MongoUtil
;
import
com.zhiwei.brandkbs2.util.RedisUtil
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.brandkbs2.util.Tools
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
com.zhiwei.middleware.auth.pojo.CenterUser
;
import
com.zhiwei.middleware.auth.util.JwtUtil
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.Logger
;
...
@@ -38,9 +42,13 @@ import org.springframework.http.HttpEntity;
...
@@ -38,9 +42,13 @@ import org.springframework.http.HttpEntity;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -87,6 +95,12 @@ public class UserServiceImpl implements UserService {
...
@@ -87,6 +95,12 @@ public class UserServiceImpl implements UserService {
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Autowired
private
RedisUtil
redisUtil
;
@Value
(
"${jwt.key}"
)
private
String
jwtKey
;
@Override
@Override
public
UserInfo
login
()
{
public
UserInfo
login
()
{
String
uid
=
UserThreadLocal
.
getUserId
();
String
uid
=
UserThreadLocal
.
getUserId
();
...
@@ -367,6 +381,7 @@ public class UserServiceImpl implements UserService {
...
@@ -367,6 +381,7 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
boolean
checkUserRoles
()
{
public
boolean
checkUserRoles
()
{
// String uid = saveLoginUserSession();
User
user
=
userDao
.
findOneById
(
UserThreadLocal
.
getUserId
());
User
user
=
userDao
.
findOneById
(
UserThreadLocal
.
getUserId
());
if
(
null
==
user
)
{
if
(
null
==
user
)
{
return
false
;
return
false
;
...
@@ -374,6 +389,19 @@ public class UserServiceImpl implements UserService {
...
@@ -374,6 +389,19 @@ public class UserServiceImpl implements UserService {
return
user
.
isSuperAdmin
()
||
!
CollectionUtils
.
isEmpty
(
user
.
getRoles
());
return
user
.
isSuperAdmin
()
||
!
CollectionUtils
.
isEmpty
(
user
.
getRoles
());
}
}
/**
* 记录登录用户的session 用于单账号登录限制session校验
* @return
*/
private
String
saveLoginUserSession
(){
ServletRequestAttributes
servletRequestAttributes
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
());
HttpServletRequest
request
=
Objects
.
requireNonNull
(
servletRequestAttributes
).
getRequest
();
Map
<
String
,
Object
>
map
=
JwtUtil
.
unsign
(
request
.
getHeader
(
jwtKey
),
Map
.
class
);
String
userId
=
map
.
get
(
GenericAttribute
.
USER_ID
).
toString
();
redisUtil
.
setExpire
(
RedisKeyPrefix
.
userSessionKey
(
userId
),
request
.
getSession
().
getId
(),
7
,
TimeUnit
.
DAYS
);
return
userId
;
}
@Override
@Override
public
void
resetBind
(
String
username
)
{
public
void
resetBind
(
String
username
)
{
String
uid
=
UserThreadLocal
.
getUserId
();
String
uid
=
UserThreadLocal
.
getUserId
();
...
...
src/main/java/com/zhiwei/brandkbs2/util/Tools.java
View file @
e288a59e
...
@@ -17,6 +17,7 @@ import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
...
@@ -17,6 +17,7 @@ import com.zhiwei.brandkbs2.easyexcel.dto.UploadKeywordDTO;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.enmus.EmotionEnum
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.model.ResponseResult
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.BaseMap
;
import
com.zhiwei.brandkbs2.pojo.vo.LineVO
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.MessagePlatform
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.pojo.common.Tag
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
import
com.zhiwei.qbjc.bean.tools.BeanTools
;
...
@@ -1422,4 +1423,51 @@ public class Tools {
...
@@ -1422,4 +1423,51 @@ public class Tools {
}
}
return
new
Long
[]{
calendar1
.
getTime
().
getTime
(),
calendar2
.
getTime
().
getTime
()};
return
new
Long
[]{
calendar1
.
getTime
().
getTime
(),
calendar2
.
getTime
().
getTime
()};
}
}
/**
* 补全图谱
* @param lines
* @param startTime
* @param endTime
* @return
*/
public
static
List
<
LineVO
>
completeLine
(
List
<
LineVO
>
lines
,
Long
startTime
,
Long
endTime
){
int
size
=
endTime
-
startTime
>
7
*
Constant
.
ONE_DAY
?
30
:
(
endTime
-
startTime
<=
Constant
.
ONE_DAY
?
24
:
7
);
long
timeRange
=
7
==
size
||
30
==
size
?
Constant
.
ONE_DAY
:
Constant
.
ONE_HOUR
;
if
(
lines
.
size
()
<
size
){
// 无数据,按时间段全部补为0
if
(
CollectionUtils
.
isEmpty
(
lines
)){
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
lines
.
add
(
new
LineVO
(
0L
,
startTime
));
startTime
=
startTime
+
timeRange
;
if
(
startTime
>=
endTime
||
lines
.
size
()
>=
size
){
break
;
}
}
return
lines
;
}
else
{
// 往前补0
LineVO
startLine
=
lines
.
get
(
0
);
Long
startLineTime
=
startLine
.
getDate
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
startLineTime
=
startLineTime
-
timeRange
;
if
(
startLineTime
<=
startTime
||
lines
.
size
()
>=
size
){
break
;
}
lines
.
add
(
0
,
new
LineVO
(
0L
,
startLineTime
));
}
// 往后补0
LineVO
endLine
=
lines
.
get
(
lines
.
size
()
-
1
);
Long
endLineTime
=
endLine
.
getDate
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
endLineTime
=
endLineTime
+
timeRange
;
if
(
endLineTime
>=
endTime
||
lines
.
size
()
>=
size
){
break
;
}
lines
.
add
(
new
LineVO
(
0L
,
endLineTime
));
}
}
}
return
lines
;
}
}
}
\ No newline at end of file
src/main/resources/application-dev.properties
View file @
e288a59e
...
@@ -16,6 +16,8 @@ brandkbs.head.url=/usr/local/sources/brandkbs2/head/
...
@@ -16,6 +16,8 @@ brandkbs.head.url=/usr/local/sources/brandkbs2/head/
brandkbs.image.url
=
https://brandkbs.test.zhiweidata.com/brandkbs/images/
brandkbs.image.url
=
https://brandkbs.test.zhiweidata.com/brandkbs/images/
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
#session\u8FC7\u671F\u65F6\u95F4
server.servlet.session.timeout
=
604800
#redis
#redis
spring.redis.host
=
192.168.0.39
spring.redis.host
=
192.168.0.39
...
...
src/main/resources/application-local.properties
View file @
e288a59e
...
@@ -16,6 +16,8 @@ brandkbs.head.url=D:\\ExcelTest\\
...
@@ -16,6 +16,8 @@ brandkbs.head.url=D:\\ExcelTest\\
brandkbs.image.url
=
https://brandkbs.zhiweidata.com/brandkbs/images/
brandkbs.image.url
=
https://brandkbs.zhiweidata.com/brandkbs/images/
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
#session\u8FC7\u671F\u65F6\u95F4
server.servlet.session.timeout
=
604800
#redis \u6D4B\u8BD5
#redis \u6D4B\u8BD5
spring.redis.host
=
192.168.0.24
spring.redis.host
=
192.168.0.24
...
...
src/main/resources/application-prod.properties
View file @
e288a59e
...
@@ -16,6 +16,8 @@ brandkbs.head.url=/usr/local/sources/brandkbs2/head/
...
@@ -16,6 +16,8 @@ brandkbs.head.url=/usr/local/sources/brandkbs2/head/
brandkbs.image.url
=
https://brandkbs.zhiweidata.com/brandkbs/images/
brandkbs.image.url
=
https://brandkbs.zhiweidata.com/brandkbs/images/
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
#\u56FE\u7247\u8D44\u6E90\u8DEF\u5F84
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
cbs.imagesPath
=
file:${brandkbs.img.url},file:${brandkbs.head.url}
#session\u8FC7\u671F\u65F6\u95F4
server.servlet.session.timeout
=
604800
#redis
#redis
spring.redis.host
=
192.168.0.39
spring.redis.host
=
192.168.0.39
...
...
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