Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
lic
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
inroi
lic
Commits
193e06b0
提交
193e06b0
authored
2月 21, 2023
作者:
李炎
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lic添加项目名称和模块多选支持
上级
2167c36e
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
130 行增加
和
33 行删除
+130
-33
LicInfoMapper.xml
...tem/src/main/java/com/system/dao/mapper/LicInfoMapper.xml
+16
-11
JacksonTypeHandler.java
.../src/main/java/com/system/handler/JacksonTypeHandler.java
+81
-0
ResourceServerConfig.java
...in/java/com/system/oauth/config/ResourceServerConfig.java
+22
-15
WebSocketConfig.java
...rc/main/java/com/system/oauth/config/WebSocketConfig.java
+4
-4
LicInfoCreateInVo.java
.../main/java/com/system/transfer/lic/LicInfoCreateInVo.java
+3
-1
LicInfoListOutVoRecords.java
...java/com/system/transfer/lic/LicInfoListOutVoRecords.java
+3
-1
application-test.yaml
lic-system/src/main/resources/application-test.yaml
+1
-1
没有找到文件。
lic-system/src/main/java/com/system/dao/mapper/LicInfoMapper.xml
浏览文件 @
193e06b0
...
...
@@ -2,12 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.system.dao.LicInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.system.transfer.lic.LicInfoListOutVoRecords"
>
<result
column=
"module_verification"
property=
"moduleVerification"
jdbcType=
"VARCHAR"
typeHandler=
"com.system.handler.JacksonTypeHandler"
/>
</resultMap>
<select
id=
"licInfoList"
parameterType=
"com.system.transfer.lic.LicInfoListInVo"
resultType=
"com.system.transfer.lic.LicInfoListOutVoRecords
"
>
<select
id=
"licInfoList"
parameterType=
"com.system.transfer.lic.LicInfoListInVo"
resultMap=
"BaseResultMap
"
>
SELECT
id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark, create_time
id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification,
remark, create_time
FROM tb_lic_info
<where>
<if
test=
"inVo.macAddress != null and inVo.macAddress != ''"
>
...
...
@@ -19,30 +24,31 @@
</select>
<insert
id=
"licInfoCreate"
parameterType=
"com.system.transfer.lic.LicInfoCreateInVo"
>
INSERT INTO tb_lic_info (
lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, remark
) VALUES (
#{lqLicName}, #{macAddress}, #{effectiveTime}, #{fileEffectiveTime}, #{verificationInterval}, #{moduleVerification}, #{remark}
#{lqLicName}, #{macAddress}, #{effectiveTime}, #{fileEffectiveTime}, #{verificationInterval},
#{moduleVerification,jdbcType=VARCHAR,typeHandler=com.system.handler.JacksonTypeHandler},
#{remark}
)
</insert>
<update
id=
"licInfoUpdate"
parameterType=
"com.system.transfer.lic.LicInfoUpdateInVo"
>
UPDATE tb_lic_info SET
lq_lic_name = #{lqLicName}, mac_address = #{macAddress}, effective_time = #{effectiveTime}, file_effective_time = #{fileEffectiveTime},
verification_interval = #{verificationInterval}, module_verification = #{moduleVerification}, remark = #{remark}
verification_interval = #{verificationInterval},
module_verification = #{moduleVerification,jdbcType=VARCHAR,typeHandler=com.system.handler.JacksonTypeHandler},
remark = #{remark}
WHERE id = #{id}
</update>
<delete
id=
"licInfoDelete"
parameterType=
"com.system.transfer.lic.LicInfoDeleteInVo"
>
DELETE FROM tb_lic_info WHERE id = #{id}
...
...
@@ -50,8 +56,8 @@
</delete>
<select
id=
"getLicInfoByMacAddress"
parameterType=
"java.lang.String"
resultType=
"com.system.transfer.lic.LicInfoListOutVoRecords"
>
<select
id=
"getLicInfoByMacAddress"
parameterType=
"java.lang.String"
resultType=
"com.system.transfer.lic.LicInfoListOutVoRecords"
>
SELECT
id, lq_lic_name, mac_address, effective_time, file_effective_time, verification_interval, module_verification, create_time
...
...
@@ -60,5 +66,4 @@
</select>
</mapper>
lic-system/src/main/java/com/system/handler/JacksonTypeHandler.java
0 → 100644
浏览文件 @
193e06b0
package
com
.
system
.
handler
;
import
java.io.IOException
;
import
java.sql.CallableStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.ibatis.exceptions.PersistenceException
;
import
org.apache.ibatis.type.BaseTypeHandler
;
import
org.apache.ibatis.type.JdbcType
;
import
org.apache.ibatis.type.MappedJdbcTypes
;
/**
JSON 字段类型处理器
**/
@Slf4j
@MappedJdbcTypes
(
JdbcType
.
VARCHAR
)
public
class
JacksonTypeHandler
<
T
extends
Object
>
extends
BaseTypeHandler
<
T
>
{
private
static
ObjectMapper
objectMapper
;
private
Class
<
T
>
type
;
static
{
objectMapper
=
new
ObjectMapper
();
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
}
public
JacksonTypeHandler
(
Class
<
T
>
type
)
{
if
(
log
.
isTraceEnabled
())
{
log
.
trace
(
"JacksonTypeHandler("
+
type
+
")"
);
}
if
(
null
==
type
)
{
throw
new
PersistenceException
(
"Type argument cannot be null"
);
}
this
.
type
=
type
;
}
private
T
parse
(
String
json
)
{
try
{
if
(
json
==
null
||
json
.
length
()
==
0
)
{
return
null
;
}
return
objectMapper
.
readValue
(
json
,
type
);
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
String
toJsonString
(
T
obj
)
{
try
{
return
objectMapper
.
writeValueAsString
(
obj
);
}
catch
(
JsonProcessingException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Override
public
T
getNullableResult
(
ResultSet
rs
,
String
columnName
)
throws
SQLException
{
return
parse
(
rs
.
getString
(
columnName
));
}
@Override
public
T
getNullableResult
(
ResultSet
rs
,
int
columnIndex
)
throws
SQLException
{
return
parse
(
rs
.
getString
(
columnIndex
));
}
@Override
public
T
getNullableResult
(
CallableStatement
cs
,
int
columnIndex
)
throws
SQLException
{
return
parse
(
cs
.
getString
(
columnIndex
));
}
@Override
public
void
setNonNullParameter
(
PreparedStatement
ps
,
int
columnIndex
,
T
parameter
,
JdbcType
jdbcType
)
throws
SQLException
{
ps
.
setString
(
columnIndex
,
toJsonString
(
parameter
));
}
}
lic-system/src/main/java/com/system/oauth/config/ResourceServerConfig.java
浏览文件 @
193e06b0
package
com
.
system
.
oauth
.
config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
...
...
@@ -28,11 +29,13 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
// return service;
// }
// @Override
// @Override
// public void configure(ResourceServerSecurityConfigurer resources) throws Exception {
// resources.tokenStore(jwtTokenStore)
// .resourceId(DEMO_RESOURCE_ID).tokenServices(tokenService());
// }
@Value
(
"${spring.profiles.active}"
)
private
String
active
;
@Override
public
void
configure
(
ResourceServerSecurityConfigurer
resources
)
throws
Exception
{
...
...
@@ -44,21 +47,24 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Override
public
void
configure
(
HttpSecurity
http
)
throws
Exception
{
http
.
authorizeRequests
()
if
(
active
.
equals
(
"test"
))
{
http
.
authorizeRequests
().
anyRequest
().
permitAll
()
.
and
().
csrf
().
disable
()
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
);
}
else
{
http
.
authorizeRequests
()
// .antMatchers(FeignInsideAuthConfig.FEIGN_INSIDE_URL_PREFIX+"/**").permitAll()
.
antMatchers
(
"/auth/login"
).
permitAll
()
//登录接口
.
antMatchers
(
"/auth/getCaptcha"
).
permitAll
()
.
antMatchers
(
"/user/image"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/webjars/**"
,
"/swagger-resources/**"
,
"/v2/**"
,
"doc.html"
,
"/"
).
permitAll
()
.
antMatchers
(
"/test"
).
permitAll
()
.
antMatchers
(
"/webSocketApi/**"
).
permitAll
()
.
antMatchers
(
"/websocket/**"
).
permitAll
()
.
antMatchers
(
"/api/lic/online/verification"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
antMatchers
(
"/auth/login"
).
permitAll
()
//登录接口
.
antMatchers
(
"/auth/getCaptcha"
).
permitAll
()
.
antMatchers
(
"/user/image"
).
permitAll
()
.
antMatchers
(
"/swagger-ui.html"
,
"/webjars/**"
,
"/swagger-resources/**"
,
"/v2/**"
,
"doc.html"
,
"/"
).
permitAll
()
.
antMatchers
(
"/test"
).
permitAll
()
.
antMatchers
(
"/webSocketApi/**"
).
permitAll
()
.
antMatchers
(
"/websocket/**"
).
permitAll
()
.
antMatchers
(
"/api/lic/online/verification"
).
permitAll
()
.
anyRequest
().
authenticated
()
// .antMatchers("/**").access("#oauth2.hasScope('ROLE_ADMIN')")
.
and
().
csrf
().
disable
()
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
);
.
and
().
csrf
().
disable
()
.
sessionManagement
().
sessionCreationPolicy
(
SessionCreationPolicy
.
STATELESS
);
}
}
}
\ No newline at end of file
lic-system/src/main/java/com/system/oauth/config/WebSocketConfig.java
浏览文件 @
193e06b0
...
...
@@ -11,12 +11,12 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
* @author daiyg
* @date 2021/8/24 17:19
*/
@Service
@Configuration
@EnableWebSocket
//
@Service
//
@Configuration
//
@EnableWebSocket
public
class
WebSocketConfig
{
@Bean
//
@Bean
public
ServerEndpointExporter
serverEndpointExporter
(){
return
new
ServerEndpointExporter
();
}
...
...
lic-system/src/main/java/com/system/transfer/lic/LicInfoCreateInVo.java
浏览文件 @
193e06b0
...
...
@@ -2,6 +2,8 @@ package com.system.transfer.lic;
import
lombok.Data
;
import
java.util.List
;
/**
* @author Inori
*/
...
...
@@ -40,7 +42,7 @@ public class LicInfoCreateInVo {
/**
* 模块验证
*/
private
String
moduleVerification
;
private
List
<
String
>
moduleVerification
;
/**
...
...
lic-system/src/main/java/com/system/transfer/lic/LicInfoListOutVoRecords.java
浏览文件 @
193e06b0
...
...
@@ -2,6 +2,8 @@ package com.system.transfer.lic;
import
lombok.Data
;
import
java.util.List
;
/**
* @author Inori
*/
...
...
@@ -45,7 +47,7 @@ public class LicInfoListOutVoRecords {
/**
* 模块验证
*/
private
String
moduleVerification
;
private
List
<
String
>
moduleVerification
;
/**
...
...
lic-system/src/main/resources/application-test.yaml
浏览文件 @
193e06b0
...
...
@@ -23,7 +23,7 @@ spring:
datasource
:
url
:
jdbc:mysql://127.0.0.1:3306/db_lic?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
username
:
root
password
:
123456
password
:
root
driver-class-name
:
com.mysql.cj.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论