Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6747d4f4
authored
Jul 27, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Plain Diff
人身核验
2 parents
f79839fe
b8a6f5cc
Show whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
1222 additions
and
223 deletions
pom.xml
src/main/java/com/subsidy/controller/BusinessScopeDictController.java
src/main/java/com/subsidy/controller/ContentVodMappingController.java
src/main/java/com/subsidy/controller/CourseContentController.java
src/main/java/com/subsidy/controller/ImageCheckRecordController.java
src/main/java/com/subsidy/controller/VodDictController.java
src/main/java/com/subsidy/controller/VodLabelDictController.java
src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java
src/main/java/com/subsidy/dto/contentVod/AddContentVod.java
src/main/java/com/subsidy/dto/contentVod/ContentVodDTO.java
src/main/java/com/subsidy/dto/image/CheckResultDTO.java
src/main/java/com/subsidy/dto/image/ImageCheckDTO.java
src/main/java/com/subsidy/dto/label/VodLabelPageDTO.java
src/main/java/com/subsidy/dto/vod/ChangeOrdersDTO.java
src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java
src/main/java/com/subsidy/mapper/ContentVodMappingMapper.java
src/main/java/com/subsidy/mapper/VodLabelDictMapper.java
src/main/java/com/subsidy/model/BusinessScopeDictDO.java
src/main/java/com/subsidy/model/ContentVodMappingDO.java
src/main/java/com/subsidy/model/ImageCheckRecordDO.java
src/main/java/com/subsidy/model/VodDictDO.java
src/main/java/com/subsidy/model/VodLabelDictDO.java
src/main/java/com/subsidy/service/BusinessScopeDictService.java
src/main/java/com/subsidy/service/ContentVodMappingService.java
src/main/java/com/subsidy/service/CourseContentService.java
src/main/java/com/subsidy/service/ImageCheckRecordService.java
src/main/java/com/subsidy/service/VodDictService.java
src/main/java/com/subsidy/service/VodLableDictService.java
src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java
src/main/java/com/subsidy/service/impl/ContentVodMappingServiceImpl.java
src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java
src/main/java/com/subsidy/util/VodUtil.java
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
src/main/java/com/subsidy/vo/token/CheckResultVO.java
src/main/java/com/subsidy/vo/token/SendResultVO.java
src/main/resources/code.properties
src/main/resources/mapper/BusinessScopeDictMapper.xml
src/main/resources/mapper/ClassDictMapper.xml
src/main/resources/mapper/ContentVodMappingMapper.xml
src/main/resources/mapper/CourseContentMapper.xml
src/main/resources/mapper/CourseDictMapper.xml
src/main/resources/mapper/VodDictMapper.xml
src/main/resources/mapper/VodLabelDictMapper.xml
pom.xml
View file @
6747d4f
...
...
@@ -32,6 +32,7 @@
<itextpdf.version>
5.4.1
</itextpdf.version>
<java-jwt.version>
3.10.3
</java-jwt.version>
<jedis.version>
3.3.0
</jedis.version>
<collections.version>
3.2.2
</collections.version>
</properties>
<dependencies>
...
...
@@ -208,6 +209,12 @@
<version>
${jedis.version}
</version>
</dependency>
<dependency>
<groupId>
commons-collections
</groupId>
<artifactId>
commons-collections
</artifactId>
<version>
${collections.version}
</version>
</dependency>
<!--webSocket-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
src/main/java/com/subsidy/controller/BusinessScopeDictController.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.businessScope.BusinessScopeDTO
;
import
com.subsidy.model.BusinessScopeDictDO
;
import
com.subsidy.service.BusinessScopeDictService
;
import
io.swagger.annotations.ApiOperation
;
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
io.swagger.annotations.Api
;
/**
* <p>
* 经营范围表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-07-25
*/
@RestController
@Api
(
tags
=
"经营范围表"
)
@RequestMapping
(
"/businessScopeDict"
)
public
class
BusinessScopeDictController
{
@Autowired
private
BusinessScopeDictService
businessScopeDictService
;
@PostMapping
(
"addBusinessScope"
)
@ApiOperation
(
"添加经营范围:businessScopeName/经营范围名称"
)
@LoginRequired
public
ResponseVO
addBusinessScope
(
@RequestBody
BusinessScopeDictDO
businessScopeDictDO
)
{
businessScopeDictService
.
save
(
businessScopeDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"updateBusinessScope"
)
@ApiOperation
(
"修改经营范围:id/ID、businessScopeName/经营范围名称"
)
@LoginRequired
public
ResponseVO
updateBusinessScope
(
@RequestBody
BusinessScopeDictDO
businessScopeDictDO
)
{
businessScopeDictService
.
updateById
(
businessScopeDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"deleteBusinessScope"
)
@ApiOperation
(
"删除经营范围:id/ID"
)
@LoginRequired
public
ResponseVO
deleteBusinessScope
(
@RequestBody
BusinessScopeDictDO
businessScopeDictDO
)
{
businessScopeDictService
.
removeById
(
businessScopeDictDO
.
getId
());
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"queryBusinessScopePage"
)
@ApiOperation
(
"分页查询经营范围:businessScopeName/经营范围名称、pageNum/当前页数、pageSize/每页显示条数"
)
@LoginRequired
public
ResponseVO
queryBusinessScopePage
(
@RequestBody
BusinessScopeDTO
businessScopeDictDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
businessScopeDictService
.
queryBusinessScopePage
(
businessScopeDictDO
));
}
}
src/main/java/com/subsidy/controller/ContentVodMappingController.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.contentVod.AddContentVod
;
import
com.subsidy.dto.contentVod.ContentVodDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.service.ContentVodMappingService
;
import
io.swagger.annotations.ApiOperation
;
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
io.swagger.annotations.Api
;
/**
* <p>
* 目录视频关系表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@RestController
@Api
(
tags
=
"目录视频关系表"
)
@RequestMapping
(
"/contentVodMapping"
)
public
class
ContentVodMappingController
{
@Autowired
private
ContentVodMappingService
contentVodMappingService
;
@PostMapping
(
"getContendVods"
)
@ApiOperation
(
"获取课程内容下的视频 {contentId vodName}"
)
@LoginRequired
public
ResponseVO
getContendVods
(
@RequestBody
GetContendVodsDTO
getContendVodsDTO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
contentVodMappingService
.
getContendVods
(
getContendVodsDTO
));
}
@PostMapping
(
"changeContentVodOrders"
)
@ApiOperation
(
"课程内容视频排序 contentId/内容ID vodIds [] 视频的id"
)
public
ResponseVO
changeContentVodOrders
(
@RequestBody
ChangeOrdersDTO
changeOrdersDTO
){
contentVodMappingService
.
changeContentVodOrders
(
changeOrdersDTO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"addContentVod"
)
@ApiOperation
(
"添加课程内容视频:contentId/内容ID、vodIds [] /视频ID"
)
@LoginRequired
public
ResponseVO
addContentVod
(
@RequestBody
AddContentVod
addContentVod
)
{
contentVodMappingService
.
addContentVod
(
addContentVod
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"deleteContentVod"
)
@ApiOperation
(
"删除课程内容下的视频: contentId/内容ID 、 vodId/视频ID"
)
@LoginRequired
public
ResponseVO
deleteContentVod
(
@RequestBody
ContentVodDTO
contentVodDTO
)
{
contentVodMappingService
.
deleteContentVod
(
contentVodDTO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
}
src/main/java/com/subsidy/controller/CourseContentController.java
View file @
6747d4f
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.model.CourseContentDO
;
import
com.subsidy.service.CourseContentService
;
import
com.subsidy.util.ConstantUtils
;
...
...
@@ -58,6 +59,4 @@ public class CourseContentController {
public
ResponseVO
updateContent
(
@RequestBody
CourseContentDO
courseContentDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
courseContentService
.
updateContent
(
courseContentDO
));
}
}
src/main/java/com/subsidy/controller/ImageCheckRecordController.java
View file @
6747d4f
...
...
@@ -4,6 +4,7 @@ package com.subsidy.controller;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.image.CheckResultDTO
;
import
com.subsidy.dto.image.ImageCheckDTO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.service.ImageCheckRecordService
;
...
...
@@ -41,11 +42,24 @@ public class ImageCheckRecordController {
}
@PostMapping
(
"imageCheck"
)
@ApiOperation
(
"
人身核验 id 用户id nonce
"
)
@ApiOperation
(
"
启动人身核验 PC端 id 用户id
"
)
public
ResponseVO
imageCheck
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
imageCheck
(
imageCheckDTO
));
}
@PostMapping
(
"h5CheckResult"
)
@ApiOperation
(
"启动人脸核验 微信浮层H5 id 用户id"
)
public
ResponseVO
h5CheckResult
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
h5CheckResult
(
imageCheckDTO
));
}
@PostMapping
(
"checkResult"
)
@ApiOperation
(
"人脸验证结果 memberId orderNo "
)
public
void
checkResult
(
@RequestBody
CheckResultDTO
checkResultDTO
)
throws
Exception
{
imageCheckRecordService
.
checkResult
(
checkResultDTO
);
}
}
src/main/java/com/subsidy/controller/VodDictController.java
View file @
6747d4f
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.service.VodDictService
;
...
...
@@ -39,38 +37,35 @@ public class VodDictController {
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
signature
());
}
@PostMapping
(
"getContendVods"
)
@ApiOperation
(
"获取目录下的视频 {contentId vodName}"
)
@LoginRequired
public
ResponseVO
getContendVods
(
@RequestBody
GetContendVodsDTO
getContendVodsDTO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
getContendVods
(
getContendVodsDTO
));
}
@PostMapping
(
"deleteVod"
)
@ApiOperation
(
"删除视频 id "
)
@LoginRequired
public
ResponseVO
deleteVod
(
@RequestBody
VodDictDO
vodDictDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
deleteVod
(
vodDictDO
));
vodDictService
.
deleteVod
(
vodDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
"addVod"
)
@ApiOperation
(
"新增视频
content
Id vodName vodLength vodType vodSize vodUrl vodCode"
)
@ApiOperation
(
"新增视频
label
Id vodName vodLength vodType vodSize vodUrl vodCode"
)
@LoginRequired
public
ResponseVO
addVod
(
@RequestBody
VodDictDO
vodDictDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
addVod
(
vodDictDO
));
vodDictService
.
addVod
(
vodDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
,
ConstantUtils
.
ADD_SUCCESS
);
}
@PostMapping
(
"updateVod"
)
@ApiOperation
(
"新增视频 id
content
Id vodName vodLength vodType vodSize vodUrl vodCode"
)
@ApiOperation
(
"新增视频 id
label
Id vodName vodLength vodType vodSize vodUrl vodCode"
)
@LoginRequired
public
ResponseVO
updateVod
(
@RequestBody
VodDictDO
vodDictDO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
updateVod
(
vodDictDO
));
vodDictService
.
updateVod
(
vodDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
,
ConstantUtils
.
SET_SUCCESS
);
}
@PostMapping
(
"changeOrders"
)
@ApiOperation
(
"排序 vodIds [] 视频的id"
)
public
ResponseVO
changeOrders
(
@RequestBody
ChangeOrdersDTO
changeOrdersDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
vodDictService
.
changeOrders
(
changeOrdersDTO
));
vodDictService
.
changeOrders
(
changeOrdersDTO
);
return
ResponseData
.
generateCreatedResponse
(
0
,
ConstantUtils
.
SET_SUCCESS
);
}
}
src/main/java/com/subsidy/controller/VodLabelDictController.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.common.interceptor.LoginRequired
;
import
com.subsidy.dto.label.VodLabelPageDTO
;
import
com.subsidy.model.VodLabelDictDO
;
import
com.subsidy.service.VodLableDictService
;
import
io.swagger.annotations.ApiOperation
;
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
io.swagger.annotations.Api
;
/**
* <p>
* 视频库类目表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@RestController
@Api
(
tags
=
"视频库类目表"
)
@RequestMapping
(
"/vodLabelDict"
)
public
class
VodLabelDictController
{
@Autowired
private
VodLableDictService
vodLableDictService
;
@PostMapping
(
value
=
"addVodLabel"
)
@ApiOperation
(
"添加视频类目: labelName/类目名称"
)
@LoginRequired
public
ResponseVO
addVodLabel
(
@RequestBody
VodLabelDictDO
vodLabelDictDO
)
{
vodLableDictService
.
save
(
vodLabelDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
value
=
"updateVodLabel"
)
@ApiOperation
(
"添加视频类目: id/类目ID、labelName/类目名称"
)
@LoginRequired
public
ResponseVO
updateVodLabel
(
@RequestBody
VodLabelDictDO
vodLabelDictDO
)
{
vodLableDictService
.
updateById
(
vodLabelDictDO
);
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
value
=
"deleteVodLabel"
)
@ApiOperation
(
"添加视频类目: id/类目ID"
)
@LoginRequired
public
ResponseVO
deleteVodLabel
(
@RequestBody
VodLabelDictDO
vodLabelDictDO
)
{
vodLableDictService
.
removeById
(
vodLabelDictDO
.
getId
());
return
ResponseData
.
generateCreatedResponse
(
0
);
}
@PostMapping
(
value
=
"queryVodLabelPage"
)
@ApiOperation
(
"分页查询视频类目: labelName/名称、pageNum/但前页数、pageSize/每页显示条数"
)
@LoginRequired
public
ResponseVO
queryVodLabelPage
(
@RequestBody
VodLabelPageDTO
vodLabelPageDTO
)
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodLableDictService
.
queryVodLabelPage
(
vodLabelPageDTO
));
}
@PostMapping
(
value
=
"queryVodLabel"
)
@ApiOperation
(
"查询全部视频类目"
)
@LoginRequired
public
ResponseVO
queryVodLabel
()
{
return
ResponseData
.
generateCreatedResponse
(
0
,
vodLableDictService
.
list
());
}
}
src/main/java/com/subsidy/dto/businessScope/BusinessScopeDTO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
dto
.
businessScope
;
import
lombok.Data
;
@Data
public
class
BusinessScopeDTO
{
private
String
businessScopeName
;
private
Integer
pageNum
;
private
Integer
pageSize
;
}
src/main/java/com/subsidy/dto/contentVod/AddContentVod.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
dto
.
contentVod
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
AddContentVod
{
private
List
<
Long
>
vodIds
;
private
Long
contentId
;
}
src/main/java/com/subsidy/dto/contentVod/ContentVodDTO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
dto
.
contentVod
;
import
lombok.Data
;
@Data
public
class
ContentVodDTO
{
private
Long
contentId
;
private
Long
vodId
;
}
src/main/java/com/subsidy/dto/image/CheckResultDTO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
dto
.
image
;
import
lombok.Data
;
@Data
public
class
CheckResultDTO
{
private
String
orderNo
;
private
Long
memberId
;
}
src/main/java/com/subsidy/dto/image/ImageCheckDTO.java
View file @
6747d4f
...
...
@@ -7,12 +7,4 @@ public class ImageCheckDTO {
private
Long
id
;
private
String
imageBase64
;
private
Long
classId
;
private
Long
paperId
;
private
String
nonce
;
}
src/main/java/com/subsidy/dto/label/VodLabelPageDTO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
dto
.
label
;
import
lombok.Data
;
@Data
public
class
VodLabelPageDTO
{
private
String
labelName
;
private
Integer
pageNum
;
private
Integer
pageSize
;
}
src/main/java/com/subsidy/dto/vod/ChangeOrdersDTO.java
View file @
6747d4f
...
...
@@ -7,6 +7,8 @@ import java.util.List;
@Data
public
class
ChangeOrdersDTO
{
private
Long
contentId
;
private
List
<
Long
>
vodIds
;
}
src/main/java/com/subsidy/mapper/BusinessScopeDictMapper.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
mapper
;
import
com.subsidy.model.BusinessScopeDictDO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* <p>
* 经营范围表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-07-25
*/
@Repository
public
interface
BusinessScopeDictMapper
extends
BaseMapper
<
BusinessScopeDictDO
>
{
}
src/main/java/com/subsidy/mapper/ContentVodMappingMapper.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
mapper
;
import
com.subsidy.model.ContentVodMappingDO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* <p>
* 目录视频关系表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Repository
public
interface
ContentVodMappingMapper
extends
BaseMapper
<
ContentVodMappingDO
>
{
}
src/main/java/com/subsidy/mapper/VodLabelDictMapper.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
mapper
;
import
com.subsidy.model.VodLabelDictDO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.springframework.stereotype.Repository
;
/**
* <p>
* 视频库类目表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Repository
public
interface
VodLabelDictMapper
extends
BaseMapper
<
VodLabelDictDO
>
{
}
src/main/java/com/subsidy/model/BusinessScopeDictDO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
model
;
import
com.subsidy.util.BaseModel
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 经营范围表
* </p>
*
* @author DengMin
* @since 2022-07-25
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"business_scope_dict"
)
public
class
BusinessScopeDictDO
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 经营范围名称
*/
private
String
businessScopeName
;
}
src/main/java/com/subsidy/model/ContentVodMappingDO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
model
;
import
com.subsidy.util.BaseModel
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 目录视频关系表
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"content_vod_mapping"
)
public
class
ContentVodMappingDO
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 课程目录ID
*/
private
Long
contentId
;
/**
* 视频ID
*/
private
Long
vodId
;
/**
* 视频排序
*/
private
Integer
orderNo
;
}
src/main/java/com/subsidy/model/ImageCheckRecordDO.java
View file @
6747d4f
...
...
@@ -26,22 +26,39 @@ public class ImageCheckRecordDO extends BaseModel {
private
Long
id
;
/**
*
班级
id
*
成员
id
*/
private
Long
class
Id
;
private
Long
member
Id
;
/**
*
成员id
*
活体检测得分
*/
private
Long
memberId
;
private
String
liveRate
;
/**
*
请求id
*
人脸检测得分
*/
private
String
requestId
;
private
String
similarity
;
/**
*
图片地址
*
刷脸时间
*/
private
String
imageUrl
;
private
String
occurredTime
;
/**
* 图片
*/
private
String
photo
;
/**
* 流水号
*/
private
String
bizSeqNo
;
/**
* 检测类型 检测类型 1,权威库 0照片比对
*/
private
Integer
checkType
;
}
src/main/java/com/subsidy/model/VodDictDO.java
View file @
6747d4f
...
...
@@ -26,9 +26,9 @@ public class VodDictDO extends BaseModel {
private
Long
id
;
/**
*
目录
id
*
类目
id
*/
private
Long
content
Id
;
private
Long
label
Id
;
/**
* 视频名称
...
...
src/main/java/com/subsidy/model/VodLabelDictDO.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
model
;
import
com.subsidy.util.BaseModel
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 视频库类目表
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"vod_label_dict"
)
public
class
VodLabelDictDO
extends
BaseModel
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 视频类目名称
*/
private
String
labelName
;
}
src/main/java/com/subsidy/service/BusinessScopeDictService.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.subsidy.dto.businessScope.BusinessScopeDTO
;
import
com.subsidy.model.BusinessScopeDictDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* <p>
* 经营范围表 服务类
* </p>
*
* @author DengMin
* @since 2022-07-25
*/
public
interface
BusinessScopeDictService
extends
IService
<
BusinessScopeDictDO
>
{
IPage
queryBusinessScopePage
(
BusinessScopeDTO
businessScopeDictDO
);
}
src/main/java/com/subsidy/service/ContentVodMappingService.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.contentVod.AddContentVod
;
import
com.subsidy.dto.contentVod.ContentVodDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.model.ContentVodMappingDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.vo.vod.GetContendVodsVO
;
import
java.util.List
;
/**
* <p>
* 目录视频关系表 服务类
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
public
interface
ContentVodMappingService
extends
IService
<
ContentVodMappingDO
>
{
List
<
GetContendVodsVO
>
getContendVods
(
GetContendVodsDTO
getContendVodsDTO
);
void
changeContentVodOrders
(
ChangeOrdersDTO
changeOrdersDTO
);
void
deleteContentVod
(
ContentVodDTO
contentVodDTO
);
void
addContentVod
(
AddContentVod
addContentVod
);
}
src/main/java/com/subsidy/service/CourseContentService.java
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.model.CourseContentDO
;
import
com.subsidy.vo.vod.GetContendVodsVO
;
import
java.util.List
;
...
...
src/main/java/com/subsidy/service/ImageCheckRecordService.java
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.subsidy.dto.image.CheckResultDTO
;
import
com.subsidy.dto.image.ImageCheckDTO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.vo.token.SendIdCardInfoVO
;
import
java.util.List
;
...
...
@@ -18,6 +20,10 @@ public interface ImageCheckRecordService extends IService<ImageCheckRecordDO> {
List
<
ImageCheckRecordDO
>
getImageCheckHistory
(
ImageCheckRecordDO
imageCheckRecordDO
);
String
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
;
SendIdCardInfoVO
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
;
SendIdCardInfoVO
h5CheckResult
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
;
void
checkResult
(
CheckResultDTO
checkResultDTO
)
throws
Exception
;
}
src/main/java/com/subsidy/service/VodDictService.java
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.vo.vod.GetContendVodsVO
;
import
com.subsidy.vo.vod.SignatureVO
;
import
java.util.List
;
/**
* <p>
* 视频表 服务类
...
...
@@ -22,13 +17,11 @@ public interface VodDictService extends IService<VodDictDO> {
SignatureVO
signature
()
throws
Exception
;
List
<
GetContendVodsVO
>
getContendVods
(
GetContendVodsDTO
getContendVodsDTO
);
String
deleteVod
(
VodDictDO
vodDictDO
);
void
deleteVod
(
VodDictDO
vodDictDO
);
String
addVod
(
VodDictDO
vodDictDO
);
void
addVod
(
VodDictDO
vodDictDO
);
String
updateVod
(
VodDictDO
vodDictDO
);
void
updateVod
(
VodDictDO
vodDictDO
);
String
changeOrders
(
ChangeOrdersDTO
changeOrdersDTO
);
void
changeOrders
(
ChangeOrdersDTO
changeOrdersDTO
);
}
src/main/java/com/subsidy/service/VodLableDictService.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.subsidy.dto.label.VodLabelPageDTO
;
import
com.subsidy.model.VodLabelDictDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
/**
* <p>
* 视频库类目表 服务类
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
public
interface
VodLableDictService
extends
IService
<
VodLabelDictDO
>
{
IPage
<
VodLabelDictDO
>
queryVodLabelPage
(
VodLabelPageDTO
vodLabelPageDTO
);
}
src/main/java/com/subsidy/service/impl/BusinessScopeDictServiceImpl.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.subsidy.dto.businessScope.BusinessScopeDTO
;
import
com.subsidy.model.BusinessScopeDictDO
;
import
com.subsidy.mapper.BusinessScopeDictMapper
;
import
com.subsidy.service.BusinessScopeDictService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 经营范围表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-07-25
*/
@Service
public
class
BusinessScopeDictServiceImpl
extends
ServiceImpl
<
BusinessScopeDictMapper
,
BusinessScopeDictDO
>
implements
BusinessScopeDictService
{
@Override
public
IPage
queryBusinessScopePage
(
BusinessScopeDTO
businessScopeDictDO
)
{
Page
page
=
new
Page
(
businessScopeDictDO
.
getPageNum
(),
businessScopeDictDO
.
getPageSize
());
return
this
.
baseMapper
.
selectPage
(
page
,
new
QueryWrapper
<
BusinessScopeDictDO
>()
.
lambda
()
.
like
(
StringUtils
.
isNotBlank
(
businessScopeDictDO
.
getBusinessScopeName
()),
BusinessScopeDictDO:
:
getBusinessScopeName
,
businessScopeDictDO
.
getBusinessScopeName
()));
}
}
src/main/java/com/subsidy/service/impl/ContentVodMappingServiceImpl.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.dto.content.GetContendVodsDTO
;
import
com.subsidy.dto.contentVod.AddContentVod
;
import
com.subsidy.dto.contentVod.ContentVodDTO
;
import
com.subsidy.dto.vod.ChangeOrdersDTO
;
import
com.subsidy.mapper.VodDictMapper
;
import
com.subsidy.model.ContentVodMappingDO
;
import
com.subsidy.mapper.ContentVodMappingMapper
;
import
com.subsidy.service.ContentVodMappingService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.vo.vod.GetContendVodsVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
* 目录视频关系表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Service
public
class
ContentVodMappingServiceImpl
extends
ServiceImpl
<
ContentVodMappingMapper
,
ContentVodMappingDO
>
implements
ContentVodMappingService
{
@Autowired
private
VodDictMapper
vodDictMapper
;
@Override
public
List
<
GetContendVodsVO
>
getContendVods
(
GetContendVodsDTO
getContendVodsDTO
)
{
return
vodDictMapper
.
getContendVods
(
getContendVodsDTO
.
getVodName
(),
getContendVodsDTO
.
getContentId
());
}
@Override
public
void
changeContentVodOrders
(
ChangeOrdersDTO
changeOrdersDTO
){
if
(
CollectionUtils
.
isNotEmpty
(
changeOrdersDTO
.
getVodIds
()))
{
for
(
int
i
=
0
;
i
<
changeOrdersDTO
.
getVodIds
().
size
();
i
++)
{
ContentVodMappingDO
contentVodMappingDO
=
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
ContentVodMappingDO
>().
lambda
()
.
eq
(
ContentVodMappingDO:
:
getContentId
,
changeOrdersDTO
.
getContentId
())
.
eq
(
ContentVodMappingDO:
:
getVodId
,
changeOrdersDTO
.
getVodIds
().
get
(
i
)));
ContentVodMappingDO
contentVodMapping
=
new
ContentVodMappingDO
();
contentVodMapping
.
setId
(
contentVodMappingDO
.
getId
());
contentVodMapping
.
setOrderNo
(
i
+
1
);
this
.
baseMapper
.
updateById
(
contentVodMapping
);
}
}
}
@Override
public
void
deleteContentVod
(
ContentVodDTO
contentVodDTO
)
{
ContentVodMappingDO
contentVodMappingDO
=
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
ContentVodMappingDO
>()
.
lambda
()
.
eq
(
ContentVodMappingDO:
:
getContentId
,
contentVodDTO
.
getContentId
())
.
eq
(
ContentVodMappingDO:
:
getVodId
,
contentVodDTO
.
getVodId
()));
if
(
contentVodMappingDO
==
null
)
{
throw
new
HttpException
(
18001
);
}
this
.
baseMapper
.
deleteById
(
contentVodMappingDO
.
getId
());
}
@Override
public
void
addContentVod
(
AddContentVod
addContentVod
)
{
if
(
CollectionUtils
.
isNotEmpty
(
addContentVod
.
getVodIds
()))
{
List
<
ContentVodMappingDO
>
list
=
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
ContentVodMappingDO
>()
.
lambda
()
.
eq
(
ContentVodMappingDO:
:
getContentId
,
addContentVod
.
getContentId
()));
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
this
.
baseMapper
.
deleteBatchIds
(
list
.
stream
().
map
(
ContentVodMappingDO:
:
getId
).
collect
(
Collectors
.
toList
()));
}
for
(
int
i
=
0
;
i
<
addContentVod
.
getVodIds
().
size
();
i
++)
{
ContentVodMappingDO
contentVodMappingDO
=
new
ContentVodMappingDO
();
contentVodMappingDO
.
setContentId
(
addContentVod
.
getContentId
());
contentVodMappingDO
.
setVodId
(
addContentVod
.
getVodIds
().
get
(
i
));
contentVodMappingDO
.
setOrderNo
(
i
+
1
);
this
.
baseMapper
.
insert
(
contentVodMappingDO
);
}
}
}
}
src/main/java/com/subsidy/service/impl/CourseContentServiceImpl.java
View file @
6747d4f
...
...
@@ -7,9 +7,7 @@ import com.subsidy.mapper.CourseContentMapper;
import
com.subsidy.model.CourseContentDO
;
import
com.subsidy.service.CourseContentService
;
import
com.subsidy.util.ConstantUtils
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
...
...
@@ -23,6 +21,7 @@ import java.util.List;
@Service
public
class
CourseContentServiceImpl
extends
ServiceImpl
<
CourseContentMapper
,
CourseContentDO
>
implements
CourseContentService
{
@Override
public
List
<
CourseContentDO
>
getContents
(
CourseContentDO
courseContentDO
)
{
return
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
CourseContentDO
>()
.
lambda
()
...
...
@@ -31,11 +30,13 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C
.
orderByAsc
(
CourseContentDO:
:
getCreateDate
));
}
@Override
public
String
deleteContent
(
CourseContentDO
courseContentDO
){
this
.
baseMapper
.
deleteById
(
courseContentDO
.
getId
());
return
ConstantUtils
.
DELETE_SUCCESS
;
}
@Override
public
String
addContent
(
CourseContentDO
courseContentDO
){
Integer
orderNoTmp
=
this
.
baseMapper
.
selectMaxOrderNo
(
courseContentDO
.
getCourseId
());
...
...
@@ -50,6 +51,7 @@ public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, C
return
ConstantUtils
.
ADD_SUCCESS
;
}
@Override
public
String
updateContent
(
CourseContentDO
courseContentDO
){
int
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
CourseContentDO
>()
...
...
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
View file @
6747d4f
package
com
.
subsidy
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.
generator.config.TemplateConfig
;
import
com.baomidou.mybatisplus.
extension.service.impl.ServiceImpl
;
import
com.google.common.hash.Hashing
;
import
com.subsidy.common.configure.RestTemplateConfig
;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.dto.image.CheckResultDTO
;
import
com.subsidy.dto.image.ImageCheckDTO
;
import
com.subsidy.mapper.AccessTokenMapper
;
import
com.subsidy.mapper.ImageCheckRecordMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.model.AccessTokenDO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.mapper.ImageCheckRecordMapper
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.service.ImageCheckRecordService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.ImageCheckUtil
;
import
com.subsidy.vo.token.*
;
import
com.subsidy.vo.wechat.AccessTokenVO
;
import
com.tencentcloudapi.faceid.v20180301.models.GetFaceIdResultResponse
;
import
com.tencentcloudapi.faceid.v20180301.models.ImageRecognitionResponse
;
import
org.apache.commons.codec.Charsets
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
sun.misc.BASE64Decoder
;
//import org.apache.commons.codec.binary.Base64;
import
java.io.*
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* <p>
...
...
@@ -48,21 +50,27 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
@Autowired
private
RestTemplateConfig
restTemplateConfig
;
@Autowired
private
AccessTokenMapper
accessTokenMapper
;
@Autowired
private
ImageCheckRecordMapper
imageCheckRecordMapper
;
// public static final String WBAPPID = "IDAaOibN";
// public static final String SECRET= "GD6Z55rHXSlBZB4oxEEowwI5h4IgwUdh0xOOHi6fambXYMFcHuDaBRxtnMx5FVhk";
public
static
final
String
WBAPPID
=
"TIDAbX8x"
;
public
static
final
String
SECRET
=
"cWAMlQ8Aq7aOad0wrtfJcSpcgksCLFT62qHC4uDHFCGx0SPKqtpt1PungiAKya2M"
;
public
static
final
String
NONCE
=
"08f1209ee37b4ba29e61e51f3643a24e"
;
public
List
<
ImageCheckRecordDO
>
getImageCheckHistory
(
ImageCheckRecordDO
imageCheckRecordDO
)
{
return
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
ImageCheckRecordDO
>()
.
lambda
()
.
eq
(
ImageCheckRecordDO:
:
getClassId
,
imageCheckRecordDO
.
getClassId
())
.
eq
(
ImageCheckRecordDO:
:
getMemberId
,
imageCheckRecordDO
.
getMemberId
())
.
orderByDesc
(
ImageCheckRecordDO:
:
getCreateDate
));
}
public
S
tring
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
S
endIdCardInfoVO
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
//获取这个学生的基本信息
MemberDO
memberDO
=
memberMapper
.
selectById
(
imageCheckDTO
.
getId
());
...
...
@@ -71,15 +79,34 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
throw
new
HttpException
(
10025
);
}
/**
* 生成订单
*/
ImageCheckRecordDO
imageCheckRecordDO
=
new
ImageCheckRecordDO
();
imageCheckRecordDO
.
setMemberId
(
imageCheckDTO
.
getId
());
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
AccessTokenDO
accessTokenDO
=
accessTokenMapper
.
selectOne
(
new
QueryWrapper
<
AccessTokenDO
>()
.
lambda
()
.
lt
(
AccessTokenDO:
:
getCreateDate
,
LocalDateTime
.
now
().
minusMinutes
(
19L
)));
//数据库没有的话
if
(
null
==
accessTokenDO
){
accessTokenMapper
.
delete
(
null
);
//获取token
IdCardAccessTokenVO
idCardAccessTokenVO
=
this
.
accessToken
();
accessTokenDO
=
new
AccessTokenDO
();
accessTokenDO
.
setAccessToken
(
idCardAccessTokenVO
.
getAccess_token
());
accessTokenMapper
.
insert
(
accessTokenDO
);
}
//获取signTicket
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
idCardAccessTokenVO
.
getAccess_t
oken
());
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
accessTokenDO
.
getAccessT
oken
());
List
<
String
>
signList1
=
new
ArrayList
<>();
signList1
.
add
(
WBAPPID
);
signList1
.
add
(
"001
"
);
signList1
.
add
(
imageCheckRecordDO
.
getId
()+
"
"
);
signList1
.
add
(
memberDO
.
getUserName
());
signList1
.
add
(
memberDO
.
getIdCard
());
signList1
.
add
(
memberDO
.
getId
()
+
""
);
...
...
@@ -87,48 +114,159 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//生成签名
String
sign
=
sign
(
signList1
,
idCardTicketsVO
.
getValue
());
System
.
out
.
println
(
sign
);
//合作方后台上送身份信息
SendIdCardInfoVO
sendIdCardInfoVO
=
this
.
sendIdCardInfo
(
"001
"
,
memberDO
,
sign
);
SendIdCardInfoVO
sendIdCardInfoVO
=
this
.
sendIdCardInfo
(
imageCheckRecordDO
.
getId
()+
"
"
,
memberDO
,
sign
);
//获取 NONCE ticket
IdCardTicketsVO
nonceTicket
=
this
.
nonceTicket
(
idCardAccessTokenVO
.
getAccess_t
oken
(),
memberDO
.
getId
()
+
""
);
IdCardTicketsVO
nonceTicket
=
this
.
nonceTicket
(
accessTokenDO
.
getAccessT
oken
(),
memberDO
.
getId
()
+
""
);
//签名2
List
<
String
>
signList2
=
new
ArrayList
<>();
signList2
.
add
(
WBAPPID
);
signList2
.
add
(
memberDO
.
getId
()
+
""
);
signList2
.
add
(
imageCheckDTO
.
getNonce
()
);
signList2
.
add
(
NONCE
);
signList2
.
add
(
"1.0.0"
);
signList2
.
add
(
sendIdCardInfoVO
.
getResult
().
getH5faceId
());
signList2
.
add
(
sendIdCardInfoVO
.
getResult
().
getOrderNo
());
String
sign2
=
sign
(
signList2
,
nonceTicket
.
getValue
());
//启动人脸验证
this
.
startCheck
(
imageCheckDTO
.
getNonce
(),
sendIdCardInfoVO
.
getResult
(),
memberDO
.
getId
()
+
""
,
sign2
);
sendIdCardInfoVO
.
getResult
().
setWbAppId
(
WBAPPID
);
sendIdCardInfoVO
.
getResult
().
setNonce
(
NONCE
);
sendIdCardInfoVO
.
getResult
().
setUserId
(
memberDO
.
getId
());
sendIdCardInfoVO
.
getResult
().
setSign
(
sign2
);
return
sendIdCardInfoVO
;
}
public
SendIdCardInfoVO
h5CheckResult
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
//获取这个学生的基本信息
MemberDO
memberDO
=
memberMapper
.
selectById
(
imageCheckDTO
.
getId
());
if
(
StringUtils
.
isEmpty
(
memberDO
.
getIdCard
()))
{
throw
new
HttpException
(
10025
);
}
AccessTokenDO
accessTokenDO
=
accessTokenMapper
.
selectOne
(
new
QueryWrapper
<
AccessTokenDO
>()
.
lambda
()
.
lt
(
AccessTokenDO:
:
getCreateDate
,
LocalDateTime
.
now
().
minusMinutes
(
19L
)));
//数据库没有的话
if
(
null
==
accessTokenDO
){
accessTokenMapper
.
delete
(
null
);
//获取token
IdCardAccessTokenVO
idCardAccessTokenVO
=
this
.
accessToken
();
accessTokenDO
=
new
AccessTokenDO
();
accessTokenDO
.
setAccessToken
(
idCardAccessTokenVO
.
getAccess_token
());
accessTokenMapper
.
insert
(
accessTokenDO
);
}
//获取signTicket
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
accessTokenDO
.
getAccessToken
());
List
<
String
>
signList1
=
new
ArrayList
<>();
signList1
.
add
(
WBAPPID
);
signList1
.
add
(
memberDO
.
getId
()
+
""
);
signList1
.
add
(
"1.0.0"
);
signList1
.
add
(
NONCE
);
//生成签名
String
sign
=
sign
(
signList1
,
idCardTicketsVO
.
getValue
());
//合作方后台上送身份信息
SendIdCardInfoVO
sendIdCardInfoVO
=
this
.
h5SendIdCardInfo
(
"001"
,
memberDO
,
sign
);
if
(!
"0"
.
equals
(
sendIdCardInfoVO
.
getCode
())){
throw
new
HttpException
(
10026
);
}
//获取 NONCE ticket
IdCardTicketsVO
nonceTicket
=
this
.
nonceTicket
(
accessTokenDO
.
getAccessToken
(),
memberDO
.
getId
()
+
""
);
//签名2
List
<
String
>
signList2
=
new
ArrayList
<>();
signList2
.
add
(
WBAPPID
);
signList2
.
add
(
"001"
);
signList2
.
add
(
memberDO
.
getId
()
+
""
);
signList2
.
add
(
"1.0.0"
);
signList2
.
add
(
sendIdCardInfoVO
.
getResult
().
getFaceId
());
signList2
.
add
(
NONCE
);
String
sign2
=
sign
(
signList2
,
nonceTicket
.
getValue
());
System
.
out
.
println
(
sign2
+
"====================================="
);
sendIdCardInfoVO
.
getResult
().
setWbAppId
(
WBAPPID
);
sendIdCardInfoVO
.
getResult
().
setNonce
(
NONCE
);
sendIdCardInfoVO
.
getResult
().
setUserId
(
memberDO
.
getId
());
sendIdCardInfoVO
.
getResult
().
setSign
(
sign2
);
return
sendIdCardInfoVO
;
}
public
void
checkResult
(
CheckResultDTO
checkResultDTO
)
throws
Exception
{
AccessTokenDO
accessTokenDO
=
accessTokenMapper
.
selectOne
(
new
QueryWrapper
<
AccessTokenDO
>()
.
lambda
()
.
gt
(
AccessTokenDO:
:
getCreateDate
,
LocalDateTime
.
now
().
minusMinutes
(
19L
)));
//数据库没有的话
if
(
null
==
accessTokenDO
){
accessTokenMapper
.
delete
(
null
);
//获取token
IdCardAccessTokenVO
idCardAccessTokenVO
=
this
.
accessToken
();
accessTokenDO
=
new
AccessTokenDO
();
accessTokenDO
.
setAccessToken
(
idCardAccessTokenVO
.
getAccess_token
());
accessTokenMapper
.
insert
(
accessTokenDO
);
}
//获取signTicket
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
accessTokenDO
.
getAccessToken
());
//签名3
List
<
String
>
signList3
=
new
ArrayList
<>();
signList3
.
add
(
WBAPPID
);
signList3
.
add
(
"001"
);
signList3
.
add
(
"1.0.0"
);
signList3
.
add
(
imageCheckDTO
.
getNonce
()
);
signList3
.
add
(
NONCE
);
String
sign3
=
sign
(
signList3
,
idCardTicketsVO
.
getValue
());
System
.
out
.
println
(
sign3
);
String
sign3
=
sign
(
signList3
,
idCardTicketsVO
.
getValue
());
//人身核验结果
ResultVO
resultVO
=
this
.
checkResult
(
"001"
,
imageCheckDTO
.
getNonce
(),
sign3
);
ResultVO
resultVO
=
this
.
checkResult
(
"001"
,
sign3
);
//存数据库
ImageCheckRecordDO
imageCheckRecordDO
=
new
ImageCheckRecordDO
();
BeanUtils
.
copyProperties
(
resultVO
,
imageCheckRecordDO
);
imageCheckRecordDO
.
setMemberId
(
checkResultDTO
.
getMemberId
());
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
}
/**
* 字符串转图片
* @param base64Str
* @return
*/
public
static
byte
[]
decode
(
String
base64Str
){
byte
[]
b
=
null
;
BASE64Decoder
decoder
=
new
BASE64Decoder
();
try
{
b
=
decoder
.
decodeBuffer
(
replaceEnter
(
base64Str
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
b
;
}
if
(
Double
.
valueOf
(
resultVO
.
getSimilarity
())
>
80.0
)
{
return
ConstantUtils
.
SUCCESS_VERIFY
;
}
else
{
return
ConstantUtils
.
FAIL_VERIFY
;
}
public
static
String
replaceEnter
(
String
str
){
String
reg
=
"[\n-\r]"
;
Pattern
p
=
Pattern
.
compile
(
reg
);
Matcher
m
=
p
.
matcher
(
str
);
return
m
.
replaceAll
(
""
);
}
/**
* 获取accessToken
*/
...
...
@@ -138,9 +276,6 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
+
"&secret="
+
SECRET
+
"&grant_type=client_credential&version=1.0.0"
;
ResponseEntity
<
IdCardAccessTokenVO
>
response
=
restTemplateConfig
.
restTemplate
()
.
exchange
(
url
,
HttpMethod
.
GET
,
null
,
IdCardAccessTokenVO
.
class
);
System
.
out
.
println
(
response
.
getBody
().
toString
());
return
response
.
getBody
();
}
...
...
@@ -152,9 +287,6 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
String
url
=
"https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/api_ticket?app_id="
+
WBAPPID
+
"&access_token="
+
accessToken
+
"&type=SIGN&version=1.0.0"
;
ResponseEntity
<
IdCardSignTicketVO
>
response
=
restTemplateConfig
.
restTemplate
()
.
exchange
(
url
,
HttpMethod
.
GET
,
null
,
IdCardSignTicketVO
.
class
);
System
.
out
.
println
(
response
.
getBody
().
getTickets
());
return
response
.
getBody
().
getTickets
().
get
(
0
);
}
...
...
@@ -177,7 +309,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
}
/**
* 合作方后台上送身份信息 POST请求
*
PC端
合作方后台上送身份信息 POST请求
*/
public
SendIdCardInfoVO
sendIdCardInfo
(
String
orderNo
,
MemberDO
memberDO
,
String
sign
)
{
String
url
=
"https://miniprogram-kyc.tencentcloudapi.com/api/server/h5/geth5faceid?orderNo="
+
orderNo
;
...
...
@@ -191,14 +323,35 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
" \"version\":\"1.0.0\","
+
" \"sign\":\""
+
sign
+
"\""
+
"}"
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
ResponseEntity
<
SendIdCardInfoVO
>
responseEntity
=
restTemplateConfig
.
restTemplate
()
.
exchange
(
url
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
input
,
headers
),
SendIdCardInfoVO
.
class
);
return
responseEntity
.
getBody
();
}
/**
* PC端 合作方后台上送身份信息 POST请求
*/
public
SendIdCardInfoVO
h5SendIdCardInfo
(
String
orderNo
,
MemberDO
memberDO
,
String
sign
)
{
String
url
=
"https://kyc.qcloud.com/api/server/getAdvFaceId?orderNo="
+
orderNo
;
String
input
=
"{\n"
+
" \"appId\":\""
+
WBAPPID
+
"\",\n"
+
" \"orderNo\":\""
+
orderNo
+
"\",\n"
+
" \"name\":\""
+
memberDO
.
getUserName
()
+
"\","
+
" \"idNo\":\""
+
memberDO
.
getIdCard
()
+
"\","
+
" \"userId\":\""
+
memberDO
.
getId
()
+
"\","
+
" \"version\":\"1.0.0\","
+
" \"sign\":\""
+
sign
+
"\","
+
" \"nonce\":\""
+
NONCE
+
"\""
+
"}"
;
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
ResponseEntity
<
SendIdCardInfoVO
>
responseEntity
=
restTemplateConfig
.
restTemplate
()
.
exchange
(
url
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
input
,
headers
),
SendIdCardInfoVO
.
class
);
return
responseEntity
.
getBody
();
}
...
...
@@ -216,33 +369,16 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
}
/**
* 启动 H5 人脸核身
*/
public
void
startCheck
(
String
nonce
,
SendResultVO
sendResultVO
,
String
userId
,
String
sign
)
{
String
url
=
"https://miniprogram-kyc.tencentcloudapi.com/api/pc/login?webankAppId="
+
WBAPPID
+
"&version=1.0.0"
+
"&nonce="
+
nonce
+
"&orderNo="
+
sendResultVO
.
getOrderNo
()
+
"&h5faceId="
+
sendResultVO
.
getH5faceId
()
+
"&url="
+
sendResultVO
.
getOptimalDomain
()
+
"&userId="
+
userId
+
"&sign="
+
sign
;
restTemplateConfig
.
restTemplate
()
.
exchange
(
url
,
HttpMethod
.
GET
,
null
,
IdCardSignTicketVO
.
class
);
}
/**
* 人脸核身结果查询 POST
*/
public
ResultVO
checkResult
(
String
orderNo
,
String
nonce
,
String
sign
)
{
public
ResultVO
checkResult
(
String
orderNo
,
String
sign
)
{
String
url
=
"https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo="
+
orderNo
;
String
url
=
"https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo="
+
orderNo
;
String
input
=
"{\n"
+
" \"appId\":\""
+
WBAPPID
+
"\",\n"
+
" \"version\":\"1.0.0\",\n"
+
" \"nonce\":\""
+
nonce
+
"\","
+
" \"nonce\":\""
+
NONCE
+
"\","
+
" \"orderNo\":\""
+
orderNo
+
"\","
+
" \"sign\":\""
+
sign
+
"\","
+
" \"getFile\":\"2\","
+
...
...
@@ -258,7 +394,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
.
exchange
(
url
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
input
.
getBytes
(),
headers
),
CheckResultVO
.
class
);
return
responseEntity
.
getBody
().
getResult
VO
();
return
responseEntity
.
getBody
().
getResult
();
}
...
...
src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
View file @
6747d4f
...
...
@@ -9,23 +9,15 @@ import com.subsidy.dto.vod.ChangeOrdersDTO;
import
com.subsidy.mapper.VodDictMapper
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.service.VodDictService
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.Signature
;
import
com.subsidy.util.VodUtil
;
import
com.subsidy.vo.vod.GetContendVodsVO
;
import
com.subsidy.vo.vod.SignatureVO
;
import
com.tencentcloudapi.common.Credential
;
import
com.tencentcloudapi.common.exception.TencentCloudSDKException
;
import
com.tencentcloudapi.common.profile.ClientProfile
;
import
com.tencentcloudapi.common.profile.HttpProfile
;
import
com.tencentcloudapi.vod.v20180717.VodClient
;
import
com.tencentcloudapi.vod.v20180717.models.DeleteMediaRequest
;
import
com.tencentcloudapi.vod.v20180717.models.MediaProcessTaskInput
;
import
com.tencentcloudapi.vod.v20180717.models.ProcessMediaRequest
;
import
com.tencentcloudapi.vod.v20180717.models.TranscodeTaskInput
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Random
;
...
...
@@ -46,6 +38,7 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
@Value
(
"${spring.profiles.active}"
)
private
String
env
;
@Override
public
SignatureVO
signature
()
{
SignatureVO
signatureVO
=
new
SignatureVO
();
...
...
@@ -66,52 +59,30 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
return
signatureVO
;
}
public
List
<
GetContendVodsVO
>
getContendVods
(
GetContendVodsDTO
getContendVodsDTO
)
{
//Page pager = new Page(getContendVodsDTO.getPageNum(), getContendVodsDTO.getPageSize());
return
this
.
baseMapper
.
getContendVods
(
getContendVodsDTO
.
getVodName
(),
getContendVodsDTO
.
getContentId
());
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteVod
(
VodDictDO
vodDictDO
)
{
VodDictDO
vod
=
this
.
baseMapper
.
selectById
(
vodDictDO
.
getId
());
if
(
null
==
vod
)
{
throw
new
HttpException
(
18000
);
}
public
String
deleteVod
(
VodDictDO
vodDictDO
)
{
VodDictDO
vodDictDO1
=
this
.
baseMapper
.
selectById
(
vodDictDO
.
getId
());
this
.
baseMapper
.
deleteById
(
vodDictDO
.
getId
());
try
{
//删除原视频
Credential
cred
=
new
Credential
(
vodConfig
.
getSecretId
(),
vodConfig
.
getSecretKey
());
HttpProfile
httpProfile
=
new
HttpProfile
();
httpProfile
.
setEndpoint
(
"vod.tencentcloudapi.com"
);
ClientProfile
clientProfile
=
new
ClientProfile
();
clientProfile
.
setHttpProfile
(
httpProfile
);
VodClient
client
=
new
VodClient
(
cred
,
""
,
clientProfile
);
// 实例化一个请求对象,每个接口都会对应一个request对象
DeleteMediaRequest
req
=
new
DeleteMediaRequest
();
req
.
setFileId
(
vodDictDO1
.
getVodCode
());
// 返回的resp是一个DeleteMediaResponse的实例,与请求对象对应
client
.
DeleteMedia
(
req
);
}
catch
(
TencentCloudSDKException
e
)
{
VodUtil
.
deleteMedia
(
vodDictDO
.
getVodCode
());
}
return
ConstantUtils
.
DELETE_SUCCESS
;
}
public
String
addVod
(
VodDictDO
vodDictDO
)
{
//排序
int
orderNo
=
1
;
@Override
public
void
addVod
(
VodDictDO
vodDictDO
)
{
int
orderNo
=
1
;
//排序
List
<
VodDictDO
>
vodDictDOS
=
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
VodDictDO
>()
.
lambda
()
.
eq
(
VodDictDO:
:
getContentId
,
vodDictDO
.
getContent
Id
())
.
eq
(
VodDictDO:
:
getLabelId
,
vodDictDO
.
getLabel
Id
())
.
orderByDesc
(
VodDictDO:
:
getOrderNo
));
if
(
vodDictDOS
.
size
()>
0
){
VodDictDO
vod
DictDO1
=
vodDictDOS
.
get
(
0
);
if
(
null
!=
vodDictDO1
){
orderNo
=
vod
DictDOS
.
get
(
0
).
getOrderNo
()+
1
;
if
(
CollectionUtils
.
isNotEmpty
(
vodDictDOS
)
){
VodDictDO
vod
=
vodDictDOS
.
get
(
0
);
if
(
null
!=
vod
){
orderNo
=
vod
.
getOrderNo
()
+
1
;
}
}
vodDictDO
.
setOrderNo
(
orderNo
);
...
...
@@ -119,49 +90,22 @@ public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> im
//测试环境就不转码了
if
(
env
.
equals
(
"prod"
)){
//上传后直接转码
Credential
cred
=
new
Credential
(
vodConfig
.
getSecretId
(),
vodConfig
.
getSecretKey
());
HttpProfile
httpProfile
=
new
HttpProfile
();
httpProfile
.
setEndpoint
(
"vod.tencentcloudapi.com"
);
ClientProfile
clientProfile
=
new
ClientProfile
();
clientProfile
.
setHttpProfile
(
httpProfile
);
VodClient
client
=
new
VodClient
(
cred
,
""
,
clientProfile
);
ProcessMediaRequest
processMediaRequest
=
new
ProcessMediaRequest
();
MediaProcessTaskInput
mediaProcessTaskInput1
=
new
MediaProcessTaskInput
();
TranscodeTaskInput
[]
transcodeTaskInputs1
=
new
TranscodeTaskInput
[
1
];
TranscodeTaskInput
transcodeTaskInput1
=
new
TranscodeTaskInput
();
transcodeTaskInput1
.
setDefinition
(
ConstantUtils
.
TEMPLATE_VOD
);
transcodeTaskInputs1
[
0
]
=
transcodeTaskInput1
;
mediaProcessTaskInput1
.
setTranscodeTaskSet
(
transcodeTaskInputs1
);
processMediaRequest
.
setMediaProcessTask
(
mediaProcessTaskInput1
);
processMediaRequest
.
setFileId
(
vodDictDO
.
getVodCode
());
try
{
client
.
ProcessMedia
(
processMediaRequest
);
}
catch
(
Exception
ex
)
{
throw
new
HttpException
(
50001
);
VodUtil
.
processMedia
(
vodDictDO
.
getVodCode
());
}
}
return
ConstantUtils
.
ADD_SUCCESS
;
}
public
String
updateVod
(
VodDictDO
vodDictDO
)
{
@Override
public
void
updateVod
(
VodDictDO
vodDictDO
)
{
this
.
baseMapper
.
updateById
(
vodDictDO
);
return
ConstantUtils
.
SET_SUCCESS
;
}
public
String
changeOrders
(
ChangeOrdersDTO
changeOrdersDTO
){
@Override
public
void
changeOrders
(
ChangeOrdersDTO
changeOrdersDTO
){
int
i
=
1
;
List
<
Long
>
longs
=
changeOrdersDTO
.
getVodIds
();
for
(
Long
lg
:
longs
){
this
.
baseMapper
.
updateVodOrderNo
(
lg
,
i
++);
}
return
ConstantUtils
.
SET_SUCCESS
;
}
}
src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.subsidy.dto.label.VodLabelPageDTO
;
import
com.subsidy.model.VodLabelDictDO
;
import
com.subsidy.mapper.VodLabelDictMapper
;
import
com.subsidy.service.VodLableDictService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* 视频库类目表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-07-19
*/
@Service
public
class
VodLabelDictServiceImpl
extends
ServiceImpl
<
VodLabelDictMapper
,
VodLabelDictDO
>
implements
VodLableDictService
{
@Override
public
IPage
<
VodLabelDictDO
>
queryVodLabelPage
(
VodLabelPageDTO
vodLabelPageDTO
)
{
Page
page
=
new
Page
(
vodLabelPageDTO
.
getPageNum
(),
vodLabelPageDTO
.
getPageSize
());
return
this
.
baseMapper
.
selectPage
(
page
,
new
QueryWrapper
<
VodLabelDictDO
>()
.
lambda
().
like
(
StringUtils
.
isNotBlank
(
vodLabelPageDTO
.
getLabelName
()),
VodLabelDictDO:
:
getLabelName
,
vodLabelPageDTO
.
getLabelName
()));
}
}
src/main/java/com/subsidy/util/VodUtil.java
0 → 100644
View file @
6747d4f
package
com
.
subsidy
.
util
;
import
com.subsidy.common.configure.VODConfig
;
import
com.subsidy.common.exception.HttpException
;
import
com.tencentcloudapi.common.Credential
;
import
com.tencentcloudapi.common.exception.TencentCloudSDKException
;
import
com.tencentcloudapi.common.profile.ClientProfile
;
import
com.tencentcloudapi.common.profile.HttpProfile
;
import
com.tencentcloudapi.cvm.v20170312.models.DescribeZonesResponse
;
import
com.tencentcloudapi.vod.v20180717.VodClient
;
import
com.tencentcloudapi.vod.v20180717.models.DeleteMediaRequest
;
import
com.tencentcloudapi.vod.v20180717.models.MediaProcessTaskInput
;
import
com.tencentcloudapi.vod.v20180717.models.ProcessMediaRequest
;
import
com.tencentcloudapi.vod.v20180717.models.ProcessMediaResponse
;
import
com.tencentcloudapi.vod.v20180717.models.TranscodeTaskInput
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
public
class
VodUtil
{
@Autowired
private
static
VODConfig
vodConfig
;
private
static
String
endpoint
=
"vod.tencentcloudapi.com"
;
/**
* 根据视频模版进行转码
* @param vodCode
* @return
*/
public
static
ProcessMediaResponse
processMedia
(
String
vodCode
)
{
try
{
//上传后直接转码
Credential
cred
=
new
Credential
(
vodConfig
.
getSecretId
(),
vodConfig
.
getSecretKey
());
HttpProfile
httpProfile
=
new
HttpProfile
();
httpProfile
.
setEndpoint
(
endpoint
);
ClientProfile
clientProfile
=
new
ClientProfile
();
clientProfile
.
setHttpProfile
(
httpProfile
);
VodClient
client
=
new
VodClient
(
cred
,
""
,
clientProfile
);
ProcessMediaRequest
processMediaRequest
=
new
ProcessMediaRequest
();
MediaProcessTaskInput
mediaProcessTaskInput1
=
new
MediaProcessTaskInput
();
TranscodeTaskInput
[]
transcodeTaskInputs1
=
new
TranscodeTaskInput
[
1
];
TranscodeTaskInput
transcodeTaskInput1
=
new
TranscodeTaskInput
();
transcodeTaskInput1
.
setDefinition
(
ConstantUtils
.
TEMPLATE_VOD
);
transcodeTaskInputs1
[
0
]
=
transcodeTaskInput1
;
mediaProcessTaskInput1
.
setTranscodeTaskSet
(
transcodeTaskInputs1
);
processMediaRequest
.
setMediaProcessTask
(
mediaProcessTaskInput1
);
processMediaRequest
.
setFileId
(
vodCode
);
return
client
.
ProcessMedia
(
processMediaRequest
);
}
catch
(
Exception
ex
)
{
throw
new
HttpException
(
50001
);
}
}
/**
* 删除腾讯云上原视频
* @param vodCode
*/
public
static
void
deleteMedia
(
String
vodCode
)
{
try
{
//删除原视频
Credential
cred
=
new
Credential
(
vodConfig
.
getSecretId
(),
vodConfig
.
getSecretKey
());
HttpProfile
httpProfile
=
new
HttpProfile
();
httpProfile
.
setEndpoint
(
endpoint
);
ClientProfile
clientProfile
=
new
ClientProfile
();
clientProfile
.
setHttpProfile
(
httpProfile
);
VodClient
client
=
new
VodClient
(
cred
,
""
,
clientProfile
);
// 实例化一个请求对象,每个接口都会对应一个request对象
DeleteMediaRequest
req
=
new
DeleteMediaRequest
();
req
.
setFileId
(
vodCode
);
// 返回的resp是一个DeleteMediaResponse的实例,与请求对象对应
client
.
DeleteMedia
(
req
);
}
catch
(
TencentCloudSDKException
e
)
{
}
}
}
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
View file @
6747d4f
package
com
.
subsidy
.
util
.
websocket
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.util.DateFormatUtil
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
...
...
@@ -11,8 +15,15 @@ import org.springframework.web.socket.TextMessage;
import
org.springframework.web.socket.WebSocketHandler
;
import
org.springframework.web.socket.WebSocketMessage
;
import
org.springframework.web.socket.WebSocketSession
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.concurrent.CopyOnWriteArraySet
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.ScheduledExecutorService
;
import
java.util.concurrent.ScheduledFuture
;
import
java.util.concurrent.TimeUnit
;
/**
* <p>
...
...
@@ -32,19 +43,52 @@ public class WebSocketUtil implements WebSocketHandler {
/**
* 存放建立连接webSocket对象
*/
private
static
CopyOnWriteArraySet
<
WebSocketSession
>
webSocketMap
=
new
CopyOnWriteArraySet
<>();
private
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
new
ConcurrentHashMap
();
ConcurrentHashMap
<
String
,
ScheduledFuture
>
taskMap
=
new
ConcurrentHashMap
<>(
1
);
/**
* 处理成功连接WebSocket
* @param session
*/
@Override
public
void
afterConnectionEstablished
(
WebSocketSession
session
)
{
public
void
afterConnectionEstablished
(
WebSocketSession
session
)
throws
IOException
{
if
(
null
!=
session
)
{
if
(
webSocketMap
.
contains
(
session
))
{
webSocketMap
.
remove
(
session
);
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
if
(
null
!=
webSocketMap
&&
webSocketMap
.
get
(
id
)
!=
null
)
{
if
(
webSocketMap
.
get
(
id
).
isOpen
())
{
/*
相同账户进行挤号,发送消息给前者WebSocket通知账户已在其他地方登录
*/
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
1011
))));
webSocketMap
.
get
(
id
).
close
();
}
else
{
/*
* 如果上次连接的WebSocket状态是关闭,并且上一次记录时间大于60秒的,则判断为这次登陆是免密码登陆的重新记录上线时间
*/
List
<
OprMemDictDO
>
list
=
oprMemDictMapper
.
selectList
(
new
QueryWrapper
<
OprMemDictDO
>()
.
lambda
()
.
eq
(
OprMemDictDO:
:
getUserId
,
id
)
.
orderByDesc
(
OprMemDictDO:
:
getCreateDate
));
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
DateFormatUtil
.
localDateTimeToDate
(
list
.
get
(
0
).
getCreateDate
()));
calendar
.
add
(
Calendar
.
SECOND
,
60
);
if
(
calendar
.
getTime
().
after
(
DateFormatUtil
.
localDateTimeToDate
(
list
.
get
(
0
).
getCreateDate
())))
{
if
(
list
.
get
(
0
).
getOprType
().
equals
(
"登出"
))
{
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getHostName
());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
webSocketMap
.
add
(
session
);
}
}
webSocketMap
.
remove
(
id
);
}
webSocketMap
.
put
(
id
,
session
);
String
httpSessionId
=
session
.
getId
();
String
host
=
session
.
getUri
().
getHost
();
...
...
@@ -67,7 +111,9 @@ public class WebSocketUtil implements WebSocketHandler {
session
.
close
();
}
webSocketMap
.
remove
(
session
);
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
webSocketMap
.
remove
(
id
);
log
.
error
(
"<---- webSocket transport error"
);
log
.
error
(
"error message: {}"
,
throwable
.
getMessage
());
}
...
...
@@ -79,21 +125,46 @@ public class WebSocketUtil implements WebSocketHandler {
* @throws Exception
*/
@Override
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
throws
Exception
{
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
throws
Exception
{
if
(
null
!=
session
)
{
webSocketMap
.
remove
(
session
);
/*
断开连接后不会马上判断为下线状态,而是进入60秒的心跳检测机制,如果60秒内没有进行重连,则判断为下线,记录下线时间和状态
*/
if
(
null
!=
webSocketMap
)
{
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
heartbeat
(
webSocketMap
.
get
(
id
));
}
log
.
info
(
"<---- webSocket is close"
);
log
.
info
(
"session {} close, status: {}"
,
session
.
getId
(),
closeStatus
);
}
}
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
/**
* 断开连接后60秒后进行判断是否重新连接了,如果没有连接成功则判断为下线
*
* @param session
*/
public
void
heartbeat
(
WebSocketSession
session
)
{
ScheduledExecutorService
service
=
Executors
.
newScheduledThreadPool
(
1
);
ScheduledFuture
scheduledFuture
=
service
.
scheduleAtFixedRate
(
new
Runnable
()
{
@SneakyThrows
@Override
public
void
run
()
{
if
(
null
!=
session
&&
!
session
.
isOpen
())
{
String
params
=
session
.
getUri
().
getQuery
();
String
[]
id
=
params
.
split
(
"="
);
oprMemDictDO
.
setUserId
(
Long
.
valueOf
(
id
[
1
]));
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登出"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getHostName
());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
System
.
out
.
println
(
"<---- webSocket is close"
);
log
.
info
(
"<---- webSocket is close"
);
log
.
info
(
"session {} close, status: {}"
,
session
.
getId
(),
closeStatus
);
taskMap
.
get
(
session
.
getId
()).
cancel
(
true
);
}
}
},
1
,
1
,
TimeUnit
.
MINUTES
);
taskMap
.
put
(
session
.
getId
(),
scheduledFuture
);
}
/**
...
...
src/main/java/com/subsidy/vo/token/CheckResultVO.java
View file @
6747d4f
...
...
@@ -11,7 +11,7 @@ public class CheckResultVO {
private
String
bizSeqNo
;
private
ResultVO
result
VO
;
private
ResultVO
result
;
private
String
transactionTime
;
...
...
src/main/java/com/subsidy/vo/token/SendResultVO.java
View file @
6747d4f
...
...
@@ -17,4 +17,14 @@ public class SendResultVO {
private
Boolean
success
;
private
String
wbAppId
;
private
String
nonce
;
private
Long
userId
;
private
String
sign
;
private
String
faceId
;
}
src/main/resources/code.properties
View file @
6747d4f
...
...
@@ -18,6 +18,7 @@ meishu.code-message[10022]=密码输入错误,您还可以输入2次密码
meishu.code-message[10023]=密码输入错误,您还可以输入3次密码
meishu.code-message[10024]=密码输入错误,您还可以输入4次密码
meishu.code-message[10025]=身份证识别错误
meishu.code-message[10026]=姓名或身份证号格式不正确
meishu.code-message[20001]=该课程已存在
...
...
src/main/resources/mapper/BusinessScopeDictMapper.xml
0 → 100644
View file @
6747d4f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.subsidy.mapper.BusinessScopeDictMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.subsidy.model.BusinessScopeDictDO"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"create_date"
property=
"createDate"
/>
<result
column=
"update_date"
property=
"updateDate"
/>
<result
column=
"delete_date"
property=
"deleteDate"
/>
<result
column=
"business_scope_name"
property=
"businessScopeName"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
create_date,
update_date,
delete_date,
id, business_scope_name
</sql>
</mapper>
src/main/resources/mapper/ClassDictMapper.xml
View file @
6747d4f
...
...
@@ -60,13 +60,15 @@
FROM
class_dict t
LEFT JOIN course_content t2 ON t.course_id = t2.course_id
LEFT JOIN vod_dict t3 ON t2.id = t3.content_id
LEFT JOIN content_vod_mapping t4 ON t4.content_id = t2.id
LEFT JOIN vod_dict t3 ON t3.id = t4.vod_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
and t3.id is not null
and t.id = #{classId}
AND t4.delete_date IS NULL
AND t3.id IS NOT NULL
AND t.id = #{classId}
</select>
<select
id=
"getSpareMembers"
parameterType=
"com.subsidy.dto.classDict.GetSpareMembersDTO"
...
...
src/main/resources/mapper/ContentVodMappingMapper.xml
0 → 100644
View file @
6747d4f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.subsidy.mapper.ContentVodMappingMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.subsidy.model.ContentVodMappingDO"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"create_date"
property=
"createDate"
/>
<result
column=
"update_date"
property=
"updateDate"
/>
<result
column=
"delete_date"
property=
"deleteDate"
/>
<result
column=
"content_id"
property=
"contentId"
/>
<result
column=
"vod_id"
property=
"vodId"
/>
<result
column=
"order_no"
property=
"orderNo"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
create_date,
update_date,
delete_date,
id, content_id, vod_id, order_no
</sql>
</mapper>
src/main/resources/mapper/CourseContentMapper.xml
View file @
6747d4f
...
...
@@ -66,6 +66,7 @@
t4.play_record
FROM
vod_dict t
LEFT JOIN content_vod_mapping cvm ON cvm.vod_id = t.id
LEFT JOIN (
SELECT
t.vod_id,
...
...
@@ -74,9 +75,9 @@
FROM
vod_play_history t
WHERE
t.delete_date
is null
and
t.member_id = #{memberId}
and
t.class_id = #{classId}
t.delete_date
IS NULL
AND
t.member_id = #{memberId}
AND
t.class_id = #{classId}
GROUP BY
t.vod_id,
t.member_id,
...
...
@@ -109,8 +110,9 @@
AND t.create_date = t2.create_date
) t4 ON t2.vod_id = t4.vod_id
WHERE
t.delete_date is null
and t.content_id = #{contentId}
t.delete_date IS NULL
AND cvm.delete_date IS NULL
and cvm.content_id = #{contentId}
) t3
ORDER BY
t3.order_no
...
...
src/main/resources/mapper/CourseDictMapper.xml
View file @
6747d4f
...
...
@@ -113,10 +113,12 @@
count( t2.id )
FROM
course_content t1
LEFT JOIN vod_dict t2 ON t1.id = t2.content_id
LEFT JOIN content_vod_mapping t3 ON t3.content_id = t1.id
LEFT JOIN vod_dict t2 ON t2.id = t3.vod_id
WHERE
t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t1.course_id = #{courseId}
</select>
...
...
@@ -125,10 +127,12 @@
sum( t2.vod_length )
FROM
course_content t1
LEFT JOIN vod_dict t2 ON t1.id = t2.content_id
LEFT JOIN content_vod_mapping t3 ON t3.content_id = t1.id
LEFT JOIN vod_dict t2 ON t2.id = t3.content_id
WHERE
t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t1.course_id = #{courseId}
</select>
...
...
src/main/resources/mapper/VodDictMapper.xml
View file @
6747d4f
...
...
@@ -8,7 +8,7 @@
<result
column=
"create_date"
property=
"createDate"
/>
<result
column=
"update_date"
property=
"updateDate"
/>
<result
column=
"delete_date"
property=
"deleteDate"
/>
<result
column=
"
content_id"
property=
"content
Id"
/>
<result
column=
"
label_id"
property=
"label
Id"
/>
<result
column=
"vod_name"
property=
"vodName"
/>
<result
column=
"vod_length"
property=
"vodLength"
/>
<result
column=
"vod_type"
property=
"vodType"
/>
...
...
@@ -22,13 +22,13 @@
create_date,
update_date,
delete_date,
id,
content
_id, vod_name, vod_length, vod_type, vod_size, vod_url, vod_code
id,
label
_id, vod_name, vod_length, vod_type, vod_size, vod_url, vod_code
</sql>
<select
id=
"getContendVods"
resultType=
"com.subsidy.vo.vod.GetContendVodsVO"
>
SELECT
t.id,
t.
content
_id,
t.
label
_id,
t.vod_name,
t.vod_length,
t.vod_type,
...
...
@@ -41,15 +41,17 @@
t.vod_code
FROM
vod_dict t
LEFT JOIN course_content t2 ON t.content_id = t2.id
LEFT JOIN content_vod_mapping t3 ON t3.vod_id = t.id
LEFT JOIN course_content t2 ON t3.content_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.content_id = #{contentId}
<if
test=
"vodName != null and vodName !=''"
>
and vod_name like concat('%',#{vodName} ,'%')
</if>
order by t
2.order_no,
t.order_no
order by t
3.order_no, t2.order_no,
t.order_no
</select>
<select
id=
"getCourseVods"
parameterType=
"long"
resultType=
"com.subsidy.model.VodDictDO"
>
...
...
@@ -59,16 +61,18 @@
t2.vod_length
FROM
course_content t
LEFT JOIN vod_dict t2 ON t.id = t2.content_id
LEFT JOIN content_vod_mapping t3 ON t3.content_id = t.id
LEFT JOIN vod_dict t2 ON t2.id = t3.vod_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t2.id is not null
AND t3.delete_date IS NULL
and t2.id IS NOT NULL
and t.course_id = #{courseId}
<if
test=
"vodName != null and vodName !=''"
>
and t2.vod_name like concat('%',#{vodName} ,'%')
</if>
order by t.id,t2.order_no
order by t.id,
t3.order_no,
t2.order_no
</select>
<select
id=
"classVodCompleteInfo"
resultType=
"com.subsidy.vo.vod.ClassVodCompleteInfoVO"
>
...
...
src/main/resources/mapper/VodLabelDictMapper.xml
0 → 100644
View file @
6747d4f
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.subsidy.mapper.VodLabelDictMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.subsidy.model.VodLabelDictDO"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"create_date"
property=
"createDate"
/>
<result
column=
"update_date"
property=
"updateDate"
/>
<result
column=
"delete_date"
property=
"deleteDate"
/>
<result
column=
"label_name"
property=
"labelName"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
create_date,
update_date,
delete_date,
id, label_name
</sql>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment