Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dc-cost-system
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
bltdc
dc-cost-system
Commits
64fbbfdb
Commit
64fbbfdb
authored
Dec 18, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登陆
parent
ec8c88a7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
5 deletions
+91
-5
pom.xml
bailuntec-cost-core/pom.xml
+6
-0
JwtUtil.java
...core/src/main/java/com/blt/other/common/util/JwtUtil.java
+59
-0
SpecDepartmentCheckConfigController.java
.../cost/controller/SpecDepartmentCheckConfigController.java
+1
-2
application-prod.yml
bailuntec-cost-core/src/main/resources/application-prod.yml
+1
-3
Cost.xml
bailuntec-cost-core/src/main/resources/mapper/Cost.xml
+3
-0
JwtUtilTest.java
.../src/test/java/com/blt/other/common/util/JwtUtilTest.java
+21
-0
No files found.
bailuntec-cost-core/pom.xml
View file @
64fbbfdb
...
@@ -42,6 +42,12 @@
...
@@ -42,6 +42,12 @@
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
org.bitbucket.b_c
</groupId>
<artifactId>
jose4j
</artifactId>
<version>
0.6.5
</version>
</dependency>
<dependency>
<groupId>
com.bailuntec
</groupId>
<groupId>
com.bailuntec
</groupId>
<artifactId>
bailuntec-cost-api
</artifactId>
<artifactId>
bailuntec-cost-api
</artifactId>
<exclusions>
<exclusions>
...
...
bailuntec-cost-core/src/main/java/com/blt/other/common/util/JwtUtil.java
0 → 100644
View file @
64fbbfdb
package
com
.
blt
.
other
.
common
.
util
;
import
com.bailuntec.common.JsonUtilByFsJson
;
import
lombok.extern.slf4j.Slf4j
;
import
org.jose4j.jwk.RsaJsonWebKey
;
import
org.jose4j.jwt.JwtClaims
;
import
org.jose4j.jwt.consumer.InvalidJwtException
;
import
org.jose4j.jwt.consumer.InvalidJwtSignatureException
;
import
org.jose4j.jwt.consumer.JwtConsumer
;
import
org.jose4j.jwt.consumer.JwtConsumerBuilder
;
import
org.jose4j.lang.JoseException
;
import
java.util.Map
;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/18 11:47 上午
*/
@Slf4j
public
class
JwtUtil
{
/**
* 前缀
*/
public
static
final
String
TOKEN_PREFIX
=
"Bearer "
;
/**
* 功能描述: 解密Bailun Sso Token
*
* @param token jwtToken
* @return 当前登陆用户oaUserId
*/
public
static
void
validateToken
(
String
token
)
{
try
{
JwtConsumer
consumer
=
new
JwtConsumerBuilder
()
.
setVerificationKey
(
new
RsaJsonWebKey
(
JsonUtilByFsJson
.
jsonToBean
(
"{\"kty\":\"RSA\",\"use\":\"sig\",\"kid\":\"0a968baa62e99029a973415887029fbd\",\"e\":\"AQAB\",\"n\":\"1hr9F7WGP6jpixp8kxN2E0BUB23EYiR0jSfdZQsN0ljnZfyqORK6fETVMDxDHB-ueekqieKh7UYJO3Cc3ecC2WCP7Z0KDsGcQBFJd0a9_BBktYv1rDnteJF3v43XkM1gi6gBEtXUb_l-mfpp14His6HtGH8W0v0klBOQ8UsBHDZvOHr2ns_qWPn0i6N86EUe1W47dGSy7fbms3nYQEncNFpnug6x39fJyFxpKjHS_63f2r3QRdf8UlHbjoVsHjg9sJ7pznrxDIIK8heRqH4JiutV8LhagPBVSm8UVHNwdi5IfjmVpYDirBrZDJZq7FwhyZE7ua29a3wP2I08qS9yJw\",\"alg\":\"RS256\"}"
,
Map
.
class
)).
getPublicKey
())
.
build
();
JwtClaims
claims
=
consumer
.
processToClaims
(
token
.
replaceAll
(
TOKEN_PREFIX
,
""
));
if
(
claims
!=
null
)
{
System
.
out
.
println
(
"认证通过!"
);
}
}
catch
(
JoseException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidJwtSignatureException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidJwtException
e
)
{
e
.
printStackTrace
();
}
}
}
bailuntec-cost-core/src/main/java/com/blt/other/module/cost/controller/SpecDepartmentCheckConfigController.java
View file @
64fbbfdb
...
@@ -30,7 +30,6 @@ import java.io.IOException;
...
@@ -30,7 +30,6 @@ import java.io.IOException;
@RequestMapping
(
"/specDepartmentCheckConfig"
)
@RequestMapping
(
"/specDepartmentCheckConfig"
)
public
class
SpecDepartmentCheckConfigController
{
public
class
SpecDepartmentCheckConfigController
{
@Resource
@Resource
ISpecDepartmentCheckConfigService
specDepartmentCheckConfigService
;
ISpecDepartmentCheckConfigService
specDepartmentCheckConfigService
;
...
@@ -58,7 +57,7 @@ public class SpecDepartmentCheckConfigController {
...
@@ -58,7 +57,7 @@ public class SpecDepartmentCheckConfigController {
@ApiOperation
(
"批量导入数据"
)
@ApiOperation
(
"批量导入数据"
)
@PostMapping
(
"/importExcel"
)
@PostMapping
(
"/importExcel"
)
public
CostResult
<
Void
>
importExcel
(
SpecDepartmentCheckImportExcelReq
excel
)
throws
IOException
{
public
CostResult
<
Void
>
importExcel
(
@RequestBody
SpecDepartmentCheckImportExcelReq
excel
)
throws
IOException
{
specDepartmentCheckConfigService
.
importExcel
(
excel
);
specDepartmentCheckConfigService
.
importExcel
(
excel
);
return
CostResult
.
success
();
return
CostResult
.
success
();
}
}
...
...
bailuntec-cost-core/src/main/resources/application-prod.yml
View file @
64fbbfdb
...
@@ -2,7 +2,7 @@ spring:
...
@@ -2,7 +2,7 @@ spring:
# 数据源配置
# 数据源配置
datasource
:
datasource
:
driver-class-name
:
com.mysql.jdbc.Driver
driver-class-name
:
com.mysql.jdbc.Driver
# url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://gz-cdb-lnrmt5zh.sql.tencentcdb.com:61369/bailun_other?useUnicode=true&characterEncoding=UTF-8&useSSL=false
url
:
jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
url
:
jdbc:mysql://10.0.8.2:3306/bailun_other?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&rewriteBatchedStatements=true
username
:
root
username
:
root
password
:
"
#7kfnymAM$Y9-Ntf"
password
:
"
#7kfnymAM$Y9-Ntf"
...
@@ -46,8 +46,6 @@ cost:
...
@@ -46,8 +46,6 @@ cost:
purchaseCashierCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/CashierCallbackUrl
purchaseCashierCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/purchasing/list/detail/CashierCallbackUrl
costApplyCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/ApplyCallbackUrl
costApplyCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/ApplyCallbackUrl
costCashierCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/CashierCallbackUrl
costCashierCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/CashierCallbackUrl
lendCostApplyCallBackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/lend/ApplyCallbackUrl
lendCostCashierCallbackUrlPost
:
http://api.fee.bailuntec.com/purchase/other/cost/check/lend/CashierCallbackUrl
getBuyDetailApi
:
http://api.fee.bailuntec.com/purchase/other/purchasing/buy/detail
getBuyDetailApi
:
http://api.fee.bailuntec.com/purchase/other/purchasing/buy/detail
getCostDetailApi
:
http://api.fee.bailuntec.com/purchase/other/cost/finansys/detail
getCostDetailApi
:
http://api.fee.bailuntec.com/purchase/other/cost/finansys/detail
...
...
bailuntec-cost-core/src/main/resources/mapper/Cost.xml
View file @
64fbbfdb
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#{projectType}
#{projectType}
</foreach>
</foreach>
</if>
</if>
group by t1.id
ORDER BY
ORDER BY
t1.id DESC
t1.id DESC
</select>
</select>
...
@@ -35,6 +36,7 @@
...
@@ -35,6 +36,7 @@
FROM cost t1
FROM cost t1
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
left join cost_current_reviewer t2 on t1.cost_no = t2.cost_no
WHERE t1.cost_no = #{costNo}
WHERE t1.cost_no = #{costNo}
group by t1.id
ORDER BY t1.id
ORDER BY t1.id
DESC
DESC
</select>
</select>
...
@@ -54,6 +56,7 @@
...
@@ -54,6 +56,7 @@
<if
test=
" kindNo!=null and kindNo != ''"
>
and t1.kind_no=#{kindNo}
</if>
<if
test=
" kindNo!=null and kindNo != ''"
>
and t1.kind_no=#{kindNo}
</if>
<if
test=
" costStatus!=null and costStatus != ''"
>
and t1.cost_status=#{costStatus}
</if>
<if
test=
" costStatus!=null and costStatus != ''"
>
and t1.cost_status=#{costStatus}
</if>
<if
test=
" lendStatus!=null and lendStatus != ''"
>
and t1.lend_status=#{lendStatus}
</if>
<if
test=
" lendStatus!=null and lendStatus != ''"
>
and t1.lend_status=#{lendStatus}
</if>
group by t1.id
ORDER BY
ORDER BY
t1.id DESC
t1.id DESC
</select>
</select>
...
...
bailuntec-cost-core/src/test/java/com/blt/other/common/util/JwtUtilTest.java
0 → 100644
View file @
64fbbfdb
package
com
.
blt
.
other
.
common
.
util
;
import
org.junit.jupiter.api.Test
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.*;
/**
* <p>
*
* </p>
*
* @author robbendev
* @since 2020/12/18 11:53 上午
*/
class
JwtUtilTest
{
@Test
void
validateToken
()
{
JwtUtil
.
validateToken
(
"Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjBhOTY4YmFhNjJlOTkwMjlhOTczNDE1ODg3MDI5ZmJkIiwidHlwIjoiSldUIn0.eyJuYmYiOjE2MDg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Y6Xu2BXdtQH303ObwiSurQ"
);
}
}
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