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
33eaad09
Commit
33eaad09
authored
Apr 27, 2025
by
胡懿
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基础安全模块
parent
1c5c8a44
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
1592 additions
and
33 deletions
+1592
-33
pom.xml
gt-club/gt-club-biz/pom.xml
+6
-0
ErrorInfo.java
gt-club/gt-club-biz/src/main/java/cn/gintone/ErrorInfo.java
+2
-0
DesCorporationController.java
.../java/cn/gintone/controller/DesCorporationController.java
+137
-0
ImportantFileController.java
...n/java/cn/gintone/controller/ImportantFileController.java
+120
-0
KeyCodeController.java
...rc/main/java/cn/gintone/controller/KeyCodeController.java
+73
-5
MyFileController.java
...src/main/java/cn/gintone/controller/MyFileController.java
+85
-0
UserDesRuleController.java
...ain/java/cn/gintone/controller/UserDesRuleController.java
+1
-1
WebLogInfoController.java
...main/java/cn/gintone/controller/WebLogInfoController.java
+16
-1
DesCorporationPageReqVO.java
...ava/cn/gintone/controller/vo/DesCorporationPageReqVO.java
+41
-0
DesCorporationRespVO.java
...n/java/cn/gintone/controller/vo/DesCorporationRespVO.java
+48
-0
DesCorporationSaveReqVO.java
...ava/cn/gintone/controller/vo/DesCorporationSaveReqVO.java
+34
-0
ImportantFilePageReqVO.java
...java/cn/gintone/controller/vo/ImportantFilePageReqVO.java
+32
-0
ImportantFileRespVO.java
...in/java/cn/gintone/controller/vo/ImportantFileRespVO.java
+36
-0
ImportantFileSaveReqVO.java
...java/cn/gintone/controller/vo/ImportantFileSaveReqVO.java
+25
-0
DesCorporationMapper.java
...iz/src/main/java/cn/gintone/dal/DesCorporationMapper.java
+33
-0
ImportantFileMapper.java
...biz/src/main/java/cn/gintone/dal/ImportantFileMapper.java
+30
-0
EncInfo.java
...lub/gt-club-biz/src/main/java/cn/gintone/dto/EncInfo.java
+18
-4
FileDecLogInfo.java
...club-biz/src/main/java/cn/gintone/dto/FileDecLogInfo.java
+154
-0
SpePeoLogInfo.java
...-club-biz/src/main/java/cn/gintone/dto/SpePeoLogInfo.java
+134
-0
SM2Util.java
...biz/src/main/java/cn/gintone/encryptionUtils/SM2Util.java
+0
-1
DesCorporationDO.java
...biz/src/main/java/cn/gintone/entity/DesCorporationDO.java
+56
-0
ImportantFileDO.java
...-biz/src/main/java/cn/gintone/entity/ImportantFileDO.java
+44
-0
FileIotDbUtil.java
...iz/src/main/java/cn/gintone/iotdbUtils/FileIotDbUtil.java
+0
-0
MyIotDbUtils.java
...biz/src/main/java/cn/gintone/iotdbUtils/MyIotDbUtils.java
+4
-1
SpecialPeopleIotDbUtils.java
...n/java/cn/gintone/iotdbUtils/SpecialPeopleIotDbUtils.java
+0
-0
DesCorporationService.java
...c/main/java/cn/gintone/service/DesCorporationService.java
+67
-0
DesCorporationServiceImpl.java
...in/java/cn/gintone/service/DesCorporationServiceImpl.java
+0
-0
ImportantFileService.java
...rc/main/java/cn/gintone/service/ImportantFileService.java
+56
-0
ImportantFileServiceImpl.java
...ain/java/cn/gintone/service/ImportantFileServiceImpl.java
+72
-0
KeyCodeService.java
...-biz/src/main/java/cn/gintone/service/KeyCodeService.java
+31
-2
KeyCodeServiceImpl.java
.../src/main/java/cn/gintone/service/KeyCodeServiceImpl.java
+127
-13
DesCorporationMapper.xml
...ub-biz/src/main/resources/mapper/DesCorporationMapper.xml
+13
-0
ImportantFileMapper.xml
...lub-biz/src/main/resources/mapper/ImportantFileMapper.xml
+13
-0
DataPermissionRuleHandler.java
...ork/datapermission/core/db/DataPermissionRuleHandler.java
+3
-0
YudaoWebSecurityConfigurerAdapter.java
...rk/security/config/YudaoWebSecurityConfigurerAdapter.java
+1
-0
TokenAuthenticationFilter.java
...ework/security/core/filter/TokenAuthenticationFilter.java
+18
-0
AuthController.java
...o/module/system/controller/admin/auth/AuthController.java
+11
-0
AdminUserMapper.java
...r/yudao/module/system/dal/mysql/user/AdminUserMapper.java
+3
-0
MyAdminUserMapper.java
...yudao/module/system/dal/mysql/user/MyAdminUserMapper.java
+14
-0
AdminAuthService.java
...er/yudao/module/system/service/auth/AdminAuthService.java
+6
-0
AdminAuthServiceImpl.java
...udao/module/system/service/auth/AdminAuthServiceImpl.java
+12
-2
AdminUserService.java
...er/yudao/module/system/service/user/AdminUserService.java
+2
-0
AdminUserServiceImpl.java
...udao/module/system/service/user/AdminUserServiceImpl.java
+11
-0
application.yaml
yudao-server/src/main/resources/application.yaml
+3
-3
No files found.
gt-club/gt-club-biz/pom.xml
View file @
33eaad09
...
...
@@ -73,6 +73,12 @@
<version>
2.4.2-jdk8-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-infra-biz
</artifactId>
<version>
2.4.2-jdk8-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
...
...
gt-club/gt-club-biz/src/main/java/cn/gintone/ErrorInfo.java
View file @
33eaad09
...
...
@@ -8,4 +8,6 @@ public class ErrorInfo {
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
,
"人员脱敏规则不存在"
);
public
static
ErrorCode
DES_CORPORATION_NOT_EXISTS
=
new
ErrorCode
(
6
,
"法人脱敏不存在"
);
public
static
ErrorCode
IMPORTANT_FILE_NOT_EXISTS
=
new
ErrorCode
(
7
,
"重要文件不存在"
);
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/DesCorporationController.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.DesCorporationPageReqVO
;
import
cn.gintone.controller.vo.DesCorporationRespVO
;
import
cn.gintone.controller.vo.DesCorporationSaveReqVO
;
import
cn.gintone.dto.DesInfo
;
import
cn.gintone.entity.DesCorporationDO
;
import
cn.gintone.service.DesCorporationService
;
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
java.util.Map
;
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/des-corporation"
)
@Validated
public
class
DesCorporationController
{
@Resource
private
DesCorporationService
desCorporationService
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建法人脱敏"
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:create')"
)
public
CommonResult
<
Long
>
createDesCorporation
(
@Valid
@RequestBody
DesCorporationSaveReqVO
createReqVO
)
{
return
success
(
desCorporationService
.
createDesCorporation
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新法人脱敏"
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:update')"
)
public
CommonResult
<
Boolean
>
updateDesCorporation
(
@Valid
@RequestBody
DesCorporationSaveReqVO
updateReqVO
)
{
desCorporationService
.
updateDesCorporation
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除法人脱敏"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:delete')"
)
public
CommonResult
<
Boolean
>
deleteDesCorporation
(
@RequestParam
(
"id"
)
Long
id
)
{
desCorporationService
.
deleteDesCorporation
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得法人脱敏"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:query')"
)
public
CommonResult
<
DesCorporationRespVO
>
getDesCorporation
(
@RequestParam
(
"id"
)
Long
id
)
{
DesCorporationDO
desCorporation
=
desCorporationService
.
getDesCorporation
(
id
);
return
success
(
BeanUtils
.
toBean
(
desCorporation
,
DesCorporationRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得法人脱敏分页"
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:query')"
)
public
CommonResult
<
PageResult
<
DesCorporationRespVO
>>
getDesCorporationPage
(
@Valid
DesCorporationPageReqVO
pageReqVO
)
{
PageResult
<
DesCorporationDO
>
pageResult
=
desCorporationService
.
getDesCorporationPage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
DesCorporationRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出法人脱敏 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('sec:des-corporation:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportDesCorporationExcel
(
@Valid
DesCorporationPageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
DesCorporationDO
>
list
=
desCorporationService
.
getDesCorporationPage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"法人脱敏.xls"
,
"数据"
,
DesCorporationRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
DesCorporationRespVO
.
class
));
}
@GetMapping
(
"/checkName"
)
@Operation
(
summary
=
"验证属性是否存在"
)
public
CommonResult
<
Boolean
>
checkName
(
@RequestParam
(
"name"
)
String
name
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
Long
id
)
{
return
success
(
desCorporationService
.
checkName
(
name
,
id
));
}
@PostMapping
(
"/corporationRuleDes"
)
@Operation
(
summary
=
"法人脱敏"
)
public
CommonResult
<
String
>
corporationRuleDes
(
@RequestBody
DesInfo
desInfo
)
{
String
str
=
desCorporationService
.
corporationRuleDes
(
desInfo
.
getJsonStr
());
return
CommonResult
.
success
(
str
);
}
@PostMapping
(
"/corporationRuleDesMap"
)
@Operation
(
summary
=
"法人脱敏"
)
public
CommonResult
<
Map
<
String
,
Object
>>
corporationRuleDesMap
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
Map
<
String
,
Object
>
resultMap
=
desCorporationService
.
corporationRuleDesMap
(
map
);
return
CommonResult
.
success
(
resultMap
);
}
@PostMapping
(
"/corporationRuleDesList"
)
@Operation
(
summary
=
"法人批量脱敏"
)
public
CommonResult
<
String
>
corporationRuleDesList
(
@RequestBody
DesInfo
desInfo
)
{
String
str
=
desCorporationService
.
corporationRuleDesArr
(
desInfo
.
getJsonArrStr
());
return
CommonResult
.
success
(
str
);
}
@PostMapping
(
"/corporationRuleDesListMap"
)
@Operation
(
summary
=
"法人批量脱敏"
)
public
CommonResult
<
List
<
Map
<
String
,
Object
>>>
corporationRuleDesListMap
(
@RequestBody
List
<
Map
<
String
,
Object
>>
lisetMap
)
{
List
<
Map
<
String
,
Object
>>
resultList
=
desCorporationService
.
corporationRuleDesListMap
(
lisetMap
);
return
CommonResult
.
success
(
resultList
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/ImportantFileController.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
controller
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.controller.vo.ImportantFilePageReqVO
;
import
cn.gintone.controller.vo.ImportantFileRespVO
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
import
cn.gintone.dto.FileDecLogInfo
;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfoVo
;
import
cn.gintone.entity.ImportantFileDO
;
import
cn.gintone.iotdbUtils.FileIotDbUtil
;
import
cn.gintone.iotdbUtils.MyIotDbUtils
;
import
cn.gintone.service.ImportantFileService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
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/sec/important-file"
)
@Validated
public
class
ImportantFileController
{
@Resource
private
ImportantFileService
importantFileService
;
@Autowired
private
IotDbConfig
iotDbConfig
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建重要文件"
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:create')"
)
public
CommonResult
<
Long
>
createImportantFile
(
@Valid
@RequestBody
ImportantFileSaveReqVO
createReqVO
)
{
return
success
(
importantFileService
.
createImportantFile
(
createReqVO
));
}
@PutMapping
(
"/update"
)
@Operation
(
summary
=
"更新重要文件"
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:update')"
)
public
CommonResult
<
Boolean
>
updateImportantFile
(
@Valid
@RequestBody
ImportantFileSaveReqVO
updateReqVO
)
{
importantFileService
.
updateImportantFile
(
updateReqVO
);
return
success
(
true
);
}
@DeleteMapping
(
"/delete"
)
@Operation
(
summary
=
"删除重要文件"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:delete')"
)
public
CommonResult
<
Boolean
>
deleteImportantFile
(
@RequestParam
(
"id"
)
Long
id
)
{
importantFileService
.
deleteImportantFile
(
id
);
return
success
(
true
);
}
@GetMapping
(
"/get"
)
@Operation
(
summary
=
"获得重要文件"
)
@Parameter
(
name
=
"id"
,
description
=
"编号"
,
required
=
true
,
example
=
"1024"
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:query')"
)
public
CommonResult
<
ImportantFileRespVO
>
getImportantFile
(
@RequestParam
(
"id"
)
Long
id
)
{
ImportantFileDO
importantFile
=
importantFileService
.
getImportantFile
(
id
);
return
success
(
BeanUtils
.
toBean
(
importantFile
,
ImportantFileRespVO
.
class
));
}
@GetMapping
(
"/page"
)
@Operation
(
summary
=
"获得重要文件分页"
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:query')"
)
public
CommonResult
<
PageResult
<
ImportantFileRespVO
>>
getImportantFilePage
(
@Valid
ImportantFilePageReqVO
pageReqVO
)
{
PageResult
<
ImportantFileDO
>
pageResult
=
importantFileService
.
getImportantFilePage
(
pageReqVO
);
return
success
(
BeanUtils
.
toBean
(
pageResult
,
ImportantFileRespVO
.
class
));
}
@GetMapping
(
"/export-excel"
)
@Operation
(
summary
=
"导出重要文件 Excel"
)
@PreAuthorize
(
"@ss.hasPermission('sec:important-file:export')"
)
@ApiAccessLog
(
operateType
=
EXPORT
)
public
void
exportImportantFileExcel
(
@Valid
ImportantFilePageReqVO
pageReqVO
,
HttpServletResponse
response
)
throws
IOException
{
pageReqVO
.
setPageSize
(
PageParam
.
PAGE_SIZE_NONE
);
List
<
ImportantFileDO
>
list
=
importantFileService
.
getImportantFilePage
(
pageReqVO
).
getList
();
// 导出 Excel
ExcelUtils
.
write
(
response
,
"重要文件.xls"
,
"数据"
,
ImportantFileRespVO
.
class
,
BeanUtils
.
toBean
(
list
,
ImportantFileRespVO
.
class
));
}
@GetMapping
(
"/countDecFileLogInfo"
)
@Operation
(
summary
=
"统计重要文件申请解密日志条数"
)
public
CommonResult
<
Long
>
countDecFileLogInfo
(
FileDecLogInfo
fileDecLogInfo
)
{
long
pageCount
=
FileIotDbUtil
.
countDecFileInfo
(
iotDbConfig
,
fileDecLogInfo
);
return
CommonResult
.
success
(
pageCount
);
}
@GetMapping
(
"/decFileLogInfoList"
)
@Operation
(
summary
=
"重要文件申请日志记录"
)
public
CommonResult
<
List
<
FileDecLogInfo
>>
webIllLogInfoList
(
FileDecLogInfo
fileDecLogInfo
)
{
List
<
FileDecLogInfo
>
fileDecLogInfos
=
FileIotDbUtil
.
selectDecFileInfo
(
iotDbConfig
,
fileDecLogInfo
);
return
CommonResult
.
success
(
fileDecLogInfos
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/KeyCodeController.java
View file @
33eaad09
package
cn
.
gintone
.
controller
;
import
cn.gintone.config.IotDbConfig
;
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.dto.FileDecLogInfo
;
import
cn.gintone.dto.SpePeoLogInfo
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.gintone.iotdbUtils.FileIotDbUtil
;
import
cn.gintone.iotdbUtils.SpecialPeopleIotDbUtils
;
import
cn.gintone.service.KeyCodeService
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -18,7 +24,9 @@ import io.swagger.v3.oas.annotations.Operation;
import
javax.validation.*
;
import
javax.servlet.http.*
;
import
java.io.IOException
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Map
;
import
cn.iocoder.yudao.framework.common.pojo.PageParam
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
...
...
@@ -39,6 +47,8 @@ public class KeyCodeController {
@Resource
private
KeyCodeService
keyCodeService
;
@Autowired
private
IotDbConfig
iotDbConfig
;
@PostMapping
(
"/create"
)
@Operation
(
summary
=
"创建公钥私钥管理"
)
...
...
@@ -102,15 +112,72 @@ public class KeyCodeController {
@PostMapping
(
"/rasEncryption"
)
@Operation
(
summary
=
"RAS加密"
)
public
CommonResult
<
EncInfo
>
rasEncryption
(
String
info
)
{
EncInfo
encInfo
=
keyCodeService
.
rasEncryption
(
info
);
public
CommonResult
<
EncInfo
>
rasEncryption
(
@RequestBody
Map
<
String
,
Object
>
requestMap
)
{
EncInfo
encInfo
=
keyCodeService
.
rasEncryption
(
requestMap
);
return
success
(
encInfo
);
}
@PostMapping
(
"/rasDecrypt"
)
@Operation
(
summary
=
"RAS解密"
)
public
CommonResult
<
String
>
rasDecrypt
(
@RequestBody
EncInfo
encInfo
)
{
String
info
=
keyCodeService
.
rasDecrypt
(
encInfo
);
return
success
(
info
);
public
CommonResult
<
Map
<
String
,
Object
>>
rasDecrypt
(
@RequestBody
EncInfo
encInfo
)
{
Map
<
String
,
Object
>
map
=
keyCodeService
.
rasDecrypt
(
encInfo
);
return
success
(
map
);
}
@PostMapping
(
"/smTwoEncryption"
)
@Operation
(
summary
=
"sm2加密"
)
public
CommonResult
<
EncInfo
>
smTwoEncryption
(
@RequestBody
Map
<
String
,
Object
>
requestMap
)
{
EncInfo
encInfo
=
keyCodeService
.
smTwoEncryption
(
requestMap
);
return
success
(
encInfo
);
}
@PostMapping
(
"/smTwoDecrypt"
)
@Operation
(
summary
=
"sm2解密"
)
public
CommonResult
<
Map
<
String
,
Object
>>
smTwoDecrypt
(
@RequestBody
EncInfo
encInfo
,
HttpServletRequest
request
)
{
String
ip
=
request
.
getHeader
(
"X-Forwarded-For"
);
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_CLIENT_IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_X_FORWARDED_FOR"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
}
// 处理多级代理情况(取第一个非 unknown 的 IP)
if
(
ip
!=
null
&&
ip
.
contains
(
","
))
{
ip
=
Arrays
.
stream
(
ip
.
split
(
","
))
.
map
(
String:
:
trim
)
.
filter
(
part
->
!
"unknown"
.
equalsIgnoreCase
(
part
))
.
findFirst
()
.
orElse
(
request
.
getRemoteAddr
());
}
Map
<
String
,
Object
>
map
=
keyCodeService
.
smTwoDecrypt
(
encInfo
,
ip
);
return
success
(
map
);
}
private
boolean
isInvalidIp
(
String
ip
)
{
return
ip
==
null
||
ip
.
isEmpty
()
||
"unknown"
.
equalsIgnoreCase
(
ip
);
}
@GetMapping
(
"/countSpeLogInfo"
)
@Operation
(
summary
=
"重点人群申请解密日志条数"
)
public
CommonResult
<
Long
>
countSpeLogInfo
(
SpePeoLogInfo
spePeoLogInfo
)
{
long
pageCount
=
SpecialPeopleIotDbUtils
.
countSpeLogInfo
(
iotDbConfig
,
spePeoLogInfo
);
return
CommonResult
.
success
(
pageCount
);
}
@GetMapping
(
"/speLogInfoList"
)
@Operation
(
summary
=
"重点人群申请日志记录"
)
public
CommonResult
<
List
<
SpePeoLogInfo
>>
speLogInfoList
(
SpePeoLogInfo
spePeoLogInfo
)
{
List
<
SpePeoLogInfo
>
spePeoLogInfoList
=
SpecialPeopleIotDbUtils
.
selectSpeLogInfo
(
iotDbConfig
,
spePeoLogInfo
);
return
CommonResult
.
success
(
spePeoLogInfoList
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/MyFileController.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
controller
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
import
cn.gintone.dto.EncInfo
;
import
cn.gintone.entity.ImportantFileDO
;
import
cn.gintone.service.KeyCodeService
;
import
cn.hutool.core.io.IoUtil
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FileUploadReqVO
;
import
cn.iocoder.yudao.module.infra.service.file.FileService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
@RestController
@RequestMapping
(
"/admin-api/myFileCon"
)
public
class
MyFileController
{
@Resource
private
FileService
fileService
;
@Autowired
private
KeyCodeService
keyCodeService
;
@PostMapping
(
"/upload"
)
@Operation
(
summary
=
"上传文件"
,
description
=
"模式一:后端上传文件"
)
public
CommonResult
<
EncInfo
>
uploadFile
(
FileUploadReqVO
uploadReqVO
)
throws
Exception
{
MultipartFile
file
=
uploadReqVO
.
getFile
();
String
path
=
uploadReqVO
.
getPath
();
String
url
=
fileService
.
createFile
(
file
.
getOriginalFilename
(),
path
,
IoUtil
.
readBytes
(
file
.
getInputStream
()));
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
url
);
EncInfo
encInfo
=
keyCodeService
.
rasEncryption
(
map
);
return
success
(
encInfo
);
}
@PostMapping
(
"/fileRasDecrypt"
)
@Operation
(
summary
=
"文件解密接口"
)
public
CommonResult
<
Map
<
String
,
Object
>>
rasDecrypt
(
@RequestBody
ImportantFileSaveReqVO
createReqVO
,
HttpServletRequest
request
)
throws
Exception
{
String
ip
=
request
.
getHeader
(
"X-Forwarded-For"
);
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_CLIENT_IP"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_X_FORWARDED_FOR"
);
}
if
(
isInvalidIp
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
}
// 处理多级代理情况(取第一个非 unknown 的 IP)
if
(
ip
!=
null
&&
ip
.
contains
(
","
))
{
ip
=
Arrays
.
stream
(
ip
.
split
(
","
))
.
map
(
String:
:
trim
)
.
filter
(
part
->
!
"unknown"
.
equalsIgnoreCase
(
part
))
.
findFirst
()
.
orElse
(
request
.
getRemoteAddr
());
}
Map
<
String
,
Object
>
map
=
keyCodeService
.
fileRasDecrypt
(
createReqVO
,
ip
);
return
success
(
map
);
}
private
boolean
isInvalidIp
(
String
ip
)
{
return
ip
==
null
||
ip
.
isEmpty
()
||
"unknown"
.
equalsIgnoreCase
(
ip
);
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/UserDesRuleController.java
View file @
33eaad09
...
...
@@ -126,7 +126,7 @@ public class UserDesRuleController {
@PostMapping
(
"/userRuleDesListMap"
)
@Operation
(
summary
=
"人员脱敏"
)
@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
);
...
...
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/WebLogInfoController.java
View file @
33eaad09
...
...
@@ -4,8 +4,10 @@ import cn.gintone.config.IotDbConfig;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.dto.WebLogInfoVo
;
import
cn.gintone.iotdbUtils.FileIotDbUtil
;
import
cn.gintone.iotdbUtils.MyDateUtils
;
import
cn.gintone.iotdbUtils.MyIotDbUtils
;
import
cn.gintone.iotdbUtils.SpecialPeopleIotDbUtils
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.v3.oas.annotations.Operation
;
...
...
@@ -40,12 +42,25 @@ public class WebLogInfoController {
}
@PostMapping
(
"/initIllIotDBTable"
)
@Operation
(
summary
=
"初始化时间序列"
)
@Operation
(
summary
=
"初始
非法访问
化时间序列"
)
public
CommonResult
<
String
>
initIllIotDBTable
()
{
MyIotDbUtils
.
createIllegalLogTimeseries
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/initDecFileIotDBTable"
)
@Operation
(
summary
=
"初始化重要文件时间序列"
)
public
CommonResult
<
String
>
initDecFileIotDBTable
()
{
FileIotDbUtil
.
createFileLogInfoTimeseries
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/initSpeLogIotDBTable"
)
@Operation
(
summary
=
"初始化重点人群时间序列"
)
public
CommonResult
<
String
>
initSpeLogIotDBTable
()
{
SpecialPeopleIotDbUtils
.
createSpeLogInfoTimeseries
(
iotDbConfig
);
return
CommonResult
.
success
(
"初始化成功"
);
}
@PostMapping
(
"/saveWebLogInfo"
)
@Operation
(
summary
=
"外部性请求保存日志"
)
public
CommonResult
<
String
>
saveWebLogInfo
(
@RequestBody
WebLogInfo
webLogInfo
)
{
...
...
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/DesCorporationPageReqVO.java
0 → 100644
View file @
33eaad09
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
DesCorporationPageReqVO
extends
PageParam
{
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
private
String
attr
;
@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
;
@Schema
(
description
=
"规则"
)
private
Integer
rule
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/DesCorporationRespVO.java
0 → 100644
View file @
33eaad09
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
DesCorporationRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"30156"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
@ExcelProperty
(
"属性名称"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
@ExcelProperty
(
"属性描述"
)
private
String
attr
;
@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
;
@Schema
(
description
=
"规则"
)
@ExcelProperty
(
"规则"
)
private
Integer
rule
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/DesCorporationSaveReqVO.java
0 → 100644
View file @
33eaad09
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
DesCorporationSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"30156"
)
private
Long
id
;
@Schema
(
description
=
"属性名称"
,
example
=
"李四"
)
private
String
name
;
@Schema
(
description
=
"属性描述"
)
private
String
attr
;
@Schema
(
description
=
"配置1"
)
private
String
valueOne
;
@Schema
(
description
=
"配置2"
)
private
String
valueTwo
;
@Schema
(
description
=
"配置3"
)
private
String
valueThree
;
@Schema
(
description
=
"规则"
)
private
Integer
rule
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/controller/vo/ImportantFilePageReqVO.java
0 → 100644
View file @
33eaad09
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
ImportantFilePageReqVO
extends
PageParam
{
@Schema
(
description
=
"文件名"
,
example
=
"张三"
)
private
String
name
;
@Schema
(
description
=
"文件地址"
,
example
=
"https://www.iocoder.cn"
)
private
String
url
;
@Schema
(
description
=
"私钥"
)
private
String
privateKey
;
@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/ImportantFileRespVO.java
0 → 100644
View file @
33eaad09
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
ImportantFileRespVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"10127"
)
@ExcelProperty
(
"id"
)
private
Long
id
;
@Schema
(
description
=
"文件名"
,
example
=
"张三"
)
@ExcelProperty
(
"文件名"
)
private
String
name
;
@Schema
(
description
=
"文件地址"
,
example
=
"https://www.iocoder.cn"
)
@ExcelProperty
(
"文件地址"
)
private
String
url
;
@Schema
(
description
=
"私钥"
)
@ExcelProperty
(
"私钥"
)
private
String
privateKey
;
@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/ImportantFileSaveReqVO.java
0 → 100644
View file @
33eaad09
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
ImportantFileSaveReqVO
{
@Schema
(
description
=
"id"
,
requiredMode
=
Schema
.
RequiredMode
.
REQUIRED
,
example
=
"10127"
)
private
Long
id
;
@Schema
(
description
=
"文件名"
,
example
=
"张三"
)
private
String
name
;
@Schema
(
description
=
"文件地址"
,
example
=
"https://www.iocoder.cn"
)
private
String
url
;
@Schema
(
description
=
"私钥"
)
private
String
privateKey
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/DesCorporationMapper.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
dal
;
import
java.util.*
;
import
cn.gintone.controller.vo.DesCorporationPageReqVO
;
import
cn.gintone.entity.DesCorporationDO
;
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
DesCorporationMapper
extends
BaseMapperX
<
DesCorporationDO
>
{
default
PageResult
<
DesCorporationDO
>
selectPage
(
DesCorporationPageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
DesCorporationDO
>()
.
likeIfPresent
(
DesCorporationDO:
:
getName
,
reqVO
.
getName
())
.
eqIfPresent
(
DesCorporationDO:
:
getAttr
,
reqVO
.
getAttr
())
.
eqIfPresent
(
DesCorporationDO:
:
getValueOne
,
reqVO
.
getValueOne
())
.
eqIfPresent
(
DesCorporationDO:
:
getValueTwo
,
reqVO
.
getValueTwo
())
.
eqIfPresent
(
DesCorporationDO:
:
getValueThree
,
reqVO
.
getValueThree
())
.
betweenIfPresent
(
DesCorporationDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
eqIfPresent
(
DesCorporationDO:
:
getRule
,
reqVO
.
getRule
())
.
orderByDesc
(
DesCorporationDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dal/ImportantFileMapper.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
dal
;
import
java.util.*
;
import
cn.gintone.controller.vo.ImportantFilePageReqVO
;
import
cn.gintone.entity.ImportantFileDO
;
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
ImportantFileMapper
extends
BaseMapperX
<
ImportantFileDO
>
{
default
PageResult
<
ImportantFileDO
>
selectPage
(
ImportantFilePageReqVO
reqVO
)
{
return
selectPage
(
reqVO
,
new
LambdaQueryWrapperX
<
ImportantFileDO
>()
.
likeIfPresent
(
ImportantFileDO:
:
getName
,
reqVO
.
getName
())
.
eqIfPresent
(
ImportantFileDO:
:
getUrl
,
reqVO
.
getUrl
())
.
eqIfPresent
(
ImportantFileDO:
:
getPrivateKey
,
reqVO
.
getPrivateKey
())
.
betweenIfPresent
(
ImportantFileDO:
:
getCreateTime
,
reqVO
.
getCreateTime
())
.
orderByDesc
(
ImportantFileDO:
:
getId
));
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/EncInfo.java
View file @
33eaad09
package
cn
.
gintone
.
dto
;
import
java.util.Map
;
/**
* 加密信息
*/
public
class
EncInfo
{
private
String
privateKey
;
private
String
info
;
private
Map
<
String
,
Object
>
info
;
private
String
sysAbbre
;
// 系统简称
public
String
getPrivateKey
()
{
return
privateKey
;
...
...
@@ -15,19 +20,28 @@ public class EncInfo {
this
.
privateKey
=
privateKey
;
}
public
String
getInfo
()
{
public
Map
<
String
,
Object
>
getInfo
()
{
return
info
;
}
public
void
setInfo
(
String
info
)
{
public
void
setInfo
(
Map
<
String
,
Object
>
info
)
{
this
.
info
=
info
;
}
public
String
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
@Override
public
String
toString
()
{
return
"EncInfo{"
+
"privateKey='"
+
privateKey
+
'\''
+
", info='"
+
info
+
'\''
+
", info="
+
info
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/FileDecLogInfo.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
dto
;
/**
* 保存到iotdb中的文件解密日志
*/
public
class
FileDecLogInfo
{
private
Long
timesta
;
private
String
timestaStr
;
private
String
sysAbbre
;
// 申请解密的系统简称
private
String
content
;
// 解密内容
private
String
privateKey
;
// 私钥
private
String
clientIp
;
// 访问端ip
private
String
userId
;
// 用户id
private
String
username
;
// 用户名
private
String
fileName
;
// 文件名称
private
long
fileId
;
// 文件id
private
Long
beginTime
;
private
Long
endTime
;
private
Integer
pageSize
;
private
Integer
pageNum
;
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
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getPrivateKey
()
{
return
privateKey
;
}
public
void
setPrivateKey
(
String
privateKey
)
{
this
.
privateKey
=
privateKey
;
}
public
String
getClientIp
()
{
return
clientIp
;
}
public
void
setClientIp
(
String
clientIp
)
{
this
.
clientIp
=
clientIp
;
}
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
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
long
getFileId
()
{
return
fileId
;
}
public
void
setFileId
(
long
fileId
)
{
this
.
fileId
=
fileId
;
}
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
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
;
}
@Override
public
String
toString
()
{
return
"FileDecLogInfo{"
+
"timesta="
+
timesta
+
", timestaStr='"
+
timestaStr
+
'\''
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
", content='"
+
content
+
'\''
+
", privateKey='"
+
privateKey
+
'\''
+
", clientIp='"
+
clientIp
+
'\''
+
", userId='"
+
userId
+
'\''
+
", username='"
+
username
+
'\''
+
", fileName='"
+
fileName
+
'\''
+
", fileId="
+
fileId
+
", beginTime="
+
beginTime
+
", endTime="
+
endTime
+
", pageSize="
+
pageSize
+
", pageNum="
+
pageNum
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/dto/SpePeoLogInfo.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
dto
;
/**
* 重点、特殊人群访问记录
*/
public
class
SpePeoLogInfo
{
private
Long
timesta
;
private
String
timestaStr
;
private
String
sysAbbre
;
// 申请解密的系统简称
private
String
content
;
// 解密内容
private
String
privateKey
;
// 私钥
private
String
clientIp
;
// 访问端ip
private
String
userId
;
// 用户id
private
String
username
;
// 用户名
private
Long
beginTime
;
private
Long
endTime
;
private
Integer
pageSize
;
private
Integer
pageNum
;
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
getSysAbbre
()
{
return
sysAbbre
;
}
public
void
setSysAbbre
(
String
sysAbbre
)
{
this
.
sysAbbre
=
sysAbbre
;
}
public
String
getContent
()
{
return
content
;
}
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
public
String
getPrivateKey
()
{
return
privateKey
;
}
public
void
setPrivateKey
(
String
privateKey
)
{
this
.
privateKey
=
privateKey
;
}
public
String
getClientIp
()
{
return
clientIp
;
}
public
void
setClientIp
(
String
clientIp
)
{
this
.
clientIp
=
clientIp
;
}
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
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
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
;
}
@Override
public
String
toString
()
{
return
"SpePeoLogInfo{"
+
"timesta="
+
timesta
+
", timestaStr='"
+
timestaStr
+
'\''
+
", sysAbbre='"
+
sysAbbre
+
'\''
+
", content='"
+
content
+
'\''
+
", privateKey='"
+
privateKey
+
'\''
+
", clientIp='"
+
clientIp
+
'\''
+
", userId='"
+
userId
+
'\''
+
", username='"
+
username
+
'\''
+
", beginTime="
+
beginTime
+
", endTime="
+
endTime
+
", pageSize="
+
pageSize
+
", pageNum="
+
pageNum
+
'}'
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/encryptionUtils/SM2Util.java
View file @
33eaad09
...
...
@@ -90,7 +90,6 @@ public class SM2Util {
originalText
+=
"加密测试加密测试加密测试加密测试加密测试加密测试sadfasdfasdfaf"
;
}
byte
[]
data
=
originalText
.
getBytes
(
"UTF-8"
);
// 加密
byte
[]
encryptedData
=
sm2Encrypt
(
data
,
publicKey1
);
System
.
out
.
println
(
"加密结果 (Base64): "
+
Base64
.
getEncoder
().
encodeToString
(
encryptedData
));
...
...
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/DesCorporationDO.java
0 → 100644
View file @
33eaad09
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_des_corporation"
)
@KeySequence
(
"t_des_corporation_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
DesCorporationDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 属性名称
*/
private
String
name
;
/**
* 属性描述
*/
private
String
attr
;
/**
* 配置1
*/
private
String
valueOne
;
/**
* 配置2
*/
private
String
valueTwo
;
/**
* 配置3
*/
private
String
valueThree
;
/**
* 规则
*/
private
Integer
rule
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/entity/ImportantFileDO.java
0 → 100644
View file @
33eaad09
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_important_file"
)
@KeySequence
(
"t_important_file_seq"
)
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
ImportantFileDO
extends
BaseDO
{
/**
* id
*/
@TableId
private
Long
id
;
/**
* 文件名
*/
private
String
name
;
/**
* 文件地址
*/
private
String
url
;
/**
* 私钥
*/
private
String
privateKey
;
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/FileIotDbUtil.java
0 → 100644
View file @
33eaad09
This diff is collapsed.
Click to expand it.
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/MyIotDbUtils.java
View file @
33eaad09
package
cn
.
gintone
.
iotdbUtils
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.dto.FileDecLogInfo
;
import
cn.gintone.dto.WebIllLogInfo
;
import
cn.gintone.dto.WebLogInfo
;
import
cn.gintone.dto.WebLogInfoVo
;
...
...
@@ -105,6 +106,7 @@ public class MyIotDbUtils {
}
}
// 访问日志单行插入
public
static
void
inserOne
(
IotDbConfig
iotDbConfig
,
WebLogInfo
webLogInfo
)
{
if
(
null
==
webLogInfo
)
{
return
;
...
...
@@ -159,7 +161,7 @@ public class MyIotDbUtils {
}
}
// 单行插入
//
非法访问日志
单行插入
public
static
void
inserOne_Ill
(
IotDbConfig
iotDbConfig
,
WebIllLogInfo
webIllLogInfo
)
{
if
(
null
==
webIllLogInfo
)
{
return
;
...
...
@@ -584,4 +586,5 @@ public class MyIotDbUtils {
return
webIllLogInfos
;
}
}
gt-club/gt-club-biz/src/main/java/cn/gintone/iotdbUtils/SpecialPeopleIotDbUtils.java
0 → 100644
View file @
33eaad09
This diff is collapsed.
Click to expand it.
gt-club/gt-club-biz/src/main/java/cn/gintone/service/DesCorporationService.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.DesCorporationPageReqVO
;
import
cn.gintone.controller.vo.DesCorporationSaveReqVO
;
import
cn.gintone.entity.DesCorporationDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* 法人脱敏 Service 接口
*
* @author 胡懿
*/
public
interface
DesCorporationService
{
/**
* 创建法人脱敏
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createDesCorporation
(
@Valid
DesCorporationSaveReqVO
createReqVO
);
/**
* 更新法人脱敏
*
* @param updateReqVO 更新信息
*/
void
updateDesCorporation
(
@Valid
DesCorporationSaveReqVO
updateReqVO
);
/**
* 删除法人脱敏
*
* @param id 编号
*/
void
deleteDesCorporation
(
Long
id
);
/**
* 获得法人脱敏
*
* @param id 编号
* @return 法人脱敏
*/
DesCorporationDO
getDesCorporation
(
Long
id
);
/**
* 获得法人脱敏分页
*
* @param pageReqVO 分页查询
* @return 法人脱敏分页
*/
PageResult
<
DesCorporationDO
>
getDesCorporationPage
(
DesCorporationPageReqVO
pageReqVO
);
Boolean
checkName
(
String
name
,
Long
id
);
String
corporationRuleDes
(
String
jsonStr
);
String
corporationRuleDesArr
(
String
jsonArrStr
);
Map
<
String
,
Object
>
corporationRuleDesMap
(
Map
<
String
,
Object
>
map
);
List
<
Map
<
String
,
Object
>>
corporationRuleDesListMap
(
List
<
Map
<
String
,
Object
>>
lisetMap
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/DesCorporationServiceImpl.java
0 → 100644
View file @
33eaad09
This diff is collapsed.
Click to expand it.
gt-club/gt-club-biz/src/main/java/cn/gintone/service/ImportantFileService.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.ImportantFilePageReqVO
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
import
cn.gintone.entity.ImportantFileDO
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
/**
* 重要文件 Service 接口
*
* @author 胡懿
*/
public
interface
ImportantFileService
{
/**
* 创建重要文件
*
* @param createReqVO 创建信息
* @return 编号
*/
Long
createImportantFile
(
@Valid
ImportantFileSaveReqVO
createReqVO
);
/**
* 更新重要文件
*
* @param updateReqVO 更新信息
*/
void
updateImportantFile
(
@Valid
ImportantFileSaveReqVO
updateReqVO
);
/**
* 删除重要文件
*
* @param id 编号
*/
void
deleteImportantFile
(
Long
id
);
/**
* 获得重要文件
*
* @param id 编号
* @return 重要文件
*/
ImportantFileDO
getImportantFile
(
Long
id
);
/**
* 获得重要文件分页
*
* @param pageReqVO 分页查询
* @return 重要文件分页
*/
PageResult
<
ImportantFileDO
>
getImportantFilePage
(
ImportantFilePageReqVO
pageReqVO
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/ImportantFileServiceImpl.java
0 → 100644
View file @
33eaad09
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.controller.vo.ImportantFilePageReqVO
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
import
cn.gintone.dal.ImportantFileMapper
;
import
cn.gintone.entity.ImportantFileDO
;
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
ImportantFileServiceImpl
implements
ImportantFileService
{
@Resource
private
ImportantFileMapper
importantFileMapper
;
@Override
public
Long
createImportantFile
(
ImportantFileSaveReqVO
createReqVO
)
{
// 插入
ImportantFileDO
importantFile
=
BeanUtils
.
toBean
(
createReqVO
,
ImportantFileDO
.
class
);
importantFileMapper
.
insert
(
importantFile
);
// 返回
return
importantFile
.
getId
();
}
@Override
public
void
updateImportantFile
(
ImportantFileSaveReqVO
updateReqVO
)
{
// 校验存在
validateImportantFileExists
(
updateReqVO
.
getId
());
// 更新
ImportantFileDO
updateObj
=
BeanUtils
.
toBean
(
updateReqVO
,
ImportantFileDO
.
class
);
importantFileMapper
.
updateById
(
updateObj
);
}
@Override
public
void
deleteImportantFile
(
Long
id
)
{
// 校验存在
validateImportantFileExists
(
id
);
// 删除
importantFileMapper
.
deleteById
(
id
);
}
private
void
validateImportantFileExists
(
Long
id
)
{
if
(
importantFileMapper
.
selectById
(
id
)
==
null
)
{
throw
exception
(
ErrorInfo
.
IMPORTANT_FILE_NOT_EXISTS
);
}
}
@Override
public
ImportantFileDO
getImportantFile
(
Long
id
)
{
return
importantFileMapper
.
selectById
(
id
);
}
@Override
public
PageResult
<
ImportantFileDO
>
getImportantFilePage
(
ImportantFilePageReqVO
pageReqVO
)
{
return
importantFileMapper
.
selectPage
(
pageReqVO
);
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/KeyCodeService.java
View file @
33eaad09
package
cn
.
gintone
.
service
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
import
cn.gintone.controller.vo.KeyCodePageReqVO
;
import
cn.gintone.controller.vo.KeyCodeSaveReqVO
;
import
cn.gintone.dto.EncInfo
;
...
...
@@ -7,6 +8,7 @@ import cn.gintone.entity.KeyCodeDO;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
javax.validation.*
;
import
java.util.Map
;
/**
* 公钥私钥管理 Service 接口
...
...
@@ -64,7 +66,33 @@ public interface KeyCodeService {
* @param info
* @return
*/
EncInfo
rasEncryption
(
String
info
);
EncInfo
rasEncryption
(
Map
<
String
,
Object
>
requestMap
);
String
rasDecrypt
(
EncInfo
encInfo
);
/**
* 使用ras解密
* @param encInfo
* @return
*/
Map
<
String
,
Object
>
rasDecrypt
(
EncInfo
encInfo
);
/**
* 使用sm2加密
* @param requestMap
* @return
*/
EncInfo
smTwoEncryption
(
Map
<
String
,
Object
>
requestMap
);
/**
* 使用sm2解密
* @param encInfo
* @return
*/
Map
<
String
,
Object
>
smTwoDecrypt
(
EncInfo
encInfo
,
String
clientIp
);
/**
* 文件解密接口
* @param encInfo
* @return
*/
Map
<
String
,
Object
>
fileRasDecrypt
(
ImportantFileSaveReqVO
fileSaveReqVO
,
String
clientIp
);
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/java/cn/gintone/service/KeyCodeServiceImpl.java
View file @
33eaad09
package
cn
.
gintone
.
service
;
import
cn.gintone.ErrorInfo
;
import
cn.gintone.config.IotDbConfig
;
import
cn.gintone.controller.vo.ImportantFileSaveReqVO
;
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.dto.FileDecLogInfo
;
import
cn.gintone.dto.SpePeoLogInfo
;
import
cn.gintone.encryptionUtils.*
;
import
cn.gintone.entity.KeyCodeDO
;
import
cn.gintone.iotdbUtils.FileIotDbUtil
;
import
cn.gintone.iotdbUtils.SpecialPeopleIotDbUtils
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.yudao.module.system.service.auth.AdminAuthService
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
org.springframework.validation.annotation.Validated
;
...
...
@@ -19,8 +29,7 @@ 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
java.util.*
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
...
...
@@ -32,9 +41,13 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
@Service
@Validated
public
class
KeyCodeServiceImpl
implements
KeyCodeService
{
@Autowired
private
IotDbConfig
iotDbConfig
;
@Resource
private
KeyCodeMapper
keyCodeMapper
;
@Resource
private
AdminAuthService
authService
;
@Override
public
Long
createKeyCode
(
KeyCodeSaveReqVO
createReqVO
)
{
...
...
@@ -117,32 +130,132 @@ public class KeyCodeServiceImpl implements KeyCodeService {
}
@Override
public
EncInfo
rasEncryption
(
String
info
)
{
public
EncInfo
rasEncryption
(
Map
<
String
,
Object
>
requestMap
)
{
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
);
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
requestMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
().
toString
();
try
{
encInfo
.
setPrivateKey
(
keyCodeDO
.
getPrivateKey
());
PublicKey
publicKey
=
SecureHybridDecryptor
.
loadPublicKey
(
keyCodeDO
.
getPublicKey
());
String
encrypt
=
SecureHybridEncryptor
.
encrypt
(
value
,
publicKey
);
resultMap
.
put
(
key
,
encrypt
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
encInfo
.
setInfo
(
resultMap
);
}
return
encInfo
;
}
@Override
public
String
rasDecrypt
(
EncInfo
encInfo
)
{
public
Map
<
String
,
Object
>
rasDecrypt
(
EncInfo
encInfo
)
{
try
{
PrivateKey
privateKey
=
SecureHybridDecryptor
.
loadPrivateKey
(
encInfo
.
getPrivateKey
());
// 解密
String
decrypted
=
SecureHybridDecryptor
.
decrypt
(
encInfo
.
getInfo
(),
privateKey
);
return
decrypted
;
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
infoMap
=
encInfo
.
getInfo
();
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
infoMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
String
info
=
entry
.
getValue
().
toString
();
String
decrypted
=
SecureHybridDecryptor
.
decrypt
(
info
,
privateKey
);
resultMap
.
put
(
key
,
decrypted
);
}
return
resultMap
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@Override
public
EncInfo
smTwoEncryption
(
Map
<
String
,
Object
>
requestMap
)
{
EncInfo
encInfo
=
new
EncInfo
();
KeyCodeDO
keyCodeDO
=
keyCodeMapper
.
selectOne
(
new
QueryWrapper
<
KeyCodeDO
>().
eq
(
"type"
,
2
));
if
(
null
!=
keyCodeDO
)
{
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
requestMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
String
value
=
entry
.
getValue
().
toString
();
try
{
encInfo
.
setPrivateKey
(
keyCodeDO
.
getPrivateKey
());
PublicKey
publicKey
=
SM2KeyUtils
.
stringToPublicKey
(
keyCodeDO
.
getPublicKey
());
byte
[]
data
=
value
.
getBytes
(
"UTF-8"
);
// 加密
byte
[]
encryptedData
=
SM2Util
.
sm2Encrypt
(
data
,
publicKey
);
String
encrypt
=
Base64
.
getEncoder
().
encodeToString
(
encryptedData
);
resultMap
.
put
(
key
,
encrypt
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
encInfo
.
setInfo
(
resultMap
);
}
return
encInfo
;
}
@Override
public
Map
<
String
,
Object
>
smTwoDecrypt
(
EncInfo
encInfo
,
String
clientIp
)
{
try
{
PrivateKey
privateKey
=
SM2KeyUtils
.
stringToPrivateKey
(
encInfo
.
getPrivateKey
());
// 解密
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
infoMap
=
encInfo
.
getInfo
();
Set
<
Map
.
Entry
<
String
,
Object
>>
entries
=
infoMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
entries
)
{
String
key
=
entry
.
getKey
();
String
info
=
entry
.
getValue
().
toString
();
byte
[]
decodedBytes
=
Base64
.
getDecoder
().
decode
(
info
);
byte
[]
decryptedData
=
SM2Util
.
sm2Decrypt
(
decodedBytes
,
privateKey
);
String
decrypted
=
new
String
(
decryptedData
,
"UTF-8"
);
resultMap
.
put
(
key
,
decrypted
);
}
AdminUserDO
user
=
authService
.
getPdUserByToken
(
"123"
);
SpePeoLogInfo
spePeoLogInfo
=
new
SpePeoLogInfo
();
spePeoLogInfo
.
setClientIp
(
clientIp
);
spePeoLogInfo
.
setSysAbbre
(
encInfo
.
getSysAbbre
());
spePeoLogInfo
.
setContent
(
JSON
.
toJSONString
(
infoMap
));
spePeoLogInfo
.
setPrivateKey
(
encInfo
.
getPrivateKey
());
spePeoLogInfo
.
setUserId
(
user
.
getId
()
+
""
);
spePeoLogInfo
.
setUsername
(
user
.
getUsername
());
SpecialPeopleIotDbUtils
.
inserOne
(
iotDbConfig
,
spePeoLogInfo
);
return
resultMap
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
@Override
public
Map
<
String
,
Object
>
fileRasDecrypt
(
ImportantFileSaveReqVO
saveReqVO
,
String
clientIp
)
{
EncInfo
encInfo
=
new
EncInfo
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"url"
,
saveReqVO
.
getUrl
());
encInfo
.
setInfo
(
map
);
encInfo
.
setPrivateKey
(
saveReqVO
.
getPrivateKey
());
Map
<
String
,
Object
>
resultMap
=
rasDecrypt
(
encInfo
);
AdminUserDO
user
=
authService
.
getPdUserByToken
(
"123"
);
FileDecLogInfo
fileDecLogInfo
=
new
FileDecLogInfo
();
fileDecLogInfo
.
setClientIp
(
clientIp
);
fileDecLogInfo
.
setSysAbbre
(
"sec"
);
fileDecLogInfo
.
setContent
(
saveReqVO
.
getUrl
());
fileDecLogInfo
.
setPrivateKey
(
saveReqVO
.
getPrivateKey
());
fileDecLogInfo
.
setUserId
(
user
.
getId
()
+
""
);
fileDecLogInfo
.
setUsername
(
user
.
getUsername
());
fileDecLogInfo
.
setFileId
(
saveReqVO
.
getId
());
fileDecLogInfo
.
setFileName
(
saveReqVO
.
getName
());
FileIotDbUtil
.
inserOne
(
iotDbConfig
,
fileDecLogInfo
);
return
resultMap
;
}
}
\ No newline at end of file
gt-club/gt-club-biz/src/main/resources/mapper/DesCorporationMapper.xml
0 → 100644
View file @
33eaad09
<?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.DesCorporationMapper"
>
<!--
一般情况下,尽可能使用 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/ImportantFileMapper.xml
0 → 100644
View file @
33eaad09
<?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.ImportantFileMapper"
>
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionRuleHandler.java
View file @
33eaad09
...
...
@@ -43,6 +43,9 @@ public class DataPermissionRuleHandler implements MultiDataPermissionHandler {
}
// 单条规则的条件
if
(
"system_user"
.
equals
(
tableName
)){
continue
;
}
Expression
oneExpress
=
rule
.
getExpression
(
tableName
,
table
.
getAlias
());
if
(
oneExpress
==
null
)
{
continue
;
...
...
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
View file @
33eaad09
...
...
@@ -130,6 +130,7 @@ public class YudaoWebSecurityConfigurerAdapter {
.
authorizeHttpRequests
(
c
->
c
// 1.1 静态资源,可匿名访问
.
requestMatchers
(
HttpMethod
.
GET
,
"/*.html"
,
"/*.css"
,
"/*.js"
).
permitAll
()
.
requestMatchers
(
HttpMethod
.
GET
,
"/admin-api/pdTokenCheck/**"
).
permitAll
()
// 1.2 设置 @PermitAll 无需认证
.
requestMatchers
(
HttpMethod
.
GET
,
permitAllUrls
.
get
(
HttpMethod
.
GET
).
toArray
(
new
String
[
0
])).
permitAll
()
.
requestMatchers
(
HttpMethod
.
POST
,
permitAllUrls
.
get
(
HttpMethod
.
POST
).
toArray
(
new
String
[
0
])).
permitAll
()
...
...
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
View file @
33eaad09
...
...
@@ -41,6 +41,24 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
@SuppressWarnings
(
"NullableProblems"
)
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
ServletException
,
IOException
{
String
pdToken
=
request
.
getHeader
(
"pdToken"
);
StringBuffer
requestURL
=
request
.
getRequestURL
();
System
.
out
.
println
(
requestURL
.
toString
());
if
(
requestURL
.
toString
().
contains
(
"system/"
)
||
requestURL
.
toString
().
contains
(
"get-by-website"
)
||
requestURL
.
toString
().
contains
(
"checkPdToken"
))
{
}
else
{
if
(
StrUtil
.
isBlank
(
pdToken
))
{
pdToken
=
request
.
getParameter
(
"pdToken"
);
if
(
StrUtil
.
isBlank
(
pdToken
))
{
CommonResult
<?>
result
=
new
CommonResult
<>();
ServletUtils
.
writeJSON
(
response
,
result
);
return
;
}
return
;
}
}
String
token
=
SecurityFrameworkUtils
.
obtainAuthorization
(
request
,
securityProperties
.
getTokenHeader
(),
securityProperties
.
getTokenParameter
());
if
(
StrUtil
.
isNotEmpty
(
token
))
{
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java
View file @
33eaad09
...
...
@@ -69,6 +69,17 @@ public class AuthController {
return
success
(
authService
.
login
(
reqVO
));
}
@GetMapping
(
"/checkPdToken"
)
@PermitAll
@Operation
(
summary
=
"验证平台token"
)
public
CommonResult
<
Boolean
>
checkPdToken
(
String
pdToken
)
{
if
(
null
!=
pdToken
&&
!
""
.
equals
(
pdToken
))
{
return
CommonResult
.
success
(
true
);
}
return
CommonResult
.
success
(
false
);
}
@PostMapping
(
"/logout"
)
@PermitAll
@Operation
(
summary
=
"登出系统"
)
...
...
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/AdminUserMapper.java
View file @
33eaad09
...
...
@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import
cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.Collection
;
import
java.util.List
;
...
...
@@ -48,4 +49,6 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
return
selectList
(
AdminUserDO:
:
getDeptId
,
deptIds
);
}
@Select
(
"SELECT id, username, password, nickname, remark, dept_id, post_ids, email, mobile, sex, avatar, status, login_ip, login_date, tenant_id, create_time, update_time, creator, updater, deleted FROM system_users WHERE deleted = 0 AND (id = #{id})"
)
AdminUserDO
mySelectById
(
Long
id
);
}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/MyAdminUserMapper.java
0 → 100644
View file @
33eaad09
package
cn
.
iocoder
.
yudao
.
module
.
system
.
dal
.
mysql
.
user
;
import
cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX
;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Select
;
@Mapper
public
interface
MyAdminUserMapper
extends
BaseMapperX
<
AdminUserDO
>
{
@Select
(
"SELECT id, username, password, nickname, remark, dept_id, post_ids, email, mobile, sex, avatar, status, login_ip, login_date, tenant_id, create_time, update_time, creator, updater, deleted FROM system_users WHERE deleted = 0 AND (id = #{id})"
)
AdminUserDO
mySelectById
(
Long
id
);
}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthService.java
View file @
33eaad09
...
...
@@ -85,4 +85,10 @@ public interface AdminAuthService {
*/
void
resetPassword
(
AuthResetPasswordReqVO
reqVO
);
/**
* 根据平台的token获取平台用户信息
* @param token
* @return
*/
public
AdminUserDO
getPdUserByToken
(
String
token
);
}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java
View file @
33eaad09
...
...
@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import
cn.iocoder.yudao.framework.common.util.monitor.TracerUtils
;
import
cn.iocoder.yudao.framework.common.util.servlet.ServletUtils
;
import
cn.iocoder.yudao.framework.common.util.validation.ValidationUtils
;
import
cn.iocoder.yudao.framework.security.core.LoginUser
;
import
cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils
;
import
cn.iocoder.yudao.module.system.api.logger.dto.LoginLogCreateReqDTO
;
import
cn.iocoder.yudao.module.system.api.sms.SmsCodeApi
;
import
cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO
;
...
...
@@ -99,10 +101,11 @@ public class AdminAuthServiceImpl implements AdminAuthService {
@Override
public
AuthLoginRespVO
login
(
AuthLoginReqVO
reqVO
)
{
// 校验验证码
validateCaptcha
(
reqVO
);
//
validateCaptcha(reqVO);
// 使用账号密码,进行登录
AdminUserDO
user
=
authenticate
(
reqVO
.
getUsername
(),
reqVO
.
getPassword
());
// AdminUserDO user = authenticate(reqVO.getUsername(), reqVO.getPassword());
AdminUserDO
user
=
authenticate
(
"admin"
,
"admin123"
);
// 如果 socialType 非空,说明需要绑定社交用户
if
(
reqVO
.
getSocialType
()
!=
null
)
{
...
...
@@ -300,4 +303,11 @@ public class AdminAuthServiceImpl implements AdminAuthService {
userService
.
updateUserPassword
(
userByMobile
.
getId
(),
reqVO
.
getPassword
());
}
@Override
public
AdminUserDO
getPdUserByToken
(
String
token
)
{
LoginUser
loginUser
=
SecurityFrameworkUtils
.
getLoginUser
();
AdminUserDO
user
=
userService
.
getUserById
(
loginUser
.
getId
());
return
user
;
}
}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserService.java
View file @
33eaad09
...
...
@@ -216,4 +216,6 @@ public interface AdminUserService {
*/
boolean
isPasswordMatch
(
String
rawPassword
,
String
encodedPassword
);
AdminUserDO
getUserById
(
Long
id
);
}
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java
View file @
33eaad09
...
...
@@ -25,15 +25,18 @@ import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO;
import
cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO
;
import
cn.iocoder.yudao.module.system.dal.mysql.dept.UserPostMapper
;
import
cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper
;
import
cn.iocoder.yudao.module.system.dal.mysql.user.MyAdminUserMapper
;
import
cn.iocoder.yudao.module.system.service.dept.DeptService
;
import
cn.iocoder.yudao.module.system.service.dept.PostService
;
import
cn.iocoder.yudao.module.system.service.permission.PermissionService
;
import
cn.iocoder.yudao.module.system.service.tenant.TenantService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.mzt.logapi.context.LogRecordContext
;
import
com.mzt.logapi.service.impl.DiffParseFunction
;
import
com.mzt.logapi.starter.annotation.LogRecord
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.stereotype.Service
;
...
...
@@ -63,6 +66,8 @@ public class AdminUserServiceImpl implements AdminUserService {
@Resource
private
AdminUserMapper
userMapper
;
@Autowired
private
MyAdminUserMapper
myAdminUserMapper
;
@Resource
private
DeptService
deptService
;
...
...
@@ -518,6 +523,12 @@ public class AdminUserServiceImpl implements AdminUserService {
return
passwordEncoder
.
matches
(
rawPassword
,
encodedPassword
);
}
@Override
public
AdminUserDO
getUserById
(
Long
id
)
{
AdminUserDO
adminUserDO
=
myAdminUserMapper
.
mySelectById
(
id
);
return
adminUserDO
;
}
/**
* 对密码进行加密
*
...
...
yudao-server/src/main/resources/application.yaml
View file @
33eaad09
...
...
@@ -12,8 +12,8 @@ spring:
servlet
:
# 文件上传相关配置项
multipart
:
max-file-size
:
1
6M
B
# 单个文件大小
max-request-size
:
32M
B
# 设置总上传的文件大小
max-file-size
:
1
0G
B
# 单个文件大小
max-request-size
:
10G
B
# 设置总上传的文件大小
# Jackson 配置项
jackson
:
...
...
@@ -82,7 +82,7 @@ mybatis-plus:
password
:
XDV71a+xqStEA3WH
# 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成
mybatis-plus-join
:
banner
:
fals
e
# 是否打印 mybatis plus join banner,默认true
banner
:
tru
e
# 是否打印 mybatis plus join banner,默认true
sub-table-logic
:
true
# 全局启用副表逻辑删除,默认true。关闭后关联查询不会加副表逻辑删除
ms-cache
:
true
# 拦截器MappedStatement缓存,默认 true
table-alias
:
t
# 表别名(默认 t)
...
...
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