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 b86edc62
authored
Jan 03, 2023
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人脸识别订单号改为用uuid生成
1 parent
c6096c21
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
222 additions
and
100 deletions
src/main/java/com/subsidy/controller/AdministerController.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/dto/administer/SelfExportVO.java
src/main/java/com/subsidy/jobs/RenSheJuJob.java
src/main/java/com/subsidy/mapper/ActivityDetectionMapper.java
src/main/java/com/subsidy/mapper/AdministerMapper.java
src/main/java/com/subsidy/service/AdministerService.java
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/java/com/subsidy/util/MyStringUtils.java
src/main/java/com/subsidy/util/OSSUtils.java
src/main/java/com/subsidy/util/RandomUtil.java
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
src/main/resources/application.properties
src/main/resources/mapper/ActivityDetectionMapper.xml
src/main/resources/mapper/AdministerMapper.xml
src/main/resources/mapper/ImageCheckRecordMapper.xml
src/main/resources/mapper/OprMemDictMapper.xml
src/main/java/com/subsidy/controller/AdministerController.java
View file @
b86edc6
...
...
@@ -273,4 +273,10 @@ public class AdministerController {
administerService
.
exportManageMember
(
manageMemberDTO
);
}
@PostMapping
(
"selfExport"
)
@ApiOperation
(
"自助导出 id导出"
)
public
void
selfExport
(
@RequestBody
ClassDictDO
classDictDO
){
administerService
.
selfExport
(
classDictDO
);
}
}
src/main/java/com/subsidy/controller/MemberController.java
View file @
b86edc6
...
...
@@ -222,4 +222,6 @@ public class MemberController {
}
}
src/main/java/com/subsidy/dto/administer/SelfExportVO.java
0 → 100644
View file @
b86edc6
package
com
.
subsidy
.
dto
.
administer
;
import
com.subsidy.util.excel.ExcelColumn
;
import
lombok.Data
;
@Data
public
class
SelfExportVO
{
@ExcelColumn
(
col
=
1
,
value
=
"姓名"
)
private
String
userName
;
@ExcelColumn
(
col
=
2
,
value
=
"视频"
)
private
String
vodName
;
@ExcelColumn
(
col
=
3
,
value
=
"开始时间"
)
private
String
startTime
;
@ExcelColumn
(
col
=
4
,
value
=
"结束时间"
)
private
String
endTime
;
@ExcelColumn
(
col
=
5
,
value
=
"学习时长"
)
private
String
playLength
;
@ExcelColumn
(
col
=
6
,
value
=
"有效时长"
)
private
String
studyLength
;
@ExcelColumn
(
col
=
7
,
value
=
"视频时长"
)
private
String
vodLength
;
}
src/main/java/com/subsidy/jobs/RenSheJuJob.java
0 → 100644
View file @
b86edc6
package
com
.
subsidy
.
jobs
;
import
org.springframework.stereotype.Component
;
/**
* 人社局数据对接
*/
@Component
public
class
RenSheJuJob
{
}
src/main/java/com/subsidy/mapper/ActivityDetectionMapper.java
View file @
b86edc6
...
...
@@ -14,9 +14,16 @@ import org.springframework.stereotype.Repository;
* @author DengMin
* @since 2022-07-13
*/
@Repository
@Repository
public
interface
ActivityDetectionMapper
extends
BaseMapper
<
ActivityDetectionDO
>
{
IPage
<
GetCheckHistoryVO
>
getCheckHistory
(
IPage
iPage
,
Long
classId
,
Long
memberId
);
/**
* 获取验证历史
*/
IPage
<
GetCheckHistoryVO
>
getCheckHistory
(
IPage
iPage
,
Long
classId
,
Long
memberId
);
/**
* 获取今天成功次数
*/
int
todayCnt
(
Long
classId
,
Long
memberId
,
Integer
checkType
,
Integer
status
);
}
src/main/java/com/subsidy/mapper/AdministerMapper.java
View file @
b86edc6
...
...
@@ -2,7 +2,9 @@ package com.subsidy.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.subsidy.dto.administer.SelfExportVO
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.vo.administer.*
;
import
com.subsidy.vo.classdict.ClassDetailVO
;
import
com.subsidy.vo.member.ClassSignVO
;
...
...
@@ -59,5 +61,9 @@ public interface AdministerMapper extends BaseMapper<AdministerDO> {
*/
IPage
<
OperatorsVO
>
operators
(
IPage
page
,
String
userName
);
/**
* 自助导出
*/
List
<
SelfExportVO
>
selfExport
(
ClassDictDO
classDictDO
);
}
src/main/java/com/subsidy/service/AdministerService.java
View file @
b86edc6
...
...
@@ -3,10 +3,7 @@ package com.subsidy.service;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.dto.administer.*
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.ExerciseDoneHistoryDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.ImageCheckRecordDO
;
import
com.subsidy.model.*
;
import
com.subsidy.vo.administer.*
;
import
com.subsidy.vo.classdict.ClassDetailVO
;
import
com.subsidy.vo.image.GetMemberCheckDetailVO
;
...
...
@@ -89,4 +86,6 @@ public interface AdministerService extends IService<AdministerDO> {
IPage
<
ManageMemberVO
>
manageMember
(
ManageMemberDTO
manageMemberDTO
);
void
exportManageMember
(
ManageMemberDTO
manageMemberDTO
);
void
selfExport
(
ClassDictDO
classDictDO
);
}
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
View file @
b86edc6
...
...
@@ -5,13 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.common.exception.HttpException
;
import
com.subsidy.dto.administer.ClassDailyInfoDTO
;
import
com.subsidy.dto.administer.ClassDetailDTO
;
import
com.subsidy.dto.administer.ClassVodDailyInfoDTO
;
import
com.subsidy.dto.administer.ClassVodInfoDTO
;
import
com.subsidy.dto.administer.ManageMemberDTO
;
import
com.subsidy.dto.administer.MemberStudyLogDTO
;
import
com.subsidy.dto.administer.OperatorsDTO
;
import
com.subsidy.dto.administer.*
;
import
com.subsidy.dto.member.ImportMemberDTO
;
import
com.subsidy.mapper.AdministerMapper
;
import
com.subsidy.mapper.AnsweringQuestionMapper
;
...
...
@@ -146,9 +140,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
private
ClassMemberMappingMapper
classMemberMappingMapper
;
@Autowired
private
CourseDictMapper
courseDictMapper
;
@Autowired
private
CompanyDictMapper
companyDictMapper
;
@Autowired
...
...
@@ -1461,6 +1452,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ExcelUtil
.
writeExcel
(
manageMemberVOS
,
ManageMemberVO
.
class
);
}
public
void
selfExport
(
ClassDictDO
classDictDO
){
List
<
SelfExportVO
>
selfExportVOS
=
this
.
baseMapper
.
selfExport
(
classDictDO
);
ExcelUtil
.
writeExcel
(
selfExportVOS
,
SelfExportVO
.
class
);
}
public
String
userName
(
String
originName
,
int
i
,
Long
companyId
)
{
i
++;
...
...
src/main/java/com/subsidy/service/impl/ImageCheckRecordServiceImpl.java
View file @
b86edc6
...
...
@@ -12,6 +12,7 @@ import com.subsidy.model.*;
import
com.subsidy.service.ImageCheckRecordService
;
import
com.subsidy.util.DateFormatUtil
;
import
com.subsidy.util.OSSUtils
;
import
com.subsidy.util.RandomUtil
;
import
com.subsidy.vo.token.*
;
import
org.apache.commons.codec.Charsets
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -119,6 +120,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setPaperId
(
paperId
);
imageCheckRecordDO
.
setClassPlace
(
classPlace
);
imageCheckRecordDO
.
setBizSeqNo
(
RandomUtil
.
randomOrderNumber
());
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
//获取signTicket
...
...
@@ -134,9 +136,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//合作方后台上送身份信息
SendIdCardInfoVO
sendIdCardInfoVO
=
null
;
if
(
StringUtils
.
isEmpty
(
memberDO
.
getCheckImage
()))
{
sendIdCardInfoVO
=
this
.
h5SendIdCardInfo
(
imageCheckRecordDO
.
get
Id
()
+
""
,
memberDO
,
sign
);
sendIdCardInfoVO
=
this
.
h5SendIdCardInfo
(
imageCheckRecordDO
.
get
BizSeqNo
()
,
memberDO
,
sign
);
}
else
{
sendIdCardInfoVO
=
this
.
h5SendIdCardInfoCompare
(
imageCheckRecordDO
.
get
Id
()
+
""
,
memberDO
,
sign
);
sendIdCardInfoVO
=
this
.
h5SendIdCardInfoCompare
(
imageCheckRecordDO
.
get
BizSeqNo
()
,
memberDO
,
sign
);
}
if
(!
"0"
.
equals
(
sendIdCardInfoVO
.
getCode
()))
{
...
...
@@ -150,7 +152,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//签名2
List
<
String
>
signList2
=
new
ArrayList
<>();
signList2
.
add
(
WBAPPID
);
signList2
.
add
(
imageCheckRecordDO
.
get
Id
()
+
""
);
signList2
.
add
(
imageCheckRecordDO
.
get
BizSeqNo
()
);
signList2
.
add
(
memberDO
.
getId
()
+
""
);
signList2
.
add
(
"1.0.0"
);
signList2
.
add
(
sendIdCardInfoVO
.
getResult
().
getFaceId
());
...
...
@@ -186,6 +188,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setCheckPlace
(
checkPlace
);
imageCheckRecordDO
.
setPaperId
(
paperId
);
imageCheckRecordDO
.
setClassPlace
(
classPlace
);
imageCheckRecordDO
.
setBizSeqNo
(
RandomUtil
.
randomOrderNumber
());
imageCheckRecordMapper
.
insert
(
imageCheckRecordDO
);
//获取signTicket
...
...
@@ -194,7 +197,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
//生成签名
List
<
String
>
signList1
=
new
ArrayList
<>();
signList1
.
add
(
WBAPPID
);
signList1
.
add
(
imageCheckRecordDO
.
get
Id
()
+
""
);
signList1
.
add
(
imageCheckRecordDO
.
get
BizSeqNo
()
);
signList1
.
add
(
memberDO
.
getId
()
+
""
);
signList1
.
add
(
"1.0.0"
);
String
sign
=
""
;
...
...
@@ -206,10 +209,10 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
signList1
.
add
(
memberDO
.
getUserName
());
signList1
.
add
(
memberDO
.
getIdCard
());
sign
=
sign
(
signList1
,
idCardTicketsVO
.
getValue
());
sendIdCardInfoVO
=
this
.
sendIdCardInfo
(
imageCheckRecordDO
.
get
Id
()
+
""
,
memberDO
,
sign
);
sendIdCardInfoVO
=
this
.
sendIdCardInfo
(
imageCheckRecordDO
.
get
BizSeqNo
()
,
memberDO
,
sign
);
}
else
{
sign
=
sign
(
signList1
,
idCardTicketsVO
.
getValue
());
sendIdCardInfoVO
=
this
.
sendIdCardInfoCompare
(
imageCheckRecordDO
.
get
Id
()
+
""
,
memberDO
,
sign
);
sendIdCardInfoVO
=
this
.
sendIdCardInfoCompare
(
imageCheckRecordDO
.
get
BizSeqNo
()
,
memberDO
,
sign
);
}
if
(!
"0"
.
equals
(
sendIdCardInfoVO
.
getCode
()))
{
...
...
@@ -263,9 +266,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO
.
setPhoto
(
OSSUtils
.
uploadOneFile
(
resultVO
.
getPhotoList
().
get
(
resultVO
.
getPhotoList
().
size
()-
1
)));
if
((
Double
.
valueOf
(
imageCheckRecordDO
.
getSimilarity
())
>
50
))
{
imageCheckRecordDO
.
setResult
(
1
);
activityDetectionDO
.
setStatus
(
1
);
//如果是签到页的认证,则把图片写到member表里
if
(
imageCheckRecordDO
.
getCheckPlace
()
==
1
)
{
//写到学生班级映射表里去
ClassMemberMappingDO
classMemberMappingDO
=
classMemberMappingMapper
.
selectOne
(
new
QueryWrapper
<
ClassMemberMappingDO
>()
.
lambda
()
...
...
@@ -274,15 +277,15 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
classMemberMappingDO
.
setPhoto
(
imageCheckRecordDO
.
getPhoto
());
classMemberMappingMapper
.
updateById
(
classMemberMappingDO
);
activityDetectionDO
.
setStatus
(
1
);
}
}
else
{
activityDetectionDO
.
setStatus
(
1
);
activityDetectionDO
.
setStatus
(
0
);
imageCheckRecordDO
.
setResult
(
0
);
}
}
catch
(
Exception
e
)
{
imageCheckRecordDO
.
setResult
(
0
);
imageCheckRecordDO
.
setResult
(
0
);
activityDetectionDO
.
setStatus
(
0
);
}
activityDetectionMapper
.
insert
(
activityDetectionDO
);
imageCheckRecordMapper
.
updateById
(
imageCheckRecordDO
);
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
b86edc6
...
...
@@ -390,12 +390,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO
.
setCompanyId
(
companyDictDO
.
getId
());
memberVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
memberVO
.
setQxyStatus
(
companyDictDO
.
getQxyStatus
());
//
OprMemDictDO oprMemDictDO = new OprMemDictDO();
//
oprMemDictDO.setUserId(memberDO.getId());
//
oprMemDictDO.setOprType("登录");
//
oprMemDictDO.setResult(1);
//
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
//
oprMemDictMapper.insert(oprMemDictDO);
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setIpAddress
(
IpAddressUtil
.
getIpAddress
(
request
));
oprMemDictMapper
.
insert
(
oprMemDictDO
);
memberVO
.
setCompanyId
(
companyDictDO
.
getId
());
memberVO
.
setSuperviseName
(
companyDictDO
.
getSuperviseName
());
memberVO
.
setCompanyName
(
companyDictDO
.
getCompanyName
());
...
...
@@ -451,13 +451,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return
null
;
}
// 9a79cda9ef6f4a52a8
// 552a4147db2d4026bc4e9021acd614f8
public
static
void
main
(
String
[]
args
)
{
String
uuid
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
System
.
out
.
println
(
uuid
);
}
public
UserRoleVO
qingxuetangLogin
(
QingxuetangLoginDTO
qingxuetangLoginDTO
,
HttpServletRequest
request
)
{
UserRoleVO
userRoleVO
=
new
UserRoleVO
();
...
...
@@ -708,10 +701,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
int
checkCnt
=
imageCheckRecordMapper
.
checkDailyCount
(
myCoursesDTO
.
getMemberId
(),
myCoursesVO
.
getClassId
(),
1
,
null
);
myCoursesVO
.
setCheckCnt
(
checkCnt
);
if
(
count
>
1
)
{
myCoursesVO
.
setResult
(
1
);
int
todayCnt
=
activityDetectionMapper
.
todayCnt
(
myCoursesVO
.
getClassId
(),
myCoursesDTO
.
getMemberId
(),
1
,
1
);
if
(
count
>
1
||
todayCnt
>
0
)
{
myCoursesVO
.
setResult
(
1
);
//不拍
}
else
{
myCoursesVO
.
setResult
(
0
);
myCoursesVO
.
setResult
(
0
);
//拍
}
}
return
myCoursesVOS
;
...
...
@@ -733,10 +728,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
int
checkCnt
=
imageCheckRecordMapper
.
checkDailyCount
(
myCoursesDTO
.
getMemberId
(),
myCoursesVO
.
getClassId
(),
1
,
null
);
myCoursesVO
.
setCheckCnt
(
checkCnt
);
if
(
count
>
0
)
{
myCoursesVO
.
setResult
(
1
);
int
todayCnt
=
activityDetectionMapper
.
todayCnt
(
myCoursesVO
.
getClassId
(),
myCoursesDTO
.
getMemberId
(),
1
,
1
);
if
(
count
>
1
||
todayCnt
>
0
)
{
myCoursesVO
.
setResult
(
1
);
//不拍
}
else
{
myCoursesVO
.
setResult
(
0
);
myCoursesVO
.
setResult
(
0
);
//拍
}
}
return
myCoursesVOS
;
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
b86edc6
...
...
@@ -61,23 +61,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
String
insertHistory
(
VodPlayHistoryDO
vodPlayHistoryDO
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
5
)
{
if
(
vodPlayHistoryDO
.
getPlayLength
()
>
8
)
{
//查看系统设定的时长
ClassDictDO
classDictDO
=
classDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassDictDO
>()
.
lambda
()
.
eq
(
ClassDictDO:
:
getId
,
vodPlayHistoryDO
.
getClassId
()));
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
vodPlayHistoryDO
.
getMemberId
(),
classDictDO
.
getId
());
if
(
total
>=
6
*
3600
)
{
throw
new
HttpException
(
13001
);
}
//是否超过时长
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
6
*
3600
)
{
//超过时长
int
playLength
=
6
*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
...
...
@@ -85,7 +81,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if
(
playLength
>
5
)
{
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
// throw new HttpException(13001);
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
...
...
@@ -100,24 +95,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public
String
insertHistoryNew
(
InsertHistoryNewDTO
insertHistoryNewDTO
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
5
)
{
if
(
insertHistoryNewDTO
.
getPlayLength
()
>
8
)
{
VodPlayHistoryDO
vodPlayHistoryDO
=
new
VodPlayHistoryDO
();
BeanUtils
.
copyProperties
(
insertHistoryNewDTO
,
vodPlayHistoryDO
);
//查看系统设定的时长
ClassDictDO
classDictDO
=
classDictMapper
.
selectOne
(
new
QueryWrapper
<
ClassDictDO
>()
.
lambda
()
.
eq
(
ClassDictDO:
:
getId
,
insertHistoryNewDTO
.
getClassId
()));
if
(
classDictDO
.
getLimitHour
()
==
1
)
{
//查看当天这个人看了多少时间
Integer
total
=
vodPlayHistoryMapper
.
memberDailyStudyLength
(
insertHistoryNewDTO
.
getMemberId
(),
insertHistoryNewDTO
.
getClassId
());
if
(
total
==
6
*
3600
)
{
throw
new
HttpException
(
13001
);
}
//是否超过时长 没超过 false 超过 true
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>
6
*
3600
)
{
int
playLength
=
6
*
3600
-
total
;
...
...
@@ -126,7 +116,6 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
if
(
playLength
>
5
)
{
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
}
// throw new HttpException(13001);
}
else
{
vodPlayHistoryDO
.
setPlayCount
(
1
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
...
...
@@ -650,14 +639,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List
<
VodPlayHistoryDO
>
vodPlayHistoryDOS
=
this
.
baseMapper
.
getVodPlayDay
(
Long
.
valueOf
(
classId
),
classMemberMappingDO
.
getMemberId
(),
vodPlayStateVO
.
getStartDate
());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for
(
int
l
=
0
;
l
<
vodPlayHistoryDOS
.
size
()
-
1
;
l
++)
{
VodPlayHistoryDO
vph1
=
vodPlayHistoryDOS
.
get
(
l
);
//第一条
if
(
l
==
0
)
{
if
(
l
==
0
)
{
vph1
.
setPlayDate
(
vph1
.
getCreateDate
());
}
VodPlayHistoryDO
vph2
=
vodPlayHistoryDOS
.
get
(
l
+
1
);
//第二条
LocalDateTime
dateTmp
=
vph1
.
getPlayDate
().
plusSeconds
(
vph2
.
getPlayLength
()
+
getRandom1_2
());
LocalDateTime
dateTmp
=
vph1
.
getPlayDate
().
plusSeconds
(
vph2
.
getPlayLength
()
+
getRandom1_2
());
vph2
.
setPlayDate
(
dateTmp
);
this
.
baseMapper
.
updateById
(
vph2
);
}
...
...
src/main/java/com/subsidy/util/MyStringUtils.java
View file @
b86edc6
...
...
@@ -4,6 +4,10 @@ import java.util.List;
public
class
MyStringUtils
{
/**
* 把集合改成字符串 去掉逗号
*/
public
static
String
changeListToString
(
List
<
String
>
list
)
{
StringBuffer
buffer
=
new
StringBuffer
();
...
...
@@ -20,4 +24,7 @@ public class MyStringUtils {
}
}
src/main/java/com/subsidy/util/OSSUtils.java
View file @
b86edc6
...
...
@@ -52,7 +52,7 @@ public class OSSUtils {
InputStream
inputStream
=
new
ByteArrayInputStream
(
bytesFile
);
ossClient
.
putObject
(
bucketName
,
fileName
,
inputStream
);
String
url
=
"http://"
+
bucketName
+
"."
+
endPoint
+
"/"
+
fileName
;
String
url
=
"http://"
+
bucketName
+
"."
+
endPoint
+
"/"
+
fileName
+
"?x-oss-process=image/auto-orient,1/resize,m_pad,w_500,h_500/quality,Q_100/format,jpg"
;
// System.out.println(url);
return
url
;
}
catch
(
Exception
e
)
{
...
...
src/main/java/com/subsidy/util/RandomUtil.java
View file @
b86edc6
package
com
.
subsidy
.
util
;
import
cn.hutool.core.lang.UUID
;
import
java.util.Random
;
public
class
RandomUtil
{
...
...
@@ -16,4 +18,17 @@ public class RandomUtil {
}
return
str
.
toString
();
}
/**
* 随机生成订单号
*/
public
static
String
randomOrderNumber
(){
return
UUID
.
fastUUID
().
toString
().
replace
(
"-"
,
""
).
substring
(
0
,
29
);
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
randomOrderNumber
());
}
}
src/main/java/com/subsidy/util/websocket/WebSocketUtil.java
View file @
b86edc6
...
...
@@ -43,8 +43,8 @@ public class WebSocketUtil implements WebSocketHandler {
private
MemberMapper
memberMapper
;
private
int
heartbeatMin
=
1
;
// 断连最小心跳次数
private
int
heartbeatMax
=
4
;
// 断连最大心跳次数
private
int
reconnectionSeconds
=
3
;
//每次断连间隔重新连接秒
private
int
heartbeatMax
=
3
;
// 断连最大心跳次数
private
int
reconnectionSeconds
=
60
;
//每次断连间隔重新连接秒
/**
* 存放建立连接webSocket对象 Map<memberId,session>
...
...
@@ -74,34 +74,28 @@ public class WebSocketUtil implements WebSocketHandler {
* 并且上一次记录时间大于 { heartbeatMax * reconnectionSeconds } 秒(心跳检测机制),则判断为这次登陆是免密码登陆的重新记录上线时间
*/
OprMemDictDO
oprMemDictDO
=
oprMemDictMapper
.
getLatestLoginInfo
(
id
);
//最近一次登录
if
(
null
!=
oprMemDictDO
)
{
if
(
oprMemDictDO
.
getOprType
().
equals
(
"登出"
))
{
//登出过的话就写记录,否则不写
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getAddress
().
getHostAddress
());
// oprMemDictDO.setIpAddress(session.getRemoteAddress().getHostName
());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
// }
}
// }
}
webSocketMap
.
remove
(
id
);
}
else
{
webSocketMap
.
put
(
id
,
session
);
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登录"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getAddress
().
getHostAddress
());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
// 数据操作
SystemSettings
systemSettings
=
memberMapper
.
companySettings
(
id
);
//公司配置
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
id
);
systemSettings
.
setClassSettingsVOS
(
classSettings
);
if
(
CollectionUtils
.
isNotEmpty
(
classSettings
))
{
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
systemSettings
),
SerializerFeature
.
WriteMapNullValue
);
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
data
));
}
}
webSocketMap
.
put
(
id
,
session
);
// 数据操作
SystemSettings
systemSettings
=
memberMapper
.
companySettings
(
id
);
//公司配置
List
<
ClassSettingsVO
>
classSettings
=
classDictMapper
.
getClassSettings
(
id
);
systemSettings
.
setClassSettingsVOS
(
classSettings
);
if
(
CollectionUtils
.
isNotEmpty
(
classSettings
))
{
String
data
=
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
0
,
systemSettings
),
SerializerFeature
.
WriteMapNullValue
);
webSocketMap
.
get
(
id
).
sendMessage
(
new
TextMessage
(
data
));
}
}
}
...
...
@@ -111,9 +105,6 @@ public class WebSocketUtil implements WebSocketHandler {
*/
@Override
public
void
handleMessage
(
WebSocketSession
session
,
WebSocketMessage
<?>
message
)
throws
Exception
{
// if (message instanceof TextMessage) {
// System.out.println(message.getPayload());
// }
this
.
handleMessage
(
session
,
message
);
}
...
...
@@ -135,20 +126,13 @@ public class WebSocketUtil implements WebSocketHandler {
* 关闭链接 :在两端WebSocket connection都关闭或transport error发生后执行
*/
@Override
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
{
public
void
afterConnectionClosed
(
WebSocketSession
session
,
CloseStatus
closeStatus
)
throws
Exception
{
if
(
null
!=
session
)
{
if
(
null
!=
webSocketMap
)
{
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
// //下线
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(id);
// oprMemDictDO.setOprType("登出");
// oprMemDictMapper.insert(oprMemDictDO);
heartbeat
(
webSocketMap
.
get
(
id
));
}
// log.info("<---- webSocket is close");
// log.info("session {} close, status: {}", session.getId(), closeStatus);
}
}
...
...
@@ -172,16 +156,14 @@ public class WebSocketUtil implements WebSocketHandler {
@Override
public
void
run
()
{
if
(
null
!=
session
&&
!
session
.
isOpen
())
{
if
(
beatsNum
>
heartbeatMax
)
{
if
(
beatsNum
>
heartbeatMax
)
{
//heartbeatMa:2
String
params
=
session
.
getUri
().
getQuery
();
Long
id
=
Long
.
valueOf
(
params
.
split
(
"="
)[
1
]);
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
id
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictDO
.
setOprType
(
"登出"
);
oprMemDictDO
.
setIpAddress
(
session
.
getRemoteAddress
().
getAddress
().
getHostAddress
());
oprMemDictMapper
.
insert
(
oprMemDictDO
);
beatsNum
=
heartbeatMin
;
taskMap
.
get
(
session
.
getId
()).
cancel
(
true
);
// break;
}
...
...
src/main/resources/application.properties
View file @
b86edc6
# 环境配置
spring.profiles.active
=
prod
spring.profiles.active
=
dev
#和CPU数
spring.server.acceptorThreadCount
=
600
spring.server.minSpareThreads
=
100
...
...
src/main/resources/mapper/ActivityDetectionMapper.xml
View file @
b86edc6
...
...
@@ -34,4 +34,16 @@
AND t.member_id = #{memberId}
</select>
<select
id=
"todayCnt"
resultType=
"integer"
>
SELECT
count(1)
FROM
activity_detection t
WHERE
t.class_id = #{classId}
AND t.member_id = #{memberId}
AND t.check_type = #{checkType}
AND t.`status` = #{status}
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT(NOW(),'%Y-%m-%d')
</select>
</mapper>
src/main/resources/mapper/AdministerMapper.xml
View file @
b86edc6
...
...
@@ -11,7 +11,6 @@
<result
column=
"telephone"
property=
"telephone"
/>
<result
column=
"password"
property=
"password"
/>
<result
column=
"user_name"
property=
"userName"
/>
<result
column=
"short_name"
property=
"shortName"
/>
<result
column=
"img"
property=
"img"
/>
<result
column=
"status"
property=
"status"
/>
</resultMap>
...
...
@@ -224,4 +223,63 @@
</if>
</select>
<select
id=
"selfExport"
parameterType=
"com.subsidy.model.ClassDictDO"
resultType=
"com.subsidy.dto.administer.SelfExportVO"
>
SELECT
t3.user_name,
t1.vod_name,
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startTime,
t1.create_date AS endTime,
SEC_TO_TIME( t1.play_length ) playLength,
IF
(
t2.total_length
<
t1.vod_length,
SEC_TO_TIME( t2.total_length ),
SEC_TO_TIME( t1.vod_length )) AS studyLength,
SEC_TO_TIME( t1.vod_length ) vodLength
FROM
(
SELECT
t.member_id,
t.class_id,
t.vod_id,
t.create_date,
t2.vod_name,
t.play_length,
t2.vod_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{id}
AND t.delete_date IS NULL
) t1
LEFT JOIN (
SELECT
t.member_id,
t.class_id,
t.vod_id,
sum( t.play_length ) AS total_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
GROUP BY
t.member_id,
t.class_id,
t.vod_id
) t2 ON t1.vod_id = t2.vod_id
AND t1.member_id = t2.member_id
AND t1.class_id = t2.class_id
LEFT JOIN member t3 ON t1.member_id = t3.id
LEFT JOIN class_member_mapping t6 ON t3.id = t6.member_id
AND t6.class_id = t1.class_id
LEFT JOIN class_dict t4 ON t1.class_id = t4.id
LEFT JOIN company_dict t5 ON t3.company_id = t5.id
WHERE
t6.delete_date IS NULL
ORDER BY
t1.member_id,
t1.class_id,
t1.create_date
</select>
</mapper>
src/main/resources/mapper/ImageCheckRecordMapper.xml
View file @
b86edc6
...
...
@@ -46,7 +46,7 @@
<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')
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>
...
...
src/main/resources/mapper/OprMemDictMapper.xml
View file @
b86edc6
...
...
@@ -66,6 +66,7 @@
opr_mem_dict t
WHERE
t.delete_date IS NULL
and t.result = 1
AND t.user_id = #{userId}
</select>
</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