Commit 27a4934c by 涂亚平

人社局对接测试

1 parent 23ad1fb2
Showing with 2437 additions and 29 deletions
......@@ -259,7 +259,12 @@
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.10.0</version>
<version>3.10.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.13.0</version>
</dependency>
</dependencies>
......
......@@ -5,6 +5,8 @@ import com.subsidy.util.websocket.WebSocketUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
......@@ -58,4 +60,11 @@ public class WebSocketConfig extends ServerEndpointConfig.Configurator implemen
return new ServerEndpointExporter();
}
@Bean
public TaskScheduler taskScheduler(){
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(10);
taskScheduler.initialize();
return taskScheduler;
}
}
\ No newline at end of file
......@@ -6,6 +6,7 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.detection.GetCheckHistoryDTO;
import com.subsidy.dto.detection.VerifyDTO;
import com.subsidy.model.ActivityDetectionDO;
import com.subsidy.service.ActivityDetectionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -47,4 +48,10 @@ public class ActivityDetectionController {
return ResponseData.generateCreatedResponse(0,activityDetectionService.getCheckHistory(getCheckHistoryDTO));
}
@PostMapping("verifyError")
@ApiOperation("验证失败记录 classId memberId")
public ResponseVO verifyError(@RequestBody ActivityDetectionDO activityDetectionDO){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verifyError(activityDetectionDO));
}
}
package com.subsidy.controller;
import com.squareup.okhttp.*;
import com.subsidy.service.RenSheJuService;
import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@RestController
@Api(tags = "人社局数据对接")
@RequestMapping("/rensheju")
public class RenSheJuController {
@Autowired
private RenSheJuService renSheJuService;
@PostMapping("getSecret")
@ApiOperation("获取秘钥")
public String getSecret(){
@PostMapping("classBaseInfo")
@ApiOperation("POST-2:班级基本信息信息采集接口")
public RensheResponseVO classBaseInfo() throws IOException {
return renSheJuService.classBaseInfo();
}
MediaType mediaType = MediaType.parse("text/plain");
@PostMapping("classHourBehavior")
@ApiOperation("POST-3:学时信息采集接口")
public RensheResponseVO classHourBehavior() throws IOException {
return renSheJuService.classHourBehavior();
}
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, "json");
Request request = new Request.Builder()
.url("https://api.shzypxy.com/token/accessPrivateKey")
.post(body)
.build();
try {
Response response = client.newCall(request).execute();
return response.body().string();
}catch (Exception e){
e.printStackTrace();
@PostMapping("uploadChapterBehavior")
@ApiOperation("POST-4:考试信息采集接口")
public RensheResponseVO uploadChapterBehavior() throws IOException {
return renSheJuService.uploadChapterBehavior();
}
return null;
@PostMapping("uploadClassAnswerQuestionBehavior")
@ApiOperation("POST-5:答疑辅导采集接口")
public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException {
return renSheJuService.uploadClassAnswerQuestionBehavior();
}
@PostMapping("classBaseInfo")
@ApiOperation("班级基本信息信息采集接口")
public String classBaseInfo(){
@PostMapping("uploadImage")
@ApiOperation("POST-6 班级活跃度/实名认证照片信息采集接口")
public List<RensheResponseVO> uploadImage()throws IOException {
return renSheJuService.uploadImage();
}
@PostMapping("getClassCodeByPrivateKey")
@ApiOperation("POST-7 获取培训待绑定的(班级编号,项目编号)列表")
public RensheResponseVO getClassCodeByPrivateKey()throws IOException {
return renSheJuService.getClassCodeByPrivateKey();
}
@PostMapping("uploadClassCode")
@ApiOperation("POST-8 上下游班级数据绑定接口")
public RensheResponseVO uploadClassCode()throws IOException {
return renSheJuService.uploadClassCode();
}
@PostMapping("getErrorClass")
@ApiOperation("POST-9 获取推送失败班级列表")
public RensheResponseVO getErrorClass()throws IOException{
return renSheJuService.getErrorClass();
}
return null;
@PostMapping("clear")
@ApiOperation("POST-10 清除推送失败班级缓存")
public RensheStringVO clear()throws IOException{
return renSheJuService.clear();
}
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 人社局推送失败记录表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
@RestController
@Api(tags = "人社局推送失败记录表")
@RequestMapping("/rensheju-history-do")
public class RenshejuHistoryController {
}
......@@ -37,7 +37,7 @@ public class VodPlayHistoryController {
@PostMapping("insertHistory")
@ApiOperation("记录学生看视频位置 ajax请求 classId班级id vodId 视频id " +
"memberId 成员id playLength 播放时长 playRecord 位点 ")
"memberId 成员id playLength 播放时长 playRecord 位点 suspendLength暂停时长 ")
@LoginRequired
@TimeRequired
public ResponseVO insertHistory(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
......@@ -46,7 +46,7 @@ public class VodPlayHistoryController {
@RequestMapping("insertHistoryNew")
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 ")
"playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired
public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
......
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ActivityList {
/**
* 是否通过,0.通过 1.未通过
*/
private Integer access;
/**
* 检验类型,1.人脸识别 2.弹出框点击事件 3.课堂答题 4.其他
*/
private Integer activityDetection;
/**
* 活跃度检测时间,【13位时间戳】【精确到毫秒】
*/
private Long activityTime;
/**
* 错误类型,1.人脸识别未通过2.弹出框未点击3.没有做课堂答题4.课堂答题合格率不达标
*/
private Integer errorInfo;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class AnswerAndQuestionList {
/**
* 回答时间
*/
private long answer;
/**
* 提问时间
*/
private long question;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class AnswerBasic {
/**
* 答疑辅导,提问和回答都存在值时才进行传递
*/
private List<AnswerAndQuestionList> answerAndQuestionList;
private String downCode;
private String identity;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class ChapterExamBasic {
/**
* 是否通过,0通过1未通过
*/
private Long access;
/**
* 活跃度列表(数组),【数组】
*/
private List<ActivityList> activityList;
/**
* 章节(课程)编码
*/
private String chapterCode;
/**
* 临时班级(项目)编号
*/
private String downCode;
/**
* 章节(课程)考试时间列表,【数组】
*/
private List<ExamList> examList;
/**
* 章节(课程)考试总时长,该字段数据应为当日产生examList列表内多条结束时间-开始时间累加和【秒】
*/
private Long examTime;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ChapterList2 {
private String chapterCode;
private String chapterName;
private Integer isExam;
private String chapterTime;
private String examTime;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ChapterList3 {
/**
* 章节(课程)编码,与基本信息内的章节(课程)编码相对应
*/
private String chapterCode;
/**
* 章节(课程)学习时长,该学习时间段内本章节学习累计时长【秒】
*/
private long chapterTime;
/**
* 学习结束时间(视频播放结束时间),【13位时间戳】【精确到毫秒】
*/
private long endTime;
/**
* 章节(课程)暂停时长,该学习时间段内本章节播放暂停累计时长【秒】(2023年2月1日开始实行)
*/
private long pauseTime;
/**
* 学习开始时间(视频播放开始时间),【13位时间戳】【精确到毫秒】
*/
private long startTime;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class ClassBaseInfoDTO {
private List<EpidemicSituationClassBasic> epidemicSituationClassBasic;
private String privateKey;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ClassCodeBasic {
/**
* 班级(项目)编号
*/
private String classCode;
/**
* 临时班级(项目)编号
*/
private String downCode;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class ClassHourBasic {
/**
* 活跃度列表,【数组】
*/
private List<ActivityList> activityList;
/**
* 临时班级(临时项目)编号
*/
private String downCode;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 当日累计学习时长,视频暂停时间不计入【秒】
*/
private long learnTime;
/**
* 上线时间列表,【数组】
*/
private List<LoginList> loginList;
/**
* 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】
*/
private long loginTime;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 当日累计播放时长,视频暂停时间计入【秒】
*/
private Long playTime;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class ClassHourBehaviorDTO {
/**
* 班级(项目)学时列表,【数组】班级(项目)学时列表
*/
private List<ClassHourBasic> classHourBasic;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.dto.renshe;
import com.subsidy.vo.renshe.MemberVO;
import lombok.Data;
import java.util.List;
@Data
public class EpidemicSituationClassBasic {
private String areaName;
private List<ChapterList2> chapterList;
private Long courseHour;
private String downCode;
private Long endDate;
private Long learnHour;
// private String professionName;
private String shortName;
private Long startDate;
private List<MemberVO> studentList;
private String trainingCode;
private String trainingName;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ExamList {
/**
* 章节(课程)考试时间列表,【13位时间戳】【精确到毫秒】
*/
private long endTime;
/**
* 登录ip,会对IP进行校验
*/
private String ip;
/**
* 章节(课程)考试开始时间,【13位时间戳】【精确到毫秒】
*/
private long startTime;
}
package com.subsidy.dto.renshe;
import lombok.Data;
@Data
public class ImageDetailList {
/**
* 检测时间,【13位时间戳】【精确到毫秒】如检测类型为活跃度检测则与【学时信息采集接口】、【考试信息采集接口】activityTime时间保持一致
*/
private Long activityTime;
/**
* 检测类型,0.实名认证 1活跃度检测 (实名认证第一次必须是活体采集)
*/
private Long detectionType;
/**
* 学员身份证,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* Base64图片,【jpg】【30kb~50kb】【413*295】
*/
private String imageBase64;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 行为类型,0实名认证 1 学时行为类型的活跃度检测 2 考试行为类型的活跃度检测
*/
private Long processType;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class LoginList {
/**
* 章节(课程)学时列表
*/
private List<ChapterList3> chapterList;
/**
* 下线时间,【13位时间戳】【精确到毫秒】
*/
private long endTime;
/**
* 登录ip,会对IP进行校验
*/
private String ip;
/**
* 上线时间,【13位时间戳】【精确到毫秒】
*/
private long startTime;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class UploadChapterBehaviorDTO {
/**
* 章节(课程)考试列表,【数组】
*/
private List<ChapterExamBasic> chapterExamBasic;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class UploadClassAnswerQuestionBehaviorDTO {
private List<AnswerBasic> answerBasic;
private String privateKey;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class UploadClassCodeDTO {
private List<ClassCodeBasic> classCodeBasic;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.dto.renshe;
import lombok.Data;
import java.util.List;
@Data
public class UploadImageDTO {
/**
* 临时班级(项目)编码
*/
private String downCode;
/**
* 活跃度照片列表,【数组】
*/
private List<ImageDetailList> imageDetailList;
/**
* 私钥
*/
private String privateKey;
}
package com.subsidy.jobs;
import com.subsidy.service.RenSheJuService;
import com.subsidy.service.RenshejuHistoryService;
import com.subsidy.service.impl.RenshejuHistoryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
/**
* 人社局数据对接
*/
......@@ -9,4 +16,72 @@ import org.springframework.stereotype.Component;
public class RenSheJuJob {
@Autowired
private RenSheJuService renSheJuService;
/**
* POST-2:班级基本信息信息采集接口
*/
@Scheduled(cron = "0 0 1 * * ?")
public void classBaseInfo()throws IOException {
renSheJuService.classBaseInfo();
}
/**
* POST-3:学时信息采集接口
*/
@Scheduled(cron = "0 5 1 * * ?")
public void classHourBehavior() throws IOException {
renSheJuService.classHourBehavior();
}
/**
* POST-4:考试信息采集接口
*/
@Scheduled(cron = "0 10 1 * * ?")
public void uploadChapterBehavior() throws IOException {
renSheJuService.uploadChapterBehavior();
}
/**
* POST-5:答疑辅导采集接口
*/
@Scheduled(cron = "0 15 1 * * ?")
public void uploadClassAnswerQuestionBehavior() throws IOException {
renSheJuService.uploadClassAnswerQuestionBehavior();
}
/**
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
@Scheduled(cron = "0 20 1 * * ?")
public void uploadImage()throws IOException {
renSheJuService.uploadImage();
}
/**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 25 1 * * ?")
public void getClassCodeByPrivateKey()throws IOException {
renSheJuService.getClassCodeByPrivateKey();
}
/**
* POST-8 上下游班级数据绑定接口
*/
@Scheduled(cron = "0 30 1 * * ?")
public void uploadClassCode()throws IOException {
renSheJuService.uploadClassCode();
}
// /**
// * POST-9 获取推送失败班级列表
// */
// @Scheduled(cron = "0 35 1 * * ?")
// public void getErrorClass()throws IOException{
// renSheJuService.getErrorClass();
// }
}
......@@ -66,4 +66,10 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
* 获取证书的全部班级
*/
List<GetAllClassesVO> getAllCertClasses(ClassDictDO classDictDO);
/**
* 前一天产生视频学习数据的班级信息
*/
List<Long> dailyClassInfo();
}
package com.subsidy.mapper;
import com.subsidy.dto.renshe.ChapterExamBasic;
import com.subsidy.dto.renshe.ChapterList2;
import com.subsidy.dto.renshe.ChapterList3;
import com.subsidy.dto.renshe.ClassHourBasic;
import com.subsidy.model.ActivityDetectionDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.vo.renshe.*;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
@Repository
public interface RenSheJuMapper {
/**
* 查询班级基本信息
*/
ClassBaseInfoVO classBaseInfo(Long classId);
/**
* 查询班级学员信息
*/
List<MemberVO> classMembers(Long classId);
/**
* 课程下章节信息
*/
List<ChapterList2> classChapters(Long classId);
/**
* 新增班级
*/
List<Long> newClasses();
/**
* 前一天新增视频学习数据
*/
List<DailyStudyInfoVO> dailyStudyInfo();
/**
* 前一天活跃度检测列表
*/
List<DailyActivitiesVO > dailyActivities(String classId, Long memberId);
/**
* 考试活跃度检测--人脸
*/
List<ExamActivitiesVO> examActivities(String classId,Long memberId);
/**
* 某人某天累计在线时长
*/
Long dailyStayLength(Long memberId);
/**
* 查看某人前一天上线的时间
*/
List<OprMemDictDO> loginRecords(Long memberId);
/**
* 查看某人前一天下线的时间
*/
List<OprMemDictDO> loginOutRecords(Long memberId);
/**
* 某个人某时间段的学习记录
*/
List<ChapterList3> dailyStudyRecords(Long memberId,String classId,String startDate, String endDate);
/**
* 前一天考试通过数据
*/
List<DailyExamBasicVO> dailyExamBasic();
/**
* 查找课程最后一个视频
*/
String classVodName(String classId);
/**
* 找到某人某个时间段内的测评记录
*/
List<ExerciseDoneResultDO> dailyExerciseDone(Long memberId, String startDate, String endDate);
/**
* 找到某人当天答疑的记录
*/
List<DailyAnswerVO> dailyAnswer();
/**
* 查找前一天做过人脸识别的班级
*/
List<Long> checkClassIds();
/**
* 查看某个班级的成员做过的人脸识别记录
*/
List<ClassImageChecksVO> classImageChecks(Long classId);
/**
* 前一天做过考试验证并且通过的人
*/
List<ClassImageChecksVO> passExamCheck(Long classId);
}
package com.subsidy.mapper;
import com.subsidy.model.RenshejuHistoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 人社局推送失败记录表 Mapper 接口
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
@Repository
public interface RenshejuHistoryMapper extends BaseMapper<RenshejuHistoryDO> {
}
......@@ -96,6 +96,10 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<VodPlayHistoryDO> getVodPlayDay(Long classId, Long memberId, Date endDate);
/**
* 找到某个人最新的学习记录
*/
// Long memberLatestRecord(Long memberId);
double getStudyTotal();
......
......@@ -56,6 +56,11 @@ public class CompanyDictDO extends BaseModel {
private String address;
/**
* 区域
*/
private String areaName;
/**
* 是否需要跳转到Q学友
*/
private Boolean qxyStatus;
......
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 人社局推送失败记录表
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("rensheju_history")
public class RenshejuHistoryDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 接口名称
*/
private String interfaceName;
/**
* 入参
*/
private String inputParam;
/**
* 出参
*/
private Object outputParam;
}
......@@ -48,6 +48,11 @@ public class VodPlayHistoryDO extends BaseModel {
private Integer playLength;
/**
* 暂停时长
*/
private Integer suspendLength;
/**
* 播放视频位置
*/
private Integer playRecord;
......
......@@ -23,4 +23,5 @@ public interface ActivityDetectionService extends IService<ActivityDetectionDO>
IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO);
String verifyError(ActivityDetectionDO activityDetectionDO);
}
package com.subsidy.service;
import com.subsidy.dto.renshe.*;
import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO;
import java.io.IOException;
import java.util.List;
public interface RenSheJuService {
RensheResponseVO classBaseInfo() throws IOException;
RensheResponseVO classHourBehavior() throws IOException;
RensheResponseVO uploadChapterBehavior() throws IOException;
RensheResponseVO uploadClassAnswerQuestionBehavior()throws IOException;
List<RensheResponseVO> uploadImage()throws IOException;
RensheResponseVO getClassCodeByPrivateKey()throws IOException;
RensheResponseVO uploadClassCode()throws IOException;
RensheResponseVO getErrorClass()throws IOException;
RensheStringVO clear()throws IOException;
void test();
}
package com.subsidy.service;
import com.subsidy.model.RenshejuHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 人社局推送失败记录表 服务类
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
public interface RenshejuHistoryService extends IService<RenshejuHistoryDO> {
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.detection.GetCheckHistoryDTO;
import com.subsidy.dto.detection.VerifyDTO;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.ActivityDetectionDO;
import com.subsidy.mapper.ActivityDetectionMapper;
import com.subsidy.service.ActivityDetectionService;
......@@ -13,6 +14,7 @@ import com.subsidy.util.ActivityDetectionUtils;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.activity.GetCheckHistoryVO;
import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
......@@ -28,6 +30,9 @@ import javax.servlet.http.HttpServletRequest;
@Service
public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionMapper, ActivityDetectionDO> implements ActivityDetectionService {
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
public String verify(VerifyDTO verifyDTO, HttpServletRequest request){
try{
......@@ -47,6 +52,11 @@ public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionM
//失败
activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO);
//
// //失败的话删掉这个人最新的学习数据
// Long latestRecord = vodPlayHistoryMapper.memberLatestRecord(verifyDTO.getMemberId());
// vodPlayHistoryMapper.deleteById(latestRecord);
throw new HttpException(19001);
}
} catch (Exception e) {
......@@ -60,4 +70,10 @@ public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionM
return this.baseMapper.getCheckHistory(pager,getCheckHistoryDTO.getClassId(),getCheckHistoryDTO.getMemberId());
}
public String verifyError(ActivityDetectionDO activityDetectionDO){
activityDetectionDO.setStatus(0);
activityDetectionDO.setCheckType(0);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.ADD_SUCCESS;
}
}
......@@ -270,16 +270,17 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
imageCheckRecordDO.setResult(1);
activityDetectionDO.setStatus(1);
//如果是签到页的认证,则把图片写到member表里
if (imageCheckRecordDO.getCheckPlace() == 1) {
if (imageCheckRecordDO.getCheckPlace() == 0) {
//写到学生班级映射表里去
ClassMemberMappingDO classMemberMappingDO = classMemberMappingMapper.selectOne(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getMemberId, imageCheckRecordDO.getMemberId())
.eq(ClassMemberMappingDO::getClassId, imageCheckRecordDO.getClassId()));
if (StringUtils.isEmpty(classMemberMappingDO.getPhoto())){
classMemberMappingDO.setPhoto(imageCheckRecordDO.getPhoto());
classMemberMappingMapper.updateById(classMemberMappingDO);
}
}
} else {
activityDetectionDO.setStatus(0);
imageCheckRecordDO.setResult(0);
......
package com.subsidy.service.impl;
import com.alibaba.fastjson.JSON;
import com.subsidy.common.configure.RenSheConfig;
import com.subsidy.dto.renshe.*;
import com.subsidy.mapper.ClassDictMapper;
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.service.RenSheJuService;
import com.subsidy.util.OSSUtils;
import com.subsidy.util.RenSheJuConstant;
import com.subsidy.vo.renshe.*;
import net.sf.json.JSONObject;
import okhttp3.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Service
public class RenSheJuServiceImpl implements RenSheJuService {
@Autowired
private RenSheJuMapper renSheJuMapper;
@Autowired
private RenSheConfig renSheConfig;
@Autowired
private ClassDictMapper classDictMapper;
@Autowired
RenshejuHistoryMapper renshejuHistoryMapper;
public RensheResponseVO classBaseInfo() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
//拼数据
ClassBaseInfoDTO classBaseInfoDTO = new ClassBaseInfoDTO();
classBaseInfoDTO.setPrivateKey(getSecret());
List<EpidemicSituationClassBasic> epidemicSituationClassBasics = new ArrayList<>();
//查找前一天产生数据的班级
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);
}
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");
ClassHourBehaviorDTO classHourBehaviorDTO = new ClassHourBehaviorDTO();
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);
}
activityList.setActivityDetection(2);
activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
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();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
if (null!=rensheResponseVO.getCtt()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
System.out.println(rensheResponseVO);
return rensheResponseVO;
}
public RensheResponseVO uploadChapterBehavior() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
UploadChapterBehaviorDTO uploadChapterBehaviorDTO = new UploadChapterBehaviorDTO();
uploadChapterBehaviorDTO.setPrivateKey(getSecret());
List<ChapterExamBasic> chapterExamBasics = new ArrayList<>();
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) {
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);
}
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()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
}
public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
UploadClassAnswerQuestionBehaviorDTO uploadClassAnswerQuestionBehaviorDTO = new UploadClassAnswerQuestionBehaviorDTO();
//秘钥
uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret());
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer();
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);
}
}
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);
}
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()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
}
public List<RensheResponseVO> uploadImage() throws IOException {
List<RensheResponseVO> rensheResponseVOS = new ArrayList<>();
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
//找到昨天做过人脸识别的班级
List<Long> classIds = renSheJuMapper.checkClassIds();
for (Long classId : classIds) {
UploadImageDTO uploadImage = new UploadImageDTO();
uploadImage.setPrivateKey(getSecret());
uploadImage.setDownCode(String.valueOf(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()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
System.out.println(rensheResponseVO);
rensheResponseVOS.add(rensheResponseVO);
}
return rensheResponseVOS;
}
public RensheResponseVO getClassCodeByPrivateKey() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/getClassCodeByPrivateKey")
.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);
if (null!=rensheResponseVO.getCtt()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_7);
renshejuHistoryDO.setInputParam(getSecret());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
}
public RensheResponseVO uploadClassCode() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
UploadClassCodeDTO uploadClassCodeDTO = new UploadClassCodeDTO();
uploadClassCodeDTO.setPrivateKey(getSecret());
//所有班级
List<Long> classIds = renSheJuMapper.newClasses();
List<ClassCodeBasic> classCodeBasics = new ArrayList<ClassCodeBasic>();
for (Long classId : classIds) {
ClassCodeBasic classCodeBasic = new ClassCodeBasic();
ClassDictDO classDictDO = classDictMapper.selectById(classId);
classCodeBasic.setDownCode(String.valueOf(classDictDO.getId()));
classCodeBasic.setClassCode(classDictDO.getClassCode());
classCodeBasics.add(classCodeBasic);
}
uploadClassCodeDTO.setClassCodeBasic(classCodeBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadClassCodeDTO));
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());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
}
public RensheResponseVO getErrorClass() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/getErrorClass")
.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()){
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_9);
renshejuHistoryDO.setInputParam(getSecret());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
}
public RensheStringVO clear() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
// MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/clear")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.build();
Response response = client.newCall(request).execute();
RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class);
System.out.println(rensheStringVO);
return rensheStringVO;
}
public String getSecret() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
// MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("publicKey", renSheConfig.getSecretKey())
.build();
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/token/accessPrivateKey")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.build();
Response response = client.newCall(request).execute();
GetSecretVO getSecretVO = JSON.parseObject(response.body().string(), GetSecretVO.class);
System.out.println(getSecretVO);
return getSecretVO.getCtt().getPrivateKey();
}
public static void main(String[] args) {
// GetSecretVO getSecretVO = new GetSecretVO();
//
// getSecretVO.setC(1);
// getSecretVO.setMsg("aaaa");
// GetSecretChildVO getSecretChildVO = new GetSecretChildVO();
// getSecretChildVO.setIp("1121");
// getSecretChildVO.setPrivateKey("1111111");
//// getSecretChildVO.setValidTime("2212");
// getSecretVO.setCtt(getSecretChildVO);
// String s = JSONObject.fromObject(getSecretVO).toString();
// System.out.println(s);
LocalDateTime localDateTime = LocalDateTime.now();
System.out.println(localDateTime.toString());
}
public void test(){
System.out.println("132222222222222222222222222222");
}
}
package com.subsidy.service.impl;
import com.subsidy.model.RenshejuHistoryDO;
import com.subsidy.mapper.RenshejuHistoryMapper;
import com.subsidy.service.RenshejuHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 人社局推送失败记录表 服务实现类
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
@Service
public class RenshejuHistoryServiceImpl extends ServiceImpl<RenshejuHistoryMapper, RenshejuHistoryDO> implements RenshejuHistoryService {
}
package com.subsidy.util;
public class RenSheJuConstant {
/**
* POST-2:班级基本信息信息采集接口
*/
public static final String POST_2 = "POST_2_classBaseInfo";
/**
* POST-3:学时信息采集接口
*/
public static final String POST_3 = "POST_3_classHourBehavior";
/**
* POST-4:考试信息采集接口
*/
public static final String POST_4 = "POST_4_uploadChapterBehavior";
/**
* POST-5:答疑辅导采集接口
*/
public static final String POST_5 = "POST_5_uploadClassAnswerQuestionBehavior";
/**
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
public static final String POST_6 = "POST_6_uploadImage";
/**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
public static final String POST_7 = "POST_7_getClassCodeByPrivateKey";
/**
* POST-8 上下游班级数据绑定接口
*/
public static final String POST_8 = "POST_8_uploadClassCode";
/**
* POST-9 获取推送失败班级列表
*/
public static final String POST_9 = "POST_9_getErrorClass";
/**
* POST-10 清除推送失败班级缓存
*/
public static final String POST_10 = "POST_10_clear";
}
......@@ -35,4 +35,6 @@ public class OperatorsVO {
private String superviseName;
private String companyCode;
private String areaName;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class ActivityList9 {
/**
* 活跃度是否通过
*/
private String access;
/**
* 活跃度检测依据
*/
private String activityDetection;
/**
* 活跃度检测时间
*/
private String activityTime;
/**
* 活跃度未通过原因
*/
private String errorInfo;
/**
* 未通过详情
*/
private String errorMessage;
/**
* 修改日期
*/
private String updateDate;
/**
* 同步状态
*/
private String updateStatus;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class ChapterList9 {
/**
* 章节(课程)编码,与基本信息内的章节(课程)编码相对应
*/
private String chapterCode;
/**
* 章节(课程)学习时长,本次登录时间段内本章节学习累计时长【分】
*/
private long chapterTime;
/**
* 学习结束时间
*/
private String endTime;
/**
* 未通过详情
*/
private String errorMessage;
/**
* 学习开始时间
*/
private String startTime;
/**
* 修改日期
*/
private String updateDate;
/**
* 同步状态
*/
private String updateStatus;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class ClassBaseInfoVO {
private String downCode;
private String shortName;
private Long learnHour;
private Long courseHour;
private Long startDate;
private Long endDate;
private String areaName;
private String trainingName;
private String trainingCode;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class ClassImageChecksVO {
/**
* 检测时间,【13位时间戳】【精确到毫秒】如检测类型为活跃度检测则与【学时信息采集接口】、【考试信息采集接口】activityTime时间保持一致
*/
private Long activityTime;
/**
* 检测类型,0.实名认证 1活跃度检测 (实名认证第一次必须是活体采集)
*/
private Long detectionType;
/**
* 学员身份证,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* Base64图片,【jpg】【30kb~50kb】【413*295】
*/
private String image;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 行为类型,0实名认证 1 学时行为类型的活跃度检测 2 考试行为类型的活跃度检测
*/
private Long processType;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class Ctt7 {
/**
* 所在区域名称
*/
private String areaName;
/**
* 班级(项目)编号
*/
private String classCode;
/**
* 项目(项目)名称
*/
private String name;
/**
* 所属企业名称
*/
private String trainingUnit;
}
package com.subsidy.vo.renshe;
import com.subsidy.dto.renshe.LoginList;
import lombok.Data;
import java.util.List;
@Data
public class Ctt9 {
/**
* 活跃度列表,【数组】
*/
private List<ActivityList9> activityList;
/**
* 班级(项目)编码
*/
private Object downCode;
/**
* 未通过详情
*/
private String errorMessage;
/**
* 学员身份证,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 当日累计学习时长,视频暂停时间不计入【分】
*/
private Object learnTime;
/**
* 上线时间列表,【数组】
*/
private List<LoginList> loginList;
/**
* 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【分】
*/
private Object loginTime;
/**
* 学员电话,会对手机号长度、格式进行校验
*/
private String phone;
/**
* 当日累计播放时长,视频暂停时间计入【分】
*/
private Object playTime;
/**
* 学员姓名
*/
private String studentName;
/**
* 修改日期
*/
private Long updateDate;
/**
* 同步状态
*/
private String updateStatus;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class DailyActivitiesVO {
private Integer access;
private Long activityTime;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class DailyAnswerVO {
private Long id;
private Long askId;
private String downCode;
private String identity;
private Long answer;
private Long question;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class DailyExamBasicVO {
private Long memberId;
private String downCode;
private String studentName;
private String phone;
private String identity;
private Long access;
private Long examTime;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class DailyStudyInfoVO {
private Long memberId;
// private Long classId;
/**
* 临时班级(临时项目)编号
*/
private String downCode;
/**
* 学员身份证号,会对身份证号长度、格式进行校验、X用大写
*/
private String identity;
/**
* 当日累计学习时长,视频暂停时间不计入【秒】
*/
private long learnTime;
/**
* 当日累计登陆时长,该字段数据应为当日产生LoginList列表内多条下线时间-上线时间累加和【秒】
*/
private long loginTime;
/**
* 学员电话号,会对学生手机号长度、格式进行校验
*/
private String phone;
/**
* 当日累计播放时长,视频暂停时间计入【秒】
*/
private Long playTime;
/**
* 学员姓名
*/
private String studentName;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class ExamActivitiesVO {
private Integer access;
private Long activityTime;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class GetSecretChildVO {
private String privateKey;
private String validTime;
private String ip;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class GetSecretVO {
private Integer c;
private String msg;
private GetSecretChildVO ctt;
}
package com.subsidy.vo.renshe;
import lombok.Data;
import java.util.List;
@Data
public class LoginList9 {
/**
* 章节(课程)学时列表
*/
private List<ChapterList9> chapterList;
/**
* 下线时间,【13位时间戳】【精确到毫秒】
*/
private long endTime;
/**
* 未通过详情
*/
private String errorMessage;
/**
* 登录ip,会对IP进行校验
*/
private String ip;
/**
* 上线时间,【13位时间戳】【精确到毫秒】
*/
private long startTime;
/**
* 修改日期
*/
private String updateDate;
/**
* 同步状态
*/
private String updateStatus;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class MemberVO {
private String name;
private String phone;
private String identity;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class RensheResponseVO {
/**
* 响应码
*/
private long c;
/**
* 响应体
*/
private Object ctt;
/**
* 响应信息
*/
private String msg;
}
package com.subsidy.vo.renshe;
import lombok.Data;
@Data
public class RensheStringVO {
/**
* 响应码
*/
private long c;
/**
* 响应体
*/
private Object ctt;
/**
* 响应信息
*/
private String msg;
}
......@@ -57,4 +57,4 @@ qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy
qxueyou.url=https://dev.qxueyou.com/auth/user/token
renshe.url = https://test.shzypxy.com
renshe.secretKey = 111
\ No newline at end of file
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
\ No newline at end of file
......@@ -55,3 +55,6 @@ spring.redis.lettuce.pool.min-idle=8
qxueyou.appId=qxywz5nnWMI77CM3Tx
qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy
qxueyou.url=https://dev.qxueyou.com/auth/user/token
renshe.url = https://api.shzypxy.com
renshe.secretKey = 111
\ No newline at end of file
......@@ -250,4 +250,14 @@
order by t.create_date desc
</select>
<select id="dailyClassInfo" resultType="long">
SELECT DISTINCT
t1.class_id
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
</select>
</mapper>
......@@ -33,7 +33,8 @@
t2.logo,
t2.address,
t2.supervise_name,
t2.company_code
t2.company_code,
t2.area_name
FROM
administer t
left join role_administer_mapping t4 on t.id = t4.administer_id
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RenSheJuMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CertCompanyMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="company_id" property="companyId" />
<result column="cert_id" property="certId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, cert_id
</sql>
<select id="classBaseInfo" parameterType="long" resultType="com.subsidy.vo.renshe.ClassBaseInfoVO">
SELECT
t2.id AS downCode,
t2.class_code,
t2.class_name AS shortName,
ROUND( sum( t7.vod_length )/ 60 ) AS learnHour,
FLOOR( sum( t7.vod_length )/ 2700 ) AS courseHour,
REPLACE ( unix_timestamp( t2.start_date ), '.', '' )/ 1000 AS startDate,
REPLACE ( unix_timestamp( t2.end_date ), '.', '' )/ 1000 AS endDate,
t3.area_name AS areaName,
t3.company_name AS trainingName,
t3.company_code AS trainingCode
FROM
class_dict t2
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
LEFT JOIN course_dict t4 ON t2.course_id = t4.id
LEFT JOIN course_content t5 ON t4.id = t5.course_id
LEFT JOIN content_vod_mapping t6 ON t5.id = t6.content_id
LEFT JOIN vod_dict t7 ON t6.vod_id = t7.id
WHERE
t2.id = #{classId}
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
AND t7.delete_date IS NULL
</select>
<select id="classMembers" parameterType="long" resultType="com.subsidy.vo.renshe.MemberVO">
SELECT
t2.user_name as name,
t2.telephone as phone,
t2.id_card as identity
FROM
class_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
AND t2.delete_date IS NULL
</select>
<select id="classChapters" parameterType="long" resultType="com.subsidy.dto.renshe.ChapterList2">
SELECT
t7.id AS chapterCode,
IFNULL( t6.vod_alias_name, t7.vod_name ) as chapterName,
ROUND( t7.vod_length / 60 ) as chapterTime,
0 as isExam,
120 as examTime
FROM
class_dict t2
LEFT JOIN course_dict t4 ON t2.course_id = t4.id
LEFT JOIN course_content t5 ON t4.id = t5.course_id
LEFT JOIN content_vod_mapping t6 ON t5.id = t6.content_id
LEFT JOIN vod_dict t7 ON t6.vod_id = t7.id
WHERE
t2.id = #{classId}
AND t2.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
AND t7.delete_date IS NULL
ORDER BY
t5.order_no,
t6.order_no,
t7.order_no
</select>
<select id="newClasses" resultType="long">
SELECT DISTINCT
t1.id
FROM
class_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
and t1.class_code is not NULL
</select>
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
SELECT
t2.class_id as downCode,
t2.member_id,
t4.user_name as studentName,
t4.telephone as phone,
t4.id_card as identity,
t2.learnTime,
t2.playTime,
t5.loginTime
FROM
(
SELECT
t1.class_id,
t1.member_id,
sum( t1.play_length ) AS learnTime,
sum( t1.play_length + t1.suspend_length ) AS playTime
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
GROUP BY
t1.class_id,
t1.member_id
) t2
LEFT JOIN class_dict t3 ON t2.class_id = t3.id
LEFT JOIN member t4 ON t2.member_id = t4.id
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登出"
AND result = 1
GROUP BY user_id
) t3
LEFT JOIN (
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登录"
AND result = 1
GROUP BY user_id
) t2 ON t3.user_id = t2.user_id
) t5 ON t4.id = t5.user_id
</select>
<select id="dailyActivities" resultType="com.subsidy.vo.renshe.DailyActivitiesVO">
SELECT
t1.`status` as access,
unix_timestamp( t1.create_date )*1000 as activityTime
FROM
activity_detection t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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">
SELECT
t1.result AS access,
UNIX_TIMESTAMP( t1.create_date )* 1000 AS activityTime
FROM
image_check_record t1
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 NOT NULL
AND t1.member_id=#{memberId}
</select>
<select id="dailyStayLength" parameterType="long" resultType="long">
SELECT
login - logout
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND t1.user_id = #{memberId}
AND opr_type = "登出"
AND result = 1
) t3
LEFT JOIN (
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND t1.user_id = #{memberId}
AND opr_type = "登录"
AND result = 1
) t2 ON t3.user_id = t2.user_id
</select>
<select id="loginRecords" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
*
FROM
opr_mem_dict t
WHERE
user_id = #{memberId}
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登录"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
</select>
<select id="loginOutRecords" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
*
FROM
opr_mem_dict t
WHERE
user_id = #{memberId}
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登出"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
</select>
<select id="dailyStudyRecords" resultType="com.subsidy.dto.renshe.ChapterList3">
SELECT
t2.id as chapterCode,
t.play_length AS chapterTime,
t.play_length + t.suspend_length AS pauseTime,
unix_timestamp(subdate( t.create_date, INTERVAL t.play_length SECOND ))*1000 AS startTime,
unix_timestamp(t.create_date)*1000 AS endTime
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%s' )
AND DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%s' )
and t.class_id = #{classId}
</select>
<select id="dailyExamBasic" resultType="com.subsidy.vo.renshe.DailyExamBasicVO">
SELECT
t3.id as downCode,
t2.id as memberId,
t3.class_code,
t2.user_name AS studentName,
t2.telephone AS phone,
t2.id_card AS identity,
IF
( t1.result = "合格", 0, 1 ) AS access,
unix_timestamp( t1.create_date )- unix_timestamp( t1.start_date ) AS examTime
FROM
exercise_done_result t1
LEFT JOIN member t2 ON t1.member_id = t2.id
LEFT JOIN class_dict t3 ON t1.class_id = t3.id
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
</select>
<select id="classVodName" parameterType="string" resultType="string">
SELECT
t7.id AS chapterCode
FROM
class_dict t2
LEFT JOIN course_dict t4 ON t2.course_id = t4.id
LEFT JOIN course_content t5 ON t4.id = t5.course_id
LEFT JOIN content_vod_mapping t6 ON t5.id = t6.content_id
LEFT JOIN vod_dict t7 ON t6.vod_id = t7.id
WHERE
t2.id = #{classId}
AND t2.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
AND t6.delete_date IS NULL
AND t7.delete_date IS NULL
ORDER BY
t5.order_no desc,
t6.order_no desc,
t7.order_no desc
limit 1
</select>
<select id="dailyExerciseDone" resultType="com.subsidy.model.ExerciseDoneResultDO">
SELECT
*
FROM
exercise_done_result t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m-%d %H:%i:%s' )
AND DATE_FORMAT(#{endDate}, '%Y-%m-%d %H:%i:%s' )
</select>
<select id="dailyAnswer" resultType="com.subsidy.vo.renshe.DailyAnswerVO">
SELECT
t1.id,
t1.ask_id,
t2.id AS downCode,
t3.id_card AS identity,
UNIX_TIMESTAMP( t1.create_date )*1000 AS answer,
UNIX_TIMESTAMP( t1.update_date )*1000 AS question
FROM
answering_question t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
LEFT JOIN member t3 ON t1.ask_id = t3.id
WHERE
DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
</select>
<select id="checkClassIds" resultType="long">
SELECT
distinct class_id
FROM
class_member_mapping
WHERE
delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
</select>
<select id="classImageChecks" parameterType="long" resultType="com.subsidy.vo.renshe.ClassImageChecksVO">
SELECT
t1.member_id,
t1.photo AS image,
t2.telephone AS phone,
t2.user_name AS studentName,
t2.id_card AS identity,
UNIX_TIMESTAMP( t1.update_date)*1000 AS activityTime
FROM
class_member_mapping t1
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
class_id = #{classId}
AND t1.delete_date IS NULL
and t2.delete_date is null
AND DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
</select>
<select id="passExamCheck" parameterType="long" resultType="com.subsidy.vo.renshe.ClassImageChecksVO">
SELECT
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 NOT NULL
AND t1.result = 1
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RenshejuHistoryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.RenshejuHistoryDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="interface_name" property="interfaceName" />
<result column="input_param" property="inputParam" />
<result column="output_param" property="outputParam" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, interface_name, input_param, output_param
</sql>
</mapper>
......@@ -399,6 +399,18 @@
t.create_date
</select>
<!-- <select id="memberLatestRecord" parameterType="long" resultType="long">-->
<!-- SELECT-->
<!-- t.id-->
<!-- FROM-->
<!-- vod_play_history t-->
<!-- WHERE-->
<!-- t.member_id = #{memberId}-->
<!-- ORDER BY-->
<!-- t.create_date DESC-->
<!-- LIMIT 1-->
<!-- </select>-->
<select id="getStudyTotal" resultType="java.lang.Double">
SELECT
sum( play_length )
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!