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 b06c404d
authored
Feb 17, 2023
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
人社局测试
1 parent
27a4934c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
486 additions
and
565 deletions
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
src/main/java/com/subsidy/jobs/RenSheJuJob.java
src/main/java/com/subsidy/mapper/RenSheJuMapper.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
src/main/java/com/subsidy/util/RenSheJuConstant.java
src/main/java/com/subsidy/util/websocket/ReConnectWebSocketClient.java
src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java
src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java
src/main/resources/mapper/RenSheJuMapper.xml
src/main/java/com/subsidy/common/interceptor/AuthenticationInterceptor.java
View file @
b06c404
...
...
@@ -11,9 +11,11 @@ import com.subsidy.common.exception.HttpException;
import
com.subsidy.mapper.AdministerMapper
;
import
com.subsidy.mapper.MemberMapper
;
import
com.subsidy.mapper.MemberTokensMapper
;
import
com.subsidy.mapper.OprMemDictMapper
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.MemberDO
;
import
com.subsidy.model.MemberTokensDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.util.ConstantUtils
;
import
com.subsidy.util.JwtUtil
;
import
com.subsidy.util.Localstorage
;
...
...
@@ -55,6 +57,9 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
private
MemberTokensMapper
memberTokensMapper
;
@Autowired
private
OprMemDictMapper
oprMemDictMapper
;
@Override
@CrossOrigin
()
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
{
...
...
@@ -67,13 +72,6 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
Method
method
=
handlerMethod
.
getMethod
();
TimeRequired
timeRequired
=
method
.
getAnnotation
(
TimeRequired
.
class
);
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
throw
new
HttpException
(
17001
);
}
}
LoginRequired
methodAnnotation
=
method
.
getAnnotation
(
LoginRequired
.
class
);
if
(
methodAnnotation
!=
null
)
{
...
...
@@ -100,6 +98,19 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
}
}
else
if
(
ConstantUtils
.
MOBILE_TERMINATE
.
equals
(
type
))
{
MemberDO
memberDO
=
memberMapper
.
selectById
(
claimMap
.
get
(
"id"
).
asLong
());
if
(
timeRequired
!=
null
){
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
if
(
hour
<
6
){
OprMemDictDO
oprMemDictDO
=
new
OprMemDictDO
();
oprMemDictDO
.
setUserId
(
memberDO
.
getId
());
oprMemDictDO
.
setOprType
(
"登出"
);
oprMemDictDO
.
setResult
(
1
);
oprMemDictMapper
.
insert
(
oprMemDictDO
);
throw
new
HttpException
(
17001
);
}
}
if
(
memberDO
!=
null
)
{
Localstorage
.
setUser
(
memberDO
);
return
true
;
...
...
src/main/java/com/subsidy/jobs/RenSheJuJob.java
View file @
b06c404
package
com
.
subsidy
.
jobs
;
import
com.alibaba.fastjson.JSONObject
;
import
com.subsidy.common.ResponseData
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.service.RenshejuHistoryService
;
import
com.subsidy.service.impl.RenshejuHistoryServiceImpl
;
import
com.subsidy.util.websocket.WebSocketUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.socket.TextMessage
;
import
org.springframework.web.socket.WebSocketSession
;
import
java.io.IOException
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* 人社局数据对接
...
...
@@ -83,5 +89,12 @@ public class RenSheJuJob {
// renSheJuService.getErrorClass();
// }
@Scheduled
(
cron
=
"00 58 23 * * ?"
)
public
void
cancelLogin
()
throws
IOException
{
ConcurrentHashMap
<
Long
,
WebSocketSession
>
webSocketMap
=
WebSocketUtil
.
webSocketMap
;
for
(
Long
key
:
webSocketMap
.
keySet
()){
webSocketMap
.
get
(
key
).
sendMessage
(
new
TextMessage
(
JSONObject
.
toJSONString
(
ResponseData
.
generateCreatedResponse
(
17001
))));
}
}
}
src/main/java/com/subsidy/mapper/RenSheJuMapper.java
View file @
b06c404
...
...
@@ -98,7 +98,7 @@ public interface RenSheJuMapper {
List
<
Long
>
checkClassIds
();
/**
* 查看某个班级的成员做过的人脸识别记录
* 查看某个班级的成员做过的人脸识别记录
弃用
*/
List
<
ClassImageChecksVO
>
classImageChecks
(
Long
classId
);
...
...
@@ -107,5 +107,9 @@ public interface RenSheJuMapper {
*/
List
<
ClassImageChecksVO
>
passExamCheck
(
Long
classId
);
/**
* 进入到课程第二次做人脸识别
*/
List
<
ClassImageChecksVO
>
studyCheck
(
Long
classId
);
}
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
b06c404
...
...
@@ -1157,6 +1157,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return
polyvInfoVO
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
String
logout
(
MemberDO
memberDO
)
{
memberTokensMapper
.
delete
(
new
QueryWrapper
<
MemberTokensDO
>()
.
lambda
()
...
...
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
View file @
b06c404
package
com
.
subsidy
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.subsidy.common.configure.RenSheConfig
;
import
com.subsidy.dto.renshe.*
;
import
com.subsidy.mapper.ClassDictMapper
;
import
com.subsidy.mapper.ImageCheckRecordMapper
;
import
com.subsidy.mapper.RenSheJuMapper
;
import
com.subsidy.mapper.RenshejuHistoryMapper
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.ExerciseDoneResultDO
;
import
com.subsidy.model.OprMemDictDO
;
import
com.subsidy.model.RenshejuHistoryDO
;
import
com.subsidy.model.*
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.util.OSSUtils
;
import
com.subsidy.util.RenSheJuConstant
;
...
...
@@ -43,6 +42,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
RenshejuHistoryMapper
renshejuHistoryMapper
;
public
RensheResponseVO
classBaseInfo
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
...
...
@@ -55,50 +55,72 @@ public class RenSheJuServiceImpl implements RenSheJuService {
//查找前一天产生数据的班级
List
<
Long
>
classIds
=
renSheJuMapper
.
newClasses
();
for
(
Long
classId
:
classIds
)
{
EpidemicSituationClassBasic
epidemicSituationClassBasic
=
new
EpidemicSituationClassBasic
();
//班级基本信息
ClassBaseInfoVO
classBaseInfoVO
=
renSheJuMapper
.
classBaseInfo
(
classId
);
BeanUtils
.
copyProperties
(
classBaseInfoVO
,
epidemicSituationClassBasic
);
epidemicSituationClassBasic
.
setDownCode
(
classBaseInfoVO
.
getDownCode
());
//章节
List
<
ChapterList2
>
chapterLists
=
renSheJuMapper
.
classChapters
(
classId
);
ChapterList2
chapterList2
=
chapterLists
.
get
(
chapterLists
.
size
()
-
1
);
chapterList2
.
setIsExam
(
1
);
epidemicSituationClassBasic
.
setChapterList
(
chapterLists
);
//学员列表
List
<
MemberVO
>
memberVOS
=
renSheJuMapper
.
classMembers
(
classId
);
epidemicSituationClassBasic
.
setStudentList
(
memberVOS
);
epidemicSituationClassBasics
.
add
(
epidemicSituationClassBasic
);
try
{
if
(
classIds
.
size
()
>
0
)
{
for
(
Long
classId
:
classIds
)
{
EpidemicSituationClassBasic
epidemicSituationClassBasic
=
new
EpidemicSituationClassBasic
();
//班级基本信息
ClassBaseInfoVO
classBaseInfoVO
=
renSheJuMapper
.
classBaseInfo
(
classId
);
BeanUtils
.
copyProperties
(
classBaseInfoVO
,
epidemicSituationClassBasic
);
epidemicSituationClassBasic
.
setDownCode
(
classBaseInfoVO
.
getDownCode
());
//章节
List
<
ChapterList2
>
chapterLists
=
renSheJuMapper
.
classChapters
(
classId
);
ChapterList2
chapterList2
=
chapterLists
.
get
(
chapterLists
.
size
()
-
1
);
chapterList2
.
setIsExam
(
1
);
epidemicSituationClassBasic
.
setChapterList
(
chapterLists
);
//学员列表
List
<
MemberVO
>
memberVOS
=
renSheJuMapper
.
classMembers
(
classId
);
epidemicSituationClassBasic
.
setStudentList
(
memberVOS
);
epidemicSituationClassBasics
.
add
(
epidemicSituationClassBasic
);
}
classBaseInfoDTO
.
setEpidemicSituationClassBasic
(
epidemicSituationClassBasics
);
System
.
out
.
println
(
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClass"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_2
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_2
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
null
;
}
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_2
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
classBaseInfoDTO
.
setEpidemicSituationClassBasic
(
epidemicSituationClassBasics
);
System
.
out
.
println
(
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classBaseInfoDTO
).
toString
());
// Request request = new Request.Builder()
// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass")
// .method("POST", body)
// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
// .addHeader("Content-Type", "application/json")
// .build();
// Response response = client.newCall(request).execute();
// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
// renshejuHistoryMapper.insert(renshejuHistoryDO);
// System.out.println(rensheResponseVO);
// return rensheResponseVO;
return
null
;
}
public
RensheResponseVO
classHourBehavior
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
...
...
@@ -108,78 +130,95 @@ public class RenSheJuServiceImpl implements RenSheJuService {
classHourBehaviorDTO
.
setPrivateKey
(
getSecret
());
List
<
ClassHourBasic
>
classHourBasics
=
new
ArrayList
<>();
//前一天新增视频学习数据的班级
List
<
DailyStudyInfoVO
>
dailyStudyInfoVOS
=
renSheJuMapper
.
dailyStudyInfo
();
for
(
DailyStudyInfoVO
dailyStudyInfoVO
:
dailyStudyInfoVOS
)
{
ClassHourBasic
classHourBasic
=
new
ClassHourBasic
();
BeanUtils
.
copyProperties
(
dailyStudyInfoVO
,
classHourBasic
);
classHourBasic
.
setDownCode
(
dailyStudyInfoVO
.
getDownCode
());
//上线时间列表
//找到当天每次上线下线时间
//上线时间
List
<
OprMemDictDO
>
loginRecords
=
renSheJuMapper
.
loginRecords
(
dailyStudyInfoVO
.
getMemberId
());
//下线时间
List
<
OprMemDictDO
>
loginOutRecords
=
renSheJuMapper
.
loginOutRecords
(
dailyStudyInfoVO
.
getMemberId
());
List
<
LoginList
>
loginLists
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
loginRecords
.
size
();
i
++)
{
LoginList
loginList
=
new
LoginList
();
loginList
.
setIp
(
loginRecords
.
get
(
i
).
getIpAddress
());
loginList
.
setStartTime
(
Timestamp
.
valueOf
(
loginRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
loginList
.
setEndTime
(
Timestamp
.
valueOf
(
loginOutRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
//查看这个人该时间段的学习记录
List
<
ChapterList3
>
chapterList3s
=
renSheJuMapper
.
dailyStudyRecords
(
dailyStudyInfoVO
.
getMemberId
(),
dailyStudyInfoVO
.
getDownCode
(),
loginRecords
.
get
(
0
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
loginList
.
setChapterList
(
chapterList3s
);
loginLists
.
add
(
loginList
);
}
classHourBasic
.
setLoginList
(
loginLists
);
//活跃度列表
List
<
ActivityList
>
activityLists
=
new
ArrayList
<>();
List
<
DailyActivitiesVO
>
activityDetectionDOS
=
renSheJuMapper
.
dailyActivities
(
dailyStudyInfoVO
.
getDownCode
(),
dailyStudyInfoVO
.
getMemberId
());
for
(
DailyActivitiesVO
dailyActivitiesVO
:
activityDetectionDOS
)
{
ActivityList
activityList
=
new
ActivityList
();
if
(
dailyActivitiesVO
.
getAccess
()
==
1
)
{
activityList
.
setAccess
(
0
);
}
else
{
activityList
.
setAccess
(
1
);
activityList
.
setErrorInfo
(
2
);
try
{
//前一天新增视频学习数据的班级
List
<
DailyStudyInfoVO
>
dailyStudyInfoVOS
=
renSheJuMapper
.
dailyStudyInfo
();
for
(
DailyStudyInfoVO
dailyStudyInfoVO
:
dailyStudyInfoVOS
)
{
ClassHourBasic
classHourBasic
=
new
ClassHourBasic
();
BeanUtils
.
copyProperties
(
dailyStudyInfoVO
,
classHourBasic
);
classHourBasic
.
setDownCode
(
dailyStudyInfoVO
.
getDownCode
());
//上线时间列表
//找到当天每次上线下线时间
//上线时间
List
<
OprMemDictDO
>
loginRecords
=
renSheJuMapper
.
loginRecords
(
dailyStudyInfoVO
.
getMemberId
());
//下线时间
List
<
OprMemDictDO
>
loginOutRecords
=
renSheJuMapper
.
loginOutRecords
(
dailyStudyInfoVO
.
getMemberId
());
List
<
LoginList
>
loginLists
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
loginRecords
.
size
();
i
++)
{
LoginList
loginList
=
new
LoginList
();
loginList
.
setIp
(
loginRecords
.
get
(
i
).
getIpAddress
());
loginList
.
setStartTime
(
Timestamp
.
valueOf
(
loginRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
loginList
.
setEndTime
(
Timestamp
.
valueOf
(
loginOutRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
//查看这个人该时间段的学习记录
List
<
ChapterList3
>
chapterList3s
=
renSheJuMapper
.
dailyStudyRecords
(
dailyStudyInfoVO
.
getMemberId
(),
dailyStudyInfoVO
.
getDownCode
(),
loginRecords
.
get
(
0
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
if
(
chapterList3s
.
size
()
>
0
)
{
loginList
.
setChapterList
(
chapterList3s
);
loginLists
.
add
(
loginList
);
}
}
activityList
.
setActivityDetection
(
2
);
activityList
.
setActivityTime
(
dailyActivitiesVO
.
getActivityTime
());
activityLists
.
add
(
activityList
);
classHourBasic
.
setLoginList
(
loginLists
);
//活跃度列表
List
<
ActivityList
>
activityLists
=
new
ArrayList
<>();
List
<
DailyActivitiesVO
>
activityDetectionDOS
=
renSheJuMapper
.
dailyActivities
(
dailyStudyInfoVO
.
getDownCode
(),
dailyStudyInfoVO
.
getMemberId
());
for
(
DailyActivitiesVO
dailyActivitiesVO
:
activityDetectionDOS
)
{
ActivityList
activityList
=
new
ActivityList
();
if
(
dailyActivitiesVO
.
getAccess
()
==
1
)
{
activityList
.
setAccess
(
0
);
}
else
{
activityList
.
setAccess
(
1
);
activityList
.
setErrorInfo
(
2
);
}
if
(
0
==
dailyActivitiesVO
.
getCheckType
())
{
activityList
.
setActivityDetection
(
2
);
}
else
{
activityList
.
setActivityDetection
(
1
);
}
activityList
.
setActivityTime
(
dailyActivitiesVO
.
getActivityTime
());
activityLists
.
add
(
activityList
);
}
classHourBasic
.
setActivityList
(
activityLists
);
classHourBasics
.
add
(
classHourBasic
);
}
classHourB
asic
.
setActivityList
(
activityList
s
);
classHourB
ehaviorDTO
.
setClassHourBasic
(
classHourBasic
s
);
classHourBasics
.
add
(
classHourBasic
);
}
classHourBehaviorDTO
.
setClassHourBasic
(
classHourBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
classHourBehaviorDTO
));
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
classHourBehaviorDTO
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
(
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassHourBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassHourBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_3
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_3
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
()
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
System
.
out
.
println
(
rensheResponseVO
);
return
rensheResponseVO
;
return
null
;
}
public
RensheResponseVO
uploadChapterBehavior
()
throws
IOException
{
...
...
@@ -196,80 +235,102 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List
<
DailyExamBasicVO
>
dailyExamBasicVOS
=
renSheJuMapper
.
dailyExamBasic
();
for
(
DailyExamBasicVO
dailyExamBasicVO
:
dailyExamBasicVOS
)
{
//章节课程考试时间列表
ChapterExamBasic
chapterExamBasic
=
new
ChapterExamBasic
();
BeanUtils
.
copyProperties
(
dailyExamBasicVO
,
chapterExamBasic
);
chapterExamBasic
.
setDownCode
(
dailyExamBasicVO
.
getDownCode
());
//最后一节课作为chapterCode
String
vodId
=
renSheJuMapper
.
classVodName
(
dailyExamBasicVO
.
getDownCode
());
chapterExamBasic
.
setChapterCode
(
vodId
);
//考试活跃度列表
List
<
ActivityList
>
activityLists
=
new
ArrayList
<>();
List
<
ExamActivitiesVO
>
activityDetectionDOS
=
renSheJuMapper
.
examActivities
(
dailyExamBasicVO
.
getDownCode
(),
dailyExamBasicVO
.
getMemberId
());
for
(
ExamActivitiesVO
dailyActivitiesVO
:
activityDetectionDOS
)
{
try
{
if
(
dailyExamBasicVOS
.
size
()
>
0
)
{
for
(
DailyExamBasicVO
dailyExamBasicVO
:
dailyExamBasicVOS
)
{
//章节课程考试时间列表
ChapterExamBasic
chapterExamBasic
=
new
ChapterExamBasic
();
BeanUtils
.
copyProperties
(
dailyExamBasicVO
,
chapterExamBasic
);
chapterExamBasic
.
setDownCode
(
dailyExamBasicVO
.
getDownCode
());
//最后一节课作为chapterCode
String
vodId
=
renSheJuMapper
.
classVodName
(
dailyExamBasicVO
.
getDownCode
());
chapterExamBasic
.
setChapterCode
(
vodId
);
//考试活跃度列表
List
<
ActivityList
>
activityLists
=
new
ArrayList
<>();
List
<
ExamActivitiesVO
>
activityDetectionDOS
=
renSheJuMapper
.
examActivities
(
dailyExamBasicVO
.
getDownCode
(),
dailyExamBasicVO
.
getMemberId
());
for
(
ExamActivitiesVO
dailyActivitiesVO
:
activityDetectionDOS
)
{
ActivityList
activityList
=
new
ActivityList
();
if
(
null
==
dailyActivitiesVO
.
getAccess
()
||
0
==
dailyActivitiesVO
.
getAccess
())
{
activityList
.
setAccess
(
1
);
activityList
.
setErrorInfo
(
1
);
}
else
{
activityList
.
setAccess
(
0
);
}
activityList
.
setActivityDetection
(
1
);
activityList
.
setActivityTime
(
dailyActivitiesVO
.
getActivityTime
());
activityLists
.
add
(
activityList
);
}
chapterExamBasic
.
setActivityList
(
activityLists
);
//考试时间列表
//上线时间
List
<
OprMemDictDO
>
loginRecords
=
renSheJuMapper
.
loginRecords
(
dailyExamBasicVO
.
getMemberId
());
//下线时间
List
<
OprMemDictDO
>
loginOutRecords
=
renSheJuMapper
.
loginOutRecords
(
dailyExamBasicVO
.
getMemberId
());
List
<
ExamList
>
examLists
=
new
ArrayList
<
ExamList
>();
for
(
int
i
=
0
;
i
<
loginRecords
.
size
();
i
++)
{
//找到该时间段内的测评
List
<
ExerciseDoneResultDO
>
exerciseDoneResultDOS
=
renSheJuMapper
.
dailyExerciseDone
(
dailyExamBasicVO
.
getMemberId
(),
loginRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
for
(
ExerciseDoneResultDO
exerciseDoneResultDO
:
exerciseDoneResultDOS
)
{
ExamList
examList
=
new
ExamList
();
examList
.
setStartTime
(
Timestamp
.
valueOf
(
exerciseDoneResultDO
.
getStartDate
()).
getTime
());
examList
.
setEndTime
(
Timestamp
.
valueOf
(
exerciseDoneResultDO
.
getCreateDate
()).
getTime
());
examList
.
setIp
(
loginRecords
.
get
(
i
).
getIpAddress
());
examLists
.
add
(
examList
);
}
}
chapterExamBasic
.
setExamList
(
examLists
);
chapterExamBasics
.
add
(
chapterExamBasic
);
}
ActivityList
activityList
=
new
ActivityList
();
if
(
null
==
dailyActivitiesVO
.
getAccess
()
||
0
==
dailyActivitiesVO
.
getAccess
())
{
activityList
.
setAccess
(
1
);
activityList
.
setErrorInfo
(
1
);
uploadChapterBehaviorDTO
.
setChapterExamBasic
(
chapterExamBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadChapterBehaviorDTO
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadChapterBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadChapterBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
// if (200==response.code()) {
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadChapterBehaviorDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
activityList
.
setAccess
(
0
);
}
activityList
.
setActivityDetection
(
1
);
activityList
.
setActivityTime
(
dailyActivitiesVO
.
getActivityTime
());
activityLists
.
add
(
activityList
);
}
chapterExamBasic
.
setActivityList
(
activityLists
);
//考试时间列表
//上线时间
List
<
OprMemDictDO
>
loginRecords
=
renSheJuMapper
.
loginRecords
(
dailyExamBasicVO
.
getMemberId
());
//下线时间
List
<
OprMemDictDO
>
loginOutRecords
=
renSheJuMapper
.
loginOutRecords
(
dailyExamBasicVO
.
getMemberId
());
List
<
ExamList
>
examLists
=
new
ArrayList
<
ExamList
>();
for
(
int
i
=
0
;
i
<
loginRecords
.
size
();
i
++)
{
//找到该时间段内的测评
List
<
ExerciseDoneResultDO
>
exerciseDoneResultDOS
=
renSheJuMapper
.
dailyExerciseDone
(
dailyExamBasicVO
.
getMemberId
(),
loginRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
for
(
ExerciseDoneResultDO
exerciseDoneResultDO
:
exerciseDoneResultDOS
)
{
ExamList
examList
=
new
ExamList
();
examList
.
setStartTime
(
Timestamp
.
valueOf
(
exerciseDoneResultDO
.
getStartDate
()).
getTime
());
examList
.
setEndTime
(
Timestamp
.
valueOf
(
exerciseDoneResultDO
.
getCreateDate
()).
getTime
());
examList
.
setIp
(
loginRecords
.
get
(
i
).
getIpAddress
());
examLists
.
add
(
examList
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
// }
return
rensheResponseVO
;
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadChapterBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
null
;
}
chapterExamBasic
.
setExamList
(
examLists
);
chapterExamBasics
.
add
(
chapterExamBasic
);
}
uploadChapterBehaviorDTO
.
setChapterExamBasic
(
chapterExamBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadChapterBehaviorDTO
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadChapterBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadChapterBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadChapterBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
()
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
return
rensheResponseVO
;
return
null
;
}
public
RensheResponseVO
uploadClassAnswerQuestionBehavior
()
throws
IOException
{
...
...
@@ -285,59 +346,79 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List
<
DailyAnswerVO
>
dailyAnswerVOS
=
renSheJuMapper
.
dailyAnswer
();
HashMap
<
String
,
List
<
AnswerAndQuestionList
>>
hashMap
=
new
HashMap
<>();
for
(
DailyAnswerVO
dailyAnswerVO
:
dailyAnswerVOS
)
{
try
{
if
(
dailyAnswerVOS
.
size
()
>
0
)
{
HashMap
<
String
,
List
<
AnswerAndQuestionList
>>
hashMap
=
new
HashMap
<>();
for
(
DailyAnswerVO
dailyAnswerVO
:
dailyAnswerVOS
)
{
if
(!
hashMap
.
containsKey
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
()))
{
List
<
AnswerAndQuestionList
>
answerAndQuestionLists
=
new
ArrayList
<>();
AnswerAndQuestionList
answerAndQuestionList
=
new
AnswerAndQuestionList
();
answerAndQuestionList
.
setAnswer
(
dailyAnswerVO
.
getAnswer
());
answerAndQuestionList
.
setQuestion
(
dailyAnswerVO
.
getQuestion
());
answerAndQuestionLists
.
add
(
answerAndQuestionList
);
hashMap
.
put
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
(),
answerAndQuestionLists
);
}
else
{
List
<
AnswerAndQuestionList
>
answerAndQuestionLists
=
hashMap
.
get
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
());
AnswerAndQuestionList
answerAndQuestionList
=
new
AnswerAndQuestionList
();
answerAndQuestionList
.
setAnswer
(
dailyAnswerVO
.
getAnswer
());
answerAndQuestionList
.
setQuestion
(
dailyAnswerVO
.
getQuestion
());
answerAndQuestionLists
.
add
(
answerAndQuestionList
);
hashMap
.
put
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
(),
answerAndQuestionLists
);
}
}
if
(!
hashMap
.
containsKey
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
()))
{
List
<
AnswerAndQuestionList
>
answerAndQuestionLists
=
new
ArrayList
<>();
AnswerAndQuestionList
answerAndQuestionList
=
new
AnswerAndQuestionList
();
answerAndQuestionList
.
setAnswer
(
dailyAnswerVO
.
getAnswer
());
answerAndQuestionList
.
setQuestion
(
dailyAnswerVO
.
getQuestion
());
answerAndQuestionLists
.
add
(
answerAndQuestionList
);
hashMap
.
put
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
(),
answerAndQuestionLists
);
}
else
{
List
<
AnswerAndQuestionList
>
answerAndQuestionLists
=
hashMap
.
get
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
());
AnswerAndQuestionList
answerAndQuestionList
=
new
AnswerAndQuestionList
();
answerAndQuestionList
.
setAnswer
(
dailyAnswerVO
.
getAnswer
());
answerAndQuestionList
.
setQuestion
(
dailyAnswerVO
.
getQuestion
());
answerAndQuestionLists
.
add
(
answerAndQuestionList
);
hashMap
.
put
(
dailyAnswerVO
.
getDownCode
()
+
":"
+
dailyAnswerVO
.
getIdentity
(),
answerAndQuestionLists
);
}
}
List
<
AnswerBasic
>
answerBasics
=
new
ArrayList
<>();
List
<
AnswerBasic
>
answerBasics
=
new
ArrayList
<>();
for
(
String
key
:
hashMap
.
keySet
())
{
AnswerBasic
answerBasic
=
new
AnswerBasic
();
String
downCode
=
key
.
split
(
":"
)[
0
];
String
identity
=
key
.
split
(
":"
)[
1
];
answerBasic
.
setDownCode
(
downCode
);
answerBasic
.
setIdentity
(
identity
);
answerBasic
.
setAnswerAndQuestionList
(
hashMap
.
get
(
key
));
answerBasics
.
add
(
answerBasic
);
}
for
(
String
key
:
hashMap
.
keySet
())
{
AnswerBasic
answerBasic
=
new
AnswerBasic
();
String
downCode
=
key
.
split
(
":"
)[
0
];
String
identity
=
key
.
split
(
":"
)[
1
];
answerBasic
.
setDownCode
(
downCode
);
answerBasic
.
setIdentity
(
identity
);
answerBasic
.
setAnswerAndQuestionList
(
hashMap
.
get
(
key
));
answerBasics
.
add
(
answerBasic
);
}
uploadClassAnswerQuestionBehaviorDTO
.
setAnswerBasic
(
answerBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadClassAnswerQuestionBehaviorDTO
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadClassAnswerQuestionBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassAnswerQuestionBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_5
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassAnswerQuestionBehaviorDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
uploadClassAnswerQuestionBehaviorDTO
.
setAnswerBasic
(
answerBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadClassAnswerQuestionBehaviorDTO
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadClassAnswerQuestionBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassAnswerQuestionBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
return
rensheResponseVO
;
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_5
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassAnswerQuestionBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
null
;
}
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_5
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassAnswerQuestionBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
()
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
return
rensheResponseVO
;
return
null
;
}
public
List
<
RensheResponseVO
>
uploadImage
()
throws
IOException
{
...
...
@@ -357,52 +438,59 @@ public class RenSheJuServiceImpl implements RenSheJuService {
uploadImage
.
setPrivateKey
(
getSecret
());
uploadImage
.
setDownCode
(
String
.
valueOf
(
classId
));
// //查找班级下所有人做过的实名认证记录
List
<
ClassImageChecksVO
>
classImageChecksVOS
=
renSheJuMapper
.
classImageChecks
(
classId
);
//
List<ClassImageChecksVO> classImageChecksVOS = renSheJuMapper.classImageChecks(classId);
List
<
ImageDetailList
>
imageDetailLists
=
new
ArrayList
<
ImageDetailList
>();
//
for
(
ClassImageChecksVO
classImageChecksVO
:
classImageChecksVOS
)
{
ImageDetailList
imageDetailList
=
new
ImageDetailList
();
BeanUtils
.
copyProperties
(
classImageChecksVO
,
imageDetailList
);
imageDetailList
.
setImageBase64
(
OSSUtils
.
image2Base64
(
classImageChecksVO
.
getImage
()));
imageDetailList
.
setProcessType
(
0L
);
imageDetailList
.
setDetectionType
(
0L
);
imageDetailLists
.
add
(
imageDetailList
);
}
//查找前一天做过考试验证的记录
List
<
ClassImageChecksVO
>
classImageChecksVOS1
=
renSheJuMapper
.
passExamCheck
(
classId
);
for
(
ClassImageChecksVO
cic
:
classImageChecksVOS1
)
{
ImageDetailList
imageDetailList
=
new
ImageDetailList
();
BeanUtils
.
copyProperties
(
cic
,
imageDetailList
);
imageDetailList
.
setImageBase64
(
OSSUtils
.
image2Base64
(
cic
.
getImage
()));
imageDetailList
.
setProcessType
(
2L
);
imageDetailList
.
setDetectionType
(
1L
);
imageDetailLists
.
add
(
imageDetailList
);
}
uploadImage
.
setImageDetailList
(
imageDetailLists
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadImage
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadImage
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadImage"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
try
{
/**
* 第二次人脸识别
*/
List
<
ClassImageChecksVO
>
classImageChecksVOS2
=
renSheJuMapper
.
studyCheck
(
classId
);
if
(
classImageChecksVOS2
.
size
()
>
0
)
{
for
(
ClassImageChecksVO
cicon
:
classImageChecksVOS2
)
{
ImageDetailList
imageDetailList
=
new
ImageDetailList
();
BeanUtils
.
copyProperties
(
cicon
,
imageDetailList
);
imageDetailList
.
setImageBase64
(
"data:image/jpeg;base64,"
+
OSSUtils
.
image2Base64
(
cicon
.
getImage
()));
imageDetailList
.
setProcessType
(
0L
);
imageDetailList
.
setDetectionType
(
0L
);
imageDetailLists
.
add
(
imageDetailList
);
}
uploadImage
.
setImageDetailList
(
imageDetailLists
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadImage
));
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadImage
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadImage"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_6
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadImage
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
rensheResponseVOS
.
add
(
rensheResponseVO
);
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_6
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadImage
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_6
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadImage
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
()
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
System
.
out
.
println
(
rensheResponseVO
);
rensheResponseVOS
.
add
(
rensheResponseVO
);
// System.out.println(rensheResponseVO);
}
return
rensheResponseVOS
;
...
...
@@ -421,19 +509,30 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
System
.
out
.
println
(
response
);
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
try
{
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_7
);
renshejuHistoryDO
.
setInputParam
(
getSecret
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_7
);
renshejuHistoryDO
.
setInputParam
(
getSecret
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
return
rensheResponseVO
;
return
null
;
}
public
RensheResponseVO
uploadClassCode
()
throws
IOException
{
...
...
@@ -460,26 +559,36 @@ public class RenSheJuServiceImpl implements RenSheJuService {
uploadClassCodeDTO
.
setClassCodeBasic
(
classCodeBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
uploadClassCodeDTO
));
try
{
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadClassCodeDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassCode"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
uploadClassCodeDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()+
"/import/downstream/enterprise/uploadClassCode"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_8
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassCodeDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_SUCCESS
);
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_8
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
uploadClassCodeDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
return
rensheResponseVO
;
return
null
;
}
public
RensheResponseVO
getErrorClass
()
throws
IOException
{
...
...
@@ -495,17 +604,28 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
if
(
null
!=
rensheResponseVO
.
getCtt
()){
try
{
Response
response
=
client
.
newCall
(
request
).
execute
(
);
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
System
.
out
.
println
(
rensheResponseVO
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_9
);
renshejuHistoryDO
.
setInputParam
(
getSecret
());
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
}
catch
(
Exception
e
)
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_9
);
renshejuHistoryDO
.
setInputParam
(
getSecret
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
return
rensheResponseVO
;
return
null
;
}
public
RensheStringVO
clear
()
throws
IOException
{
...
...
@@ -543,7 +663,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
GetSecretVO
getSecretVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
GetSecretVO
.
class
);
System
.
out
.
println
(
getSecretVO
);
return
getSecretVO
.
getCtt
().
getPrivateKey
();
}
...
...
@@ -565,7 +684,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
public
void
test
(){
public
void
test
()
{
System
.
out
.
println
(
"132222222222222222222222222222"
);
}
...
...
src/main/java/com/subsidy/util/RenSheJuConstant.java
View file @
b06c404
...
...
@@ -47,5 +47,23 @@ public class RenSheJuConstant {
*/
public
static
final
String
POST_10
=
"POST_10_clear"
;
/**
* 调取失败
*/
public
static
final
String
API_ERROR
=
"调取失败"
;
/**
* 当天没数据
*/
public
static
final
String
NO_DATA
=
"NO_DATA"
;
/**
* 推送失败
*/
public
static
final
String
PUSH_FAIL
=
"推送失败"
;
/**
* 推送成功
*/
public
static
final
String
PUSH_SUCCESS
=
"推送成功"
;
}
src/main/java/com/subsidy/util/websocket/ReConnectWebSocketClient.java
deleted
100644 → 0
View file @
27a4934
package
com
.
subsidy
.
util
.
websocket
;
import
cn.hutool.core.thread.ThreadUtil
;
import
cn.hutool.core.util.StrUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.java_websocket.WebSocket
;
import
org.java_websocket.client.WebSocketClient
;
import
org.java_websocket.framing.Framedata
;
import
org.java_websocket.handshake.ServerHandshake
;
import
javax.net.ssl.*
;
import
java.net.Socket
;
import
java.net.URI
;
import
java.nio.ByteBuffer
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.atomic.AtomicBoolean
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.function.Consumer
;
/** @Author huyi @Date 2021/10/15 20:03 @Description: 重连websocket客户端 */
@Slf4j
public
class
ReConnectWebSocketClient
{
/** 字符串消息回调 */
private
Consumer
<
String
>
msgStr
;
/** 字节流消息回调 */
private
Consumer
<
ByteBuffer
>
msgByte
;
/** 异常回调 */
private
Consumer
<
Exception
>
error
;
/** 连接标识 */
private
String
key
;
/** ws服务端连接 */
private
URI
serverUri
;
/** 尝试重连标识 */
private
AtomicBoolean
tryReconnect
;
/** 需要ping标识 */
private
AtomicBoolean
needPing
;
/** websocket连接实体 */
private
WebSocketClient
webSocketClient
;
/** 重连次数 */
private
AtomicInteger
reConnectTimes
;
/** 连接结束标识 */
private
AtomicBoolean
end
;
/** 连接后初始发送报文,这里也可以不需要,如果服务端主动断开连接,重连后可以继续推送报文的话。 */
private
String
initReConnectReq
;
/** 结束回调 */
private
Consumer
<
String
>
endConsumer
;
public
ReConnectWebSocketClient
(
URI
serverUri
,
String
key
,
Consumer
<
String
>
msgStr
,
Consumer
<
ByteBuffer
>
msgByte
,
Consumer
<
Exception
>
error
)
{
this
.
msgStr
=
msgStr
;
this
.
msgByte
=
msgByte
;
this
.
error
=
error
;
this
.
key
=
key
;
this
.
serverUri
=
serverUri
;
this
.
tryReconnect
=
new
AtomicBoolean
(
false
);
this
.
needPing
=
new
AtomicBoolean
(
true
);
this
.
reConnectTimes
=
new
AtomicInteger
(
0
);
this
.
end
=
new
AtomicBoolean
(
false
);
this
.
endConsumer
=
this
::
close
;
init
();
}
/** 初始化连接 */
public
void
init
()
{
// 创建连接
createWebSocketClient
();
// ping线程
circlePing
();
}
private
void
needReconnect
()
throws
Exception
{
ThreadUtil
.
sleep
(
10
,
TimeUnit
.
SECONDS
);
int
cul
=
reConnectTimes
.
incrementAndGet
();
if
(
cul
>
3
)
{
close
(
"real stop"
);
throw
new
Exception
(
"服务端断连,3次重连均失败"
);
}
log
.
warn
(
"[{}]第[{}]次断开重连"
,
key
,
cul
);
if
(
tryReconnect
.
get
())
{
log
.
error
(
"[{}]第[{}]次断开重连结果 -> 连接正在重连,本次重连请求放弃"
,
key
,
cul
);
needReconnect
();
return
;
}
try
{
tryReconnect
.
set
(
true
);
if
(
webSocketClient
.
isOpen
())
{
log
.
warn
(
"[{}]第[{}]次断开重连,关闭旧连接"
,
key
,
cul
);
webSocketClient
.
closeConnection
(
2
,
"reconnect stop"
);
}
webSocketClient
=
null
;
createWebSocketClient
();
connect
();
if
(!
StrUtil
.
hasBlank
(
initReConnectReq
))
{
send
(
initReConnectReq
);
}
}
catch
(
Exception
exception
)
{
log
.
error
(
"[{}]第[{}]次断开重连结果 -> 连接正在重连,重连异常:[{}]"
,
key
,
cul
,
exception
.
getMessage
());
needReconnect
();
}
finally
{
tryReconnect
.
set
(
false
);
}
}
private
void
createWebSocketClient
()
{
webSocketClient
=
new
WebSocketClient
(
serverUri
)
{
@Override
public
void
onOpen
(
ServerHandshake
serverHandshake
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onOpen]连接成功{}"
,
key
,
getRemoteSocketAddress
());
tryReconnect
.
set
(
false
);
}
@Override
public
void
onMessage
(
String
text
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onMessage]接收到服务端数据:text={}"
,
key
,
text
);
msgStr
.
accept
(
text
);
}
@Override
public
void
onMessage
(
ByteBuffer
bytes
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onMessage]接收到服务端数据:bytes={}"
,
key
,
bytes
);
msgByte
.
accept
(
bytes
);
}
@Override
public
void
onWebsocketPong
(
WebSocket
conn
,
Framedata
f
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onWebsocketPong]接收到服务端数据:opcode={}"
,
key
,
f
.
getOpcode
());
}
@Override
public
void
onClose
(
int
i
,
String
s
,
boolean
b
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onClose]关闭,s={},b={}"
,
key
,
s
,
b
);
if
(
StrUtil
.
hasBlank
(
s
)
||
s
.
contains
(
"https"
))
{
if
(
end
.
get
())
{
return
;
}
try
{
needReconnect
();
}
catch
(
Exception
exception
)
{
endConsumer
.
accept
(
"reconnect error"
);
error
.
accept
(
exception
);
}
}
}
@Override
public
void
onError
(
Exception
e
)
{
log
.
info
(
"[{}]ReConnectWebSocketClient [onError]异常,e={}"
,
key
,
e
);
endConsumer
.
accept
(
"error close"
);
error
.
accept
(
e
);
}
};
if
(
serverUri
.
toString
().
contains
(
"wss://"
))
{
trustAllHosts
(
webSocketClient
);
}
}
public
void
circlePing
()
{
new
Thread
(
()
->
{
while
(
needPing
.
get
())
{
if
(
webSocketClient
.
isOpen
())
{
webSocketClient
.
sendPing
();
}
ThreadUtil
.
sleep
(
5
,
TimeUnit
.
SECONDS
);
}
log
.
warn
(
"[{}]Ping循环关闭"
,
key
);
})
.
start
();
}
/**
* 连接
*
* @throws Exception 异常
*/
public
void
connect
()
throws
Exception
{
webSocketClient
.
connectBlocking
(
10
,
TimeUnit
.
SECONDS
);
}
/**
* 发送
*
* @param msg 消息
* @throws Exception 异常
*/
public
void
send
(
String
msg
)
throws
Exception
{
this
.
initReConnectReq
=
msg
;
if
(
webSocketClient
.
isOpen
())
{
webSocketClient
.
send
(
msg
);
}
}
/**
* 关闭
*
* @param msg 关闭消息
*/
public
void
close
(
String
msg
)
{
needPing
.
set
(
false
);
end
.
set
(
true
);
if
(
webSocketClient
!=
null
)
{
webSocketClient
.
closeConnection
(
3
,
msg
);
}
}
/**
* 忽略证书
*
* @param client
*/
public
void
trustAllHosts
(
WebSocketClient
client
)
{
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]
{
new
X509ExtendedTrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
,
Socket
socket
)
throws
CertificateException
{}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
,
Socket
socket
)
throws
CertificateException
{}
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
,
SSLEngine
sslEngine
)
throws
CertificateException
{}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
,
SSLEngine
sslEngine
)
throws
CertificateException
{}
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
)
throws
CertificateException
{}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
x509Certificates
,
String
s
)
throws
CertificateException
{}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
}
};
try
{
SSLContext
ssl
=
SSLContext
.
getInstance
(
"SSL"
);
ssl
.
init
(
null
,
trustAllCerts
,
new
java
.
security
.
SecureRandom
());
SSLSocketFactory
socketFactory
=
ssl
.
getSocketFactory
();
client
.
setSocketFactory
(
socketFactory
);
}
catch
(
Exception
e
)
{
log
.
error
(
"ReConnectWebSocketClient trustAllHosts 异常,e={0}"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/subsidy/vo/renshe/ClassImageChecksVO.java
View file @
b06c404
...
...
@@ -5,6 +5,10 @@ import lombok.Data;
@Data
public
class
ClassImageChecksVO
{
Long
classId
;
Long
memberId
;
/**
* 检测时间,【13位时间戳】【精确到毫秒】如检测类型为活跃度检测则与【学时信息采集接口】、【考试信息采集接口】activityTime时间保持一致
*/
...
...
src/main/java/com/subsidy/vo/renshe/DailyActivitiesVO.java
View file @
b06c404
...
...
@@ -9,5 +9,6 @@ public class DailyActivitiesVO {
private
Long
activityTime
;
private
Integer
checkType
;
}
src/main/resources/mapper/RenSheJuMapper.xml
View file @
b06c404
...
...
@@ -168,7 +168,8 @@
<select
id=
"dailyActivities"
resultType=
"com.subsidy.vo.renshe.DailyActivitiesVO"
>
SELECT
t1.`status` as access,
unix_timestamp( t1.create_date )*1000 as activityTime
unix_timestamp( t1.create_date )*1000 as activityTime,
t1.check_type
FROM
activity_detection t1
WHERE
...
...
@@ -176,7 +177,6 @@
AND t1.delete_date IS NULL
AND t1.member_id = #{memberId}
AND t1.class_id = #{classId}
and t1.check_type= 0
</select>
<select
id=
"examActivities"
resultType=
"com.subsidy.vo.renshe.ExamActivitiesVO"
>
...
...
@@ -353,7 +353,7 @@
SELECT
distinct class_id
FROM
class_member_mapping
image_check_record
WHERE
delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
...
...
@@ -401,4 +401,27 @@
AND t1.result = 1
</select>
<select
id=
"studyCheck"
parameterType=
"long"
resultType=
"com.subsidy.vo.renshe.ClassImageChecksVO"
>
SELECT
t1.class_id,
t1.member_id,
t1.photo AS image,
t2.user_name AS studentName,
t2.id_card AS identity,
t2.telephone AS phone,
UNIX_TIMESTAMP( t1.create_date )* 1000 AS activityTime
FROM
image_check_record t1
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
class_id = #{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.paper_id IS NULL
AND t1.result = 1
and t1.member_id
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc
</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