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 421d9309
authored
Sep 02, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人脸识别版本备个份
1 parent
6b16f6de
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
282 additions
and
137 deletions
src/main/java/com/subsidy/controller/ImageCheckRecordController.java
src/main/java/com/subsidy/dto/image/ImageCheckDTO.java
src/main/java/com/subsidy/mapper/ClassDictMapper.java
src/main/java/com/subsidy/mapper/ImageCheckRecordMapper.java
src/main/java/com/subsidy/mapper/MemberMapper.java
src/main/java/com/subsidy/mapper/OprMemDictMapper.java
src/main/java/com/subsidy/model/ImageCheckRecordDO.java
src/main/java/com/subsidy/model/OprMemDictDO.java
src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
src/main/java/com/subsidy/vo/classdict/SystemSettings.java
src/main/java/com/subsidy/vo/image/CheckImageResultVO.java
src/main/java/com/subsidy/vo/member/MyCoursesVO.java
src/main/java/com/subsidy/vo/paper/QueryPapersVO.java
src/main/resources/mapper/ClassDictMapper.xml
src/main/resources/mapper/ImageCheckRecordMapper.xml
src/main/resources/mapper/MemberMapper.xml
src/main/resources/mapper/OprMemDictMapper.xml
src/main/java/com/subsidy/controller/ImageCheckRecordController.java
View file @
421d930
...
@@ -43,14 +43,14 @@ public class ImageCheckRecordController {
...
@@ -43,14 +43,14 @@ public class ImageCheckRecordController {
}
}
@PostMapping
(
"imageCheck"
)
@PostMapping
(
"imageCheck"
)
@ApiOperation
(
"课程/测评人身核验(权威库:身份证) PC端 id 用户id classId 班级id "
)
@ApiOperation
(
"课程/测评人身核验(权威库:身份证) PC端 id 用户id classId 班级id
classPlace 1:视频的时候检测 2:测评的时候检测 paperId
"
)
@TimeRequired
@TimeRequired
public
ResponseVO
imageCheck
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
ResponseVO
imageCheck
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
imageCheck
(
imageCheckDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
imageCheck
(
imageCheckDTO
));
}
}
@PostMapping
(
"h5ImageCheck"
)
@PostMapping
(
"h5ImageCheck"
)
@ApiOperation
(
"课程/测评人脸核验(权威库:身份证) 微信浮层H5 id 用户id classId 班级id"
)
@ApiOperation
(
"课程/测评人脸核验(权威库:身份证) 微信浮层H5 id 用户id classId 班级id
classPlace 1:视频的时候检测 2:测评的时候检测 paperId
"
)
@TimeRequired
@TimeRequired
public
ResponseVO
h5CheckResult
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
ResponseVO
h5CheckResult
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
h5CheckResult
(
imageCheckDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
h5CheckResult
(
imageCheckDTO
));
...
@@ -64,7 +64,7 @@ public class ImageCheckRecordController {
...
@@ -64,7 +64,7 @@ public class ImageCheckRecordController {
}
}
@PostMapping
(
"h5LoginCheck"
)
@PostMapping
(
"h5LoginCheck"
)
@ApiOperation
(
"签到页做人脸核验 (权威库:身份证)
PC端
id 用户id"
)
@ApiOperation
(
"签到页做人脸核验 (权威库:身份证) id 用户id"
)
@TimeRequired
@TimeRequired
public
ResponseVO
h5LoginCheck
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
ResponseVO
h5LoginCheck
(
@RequestBody
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
h5LoginCheck
(
imageCheckDTO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
imageCheckRecordService
.
h5LoginCheck
(
imageCheckDTO
));
...
...
src/main/java/com/subsidy/dto/image/ImageCheckDTO.java
View file @
421d930
...
@@ -15,4 +15,14 @@ public class ImageCheckDTO {
...
@@ -15,4 +15,14 @@ public class ImageCheckDTO {
*/
*/
private
Long
classId
;
private
Long
classId
;
/**
* 试卷id
*/
private
Long
paperId
;
/**
* 1:视频的时候检测 2:测评的时候检测
*/
private
Integer
classPlace
;
}
}
src/main/java/com/subsidy/mapper/ClassDictMapper.java
View file @
421d930
...
@@ -5,10 +5,7 @@ import com.subsidy.dto.classDict.GetSpareMembersDTO;
...
@@ -5,10 +5,7 @@ import com.subsidy.dto.classDict.GetSpareMembersDTO;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.vo.classdict.ClassAndCompanyInfoVO
;
import
com.subsidy.vo.classdict.*
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.GetAllClassesVO
;
import
com.subsidy.vo.classdict.GetClassBaseInfoVO
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.data.repository.query.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -59,4 +56,9 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
...
@@ -59,4 +56,9 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
Integer
getClassCount
();
Integer
getClassCount
();
List
<
ClassSettingsVO
>
getClassSettings
(
@Param
(
"userId"
)
Long
userId
);
List
<
ClassSettingsVO
>
getClassSettings
(
@Param
(
"userId"
)
Long
userId
);
/**
* 通过班级id查看公司配置
*/
SystemSettings
getCompanySettings
(
Long
classId
);
}
}
src/main/java/com/subsidy/mapper/ImageCheckRecordMapper.java
View file @
421d930
...
@@ -24,4 +24,9 @@ public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
...
@@ -24,4 +24,9 @@ public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
*/
*/
List
<
GetMemberCheckDetailVO
>
getMemberCheckDetail
(
Long
memberId
,
Long
classId
);
List
<
GetMemberCheckDetailVO
>
getMemberCheckDetail
(
Long
memberId
,
Long
classId
);
/**
* 查看某个人某个课程当天做了几次人脸识别
*/
int
checkDailyCount
(
Long
memberId
,
Long
classId
,
Integer
checkPlace
,
Long
paperId
);
}
}
src/main/java/com/subsidy/mapper/MemberMapper.java
View file @
421d930
...
@@ -7,6 +7,7 @@ import com.subsidy.model.DepartmentDictDO;
...
@@ -7,6 +7,7 @@ import com.subsidy.model.DepartmentDictDO;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.vo.administer.ManageMemberVO
;
import
com.subsidy.vo.administer.ManageMemberVO
;
import
com.subsidy.vo.administer.UserRoleVO
;
import
com.subsidy.vo.administer.UserRoleVO
;
import
com.subsidy.vo.classdict.SystemSettings
;
import
com.subsidy.vo.member.GetAllVO
;
import
com.subsidy.vo.member.GetAllVO
;
import
com.subsidy.vo.member.MyCoursesVO
;
import
com.subsidy.vo.member.MyCoursesVO
;
import
com.subsidy.vo.member.StudyPageVO
;
import
com.subsidy.vo.member.StudyPageVO
;
...
@@ -76,5 +77,10 @@ public interface MemberMapper extends BaseMapper<MemberDO> {
...
@@ -76,5 +77,10 @@ public interface MemberMapper extends BaseMapper<MemberDO> {
*/
*/
void
removeCheckImage
(
Long
id
);
void
removeCheckImage
(
Long
id
);
/**
* 通过人员id查询公司配置
*/
SystemSettings
companySettings
(
Long
memberId
);
}
}
src/main/java/com/subsidy/mapper/OprMemDictMapper.java
View file @
421d930
...
@@ -23,4 +23,6 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
...
@@ -23,4 +23,6 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
List
<
OprMemDictDO
>
getRecordByDate
();
List
<
OprMemDictDO
>
getRecordByDate
();
OprMemDictDO
getLatestLoginInfo
(
Long
userId
);
}
}
src/main/java/com/subsidy/model/ImageCheckRecordDO.java
View file @
421d930
...
@@ -31,6 +31,11 @@ public class ImageCheckRecordDO extends BaseModel {
...
@@ -31,6 +31,11 @@ public class ImageCheckRecordDO extends BaseModel {
private
Long
classId
;
private
Long
classId
;
/**
/**
* 试卷id
*/
private
Long
paperId
;
/**
* 成员id
* 成员id
*/
*/
private
Long
memberId
;
private
Long
memberId
;
...
@@ -70,5 +75,15 @@ public class ImageCheckRecordDO extends BaseModel {
...
@@ -70,5 +75,15 @@ public class ImageCheckRecordDO extends BaseModel {
*/
*/
private
Integer
checkPlace
;
private
Integer
checkPlace
;
/**
* 1:视频的时候检测 2:测评的时候检测
*/
private
Integer
classPlace
;
/**
* 1 核对通过 0 核对不通过
*/
private
Integer
result
;
}
}
src/main/java/com/subsidy/model/OprMemDictDO.java
View file @
421d930
...
@@ -38,8 +38,8 @@ public class OprMemDictDO extends BaseModel {
...
@@ -38,8 +38,8 @@ public class OprMemDictDO extends BaseModel {
private
Integer
result
;
private
Integer
result
;
/**
/**
* 登录ip
* 登录ip
==弃用字段
*/
*/
private
String
ipAddress
;
//
private String ipAddress;
}
}
src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java
View file @
421d930
...
@@ -40,6 +40,7 @@ import com.subsidy.util.websocket.WebSocketUtil;
...
@@ -40,6 +40,7 @@ import com.subsidy.util.websocket.WebSocketUtil;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.GetAllClassesVO
;
import
com.subsidy.vo.classdict.GetAllClassesVO
;
import
com.subsidy.vo.classdict.GetClassBaseInfoVO
;
import
com.subsidy.vo.classdict.GetClassBaseInfoVO
;
import
com.subsidy.vo.classdict.SystemSettings
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -163,6 +164,9 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
...
@@ -163,6 +164,9 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
public
String
updateClass
(
ClassDictDO
classDictDO
)
{
public
String
updateClass
(
ClassDictDO
classDictDO
)
{
this
.
baseMapper
.
updateById
(
classDictDO
);
this
.
baseMapper
.
updateById
(
classDictDO
);
//班级所在公司
SystemSettings
systemSettings
=
this
.
baseMapper
.
getCompanySettings
(
classDictDO
.
getId
());
List
<
ClassMemberMappingDO
>
list
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
List
<
ClassMemberMappingDO
>
list
=
classMemberMappingMapper
.
selectList
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
.
lambda
()
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classDictDO
.
getId
()));
.
eq
(
ClassMemberMappingDO:
:
getClassId
,
classDictDO
.
getId
()));
...
@@ -171,8 +175,10 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
...
@@ -171,8 +175,10 @@ public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDict
WebSocketSession
webSocketSession
=
WebSocketUtil
.
webSocketMap
.
get
(
classMemberMappingDO
.
getMemberId
());
WebSocketSession
webSocketSession
=
WebSocketUtil
.
webSocketMap
.
get
(
classMemberMappingDO
.
getMemberId
());
if
(
null
!=
webSocketSession
&&
webSocketSession
.
isOpen
())
{
if
(
null
!=
webSocketSession
&&
webSocketSession
.
isOpen
())
{
try
{
try
{
//班级的配置
List
<
ClassSettingsVO
>
classSettings
=
this
.
baseMapper
.
getClassSettings
(
classMemberMappingDO
.
getMemberId
());
List
<
ClassSettingsVO
>
classSettings
=
this
.
baseMapper
.
getClassSettings
(
classMemberMappingDO
.
getMemberId
());
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
classSettings
),
SerializerFeature
.
WriteMapNullValue
);
systemSettings
.
setClassSettingsVOS
(
classSettings
);
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
systemSettings
),
SerializerFeature
.
WriteMapNullValue
);
webSocketSession
.
sendMessage
(
new
TextMessage
(
data
));
webSocketSession
.
sendMessage
(
new
TextMessage
(
data
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
View file @
421d930
...
@@ -39,6 +39,7 @@ import com.subsidy.util.VodUtil;
...
@@ -39,6 +39,7 @@ import com.subsidy.util.VodUtil;
import
com.subsidy.util.websocket.WebSocketUtil
;
import
com.subsidy.util.websocket.WebSocketUtil
;
import
com.subsidy.vo.administer.OperatorsVO
;
import
com.subsidy.vo.administer.OperatorsVO
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.SystemSettings
;
import
com.subsidy.vo.company.CDNStatDetailsVO
;
import
com.subsidy.vo.company.CDNStatDetailsVO
;
import
com.subsidy.vo.company.DataOverviewVO
;
import
com.subsidy.vo.company.DataOverviewVO
;
import
com.subsidy.vo.company.GetAllCompanyVO
;
import
com.subsidy.vo.company.GetAllCompanyVO
;
...
@@ -293,6 +294,10 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
...
@@ -293,6 +294,10 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
public
String
updateCompanySettings
(
CompanyDictDO
companyDictDO
)
{
public
String
updateCompanySettings
(
CompanyDictDO
companyDictDO
)
{
this
.
baseMapper
.
updateById
(
companyDictDO
);
this
.
baseMapper
.
updateById
(
companyDictDO
);
CompanyDictDO
companyDictDO1
=
this
.
baseMapper
.
selectById
(
companyDictDO
.
getId
());
SystemSettings
systemSettings
=
new
SystemSettings
();
BeanUtils
.
copyProperties
(
companyDictDO1
,
systemSettings
);
List
<
ClassMemberMappingDO
>
list
=
classMemberMappingMapper
.
getCLassMemberByCompanyId
(
companyDictDO
.
getId
());
List
<
ClassMemberMappingDO
>
list
=
classMemberMappingMapper
.
getCLassMemberByCompanyId
(
companyDictDO
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
ClassMemberMappingDO
classMemberMappingDO
:
list
)
{
for
(
ClassMemberMappingDO
classMemberMappingDO
:
list
)
{
...
@@ -300,7 +305,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
...
@@ -300,7 +305,8 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
if
(
null
!=
webSocketSession
&&
webSocketSession
.
isOpen
())
{
if
(
null
!=
webSocketSession
&&
webSocketSession
.
isOpen
())
{
try
{
try
{
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
classMemberMappingDO
.
getMemberId
());
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
classMemberMappingDO
.
getMemberId
());
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
classSettings
),
SerializerFeature
.
WriteMapNullValue
);
systemSettings
.
setClassSettingsVOS
(
classSettings
);
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
systemSettings
),
SerializerFeature
.
WriteMapNullValue
);
webSocketSession
.
sendMessage
(
new
TextMessage
(
data
));
webSocketSession
.
sendMessage
(
new
TextMessage
(
data
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
View file @
421d930
...
@@ -14,9 +14,7 @@ import com.subsidy.model.AccessTokenDO;
...
@@ -14,9 +14,7 @@ import com.subsidy.model.AccessTokenDO;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.service.ImageCheckRecordService
;
import
com.subsidy.service.ImageCheckRecordService
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.vo.image.CheckImageResultVO
;
import
com.subsidy.vo.token.*
;
import
com.subsidy.vo.token.*
;
import
org.apache.commons.codec.Charsets
;
import
org.apache.commons.codec.Charsets
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -24,15 +22,11 @@ import org.springframework.beans.BeanUtils;
...
@@ -24,15 +22,11 @@ import org.springframework.beans.BeanUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.*
;
import
org.springframework.http.*
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
sun.misc.BASE64Decoder
;
import
sun.security.krb5.internal.crypto.Nonce
;
//import org.apache.commons.codec.binary.Base64;
import
java.io.*
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
//import org.apache.commons.codec.binary.Base64
;
/**
/**
* <p>
* <p>
...
@@ -72,19 +66,19 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -72,19 +66,19 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
}
}
public
SendIdCardInfoVO
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
SendIdCardInfoVO
imageCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
PCCheckIdCard
(
imageCheckDTO
.
getId
(),
imageCheckDTO
.
getClassId
(),
0
);
return
PCCheckIdCard
(
imageCheckDTO
.
getId
(),
imageCheckDTO
.
getClassId
(),
0
,
imageCheckDTO
.
getClassPlace
(),
imageCheckDTO
.
getPaperId
()
);
}
}
public
SendIdCardInfoVO
h5CheckResult
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
SendIdCardInfoVO
h5CheckResult
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
H5IdCheckCard
(
imageCheckDTO
.
getId
(),
imageCheckDTO
.
getClassId
(),
0
);
return
H5IdCheckCard
(
imageCheckDTO
.
getId
(),
imageCheckDTO
.
getClassId
(),
0
,
imageCheckDTO
.
getClassPlace
(),
imageCheckDTO
.
getPaperId
()
);
}
}
public
SendIdCardInfoVO
loginCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
SendIdCardInfoVO
loginCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
PCCheckIdCard
(
imageCheckDTO
.
getId
(),
null
,
1
);
return
PCCheckIdCard
(
imageCheckDTO
.
getId
(),
null
,
1
,
null
,
null
);
}
}
public
SendIdCardInfoVO
h5LoginCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
public
SendIdCardInfoVO
h5LoginCheck
(
ImageCheckDTO
imageCheckDTO
)
throws
Exception
{
return
H5IdCheckCard
(
imageCheckDTO
.
getId
(),
imageCheckDTO
.
getClassId
(),
1
);
return
H5IdCheckCard
(
imageCheckDTO
.
getId
(),
null
,
1
,
null
,
null
);
}
}
/**
/**
...
@@ -104,7 +98,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -104,7 +98,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
* H5端调取权威库(身份证)验证 权威库
* H5端调取权威库(身份证)验证 权威库
* 1,签到页 0 班级内
* 1,签到页 0 班级内
*/
*/
public
SendIdCardInfoVO
H5IdCheckCard
(
Long
id
,
Long
classId
,
Integer
checkPlace
)
{
public
SendIdCardInfoVO
H5IdCheckCard
(
Long
id
,
Long
classId
,
Integer
checkPlace
,
Integer
classPlace
,
Long
paperId
)
{
getDailyCheckCnt
(
id
);
getDailyCheckCnt
(
id
);
//获取这个学生的基本信息
//获取这个学生的基本信息
MemberDO
memberDO
=
memberMapper
.
selectById
(
id
);
MemberDO
memberDO
=
memberMapper
.
selectById
(
id
);
...
@@ -119,6 +113,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -119,6 +113,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setClassId
(
classId
);
imageCheckRecordDO
.
setClassId
(
classId
);
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setPaperId
(
paperId
);
imageCheckRecordDO
.
setClassPlace
(
classPlace
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
//获取signTicket
//获取signTicket
...
@@ -169,7 +165,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -169,7 +165,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
* PC端调取权威库(身份证)验证 权威库
* PC端调取权威库(身份证)验证 权威库
* 1,签到页 0 班级内
* 1,签到页 0 班级内
*/
*/
public
SendIdCardInfoVO
PCCheckIdCard
(
Long
id
,
Long
classId
,
Integer
checkPlace
)
{
public
SendIdCardInfoVO
PCCheckIdCard
(
Long
id
,
Long
classId
,
Integer
checkPlace
,
Integer
classPlace
,
Long
paperId
)
{
getDailyCheckCnt
(
id
);
getDailyCheckCnt
(
id
);
//获取这个学生的基本信息
//获取这个学生的基本信息
...
@@ -184,6 +180,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -184,6 +180,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setClassId
(
classId
);
imageCheckRecordDO
.
setClassId
(
classId
);
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordDO
.
setCheckType
(
1
);
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setPaperId
(
paperId
);
imageCheckRecordDO
.
setClassPlace
(
classPlace
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
//获取signTicket
//获取signTicket
...
@@ -210,8 +208,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -210,8 +208,8 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//获取 NONCE ticket
//获取 NONCE ticket
IdCardTicketsVO
nonceTicket
=
this
.
nonceTicket
(
getLatestAccessToken
(),
memberDO
.
getId
()
+
""
);
IdCardTicketsVO
nonceTicket
=
this
.
nonceTicket
(
getLatestAccessToken
(),
memberDO
.
getId
()
+
""
);
//签名2
//签名2
faceId ===>H5FaceId
List
<
String
>
signList2
=
new
ArrayList
(
Arrays
.
asList
(
WBAPPID
,
memberDO
.
getId
()
+
""
,
NONCE
,
"1.0.0"
,
sendIdCardInfoVO
.
getResult
().
get
F
aceId
(),
sendIdCardInfoVO
.
getResult
().
getOrderNo
()));
List
<
String
>
signList2
=
new
ArrayList
(
Arrays
.
asList
(
WBAPPID
,
memberDO
.
getId
()
+
""
,
NONCE
,
"1.0.0"
,
sendIdCardInfoVO
.
getResult
().
get
H5f
aceId
(),
sendIdCardInfoVO
.
getResult
().
getOrderNo
()));
String
sign2
=
sign
(
signList2
,
nonceTicket
.
getValue
());
String
sign2
=
sign
(
signList2
,
nonceTicket
.
getValue
());
sendIdCardInfoVO
.
getResult
().
setWbAppId
(
WBAPPID
);
sendIdCardInfoVO
.
getResult
().
setWbAppId
(
WBAPPID
);
...
@@ -223,7 +221,6 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -223,7 +221,6 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
public
ImageCheckRecordDO
checkResult
(
CheckResultDTO
checkResultDTO
)
throws
Exception
{
public
ImageCheckRecordDO
checkResult
(
CheckResultDTO
checkResultDTO
)
throws
Exception
{
CheckImageResultVO
checkImageResultVO
=
new
CheckImageResultVO
();
//获取signTicket
//获取signTicket
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
getLatestAccessToken
());
IdCardTicketsVO
idCardTicketsVO
=
this
.
signTickets
(
getLatestAccessToken
());
...
@@ -242,21 +239,26 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
...
@@ -242,21 +239,26 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//存数据库
//存数据库
ImageCheckRecordDO
imageCheckRecordDO
=
imageCheckRecordMapper
.
selectById
(
checkResultDTO
.
getId
());
ImageCheckRecordDO
imageCheckRecordDO
=
imageCheckRecordMapper
.
selectById
(
checkResultDTO
.
getId
());
BeanUtils
.
copyProperties
(
resultVO
,
imageCheckRecordDO
);
BeanUtils
.
copyProperties
(
resultVO
,
imageCheckRecordDO
);
imageCheckRecordMapper
.
updateById
(
imageCheckRecordDO
);
BeanUtils
.
copyProperties
(
imageCheckRecordDO
,
checkImageResultVO
);
try
{
if
((
Double
.
valueOf
(
imageCheckRecordDO
.
getSimilarity
())
>
60
))
{
imageCheckRecordDO
.
setResult
(
1
);
//如果是签到页的认证,则把图片写到member表里
//如果是签到页的认证,则把图片写到member表里
if
(
imageCheckRecordDO
.
getCheckPlace
()==
1
){
MemberDO
memberDO
=
memberMapper
.
selectById
(
imageCheckRecordDO
.
getMemberId
());
MemberDO
memberDO
=
memberMapper
.
selectById
(
imageCheckRecordDO
.
getMemberId
());
memberDO
.
setImage
(
checkImageResultV
O
.
getPhoto
());
memberDO
.
setCheckImage
(
imageCheckRecordD
O
.
getPhoto
());
memberDO
.
setCheckTime
(
DateFormatUtil
.
format
(
new
Date
(),
DateFormatUtil
.
FMT_sdf14_L
));
memberDO
.
setCheckTime
(
DateFormatUtil
.
format
(
new
Date
(),
DateFormatUtil
.
FMT_sdf14_L
));
memberMapper
.
updateById
(
memberDO
);
memberMapper
.
updateById
(
memberDO
);
}
if
((
Double
.
valueOf
(
imageCheckRecordDO
.
getSimilarity
())
>
60
))
{
checkImageResultVO
.
setResult
(
true
);
}
else
{
}
else
{
checkImageResultVO
.
setResult
(
false
);
imageCheckRecordDO
.
setResult
(
0
);
}
}
catch
(
Exception
e
){
imageCheckRecordDO
.
setResult
(
0
);
}
}
imageCheckRecordMapper
.
updateById
(
imageCheckRecordDO
);
return
imageCheckRecordDO
;
return
imageCheckRecordDO
;
}
}
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
421d930
...
@@ -9,42 +9,8 @@ import com.subsidy.common.configure.QXueYouConfig;
...
@@ -9,42 +9,8 @@ import com.subsidy.common.configure.QXueYouConfig;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.dto.administer.VerifyCodeDTO
;
import
com.subsidy.dto.administer.VerifyCodeDTO
;
import
com.subsidy.dto.member.*
;
import
com.subsidy.dto.member.*
;
import
com.subsidy.mapper.ClassDictMapper
;
import
com.subsidy.mapper.*
;
import
com.subsidy.mapper.ClassHourDictMapper
;
import
com.subsidy.model.*
;
import
com.subsidy.mapper.ClassMemberMappingMapper
;
import
com.subsidy.mapper.CompanyDictMapper
;
import
com.subsidy.mapper.CourseContentMapper
;
import
com.subsidy.mapper.CourseFieldMappingMapper
;
import
com.subsidy.mapper.DepartmentDictMapper
;
import
com.subsidy.mapper.ExerciseDoneResultMapper
;
import
com.subsidy.mapper.FileDictMapper
;
import
com.subsidy.mapper.JobDictMapper
;
import
com.subsidy.mapper.JobMemberMappingMapper
;
import
com.subsidy.mapper.MemberDepartmentMappingMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.mapper.PaperDictMapper
;
import
com.subsidy.mapper.RotationImgDictMapper
;
import
com.subsidy.mapper.SmsVerifyCodeMapper
;
import
com.subsidy.mapper.VodDictMapper
;
import
com.subsidy.mapper.VodPlayHistoryMapper
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.ClassHourDictDO
;
import
com.subsidy.model.ClassMemberMappingDO
;
import
com.subsidy.model.CompanyDictDO
;
import
com.subsidy.model.CourseContentDO
;
import
com.subsidy.model.DepartmentDictDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.FieldDictDO
;
import
com.subsidy.model.FileDictDO
;
import
com.subsidy.model.JobDictDO
;
import
com.subsidy.model.JobMemberMappingDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberDepartmentMappingDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.model.RotationImgDictDO
;
import
com.subsidy.model.SmsVerifyCodeDO
;
import
com.subsidy.model.VodDictDO
;
import
com.subsidy.service.MemberService
;
import
com.subsidy.service.MemberService
;
import
com.subsidy.util.*
;
import
com.subsidy.util.*
;
//import com.subsidy.util.RedisUtil;
//import com.subsidy.util.RedisUtil;
...
@@ -135,7 +101,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
...
@@ -135,7 +101,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
private
RotationImgDictMapper
rotationImgDictMapper
;
private
RotationImgDictMapper
rotationImgDictMapper
;
@Autowired
@Autowired
private
VodDictMapper
vodDict
Mapper
;
private
ImageCheckRecordMapper
imageCheckRecord
Mapper
;
@Autowired
@Autowired
private
SmsVerifyCodeMapper
smsVerifyCodeMapper
;
private
SmsVerifyCodeMapper
smsVerifyCodeMapper
;
...
@@ -719,6 +685,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
...
@@ -719,6 +685,21 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
for
(
MyCoursesVO
myCoursesVO
:
myCoursesVOS
)
{
for
(
MyCoursesVO
myCoursesVO
:
myCoursesVOS
)
{
List
<
FieldDictDO
>
fieldDictDOS
=
courseFieldMappingMapper
.
courseFields
(
myCoursesVO
.
getCourseId
());
List
<
FieldDictDO
>
fieldDictDOS
=
courseFieldMappingMapper
.
courseFields
(
myCoursesVO
.
getCourseId
());
myCoursesVO
.
setFieldDictDOS
(
fieldDictDOS
);
myCoursesVO
.
setFieldDictDOS
(
fieldDictDOS
);
int
count
=
imageCheckRecordMapper
.
selectCount
(
new
QueryWrapper
<
ImageCheckRecordDO
>()
.
lambda
()
.
eq
(
ImageCheckRecordDO:
:
getMemberId
,
myCoursesDTO
.
getMemberId
())
.
eq
(
ImageCheckRecordDO:
:
getClassId
,
myCoursesVO
.
getClassId
())
.
eq
(
ImageCheckRecordDO:
:
getCheckPlace
,
1
)
.
eq
(
ImageCheckRecordDO:
:
getResult
,
1
));
int
checkCnt
=
imageCheckRecordMapper
.
checkDailyCount
(
myCoursesDTO
.
getMemberId
(),
myCoursesVO
.
getClassId
(),
1
,
null
);
myCoursesVO
.
setCheckCnt
(
checkCnt
);
if
(
count
>
0
)
{
myCoursesVO
.
setResult
(
1
);
}
else
{
myCoursesVO
.
setResult
(
0
);
}
}
}
return
myCoursesVOS
;
return
myCoursesVOS
;
}
}
...
@@ -855,6 +836,23 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
...
@@ -855,6 +836,23 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
}
else
{
}
else
{
queryPapersVO
.
setResult
(
"待完成"
);
queryPapersVO
.
setResult
(
"待完成"
);
}
}
int
count
=
imageCheckRecordMapper
.
selectCount
(
new
QueryWrapper
<
ImageCheckRecordDO
>()
.
lambda
()
.
eq
(
ImageCheckRecordDO:
:
getMemberId
,
contentMemberDTO
.
getMemberId
())
.
eq
(
ImageCheckRecordDO:
:
getClassId
,
contentMemberDTO
.
getClassId
())
.
eq
(
ImageCheckRecordDO:
:
getPaperId
,
queryPapersVO
.
getId
())
.
eq
(
ImageCheckRecordDO:
:
getClassPlace
,
2
)
.
eq
(
ImageCheckRecordDO:
:
getResult
,
1
));
int
checkCnt
=
imageCheckRecordMapper
.
checkDailyCount
(
contentMemberDTO
.
getMemberId
(),
contentMemberDTO
.
getClassId
(),
2
,
queryPapersVO
.
getId
());
queryPapersVO
.
setCheckCnt
(
checkCnt
);
if
(
count
>
0
)
{
queryPapersVO
.
setCheckResult
(
1
);
}
else
{
queryPapersVO
.
setCheckResult
(
0
);
}
//截止时间
//截止时间
queryPapersVO
.
setEndDate
(
classDictDO
.
getEndDate
());
queryPapersVO
.
setEndDate
(
classDictDO
.
getEndDate
());
}
}
...
...
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
View file @
421d930
...
@@ -5,10 +5,16 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
...
@@ -5,10 +5,16 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.mapper.ClassDictMapper
;
import
com.subsidy.mapper.ClassDictMapper
;
import
com.subsidy.mapper.CompanyDictMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.model.CompanyDictDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.ClassSettingsVO
;
import
com.subsidy.vo.classdict.SystemSettings
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
@@ -19,6 +25,7 @@ import org.springframework.web.socket.TextMessage;
...
@@ -19,6 +25,7 @@ import org.springframework.web.socket.TextMessage;
import
org.springframework.web.socket.WebSocketHandler
;
import
org.springframework.web.socket.WebSocketHandler
;
import
org.springframework.web.socket.WebSocketMessage
;
import
org.springframework.web.socket.WebSocketMessage
;
import
org.springframework.web.socket.WebSocketSession
;
import
org.springframework.web.socket.WebSocketSession
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -47,12 +54,15 @@ public class WebSocketUtil implements WebSocketHandler {
...
@@ -47,12 +54,15 @@ public class WebSocketUtil implements WebSocketHandler {
@Autowired
@Autowired
private
ClassDictMapper
classDictMapper
;
private
ClassDictMapper
classDictMapper
;
@Autowired
private
MemberMapper
memberMapper
;
private
int
heartbeatMin
=
1
;
// 断连最小心跳次数
private
int
heartbeatMin
=
1
;
// 断连最小心跳次数
private
int
heartbeatMax
=
2
;
// 断连最大心跳次数
private
int
heartbeatMax
=
2
;
// 断连最大心跳次数
private
int
reconnectionSeconds
=
60
;
//每次断连间隔重新连接秒
private
int
reconnectionSeconds
=
60
;
//每次断连间隔重新连接秒
/**
/**
* 存放建立连接webSocket对象
* 存放建立连接webSocket对象
Map<memberId,session>
*/
*/
public
static
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
new
ConcurrentHashMap
();
public
static
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
new
ConcurrentHashMap
();
...
@@ -60,124 +70,117 @@ public class WebSocketUtil implements WebSocketHandler {
...
@@ -60,124 +70,117 @@ public class WebSocketUtil implements WebSocketHandler {
/**
/**
* 处理成功连接WebSocket 建立直接后调用
* 处理成功连接WebSocket 建立直接后调用
* @param session
*/
*/
@Override
@Override
public
void
afterConnectionEstablished
(
WebSocketSession
session
)
throws
IOException
{
public
void
afterConnectionEstablished
(
WebSocketSession
session
)
throws
IOException
{
if
(
null
!=
session
)
{
if
(
null
!=
session
)
{
String
params
=
session
.
getUri
().
getQuery
();
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
if
(
null
!=
webSocketMap
&&
webSocketMap
.
get
(
id
)
!=
null
)
{
if
(
webSocketMap
.
get
(
id
).
isOpen
())
{
//webSocketMap的操作
if
(
null
!=
webSocketMap
&&
webSocketMap
.
get
(
id
)
!=
null
)
{
if
(
webSocketMap
.
get
(
id
).
isOpen
())
{
/* 相同账户进行挤号,发送消息给WebSocket通知账户已在其他地方登录 */
/* 相同账户进行挤号,发送消息给WebSocket通知账户已在其他地方登录 */
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
1011
))));
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
1011
))));
webSocketMap
.
get
(
id
).
close
();
webSocketMap
.
get
(
id
).
close
();
}
else
{
}
else
{
/*
/*
*
如果
上次连接的WebSocket状态是关闭,
* 上次连接的WebSocket状态是关闭,
* 并且上一次记录时间大于 { heartbeatMax * reconnectionSeconds } 秒(心跳检测机制),则判断为这次登陆是免密码登陆的重新记录上线时间
* 并且上一次记录时间大于 { heartbeatMax * reconnectionSeconds } 秒(心跳检测机制),则判断为这次登陆是免密码登陆的重新记录上线时间
*/
*/
List
<
OprMemDictDO
>
list
=
oprMemDictMapper
.
selectList
(
new
QueryWrapper
<
OprMemDictDO
>()
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
id
);
//最近一次登录
.
lambda
()
.
eq
(
OprMemDictDO:
:
getUserId
,
id
)
// Calendar calendar = Calendar.getInstance();
.
orderByDesc
(
OprMemDictDO:
:
getCreateDate
));
// calendar.setTime(DateFormatUtil.localDateTimeToDate(oprMemDictDO.getCreateDate()));
// calendar.add(Calendar.SECOND,heartbeatMax * reconnectionSeconds); //当前时间+最大链接次数,判定为超时
Calendar
calendar
=
Calendar
.
getInstance
();
// if(calendar.getTime().after(DateFormatUtil.localDateTimeToDate(oprMemDictDO.getCreateDate()))) {
calendar
.
setTime
(
DateFormatUtil
.
localDateTimeToDate
(
list
.
get
(
0
).
getCreateDate
()));
if
(
oprMemDictDO
.
getOprType
().
equals
(
"登出"
))
{
calendar
.
add
(
Calendar
.
SECOND
,
heartbeatMax
*
reconnectionSeconds
);
//登出过的话就写记录,否则不写
if
(
calendar
.
getTime
().
after
(
DateFormatUtil
.
localDateTimeToDate
(
list
.
get
(
0
).
getCreateDate
())))
{
if
(
list
.
get
(
0
).
getOprType
().
equals
(
"登出"
))
{
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getHostName
());
//
oprMemDictDO.setIpAddress(session.getRemoteAddress().getHostName());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
oprMemDictMapper
.
insert
(
oprMemDictDO
);
}
}
}
//
}
}
}
webSocketMap
.
remove
(
id
);
webSocketMap
.
remove
(
id
);
}
}
webSocketMap
.
put
(
id
,
session
);
webSocketMap
.
put
(
id
,
session
);
/* 班级配置信息 */
//查人的班级
// 数据操作
SystemSettings
systemSettings
=
memberMapper
.
companySettings
(
id
);
//公司配置
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
id
);
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
id
);
if
(
CollectionUtils
.
isNotEmpty
(
classSettings
))
{
systemSettings
.
setClassSettingsVOS
(
classSettings
);
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
classSettings
),
SerializerFeature
.
WriteMapNullValue
);
if
(
CollectionUtils
.
isNotEmpty
(
classSettings
))
{
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
systemSettings
),
SerializerFeature
.
WriteMapNullValue
);
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
data
));
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
data
));
}
}
String
httpSessionId
=
session
.
getId
();
//
String httpSessionId = session.getId();
String
host
=
session
.
getUri
().
getHost
();
//
String host = session.getUri().getHost();
String
query
=
session
.
getUri
().
getQuery
();
//
String query = session.getUri().getQuery();
log
.
info
(
"----> webSocket connection success"
);
//
log.info("----> webSocket connection success");
log
.
info
(
"parameter:[ httpSessionId: {}, host: {}, {} ]"
,
httpSessionId
,
host
,
query
);
//
log.info("parameter:[ httpSessionId: {}, host: {}, {} ]", httpSessionId, host, query);
log
.
info
(
"connection time: {}"
,
DateFormatUtil
.
format
(
new
Date
(),
DateFormatUtil
.
FMT_sdf14_L
));
//
log.info("connection time: {}", DateFormatUtil.format(new Date(), DateFormatUtil.FMT_sdf14_L));
}
}
}
}
/**
/**
* 处理WebSocket transport error
* 处理WebSocket transport error
* @param session
* @param throwable
* @throws Exception
*/
*/
@Override
@Override
public
void
handleTransportError
(
WebSocketSession
session
,
Throwable
throwable
)
throws
Exception
{
public
void
handleTransportError
(
WebSocketSession
session
,
Throwable
throwable
)
throws
Exception
{
if
(
session
.
isOpen
())
{
if
(
session
.
isOpen
())
{
session
.
close
();
session
.
close
();
}
}
String
params
=
session
.
getUri
().
getQuery
();
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
webSocketMap
.
remove
(
id
);
webSocketMap
.
remove
(
id
);
log
.
error
(
"<---- webSocket transport error"
);
//
log.error("<---- webSocket transport error");
log
.
error
(
"error message: {}"
,
throwable
.
getMessage
());
//
log.error("error message: {}", throwable.getMessage());
}
}
/**
/**
* 在两端WebSocket connection都关闭或transport error发生后执行
* 在两端WebSocket connection都关闭或transport error发生后执行
* @param session
* @param closeStatus
* @throws Exception
*/
*/
@Override
@Override
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
throws
Exception
{
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
throws
Exception
{
if
(
null
!=
session
)
{
if
(
null
!=
session
)
{
if
(
null
!=
webSocketMap
)
{
if
(
null
!=
webSocketMap
)
{
String
params
=
session
.
getUri
().
getQuery
();
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
heartbeat
(
webSocketMap
.
get
(
id
));
heartbeat
(
webSocketMap
.
get
(
id
));
}
}
log
.
info
(
"<---- webSocket is close"
);
//
log.info("<---- webSocket is close");
log
.
info
(
"session {} close, status: {}"
,
session
.
getId
(),
closeStatus
);
//
log.info("session {} close, status: {}", session.getId(), closeStatus);
}
}
}
}
/**
/**
* 断开连接后进行三次心跳验证判断是否重新连接了,如果没有连接成功则判断为下线
* 断开连接后进行三次心跳验证判断是否重新连接了,如果没有连接成功则判断为下线
*
* @param session
*/
*/
public
void
heartbeat
(
WebSocketSession
session
)
{
public
void
heartbeat
(
WebSocketSession
session
)
{
ScheduledExecutorService
service
=
Executors
.
newScheduledThreadPool
(
1
);
ScheduledExecutorService
service
=
Executors
.
newScheduledThreadPool
(
1
);
ScheduledFuture
scheduledFuture
=
service
.
scheduleAtFixedRate
(
new
Runnable
()
{
ScheduledFuture
scheduledFuture
=
service
.
scheduleAtFixedRate
(
new
Runnable
()
{
int
beatsNum
=
heartbeatMin
;
int
beatsNum
=
heartbeatMin
;
@SneakyThrows
@SneakyThrows
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
null
!=
session
&&
!
session
.
isOpen
())
{
if
(
null
!=
session
&&
!
session
.
isOpen
())
{
while
(
beatsNum
>
heartbeatMax
)
{
if
(
beatsNum
>
heartbeatMax
)
{
//heartbeatMa:2
String
params
=
session
.
getUri
().
getQuery
();
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登出"
);
oprMemDictDO
.
setOprType
(
"登出"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getHostName
());
//
oprMemDictDO.setIpAddress(session.getRemoteAddress().getHostName());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
oprMemDictMapper
.
insert
(
oprMemDictDO
);
taskMap
.
get
(
session
.
getId
()).
cancel
(
true
);
taskMap
.
get
(
session
.
getId
()).
cancel
(
true
);
// break;
}
}
beatsNum
++;
beatsNum
++;
}
else
if
(
null
!=
session
&&
session
.
isOpen
())
{
}
else
if
(
null
!=
session
&&
session
.
isOpen
())
{
...
@@ -191,14 +194,11 @@ public class WebSocketUtil implements WebSocketHandler {
...
@@ -191,14 +194,11 @@ public class WebSocketUtil implements WebSocketHandler {
/**
/**
* 接收WebSocket客户端Message
* 接收WebSocket客户端Message
* @param session
* @param message
* @throws Exception
*/
*/
@Override
@Override
public
void
handleMessage
(
WebSocketSession
session
,
WebSocketMessage
<?>
message
)
throws
Exception
{
public
void
handleMessage
(
WebSocketSession
session
,
WebSocketMessage
<?>
message
)
throws
Exception
{
if
(
message
instanceof
TextMessage
)
{
if
(
message
instanceof
TextMessage
)
{
System
.
out
.
println
(
message
.
getPayload
());
//
System.out.println(message.getPayload());
}
}
}
}
...
...
src/main/java/com/subsidy/vo/classdict/SystemSettings.java
0 → 100644
View file @
421d930
package
com
.
subsidy
.
vo
.
classdict
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SystemSettings
{
/**
* 上课时间不晚于23:30,不早于6:30
*/
private
Integer
timeLimit
;
/**
* 签到时记录IP地址
*/
private
Integer
ipAddressRecord
;
/**
* 签到时记录设备型号
*/
private
Integer
deviceNoRecord
;
/**
* 班级配置
*/
private
List
<
ClassSettingsVO
>
classSettingsVOS
;
}
src/main/java/com/subsidy/vo/image/CheckImageResultVO.java
deleted
100644 → 0
View file @
6b16f6d
package
com
.
subsidy
.
vo
.
image
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
lombok.Data
;
@Data
public
class
CheckImageResultVO
extends
ImageCheckRecordDO
{
private
Boolean
result
;
}
src/main/java/com/subsidy/vo/member/MyCoursesVO.java
View file @
421d930
...
@@ -32,5 +32,9 @@ public class MyCoursesVO {
...
@@ -32,5 +32,9 @@ public class MyCoursesVO {
private
Integer
isFastPlay
;
private
Integer
isFastPlay
;
private
Integer
result
;
private
Integer
checkCnt
;
private
List
<
FieldDictDO
>
fieldDictDOS
;
private
List
<
FieldDictDO
>
fieldDictDOS
;
}
}
src/main/java/com/subsidy/vo/paper/QueryPapersVO.java
View file @
421d930
...
@@ -21,4 +21,8 @@ public class QueryPapersVO {
...
@@ -21,4 +21,8 @@ public class QueryPapersVO {
private
String
endDate
;
private
String
endDate
;
private
Integer
checkCnt
;
private
Integer
checkResult
;
}
}
src/main/resources/mapper/ClassDictMapper.xml
View file @
421d930
...
@@ -197,4 +197,19 @@
...
@@ -197,4 +197,19 @@
AND t2.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t3.delete_date IS NULL
</select>
</select>
<select
id=
"getCompanySettings"
parameterType=
"long"
resultType=
"com.subsidy.vo.classdict.SystemSettings"
>
SELECT
t2.time_limit,
t2.ip_address_record,
t2.device_no_record
FROM
class_dict t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.id = #{classId}
</select>
</mapper>
</mapper>
src/main/resources/mapper/ImageCheckRecordMapper.xml
View file @
421d930
...
@@ -33,4 +33,26 @@
...
@@ -33,4 +33,26 @@
AND t.member_id = #{memberId}
AND t.member_id = #{memberId}
</select>
</select>
<select
id=
"checkDailyCount"
resultType=
"int"
>
SELECT
count(1)
FROM
image_check_record t
WHERE
t.delete_date IS NULL
<if
test=
"memberId != null and memberId != ''"
>
AND t.member_id = #{memberId}
</if>
<if
test=
"classId != null and classId != ''"
>
AND t.class_id = #{classId}
</if>
AND DATE_FORMAT(now(), '%Y-%m-%d') = DATE_FORMAT(t.create_date, '%Y-%m-%d')
<if
test=
"checkPlace != null and checkPlace != ''"
>
and class_place = #{checkPlace}
</if>
<if
test=
"paperId != null and paperId != ''"
>
and paper_id = #{paperId}
</if>
</select>
</mapper>
</mapper>
src/main/resources/mapper/MemberMapper.xml
View file @
421d930
...
@@ -330,4 +330,18 @@
...
@@ -330,4 +330,18 @@
<update
id=
"removeCheckImage"
parameterType=
"long"
>
<update
id=
"removeCheckImage"
parameterType=
"long"
>
update member set check_image = null,check_time = null where id = #{id}
update member set check_image = null,check_time = null where id = #{id}
</update>
</update>
<select
id=
"companySettings"
parameterType=
"long"
resultType=
"com.subsidy.vo.classdict.SystemSettings"
>
SELECT
t2.time_limit,
t2.ip_address_record,
t2.device_no_record
FROM
member t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.id = #{memberId}
</select>
</mapper>
</mapper>
src/main/resources/mapper/OprMemDictMapper.xml
View file @
421d930
...
@@ -54,4 +54,18 @@
...
@@ -54,4 +54,18 @@
WHERE
WHERE
create_date
<
(NOW() - INTERVAL 10 DAY)
create_date
<
(NOW() - INTERVAL 10 DAY)
</select>
</select>
<select
id=
"getLatestLoginInfo"
parameterType=
"long"
resultType=
"com.subsidy.model.OprMemDictDO"
>
SELECT
t.ip_address,
t.opr_type,
t.result,
t.user_id,
max(t.create_date) as create_date
FROM
opr_mem_dict t
WHERE
t.delete_date IS NULL
AND t.user_id = #{userId}
</select>
</mapper>
</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