Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
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
civil
civil-bigdata
Commits
a8c391a3
Commit
a8c391a3
authored
Jun 22, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改启动
parent
05c21c4a
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
60 additions
and
185 deletions
+60
-185
api-server/src/main/java/com/zq/api/ApiApplication.java
+0
-4
api-server/src/main/java/com/zq/api/config/ApiTokenUtils.java
+0
-104
config-server/src/main/resources/properties/config-product.yml
+2
-2
portal-server/src/main/java/com/zq/portal/controller/admin/PeopleController.java
+2
-2
portal-server/src/main/java/com/zq/portal/controller/admin/PortalController.java
+2
-2
portal-server/src/main/java/com/zq/portal/controller/admin/SearchController.java
+2
-2
portal-server/src/main/java/com/zq/portal/controller/admin/StatsAdminController.java
+3
-3
portal-server/src/main/java/com/zq/portal/controller/app/StatsController.java
+17
-0
portal-server/src/main/java/com/zq/portal/controller/app/UserController.java
+5
-0
portal-server/src/main/java/com/zq/portal/dao/StatsDao.java
+7
-0
portal-server/src/main/java/com/zq/portal/feign/UploadServerFeignClient.java
+0
-61
portal-server/src/main/java/com/zq/portal/manager/PortalCacheManager.java
+1
-5
portal-server/src/main/java/com/zq/portal/service/StatsService.java
+14
-0
portal-server/src/main/resources/mapper/StatsMapper.xml
+5
-0
No files found.
api-server/src/main/java/com/zq/api/ApiApplication.java
View file @
a8c391a3
...
...
@@ -22,8 +22,4 @@ public class ApiApplication {
SpringApplication
.
run
(
ApiApplication
.
class
,
args
);
}
@Bean
public
SpringContextHolder
springContextHolder
()
{
return
new
SpringContextHolder
();
}
}
api-server/src/main/java/com/zq/api/config/ApiTokenUtils.java
deleted
100644 → 0
View file @
05c21c4a
package
com
.
zq
.
api
.
config
;
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
com.alibaba.fastjson.JSON
;
import
com.zq.common.config.security.SecurityProperties
;
import
com.zq.common.vo.ApiTokenVo
;
import
io.jsonwebtoken.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Component
;
import
javax.crypto.spec.SecretKeySpec
;
import
javax.xml.bind.DatatypeConverter
;
import
java.security.Key
;
import
java.util.Date
;
/**
* @author /
*/
@Slf4j
@Component
public
class
ApiTokenUtils
implements
InitializingBean
{
private
static
SecurityProperties
properties
;
private
static
final
String
APP_TOKEN_KEY
=
"appToken"
;
private
static
Key
key
;
private
static
SignatureAlgorithm
signatureAlgorithm
;
public
ApiTokenUtils
(
SecurityProperties
securityProperties
)
{
ApiTokenUtils
.
properties
=
securityProperties
;
}
@Override
public
void
afterPropertiesSet
()
{
signatureAlgorithm
=
SignatureAlgorithm
.
HS512
;
byte
[]
keyBytes
=
DatatypeConverter
.
parseBase64Binary
(
properties
.
getBase64Secret
());
key
=
new
SecretKeySpec
(
keyBytes
,
signatureAlgorithm
.
getJcaName
());
}
public
static
String
createToken
(
ApiTokenVo
tokenVo
,
long
minutes
)
{
long
nowMillis
=
System
.
currentTimeMillis
();
Date
now
=
new
Date
(
nowMillis
);
JwtBuilder
jwtBuilder
=
Jwts
.
builder
()
.
setSubject
(
tokenVo
.
getPhone
())
.
setIssuedAt
(
now
)
.
claim
(
APP_TOKEN_KEY
,
tokenVo
)
.
signWith
(
signatureAlgorithm
,
key
)
// 加入ID确保生成的 Token 都不一致
.
setId
(
tokenVo
.
getUserId
().
toString
());
if
(
minutes
>=
0
)
{
long
expMillis
=
nowMillis
+
(
minutes
*
60
*
1000
);
Date
exp
=
new
Date
(
expMillis
);
jwtBuilder
.
setExpiration
(
exp
);
}
return
jwtBuilder
.
compact
();
}
public
static
ApiTokenVo
getAppTokenVo
(
String
token
)
{
try
{
Claims
claims
=
Jwts
.
parser
()
.
setSigningKey
(
DatatypeConverter
.
parseBase64Binary
(
properties
.
getBase64Secret
()))
.
parseClaimsJws
(
token
)
.
getBody
();
// fix bug: 当前用户如果没有任何权限时,在输入用户名后,刷新验证码会抛IllegalArgumentException
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
claims
.
get
(
APP_TOKEN_KEY
)),
ApiTokenVo
.
class
);
}
catch
(
Exception
e
)
{
return
null
;
}
}
public
static
boolean
isTokenValid
(
String
token
)
{
try
{
//解析JWT字符串中的数据,并进行最基础的验证
Claims
claims
=
Jwts
.
parser
()
.
setSigningKey
(
DatatypeConverter
.
parseBase64Binary
(
properties
.
getBase64Secret
()))
.
parseClaimsJws
(
token
)
.
getBody
();
return
true
;
}
//在解析JWT字符串时,如果密钥不正确,将会解析失败,抛出SignatureException异常,说明该JWT字符串是伪造的
//在解析JWT字符串时,如果‘过期时间字段’已经早于当前时间,将会抛出ExpiredJwtException异常,说明本次请求已经失效
catch
(
SignatureException
|
ExpiredJwtException
e
)
{
return
false
;
}
}
}
config-server/src/main/resources/properties/config-product.yml
View file @
a8c391a3
...
...
@@ -10,8 +10,8 @@ file.name: FILE-SERVER
api.port
:
9100
api.name
:
API-SERVER
cms
.port
:
9700
cms.name
:
CMS
-SERVER
portal
.port
:
9700
portal.name
:
PORTAL
-SERVER
gateway.port
:
9888
gateway.name
:
GATEWAY-SERVER
...
...
portal-server/src/main/java/com/zq/portal/controller/PeopleController.java
→
portal-server/src/main/java/com/zq/portal/controller/
admin/
PeopleController.java
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
;
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.PeopleService
;
...
...
@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/portal/people/"
)
@RequestMapping
(
"/portal/
admin/
people/"
)
public
class
PeopleController
{
@Autowired
private
PeopleService
peopleService
;
...
...
portal-server/src/main/java/com/zq/portal/controller/PortalController.java
→
portal-server/src/main/java/com/zq/portal/controller/
admin/
PortalController.java
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
;
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.zq.common.annotation.AnonymousAccess
;
import
org.springframework.stereotype.Controller
;
...
...
@@ -6,7 +6,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
(
"/portal"
)
@RequestMapping
(
"/portal
/admin
"
)
public
class
PortalController
{
@AnonymousAccess
...
...
portal-server/src/main/java/com/zq/portal/controller/SearchController.java
→
portal-server/src/main/java/com/zq/portal/controller/
admin/
SearchController.java
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
;
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.portal.service.SearchService
;
...
...
@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/portal/search/"
)
@RequestMapping
(
"/portal/
admin/
search/"
)
public
class
SearchController
{
@Autowired
...
...
portal-server/src/main/java/com/zq/portal/controller/
Stats
Controller.java
→
portal-server/src/main/java/com/zq/portal/controller/
admin/StatsAdmin
Controller.java
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
;
package
com
.
zq
.
portal
.
controller
.
admin
;
import
com.alibaba.fastjson.JSONObject
;
import
com.zq.common.context.ContextUtils
;
...
...
@@ -17,8 +17,8 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/portal/stats/"
)
public
class
StatsController
{
@RequestMapping
(
"/portal/
admin/
stats/"
)
public
class
Stats
Admin
Controller
{
@Autowired
private
StatsServerFeignClient
statsFegin
;
@Autowired
...
...
portal-server/src/main/java/com/zq/portal/controller/app/StatsController.java
0 → 100644
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
.
app
;
import
com.zq.portal.service.StatsService
;
import
io.swagger.annotations.Api
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
"统计相关接口"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
value
=
"/portal/app/stats"
)
public
class
StatsController
{
public
final
StatsService
statsService
;
}
portal-server/src/main/java/com/zq/portal/controller/app/UserController.java
0 → 100644
View file @
a8c391a3
package
com
.
zq
.
portal
.
controller
.
app
;
public
class
UserController
{
}
portal-server/src/main/java/com/zq/portal/dao/StatsDao.java
0 → 100644
View file @
a8c391a3
package
com
.
zq
.
portal
.
dao
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
StatsDao
{
}
portal-server/src/main/java/com/zq/portal/feign/UploadServerFeignClient.java
deleted
100644 → 0
View file @
05c21c4a
package
com
.
zq
.
portal
.
feign
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.common.vo.UploadVo
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
@Component
public
class
UploadServerFeignClient
{
RestTemplate
restTemplate
=
new
RestTemplate
();
String
FileServer
=
"http://localhost:9500"
;
String
xmlServer
=
"http://localhost:10230"
;
/**
* 上传xml 解析
*
* @param vo
* @return
*/
public
ResultVo
uploadXmlFile
(
UploadVo
vo
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
MultiValueMap
<
String
,
Object
>
parts
=
new
LinkedMultiValueMap
<>();
parts
.
add
(
"file"
,
vo
.
getFile
().
getResource
());
parts
.
add
(
"systemName"
,
vo
.
getSystemName
());
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
httpEntity
=
new
HttpEntity
<>(
parts
,
headers
);
ResponseEntity
<
ResultVo
>
responseEntity
=
restTemplate
.
postForEntity
(
xmlServer
+
"/xml/doMain"
,
httpEntity
,
ResultVo
.
class
);
return
responseEntity
.
getBody
();
}
// /**
// * 上传图片
// *
// * @param vo
// * @return
// */
// public ResultVo uploadImage(UploadVo vo) {
// return restTemplate.postForObject(FileServer + "/file/uploadImage", vo, ResultVo.class);
// }
//
// /**
// * 上传文件
// *
// * @param vo
// * @return
// */
// public ResultVo uploadFile(UploadVo vo) {
// return restTemplate.postForObject(FileServer + "/file/uploadFile", vo, ResultVo.class);
// }
}
portal-server/src/main/java/com/zq/portal/manager/PortalCacheManager.java
View file @
a8c391a3
...
...
@@ -19,7 +19,6 @@ public class PortalCacheManager extends RedisUtils {
super
(
stringRedisTemplate
,
redisTemplate
);
}
/**
* 获取缓存的区域统计数据
*
...
...
@@ -68,7 +67,6 @@ public class PortalCacheManager extends RedisUtils {
setStr
(
"peopleType"
,
JSONObject
.
toJSONString
(
param
));
}
/**
* 获取残疾人相关类型人口
*
...
...
@@ -79,7 +77,6 @@ public class PortalCacheManager extends RedisUtils {
return
getStr
(
"peopleType"
);
}
/**
* 缓存残疾人相关类型人口
*
...
...
@@ -90,7 +87,6 @@ public class PortalCacheManager extends RedisUtils {
setStr
(
"CountTableData"
,
JSONObject
.
toJSONString
(
data
));
}
/**
* 获取残疾人相关类型人口
*
...
...
@@ -137,7 +133,6 @@ public class PortalCacheManager extends RedisUtils {
return
getStr
(
"CJYLCount"
);
}
public
void
cachePeopleBaseDataNum
(
CountVo
data
)
{
setStr
(
"PeopleBaseDataNum"
,
JSONObject
.
toJSONString
(
data
));
}
...
...
@@ -174,4 +169,5 @@ public class PortalCacheManager extends RedisUtils {
public
void
cacheCJYLCount
(
int
count
)
{
setStr
(
"CJYLCount"
,
JSONObject
.
toJSONString
(
count
));
}
}
portal-server/src/main/java/com/zq/portal/service/StatsService.java
0 → 100644
View file @
a8c391a3
package
com
.
zq
.
portal
.
service
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
@Service
@RequiredArgsConstructor
public
class
StatsService
{
public
Object
getMapData
()
{
return
null
;
}
}
portal-server/src/main/resources/mapper/StatsMapper.xml
0 → 100644
View file @
a8c391a3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zq.portal.dao.StatsDao"
>
</mapper>
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