Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
secure
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
胡懿
secure
Commits
930cdfe7
Commit
930cdfe7
authored
Apr 25, 2025
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
接口日志访问功能,人员托名功能
parent
9377fa94
Show whitespace changes
Inline
Side-by-side
Showing
72 changed files
with
5293 additions
and
2 deletions
+5293
-2
123
123
+0
-2
pom.xml
gt-club/gt-club-biz/pom.xml
+87
-0
ErrorInfo.java
gt-club/gt-club-biz/src/main/java/cn/gintone/ErrorInfo.java
+11
-0
AesKeyConfig.java
...lub-biz/src/main/java/cn/gintone/config/AesKeyConfig.java
+25
-0
IotDbConfig.java
...club-biz/src/main/java/cn/gintone/config/IotDbConfig.java
+55
-0
MyConsumer.java
...-club-biz/src/main/java/cn/gintone/config/MyConsumer.java
+62
-0
MyRabbitConfig.java
...b-biz/src/main/java/cn/gintone/config/MyRabbitConfig.java
+86
-0
KeyCodeController.java
...rc/main/java/cn/gintone/controller/KeyCodeController.java
+117
-0
MySystemController.java
...c/main/java/cn/gintone/controller/MySystemController.java
+39
-0
MyTableController.java
...rc/main/java/cn/gintone/controller/MyTableController.java
+97
-0
TestController.java
...z/src/main/java/cn/gintone/controller/TestController.java
+30
-0
UserDesRuleController.java
...ain/java/cn/gintone/controller/UserDesRuleController.java
+135
-0
VisitController.java
.../src/main/java/cn/gintone/controller/VisitController.java
+97
-0
VisitInfoController.java
.../main/java/cn/gintone/controller/VisitInfoController.java
+117
-0
WebLogInfoController.java
...main/java/cn/gintone/controller/WebLogInfoController.java
+103
-0
KeyCodePageReqVO.java
.../main/java/cn/gintone/controller/vo/KeyCodePageReqVO.java
+36
-0
KeyCodeRespVO.java
...src/main/java/cn/gintone/controller/vo/KeyCodeRespVO.java
+40
-0
KeyCodeSaveReqVO.java
.../main/java/cn/gintone/controller/vo/KeyCodeSaveReqVO.java
+28
-0
MyTablePageReqVO.java
.../main/java/cn/gintone/controller/vo/MyTablePageReqVO.java
+25
-0
MyTableRespVO.java
...src/main/java/cn/gintone/controller/vo/MyTableRespVO.java
+31
-0
MyTableSaveReqVO.java
.../main/java/cn/gintone/controller/vo/MyTableSaveReqVO.java
+26
-0
UserDesRulePageReqVO.java
...n/java/cn/gintone/controller/vo/UserDesRulePageReqVO.java
+41
-0
UserDesRuleRespVO.java
...main/java/cn/gintone/controller/vo/UserDesRuleRespVO.java
+48
-0
UserDesRuleSaveReqVO.java
...n/java/cn/gintone/controller/vo/UserDesRuleSaveReqVO.java
+34
-0
VisitInfoPageReqVO.java
...ain/java/cn/gintone/controller/vo/VisitInfoPageReqVO.java
+53
-0
VisitInfoRespVO.java
...c/main/java/cn/gintone/controller/vo/VisitInfoRespVO.java
+63
-0
VisitInfoSaveReqVO.java
...ain/java/cn/gintone/controller/vo/VisitInfoSaveReqVO.java
+48
-0
VisitPageReqVO.java
...rc/main/java/cn/gintone/controller/vo/VisitPageReqVO.java
+25
-0
VisitRespVO.java
...z/src/main/java/cn/gintone/controller/vo/VisitRespVO.java
+26
-0
VisitSaveReqVO.java
...rc/main/java/cn/gintone/controller/vo/VisitSaveReqVO.java
+19
-0
KeyCodeMapper.java
...-club-biz/src/main/java/cn/gintone/dal/KeyCodeMapper.java
+29
-0
MyTableMapper.java
...-club-biz/src/main/java/cn/gintone/dal/MyTableMapper.java
+28
-0
UserDesRuleMapper.java
...b-biz/src/main/java/cn/gintone/dal/UserDesRuleMapper.java
+28
-0
VisitInfoMapper.java
...lub-biz/src/main/java/cn/gintone/dal/VisitInfoMapper.java
+55
-0
VisitMapper.java
...gt-club-biz/src/main/java/cn/gintone/dal/VisitMapper.java
+26
-0
DesInfo.java
...lub/gt-club-biz/src/main/java/cn/gintone/dto/DesInfo.java
+22
-0
EncInfo.java
...lub/gt-club-biz/src/main/java/cn/gintone/dto/EncInfo.java
+33
-0
WebIllLogInfo.java
...-club-biz/src/main/java/cn/gintone/dto/WebIllLogInfo.java
+120
-0
WebLogInfo.java
.../gt-club-biz/src/main/java/cn/gintone/dto/WebLogInfo.java
+118
-0
WebLogInfoVo.java
...t-club-biz/src/main/java/cn/gintone/dto/WebLogInfoVo.java
+83
-0
DataDesensitizationUtils.java
.../cn/gintone/encryptionUtils/DataDesensitizationUtils.java
+151
-0
PemFileGenerator.java
...ain/java/cn/gintone/encryptionUtils/PemFileGenerator.java
+82
-0
SM2KeyUtils.java
...src/main/java/cn/gintone/encryptionUtils/SM2KeyUtils.java
+55
-0
SM2Util.java
...biz/src/main/java/cn/gintone/encryptionUtils/SM2Util.java
+103
-0
SecureHybridDecryptor.java
...ava/cn/gintone/encryptionUtils/SecureHybridDecryptor.java
+135
-0
SecureHybridEncryptor.java
...ava/cn/gintone/encryptionUtils/SecureHybridEncryptor.java
+112
-0
KeyCodeDO.java
...t-club-biz/src/main/java/cn/gintone/entity/KeyCodeDO.java
+44
-0
MyTableDO.java
...t-club-biz/src/main/java/cn/gintone/entity/MyTableDO.java
+43
-0
UserDesRuleDO.java
...ub-biz/src/main/java/cn/gintone/entity/UserDesRuleDO.java
+57
-0
VisitDO.java
.../gt-club-biz/src/main/java/cn/gintone/entity/VisitDO.java
+36
-0
VisitInfoDO.java
...club-biz/src/main/java/cn/gintone/entity/VisitInfoDO.java
+72
-0
IotDBUtil.java
...ub-biz/src/main/java/cn/gintone/iotdbUtils/IotDBUtil.java
+299
-0
MyDateUtils.java
...-biz/src/main/java/cn/gintone/iotdbUtils/MyDateUtils.java
+26
-0
MyIotDbUtils.java
...biz/src/main/java/cn/gintone/iotdbUtils/MyIotDbUtils.java
+587
-0
KeyCodeService.java
...-biz/src/main/java/cn/gintone/service/KeyCodeService.java
+71
-0
KeyCodeServiceImpl.java
.../src/main/java/cn/gintone/service/KeyCodeServiceImpl.java
+149
-0
MySystemService.java
...biz/src/main/java/cn/gintone/service/MySystemService.java
+23
-0
MySystemServiceImpl.java
...src/main/java/cn/gintone/service/MySystemServiceImpl.java
+113
-0
MyTableService.java
...-biz/src/main/java/cn/gintone/service/MyTableService.java
+57
-0
MyTableServiceImpl.java
.../src/main/java/cn/gintone/service/MyTableServiceImpl.java
+72
-0
UserDesRuleService.java
.../src/main/java/cn/gintone/service/UserDesRuleService.java
+67
-0
UserDesRuleServiceImpl.java
.../main/java/cn/gintone/service/UserDesRuleServiceImpl.java
+299
-0
VisitInfoService.java
...iz/src/main/java/cn/gintone/service/VisitInfoService.java
+67
-0
VisitInfoServiceImpl.java
...rc/main/java/cn/gintone/service/VisitInfoServiceImpl.java
+202
-0
VisitService.java
...ub-biz/src/main/java/cn/gintone/service/VisitService.java
+56
-0
VisitServiceImpl.java
...iz/src/main/java/cn/gintone/service/VisitServiceImpl.java
+78
-0
KeyCodeMapper.xml
...b/gt-club-biz/src/main/resources/mapper/KeyCodeMapper.xml
+13
-0
MyTableMapper.xml
...b/gt-club-biz/src/main/resources/mapper/MyTableMapper.xml
+13
-0
UserDesRuleMapper.xml
...-club-biz/src/main/resources/mapper/UserDesRuleMapper.xml
+13
-0
VisitInfoMapper.xml
...gt-club-biz/src/main/resources/mapper/VisitInfoMapper.xml
+13
-0
VisitMapper.xml
...lub/gt-club-biz/src/main/resources/mapper/VisitMapper.xml
+13
-0
pom.xml
gt-club/pom.xml
+26
-0
No files found.
123
deleted
100644 → 0
View file @
9377fa94
123
\ No newline at end of file
gt-club/gt-club-biz/pom.xml
0 → 100644
View file @
930cdfe7
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
cn.gintone
</groupId>
<artifactId>
gt-club
</artifactId>
<version>
${revision}
</version>
</parent>
<artifactId>
gt-club-biz
</artifactId>
<packaging>
jar
</packaging>
<dependencies>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-common
</artifactId>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-spring-boot-starter-excel
</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-spring-boot-starter-security
</artifactId>
</dependency>
<!-- DB 相关 -->
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-spring-boot-starter-mybatis
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>-->
<dependency>
<groupId>
org.springframework.amqp
</groupId>
<artifactId>
spring-amqp
</artifactId>
<version>
2.3.12
</version>
<!-- 使用最新的稳定版本 -->
</dependency>
<dependency>
<groupId>
org.apache.iotdb
</groupId>
<artifactId>
iotdb-session
</artifactId>
<!-- 版本号与数据库版本号相同 -->
<version>
1.3.3
</version>
</dependency>
<dependency>
<groupId>
org.springframework.amqp
</groupId>
<artifactId>
spring-rabbit
</artifactId>
</dependency>
<dependency>
<groupId>
org.bouncycastle
</groupId>
<artifactId>
bcprov-jdk15on
</artifactId>
<version>
1.70
</version>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-system-biz
</artifactId>
<version>
2.4.2-jdk8-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/ErrorInfo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
public
class
ErrorInfo
{
public
static
ErrorCode
MY_TABLE_NOT_EXISTS
=
new
ErrorCode
(
1
,
"我的测试表不存在"
);
public
static
ErrorCode
KEY_CODE_NOT_EXISTS
=
new
ErrorCode
(
2
,
"公钥私钥管理不存在"
);
public
static
ErrorCode
VISIT_NOT_EXISTS
=
new
ErrorCode
(
3
,
"接口安全访问策略不存在"
);
public
static
ErrorCode
VISIT_INFO_NOT_EXISTS
=
new
ErrorCode
(
4
,
"访问规则配置不存在"
);
public
static
ErrorCode
USER_DES_RULE_NOT_EXISTS
=
new
ErrorCode
(
5
,
"人员脱敏规则不存在"
);
}
gt-club/gt-club-biz/src/main/java/cn/gintone/config/AesKeyConfig.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"aes"
)
// 前缀与 yml 中的键匹配
public
class
AesKeyConfig
{
private
String
key
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
@Override
public
String
toString
()
{
return
"AesKeyConfig{"
+
"key='"
+
key
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/config/IotDbConfig.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
config
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"iotdb"
)
// 前缀与 yml 中的键匹配
public
class
IotDbConfig
{
private
String
ip
;
private
Integer
port
;
private
String
username
;
private
String
password
;
public
String
getIp
()
{
return
ip
;
}
public
void
setIp
(
String
ip
)
{
this
.
ip
=
ip
;
}
public
Integer
getPort
()
{
return
port
;
}
public
void
setPort
(
Integer
port
)
{
this
.
port
=
port
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
@Override
public
String
toString
()
{
return
"IotDbConfig{"
+
"ip='"
+
ip
+
'\''
+
", port="
+
port
+
", username='"
+
username
+
'\''
+
", password='"
+
password
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/config/MyConsumer.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
config
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.iotdbUtils.MyIotDbUtils
;
import
cn.gintone.service.VisitInfoService
;
import
com.alibaba.fastjson.JSON
;
import
com.rabbitmq.client.Channel
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.messaging.handler.annotation.SendTo
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
/**
* 消费者类
*/
@Component
public
class
MyConsumer
{
@Autowired
private
IotDbConfig
iotDbConfig
;
@Autowired
private
VisitInfoService
visitInfoService
;
/**
* 监听队列---当队列中有消息,则监听器工作,处理接受到的消息
*/
@RabbitListener
(
queues
=
"my_boot_fanout_queue1"
)
public
void
receive1
(
Message
message
)
{
byte
[]
body
=
message
.
getBody
();
System
.
out
.
printf
(
"receive1接受到的消息"
+
new
String
(
body
));
}
@RabbitListener
(
queues
=
"my_boot_topic_queue"
)
public
void
receive2
(
Message
message
,
Channel
channel
)
throws
IOException
{
byte
[]
body
=
message
.
getBody
();
String
receivedRoutingKey
=
message
.
getMessageProperties
().
getReceivedRoutingKey
();
if
(
receivedRoutingKey
.
contains
(
"weblog"
))
{
System
.
out
.
println
(
iotDbConfig
);
System
.
out
.
println
(
channel
);
String
jsonStr
=
new
String
(
body
);
WebLogInfo
webLogInfo
=
null
;
try
{
webLogInfo
=
JSON
.
parseObject
(
JSON
.
parse
(
jsonStr
).
toString
(),
WebLogInfo
.
class
);
MyIotDbUtils
.
inserOne
(
iotDbConfig
,
webLogInfo
);
visitInfoService
.
checkWebLogInfo
(
webLogInfo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
return
;
}
}
// 手动ack,告知broker要签收的消息的id(deliveryTag)
// channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/config/MyRabbitConfig.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
config
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.BindingBuilder
;
import
org.springframework.amqp.core.Queue
;
import
org.springframework.amqp.core.TopicExchange
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* 消费者的配置类
*/
@Configuration
public
class
MyRabbitConfig
{
/*
*//**
* 不使用topic的模式
*//*
private static String EXCHANGE_NAME = "my_boot_fanout_exchange"; // 交换机
private static String QUEUE_NAME = "my_boot_fanout_queue1"; // 队列名称
*//**
* 声明交换机
*//*
@Bean
public FanoutExchange fanoutExchange() {
return new FanoutExchange(EXCHANGE_NAME, true, false); // 设置交换机,设置是持久化的,设置不自动删除
}
*//**
* 声明队列
*//*
@Bean
public Queue queue() {
return new Queue(QUEUE_NAME, true,false, false); // 队列名称,是否持久化。是否自动删除
}
*//**
* 创建绑定关系
*//*
@Bean
public Binding binding(FanoutExchange fanoutExchange, Queue queue) {
return BindingBuilder.bind(queue).to(fanoutExchange); // 把队列绑定到交换机上
}
*/
@Autowired
private
IotDbConfig
iotDbConfig
;
/**
* 声明队列、交换机、绑定关系(routing-key)
*/
private
static
String
QUEUE_NAME
=
"my_boot_topic_queue"
;
private
static
String
EXCHANGE_NAME
=
"my_boot_topic_exchange"
;
/**
* 申明队列
* @return
*/
@Bean
public
Queue
queue
()
{
return
new
Queue
(
QUEUE_NAME
,
true
,
false
,
false
);
// 队列名称,是否持久化。是否自动删除
}
/**
* 申明交换机
* @return
*/
@Bean
public
TopicExchange
topicExchange
()
{
return
new
TopicExchange
(
EXCHANGE_NAME
,
true
,
false
);
}
/**
* 申明绑定关系
*/
@Bean
public
Binding
queueBinding
(
Queue
queue
,
TopicExchange
topicExchange
)
{
return
BindingBuilder
.
bind
(
queue
).
to
(
topicExchange
).
with
(
"weblog.*"
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/KeyCodeController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.KeyCodePageReqVO
;
import
cn.gintone.controller.vo.KeyCodeRespVO
;
import
cn.gintone.controller.vo.KeyCodeSaveReqVO
;
import
cn.gintone.dto.EncInfo
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.gintone.service.KeyCodeService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Operation
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.io.IOException
;
import
java.util.List
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
@Tag
(
name
=
"管理后台 - 公钥私钥管理"
)
@RestController
@RequestMapping
(
"/admin-api/gintone/key-code"
)
@Validated
public
class
KeyCodeController
{
@Resource
private
KeyCodeService
keyCodeService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建公钥私钥管理"
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:create')"
)
public
CommonResult
<
Long
>
createKeyCode
(
@Valid
@RequestBody
KeyCodeSaveReqVO
createReqVO
)
{
return
success
(
keyCodeService
.
createKeyCode
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新公钥私钥管理"
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:update')"
)
public
CommonResult
<
Boolean
>
updateKeyCode
(
@Valid
@RequestBody
KeyCodeSaveReqVO
updateReqVO
)
{
keyCodeService
.
updateKeyCode
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除公钥私钥管理"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:delete')"
)
public
CommonResult
<
Boolean
>
deleteKeyCode
(
@RequestParam
(
"id"
)
Long
id
)
{
keyCodeService
.
deleteKeyCode
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得公钥私钥管理"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:query')"
)
public
CommonResult
<
KeyCodeRespVO
>
getKeyCode
(
@RequestParam
(
"id"
)
Long
id
)
{
KeyCodeDO
keyCode
=
keyCodeService
.
getKeyCode
(
id
);
return
success
(
BeanUtils
.
toBean
(
keyCode
,
KeyCodeRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得公钥私钥管理分页"
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:query')"
)
public
CommonResult
<
PageResult
<
KeyCodeRespVO
>>
getKeyCodePage
(
@Valid
KeyCodePageReqVO
pageReqVO
)
{
PageResult
<
KeyCodeDO
>
pageResult
=
keyCodeService
.
getKeyCodePage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
KeyCodeRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出公钥私钥管理 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('gintone:key-code:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportKeyCodeExcel
(
@Valid
KeyCodePageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
KeyCodeDO
>
list
=
keyCodeService
.
getKeyCodePage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"公钥私钥管理.xls"
,
"数据"
,
KeyCodeRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
KeyCodeRespVO
.
class
));
}
@PostMapping
(
"/initKey"
)
@Operation
(
summary
=
"初始化公钥私钥"
)
public
CommonResult
<
String
>
initKey
()
{
return
success
(
keyCodeService
.
initKey
());
}
@PostMapping
(
"/rasEncryption"
)
@Operation
(
summary
=
"RAS加密"
)
public
CommonResult
<
EncInfo
>
rasEncryption
(
String
info
)
{
EncInfo
encInfo
=
keyCodeService
.
rasEncryption
(
info
);
return
success
(
encInfo
);
}
@PostMapping
(
"/rasDecrypt"
)
@Operation
(
summary
=
"RAS解密"
)
public
CommonResult
<
String
>
rasDecrypt
(
@RequestBody
EncInfo
encInfo
)
{
String
info
=
keyCodeService
.
rasDecrypt
(
encInfo
);
return
success
(
info
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/MySystemController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.service.MySystemService
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/admin-api/gintone/MySystemController"
)
public
class
MySystemController
{
@Autowired
private
MySystemService
mySystemService
;
@GetMapping
(
"/getMenuBySysAbbre"
)
public
CommonResult
<
List
<
AuthPermissionInfoRespVO
.
MenuVO
>>
getMenuBySysAbbre
(
@RequestParam
(
"sysAbbre"
)
String
sysAbbre
)
{
List
<
AuthPermissionInfoRespVO
.
MenuVO
>
menuBySysAbbre
=
mySystemService
.
getMenuBySysAbbre
(
sysAbbre
);
return
CommonResult
.
success
(
menuBySysAbbre
);
}
@GetMapping
(
"/getRoleBySysAbbre"
)
public
CommonResult
<
List
<
RoleDO
>>
getRoleBySysAbbre
(
@RequestParam
(
"sysAbbre"
)
String
sysAbbre
)
{
List
<
RoleDO
>
roleDOList
=
mySystemService
.
getRolesBySysAbbre
(
sysAbbre
);
return
CommonResult
.
success
(
roleDOList
);
}
@GetMapping
(
"/getUserBySysAbbreAndRoleId"
)
public
CommonResult
<
List
<
AdminUserDO
>>
getUserBySysAbbreAndRoleId
(
@RequestParam
(
"sysAbbre"
)
String
sysAbbre
,
@RequestParam
(
"roleId"
)
String
roleId
)
{
List
<
AdminUserDO
>
userDOList
=
mySystemService
.
getAdminUsersBySysAbbreAndRoleId
(
sysAbbre
,
roleId
);
return
CommonResult
.
success
(
userDOList
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/MyTableController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.MyTablePageReqVO
;
import
cn.gintone.controller.vo.MyTableRespVO
;
import
cn.gintone.controller.vo.MyTableSaveReqVO
;
import
cn.gintone.entity.MyTableDO
;
import
cn.gintone.service.MyTableService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Operation
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.util.*
;
import
java.io.IOException
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
@Tag
(
name
=
"管理后台 - 我的测试表"
)
@RestController
@RequestMapping
(
"/admin-api/sec/my-table"
)
@Validated
public
class
MyTableController
{
@Resource
private
MyTableService
myTableService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建我的测试表"
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:create')"
)
public
CommonResult
<
Long
>
createMyTable
(
@Valid
@RequestBody
MyTableSaveReqVO
createReqVO
)
{
return
success
(
myTableService
.
createMyTable
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新我的测试表"
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:update')"
)
public
CommonResult
<
Boolean
>
updateMyTable
(
@Valid
@RequestBody
MyTableSaveReqVO
updateReqVO
)
{
myTableService
.
updateMyTable
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除我的测试表"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:delete')"
)
public
CommonResult
<
Boolean
>
deleteMyTable
(
@RequestParam
(
"id"
)
Long
id
)
{
myTableService
.
deleteMyTable
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得我的测试表"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:query')"
)
public
CommonResult
<
MyTableRespVO
>
getMyTable
(
@RequestParam
(
"id"
)
Long
id
)
{
MyTableDO
myTable
=
myTableService
.
getMyTable
(
id
);
return
success
(
BeanUtils
.
toBean
(
myTable
,
MyTableRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得我的测试表分页"
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:query')"
)
public
CommonResult
<
PageResult
<
MyTableRespVO
>>
getMyTablePage
(
@Valid
MyTablePageReqVO
pageReqVO
)
{
PageResult
<
MyTableDO
>
pageResult
=
myTableService
.
getMyTablePage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
MyTableRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出我的测试表 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('sec:my-table:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportMyTableExcel
(
@Valid
MyTablePageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
MyTableDO
>
list
=
myTableService
.
getMyTablePage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"我的测试表.xls"
,
"数据"
,
MyTableRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
MyTableRespVO
.
class
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/TestController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.iotdbUtils.IotDBUtil
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/testCon"
)
public
class
TestController
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@GetMapping
(
"/testRabbit"
)
public
void
testRabbit
()
{
String
message
=
"hellow spring boot topic message"
;
rabbitTemplate
.
convertAndSend
(
"my_boot_fanout_exchange"
,
"product.delete"
,
message
);
}
@GetMapping
(
"/testIotdb"
)
public
void
testIotdb
()
{
IotDBUtil
.
select
();
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/UserDesRuleController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.UserDesRulePageReqVO
;
import
cn.gintone.controller.vo.UserDesRuleRespVO
;
import
cn.gintone.controller.vo.UserDesRuleSaveReqVO
;
import
cn.gintone.dto.DesInfo
;
import
cn.gintone.entity.UserDesRuleDO
;
import
cn.gintone.service.UserDesRuleService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Operation
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
@Tag
(
name
=
"管理后台 - 人员脱敏规则"
)
@RestController
@RequestMapping
(
"/admin-api/sec/user-des-rule"
)
@Validated
public
class
UserDesRuleController
{
@Resource
private
UserDesRuleService
userDesRuleService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建人员脱敏规则"
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:create')"
)
public
CommonResult
<
Long
>
createUserDesRule
(
@Valid
@RequestBody
UserDesRuleSaveReqVO
createReqVO
)
{
return
success
(
userDesRuleService
.
createUserDesRule
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新人员脱敏规则"
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:update')"
)
public
CommonResult
<
Boolean
>
updateUserDesRule
(
@Valid
@RequestBody
UserDesRuleSaveReqVO
updateReqVO
)
{
userDesRuleService
.
updateUserDesRule
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除人员脱敏规则"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:delete')"
)
public
CommonResult
<
Boolean
>
deleteUserDesRule
(
@RequestParam
(
"id"
)
Long
id
)
{
userDesRuleService
.
deleteUserDesRule
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得人员脱敏规则"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:query')"
)
public
CommonResult
<
UserDesRuleRespVO
>
getUserDesRule
(
@RequestParam
(
"id"
)
Long
id
)
{
UserDesRuleDO
userDesRule
=
userDesRuleService
.
getUserDesRule
(
id
);
return
success
(
BeanUtils
.
toBean
(
userDesRule
,
UserDesRuleRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得人员脱敏规则分页"
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:query')"
)
public
CommonResult
<
PageResult
<
UserDesRuleRespVO
>>
getUserDesRulePage
(
@Valid
UserDesRulePageReqVO
pageReqVO
)
{
PageResult
<
UserDesRuleDO
>
pageResult
=
userDesRuleService
.
getUserDesRulePage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
UserDesRuleRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出人员脱敏规则 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('sec:user-des-rule:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportUserDesRuleExcel
(
@Valid
UserDesRulePageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
UserDesRuleDO
>
list
=
userDesRuleService
.
getUserDesRulePage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"人员脱敏规则.xls"
,
"数据"
,
UserDesRuleRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
UserDesRuleRespVO
.
class
));
}
@GetMapping
(
"/checkName"
)
@Operation
(
summary
=
"验证属性是否存在"
)
public
CommonResult
<
Boolean
>
checkName
(
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
Long
id
)
{
return
success
(
userDesRuleService
.
checkName
(
name
,
id
));
}
@PostMapping
(
"/userRuleDes"
)
@Operation
(
summary
=
"人员脱敏"
)
public
CommonResult
<
String
>
userRuleDes
(
@RequestBody
DesInfo
desInfo
)
{
String
str
=
userDesRuleService
.
userRuleDes
(
desInfo
.
getJsonStr
());
return
CommonResult
.
success
(
str
);
}
@PostMapping
(
"/userRuleDesMap"
)
@Operation
(
summary
=
"人员脱敏"
)
public
CommonResult
<
Map
<
String
,
Object
>>
userRuleDesMap
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
Map
<
String
,
Object
>
resultMap
=
userDesRuleService
.
userRuleDesMap
(
map
);
return
CommonResult
.
success
(
resultMap
);
}
@PostMapping
(
"/userRuleDesList"
)
@Operation
(
summary
=
"人员批量脱敏"
)
public
CommonResult
<
String
>
userRuleDesList
(
@RequestBody
DesInfo
desInfo
)
{
String
str
=
userDesRuleService
.
userRuleDesArr
(
desInfo
.
getJsonArrStr
());
return
CommonResult
.
success
(
str
);
}
@PostMapping
(
"/userRuleDesListMap"
)
@Operation
(
summary
=
"人员脱敏"
)
public
CommonResult
<
List
<
Map
<
String
,
Object
>>>
userRuleDesListMap
(
@RequestBody
List
<
Map
<
String
,
Object
>>
lisetMap
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
userDesRuleService
.
userRuleDesListMap
(
lisetMap
);
return
CommonResult
.
success
(
resultList
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/VisitController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.VisitPageReqVO
;
import
cn.gintone.controller.vo.VisitRespVO
;
import
cn.gintone.controller.vo.VisitSaveReqVO
;
import
cn.gintone.entity.VisitDO
;
import
cn.gintone.service.VisitService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Operation
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.io.IOException
;
import
java.util.List
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
@Tag
(
name
=
"管理后台 - 接口安全访问策略"
)
@RestController
@RequestMapping
(
"/admin-api/visit/visit"
)
@Validated
public
class
VisitController
{
@Resource
private
VisitService
visitService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建接口安全访问策略"
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:create')"
)
public
CommonResult
<
Long
>
createVisit
(
@Valid
@RequestBody
VisitSaveReqVO
createReqVO
)
{
return
success
(
visitService
.
createVisit
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新接口安全访问策略"
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:update')"
)
public
CommonResult
<
Boolean
>
updateVisit
(
@Valid
@RequestBody
VisitSaveReqVO
updateReqVO
)
{
visitService
.
updateVisit
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除接口安全访问策略"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:delete')"
)
public
CommonResult
<
Boolean
>
deleteVisit
(
@RequestParam
(
"id"
)
Long
id
)
{
visitService
.
deleteVisit
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得接口安全访问策略"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:query')"
)
public
CommonResult
<
VisitRespVO
>
getVisit
(
@RequestParam
(
"id"
)
Long
id
)
{
VisitDO
visit
=
visitService
.
getVisit
(
id
);
return
success
(
BeanUtils
.
toBean
(
visit
,
VisitRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得接口安全访问策略分页"
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:query')"
)
public
CommonResult
<
PageResult
<
VisitRespVO
>>
getVisitPage
(
@Valid
VisitPageReqVO
pageReqVO
)
{
PageResult
<
VisitDO
>
pageResult
=
visitService
.
getVisitPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
VisitRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出接口安全访问策略 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('visit:visit:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportVisitExcel
(
@Valid
VisitPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
VisitDO
>
list
=
visitService
.
getVisitPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"接口安全访问策略.xls"
,
"数据"
,
VisitRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
VisitRespVO
.
class
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/VisitInfoController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.VisitInfoPageReqVO
;
import
cn.gintone.controller.vo.VisitInfoRespVO
;
import
cn.gintone.controller.vo.VisitInfoSaveReqVO
;
import
cn.gintone.entity.VisitInfoDO
;
import
cn.gintone.service.VisitInfoService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.Parameter
;
import
io.swagger.v3.oas.annotations.Operation
;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.io.IOException
;
import
java.util.List
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
import
cn.iocoder.yudao.framework.excel.core.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
apilog
.
core
.
enums
.
OperateTypeEnum
.*;
@Tag
(
name
=
"管理后台 - 访问规则配置"
)
@RestController
@RequestMapping
(
"/admin-api/visitInfo/visit-info"
)
@Validated
public
class
VisitInfoController
{
@Resource
private
VisitInfoService
visitInfoService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建访问规则配置"
)
public
CommonResult
<
Long
>
createVisitInfo
(
@Valid
@RequestBody
VisitInfoSaveReqVO
createReqVO
)
{
return
success
(
visitInfoService
.
createVisitInfo
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新访问规则配置"
)
public
CommonResult
<
Boolean
>
updateVisitInfo
(
@Valid
@RequestBody
VisitInfoSaveReqVO
updateReqVO
)
{
visitInfoService
.
updateVisitInfo
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除访问规则配置"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
public
CommonResult
<
Boolean
>
deleteVisitInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
visitInfoService
.
deleteVisitInfo
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得访问规则配置"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
public
CommonResult
<
VisitInfoRespVO
>
getVisitInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
VisitInfoDO
visitInfo
=
visitInfoService
.
getVisitInfo
(
id
);
return
success
(
BeanUtils
.
toBean
(
visitInfo
,
VisitInfoRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得访问规则配置分页"
)
public
CommonResult
<
PageResult
<
VisitInfoRespVO
>>
getVisitInfoPage
(
@Valid
VisitInfoPageReqVO
pageReqVO
)
{
PageResult
<
VisitInfoDO
>
pageResult
=
visitInfoService
.
getVisitInfoPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
VisitInfoRespVO
.
class
));
}
@GetMapping
(
"/getList"
)
@Operation
(
summary
=
"获得访问规则配置"
)
public
CommonResult
<
List
<
VisitInfoDO
>>
getList
(
VisitInfoPageReqVO
pageReqVO
)
{
List
<
VisitInfoDO
>
list
=
visitInfoService
.
getList
(
pageReqVO
);
return
success
(
list
);
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出访问规则配置 Excel"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportVisitInfoExcel
(
@Valid
VisitInfoPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
VisitInfoDO
>
list
=
visitInfoService
.
getVisitInfoPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"访问规则配置.xls"
,
"数据"
,
VisitInfoRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
VisitInfoRespVO
.
class
));
}
@PostMapping
(
"/saveAllVisitInfo"
)
@Operation
(
summary
=
"创建访问规则配置"
)
public
CommonResult
<
Boolean
>
saveAllVisitInfo
(
@Valid
@RequestBody
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
)
{
return
success
(
visitInfoService
.
saveAllVisitInfo
(
visitInfoSaveReqVOList
));
}
@DeleteMapping
(
"/deleteByVisitId"
)
@Operation
(
summary
=
"根据visitId删除访问规则配置"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
public
CommonResult
<
Boolean
>
deleteByVisitId
(
@RequestParam
(
"visitId"
)
Long
visitId
)
{
visitInfoService
.
deleteByVisitId
(
visitId
);
return
success
(
true
);
}
@PutMapping
(
"/updateAllVisitInfo"
)
@Operation
(
summary
=
"更新访问规则配置"
)
public
CommonResult
<
Boolean
>
updateAllVisitInfo
(
@Valid
@RequestBody
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
)
{
return
success
(
visitInfoService
.
updateAllVisitInfo
(
visitInfoSaveReqVOList
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/WebLogInfoController.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.dto.WebLogInfoVo
;
import
cn.gintone.iotdbUtils.MyDateUtils
;
import
cn.gintone.iotdbUtils.MyIotDbUtils
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.v3.oas.annotations.Operation
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/admin-api/gintone/webLogInfo"
)
public
class
WebLogInfoController
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Autowired
private
IotDbConfig
iotDbConfig
;
@PostMapping
(
"/initIotDBDatabase"
)
@Operation
(
summary
=
"初始化数据库"
)
public
CommonResult
<
String
>
initIotDBDatabase
()
{
MyIotDbUtils
.
createDatabase
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/initIotDBTable"
)
@Operation
(
summary
=
"初始化时间序列"
)
public
CommonResult
<
String
>
initIotDBTable
()
{
MyIotDbUtils
.
createWebLogInfoTimeseries
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/initIllIotDBTable"
)
@Operation
(
summary
=
"初始化时间序列"
)
public
CommonResult
<
String
>
initIllIotDBTable
()
{
MyIotDbUtils
.
createIllegalLogTimeseries
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/saveWebLogInfo"
)
@Operation
(
summary
=
"外部性请求保存日志"
)
public
CommonResult
<
String
>
saveWebLogInfo
(
@RequestBody
WebLogInfo
webLogInfo
)
{
if
(
null
==
webLogInfo
.
getAccessed
())
{
webLogInfo
.
setAccessed
(
MyDateUtils
.
longToString
(
new
Date
().
getTime
()));
}
String
webLogInfoStr
=
JSON
.
toJSONString
(
webLogInfo
);
rabbitTemplate
.
convertAndSend
(
"my_boot_topic_exchange"
,
"weblog.save"
,
webLogInfoStr
);
return
CommonResult
.
success
(
"保存成功"
);
}
@GetMapping
(
"/countWebLogInfo"
)
@Operation
(
summary
=
"统计日志条数接口"
)
public
CommonResult
<
Long
>
countWebLogInfo
(
WebLogInfoVo
webLogInfoVo
)
{
long
pageCount
=
MyIotDbUtils
.
countWebInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
pageCount
);
}
@GetMapping
(
"/webLogInfoList"
)
@Operation
(
summary
=
"查询接口日志接口"
)
public
CommonResult
<
List
<
WebLogInfo
>>
webLogInfoList
(
WebLogInfoVo
webLogInfoVo
)
{
List
<
WebLogInfo
>
webLogInfoList
=
MyIotDbUtils
.
selectWebInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
webLogInfoList
);
}
@GetMapping
(
"/webLogInfoWarningList"
)
@Operation
(
summary
=
"查询警告接口日志接口"
)
public
CommonResult
<
List
<
WebLogInfo
>>
webLogInfoWarningList
(
WebLogInfoVo
webLogInfoVo
)
{
webLogInfoVo
.
setType
(
"warning"
);
List
<
WebLogInfo
>
webLogInfoList
=
MyIotDbUtils
.
selectWebInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
webLogInfoList
);
}
@GetMapping
(
"/webLogInfoErrorList"
)
@Operation
(
summary
=
"查询警告接口日志接口"
)
public
CommonResult
<
List
<
WebLogInfo
>>
webLogInfoErrorList
(
WebLogInfoVo
webLogInfoVo
)
{
webLogInfoVo
.
setType
(
"error"
);
List
<
WebLogInfo
>
webLogInfoList
=
MyIotDbUtils
.
selectWebInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
webLogInfoList
);
}
@GetMapping
(
"/countWebIllLogInfo"
)
@Operation
(
summary
=
"统计非法日志条数接口"
)
public
CommonResult
<
Long
>
countWebIllLogInfo
(
WebLogInfoVo
webLogInfoVo
)
{
long
pageCount
=
MyIotDbUtils
.
countWebIllInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
pageCount
);
}
@GetMapping
(
"/webIllLogInfoList"
)
@Operation
(
summary
=
"查询非法日志记录"
)
public
CommonResult
<
List
<
WebIllLogInfo
>>
webIllLogInfoList
(
WebLogInfoVo
webLogInfoVo
)
{
List
<
WebIllLogInfo
>
webIllLogInfos
=
MyIotDbUtils
.
selectWebIllInfo
(
iotDbConfig
,
webLogInfoVo
);
return
CommonResult
.
success
(
webIllLogInfos
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/KeyCodePageReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 公钥私钥管理分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
KeyCodePageReqVO
extends
PageParam
{
@Schema
(
description
=
"类型用户编号"
,
example
=
"1"
)
private
Integer
type
;
@Schema
(
description
=
"公钥用户类型"
)
private
String
publicKey
;
@Schema
(
description
=
"私钥"
)
private
String
privateKey
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
@Schema
(
description
=
"跟新时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
updateTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/KeyCodeRespVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 公钥私钥管理 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
KeyCodeRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"4344"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"类型用户编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@ExcelProperty
(
"类型用户编号"
)
private
Integer
type
;
@Schema
(
description
=
"公钥用户类型"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"公钥用户类型"
)
private
String
publicKey
;
@Schema
(
description
=
"私钥"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"私钥"
)
private
String
privateKey
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
@Schema
(
description
=
"更新时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"更新时间"
)
private
LocalDateTime
updateTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/KeyCodeSaveReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 公钥私钥管理新增/修改 Request VO"
)
@Data
public
class
KeyCodeSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"4344"
)
private
Long
id
;
@Schema
(
description
=
"类型用户编号"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"1"
)
@NotNull
(
message
=
"类型用户编号不能为空"
)
private
Integer
type
;
@Schema
(
description
=
"公钥用户类型"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"公钥用户类型不能为空"
)
private
String
publicKey
;
@Schema
(
description
=
"私钥"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"私钥不能为空"
)
private
String
privateKey
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/MyTablePageReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
java.math.BigDecimal
;
@Schema
(
description
=
"管理后台 - 我的测试表分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
MyTablePageReqVO
extends
PageParam
{
@Schema
(
description
=
"name"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"age"
)
private
Integer
age
;
@Schema
(
description
=
"money"
)
private
BigDecimal
money
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/MyTableRespVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 我的测试表 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
MyTableRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"29789"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"name"
,
example
=
"李四"
)
@ExcelProperty
(
"name"
)
private
String
name
;
@Schema
(
description
=
"age"
)
@ExcelProperty
(
"age"
)
private
Integer
age
;
@Schema
(
description
=
"money"
)
@ExcelProperty
(
"money"
)
private
BigDecimal
money
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/MyTableSaveReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
import
java.math.BigDecimal
;
@Schema
(
description
=
"管理后台 - 我的测试表新增/修改 Request VO"
)
@Data
public
class
MyTableSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"29789"
)
private
Long
id
;
@Schema
(
description
=
"name"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"age"
)
private
Integer
age
;
@Schema
(
description
=
"money"
)
private
BigDecimal
money
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/UserDesRulePageReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 人员脱敏规则分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
UserDesRulePageReqVO
extends
PageParam
{
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
private
String
attr
;
@Schema
(
description
=
"规则"
)
private
Integer
rule
;
@Schema
(
description
=
"配置项1"
)
private
String
valueOne
;
@Schema
(
description
=
"配置项2"
)
private
String
valueTwo
;
@Schema
(
description
=
"配置项3"
)
private
String
valueThree
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/UserDesRuleRespVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 人员脱敏规则 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
UserDesRuleRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"4684"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
@ExcelProperty
(
"属性名称"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
@ExcelProperty
(
"属性描述"
)
private
String
attr
;
@Schema
(
description
=
"规则"
)
@ExcelProperty
(
"规则"
)
private
Integer
rule
;
@Schema
(
description
=
"配置项1"
)
@ExcelProperty
(
"配置项1"
)
private
String
valueOne
;
@Schema
(
description
=
"配置项2"
)
@ExcelProperty
(
"配置项2"
)
private
String
valueTwo
;
@Schema
(
description
=
"配置项3"
)
@ExcelProperty
(
"配置项3"
)
private
String
valueThree
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/UserDesRuleSaveReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 人员脱敏规则新增/修改 Request VO"
)
@Data
public
class
UserDesRuleSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"4684"
)
private
Long
id
;
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
private
String
attr
;
@Schema
(
description
=
"规则"
)
private
Integer
rule
;
@Schema
(
description
=
"配置项1"
)
private
String
valueOne
;
@Schema
(
description
=
"配置项2"
)
private
String
valueTwo
;
@Schema
(
description
=
"配置项3"
)
private
String
valueThree
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitInfoPageReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
lombok.*
;
import
java.util.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 访问规则配置分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
VisitInfoPageReqVO
extends
PageParam
{
@Schema
(
description
=
"规则表外键"
,
example
=
"10305"
)
private
Long
visitId
;
@Schema
(
description
=
"系统简称"
)
private
String
sysAbbre
;
@Schema
(
description
=
"系统名称"
,
example
=
"王五"
)
private
String
sysAbbreName
;
@Schema
(
description
=
"菜单名称"
,
example
=
"王五"
)
private
String
urlName
;
@Schema
(
description
=
"菜单地址"
,
example
=
"https://www.iocoder.cn"
)
private
String
url
;
@Schema
(
description
=
"菜单地址Id"
,
example
=
"https://www.iocoder.cn"
)
private
String
urlId
;
@Schema
(
description
=
"角色id"
,
example
=
"6818"
)
private
String
roleId
;
@Schema
(
description
=
"角色名称"
,
example
=
"李四"
)
private
String
roleName
;
@Schema
(
description
=
"用户id"
,
example
=
"31619"
)
private
String
userId
;
@Schema
(
description
=
"用户名称"
,
example
=
"王五"
)
private
String
userName
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitInfoRespVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 访问规则配置 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
VisitInfoRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31715"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"规则表外键"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"10305"
)
@ExcelProperty
(
"规则表外键"
)
private
Long
visitId
;
@Schema
(
description
=
"系统简称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"系统简称"
)
private
String
sysAbbre
;
@Schema
(
description
=
"系统名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@ExcelProperty
(
"系统名称"
)
private
String
sysAbbreName
;
@Schema
(
description
=
"菜单名称"
,
example
=
"王五"
)
@ExcelProperty
(
"菜单名称"
)
private
String
urlName
;
@Schema
(
description
=
"菜单地址"
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"菜单地址"
)
private
String
url
;
@Schema
(
description
=
"菜单地址Id"
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"菜单地址Id"
)
private
String
urlId
;
@Schema
(
description
=
"角色id"
,
example
=
"6818"
)
@ExcelProperty
(
"角色id"
)
private
String
roleId
;
@Schema
(
description
=
"角色名称"
,
example
=
"李四"
)
@ExcelProperty
(
"角色名称"
)
private
String
roleName
;
@Schema
(
description
=
"用户id"
,
example
=
"31619"
)
@ExcelProperty
(
"用户id"
)
private
String
userId
;
@Schema
(
description
=
"用户名称"
,
example
=
"王五"
)
@ExcelProperty
(
"用户名称"
)
private
String
userName
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitInfoSaveReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.util.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 访问规则配置新增/修改 Request VO"
)
@Data
public
class
VisitInfoSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"31715"
)
private
Long
id
;
@Schema
(
description
=
"规则表外键"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"10305"
)
@NotNull
(
message
=
"规则表外键不能为空"
)
private
Long
visitId
;
@Schema
(
description
=
"系统简称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@NotEmpty
(
message
=
"系统简称不能为空"
)
private
String
sysAbbre
;
@Schema
(
description
=
"系统名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"王五"
)
@NotEmpty
(
message
=
"系统名称不能为空"
)
private
String
sysAbbreName
;
@Schema
(
description
=
"菜单名称"
,
example
=
"王五"
)
private
String
urlName
;
@Schema
(
description
=
"菜单地址"
,
example
=
"https://www.iocoder.cn"
)
private
String
url
;
@Schema
(
description
=
"菜单地址Id"
,
example
=
"https://www.iocoder.cn"
)
private
String
urlId
;
@Schema
(
description
=
"角色id"
,
example
=
"6818"
)
private
String
roleId
;
@Schema
(
description
=
"角色名称"
,
example
=
"李四"
)
private
String
roleName
;
@Schema
(
description
=
"用户id"
,
example
=
"31619"
)
private
String
userId
;
@Schema
(
description
=
"用户名称"
,
example
=
"王五"
)
private
String
userName
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitPageReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
lombok.*
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDateTime
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
@Schema
(
description
=
"管理后台 - 接口安全访问策略分页 Request VO"
)
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
VisitPageReqVO
extends
PageParam
{
@Schema
(
description
=
"规则名称"
,
example
=
"芋艿"
)
private
String
name
;
@Schema
(
description
=
"创建时间"
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
private
LocalDateTime
[]
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitRespVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
java.time.LocalDateTime
;
import
com.alibaba.excel.annotation.*
;
@Schema
(
description
=
"管理后台 - 接口安全访问策略 Response VO"
)
@Data
@ExcelIgnoreUnannotated
public
class
VisitRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2361"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"规则名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"芋艿"
)
@ExcelProperty
(
"规则名称"
)
private
String
name
;
@Schema
(
description
=
"创建时间"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
)
@ExcelProperty
(
"创建时间"
)
private
LocalDateTime
createTime
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/VisitSaveReqVO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
controller
.
vo
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.*
;
import
javax.validation.constraints.*
;
@Schema
(
description
=
"管理后台 - 接口安全访问策略新增/修改 Request VO"
)
@Data
public
class
VisitSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"2361"
)
private
Long
id
;
@Schema
(
description
=
"规则名称"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"芋艿"
)
@NotEmpty
(
message
=
"规则名称不能为空"
)
private
String
name
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/KeyCodeMapper.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dal
;
import
cn.gintone.controller.vo.KeyCodePageReqVO
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 公钥私钥管理 Mapper
*
* @author 胡懿
*/
@Mapper
public
interface
KeyCodeMapper
extends
BaseMapperX
<
KeyCodeDO
>
{
default
PageResult
<
KeyCodeDO
>
selectPage
(
KeyCodePageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
KeyCodeDO
>()
.
eqIfPresent
(
KeyCodeDO:
:
getType
,
reqVO
.
getType
())
.
eqIfPresent
(
KeyCodeDO:
:
getPublicKey
,
reqVO
.
getPublicKey
())
.
eqIfPresent
(
KeyCodeDO:
:
getPrivateKey
,
reqVO
.
getPrivateKey
())
.
betweenIfPresent
(
KeyCodeDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
betweenIfPresent
(
KeyCodeDO:
:
getUpdateTime
,
reqVO
.
getUpdateTime
())
.
orderByDesc
(
KeyCodeDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/MyTableMapper.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dal
;
import
cn.gintone.controller.vo.MyTablePageReqVO
;
import
cn.gintone.entity.MyTableDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 我的测试表 Mapper
*
* @author 胡懿
*/
@Mapper
public
interface
MyTableMapper
extends
BaseMapperX
<
MyTableDO
>
{
default
PageResult
<
MyTableDO
>
selectPage
(
MyTablePageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
MyTableDO
>()
.
likeIfPresent
(
MyTableDO:
:
getName
,
reqVO
.
getName
())
.
eqIfPresent
(
MyTableDO:
:
getAge
,
reqVO
.
getAge
())
.
eqIfPresent
(
MyTableDO:
:
getMoney
,
reqVO
.
getMoney
())
.
orderByDesc
(
MyTableDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/UserDesRuleMapper.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dal
;
import
cn.gintone.controller.vo.UserDesRulePageReqVO
;
import
cn.gintone.entity.UserDesRuleDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 人员脱敏规则 Mapper
*
* @author 胡懿
*/
@Mapper
public
interface
UserDesRuleMapper
extends
BaseMapperX
<
UserDesRuleDO
>
{
default
PageResult
<
UserDesRuleDO
>
selectPage
(
UserDesRulePageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
UserDesRuleDO
>()
.
likeIfPresent
(
UserDesRuleDO:
:
getName
,
reqVO
.
getName
())
.
likeIfPresent
(
UserDesRuleDO:
:
getAttr
,
reqVO
.
getAttr
())
.
betweenIfPresent
(
UserDesRuleDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
UserDesRuleDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/VisitInfoMapper.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dal
;
import
cn.gintone.controller.vo.VisitInfoPageReqVO
;
import
cn.gintone.controller.vo.VisitInfoRespVO
;
import
cn.gintone.entity.VisitInfoDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* 访问规则配置 Mapper
*
* @author 胡懿
*/
@Mapper
public
interface
VisitInfoMapper
extends
BaseMapperX
<
VisitInfoDO
>
{
default
PageResult
<
VisitInfoDO
>
selectPage
(
VisitInfoPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
VisitInfoDO
>()
.
eqIfPresent
(
VisitInfoDO:
:
getVisitId
,
reqVO
.
getVisitId
())
.
eqIfPresent
(
VisitInfoDO:
:
getSysAbbre
,
reqVO
.
getSysAbbre
())
.
likeIfPresent
(
VisitInfoDO:
:
getSysAbbreName
,
reqVO
.
getSysAbbreName
())
.
likeIfPresent
(
VisitInfoDO:
:
getUrlName
,
reqVO
.
getUrlName
())
.
eqIfPresent
(
VisitInfoDO:
:
getUrl
,
reqVO
.
getUrl
())
.
eqIfPresent
(
VisitInfoDO:
:
getUrlId
,
reqVO
.
getUrlId
())
.
eqIfPresent
(
VisitInfoDO:
:
getRoleId
,
reqVO
.
getRoleId
())
.
likeIfPresent
(
VisitInfoDO:
:
getRoleName
,
reqVO
.
getRoleName
())
.
eqIfPresent
(
VisitInfoDO:
:
getUserId
,
reqVO
.
getUserId
())
.
likeIfPresent
(
VisitInfoDO:
:
getUserName
,
reqVO
.
getUserName
())
.
betweenIfPresent
(
VisitInfoDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
VisitInfoDO:
:
getId
));
}
default
List
<
VisitInfoDO
>
selectList
(
VisitInfoPageReqVO
reqVO
)
{
List
<
VisitInfoDO
>
visitInfoDOS
=
selectList
(
new
LambdaQueryWrapperX
<
VisitInfoDO
>()
.
eqIfPresent
(
VisitInfoDO:
:
getVisitId
,
reqVO
.
getVisitId
())
.
eqIfPresent
(
VisitInfoDO:
:
getSysAbbre
,
reqVO
.
getSysAbbre
())
.
likeIfPresent
(
VisitInfoDO:
:
getSysAbbreName
,
reqVO
.
getSysAbbreName
())
.
likeIfPresent
(
VisitInfoDO:
:
getUrlName
,
reqVO
.
getUrlName
())
.
eqIfPresent
(
VisitInfoDO:
:
getUrl
,
reqVO
.
getUrl
())
.
eqIfPresent
(
VisitInfoDO:
:
getUrlId
,
reqVO
.
getUrlId
())
.
eqIfPresent
(
VisitInfoDO:
:
getRoleId
,
reqVO
.
getRoleId
())
.
likeIfPresent
(
VisitInfoDO:
:
getRoleName
,
reqVO
.
getRoleName
())
.
eqIfPresent
(
VisitInfoDO:
:
getUserId
,
reqVO
.
getUserId
())
.
likeIfPresent
(
VisitInfoDO:
:
getUserName
,
reqVO
.
getUserName
())
.
betweenIfPresent
(
VisitInfoDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
VisitInfoDO:
:
getId
));
return
visitInfoDOS
;
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/VisitMapper.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dal
;
import
cn.gintone.controller.vo.VisitPageReqVO
;
import
cn.gintone.entity.VisitDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 接口安全访问策略 Mapper
*
* @author 胡懿
*/
@Mapper
public
interface
VisitMapper
extends
BaseMapperX
<
VisitDO
>
{
default
PageResult
<
VisitDO
>
selectPage
(
VisitPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
VisitDO
>()
.
likeIfPresent
(
VisitDO:
:
getName
,
reqVO
.
getName
())
.
betweenIfPresent
(
VisitDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
VisitDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/DesInfo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dto
;
public
class
DesInfo
{
private
String
jsonStr
;
private
String
jsonArrStr
;
public
String
getJsonStr
()
{
return
jsonStr
;
}
public
void
setJsonStr
(
String
jsonStr
)
{
this
.
jsonStr
=
jsonStr
;
}
public
String
getJsonArrStr
()
{
return
jsonArrStr
;
}
public
void
setJsonArrStr
(
String
jsonArrStr
)
{
this
.
jsonArrStr
=
jsonArrStr
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/EncInfo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dto
;
/**
* 加密信息
*/
public
class
EncInfo
{
private
String
privateKey
;
private
String
info
;
public
String
getPrivateKey
()
{
return
privateKey
;
}
public
void
setPrivateKey
(
String
privateKey
)
{
this
.
privateKey
=
privateKey
;
}
public
String
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
this
.
info
=
info
;
}
@Override
public
String
toString
()
{
return
"EncInfo{"
+
"privateKey='"
+
privateKey
+
'\''
+
", info='"
+
info
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/WebIllLogInfo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dto
;
public
class
WebIllLogInfo
{
private
Long
timesta
;
private
String
timestaStr
;
private
String
userId
;
// 用户id
private
String
username
;
// 用户名
private
String
sysAbbre
;
// 系统简称
private
String
url
;
// 访问链接
private
String
accessed
;
// 访问时间
private
String
type
;
// 日志类型(url, info, warning, error)
private
String
clientIp
;
// 访问端ip
private
String
remark
;
// 备注
private
String
illType
;
// 非法访问类型(noRule:无访问策略配置)
public
Long
getTimesta
()
{
return
timesta
;
}
public
void
setTimesta
(
Long
timesta
)
{
this
.
timesta
=
timesta
;
}
public
String
getTimestaStr
()
{
return
timestaStr
;
}
public
void
setTimestaStr
(
String
timestaStr
)
{
this
.
timestaStr
=
timestaStr
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getAccessed
()
{
return
accessed
;
}
public
void
setAccessed
(
String
accessed
)
{
this
.
accessed
=
accessed
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getClientIp
()
{
return
clientIp
;
}
public
void
setClientIp
(
String
clientIp
)
{
this
.
clientIp
=
clientIp
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
public
String
getIllType
()
{
return
illType
;
}
public
void
setIllType
(
String
illType
)
{
this
.
illType
=
illType
;
}
@Override
public
String
toString
()
{
return
"WebIllLogInfo{"
+
"timesta="
+
timesta
+
", timestaStr='"
+
timestaStr
+
'\''
+
", userId='"
+
userId
+
'\''
+
", username='"
+
username
+
'\''
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
", url='"
+
url
+
'\''
+
", accessed='"
+
accessed
+
'\''
+
", type='"
+
type
+
'\''
+
", clientIp='"
+
clientIp
+
'\''
+
", remark='"
+
remark
+
'\''
+
", illType='"
+
illType
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/WebLogInfo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dto
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
public
class
WebLogInfo
{
private
Long
timesta
;
private
String
timestaStr
;
private
String
userId
;
// 用户id
private
String
username
;
// 用户名
private
String
sysAbbre
;
// 系统简称
private
String
url
;
// 访问链接
private
String
accessed
;
// 访问时间
private
String
type
;
// 日志类型(url, info, warning, error)
private
String
clientIp
;
// 访问端ip
private
String
remark
;
// 备注
public
Long
getTimesta
()
{
return
timesta
;
}
public
void
setTimesta
(
Long
timesta
)
{
this
.
timesta
=
timesta
;
}
public
String
getTimestaStr
()
{
return
timestaStr
;
}
public
void
setTimestaStr
(
String
timestaStr
)
{
this
.
timestaStr
=
timestaStr
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
public
String
getUrl
()
{
return
url
;
}
public
void
setUrl
(
String
url
)
{
this
.
url
=
url
;
}
public
String
getAccessed
()
{
return
accessed
;
}
public
void
setAccessed
(
String
accessed
)
{
this
.
accessed
=
accessed
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getClientIp
()
{
return
clientIp
;
}
public
void
setClientIp
(
String
clientIp
)
{
this
.
clientIp
=
clientIp
;
}
public
String
getRemark
()
{
return
remark
;
}
public
void
setRemark
(
String
remark
)
{
this
.
remark
=
remark
;
}
@Override
public
String
toString
()
{
return
"WebLogInfo{"
+
"timesta="
+
timesta
+
", timestaStr='"
+
timestaStr
+
'\''
+
", userId='"
+
userId
+
'\''
+
", username='"
+
username
+
'\''
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
", url='"
+
url
+
'\''
+
", accessed='"
+
accessed
+
'\''
+
", type='"
+
type
+
'\''
+
", clientIp='"
+
clientIp
+
'\''
+
", remark='"
+
remark
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/WebLogInfoVo.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
dto
;
/**
* WebLogInfo的查询对象
*/
public
class
WebLogInfoVo
{
private
Long
beginTime
;
private
Long
endTime
;
private
String
type
;
private
String
sysAbbre
;
private
Integer
pageSize
;
private
Integer
pageNum
;
private
Integer
illType
;
public
Long
getBeginTime
()
{
return
beginTime
;
}
public
void
setBeginTime
(
Long
beginTime
)
{
this
.
beginTime
=
beginTime
;
}
public
Long
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Long
endTime
)
{
this
.
endTime
=
endTime
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
public
Integer
getPageSize
()
{
return
pageSize
;
}
public
void
setPageSize
(
Integer
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
public
Integer
getPageNum
()
{
return
pageNum
;
}
public
void
setPageNum
(
Integer
pageNum
)
{
this
.
pageNum
=
pageNum
;
}
public
Integer
getIllType
()
{
return
illType
;
}
public
void
setIllType
(
Integer
illType
)
{
this
.
illType
=
illType
;
}
@Override
public
String
toString
()
{
return
"WebLogInfoVo{"
+
"beginTime="
+
beginTime
+
", endTime="
+
endTime
+
", type='"
+
type
+
'\''
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
", pageSize="
+
pageSize
+
", pageNum="
+
pageNum
+
", illType="
+
illType
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/DataDesensitizationUtils.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
cn.hutool.json.JSONObject
;
import
com.alibaba.druid.util.StringUtils
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.IvParameterSpec
;
import
javax.crypto.spec.PBEKeySpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.nio.charset.StandardCharsets
;
import
java.security.spec.KeySpec
;
import
java.util.*
;
import
java.util.concurrent.ThreadLocalRandom
;
public
class
DataDesensitizationUtils
{
// 无效化处理(从第几位到第几位)
public
static
String
invalidatePhone
(
String
str
,
int
beginNum
,
int
endNum
)
{
if
(
StringUtils
.
isEmpty
(
str
))
{
return
"**"
;
}
if
(
beginNum
>
endNum
)
{
return
"**"
;
}
String
score
=
""
;
for
(
int
i
=
0
;
i
<
(
endNum
-
beginNum
);
i
++)
{
score
+=
"*"
;
}
if
(
endNum
>=
str
.
length
())
{
return
str
.
substring
(
0
,
beginNum
)
+
score
+
str
.
substring
(
str
.
length
()
);
}
return
str
.
substring
(
0
,
beginNum
)
+
score
+
str
.
substring
(
endNum
);
}
// 随机值替换
public
static
String
randomPhone
(
String
str
)
{
if
(
str
==
null
||
str
.
isEmpty
())
{
return
str
;
}
Random
random
=
new
Random
();
char
[]
chars
=
str
.
toCharArray
();
for
(
int
i
=
0
;
i
<
chars
.
length
;
i
++)
{
// 生成32到126之间的随机ASCII字符(包含空格和可打印字符)
chars
[
i
]
=
(
char
)
(
random
.
nextInt
(
95
)
+
32
);
}
return
new
String
(
chars
);
}
// 数据替换
public
static
String
replaceRange
(
String
original
,
String
replacement
,
int
start
,
int
end
)
{
if
(
original
==
null
)
{
return
null
;
}
// 处理替换字符串为null的情况
if
(
replacement
==
null
)
{
replacement
=
""
;
}
// 规范索引范围
int
safeStart
=
Math
.
max
(
0
,
start
);
int
safeEnd
=
Math
.
min
(
end
,
original
.
length
());
// 确保起始索引不大于结束索引
if
(
safeStart
>
safeEnd
)
{
int
temp
=
safeStart
;
safeStart
=
safeEnd
;
safeEnd
=
temp
;
}
// 构建新字符串
String
prefix
=
original
.
substring
(
0
,
safeStart
);
String
suffix
=
original
.
substring
(
safeEnd
);
return
prefix
+
replacement
+
suffix
;
}
// 对称加密(示例)
public
static
String
encryptAES
(
String
data
,
String
key
)
throws
Exception
{
SecretKeySpec
secretKey
=
new
SecretKeySpec
(
key
.
getBytes
(
StandardCharsets
.
UTF_8
),
"AES"
);
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/ECB/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
secretKey
);
byte
[]
encrypted
=
cipher
.
doFinal
(
data
.
getBytes
());
return
Base64
.
getEncoder
().
encodeToString
(
encrypted
);
}
// 解密方法
public
static
String
decryptAES
(
String
encryptedData
,
String
key
)
throws
Exception
{
// 1. 创建相同的密钥规范
SecretKeySpec
secretKey
=
new
SecretKeySpec
(
key
.
getBytes
(
StandardCharsets
.
UTF_8
),
"AES"
);
// 2. 获取密码器实例(参数必须与加密时完全一致)
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/ECB/PKCS5Padding"
);
// 3. 初始化密码器为解密模式
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
secretKey
);
// 4. 执行解密操作
byte
[]
decodedData
=
Base64
.
getDecoder
().
decode
(
encryptedData
);
byte
[]
decrypted
=
cipher
.
doFinal
(
decodedData
);
return
new
String
(
decrypted
,
StandardCharsets
.
UTF_8
);
}
/*// 偏移运算
public static int offsetAndRound(long value, int offsetRange) {
int offset = ThreadLocalRandom.current().nextInt(-offsetRange, offsetRange + 1);
return (int) Math.round(value + offset + ThreadLocalRandom.current().nextDouble());
}*/
// 偏移运算
public
static
String
shiftString
(
String
str
,
int
num
)
{
if
(
str
==
null
||
str
.
isEmpty
())
return
str
;
StringBuilder
sb
=
new
StringBuilder
();
for
(
char
c
:
str
.
toCharArray
())
{
// 计算偏移后的字符(自动处理char越界)
sb
.
append
((
char
)
(
c
+
num
));
}
return
sb
.
toString
();
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/*System.out.println("手机号脱敏: " + invalidatePhone("13812345678", 2, 5));
System.out.println("随机替换: " + randomPhone("阿斯顿发生大法师大法师放大132123fsdasdfasdfasf"));
String str = "asdfadfasdfasdfasdfasdfasdfasdfasdfasddfasdfhdfghfdghd";
str = encryptAES(str, "sx+htIs=6a2t8qt%");
System.out.println(str);
System.out.println(decryptAES(str, "sx+htIs=6a2t8qt%"));
System.out.println(shiftString("asdfjasdfiosdj呼呼收到回复", 12));*/
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"name"
,
"胡懿"
);
Long
l
=
15234609999L
;
jsonObject
.
put
(
"phone"
,
l
);
long
idCard
=
142222199514442333L
;
jsonObject
.
put
(
"idCard"
,
idCard
);
System
.
out
.
println
(
jsonObject
.
toString
());
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/PemFileGenerator.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
java.io.FileWriter
;
import
java.nio.charset.StandardCharsets
;
import
java.security.KeyPair
;
import
java.security.KeyPairGenerator
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Map
;
// 生成公私钥
public
class
PemFileGenerator
{
// 生成RSA密钥对
public
static
KeyPair
generateRSAKeyPair
(
int
keySize
)
throws
Exception
{
KeyPairGenerator
keyPairGenerator
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
keyPairGenerator
.
initialize
(
keySize
);
return
keyPairGenerator
.
generateKeyPair
();
}
// 将公钥转换为PEM格式字符串
public
static
String
publicKeyToPem
(
PublicKey
publicKey
)
{
byte
[]
encoded
=
publicKey
.
getEncoded
();
String
base64
=
Base64
.
getEncoder
().
encodeToString
(
encoded
);
return
formatPem
(
base64
,
"PUBLIC KEY"
);
}
// 将私钥转换为PEM格式字符串
public
static
String
privateKeyToPem
(
PrivateKey
privateKey
)
{
byte
[]
encoded
=
privateKey
.
getEncoded
();
String
base64
=
Base64
.
getEncoder
().
encodeToString
(
encoded
);
return
formatPem
(
base64
,
"PRIVATE KEY"
);
}
// 格式化PEM内容
private
static
String
formatPem
(
String
base64
,
String
keyType
)
{
StringBuilder
pem
=
new
StringBuilder
();
pem
.
append
(
"-----BEGIN "
).
append
(
keyType
).
append
(
"-----\n"
);
// 每64个字符换行
int
lineLength
=
64
;
for
(
int
i
=
0
;
i
<
base64
.
length
();
i
+=
lineLength
)
{
int
end
=
Math
.
min
(
i
+
lineLength
,
base64
.
length
());
pem
.
append
(
base64
,
i
,
end
).
append
(
"\n"
);
}
pem
.
append
(
"-----END "
).
append
(
keyType
).
append
(
"-----\n"
);
return
pem
.
toString
();
}
// 完整生成示例
public
static
Map
<
String
,
String
>
generateAndSaveKeyPair
(
int
keySize
)
throws
Exception
{
// 生成密钥对
KeyPair
keyPair
=
generateRSAKeyPair
(
keySize
);
// 转换为PEM格式
String
publicPem
=
publicKeyToPem
(
keyPair
.
getPublic
());
String
privatePem
=
privateKeyToPem
(
keyPair
.
getPrivate
());
Map
<
String
,
String
>
keyMap
=
new
HashMap
<
String
,
String
>();
keyMap
.
put
(
"publicPem"
,
publicPem
);
keyMap
.
put
(
"privatePem"
,
privatePem
);
return
keyMap
;
}
// 测试用例
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// 生成2048位的RSA密钥对
generateAndSaveKeyPair
(
2048
);
System
.
out
.
println
(
"密钥对已生成:"
);
System
.
out
.
println
(
"公钥 -> public_key.pem"
);
System
.
out
.
println
(
"私钥 -> private_key.pem"
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/SM2KeyUtils.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.jce.spec.ECParameterSpec
;
import
org.bouncycastle.jce.spec.ECPrivateKeySpec
;
import
org.bouncycastle.jce.spec.ECPublicKeySpec
;
import
org.bouncycastle.jce.interfaces.ECPrivateKey
;
import
org.bouncycastle.jce.interfaces.ECPublicKey
;
import
org.bouncycastle.jce.ECNamedCurveTable
;
import
org.bouncycastle.math.ec.ECPoint
;
import
java.security.*
;
import
java.security.spec.*
;
import
java.util.Base64
;
public
class
SM2KeyUtils
{
static
{
Security
.
addProvider
(
new
BouncyCastleProvider
());
}
// 公钥对象转字符串 (Base64)
public
static
String
publicKeyToString
(
PublicKey
publicKey
)
{
if
(
publicKey
==
null
)
return
null
;
ECPublicKey
ecPublicKey
=
(
ECPublicKey
)
publicKey
;
byte
[]
keyBytes
=
ecPublicKey
.
getQ
().
getEncoded
(
true
);
// 压缩格式
return
Base64
.
getEncoder
().
encodeToString
(
keyBytes
);
}
// 字符串转公钥对象
public
static
PublicKey
stringToPublicKey
(
String
publicKeyStr
)
throws
Exception
{
if
(
publicKeyStr
==
null
||
publicKeyStr
.
isEmpty
())
return
null
;
byte
[]
keyBytes
=
Base64
.
getDecoder
().
decode
(
publicKeyStr
);
ECParameterSpec
ecSpec
=
ECNamedCurveTable
.
getParameterSpec
(
"sm2p256v1"
);
ECPoint
ecPoint
=
ecSpec
.
getCurve
().
decodePoint
(
keyBytes
);
ECPublicKeySpec
keySpec
=
new
ECPublicKeySpec
(
ecPoint
,
ecSpec
);
return
KeyFactory
.
getInstance
(
"EC"
,
"BC"
).
generatePublic
(
keySpec
);
}
// 私钥对象转字符串 (Base64)
public
static
String
privateKeyToString
(
PrivateKey
privateKey
)
{
if
(
privateKey
==
null
)
return
null
;
ECPrivateKey
ecPrivateKey
=
(
ECPrivateKey
)
privateKey
;
byte
[]
keyBytes
=
ecPrivateKey
.
getD
().
toByteArray
();
// 大整数字节
return
Base64
.
getEncoder
().
encodeToString
(
keyBytes
);
}
// 字符串转私钥对象
public
static
PrivateKey
stringToPrivateKey
(
String
privateKeyStr
)
throws
Exception
{
if
(
privateKeyStr
==
null
||
privateKeyStr
.
isEmpty
())
return
null
;
byte
[]
keyBytes
=
Base64
.
getDecoder
().
decode
(
privateKeyStr
);
ECParameterSpec
ecSpec
=
ECNamedCurveTable
.
getParameterSpec
(
"sm2p256v1"
);
ECPrivateKeySpec
keySpec
=
new
ECPrivateKeySpec
(
new
java
.
math
.
BigInteger
(
1
,
keyBytes
),
ecSpec
);
return
KeyFactory
.
getInstance
(
"EC"
,
"BC"
).
generatePrivate
(
keySpec
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/SM2Util.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.jce.spec.ECParameterSpec
;
import
org.bouncycastle.jce.spec.ECPrivateKeySpec
;
import
org.bouncycastle.jce.spec.ECPublicKeySpec
;
import
org.bouncycastle.crypto.engines.SM2Engine
;
import
org.bouncycastle.crypto.params.ECPrivateKeyParameters
;
import
org.bouncycastle.crypto.params.ECPublicKeyParameters
;
import
org.bouncycastle.crypto.params.ParametersWithRandom
;
import
org.bouncycastle.jce.ECNamedCurveTable
;
import
org.bouncycastle.math.ec.ECPoint
;
import
java.security.*
;
import
java.util.Base64
;
public
class
SM2Util
{
static
{
Security
.
addProvider
(
new
BouncyCastleProvider
());
}
// SM2加密方法
public
static
byte
[]
sm2Encrypt
(
byte
[]
data
,
PublicKey
publicKey
)
throws
Exception
{
SM2Engine
engine
=
new
SM2Engine
(
SM2Engine
.
Mode
.
C1C3C2
);
ECPublicKeyParameters
ecPublicKey
=
(
ECPublicKeyParameters
)
ECUtil
.
generatePublicKeyParameter
(
publicKey
);
engine
.
init
(
true
,
new
ParametersWithRandom
(
ecPublicKey
,
new
SecureRandom
()));
return
engine
.
processBlock
(
data
,
0
,
data
.
length
);
}
// SM2解密方法
public
static
byte
[]
sm2Decrypt
(
byte
[]
cipherText
,
PrivateKey
privateKey
)
throws
Exception
{
SM2Engine
engine
=
new
SM2Engine
(
SM2Engine
.
Mode
.
C1C3C2
);
ECPrivateKeyParameters
ecPrivateKey
=
(
ECPrivateKeyParameters
)
ECUtil
.
generatePrivateKeyParameter
(
privateKey
);
engine
.
init
(
false
,
ecPrivateKey
);
return
engine
.
processBlock
(
cipherText
,
0
,
cipherText
.
length
);
}
// 生成SM2密钥对
public
static
KeyPair
generateSm2KeyPair
()
throws
Exception
{
ECParameterSpec
ecSpec
=
ECNamedCurveTable
.
getParameterSpec
(
"sm2p256v1"
);
KeyPairGenerator
keyPairGenerator
=
KeyPairGenerator
.
getInstance
(
"EC"
,
"BC"
);
keyPairGenerator
.
initialize
(
ecSpec
,
new
SecureRandom
());
return
keyPairGenerator
.
generateKeyPair
();
}
// 将公钥转换为字节数组
public
static
byte
[]
publicKeyToBytes
(
PublicKey
publicKey
)
{
return
((
org
.
bouncycastle
.
jce
.
interfaces
.
ECPublicKey
)
publicKey
).
getQ
().
getEncoded
(
true
);
}
// 将字节数组转换为公钥
public
static
PublicKey
bytesToPublicKey
(
byte
[]
keyBytes
)
throws
Exception
{
ECParameterSpec
ecSpec
=
ECNamedCurveTable
.
getParameterSpec
(
"sm2p256v1"
);
ECPoint
ecPoint
=
ecSpec
.
getCurve
().
decodePoint
(
keyBytes
);
ECPublicKeySpec
keySpec
=
new
ECPublicKeySpec
(
ecPoint
,
ecSpec
);
return
KeyFactory
.
getInstance
(
"EC"
,
"BC"
).
generatePublic
(
keySpec
);
}
// 将私钥转换为字节数组
public
static
byte
[]
privateKeyToBytes
(
PrivateKey
privateKey
)
{
return
((
org
.
bouncycastle
.
jce
.
interfaces
.
ECPrivateKey
)
privateKey
).
getD
().
toByteArray
();
}
// 将字节数组转换为私钥
public
static
PrivateKey
bytesToPrivateKey
(
byte
[]
keyBytes
)
throws
Exception
{
ECParameterSpec
ecSpec
=
ECNamedCurveTable
.
getParameterSpec
(
"sm2p256v1"
);
ECPrivateKeySpec
keySpec
=
new
ECPrivateKeySpec
(
new
java
.
math
.
BigInteger
(
1
,
keyBytes
),
ecSpec
);
return
KeyFactory
.
getInstance
(
"EC"
,
"BC"
).
generatePrivate
(
keySpec
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// 生成密钥对
KeyPair
keyPair
=
generateSm2KeyPair
();
PublicKey
publicKey
=
keyPair
.
getPublic
();
PrivateKey
privateKey
=
keyPair
.
getPrivate
();
String
pubStr
=
SM2KeyUtils
.
publicKeyToString
(
publicKey
);
String
priStr
=
SM2KeyUtils
.
privateKeyToString
(
privateKey
);
PublicKey
publicKey1
=
SM2KeyUtils
.
stringToPublicKey
(
pubStr
);
PrivateKey
privateKey1
=
SM2KeyUtils
.
stringToPrivateKey
(
priStr
);
// 测试数据
String
originalText
=
"Hello, SM2加密测试!"
;
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
originalText
+=
"加密测试加密测试加密测试加密测试加密测试加密测试sadfasdfasdfaf"
;
}
byte
[]
data
=
originalText
.
getBytes
(
"UTF-8"
);
// 加密
byte
[]
encryptedData
=
sm2Encrypt
(
data
,
publicKey1
);
System
.
out
.
println
(
"加密结果 (Base64): "
+
Base64
.
getEncoder
().
encodeToString
(
encryptedData
));
// 解密
byte
[]
decryptedData
=
sm2Decrypt
(
encryptedData
,
privateKey1
);
String
decryptedText
=
new
String
(
decryptedData
,
"UTF-8"
);
System
.
out
.
println
(
"解密结果: "
+
decryptedText
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/SecureHybridDecryptor.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.GCMParameterSpec
;
import
javax.crypto.spec.SecretKeySpec
;
import
java.io.ByteArrayInputStream
;
import
java.io.ObjectInputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.nio.file.Files
;
import
java.nio.file.Paths
;
import
java.security.KeyFactory
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.spec.PKCS8EncodedKeySpec
;
import
java.security.spec.X509EncodedKeySpec
;
import
java.util.Base64
;
import
java.util.Map
;
public
class
SecureHybridDecryptor
{
private
static
final
int
GCM_TAG_LENGTH
=
128
;
public
static
String
decrypt
(
String
encryptedData
,
PrivateKey
privateKey
)
throws
Exception
{
String
[]
parts
=
encryptedData
.
split
(
":"
,
3
);
String
encryptedAESKey
=
parts
[
0
];
String
ivBase64
=
parts
[
1
];
String
encryptedText
=
parts
[
2
];
// 1. 解密AES密钥
SecretKey
aesKey
=
decryptAESKey
(
encryptedAESKey
,
privateKey
);
// 2. 解密数据
return
decryptWithAES
(
encryptedText
,
aesKey
,
ivBase64
);
}
public
static
Object
decrypt_Object
(
String
encryptedData
,
PrivateKey
privateKey
)
throws
Exception
{
String
[]
parts
=
encryptedData
.
split
(
":"
,
3
);
String
encryptedAESKey
=
parts
[
0
];
String
ivBase64
=
parts
[
1
];
String
encryptedText
=
parts
[
2
];
// 1. 解密AES密钥
SecretKey
aesKey
=
decryptAESKey
(
encryptedAESKey
,
privateKey
);
// 2. 解密数据
return
decryptWithAES_object
(
encryptedText
,
aesKey
,
ivBase64
);
}
private
static
SecretKey
decryptAESKey
(
String
encryptedKey
,
PrivateKey
privateKey
)
throws
Exception
{
byte
[]
keyBytes
=
Base64
.
getDecoder
().
decode
(
encryptedKey
);
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA/ECB/OAEPWithSHA-256AndMGF1Padding"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
byte
[]
decryptedKey
=
cipher
.
doFinal
(
keyBytes
);
return
new
SecretKeySpec
(
decryptedKey
,
"AES"
);
}
private
static
String
decryptWithAES
(
String
encryptedData
,
SecretKey
aesKey
,
String
ivBase64
)
throws
Exception
{
byte
[]
iv
=
Base64
.
getDecoder
().
decode
(
ivBase64
);
byte
[]
data
=
Base64
.
getDecoder
().
decode
(
encryptedData
);
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/GCM/NoPadding"
);
GCMParameterSpec
spec
=
new
GCMParameterSpec
(
128
,
iv
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
aesKey
,
spec
);
byte
[]
decrypted
=
cipher
.
doFinal
(
data
);
return
new
String
(
decrypted
,
StandardCharsets
.
UTF_8
);
}
private
static
Object
decryptWithAES_object
(
String
encryptedDataBase64
,
SecretKey
aesKey
,
String
ivBase64
)
throws
Exception
{
// 解码Base64编码的加密数据和IV
byte
[]
encryptedData
=
Base64
.
getDecoder
().
decode
(
encryptedDataBase64
);
byte
[]
iv
=
Base64
.
getDecoder
().
decode
(
ivBase64
);
// 使用AES/GCM/NoPadding进行解密
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/GCM/NoPadding"
);
GCMParameterSpec
spec
=
new
GCMParameterSpec
(
GCM_TAG_LENGTH
,
iv
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
aesKey
,
spec
);
byte
[]
decrypted
=
cipher
.
doFinal
(
encryptedData
);
// 将解密后的字节数组反序列化为对象
ByteArrayInputStream
byteArrayInputStream
=
new
ByteArrayInputStream
(
decrypted
);
ObjectInputStream
objectInputStream
=
new
ObjectInputStream
(
byteArrayInputStream
);
Object
obj
=
objectInputStream
.
readObject
();
objectInputStream
.
close
();
return
obj
;
}
// 解密
public
static
PrivateKey
loadPrivateKey
(
String
privateKey
)
throws
Exception
{
privateKey
=
privateKey
.
replace
(
"-----BEGIN PRIVATE KEY-----"
,
""
)
.
replace
(
"-----END PRIVATE KEY-----"
,
""
)
.
replaceAll
(
"\\s"
,
""
);
byte
[]
keyBytes
=
Base64
.
getDecoder
().
decode
(
privateKey
);
PKCS8EncodedKeySpec
spec
=
new
PKCS8EncodedKeySpec
(
keyBytes
);
KeyFactory
kf
=
KeyFactory
.
getInstance
(
"RSA"
);
return
kf
.
generatePrivate
(
spec
);
}
// 公钥加密
public
static
PublicKey
loadPublicKey
(
String
publicKey
)
throws
Exception
{
publicKey
=
publicKey
.
replace
(
"-----BEGIN PUBLIC KEY-----"
,
""
)
.
replace
(
"-----END PUBLIC KEY-----"
,
""
)
.
replaceAll
(
"\\s"
,
""
);
// 清理PEM格式
byte
[]
keyBytes
=
Base64
.
getDecoder
().
decode
(
publicKey
);
X509EncodedKeySpec
spec
=
new
X509EncodedKeySpec
(
keyBytes
);
KeyFactory
kf
=
KeyFactory
.
getInstance
(
"RSA"
);
return
kf
.
generatePublic
(
spec
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
String
original
=
"这是一个需要加密的长文本数据,可以超过任意长度限制。"
;
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
original
+=
"这是一个需要加密的长文本数据,可以超过任意长度限制。"
;
}
Map
<
String
,
String
>
keyMap
=
PemFileGenerator
.
generateAndSaveKeyPair
(
1024
);
PublicKey
publicKey
=
loadPublicKey
(
keyMap
.
get
(
"publicPem"
));
// 加密
String
encrypted
=
SecureHybridEncryptor
.
encrypt_object
(
original
,
publicKey
);
System
.
out
.
println
(
"加密结果:"
+
encrypted
.
substring
(
0
,
100
)
+
"..."
);
PrivateKey
privateKey
=
loadPrivateKey
(
keyMap
.
get
(
"privatePem"
));
// 解密
Object
decrypted
=
SecureHybridDecryptor
.
decrypt_Object
(
encrypted
,
privateKey
);
System
.
out
.
println
(
"解密结果验证:"
+
decrypted
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/SecureHybridEncryptor.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
encryptionUtils
;
import
javax.crypto.Cipher
;
import
javax.crypto.KeyGenerator
;
import
javax.crypto.SecretKey
;
import
javax.crypto.spec.GCMParameterSpec
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ObjectOutputStream
;
import
java.nio.charset.StandardCharsets
;
import
java.security.PublicKey
;
import
java.security.SecureRandom
;
import
java.util.Base64
;
public
class
SecureHybridEncryptor
{
private
static
final
int
AES_KEY_SIZE
=
128
;
private
static
final
int
GCM_TAG_LENGTH
=
128
;
private
static
final
int
GCM_IV_LENGTH
=
12
;
// bytes
// 主加密方法
public
static
String
encrypt
(
String
plaintext
,
PublicKey
publicKey
)
throws
Exception
{
// 1. 生成随机AES密钥
SecretKey
aesKey
=
generateAESKey
();
// 2. 使用AES加密原始数据
byte
[]
iv
=
generateSecureIV
();
String
[]
aesResult
=
encryptWithAES
(
plaintext
,
aesKey
,
iv
);
String
encryptedData
=
aesResult
[
0
];
String
ivBase64
=
aesResult
[
1
];
// 3. 使用RSA加密AES密钥
String
encryptedAESKey
=
encryptAESKey
(
aesKey
,
publicKey
);
// 4. 组合加密结果
return
formatFinalResult
(
encryptedAESKey
,
ivBase64
,
encryptedData
);
}
public
static
String
encrypt_object
(
Object
obj
,
PublicKey
publicKey
)
throws
Exception
{
// 1. 生成随机AES密钥
SecretKey
aesKey
=
generateAESKey
();
// 2. 使用AES加密原始数据
byte
[]
iv
=
generateSecureIV
();
String
[]
aesResult
=
encryptWithAES_object
(
obj
,
aesKey
,
iv
);
String
encryptedData
=
aesResult
[
0
];
String
ivBase64
=
aesResult
[
1
];
// 3. 使用RSA加密AES密钥
String
encryptedAESKey
=
encryptAESKey
(
aesKey
,
publicKey
);
// 4. 组合加密结果
return
formatFinalResult
(
encryptedAESKey
,
ivBase64
,
encryptedData
);
}
private
static
SecretKey
generateAESKey
()
throws
Exception
{
KeyGenerator
keyGen
=
KeyGenerator
.
getInstance
(
"AES"
);
keyGen
.
init
(
AES_KEY_SIZE
);
return
keyGen
.
generateKey
();
}
private
static
byte
[]
generateSecureIV
()
{
byte
[]
iv
=
new
byte
[
GCM_IV_LENGTH
];
new
SecureRandom
().
nextBytes
(
iv
);
return
iv
;
}
private
static
String
[]
encryptWithAES
(
String
plaintext
,
SecretKey
aesKey
,
byte
[]
iv
)
throws
Exception
{
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/GCM/NoPadding"
);
GCMParameterSpec
spec
=
new
GCMParameterSpec
(
GCM_TAG_LENGTH
,
iv
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
aesKey
,
spec
);
byte
[]
encrypted
=
cipher
.
doFinal
(
plaintext
.
getBytes
(
StandardCharsets
.
UTF_8
));
return
new
String
[]
{
Base64
.
getEncoder
().
encodeToString
(
encrypted
),
Base64
.
getEncoder
().
encodeToString
(
iv
)
};
}
private
static
String
[]
encryptWithAES_object
(
Object
obj
,
SecretKey
aesKey
,
byte
[]
iv
)
throws
Exception
{
// 将对象序列化为字节数组
ByteArrayOutputStream
byteArrayOutputStream
=
new
ByteArrayOutputStream
();
ObjectOutputStream
objectOutputStream
=
new
ObjectOutputStream
(
byteArrayOutputStream
);
objectOutputStream
.
writeObject
(
obj
);
objectOutputStream
.
flush
();
byte
[]
serializedObject
=
byteArrayOutputStream
.
toByteArray
();
objectOutputStream
.
close
();
Cipher
cipher
=
Cipher
.
getInstance
(
"AES/GCM/NoPadding"
);
GCMParameterSpec
spec
=
new
GCMParameterSpec
(
GCM_TAG_LENGTH
,
iv
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
aesKey
,
spec
);
byte
[]
encrypted
=
cipher
.
doFinal
(
serializedObject
);
return
new
String
[]
{
Base64
.
getEncoder
().
encodeToString
(
encrypted
),
Base64
.
getEncoder
().
encodeToString
(
iv
)
};
}
private
static
String
encryptAESKey
(
SecretKey
aesKey
,
PublicKey
publicKey
)
throws
Exception
{
Cipher
cipher
=
Cipher
.
getInstance
(
"RSA/ECB/OAEPWithSHA-256AndMGF1Padding"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
publicKey
);
byte
[]
encryptedKey
=
cipher
.
doFinal
(
aesKey
.
getEncoded
());
return
Base64
.
getEncoder
().
encodeToString
(
encryptedKey
);
}
private
static
String
formatFinalResult
(
String
encryptedKey
,
String
iv
,
String
data
)
{
return
encryptedKey
+
":"
+
iv
+
":"
+
data
;
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/KeyCodeDO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
entity
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 公钥私钥管理 DO
*
* @author 胡懿
*/
@TableName
(
"t_key_code"
)
@KeySequence
(
"t_key_code_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
KeyCodeDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 类型用户编号 1:rsa 2:sm2
*/
private
Integer
type
;
/**
* 公钥用户类型
*/
private
String
publicKey
;
/**
* 私钥
*/
private
String
privateKey
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/MyTableDO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
entity
;
import
lombok.*
;
import
java.util.*
;
import
java.math.BigDecimal
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 我的测试表 DO
*
* @author 胡懿
*/
@TableName
(
"t_my_table"
)
@KeySequence
(
"t_my_table_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
MyTableDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* name
*/
private
String
name
;
/**
* age
*/
private
Integer
age
;
/**
* money
*/
private
BigDecimal
money
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/UserDesRuleDO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
entity
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 人员脱敏规则 DO
*
* @author 胡懿
*/
@TableName
(
"t_user_des_rule"
)
@KeySequence
(
"t_user_des_rule_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
UserDesRuleDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 属性名称
*/
private
String
name
;
/**
* 属性描述
*/
private
String
attr
;
/**
* 规则
*/
private
Integer
rule
;
/**
* 配置项1
*/
private
String
valueOne
;
/**
* 配置项2
*/
private
String
valueTwo
;
/**
* 配置项3
*/
private
String
valueThree
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/VisitDO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
entity
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 接口安全访问策略 DO
*
* @author 胡懿
*/
@TableName
(
"t_visit"
)
@KeySequence
(
"t_visit_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
VisitDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 规则名称
*/
private
String
name
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/VisitInfoDO.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
entity
;
import
lombok.*
;
import
java.util.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.*
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
/**
* 访问规则配置 DO
*
* @author 胡懿
*/
@TableName
(
"t_visit_info"
)
@KeySequence
(
"t_visit_info_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
VisitInfoDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 规则表外键
*/
private
Long
visitId
;
/**
* 系统简称
*/
private
String
sysAbbre
;
/**
* 系统名称
*/
private
String
sysAbbreName
;
/**
* 菜单名称
*/
private
String
urlName
;
/**
* 菜单地址
*/
private
String
url
;
/**
* 菜单地址Id
*/
private
String
urlId
;
/**
* 角色id
*/
private
String
roleId
;
/**
* 角色名称
*/
private
String
roleName
;
/**
* 用户id
*/
private
String
userId
;
/**
* 用户名称
*/
private
String
userName
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/IotDBUtil.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
iotdbUtils
;
import
org.apache.iotdb.isession.pool.SessionDataSetWrapper
;
import
org.apache.iotdb.rpc.IoTDBConnectionException
;
import
org.apache.iotdb.rpc.StatementExecutionException
;
import
org.apache.iotdb.session.pool.SessionPool
;
import
org.apache.tsfile.enums.TSDataType
;
import
org.apache.tsfile.file.metadata.enums.CompressionType
;
import
org.apache.tsfile.file.metadata.enums.TSEncoding
;
import
org.apache.tsfile.read.common.Field
;
import
org.apache.tsfile.read.common.RowRecord
;
import
org.apache.tsfile.write.record.Tablet
;
import
org.apache.tsfile.write.schema.MeasurementSchema
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Random
;
public
class
IotDBUtil
{
private
static
SessionPool
sessionPool
;
public
static
void
main
(
String
[]
args
)
{
select
();
}
// 创建数据库
public
static
void
createDatabase
()
{
// Using nodeUrls ensures that when one node goes down, other nodes are automatically connected to retry
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
sessionPool
.
createDatabase
(
"root.myDateTestTwo"
);
// 创建数据库
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 创建对齐时间序列
public
static
void
createAlignedTimeseries
()
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
// 创建对齐时间序列
List
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
"userId"
);
list
.
add
(
"userName"
);
list
.
add
(
"url"
);
List
<
TSDataType
>
list2
=
new
ArrayList
<>();
list2
.
add
(
TSDataType
.
TEXT
);
list2
.
add
(
TSDataType
.
TEXT
);
list2
.
add
(
TSDataType
.
TEXT
);
List
<
TSEncoding
>
list3
=
new
ArrayList
<>();
list3
.
add
(
TSEncoding
.
PLAIN
);
list3
.
add
(
TSEncoding
.
PLAIN
);
list3
.
add
(
TSEncoding
.
PLAIN
);
List
<
CompressionType
>
list4
=
new
ArrayList
<>();
list4
.
add
(
CompressionType
.
UNCOMPRESSED
);
list4
.
add
(
CompressionType
.
UNCOMPRESSED
);
list4
.
add
(
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createAlignedTimeseries
(
"root.myDateTestTwo.tableTwo"
,
list
,
list2
,
list3
,
list4
,
null
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 创建时间序列
public
static
void
createTimeseries
()
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
// 设置数据类型,设置默认编码模式,设置默认压缩模式
sessionPool
.
createTimeseries
(
"root.myDateTestTwo.tableOne.name"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 单行插入
public
static
void
inserOne
()
{
// Using nodeUrls ensures that when one node goes down, other nodes are automatically connected to retry
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
List
<
String
>
list5
=
new
ArrayList
<>();
list5
.
add
(
"name"
);
list5
.
add
(
"age"
);
List
<
TSDataType
>
list6
=
new
ArrayList
<>();
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
INT32
);
List
<
Object
>
values
=
new
ArrayList
<>();
values
.
add
(
"胡懿"
);
values
.
add
(
31
);
sessionPool
.
insertRecord
(
"root.myDateTestTwo.tableOne"
,
System
.
currentTimeMillis
(),
list5
,
list6
,
values
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 批量插入
public
static
void
insetAll
()
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
List
<
String
>
deviceIds
=
new
ArrayList
<>();
List
<
Long
>
times
=
new
ArrayList
<>();
List
<
List
<
String
>>
measurementList
=
new
ArrayList
<>();
List
<
List
<
TSDataType
>>
typeList
=
new
ArrayList
<>();
List
<
List
<
Object
>>
valueList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
50
;
i
++)
{
deviceIds
.
add
(
"root.myDateTestTwo.tableThree"
);
Thread
.
sleep
(
30
);
times
.
add
(
System
.
currentTimeMillis
());
List
<
String
>
measurements
=
new
ArrayList
<>();
measurements
.
add
(
"userId"
);
measurements
.
add
(
"userName"
);
measurements
.
add
(
"url"
);
measurementList
.
add
(
measurements
);
List
<
TSDataType
>
types
=
new
ArrayList
<>();
types
.
add
(
TSDataType
.
TEXT
);
types
.
add
(
TSDataType
.
TEXT
);
types
.
add
(
TSDataType
.
TEXT
);
typeList
.
add
(
types
);
List
<
Object
>
valuexxs
=
new
ArrayList
<>();
valuexxs
.
add
(
""
+
i
);
valuexxs
.
add
(
"胡懿"
+
i
);
valuexxs
.
add
(
"https_"
+
i
);
valueList
.
add
(
valuexxs
);
}
sessionPool
.
insertRecords
(
deviceIds
,
times
,
measurementList
,
typeList
,
valueList
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
InterruptedException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 向单个表中批量写入数据
public
static
void
insertTablet
()
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
// 设置表属性
List
<
MeasurementSchema
>
schemas
=
new
ArrayList
<>();
schemas
.
add
(
new
MeasurementSchema
(
"s1"
,
TSDataType
.
DOUBLE
));
schemas
.
add
(
new
MeasurementSchema
(
"s2"
,
TSDataType
.
DOUBLE
));
schemas
.
add
(
new
MeasurementSchema
(
"s3"
,
TSDataType
.
DOUBLE
));
Tablet
tablet
=
new
Tablet
(
"root.myDateTestTwo.tableFour"
,
schemas
,
101
);
// 最后的100代表设置每次最多添加100条数据
// 添加数据
long
timeMillis
=
System
.
currentTimeMillis
();
Random
random
=
new
Random
();
for
(
int
i
=
1
;
i
<=
100
;
i
++)
{
tablet
.
addTimestamp
(
i
,
timeMillis
);
timeMillis
+=
100
;
for
(
int
s
=
0
;
s
<
3
;
s
++)
{
int
value
=
random
.
nextInt
(
50
);
tablet
.
addValue
(
schemas
.
get
(
s
).
getMeasurementId
(),
i
,
value
+
0.0
);
}
tablet
.
rowSize
++;
}
if
(
tablet
.
rowSize
!=
0
)
{
sessionPool
.
insertTablet
(
tablet
);
tablet
.
reset
();
// 清空tablet
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 查询
public
static
void
select
()
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
"192.168.19.128:6667"
);
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
"root"
)
.
password
(
"root"
)
.
maxSize
(
3
)
.
build
();
SessionDataSetWrapper
sessionDataSetWrapper
=
sessionPool
.
executeQueryStatement
(
"select s1,s2,s3 from root.myDateTestTwo.tableFour"
);
List
<
String
>
columnNames
=
sessionDataSetWrapper
.
getColumnNames
();
System
.
out
.
println
(
columnNames
);
while
(
sessionDataSetWrapper
.
hasNext
())
{
RowRecord
next
=
sessionDataSetWrapper
.
next
();
// 取出一行数据
long
timestamp
=
next
.
getTimestamp
();
// 获取这行的时间戳
List
<
Field
>
fields
=
next
.
getFields
();
Field
field1
=
fields
.
get
(
0
);
double
s1
=
field1
.
getDoubleV
();
Field
field2
=
fields
.
get
(
1
);
double
s2
=
field2
.
getDoubleV
();
Field
field3
=
fields
.
get
(
2
);
double
s3
=
field3
.
getDoubleV
();
System
.
out
.
println
(
timestamp
+
"----"
+
s1
+
"----"
+
s2
+
"-----"
+
s3
);
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/MyDateUtils.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
iotdbUtils
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
MyDateUtils
{
public
static
long
stringToLong
(
String
timeStr
){
try
{
boolean
hasMillis
=
timeStr
.
contains
(
"."
);
String
pattern
=
hasMillis
?
"yyyy-MM-dd HH:mm:ss.SSS"
:
"yyyy-MM-dd HH:mm:ss"
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
pattern
);
Date
date
=
sdf
.
parse
(
timeStr
);
return
date
.
getTime
();
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
String
longToString
(
long
timestamp
)
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss.SSS"
);
Date
date
=
new
Date
(
timestamp
);
return
sdf
.
format
(
date
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/MyIotDbUtils.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
iotdbUtils
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.dto.WebLogInfoVo
;
import
org.apache.iotdb.isession.pool.SessionDataSetWrapper
;
import
org.apache.iotdb.rpc.IoTDBConnectionException
;
import
org.apache.iotdb.rpc.StatementExecutionException
;
import
org.apache.iotdb.session.pool.SessionPool
;
import
org.apache.tsfile.enums.TSDataType
;
import
org.apache.tsfile.file.metadata.enums.CompressionType
;
import
org.apache.tsfile.file.metadata.enums.TSEncoding
;
import
org.apache.tsfile.read.common.Field
;
import
org.apache.tsfile.read.common.RowRecord
;
import
org.springframework.util.StringUtils
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
MyIotDbUtils
{
private
static
SessionPool
sessionPool
;
// 创建数据库
public
static
void
createDatabase
(
IotDbConfig
iotDbConfig
)
{
// Using nodeUrls ensures that when one node goes down, other nodes are automatically connected to retry
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
sessionPool
.
createDatabase
(
"root.myWebLogInfo"
);
// 创建数据库
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
void
createWebLogInfoTimeseries
(
IotDbConfig
iotDbConfig
)
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
// 设置数据类型,设置默认编码模式,设置默认压缩模式
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.userId"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.username"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.sysAbbre"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.url"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.accessed"
,
TSDataType
.
TIMESTAMP
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.type"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.clientIp"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableTwo.remark"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
void
createIllegalLogTimeseries
(
IotDbConfig
iotDbConfig
)
{
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
// 设置数据类型,设置默认编码模式,设置默认压缩模式
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.userId"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.username"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.sysAbbre"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.url"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.accessed"
,
TSDataType
.
TIMESTAMP
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.type"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.clientIp"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.remark"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
createTimeseries
(
"root.myWebLogInfo.tableThree.illType"
,
TSDataType
.
TEXT
,
TSEncoding
.
PLAIN
,
CompressionType
.
UNCOMPRESSED
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
static
void
inserOne
(
IotDbConfig
iotDbConfig
,
WebLogInfo
webLogInfo
)
{
if
(
null
==
webLogInfo
)
{
return
;
}
// Using nodeUrls ensures that when one node goes down, other nodes are automatically connected to retry
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
List
<
String
>
list5
=
new
ArrayList
<>();
list5
.
add
(
"userId"
);
list5
.
add
(
"username"
);
list5
.
add
(
"sysAbbre"
);
list5
.
add
(
"url"
);
list5
.
add
(
"accessed"
);
list5
.
add
(
"type"
);
list5
.
add
(
"clientIp"
);
list5
.
add
(
"remark"
);
List
<
TSDataType
>
list6
=
new
ArrayList
<>();
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TIMESTAMP
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
List
<
Object
>
values
=
new
ArrayList
<>();
values
.
add
(
webLogInfo
.
getUserId
());
values
.
add
(
webLogInfo
.
getUsername
());
values
.
add
(
webLogInfo
.
getSysAbbre
());
values
.
add
(
webLogInfo
.
getUrl
());
values
.
add
(
MyDateUtils
.
stringToLong
(
webLogInfo
.
getAccessed
()));
values
.
add
(
webLogInfo
.
getType
());
values
.
add
(
webLogInfo
.
getClientIp
());
values
.
add
(
webLogInfo
.
getRemark
());
sessionPool
.
insertRecord
(
"root.myWebLogInfo.tableThree"
,
System
.
currentTimeMillis
(),
list5
,
list6
,
values
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 单行插入
public
static
void
inserOne_Ill
(
IotDbConfig
iotDbConfig
,
WebIllLogInfo
webIllLogInfo
)
{
if
(
null
==
webIllLogInfo
)
{
return
;
}
// Using nodeUrls ensures that when one node goes down, other nodes are automatically connected to retry
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
List
<
String
>
list5
=
new
ArrayList
<>();
list5
.
add
(
"userId"
);
list5
.
add
(
"username"
);
list5
.
add
(
"sysAbbre"
);
list5
.
add
(
"url"
);
list5
.
add
(
"accessed"
);
list5
.
add
(
"type"
);
list5
.
add
(
"clientIp"
);
list5
.
add
(
"remark"
);
list5
.
add
(
"illType"
);
List
<
TSDataType
>
list6
=
new
ArrayList
<>();
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TIMESTAMP
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
list6
.
add
(
TSDataType
.
TEXT
);
List
<
Object
>
values
=
new
ArrayList
<>();
values
.
add
(
webIllLogInfo
.
getUserId
());
values
.
add
(
webIllLogInfo
.
getUsername
());
values
.
add
(
webIllLogInfo
.
getSysAbbre
());
values
.
add
(
webIllLogInfo
.
getUrl
());
values
.
add
(
MyDateUtils
.
stringToLong
(
webIllLogInfo
.
getAccessed
()));
values
.
add
(
webIllLogInfo
.
getType
());
values
.
add
(
webIllLogInfo
.
getClientIp
());
values
.
add
(
webIllLogInfo
.
getRemark
());
values
.
add
(
webIllLogInfo
.
getIllType
());
sessionPool
.
insertRecord
(
"root.myWebLogInfo.tableThree"
,
System
.
currentTimeMillis
(),
list5
,
list6
,
values
);
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
// 查询总条数
public
static
long
countWebInfo
(
IotDbConfig
iotDbConfig
,
WebLogInfoVo
webLogInfoVo
)
{
long
num
=
0
;
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"select count(userId) from root.myWebLogInfo.tableTwo"
);
if
((
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
())
||
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
||
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
||
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
())))
{
sb
.
append
(
" where"
);
boolean
needAnd
=
false
;
if
(
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
()
)
{
needAnd
=
true
;
sb
.
append
(
" accessed <= "
+
webLogInfoVo
.
getEndTime
());
}
if
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" accessed >= "
+
webLogInfoVo
.
getBeginTime
());
}
if
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" type = '"
+
webLogInfoVo
.
getType
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" sysAbbre = "
+
"'"
+
webLogInfoVo
.
getSysAbbre
()
+
"'"
);
}
}
String
sql
=
sb
.
toString
();
System
.
out
.
println
(
sql
);
SessionDataSetWrapper
sessionDataSetWrapper
=
sessionPool
.
executeQueryStatement
(
sql
);
List
<
String
>
columnNames
=
sessionDataSetWrapper
.
getColumnNames
();
System
.
out
.
println
(
columnNames
);
while
(
sessionDataSetWrapper
.
hasNext
())
{
RowRecord
next
=
sessionDataSetWrapper
.
next
();
// 取出一行数据
long
timestamp
=
next
.
getTimestamp
();
// 获取这行的时间戳
List
<
Field
>
fields
=
next
.
getFields
();
Field
field0
=
fields
.
get
(
0
);
num
=
field0
.
getLongV
();
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
num
;
}
// 查询列表
public
static
List
<
WebLogInfo
>
selectWebInfo
(
IotDbConfig
iotDbConfig
,
WebLogInfoVo
webLogInfoVo
)
{
List
<
WebLogInfo
>
webLogInfos
=
new
ArrayList
<>();
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
int
offsetNum
=
(
webLogInfoVo
.
getPageNum
()
-
1
)
*
webLogInfoVo
.
getPageSize
()
+
1
;
int
limitNum
=
webLogInfoVo
.
getPageSize
();
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"select userId, username, sysAbbre, url, accessed, type, clientIp, remark from root.myWebLogInfo.tableTwo"
);
if
((
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
())
||
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
||
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
||
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
())))
{
sb
.
append
(
" where"
);
boolean
needAnd
=
false
;
if
(
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
()
)
{
needAnd
=
true
;
sb
.
append
(
" accessed <= "
+
webLogInfoVo
.
getEndTime
());
}
if
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" accessed >= "
+
webLogInfoVo
.
getBeginTime
());
}
if
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" type = '"
+
webLogInfoVo
.
getType
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" sysAbbre = "
+
"'"
+
webLogInfoVo
.
getSysAbbre
()
+
"'"
);
}
}
sb
.
append
(
" order by time desc offset "
+
offsetNum
+
" limit "
+
limitNum
);
String
sql
=
sb
.
toString
();
System
.
out
.
println
(
sql
);
SessionDataSetWrapper
sessionDataSetWrapper
=
sessionPool
.
executeQueryStatement
(
sql
);
List
<
String
>
columnNames
=
sessionDataSetWrapper
.
getColumnNames
();
System
.
out
.
println
(
columnNames
);
while
(
sessionDataSetWrapper
.
hasNext
())
{
RowRecord
next
=
sessionDataSetWrapper
.
next
();
// 取出一行数据
long
timestamp
=
next
.
getTimestamp
();
// 获取这行的时间戳
List
<
Field
>
fields
=
next
.
getFields
();
Field
field0
=
fields
.
get
(
0
);
String
userId
=
field0
.
getStringValue
();
Field
field1
=
fields
.
get
(
1
);
String
username
=
field1
.
getStringValue
();
Field
field2
=
fields
.
get
(
2
);
String
sysAbbre
=
field2
.
getStringValue
();
Field
field3
=
fields
.
get
(
3
);
String
url
=
field3
.
getStringValue
();
Field
field4
=
fields
.
get
(
4
);
long
accessed
=
field4
.
getLongV
();
Field
field5
=
fields
.
get
(
5
);
String
type
=
field5
.
getStringValue
();
Field
field6
=
fields
.
get
(
6
);
String
clientIp
=
field6
.
getStringValue
();
Field
field7
=
fields
.
get
(
7
);
String
remark
=
field7
.
getStringValue
();
WebLogInfo
webLogInfo
=
new
WebLogInfo
();
webLogInfo
.
setTimesta
(
timestamp
);
webLogInfo
.
setTimestaStr
(
MyDateUtils
.
longToString
(
timestamp
));
webLogInfo
.
setUserId
(
userId
);
webLogInfo
.
setUsername
(
username
);
webLogInfo
.
setSysAbbre
(
sysAbbre
);
webLogInfo
.
setUrl
(
url
);
webLogInfo
.
setAccessed
(
MyDateUtils
.
longToString
(
accessed
));
webLogInfo
.
setType
(
type
);
webLogInfo
.
setClientIp
(
clientIp
);
webLogInfo
.
setRemark
(
remark
);
webLogInfos
.
add
(
webLogInfo
);
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
webLogInfos
;
}
// 查询总条数
public
static
long
countWebIllInfo
(
IotDbConfig
iotDbConfig
,
WebLogInfoVo
webLogInfoVo
)
{
long
num
=
0
;
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"select count(userId) from root.myWebLogInfo.tableThree"
);
if
((
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
())
||
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
||
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
||
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
())))
{
sb
.
append
(
" where"
);
boolean
needAnd
=
false
;
if
(
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
()
)
{
needAnd
=
true
;
sb
.
append
(
" accessed <= "
+
webLogInfoVo
.
getEndTime
());
}
if
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" accessed >= "
+
webLogInfoVo
.
getBeginTime
());
}
if
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" type = '"
+
webLogInfoVo
.
getType
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" sysAbbre = "
+
"'"
+
webLogInfoVo
.
getSysAbbre
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getIllType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getIllType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" illType = "
+
"'"
+
webLogInfoVo
.
getIllType
()
+
"'"
);
}
}
String
sql
=
sb
.
toString
();
System
.
out
.
println
(
sql
);
SessionDataSetWrapper
sessionDataSetWrapper
=
sessionPool
.
executeQueryStatement
(
sql
);
List
<
String
>
columnNames
=
sessionDataSetWrapper
.
getColumnNames
();
System
.
out
.
println
(
columnNames
);
while
(
sessionDataSetWrapper
.
hasNext
())
{
RowRecord
next
=
sessionDataSetWrapper
.
next
();
// 取出一行数据
long
timestamp
=
next
.
getTimestamp
();
// 获取这行的时间戳
List
<
Field
>
fields
=
next
.
getFields
();
Field
field0
=
fields
.
get
(
0
);
num
=
field0
.
getLongV
();
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
num
;
}
public
static
List
<
WebIllLogInfo
>
selectWebIllInfo
(
IotDbConfig
iotDbConfig
,
WebLogInfoVo
webLogInfoVo
)
{
List
<
WebIllLogInfo
>
webIllLogInfos
=
new
ArrayList
<>();
try
{
List
<
String
>
nodeUrls
=
new
ArrayList
<>();
nodeUrls
.
add
(
iotDbConfig
.
getIp
()
+
":"
+
iotDbConfig
.
getPort
());
sessionPool
=
new
SessionPool
.
Builder
()
.
nodeUrls
(
nodeUrls
)
.
user
(
iotDbConfig
.
getUsername
())
.
password
(
iotDbConfig
.
getPassword
())
.
maxSize
(
3
)
.
build
();
int
offsetNum
=
(
webLogInfoVo
.
getPageNum
()
-
1
)
*
webLogInfoVo
.
getPageSize
()
+
1
;
int
limitNum
=
webLogInfoVo
.
getPageSize
();
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"select userId, username, sysAbbre, url, accessed, type, clientIp, remark, illType from root.myWebLogInfo.tableThree"
);
if
((
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
())
||
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
||
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
||
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
())))
{
sb
.
append
(
" where"
);
boolean
needAnd
=
false
;
if
(
null
!=
webLogInfoVo
.
getEndTime
()
&&
0
!=
webLogInfoVo
.
getEndTime
()
)
{
needAnd
=
true
;
sb
.
append
(
" accessed <= "
+
webLogInfoVo
.
getEndTime
());
}
if
(
null
!=
webLogInfoVo
.
getBeginTime
()
&&
0
!=
webLogInfoVo
.
getBeginTime
())
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" accessed >= "
+
webLogInfoVo
.
getBeginTime
());
}
if
(
null
!=
webLogInfoVo
.
getType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" type = '"
+
webLogInfoVo
.
getType
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getSysAbbre
()
&&
!
""
.
equals
(
webLogInfoVo
.
getSysAbbre
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" sysAbbre = "
+
"'"
+
webLogInfoVo
.
getSysAbbre
()
+
"'"
);
}
if
(
null
!=
webLogInfoVo
.
getIllType
()
&&
!
""
.
equals
(
webLogInfoVo
.
getIllType
()))
{
if
(
needAnd
)
{
sb
.
append
(
" and"
);
}
needAnd
=
true
;
sb
.
append
(
" illType = "
+
"'"
+
webLogInfoVo
.
getIllType
()
+
"'"
);
}
}
sb
.
append
(
" order by time desc offset "
+
offsetNum
+
" limit "
+
limitNum
);
String
sql
=
sb
.
toString
();
System
.
out
.
println
(
sql
);
SessionDataSetWrapper
sessionDataSetWrapper
=
sessionPool
.
executeQueryStatement
(
sql
);
List
<
String
>
columnNames
=
sessionDataSetWrapper
.
getColumnNames
();
System
.
out
.
println
(
columnNames
);
while
(
sessionDataSetWrapper
.
hasNext
())
{
RowRecord
next
=
sessionDataSetWrapper
.
next
();
// 取出一行数据
long
timestamp
=
next
.
getTimestamp
();
// 获取这行的时间戳
List
<
Field
>
fields
=
next
.
getFields
();
Field
field0
=
fields
.
get
(
0
);
String
userId
=
field0
.
getStringValue
();
Field
field1
=
fields
.
get
(
1
);
String
username
=
field1
.
getStringValue
();
Field
field2
=
fields
.
get
(
2
);
String
sysAbbre
=
field2
.
getStringValue
();
Field
field3
=
fields
.
get
(
3
);
String
url
=
field3
.
getStringValue
();
Field
field4
=
fields
.
get
(
4
);
long
accessed
=
field4
.
getLongV
();
Field
field5
=
fields
.
get
(
5
);
String
type
=
field5
.
getStringValue
();
Field
field6
=
fields
.
get
(
6
);
String
clientIp
=
field6
.
getStringValue
();
Field
field7
=
fields
.
get
(
7
);
String
remark
=
field7
.
getStringValue
();
Field
field8
=
fields
.
get
(
8
);
String
illType
=
field8
.
getStringValue
();
WebIllLogInfo
webIllLogInfo
=
new
WebIllLogInfo
();
webIllLogInfo
.
setTimesta
(
timestamp
);
webIllLogInfo
.
setTimestaStr
(
MyDateUtils
.
longToString
(
timestamp
));
webIllLogInfo
.
setUserId
(
userId
);
webIllLogInfo
.
setUsername
(
username
);
webIllLogInfo
.
setSysAbbre
(
sysAbbre
);
webIllLogInfo
.
setUrl
(
url
);
webIllLogInfo
.
setAccessed
(
MyDateUtils
.
longToString
(
accessed
));
webIllLogInfo
.
setType
(
type
);
webIllLogInfo
.
setClientIp
(
clientIp
);
webIllLogInfo
.
setRemark
(
remark
);
webIllLogInfo
.
setIllType
(
illType
);
webIllLogInfos
.
add
(
webIllLogInfo
);
}
sessionPool
.
close
();
}
catch
(
IoTDBConnectionException
e
)
{
throw
new
RuntimeException
(
e
);
}
catch
(
StatementExecutionException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
webIllLogInfos
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/service/KeyCodeService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.KeyCodePageReqVO
;
import
cn.gintone.controller.vo.KeyCodeSaveReqVO
;
import
cn.gintone.dto.EncInfo
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
/**
* 公钥私钥管理 Service 接口
*
* @author 胡懿
*/
public
interface
KeyCodeService
{
/**
* 创建公钥私钥管理
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createKeyCode
(
@Valid
KeyCodeSaveReqVO
createReqVO
);
/**
* 更新公钥私钥管理
*
* @param updateReqVO 更新信息
*/
void
updateKeyCode
(
@Valid
KeyCodeSaveReqVO
updateReqVO
);
/**
* 删除公钥私钥管理
*
* @param id 编号
*/
void
deleteKeyCode
(
Long
id
);
/**
* 获得公钥私钥管理
*
* @param id 编号
* @return 公钥私钥管理
*/
KeyCodeDO
getKeyCode
(
Long
id
);
/**
* 获得公钥私钥管理分页
*
* @param pageReqVO 分页查询
* @return 公钥私钥管理分页
*/
PageResult
<
KeyCodeDO
>
getKeyCodePage
(
KeyCodePageReqVO
pageReqVO
);
/**
* 初始化公钥私钥
* @return
*/
String
initKey
();
/**
* 使用ras加密
* @param info
* @return
*/
EncInfo
rasEncryption
(
String
info
);
String
rasDecrypt
(
EncInfo
encInfo
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/KeyCodeServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.controller.vo.KeyCodePageReqVO
;
import
cn.gintone.controller.vo.KeyCodeSaveReqVO
;
import
cn.gintone.dal.KeyCodeMapper
;
import
cn.gintone.dto.EncInfo
;
import
cn.gintone.encryptionUtils.*
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
java.security.KeyPair
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.util.List
;
import
java.util.Map
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 公钥私钥管理 Service 实现类
*
* @author 胡懿
*/
@Service
@Validated
public
class
KeyCodeServiceImpl
implements
KeyCodeService
{
@Resource
private
KeyCodeMapper
keyCodeMapper
;
@Override
public
Long
createKeyCode
(
KeyCodeSaveReqVO
createReqVO
)
{
// 插入
KeyCodeDO
keyCode
=
BeanUtils
.
toBean
(
createReqVO
,
KeyCodeDO
.
class
);
keyCodeMapper
.
insert
(
keyCode
);
// 返回
return
keyCode
.
getId
();
}
@Override
public
void
updateKeyCode
(
KeyCodeSaveReqVO
updateReqVO
)
{
// 校验存在
validateKeyCodeExists
(
updateReqVO
.
getId
());
// 更新
KeyCodeDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
KeyCodeDO
.
class
);
keyCodeMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteKeyCode
(
Long
id
)
{
// 校验存在
validateKeyCodeExists
(
id
);
// 删除
keyCodeMapper
.
deleteById
(
id
);
}
private
void
validateKeyCodeExists
(
Long
id
)
{
if
(
keyCodeMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
KEY_CODE_NOT_EXISTS
);
}
}
@Override
public
KeyCodeDO
getKeyCode
(
Long
id
)
{
return
keyCodeMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
KeyCodeDO
>
getKeyCodePage
(
KeyCodePageReqVO
pageReqVO
)
{
return
keyCodeMapper
.
selectPage
(
pageReqVO
);
}
@Override
public
String
initKey
()
{
List
<
KeyCodeDO
>
keyCodeDOS
=
keyCodeMapper
.
selectList
(
new
QueryWrapper
<
KeyCodeDO
>());
System
.
out
.
println
(
"keyCodeDOS:"
+
keyCodeDOS
.
size
());
if
(
null
!=
keyCodeDOS
&&
keyCodeDOS
.
size
()
>
0
)
{
for
(
KeyCodeDO
keyCodeDO
:
keyCodeDOS
){
keyCodeMapper
.
deleteById
(
keyCodeDO
.
getId
());
}
}
try
{
KeyCodeDO
keyCodeDO_rsa
=
new
KeyCodeDO
();
Map
<
String
,
String
>
keyMap
=
PemFileGenerator
.
generateAndSaveKeyPair
(
1024
);
String
pubKey_rsa
=
keyMap
.
get
(
"publicPem"
);
String
priKey_rsa
=
keyMap
.
get
(
"privatePem"
);
keyCodeDO_rsa
.
setType
(
1
);
keyCodeDO_rsa
.
setPublicKey
(
pubKey_rsa
);
keyCodeDO_rsa
.
setPrivateKey
(
priKey_rsa
);
int
insert
=
keyCodeMapper
.
insert
(
keyCodeDO_rsa
);
KeyCodeDO
keyCodeDo_sm2
=
new
KeyCodeDO
();
KeyPair
keyPair
=
SM2Util
.
generateSm2KeyPair
();
PublicKey
publicKey
=
keyPair
.
getPublic
();
PrivateKey
privateKey
=
keyPair
.
getPrivate
();
String
pubStr_sm2
=
SM2KeyUtils
.
publicKeyToString
(
publicKey
);
String
priStr_sm2
=
SM2KeyUtils
.
privateKeyToString
(
privateKey
);
keyCodeDo_sm2
.
setType
(
2
);
keyCodeDo_sm2
.
setPublicKey
(
pubStr_sm2
);
keyCodeDo_sm2
.
setPrivateKey
(
priStr_sm2
);
keyCodeMapper
.
insert
(
keyCodeDo_sm2
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
return
"初始化成功"
;
}
@Override
public
EncInfo
rasEncryption
(
String
info
)
{
EncInfo
encInfo
=
new
EncInfo
();
KeyCodeDO
keyCodeDO
=
keyCodeMapper
.
selectOne
(
new
QueryWrapper
<
KeyCodeDO
>().
eq
(
"type"
,
1
));
if
(
null
!=
keyCodeDO
)
{
try
{
encInfo
.
setPrivateKey
(
keyCodeDO
.
getPrivateKey
());
PublicKey
publicKey
=
SecureHybridDecryptor
.
loadPublicKey
(
keyCodeDO
.
getPublicKey
());
String
encrypt
=
SecureHybridEncryptor
.
encrypt
(
info
,
publicKey
);
encInfo
.
setInfo
(
encrypt
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
return
encInfo
;
}
@Override
public
String
rasDecrypt
(
EncInfo
encInfo
)
{
try
{
PrivateKey
privateKey
=
SecureHybridDecryptor
.
loadPrivateKey
(
encInfo
.
getPrivateKey
());
// 解密
String
decrypted
=
SecureHybridDecryptor
.
decrypt
(
encInfo
.
getInfo
(),
privateKey
);
return
decrypted
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/MySystemService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
public
interface
MySystemService
{
/**
* 获取菜单树
* @param sysAbbre
* @return
*/
public
List
<
AuthPermissionInfoRespVO
.
MenuVO
>
getMenuBySysAbbre
(
String
sysAbbre
);
public
List
<
RoleDO
>
getRolesBySysAbbre
(
String
sysAbbre
);
public
List
<
AdminUserDO
>
getAdminUsersBySysAbbreAndRoleId
(
String
sysAbbre
,
String
roleId
);
}
gt-club/gt-club-biz/src/main/java/cn/gintone/service/MySystemServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.iocoder.yudao.module.system.controller.admin.auth.vo.AuthPermissionInfoRespVO
;
import
cn.iocoder.yudao.module.system.convert.auth.AuthConvert
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper
;
import
cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum
;
import
cn.iocoder.yudao.module.system.service.permission.MenuService
;
import
cn.iocoder.yudao.module.system.service.permission.RoleService
;
import
cn.iocoder.yudao.module.system.service.user.AdminUserService
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
convertSet
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
collection
.
CollectionUtils
.
filterList
;
import
static
cn
.
iocoder
.
yudao
.
module
.
system
.
dal
.
dataobject
.
permission
.
MenuDO
.
ID_ROOT
;
@Service
public
class
MySystemServiceImpl
implements
MySystemService
{
@Autowired
private
MenuService
menuService
;
@Autowired
private
RoleService
roleService
;
@Autowired
private
AdminUserService
adminUserService
;
@Autowired
private
UserRoleMapper
userRoleMapper
;
@Override
public
List
<
AuthPermissionInfoRespVO
.
MenuVO
>
getMenuBySysAbbre
(
String
sysAbbre
)
{
if
(
"secure"
.
equals
(
sysAbbre
))
{
Set
<
Long
>
menuIds
=
convertSet
(
menuService
.
getMenuList
(),
MenuDO:
:
getId
);
List
<
MenuDO
>
menuList
=
menuService
.
getMenuList
(
menuIds
);
menuList
=
menuService
.
filterDisableMenus
(
menuList
);
List
<
AuthPermissionInfoRespVO
.
MenuVO
>
menuVOS
=
buildMenuTree
(
menuList
);
return
menuVOS
;
}
else
{
return
CollUtil
.
newArrayList
();
}
}
@Override
public
List
<
RoleDO
>
getRolesBySysAbbre
(
String
sysAbbre
)
{
if
(
"secure"
.
equals
(
sysAbbre
))
{
return
roleService
.
getRoleList
();
}
else
{
return
CollUtil
.
newArrayList
();
}
}
@Override
public
List
<
AdminUserDO
>
getAdminUsersBySysAbbreAndRoleId
(
String
sysAbbre
,
String
roleId
)
{
List
<
AdminUserDO
>
adminUserDOList
=
new
ArrayList
<>();
if
(
"secure"
.
equals
(
sysAbbre
))
{
List
<
Long
>
roleIds
=
new
ArrayList
<>();
roleIds
.
add
(
Long
.
valueOf
(
roleId
));
List
<
UserRoleDO
>
userRoleDOS
=
userRoleMapper
.
selectListByRoleIds
(
roleIds
);
if
(
null
!=
userRoleDOS
&&
userRoleDOS
.
size
()
>
0
)
{
for
(
UserRoleDO
userRoleDO
:
userRoleDOS
)
{
Long
userId
=
userRoleDO
.
getUserId
();
AdminUserDO
user
=
adminUserService
.
getUser
(
userId
);
adminUserDOList
.
add
(
user
);
}
}
return
adminUserDOList
;
}
return
Collections
.
emptyList
();
}
public
List
<
AuthPermissionInfoRespVO
.
MenuVO
>
buildMenuTree
(
List
<
MenuDO
>
menuList
)
{
if
(
CollUtil
.
isEmpty
(
menuList
))
{
return
Collections
.
emptyList
();
}
// 移除按钮
menuList
.
removeIf
(
menu
->
menu
.
getType
().
equals
(
MenuTypeEnum
.
BUTTON
.
getType
()));
// 排序,保证菜单的有序性
menuList
.
sort
(
Comparator
.
comparing
(
MenuDO:
:
getSort
));
// 构建菜单树
// 使用 LinkedHashMap 的原因,是为了排序 。实际也可以用 Stream API ,就是太丑了。
Map
<
Long
,
AuthPermissionInfoRespVO
.
MenuVO
>
treeNodeMap
=
new
LinkedHashMap
<>();
menuList
.
forEach
(
menu
->
treeNodeMap
.
put
(
menu
.
getId
(),
AuthConvert
.
INSTANCE
.
convertTreeNode
(
menu
)));
// 处理父子关系
treeNodeMap
.
values
().
stream
().
filter
(
node
->
!
node
.
getParentId
().
equals
(
ID_ROOT
)).
forEach
(
childNode
->
{
// 获得父节点
AuthPermissionInfoRespVO
.
MenuVO
parentNode
=
treeNodeMap
.
get
(
childNode
.
getParentId
());
if
(
parentNode
==
null
)
{
LoggerFactory
.
getLogger
(
getClass
()).
error
(
"[buildRouterTree][resource({}) 找不到父资源({})]"
,
childNode
.
getId
(),
childNode
.
getParentId
());
return
;
}
// 将自己添加到父节点中
if
(
parentNode
.
getChildren
()
==
null
)
{
parentNode
.
setChildren
(
new
ArrayList
<>());
}
parentNode
.
getChildren
().
add
(
childNode
);
});
// 获得到所有的根节点
return
filterList
(
treeNodeMap
.
values
(),
node
->
ID_ROOT
.
equals
(
node
.
getParentId
()));
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/service/MyTableService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.MyTablePageReqVO
;
import
cn.gintone.controller.vo.MyTableSaveReqVO
;
import
cn.gintone.entity.MyTableDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
java.util.*
;
import
javax.validation.*
;
/**
* 我的测试表 Service 接口
*
* @author 胡懿
*/
public
interface
MyTableService
{
/**
* 创建我的测试表
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createMyTable
(
@Valid
MyTableSaveReqVO
createReqVO
);
/**
* 更新我的测试表
*
* @param updateReqVO 更新信息
*/
void
updateMyTable
(
@Valid
MyTableSaveReqVO
updateReqVO
);
/**
* 删除我的测试表
*
* @param id 编号
*/
void
deleteMyTable
(
Long
id
);
/**
* 获得我的测试表
*
* @param id 编号
* @return 我的测试表
*/
MyTableDO
getMyTable
(
Long
id
);
/**
* 获得我的测试表分页
*
* @param pageReqVO 分页查询
* @return 我的测试表分页
*/
PageResult
<
MyTableDO
>
getMyTablePage
(
MyTablePageReqVO
pageReqVO
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/MyTableServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.controller.vo.MyTablePageReqVO
;
import
cn.gintone.controller.vo.MyTableSaveReqVO
;
import
cn.gintone.dal.MyTableMapper
;
import
cn.gintone.entity.MyTableDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 我的测试表 Service 实现类
*
* @author 胡懿
*/
@Service
@Validated
public
class
MyTableServiceImpl
implements
MyTableService
{
@Resource
private
MyTableMapper
myTableMapper
;
@Override
public
Long
createMyTable
(
MyTableSaveReqVO
createReqVO
)
{
// 插入
MyTableDO
myTable
=
BeanUtils
.
toBean
(
createReqVO
,
MyTableDO
.
class
);
myTableMapper
.
insert
(
myTable
);
// 返回
return
myTable
.
getId
();
}
@Override
public
void
updateMyTable
(
MyTableSaveReqVO
updateReqVO
)
{
// 校验存在
validateMyTableExists
(
updateReqVO
.
getId
());
// 更新
MyTableDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
MyTableDO
.
class
);
myTableMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteMyTable
(
Long
id
)
{
// 校验存在
validateMyTableExists
(
id
);
// 删除
myTableMapper
.
deleteById
(
id
);
}
private
void
validateMyTableExists
(
Long
id
)
{
if
(
myTableMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
MY_TABLE_NOT_EXISTS
);
}
}
@Override
public
MyTableDO
getMyTable
(
Long
id
)
{
return
myTableMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
MyTableDO
>
getMyTablePage
(
MyTablePageReqVO
pageReqVO
)
{
return
myTableMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/UserDesRuleService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.UserDesRulePageReqVO
;
import
cn.gintone.controller.vo.UserDesRuleSaveReqVO
;
import
cn.gintone.entity.UserDesRuleDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* 人员脱敏规则 Service 接口
*
* @author 胡懿
*/
public
interface
UserDesRuleService
{
/**
* 创建人员脱敏规则
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createUserDesRule
(
@Valid
UserDesRuleSaveReqVO
createReqVO
);
/**
* 更新人员脱敏规则
*
* @param updateReqVO 更新信息
*/
void
updateUserDesRule
(
@Valid
UserDesRuleSaveReqVO
updateReqVO
);
/**
* 删除人员脱敏规则
*
* @param id 编号
*/
void
deleteUserDesRule
(
Long
id
);
/**
* 获得人员脱敏规则
*
* @param id 编号
* @return 人员脱敏规则
*/
UserDesRuleDO
getUserDesRule
(
Long
id
);
/**
* 获得人员脱敏规则分页
*
* @param pageReqVO 分页查询
* @return 人员脱敏规则分页
*/
PageResult
<
UserDesRuleDO
>
getUserDesRulePage
(
UserDesRulePageReqVO
pageReqVO
);
String
userRuleDes
(
String
userJsonStr
);
String
userRuleDesArr
(
String
userJsonArrStr
);
Boolean
checkName
(
String
name
,
Long
id
);
Map
<
String
,
Object
>
userRuleDesMap
(
Map
<
String
,
Object
>
map
);
List
<
Map
<
String
,
Object
>>
userRuleDesListMap
(
List
<
Map
<
String
,
Object
>>
lisetMap
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/UserDesRuleServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.config.AesKeyConfig
;
import
cn.gintone.controller.vo.UserDesRulePageReqVO
;
import
cn.gintone.controller.vo.UserDesRuleSaveReqVO
;
import
cn.gintone.dal.UserDesRuleMapper
;
import
cn.gintone.encryptionUtils.DataDesensitizationUtils
;
import
cn.gintone.entity.UserDesRuleDO
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
java.util.*
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 人员脱敏规则 Service 实现类
*
* @author 胡懿
*/
@Service
@Validated
public
class
UserDesRuleServiceImpl
implements
UserDesRuleService
{
@Resource
private
UserDesRuleMapper
userDesRuleMapper
;
@Resource
private
AesKeyConfig
aesKeyConfig
;
@Override
public
Long
createUserDesRule
(
UserDesRuleSaveReqVO
createReqVO
)
{
// 插入
UserDesRuleDO
userDesRule
=
BeanUtils
.
toBean
(
createReqVO
,
UserDesRuleDO
.
class
);
userDesRuleMapper
.
insert
(
userDesRule
);
// 返回
return
userDesRule
.
getId
();
}
@Override
public
void
updateUserDesRule
(
UserDesRuleSaveReqVO
updateReqVO
)
{
// 校验存在
validateUserDesRuleExists
(
updateReqVO
.
getId
());
// 更新
UserDesRuleDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
UserDesRuleDO
.
class
);
userDesRuleMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteUserDesRule
(
Long
id
)
{
// 校验存在
validateUserDesRuleExists
(
id
);
// 删除
userDesRuleMapper
.
deleteById
(
id
);
}
private
void
validateUserDesRuleExists
(
Long
id
)
{
if
(
userDesRuleMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
USER_DES_RULE_NOT_EXISTS
);
}
}
@Override
public
UserDesRuleDO
getUserDesRule
(
Long
id
)
{
return
userDesRuleMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
UserDesRuleDO
>
getUserDesRulePage
(
UserDesRulePageReqVO
pageReqVO
)
{
return
userDesRuleMapper
.
selectPage
(
pageReqVO
);
}
@Override
public
String
userRuleDes
(
String
userJsonStr
)
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
();
Map
<
String
,
UserDesRuleDO
>
ruleDOMap
=
new
HashMap
<>();
for
(
UserDesRuleDO
userDesRuleDO
:
userDesRuleDOS
)
{
ruleDOMap
.
put
(
userDesRuleDO
.
getName
(),
userDesRuleDO
);
}
JSONObject
resultJson
=
new
JSONObject
();
try
{
// 将 JSON 字符串转为 JSONObject
JSONObject
jsonObject
=
new
JSONObject
(
userJsonStr
);
// 遍历所有属性
Set
<
String
>
keySet
=
jsonObject
.
keySet
();
for
(
String
key
:
keySet
)
{
UserDesRuleDO
userDesRuleDO
=
ruleDOMap
.
get
(
key
);
if
(
null
!=
userDesRuleDO
)
{
if
(
1
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
invalidatePhone
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()));
resultJson
.
put
(
key
,
v
);
}
else
if
(
2
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
randomPhone
(
value
);
resultJson
.
put
(
key
,
v
);
}
else
if
(
3
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
replaceRange
(
value
,
userDesRuleDO
.
getValueOne
(),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueThree
()));
resultJson
.
put
(
key
,
v
);
}
else
if
(
4
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
encryptAES
(
value
,
aesKeyConfig
.
getKey
());
resultJson
.
put
(
key
,
v
);
}
else
if
(
5
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
shiftString
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()));
resultJson
.
put
(
key
,
v
);
}
else
{
resultJson
.
put
(
key
,
jsonObject
.
get
(
key
));
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
resultJson
.
toString
();
}
@Override
public
String
userRuleDesArr
(
String
userJsonArrStr
)
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
();
Map
<
String
,
UserDesRuleDO
>
ruleDOMap
=
new
HashMap
<>();
for
(
UserDesRuleDO
userDesRuleDO
:
userDesRuleDOS
)
{
ruleDOMap
.
put
(
userDesRuleDO
.
getName
(),
userDesRuleDO
);
}
JSONArray
resultJsonArr
=
new
JSONArray
();
JSONArray
jsonArray
=
new
JSONArray
(
userJsonArrStr
);
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
Set
<
String
>
keySet
=
jsonObject
.
keySet
();
JSONObject
resultJson
=
new
JSONObject
();
try
{
for
(
String
key
:
keySet
)
{
UserDesRuleDO
userDesRuleDO
=
ruleDOMap
.
get
(
key
);
if
(
null
!=
userDesRuleDO
)
{
if
(
1
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
invalidatePhone
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()));
resultJson
.
put
(
key
,
v
);
}
else
if
(
2
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
randomPhone
(
value
);
resultJson
.
put
(
key
,
v
);
}
else
if
(
3
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
replaceRange
(
value
,
userDesRuleDO
.
getValueOne
(),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueThree
()));
resultJson
.
put
(
key
,
v
);
}
else
if
(
4
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
encryptAES
(
value
,
aesKeyConfig
.
getKey
());
resultJson
.
put
(
key
,
v
);
}
else
if
(
5
==
userDesRuleDO
.
getRule
())
{
String
value
=
jsonObject
.
getStr
(
key
);
String
v
=
DataDesensitizationUtils
.
shiftString
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()));
resultJson
.
put
(
key
,
v
);
}
else
{
resultJson
.
put
(
key
,
jsonObject
.
get
(
key
));
}
}
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
resultJsonArr
.
add
(
resultJson
);
}
return
resultJsonArr
.
toString
();
}
@Override
public
Boolean
checkName
(
String
name
,
Long
id
)
{
if
(
null
!=
id
&&
id
!=
0
)
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
(
new
LambdaQueryWrapper
<
UserDesRuleDO
>()
.
eq
(
UserDesRuleDO:
:
getName
,
name
)
.
eq
(
UserDesRuleDO:
:
getId
,
id
)
);
if
(
null
!=
userDesRuleDOS
&&
userDesRuleDOS
.
size
()
>
0
)
{
return
true
;
}
}
else
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
(
new
LambdaQueryWrapper
<
UserDesRuleDO
>()
.
eq
(
UserDesRuleDO:
:
getName
,
name
)
);
if
(
null
!=
userDesRuleDOS
&&
userDesRuleDOS
.
size
()
>
0
)
{
return
true
;
}
}
return
false
;
}
@Override
public
Map
<
String
,
Object
>
userRuleDesMap
(
Map
<
String
,
Object
>
map
)
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
();
Map
<
String
,
UserDesRuleDO
>
ruleDOMap
=
new
HashMap
<>();
for
(
UserDesRuleDO
userDesRuleDO
:
userDesRuleDOS
)
{
ruleDOMap
.
put
(
userDesRuleDO
.
getName
(),
userDesRuleDO
);
}
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
try
{
// 将 JSON 字符串转为 JSONObject
// 遍历所有属性
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
map
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
UserDesRuleDO
userDesRuleDO
=
ruleDOMap
.
get
(
key
);
if
(
null
!=
userDesRuleDO
)
{
if
(
1
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
invalidatePhone
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()));
resultMap
.
put
(
key
,
v
);
}
else
if
(
2
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
randomPhone
(
value
);
resultMap
.
put
(
key
,
v
);
}
else
if
(
3
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
replaceRange
(
value
,
userDesRuleDO
.
getValueOne
(),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueThree
()));
resultMap
.
put
(
key
,
v
);
}
else
if
(
4
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
encryptAES
(
value
,
aesKeyConfig
.
getKey
());
resultMap
.
put
(
key
,
v
);
}
else
if
(
5
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
shiftString
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()));
resultMap
.
put
(
key
,
v
);
}
else
{
resultMap
.
put
(
key
,
entry
.
getValue
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
resultMap
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
userRuleDesListMap
(
List
<
Map
<
String
,
Object
>>
lisetMap
)
{
List
<
UserDesRuleDO
>
userDesRuleDOS
=
userDesRuleMapper
.
selectList
();
Map
<
String
,
UserDesRuleDO
>
ruleDOMap
=
new
HashMap
<>();
for
(
UserDesRuleDO
userDesRuleDO
:
userDesRuleDOS
)
{
ruleDOMap
.
put
(
userDesRuleDO
.
getName
(),
userDesRuleDO
);
}
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
lisetMap
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
lisetMap
.
get
(
i
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
try
{
// 将 JSON 字符串转为 JSONObject
// 遍历所有属性
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
map
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
UserDesRuleDO
userDesRuleDO
=
ruleDOMap
.
get
(
key
);
if
(
null
!=
userDesRuleDO
)
{
if
(
1
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
invalidatePhone
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()));
resultMap
.
put
(
key
,
v
);
}
else
if
(
2
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
randomPhone
(
value
);
resultMap
.
put
(
key
,
v
);
}
else
if
(
3
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
replaceRange
(
value
,
userDesRuleDO
.
getValueOne
(),
Integer
.
parseInt
(
userDesRuleDO
.
getValueTwo
()),
Integer
.
parseInt
(
userDesRuleDO
.
getValueThree
()));
resultMap
.
put
(
key
,
v
);
}
else
if
(
4
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
encryptAES
(
value
,
aesKeyConfig
.
getKey
());
resultMap
.
put
(
key
,
v
);
}
else
if
(
5
==
userDesRuleDO
.
getRule
())
{
String
value
=
entry
.
getValue
().
toString
();
String
v
=
DataDesensitizationUtils
.
shiftString
(
value
,
Integer
.
parseInt
(
userDesRuleDO
.
getValueOne
()));
resultMap
.
put
(
key
,
v
);
}
else
{
resultMap
.
put
(
key
,
entry
.
getValue
());
}
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
resultList
.
add
(
resultMap
);
}
return
resultList
;
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/VisitInfoService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.VisitInfoPageReqVO
;
import
cn.gintone.controller.vo.VisitInfoRespVO
;
import
cn.gintone.controller.vo.VisitInfoSaveReqVO
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.entity.VisitInfoDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
import
java.util.List
;
/**
* 访问规则配置 Service 接口
*
* @author 胡懿
*/
public
interface
VisitInfoService
{
/**
* 创建访问规则配置
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createVisitInfo
(
@Valid
VisitInfoSaveReqVO
createReqVO
);
/**
* 更新访问规则配置
*
* @param updateReqVO 更新信息
*/
void
updateVisitInfo
(
@Valid
VisitInfoSaveReqVO
updateReqVO
);
/**
* 删除访问规则配置
*
* @param id 编号
*/
void
deleteVisitInfo
(
Long
id
);
/**
* 获得访问规则配置
*
* @param id 编号
* @return 访问规则配置
*/
VisitInfoDO
getVisitInfo
(
Long
id
);
/**
* 获得访问规则配置分页
*
* @param pageReqVO 分页查询
* @return 访问规则配置分页
*/
PageResult
<
VisitInfoDO
>
getVisitInfoPage
(
VisitInfoPageReqVO
pageReqVO
);
List
<
VisitInfoDO
>
getList
(
VisitInfoPageReqVO
reqVo
);
Boolean
saveAllVisitInfo
(
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
);
void
deleteByVisitId
(
Long
visitId
);
boolean
updateAllVisitInfo
(
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
);
void
checkWebLogInfo
(
WebLogInfo
webLogInfo
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/VisitInfoServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.controller.vo.VisitInfoPageReqVO
;
import
cn.gintone.controller.vo.VisitInfoRespVO
;
import
cn.gintone.controller.vo.VisitInfoSaveReqVO
;
import
cn.gintone.dal.VisitInfoMapper
;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.entity.VisitInfoDO
;
import
cn.gintone.iotdbUtils.MyIotDbUtils
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper
;
import
cn.iocoder.yudao.module.system.dal.mysql.permission.UserRoleMapper
;
import
cn.iocoder.yudao.module.system.service.user.AdminUserService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 访问规则配置 Service 实现类
*
* @author 胡懿
*/
@Service
@Validated
public
class
VisitInfoServiceImpl
implements
VisitInfoService
{
@Resource
private
VisitInfoMapper
visitInfoMapper
;
@Autowired
private
IotDbConfig
iotDbConfig
;
@Autowired
private
AdminUserService
adminUserService
;
@Autowired
private
UserRoleMapper
userRoleMapper
;
@Autowired
private
RoleMapper
roleMapper
;
@Override
public
Long
createVisitInfo
(
VisitInfoSaveReqVO
createReqVO
)
{
// 插入
VisitInfoDO
visitInfo
=
BeanUtils
.
toBean
(
createReqVO
,
VisitInfoDO
.
class
);
visitInfoMapper
.
insert
(
visitInfo
);
// 返回
return
visitInfo
.
getId
();
}
@Override
public
void
updateVisitInfo
(
VisitInfoSaveReqVO
updateReqVO
)
{
// 校验存在
validateVisitInfoExists
(
updateReqVO
.
getId
());
// 更新
VisitInfoDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
VisitInfoDO
.
class
);
visitInfoMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteVisitInfo
(
Long
id
)
{
// 校验存在
validateVisitInfoExists
(
id
);
// 删除
visitInfoMapper
.
deleteById
(
id
);
}
private
void
validateVisitInfoExists
(
Long
id
)
{
if
(
visitInfoMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
VISIT_INFO_NOT_EXISTS
);
}
}
@Override
public
VisitInfoDO
getVisitInfo
(
Long
id
)
{
return
visitInfoMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
VisitInfoDO
>
getVisitInfoPage
(
VisitInfoPageReqVO
pageReqVO
)
{
return
visitInfoMapper
.
selectPage
(
pageReqVO
);
}
public
List
<
VisitInfoDO
>
getList
(
VisitInfoPageReqVO
reqVo
)
{
return
visitInfoMapper
.
selectList
(
reqVo
);
}
@Override
public
Boolean
saveAllVisitInfo
(
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
)
{
if
(
visitInfoSaveReqVOList
!=
null
&&
!
visitInfoSaveReqVOList
.
isEmpty
())
{
List
<
VisitInfoDO
>
visitInfoDOList
=
new
ArrayList
<>();
for
(
VisitInfoSaveReqVO
visitInfoSaveReqVO
:
visitInfoSaveReqVOList
)
{
VisitInfoDO
visitInfo
=
BeanUtils
.
toBean
(
visitInfoSaveReqVO
,
VisitInfoDO
.
class
);
visitInfoDOList
.
add
(
visitInfo
);
}
return
visitInfoMapper
.
insertBatch
(
visitInfoDOList
);
}
return
false
;
}
@Override
public
void
deleteByVisitId
(
Long
visitId
)
{
visitInfoMapper
.
delete
(
new
QueryWrapper
<
VisitInfoDO
>().
lambda
().
eq
(
VisitInfoDO:
:
getVisitId
,
visitId
));
}
@Override
public
boolean
updateAllVisitInfo
(
List
<
VisitInfoSaveReqVO
>
visitInfoSaveReqVOList
)
{
if
(
visitInfoSaveReqVOList
!=
null
&&
!
visitInfoSaveReqVOList
.
isEmpty
())
{
VisitInfoSaveReqVO
visitInfoSaveReqVO1
=
visitInfoSaveReqVOList
.
get
(
0
);
visitInfoMapper
.
delete
(
new
QueryWrapper
<
VisitInfoDO
>().
lambda
().
eq
(
VisitInfoDO:
:
getVisitId
,
visitInfoSaveReqVO1
.
getVisitId
()));
List
<
VisitInfoDO
>
visitInfoDOList
=
new
ArrayList
<>();
for
(
VisitInfoSaveReqVO
visitInfoSaveReqVO
:
visitInfoSaveReqVOList
)
{
VisitInfoDO
visitInfo
=
BeanUtils
.
toBean
(
visitInfoSaveReqVO
,
VisitInfoDO
.
class
);
visitInfoDOList
.
add
(
visitInfo
);
}
return
visitInfoMapper
.
insertBatch
(
visitInfoDOList
);
}
return
false
;
}
@Override
public
void
checkWebLogInfo
(
WebLogInfo
webLogInfo
)
{
String
userId
=
webLogInfo
.
getUserId
();
if
(
null
==
userId
||
""
.
equals
(
userId
))
{
WebIllLogInfo
webIllLogInfo
=
new
WebIllLogInfo
();
webIllLogInfo
.
setUserId
(
webLogInfo
.
getUserId
());
webIllLogInfo
.
setUserId
(
webLogInfo
.
getUsername
());
webIllLogInfo
.
setSysAbbre
(
webLogInfo
.
getSysAbbre
());
webIllLogInfo
.
setUrl
(
webLogInfo
.
getUrl
());
webIllLogInfo
.
setAccessed
(
webLogInfo
.
getAccessed
());
webIllLogInfo
.
setType
(
webLogInfo
.
getType
());
webIllLogInfo
.
setClientIp
(
webLogInfo
.
getClientIp
());
webIllLogInfo
.
setRemark
(
webLogInfo
.
getRemark
());
webIllLogInfo
.
setIllType
(
"noRule"
);
MyIotDbUtils
.
inserOne_Ill
(
iotDbConfig
,
webIllLogInfo
);
return
;
}
// 获取用户信息和角色信息------需要调用平台的接口
List
<
UserRoleDO
>
userRoleDOS
=
userRoleMapper
.
selectListByUserId
(
Long
.
parseLong
(
userId
));
boolean
isLegal
=
false
;
// 是否合法。false:不合法,true:合法
// 先查询角色规则
if
(
null
!=
userRoleDOS
&&
!
userRoleDOS
.
isEmpty
())
{
for
(
UserRoleDO
userRoleDO
:
userRoleDOS
)
{
List
<
VisitInfoDO
>
visitInfoDOS
=
visitInfoMapper
.
selectList
(
new
LambdaQueryWrapper
<
VisitInfoDO
>()
.
eq
(
VisitInfoDO:
:
getRoleId
,
userRoleDO
.
getRoleId
())
.
like
(
VisitInfoDO:
:
getUrl
,
webLogInfo
.
getUrl
())
);
if
(
null
!=
visitInfoDOS
&&
visitInfoDOS
.
size
()
>
0
)
{
isLegal
=
true
;
}
}
}
// 查询用户规则,如果配置了用户规则,则按照用户规则走
List
<
VisitInfoDO
>
visitInfoDOS
=
visitInfoMapper
.
selectList
(
new
LambdaQueryWrapper
<
VisitInfoDO
>()
.
like
(
VisitInfoDO:
:
getUrl
,
webLogInfo
.
getUrl
())
);
if
(
null
!=
visitInfoDOS
&&
visitInfoDOS
.
size
()
>
0
)
{
isLegal
=
false
;
List
<
VisitInfoDO
>
visitInfoDOS2
=
visitInfoMapper
.
selectList
(
new
LambdaQueryWrapper
<
VisitInfoDO
>()
.
eq
(
VisitInfoDO:
:
getUserId
,
userId
)
.
like
(
VisitInfoDO:
:
getUrl
,
webLogInfo
.
getUrl
())
);
if
(
null
!=
visitInfoDOS2
&&
visitInfoDOS2
.
size
()
>
0
)
{
isLegal
=
true
;
}
}
if
(!
isLegal
)
{
WebIllLogInfo
webIllLogInfo
=
new
WebIllLogInfo
();
webIllLogInfo
.
setUserId
(
webLogInfo
.
getUserId
());
webIllLogInfo
.
setUserId
(
webLogInfo
.
getUsername
());
webIllLogInfo
.
setSysAbbre
(
webLogInfo
.
getSysAbbre
());
webIllLogInfo
.
setUrl
(
webLogInfo
.
getUrl
());
webIllLogInfo
.
setAccessed
(
webLogInfo
.
getAccessed
());
webIllLogInfo
.
setType
(
webLogInfo
.
getType
());
webIllLogInfo
.
setClientIp
(
webLogInfo
.
getClientIp
());
webIllLogInfo
.
setRemark
(
webLogInfo
.
getRemark
());
webIllLogInfo
.
setIllType
(
"noRule"
);
MyIotDbUtils
.
inserOne_Ill
(
iotDbConfig
,
webIllLogInfo
);
}
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/VisitService.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.VisitPageReqVO
;
import
cn.gintone.controller.vo.VisitSaveReqVO
;
import
cn.gintone.entity.VisitDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
/**
* 接口安全访问策略 Service 接口
*
* @author 胡懿
*/
public
interface
VisitService
{
/**
* 创建接口安全访问策略
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createVisit
(
@Valid
VisitSaveReqVO
createReqVO
);
/**
* 更新接口安全访问策略
*
* @param updateReqVO 更新信息
*/
void
updateVisit
(
@Valid
VisitSaveReqVO
updateReqVO
);
/**
* 删除接口安全访问策略
*
* @param id 编号
*/
void
deleteVisit
(
Long
id
);
/**
* 获得接口安全访问策略
*
* @param id 编号
* @return 接口安全访问策略
*/
VisitDO
getVisit
(
Long
id
);
/**
* 获得接口安全访问策略分页
*
* @param pageReqVO 分页查询
* @return 接口安全访问策略分页
*/
PageResult
<
VisitDO
>
getVisitPage
(
VisitPageReqVO
pageReqVO
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/VisitServiceImpl.java
0 → 100644
View file @
930cdfe7
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.controller.vo.VisitPageReqVO
;
import
cn.gintone.controller.vo.VisitSaveReqVO
;
import
cn.gintone.dal.VisitMapper
;
import
cn.gintone.entity.VisitDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
import
cn.iocoder.yudao.framework.common.util.object.BeanUtils
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
/**
* 接口安全访问策略 Service 实现类
*
* @author 胡懿
*/
@Service
@Validated
public
class
VisitServiceImpl
implements
VisitService
{
@Resource
private
VisitMapper
visitMapper
;
@Autowired
private
VisitInfoService
visitInfoService
;
@Override
public
Long
createVisit
(
VisitSaveReqVO
createReqVO
)
{
// 插入
VisitDO
visit
=
BeanUtils
.
toBean
(
createReqVO
,
VisitDO
.
class
);
visitMapper
.
insert
(
visit
);
// 返回
return
visit
.
getId
();
}
@Override
public
void
updateVisit
(
VisitSaveReqVO
updateReqVO
)
{
// 校验存在
validateVisitExists
(
updateReqVO
.
getId
());
// 更新
VisitDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
VisitDO
.
class
);
visitMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteVisit
(
Long
id
)
{
// 校验存在
validateVisitExists
(
id
);
// 删除
visitMapper
.
deleteById
(
id
);
visitInfoService
.
deleteVisitInfo
(
id
);
}
private
void
validateVisitExists
(
Long
id
)
{
if
(
visitMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
VISIT_NOT_EXISTS
);
}
}
@Override
public
VisitDO
getVisit
(
Long
id
)
{
return
visitMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
VisitDO
>
getVisitPage
(
VisitPageReqVO
pageReqVO
)
{
return
visitMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/KeyCodeMapper.xml
0 → 100644
View file @
930cdfe7
<?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=
"cn.gintone.dal.KeyCodeMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/MyTableMapper.xml
0 → 100644
View file @
930cdfe7
<?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=
"cn.gintone.dal.MyTableMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/UserDesRuleMapper.xml
0 → 100644
View file @
930cdfe7
<?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=
"cn.gintone.dal.UserDesRuleMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/VisitInfoMapper.xml
0 → 100644
View file @
930cdfe7
<?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=
"cn.gintone.dal.VisitInfoMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/VisitMapper.xml
0 → 100644
View file @
930cdfe7
<?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=
"cn.gintone.dal.VisitMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
gt-club/pom.xml
0 → 100644
View file @
930cdfe7
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao
</artifactId>
<version>
${revision}
</version>
</parent>
<groupId>
cn.gintone
</groupId>
<artifactId>
gt-club
</artifactId>
<packaging>
pom
</packaging>
<modules>
<module>
gt-club-biz
</module>
</modules>
<properties>
<maven.compiler.source>
8
</maven.compiler.source>
<maven.compiler.target>
8
</maven.compiler.target>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
</properties>
</project>
\ No newline at end of file
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