Commit 7944d5ce by 涂亚平

补贴培训第一次上课

1 parent 2174a9b2
Showing with 2123 additions and 557 deletions
......@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController;
@RestController
......@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableScheduling
//@EnableCaching
@EnableAsync
@EnableTransactionManagement
public class MeishuApplication {
public static void main(String[] args) {
......
......@@ -57,9 +57,6 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired
private MemberTokensMapper memberTokensMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Override
@CrossOrigin()
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
......@@ -102,11 +99,11 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
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);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登出");
// oprMemDictDO.setResult(1);
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(17001);
}
}
......
......@@ -7,22 +7,13 @@ import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.*;
import com.subsidy.model.*;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.net.InetAddress;
/**
* <p>
* 管理平台用户 前端控制器
......
package com.subsidy.controller;
import com.subsidy.dto.renshe.*;
import com.subsidy.service.DudaoService;
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("/dudao")
public class DuDaoController {
@Autowired
private DudaoService dudaoService;
@PostMapping("classBaseInfo")
@ApiOperation("POST-1:班级基本信息信息采集接口")
public RensheResponseVO classBaseInfo() throws IOException {
return dudaoService.classBaseInfo();
}
@PostMapping("classHourBehavior")
@ApiOperation("POST-2:学时信息采集接口")
public RensheResponseVO classHourBehavior() throws IOException {
return dudaoService.classHourBehavior();
}
@PostMapping("uploadChapterBehavior")
@ApiOperation("POST-3:考试信息采集接口")
public RensheResponseVO uploadChapterBehavior() throws IOException {
return dudaoService.uploadChapterBehavior();
}
@PostMapping("uploadClassAnswerQuestionBehavior")
@ApiOperation("POST-4:答疑辅导采集接口")
public RensheResponseVO uploadClassAnswerQuestionBehavior() throws IOException {
return dudaoService.uploadClassAnswerQuestionBehavior();
}
@PostMapping("uploadClassCode")
@ApiOperation("POST-5: 上下游班级数据绑定接口")
public RensheResponseVO uploadClassCode()throws IOException {
return dudaoService.uploadClassCode();
}
}
......@@ -60,7 +60,7 @@ public class ExerciseDictController {
@PostMapping("submit")
@ApiOperation("提交答案 {paperId 卷子id l length memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] startDate:做题时长} ")
@LoginRequired
// @LoginRequired
@TimeRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#submitDTO.getClassId()")
public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
......
......@@ -122,7 +122,7 @@ public class MemberController {
@PostMapping("myCertCourses")
@ApiOperation("手机端:我的学习--证书课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
// @LoginRequired
@LoginRequired
@TimeRequired
public ResponseVO myCertCourses(@RequestBody MyCoursesDTO myCoursesDTO){
return ResponseData.generateCreatedResponse(0,memberService.myCertCourses(myCoursesDTO));
......@@ -223,13 +223,13 @@ public class MemberController {
return memberService.polyvInfo(userid,channelId,ts,token);
}
@RequestMapping("logout")
@ApiOperation("登出 学生id")
@TimeRequired
public ResponseVO logout(@RequestBody String param){
MemberDO memberDO = JSON.parseObject(param, MemberDO.class);
return ResponseData.generateCreatedResponse(0,memberService.logout(memberDO));
}
// @RequestMapping("logout")
// @ApiOperation("登出 学生id")
// @TimeRequired
// public ResponseVO logout(@RequestBody String param){
// MemberDO memberDO = JSON.parseObject(param, MemberDO.class);
// return ResponseData.generateCreatedResponse(0,memberService.logout(memberDO));
// }
......
package com.subsidy.controller;
import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.PutObjectRequest;
import com.aliyun.oss.model.PutObjectResult;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.*;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.vo.oss.GetSecretVO;
......@@ -17,6 +18,12 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "oss")
@RestController
@RequestMapping("/oss")
......@@ -40,40 +47,183 @@ public class OssController {
return ResponseData.generateCreatedResponse(0, getSecretVO);
}
// @PostMapping("uploadFile")
// @ApiOperation("上传文件 file")
// public ResponseVO uploadFile(@RequestParam("file") MultipartFile file) {
// // 创建OSSClient实例。
// OSS ossClient = new OSSClientBuilder().build("http://oss-cn-shanghai.aliyuncs.com", keyId, secret);
// UploadFileVO uploadFileVO = new UploadFileVO();
// try {
//
// if (env.equals("test")) {
// env = "ykhl-bigger-test";
// }
// if (env.equals("prod")) {
// env = "ykhl-bigger";
// }
//
//
// // 创建PutObjectRequest对象。
// PutObjectRequest putObjectRequest = new PutObjectRequest(env, System.currentTimeMillis() + "_" + file.getOriginalFilename(), file.getInputStream());
// // 设置该属性可以返回response。如果不设置,则返回的response为空。
// putObjectRequest.setProcess("true");
// // 创建PutObject请求。
// PutObjectResult result = ossClient.putObject(putObjectRequest);
// // 如果上传成功,则返回200。
//// System.out.println(result.getResponse().getUri());
// uploadFileVO.setUrl(result.getResponse().getUri());
// } catch (Exception oe) {
// oe.printStackTrace();
// } finally {
// if (ossClient != null) {
// ossClient.shutdown();
// }
// }
// return ResponseData.generateCreatedResponse(0, uploadFileVO);
// }
@PostMapping("uploadFile")
@ApiOperation("上传文件 file")
public ResponseVO uploadFile(@RequestParam("file") MultipartFile file) {
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build("http://oss-cn-shanghai.aliyuncs.com", keyId, secret);
@ApiOperation("分片上传")
public ResponseVO fenpian(@RequestParam("file") MultipartFile file) {
UploadFileVO uploadFileVO = new UploadFileVO();
// Endpoint以华东1(杭州)为例,其它Region请按实际情况填写。
String endpoint = "http://oss-cn-beijing.aliyuncs.com";
// 阿里云账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM用户进行API访问或日常运维,请登录RAM控制台创建RAM用户。
String accessKeyId = keyId;
String accessKeySecret = secret;
// 填写Bucket名称,例如examplebucket。
// String bucketName = "zhongzhi-cms";
// 填写Object完整路径,例如exampledir/exampleobject.txt。Object完整路径中不能包含Bucket名称。
String objectName = System.currentTimeMillis() + "_" + file.getOriginalFilename();
// 创建OSSClient实例。
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
if (env.equals("dev")) {
env = "ykhl-bigger-test";
}
if (env.equals("prod")) {
env = "ykhl-bigger";
}
try {
// 创建InitiateMultipartUploadRequest对象。
InitiateMultipartUploadRequest request = new InitiateMultipartUploadRequest(env, objectName);
// 如果需要在初始化分片时设置请求头,请参考以下示例代码。
// ObjectMetadata metadata = new ObjectMetadata();
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard.toString());
// 指定该Object的网页缓存行为。
// metadata.setCacheControl("no-cache");
// 指定该Object被下载时的名称。
// metadata.setContentDisposition("attachment;filename=oss_MultipartUpload.txt");
// 指定该Object的内容编码格式。
// metadata.setContentEncoding(OSSConstants.DEFAULT_CHARSET_NAME);
// 指定初始化分片上传时是否覆盖同名Object。此处设置为true,表示禁止覆盖同名Object。
// metadata.setHeader("x-oss-forbid-overwrite", "true");
// 指定上传该Object的每个part时使用的服务器端加密方式。
// metadata.setHeader(OSSHeaders.OSS_SERVER_SIDE_ENCRYPTION, ObjectMetadata.KMS_SERVER_SIDE_ENCRYPTION);
// 指定Object的加密算法。如果未指定此选项,表明Object使用AES256加密算法。
// metadata.setHeader(OSSHeaders.OSS_SERVER_SIDE_DATA_ENCRYPTION, ObjectMetadata.KMS_SERVER_SIDE_ENCRYPTION);
// 指定KMS托管的用户主密钥。
// metadata.setHeader(OSSHeaders.OSS_SERVER_SIDE_ENCRYPTION_KEY_ID, "9468da86-3509-4f8d-a61e-6eab1eac****");
// 指定Object的存储类型。
// metadata.setHeader(OSSHeaders.OSS_STORAGE_CLASS, StorageClass.Standard);
// 指定Object的对象标签,可同时设置多个标签。
// metadata.setHeader(OSSHeaders.OSS_TAGGING, "a:1");
// request.setObjectMetadata(metadata);
// 初始化分片。
InitiateMultipartUploadResult upresult = ossClient.initiateMultipartUpload(request);
// 返回uploadId,它是分片上传事件的唯一标识。您可以根据该uploadId发起相关的操作,例如取消分片上传、查询分片上传等。
String uploadId = upresult.getUploadId();
if (env.equals("test")) {
env = "ykhl-bigger-test";
// partETags是PartETag的集合。PartETag由分片的ETag和分片号组成。
List<PartETag> partETags = new ArrayList<PartETag>();
// 每个分片的大小,用于计算文件有多少个分片。单位为字节。
final long partSize = 1 * 1024 * 1024L; //1 MB。
// 根据上传的数据大小计算分片数。以本地文件为例,说明如何通过File.length()获取上传数据的大小。
// final File sampleFile = new File("D:\\localpath\\examplefile.txt");
// long fileLength = sampleFile.length();
// int partCount = (int) (fileLength / partSize);
// if (fileLength % partSize != 0) {
// partCount++;
// }
long fileLength = file.getSize();
int partCount = (int) (fileLength / partSize);
if (fileLength % partSize != 0) {
partCount++;
}
if (env.equals("prod")) {
env = "ykhl-bigger";
// 遍历分片上传。
for (int i = 0; i < partCount; i++) {
long startPos = i * partSize;
long curPartSize = (i + 1 == partCount) ? (fileLength - startPos) : partSize;
UploadPartRequest uploadPartRequest = new UploadPartRequest();
uploadPartRequest.setBucketName(env);
uploadPartRequest.setKey(objectName);
uploadPartRequest.setUploadId(uploadId);
// 设置上传的分片流。
// 以本地文件为例说明如何创建FIleInputstream,并通过InputStream.skip()方法跳过指定数据。
InputStream instream = file.getInputStream();
instream.skip(startPos);
uploadPartRequest.setInputStream(instream);
// 设置分片大小。除了最后一个分片没有大小限制,其他的分片最小为100 KB。
uploadPartRequest.setPartSize(curPartSize);
// 设置分片号。每一个上传的分片都有一个分片号,取值范围是1~10000,如果超出此范围,OSS将返回InvalidArgument错误码。
uploadPartRequest.setPartNumber(i + 1);
// 每个分片不需要按顺序上传,甚至可以在不同客户端上传,OSS会按照分片号排序组成完整的文件。
UploadPartResult uploadPartResult = ossClient.uploadPart(uploadPartRequest);
// 每次上传分片之后,OSS的返回结果包含PartETag。PartETag将被保存在partETags中。
partETags.add(uploadPartResult.getPartETag());
}
// 创建PutObjectRequest对象。
PutObjectRequest putObjectRequest = new PutObjectRequest(env, System.currentTimeMillis() + "_" + file.getOriginalFilename(), file.getInputStream());
// 设置该属性可以返回response。如果不设置,则返回的response为空。
putObjectRequest.setProcess("true");
// 创建PutObject请求。
PutObjectResult result = ossClient.putObject(putObjectRequest);
// 如果上传成功,则返回200。
// System.out.println(result.getResponse().getUri());
uploadFileVO.setUrl(result.getResponse().getUri());
} catch (Exception oe) {
oe.printStackTrace();
// 创建CompleteMultipartUploadRequest对象。
// 在执行完成分片上传操作时,需要提供所有有效的partETags。OSS收到提交的partETags后,会逐一验证每个分片的有效性。当所有的数据分片验证通过后,OSS将把这些分片组合成一个完整的文件。
CompleteMultipartUploadRequest completeMultipartUploadRequest =
new CompleteMultipartUploadRequest(env, objectName, uploadId, partETags);
// 如果需要在完成分片上传的同时设置文件访问权限,请参考以下示例代码。
// completeMultipartUploadRequest.setObjectACL(CannedAccessControlList.Private);
// 指定是否列举当前UploadId已上传的所有Part。仅在Java SDK为3.14.0及以上版本时,支持通过服务端List分片数据来合并完整文件时,将CompleteMultipartUploadRequest中的partETags设置为null。
// Map<String, String> headers = new HashMap<String, String>();
// 如果指定了x-oss-complete-all:yes,则OSS会列举当前UploadId已上传的所有Part,然后按照PartNumber的序号排序并执行CompleteMultipartUpload操作。
// 如果指定了x-oss-complete-all:yes,则不允许继续指定body,否则报错。
// headers.put("x-oss-complete-all","yes");
// completeMultipartUploadRequest.setHeaders(headers);
// 完成分片上传。
CompleteMultipartUploadResult completeMultipartUploadResult = ossClient.completeMultipartUpload(completeMultipartUploadRequest);
uploadFileVO.setUrl(completeMultipartUploadResult.getLocation());
System.out.println(completeMultipartUploadResult.getLocation());
} catch (OSSException oe) {
System.out.println("Caught an OSSException, which means your request made it to OSS, "
+ "but was rejected with an error response for some reason.");
System.out.println("Error Message:" + oe.getErrorMessage());
System.out.println("Error Code:" + oe.getErrorCode());
System.out.println("Request ID:" + oe.getRequestId());
System.out.println("Host ID:" + oe.getHostId());
} catch (ClientException ce) {
System.out.println("Caught an ClientException, which means the client encountered "
+ "a serious internal problem while trying to communicate with OSS, "
+ "such as not being able to access the network.");
System.out.println("Error Message:" + ce.getMessage());
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (ossClient != null) {
ossClient.shutdown();
}
}
return ResponseData.generateCreatedResponse(0, uploadFileVO);
}
}
......@@ -48,6 +48,7 @@ public class VodPlayHistoryController {
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired
// @LoginRequired
public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO));
......@@ -55,7 +56,7 @@ public class VodPlayHistoryController {
@PostMapping("dataFix")
@ApiOperation("每个视频都看一次")
// @LoginRequired
@LoginRequired
public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){
vodPlayHistoryService.dataFix(dataFixDTO);
}
......
//package com.subsidy.jobs;
//
//import com.subsidy.service.DudaoService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.io.IOException;
//
///**
// * 企业职工线上培训
// */
//@Component
//public class DudaoJob {
//
//
// @Autowired
// private DudaoService dudaoService;
//
// @Scheduled(cron = "0 0 2 * * ?")
// public void classBaseInfo() throws IOException {
// dudaoService.classBaseInfo();
// }
//
// @Scheduled(cron = "0 5 2 * * ?")
// public void classHourBehavior() throws IOException {
// dudaoService.classHourBehavior();
// }
//
// @Scheduled(cron = "0 10 2 * * ?")
// public void uploadChapterBehavior() throws IOException {
// dudaoService.uploadChapterBehavior();
// }
//
// @Scheduled(cron = "0 15 2 * * ?")
// public void uploadClassAnswerQuestionBehavior() throws IOException {
// dudaoService.uploadClassAnswerQuestionBehavior();
// }
//
// @Scheduled(cron = "0 20 2 * * ?")
// public void uploadClassCode()throws IOException {
// dudaoService.uploadClassCode();
// }
//
//}
......@@ -5,19 +5,25 @@ import com.subsidy.common.ResponseData;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.service.RenSheJuService;
import com.subsidy.util.IpAddressUtil;
import com.subsidy.util.websocket.WebSocketUtil;
import com.subsidy.vo.opr.InsertLastStudyRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
/**
* 企业职工线上培训
* 企业职工线上培训
*/
@Component
public class RenSheJuJob {
......@@ -30,10 +36,10 @@ public class RenSheJuJob {
private OprMemDictMapper oprMemDictMapper;
/**
* POST-2:班级基本信息信息采集接口
* POST-2:班级基本信息信息采集接口
*/
@Scheduled(cron = "0 0 1 * * ?")
public void classBaseInfo()throws IOException {
public void classBaseInfo() throws IOException {
renSheJuService.classBaseInfo();
}
......@@ -65,7 +71,7 @@ public class RenSheJuJob {
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
@Scheduled(cron = "0 20 1 * * ?")
public void uploadImage()throws IOException {
public void uploadImage() throws IOException {
renSheJuService.uploadImage();
}
......@@ -73,7 +79,7 @@ public class RenSheJuJob {
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 25 1 * * ?")
public void getClassCodeByPrivateKey()throws IOException {
public void getClassCodeByPrivateKey() throws IOException {
renSheJuService.getClassCodeByPrivateKey();
}
......@@ -81,7 +87,7 @@ public class RenSheJuJob {
* POST-8 上下游班级数据绑定接口
*/
@Scheduled(cron = "0 30 1 * * ?")
public void uploadClassCode()throws IOException {
public void uploadClassCode() throws IOException {
renSheJuService.uploadClassCode();
}
......@@ -93,26 +99,72 @@ public class RenSheJuJob {
// renSheJuService.getErrorClass();
// }
@Scheduled(cron = "00 58 23 * * ?")
public void cancelLogin(){
@Scheduled(cron = "00 50 23 * * ?")
@Transactional(rollbackFor = Exception.class)
public void logout(){
//让当前用户下线
ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
List<Long> onLineUsers = oprMemDictMapper.onlineUsers();
//查看当天登录过的人最后一次活跃数据
List<InsertLastStudyRecordVO> insertLastStudyRecordVOS = oprMemDictMapper.insertLastStudyRecord();
for (InsertLastStudyRecordVO ilsr : insertLastStudyRecordVOS) {
for (Long key : onLineUsers){
try {
if (null != webSocketMap.get(key)){
webSocketMap.get(key).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001))));
if (null != webSocketMap.get(ilsr.getMemberId())) {
webSocketMap.get(ilsr.getMemberId()).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001))));
}
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setResult(1);
oprMemDictDO.setOprType("登出");
oprMemDictDO.setUserId(key);
oprMemDictMapper.insert(oprMemDictDO);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
}
}
}
@Scheduled(cron = "00 55 23 * * ?")
@Transactional(rollbackFor = Exception.class)
public void cancelLogin() {
//让当前用户下线
// ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap;
//查看当天登录过的人最后一次活跃数据
List<InsertLastStudyRecordVO> insertLastStudyRecordVOS = oprMemDictMapper.insertLastStudyRecord();
for (InsertLastStudyRecordVO ilsr : insertLastStudyRecordVOS) {
oprMemDictMapper.insertOrUpdate(ilsr.getMemberId(),"登录",1, ilsr.getIpAddress(),ilsr.getSignInDate());
if (null == ilsr.getMt()) {
//补23:58的数据
oprMemDictMapper.insertOrUpdate(ilsr.getMemberId(),"登出",1,null,new Date());
} else {
//最后一次学习的数据
oprMemDictMapper.insertOrUpdate(ilsr.getMemberId(), "登出", 1, null, ilsr.getMt());
}
}
// List<Long> shutdownUsers = oprMemDictMapper.shutdownUser();
// for (Long key : shutdownUsers) {
// try {
// if (!onLineUsers.contains(key)) {
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(key);
// if (null != oprMemDictDO) {
// if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) {
// oprMemDictMapper.deleteById(oprMemDictDO.getId());
// }
// }
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime time = LocalDateTime.now();
// String localDateTime = df.format(time);
// LocalDateTime ldt = LocalDateTime.parse(localDateTime, df);
// oprMemDictDO.setCreateDate(ldt);
// oprMemDictMapper.insertOrUpdate(key, "登出", 1, null, ldt);
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
}
}
......@@ -14,55 +14,55 @@ import java.io.IOException;
public class ShehuihuaJob {
@Autowired
private ShehuihuaService shehuihuaService;
/**
* POST-2 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 0 2 * * ?")
public void getClassCodeByPrivateKey()throws IOException {
shehuihuaService.getClassCodeByPrivateKey();
}
/**
* POST-3:班级基本信息信息采集接口
*/
@Scheduled(cron = "0 5 2 * * ?")
public void uploadClass() throws IOException {
shehuihuaService.uploadClass();
}
/**
* POST-4:考试信息采集接口
*/
@Scheduled(cron = "0 10 2 * * ?")
public void classHourBehavior() throws IOException {
shehuihuaService.classHourBehavior();
}
/**
* POST-5:答疑辅导采集接口
*/
@Scheduled(cron = "0 15 2 * * ?")
public void uploadChapterBehavior() throws IOException {
shehuihuaService.uploadChapterBehavior();
}
/**
* POST-6 班级活跃度/实名认证照片信息采集接口
*/
@Scheduled(cron = "0 20 2 * * ?")
public void uploadClassAnswerQuestionBehavior()throws IOException {
shehuihuaService.uploadClassAnswerQuestionBehavior();
}
/**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/
@Scheduled(cron = "0 25 2 * * ?")
public void uploadImage()throws IOException {
shehuihuaService.uploadImage();
}
// @Autowired
// private ShehuihuaService shehuihuaService;
//
// /**
// * POST-2 获取培训待绑定的(班级编号,项目编号)列表
// */
// @Scheduled(cron = "0 0 2 * * ?")
// public void getClassCodeByPrivateKey()throws IOException {
// shehuihuaService.getClassCodeByPrivateKey();
// }
//
// /**
// * POST-3:班级基本信息信息采集接口
// */
// @Scheduled(cron = "0 5 2 * * ?")
// public void uploadClass() throws IOException {
// shehuihuaService.uploadClass();
// }
//
// /**
// * POST-4:考试信息采集接口
// */
// @Scheduled(cron = "0 10 2 * * ?")
// public void classHourBehavior() throws IOException {
// shehuihuaService.classHourBehavior();
// }
//
// /**
// * POST-5:答疑辅导采集接口
// */
// @Scheduled(cron = "0 15 2 * * ?")
// public void uploadChapterBehavior() throws IOException {
// shehuihuaService.uploadChapterBehavior();
// }
//
// /**
// * POST-6 班级活跃度/实名认证照片信息采集接口
// */
// @Scheduled(cron = "0 20 2 * * ?")
// public void uploadClassAnswerQuestionBehavior()throws IOException {
// shehuihuaService.uploadClassAnswerQuestionBehavior();
// }
//
// /**
// * POST-7 获取培训待绑定的(班级编号,项目编号)列表
// */
// @Scheduled(cron = "0 25 2 * * ?")
// public void uploadImage()throws IOException {
// shehuihuaService.uploadImage();
// }
}
package com.subsidy.mapper;
import com.subsidy.vo.renshe.DailyAnswerVO;
import com.subsidy.vo.renshe.DailyStudyInfoVO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface DudaoMapper {
/**
* 产生视频数据的班级
*/
List<Long> vodClassIds(String classType);
/**
* 产生考试数据的班级
*/
List<Long> examClassIds(String classType);
/**
* 答疑数据的班级
*/
List<Long> answerClassIds(String classType);
/**
* 产生人脸识别的班级
*/
List<Long> imageClassIds(String classType);
/**
* 前一天新增视频学习数据
*/
List<DailyStudyInfoVO> dailyStudyInfo(String classType);
/**
* 前一天考试通过数据
*/
List<Long> dailyExamBasic(String classType);
/**
* 找到某人当天答疑的记录
*/
List<DailyAnswerVO> dailyAnswer(String classType);
/**
* 新增班级
*/
List<Long> newClasses(String classType);
}
......@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
import com.subsidy.vo.opr.InsertLastStudyRecordVO;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
/**
......@@ -28,22 +31,30 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
*/
OprMemDictDO getLatestLoginInfo(Long userId);
// /**
// * 当天最后一次登录
// */
// OprMemDictDO getLatestLogoutInfo(Long userId);
// void deleteData(OprMemDictDO oprMemDictDO);
/**
* 当天最后一次登出
*/
OprMemDictDO getLatestLogoutInfo(Long userId);
/**
* 查看当天还在线的用户
*/
List<Long> onlineUsers();
// /**
// * 根据最后一次看视频时间随机去写几秒登出
// */
// void insertLastStudyRecord();
/**
* 根据最后一次看视频时间随机去写几秒登出
*/
List<InsertLastStudyRecordVO> insertLastStudyRecord();
/**
* 查看视频记录晚于最后一次登出的人,补一次11:58登出的记录
*/
List<Long> shutdownUser();
/**
* 防止相同两条数据的插入
*/
void insertOrUpdate(Long userId, String oprType, Integer result, String ipAddress, Date createDate);
}
......@@ -49,8 +49,6 @@ public interface RenSheJuMapper {
*/
List<ExamActivitiesVO> examActivities(Long classId,Long memberId);
/**
* 某人某天累计在线时长
*/
......@@ -74,7 +72,7 @@ public interface RenSheJuMapper {
/**
* 前一天考试通过数据
*/
List<Long> dailyExamBasic();
List<Long> dailyExamBasic(String classType);
/**
* 前一天做过考试通过数据
......@@ -100,7 +98,7 @@ public interface RenSheJuMapper {
/**
* 找到某人当天答疑的记录
*/
List<DailyAnswerVO> dailyAnswer();
List<DailyAnswerVO> dailyAnswer(String classType);
/**
* 查找前一天做过人脸识别的班级
......@@ -127,4 +125,24 @@ public interface RenSheJuMapper {
*/
List<ClassImageChecksVO> examCheck(Long classId);
/**
* 产生视频数据的班级
*/
List<Long> vodClassIds(String classType);
/**
* 产生考试数据的班级
*/
List<Long> examClassIds(String classType);
/**
* 答疑数据的班级
*/
List<Long> answerClassIds(String classType);
/**
* 产生人脸识别的班级
*/
List<Long> imageClassIds(String classType);
}
......@@ -101,6 +101,12 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
// Long memberLatestRecord(Long memberId);
/**
* 插入一条学习数据
*/
void insertPlayRecord(Long classId,Long vodId,Long memberId,Integer playLength,Integer suspendLength,Integer playRecord,Integer playCount,Date createDate);
double getStudyTotal();
double getSubsidyStudyTotal();
......
package com.subsidy.service;
import com.subsidy.dto.renshe.*;
import com.subsidy.vo.renshe.RensheResponseVO;
import java.io.IOException;
public interface DudaoService {
RensheResponseVO classBaseInfo() throws IOException;
RensheResponseVO classHourBehavior() throws IOException;
RensheResponseVO uploadChapterBehavior() throws IOException;
RensheResponseVO uploadClassAnswerQuestionBehavior()throws IOException;
RensheResponseVO uploadClassCode()throws IOException;
}
......@@ -79,5 +79,5 @@ public interface MemberService extends IService<MemberDO> {
PolyvInfoVO polyvInfo(String userid,String channelId,String ts,String token);
String logout(MemberDO memberDO);
// String logout(MemberDO memberDO);
}
package com.subsidy.service;
import com.subsidy.dto.renshe.*;
import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO;
......
......@@ -170,7 +170,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
AdministerDO administerDO = new AdministerDO();
administerDO.setAccountName(addCompanyDTO.getAccountName());
administerDO.setCompanyId(companyDictDO.getId());
administerDO.setPassword("admin123");
administerDO.setPassword("admin321");
administerDO.setStatus("1");
//administerDO.setRole(1);
administerMapper.insert(administerDO);
......
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.*;
import com.subsidy.model.*;
import com.subsidy.service.DudaoService;
import com.subsidy.service.RenSheJuService;
import com.subsidy.util.OSSUtils;
import com.subsidy.util.DudaoConstant;
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.*;
@Service
public class DudaoServiceImpl implements DudaoService {
/**
* 测试环境
*/
public static final String PREFIX_URL = "http://180.167.195.117:18015/ddproject";
@Autowired
private RenSheJuMapper renSheJuMapper;
@Autowired
private ClassDictMapper classDictMapper;
@Autowired
RenshejuHistoryMapper renshejuHistoryMapper;
@Autowired
private DudaoMapper dudaoMapper;
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> vodClassIds = dudaoMapper.vodClassIds("0");
//考试
List<Long> examClassIds = dudaoMapper.examClassIds("0");
//答疑
List<Long> answerClassIds = dudaoMapper.answerClassIds("0");
//人脸识别
List<Long> imageClassIds = dudaoMapper.imageClassIds("0");
Set<Long> classIds = new HashSet<>();
vodClassIds.stream().forEach(x->classIds.add(x));
examClassIds.stream().forEach(x->classIds.add(x));
answerClassIds.stream().forEach(x->classIds.add(x));
imageClassIds.stream().forEach(x->classIds.add(x));
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(PREFIX_URL + "/classbasicinformation/insertClassBasicInformation")
.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(DudaoConstant.POST_1);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
} else {
renshejuHistoryDO.setOutputParam(DudaoConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_1);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_1);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
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<>();
try {
//前一天新增视频学习数据的班级并且是普陀的
List<DailyStudyInfoVO> dailyStudyInfoVOS = dudaoMapper.dailyStudyInfo("0");
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(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
if (chapterList3s.size() > 0) {
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 (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) {
activityList.setAccess(1);
activityList.setErrorInfo(2);
} else {
activityList.setAccess(0);
}
if (0 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(2);
} else if (1 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(1);
}
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));
if (classHourBasics.size()>0){
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/learnduration/insertLearnDuration")
.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(DudaoConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
} else {
renshejuHistoryDO.setOutputParam(DudaoConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
}else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
// return null;
} catch (Exception e) {
e.printStackTrace();
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
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<Long> classIds = dudaoMapper.dailyExamBasic("0");
try {
if (classIds.size() > 0) {
for (Long classId : classIds) {
//具体哪些人做了
List<MemberDO> memberDOList = renSheJuMapper.memberIds(classId);
for (MemberDO memberDO : memberDOList) {
//章节课程考试时间列表
ChapterExamBasic chapterExamBasic = new ChapterExamBasic();
chapterExamBasic.setDownCode(String.valueOf(classId));
//最后一节课作为chapterCode
String vodId = renSheJuMapper.classVodName(classId);
chapterExamBasic.setChapterCode(vodId);
chapterExamBasic.setStudentName(memberDO.getUserName());
chapterExamBasic.setPhone(memberDO.getTelephone());
chapterExamBasic.setIdentity(memberDO.getIdCard());
//考试花了多长时间
Long examLength = renSheJuMapper.examLength(memberDO.getId(), classId);
chapterExamBasic.setExamTime(examLength);
//考试活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<ExamActivitiesVO> activityDetectionDOS = renSheJuMapper.examActivities(classId, memberDO.getId());
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<ExamList> examLists = new ArrayList<>();
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(memberDO.getId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(memberDO.getId());
boolean flag = false;
for (int i = 0; i < loginRecords.size(); i++) {
//找到该时间段内的测评
List<ExerciseDoneResultDO> exerciseDoneResultDOS = renSheJuMapper.dailyExerciseDone(memberDO.getId(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "), classId);
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());
if ("合格".equals(exerciseDoneResultDO.getResult())) {
flag = true;
}
examLists.add(examList);
}
}
if (flag == true) {
chapterExamBasic.setAccess(0L);
} else {
chapterExamBasic.setAccess(1L);
}
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(PREFIX_URL + "/examinformation/insertExamInformation")
.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(DudaoConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
} else {
renshejuHistoryDO.setOutputParam(DudaoConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
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 = dudaoMapper.dailyAnswer("0");
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);
}
}
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(PREFIX_URL + "/answertutor/insertAnswerTutor")
.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(DudaoConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
} else {
renshejuHistoryDO.setOutputParam(DudaoConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_4);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
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 = dudaoMapper.newClasses("0");
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));
try {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadClassCodeDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/bindclass/insertBindClass")
.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(DudaoConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassCodeDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
} else {
renshejuHistoryDO.setOutputParam(DudaoConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} catch (Exception e) {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(DudaoConstant.POST_5);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassCodeDTO).toString());
renshejuHistoryDO.setOutputParam(DudaoConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return null;
}
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", "ykhl65032260")
// .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);
return "ykhl65032260";
}
}
......@@ -3,6 +3,7 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.exercise.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO;
import com.subsidy.mapper.ExerciseDictMapper;
......@@ -20,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
......@@ -39,13 +43,13 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
@Autowired
private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper;
public String addExercise(ExerciseDictDO exerciseDictDO){
public String addExercise(ExerciseDictDO exerciseDictDO) {
Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId());
int orderNo = 1;
if (null!= orderNoTmp) {
if (null != orderNoTmp) {
orderNo = orderNoTmp + 1;
}
exerciseDictDO.setOrderNo(orderNo);
......@@ -70,6 +74,17 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
List<MemberExerciseVO> memberExerciseVOS = submitDTO.getMemberExerciseVOS();
SimpleDateFormat startDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
Date startDate = startDateFormat1.parse(submitDTO.getStartDate());
if (new Date().getTime() - startDate.getTime() < 180 * 1000L) {
throw new HttpException(20003);
}
} catch (ParseException e) {
}
int rightCounts = 0;
for (MemberExerciseVO exerciseVO : memberExerciseVOS) {
......@@ -77,13 +92,12 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())) {
exerciseVO.setResult(1);
rightCounts++;
}else {
} else {
exerciseVO.setResult(0);
}
}
exerciseDoneResultDO.setClassId(submitDTO.getClassId());
exerciseDoneResultDO.setRightCounts(rightCounts);
exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size());
......@@ -94,11 +108,11 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setStartDate(submitDTO.getStartDate());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score);
exerciseDoneResultDO.setResult(score>=60?"合格":"不合格");
exerciseDoneResultDO.setResult(score >= 60 ? "合格" : "不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS){
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS) {
ExerciseDoneHistoryDO exerciseDoneHistoryDO = new ExerciseDoneHistoryDO();
exerciseDoneHistoryDO.setPaperId(submitDTO.getPaperId());
......@@ -116,7 +130,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
public IPage<GetPaperExerciseVO> getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO) {
Page pager = new Page(getPaperExerciseDTO.getPageNum(), getPaperExerciseDTO.getPageSize());
return this.baseMapper.getPaperExercise(pager,getPaperExerciseDTO.getPaperId(),getPaperExerciseDTO.getDifficulty(),getPaperExerciseDTO.getExerciseType(),getPaperExerciseDTO.getTitle());
return this.baseMapper.getPaperExercise(pager, getPaperExerciseDTO.getPaperId(), getPaperExerciseDTO.getDifficulty(), getPaperExerciseDTO.getExerciseType(), getPaperExerciseDTO.getTitle());
}
}
......@@ -41,6 +41,7 @@ import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -92,8 +93,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private CompanyDictMapper companyDictMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
// @Autowired
// private OprMemDictMapper oprMemDictMapper;
@Autowired
private JobDictMapper jobDictMapper;
......@@ -128,6 +129,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private MemberTokensMapper memberTokensMapper;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
......@@ -302,19 +304,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + memberDO.getUserName() + ":" + companyDictDO.getCompanyName() + ":" + LocalDateTime.now(), oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
......@@ -322,11 +317,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
if (0 == memberDO.getFirstLogin()) {
memberDO.setFirstLogin(1);
this.baseMapper.updateById(memberDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
//String code = redisUtil.get(RedisPrefixConstant.SUBSIDY_TELEPHONE_PREFIX + verifyCodeDTO.getTelephone()).toString();
SmsVerifyCodeDO smsCodeDO = smsVerifyCodeMapper.selectOne(new QueryWrapper<SmsVerifyCodeDO>()
.lambda()
.eq(SmsVerifyCodeDO::getTelephone, verifyCodeDTO.getTelephone())
......@@ -334,24 +327,24 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.gt(SmsVerifyCodeDO::getCreateDate, LocalDateTime.now().minusMinutes(30L)));
if (null == smsCodeDO || !verifyCodeDTO.getVerifyCode().equals(smsCodeDO.getVerifyCode())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(70010);
}
//审计日志
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
//mongoTemplate.insert(oprMemDictDO);
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
......@@ -364,21 +357,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
//redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token);
Localstorage.setUser(memberDO);
userRoleVO.setToken(token);
return userRoleVO;
}
public MemberVO passwordLogin(PasswordLoginDTO passwordLoginDTO, HttpServletRequest request) {
/**
* 先从redis里查
*/
//MemberDO memberDO = (MemberDO) redisUtil.get(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + passwordLoginDTO.getCompanyId() + ":" + passwordLoginDTO.getAccountName());
MemberDO memberDO = null;
if (null == memberDO) {
/**
* redis里没有,从数据库里查
* 从数据库里查
*/
memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
......@@ -396,15 +385,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName());
memberVO.setQxyStatus(companyDictDO.getQxyStatus());
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setSuperviseName(companyDictDO.getSuperviseName());
memberVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -434,36 +423,22 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return memberVO;
} else {
if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10016);
}
if (0 == memberDO.getFirstLogin()) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
//oprMemDictDO.setUserName(memberDO.getUserName());
//oprMemDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprMemDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprMemDictDO.setCompanyName(companyDictDO.getCompanyName());
//oprMemDictDO.setCompanyId(companyDictDO.getId());
//mongoTemplate.insert(oprMemDictDO);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
//redisUtil.set(RedisPrefixConstant.SUBSIDY_MEMBER_LOGIN_PREFIX + memberDO.getId() + ":" + System.currentTimeMillis(), 0);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10015);
}
......@@ -495,12 +470,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14002);
}
......@@ -526,48 +501,40 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14001);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
// //是否登陆过 1:是 0:否
// if (0 == memberDO.getFirstLogin()) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// throw new HttpException(10015);
// }
throw new HttpException(10013);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -578,7 +545,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
// redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token);
userRoleVO.setToken(token);
return userRoleVO;
}
......@@ -601,12 +567,12 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14002);
}
......@@ -620,48 +586,39 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14001);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
// //是否登陆过 1:是 0:否
// if (0 == memberDO.getFirstLogin()) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// throw new HttpException(10015);
// }
throw new HttpException(10013);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
}
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -672,7 +629,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
// redisUtil.set(ConstantUtils.MOBILE_TERMINATE + "_" + memberDO.getId(), token);
userRoleVO.setToken(token);
return userRoleVO;
}
......@@ -682,22 +638,22 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
CheckStatusVO checkStatusVO = new CheckStatusVO();
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
if (StringUtils.isEmpty(memberDO1.getCheckImage())) {
checkStatusVO.setImageStatus(false);
} else {
checkStatusVO.setImageStatus(true);
}
if (memberDO1.getFirstLogin() == 1) {
checkStatusVO.setSMSStatus(true);
} else {
checkStatusVO.setSMSStatus(false);
}
if (StringUtils.isEmpty(memberDO1.getIdCardPhoto())) {
checkStatusVO.setIdCardStatus(false);
} else {
Integer count = imageCheckRecordMapper.selectCount(new QueryWrapper<ImageCheckRecordDO>()
.lambda()
.eq(ImageCheckRecordDO::getMemberId, memberDO.getId()));
if (count >0){
checkStatusVO.setIdCardStatus(true);
checkStatusVO.setImageStatus(true);
}else {
checkStatusVO.setImageStatus(false);
checkStatusVO.setIdCardStatus(false);
}
return checkStatusVO;
......@@ -1108,13 +1064,13 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
this.baseMapper.insert(memberDO);
//审计日志
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
//oprMemDictDO.setUserName(memberDO.getUserName());
oprMemDictDO.setResult(1);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// //oprMemDictDO.setUserName(memberDO.getUserName());
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
CompanyDictDO companyDictDO = companyDictMapper.selectById(registerDTO.getCompanyId());
BeanUtils.copyProperties(memberDO, userRoleVO);
......@@ -1157,24 +1113,32 @@ 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()
.eq(MemberTokensDO::getMemberId, memberDO.getId()));
OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// @Transactional(rollbackFor = Exception.class)
// public String logout(MemberDO memberDO) {
// memberTokensMapper.delete(new QueryWrapper<MemberTokensDO>()
// .lambda()
// .eq(MemberTokensDO::getMemberId, memberDO.getId()));
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
//
// if (null != oprMemDictDO){
// if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) {
// oprMemDictMapper.deleteById(oprMemDictDO.getId());
//// oprMemDictMapper.deleteData(oprMemDictDO);
// }
// }
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setResult(1);
// oprMemDictDO.setOprType("登出");
//
// DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// LocalDateTime time = LocalDateTime.now();
// String localDateTime = df.format(time);
// LocalDateTime ldt = LocalDateTime.parse(localDateTime, df);
// oprMemDictMapper.insertOrUpdate(oprMemDictDO.getUserId(),oprMemDictDO.getOprType(),oprMemDictDO.getResult(),oprMemDictDO.getIpAddress(),ldt);
// return ConstantUtils.ADD_SUCCESS;
// }
if (null != oprMemDictDO){
if (oprMemDictDO.getResult() == 1 && "登出".equals(oprMemDictDO.getOprType())) {
oprMemDictMapper.deleteById(oprMemDictDO.getId());
// oprMemDictMapper.deleteData(oprMemDictDO);
}
}
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setResult(1);
oprMemDictDO.setOprType("登出");
oprMemDictMapper.insert(oprMemDictDO);
return ConstantUtils.ADD_SUCCESS;
}
}
......@@ -23,9 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.*;
@Service
public class RenSheJuServiceImpl implements RenSheJuService {
......@@ -59,7 +57,25 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<EpidemicSituationClassBasic> epidemicSituationClassBasics = new ArrayList<>();
//查找前一天产生数据的班级
List<Long> classIds = renSheJuMapper.newClasses("0");
//看视频
List<Long> vodClassIds = renSheJuMapper.vodClassIds("0");
//考试
List<Long> examClassIds = renSheJuMapper.examClassIds("0");
//答疑
List<Long> answerClassIds = renSheJuMapper.answerClassIds("0");
//人脸识别
List<Long> imageClassIds = renSheJuMapper.imageClassIds("0");
Set<Long> classIds = new HashSet<>();
vodClassIds.stream().forEach(x->classIds.add(x));
examClassIds.stream().forEach(x->classIds.add(x));
answerClassIds.stream().forEach(x->classIds.add(x));
imageClassIds.stream().forEach(x->classIds.add(x));
try {
if (classIds.size() > 0) {
......@@ -87,26 +103,25 @@ public class RenSheJuServiceImpl implements RenSheJuService {
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;
return null;
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);
......@@ -175,11 +190,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
ActivityList activityList = new ActivityList();
if (dailyActivitiesVO.getAccess() == 1) {
activityList.setAccess(0);
} else {
if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) {
activityList.setAccess(1);
activityList.setErrorInfo(2);
} else {
activityList.setAccess(0);
}
if (0 == dailyActivitiesVO.getCheckType()) {
......@@ -199,27 +214,36 @@ public class RenSheJuServiceImpl implements RenSheJuService {
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
if (classHourBasics.size()>0){
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);
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);
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;
}else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} catch (Exception e) {
e.printStackTrace();
......@@ -245,7 +269,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<ChapterExamBasic> chapterExamBasics = new ArrayList<>();
//找出前一天产生考试数据的班级
List<Long> classIds = renSheJuMapper.dailyExamBasic();
List<Long> classIds = renSheJuMapper.dailyExamBasic("0");
try {
if (classIds.size() > 0) {
......@@ -349,7 +373,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryMapper.insert(renshejuHistoryDO);
}
return rensheResponseVO;
// return null;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_4);
......@@ -379,7 +402,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
//秘钥
uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret());
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer();
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer("0");
try {
if (dailyAnswerVOS.size() > 0) {
......@@ -426,7 +449,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.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());
......@@ -438,7 +461,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_5);
......@@ -503,7 +525,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
imageDetailLists.add(imageDetailList);
}
}
/**
......@@ -543,7 +564,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
renshejuHistoryMapper.insert(renshejuHistoryDO);
rensheResponseVOS.add(rensheResponseVO);
System.out.println(111);
} else {
RenshejuHistoryDO renshejuHistoryDO1 = new RenshejuHistoryDO();
renshejuHistoryDO1.setInterfaceName(RenSheJuConstant.POST_6);
......@@ -569,14 +589,14 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
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)")
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
......@@ -615,9 +635,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
uploadClassCodeDTO.setPrivateKey(getSecret());
//所有班级
// List<Long> classIds = renSheJuMapper.newClasses("0");
List<Long> classIds = new ArrayList<Long>();
classIds.add(404L);
List<Long> classIds = renSheJuMapper.newClasses("0");
List<ClassCodeBasic> classCodeBasics = new ArrayList<ClassCodeBasic>();
for (Long classId : classIds) {
......@@ -667,14 +685,13 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
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)")
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
......@@ -704,14 +721,14 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
// MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
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)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class);
......
......@@ -47,14 +47,14 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/getClassCodeByPrivateKey")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
......@@ -285,7 +285,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
List<ChapterExamBasic5> chapterExamBasics = new ArrayList<>();
//找出前一天产生考试数据的班级
List<Long> classIds = renSheJuMapper.dailyExamBasic();
List<Long> classIds = renSheJuMapper.dailyExamBasic("1");
try {
if (classIds.size() > 0) {
......@@ -419,7 +419,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
//秘钥
uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret());
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer();
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer("1");
try {
if (dailyAnswerVOS.size() > 0) {
......@@ -609,14 +609,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/getErrorClass")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
try {
Response response = client.newCall(request).execute();
......@@ -646,14 +645,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
// MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("privateKey", getSecret())
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/clear")
.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();
RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class);
......
......@@ -6,22 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.mapper.AnsweringQuestionMapper;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.mapper.ExerciseDoneResultMapper;
import com.subsidy.mapper.SignInRecordMapper;
import com.subsidy.mapper.VodPlayHistoryMapper;
import com.subsidy.model.AnsweringQuestionDO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.IpAddressUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO;
......@@ -54,8 +45,8 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper;
//@Autowired
//private RedisUtil redisUtil;
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Autowired
private SignInRecordMapper signInRecordMapper;
......@@ -75,30 +66,24 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return this.baseMapper.selectPage(pager, new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, getMemberSignInfoDTO.getId())
.eq(SignInRecordDO::getClassId,getMemberSignInfoDTO.getClassId())
.eq(SignInRecordDO::getClassId, getMemberSignInfoDTO.getClassId())
.orderByDesc(SignInRecordDO::getCreateDate));
}
@Transactional(rollbackFor = Exception.class)
public String signIn(SignInRecordDO signInRecordDO, HttpServletRequest request) {
//查看学生所有在读班级
//查看学生所有在读班级
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) {
//Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + signInRecordDO.getClassId() + ":" + DateFormatUtil.format(signInRecordDO.getSignInDate(), "yyyy-MM-dd")+":*");
//if(set != null && set.size() > 0) {
// redisUtil.del(set);
//}
//redisUtil.set(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + signInRecordDO.getMemberId() + ":classId:" + classDictDO.getId() + ":" + DateFormatUtil.format(new Date(), "yyyy-MM-dd") + ":" + System.currentTimeMillis(), null);
// 存储到缓存到同时保存到数据库
SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.eq(SignInRecordDO::getClassId, classDictDO.getId())
.like(SignInRecordDO::getSignInDate, DateFormatUtil.format(new Date(), "yyyy-MM-dd")));
if(sign != null) {
if (sign != null) {
this.baseMapper.deleteById(sign.getId());
}
......@@ -109,6 +94,14 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
signInRecordDO.setDeviceNo(signInRecordDO.getDeviceNo());
this.baseMapper.insert(signInRecordDO);
}
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(signInRecordDO.getMemberId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
return ConstantUtils.ADD_SUCCESS;
}
......@@ -157,7 +150,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//视频
int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getClassId(),classMemberMappingDO.getMemberId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classMemberMappingDO.getClassId(), classMemberMappingDO.getMemberId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......
......@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
......@@ -56,11 +57,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private MemberStudyLengthMapper memberStudyLengthMapper;
// @Autowired
// private RedisUtil redisUtil;
@Transactional(rollbackFor = Exception.class)
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8) {
//查看系统设定的时长
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
......@@ -79,22 +79,29 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) {
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
}
} else {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
// this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
}
} else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
}
}
return ConstantUtils.ADD_SUCCESS;
}
@Transactional(rollbackFor = Exception.class)
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
......@@ -114,15 +121,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) {
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
}
} else {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
}
} else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1);
this.baseMapper.insert(vodPlayHistoryDO);
vodPlayHistoryMapper.insertPlayRecord(vodPlayHistoryDO.getClassId(), vodPlayHistoryDO.getVodId(), vodPlayHistoryDO.getMemberId(), vodPlayHistoryDO.getPlayLength()
, vodPlayHistoryDO.getSuspendLength(), vodPlayHistoryDO.getPlayRecord(), vodPlayHistoryDO.getPlayCount(), date);
// this.baseMapper.insert(vodPlayHistoryDO);
}
}
return ConstantUtils.ADD_SUCCESS;
......@@ -620,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
String classIds = "374,375,376,377,378,379,382,383,384,385,386,387,388,389,390,391,392,393,394,395";
String classIds = "400";
String[] classIdArr = classIds.split(",");
......@@ -634,22 +647,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() - 3000 > vodPlayStateVO.getStartDate().getTime() && vodPlayStateVO.getPlayLength() >= 3) {
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
//这一条数据有问题
// System.out.println("111111111111111111111" + vodPlayStateVO);
System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
if (l == 0) {
vph1.setPlayDate(vph1.getCreateDate());
}
VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength() + getRandom1_2());
vph2.setPlayDate(dateTmp);
this.baseMapper.updateById(vph2);
}
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
// for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
// VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
// if (l == 0) {
// vph1.setPlayDate(vph1.getCreateDate());
// }
// VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
// LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength() + getRandom1_2());
// vph2.setPlayDate(dateTmp);
// this.baseMapper.updateById(vph2);
// }
result.add(vodPlayStateVO.getId());
// break;
}
......
package com.subsidy.util;
public class DudaoConstant {
/**
* POST-1:班级基本信息信息采集接口
*/
public static final String POST_1 = "DUDAO_POST_1_insertClassBasicInformation";
/**
* POST-2:学时信息采集接口
*/
public static final String POST_2 = "DUDAO_POST_2_insertLearnDuration";
/**
* POST-3:考试信息采集接口
*/
public static final String POST_3 = "DUDAO_POST_3_insertExamInformation";
/**
* POST-4:答疑辅导采集接口
*/
public static final String POST_4 = "DUDAO_POST_4_insertAnswerTutor";
/**
* POST-5 上下游班级数据绑定接口
*/
public static final String POST_5 = "DUDAO_POST_5_insertBindClass";
/**
* 调取失败
*/
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 = "推送成功";
}
......@@ -17,10 +17,10 @@ import java.util.UUID;
public class OSSUtils {
// @Value("${aliyun.oss.accessKeyId}")
private static String accessKeyId = "LTAIOrpFKrDqsQ2c";
private static String accessKeyId = "LTAI5tPAH7P7WQVeowo517BE";
// @Value("${aliyun.oss.accessKeySecret}")
private static String secretAccessKey = "1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G";
private static String secretAccessKey = "0ueqhIfdAZyw5lWlBVSLpAxTtx37RY";
// @Value("${aliyun.oss.endpoint}")
private static String endPoint = "oss-cn-beijing.aliyuncs.com";
......
......@@ -64,6 +64,7 @@ public class SMSUtils {
throw new Exception(sendSmsResponse.getMessage());
} catch (Exception e) {
e.printStackTrace();
throw new HttpException(70011);
}
}
......
package com.subsidy.vo.opr;
import lombok.Data;
import java.util.Date;
@Data
public class InsertLastStudyRecordVO {
private Long id;
private Long memberId;
private Date signInDate;
private String ipAddress;
private Date mt;
}
......@@ -25,9 +25,6 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
spring.servlet.multipart.max-file-size=2048KB
spring.servlet.multipart.max-request-size=4098KB
#wechat.appId= wx7785293ff5e31f14
#wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6
#wechat.msgUrl= https://teachai.youkehulian.com/login
......@@ -51,4 +48,5 @@ qxueyou.securityKey=44420Tlu-P463-9041-2h1q-29Z59qxy
qxueyou.url=https://www.qxueyou.com/auth/user/token
renshe.url = https://api.shzypxy.com
renshe.secretKey = 111
\ No newline at end of file
#renshe.url = http://trial.shzypxy.com/api
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
\ No newline at end of file
......@@ -14,6 +14,8 @@ spring.server.compression=on
#文件请求大小
spring.server.MaxFileSize=300MB
spring.server.MaxRequestSize=500MB
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=50MB
# 文件编码 UTF8
spring.mandatory-file-encoding=UTF-8
spring.jackson.time-zone=GMT+8
......@@ -40,8 +42,8 @@ spring.cache.ehcache.config=classpath:ehcache.xml
# 阿里云短信
sms.product=Dysmsapi
sms.domain=dysmsapi.aliyuncs.com
sms.accessKeyId=LTAIOrpFKrDqsQ2c
sms.accessKeySecret=1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G
sms.accessKeyId=LTAI5tPAH7P7WQVeowo517BE
sms.accessKeySecret=0ueqhIfdAZyw5lWlBVSLpAxTtx37RY
#wechat.app-id=wx7785293ff5e31f14
#wechat.app-secret=25d57cad61fc1b45b3afa46d4c35e8f6
#wechat.agentId=1000008
......
......@@ -73,4 +73,6 @@ meishu.code-message[17001]=系统不支持00:00:00~06:00:00学习
meishu.code-message[18001]=已超过当日验证次数上线
meishu.code-message[19001]=验证失败
\ No newline at end of file
meishu.code-message[19001]=验证失败
meishu.code-message[20003]=提交时间过短,请稍后尝试
\ No newline at end of file
......@@ -146,6 +146,7 @@
left join company_dict t4 on t2.company_id = t4.id
where t.delete_date IS NULL
AND t2.delete_date IS NULL
and t3.delete_date IS NULL
AND t.class_id = #{classId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
......@@ -184,6 +185,7 @@
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t3.delete_date IS NULL
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
......@@ -224,10 +226,10 @@
</select>
<select id="selfExport" parameterType="com.subsidy.model.ClassDictDO" resultType="com.subsidy.dto.administer.SelfExportVO">
SELECT
SELECT
t3.user_name,
t1.vod_name,
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startTime,
t7.vodName,
DATE_SUB( t1.create_date, INTERVAL (t1.play_length + t1.suspend_length) SECOND ) AS startTime,
t1.create_date AS endTime,
SEC_TO_TIME( t1.play_length ) playLength,
IF
......@@ -245,7 +247,8 @@
t.create_date,
t2.vod_name,
t.play_length,
t2.vod_length
t2.vod_length,
t.suspend_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
......@@ -269,6 +272,24 @@
) t2 ON t1.vod_id = t2.vod_id
AND t1.member_id = t2.member_id
AND t1.class_id = t2.class_id
LEFT JOIN (
SELECT
t5.id,
IFNULL( t4.vod_alias_name, t5.vod_name ) AS vodName
FROM
class_dict t1
LEFT JOIN course_dict t2 ON t1.course_id = t2.id
LEFT JOIN course_content t3 ON t2.id = t3.course_id
LEFT JOIN content_vod_mapping t4 ON t3.id = t4.content_id
LEFT JOIN vod_dict t5 ON t5.id = t4.vod_id
WHERE
t1.id = #{id}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
) t7 ON t1.vod_id = t7.id
LEFT JOIN member t3 ON t1.member_id = t3.id
LEFT JOIN class_member_mapping t6 ON t3.id = t6.member_id
AND t6.class_id = t1.class_id
......
......@@ -256,7 +256,7 @@
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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>
......
<?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.DudaoMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, company_id, cert_id
</sql>
<select id="vodClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
vod_play_history t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="examClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
exercise_done_result t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="answerClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
answering_question t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
</select>
<select id="imageClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
image_check_record t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
AND t.result = 1
) t2 ON t.id = t2.class_id
LEFT JOIN company_dict t3 ON t.company_id = t3.id
WHERE
t2.class_Id IS NOT NULL
and t3.area_name = '普陀'
AND t.class_type = #{classType}
AND t.delete_date IS 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 company_dict t6 ON t3.company_id = t6.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
<if test="classType != null and classType != ''">
where t3.class_type = #{classType}
</if>
and t6.area_name = '普陀'
</select>
<select id="dailyExamBasic" resultType="long">
SELECT DISTINCT
class_id
FROM
exercise_done_result t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
WHERE
t1.delete_date IS NULL
AND t2.class_type = #{classType}
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
and t3.area_name = '普陀'
</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
LEFT JOIN company_dict t4 ON t2.company_id = t4.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
and t2.class_type = #{classType}
and t4.area_name = '普陀'
</select>
<select id="newClasses" parameterType="string" resultType="long">
SELECT DISTINCT
t1.id
FROM
class_dict t1
LEFT JOIN company_dict t3 ON t1.company_id = t3.id
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
<if test="classType != null and classType != ''">
and t1.class_type = #{classType}
</if>
and t3.area_name = '普陀'
</select>
</mapper>
......@@ -309,6 +309,7 @@
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t2.id IS NOT NULL
and t.department_id = #{departmentId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
......
......@@ -70,7 +70,7 @@
FROM
opr_adm_dict
WHERE
create_date &lt; (NOW() - INTERVAL 2 DAY)
create_date &lt; (NOW() -interval 1 day)
</select>
</mapper>
......@@ -4,12 +4,12 @@
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.OprMemDictDO">
<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="user_id" property="userId" />
<result column="opr_type" property="oprType" />
<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="user_id" property="userId"/>
<result column="opr_type" property="oprType"/>
</resultMap>
<!-- 通用查询结果列 -->
......@@ -23,27 +23,27 @@
<select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
SELECT
t.id,
t2.user_name,
t3.company_name,
t.opr_type,
t.create_date,
t.result
t.id,
t2.user_name,
t3.company_name,
t.opr_type,
t.create_date,
t.result
FROM
opr_mem_dict t
LEFT JOIN member t2 ON t.user_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
opr_mem_dict t
LEFT JOIN member t2 ON t.user_id = t2.id
LEFT JOIN company_dict t3 ON t2.company_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) BETWEEN DATE_FORMAT( #{startDate}, '%Y-%m-%d' )
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d' )
ORDER BY
t.create_date DESC
t.create_date DESC
</select>
<select id="getRecordByDate" resultType="com.subsidy.model.OprMemDictDO">
......@@ -52,7 +52,7 @@
FROM
opr_mem_dict
WHERE
create_date &lt; (NOW() - INTERVAL 2 DAY)
create_date &lt; (NOW() -interval 1 day)
</select>
<select id="getLatestLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
......@@ -67,26 +67,44 @@
WHERE
t.delete_date IS NULL
AND t.result = 1
AND t.user_id =#{userId}
AND t.user_id = #{userId}
and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
order by t.id desc
limit 1
</select>
<select id="getLatestLogoutInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT t.id,
t.ip_address,
t.opr_type,
t.result,
t.user_id,
t.create_date
FROM
opr_mem_dict t
WHERE
t.delete_date IS NULL
AND t.result = 1
AND t.user_id =#{userId}
and t.opr_type = '登出'
and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
order by t.id desc
limit 1
</select>
<!-- <update id="deleteData" parameterType="com.subsidy.model.OprMemDictDO">-->
<!-- DELETE-->
<!-- FROM-->
<!-- opr_mem_dict-->
<!-- WHERE-->
<!-- delete_date IS NULL-->
<!-- AND id = #{id}-->
<!-- </update>-->
<!-- <update id="deleteData" parameterType="com.subsidy.model.OprMemDictDO">-->
<!-- DELETE-->
<!-- FROM-->
<!-- opr_mem_dict-->
<!-- WHERE-->
<!-- delete_date IS NULL-->
<!-- AND id = #{id}-->
<!-- </update>-->
<select id="onlineUsers" resultType="long">
SELECT
t1.user_id
distinct t1.user_id
FROM
(
SELECT
......@@ -100,6 +118,7 @@
DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' )
AND result = 1
AND opr_type = "登录"
and delete_date IS NULL
GROUP BY
user_id
ORDER BY
......@@ -117,6 +136,7 @@
DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' )
AND result = 1
AND opr_type = "登出"
and delete_date is null
GROUP BY
user_id
ORDER BY
......@@ -127,7 +147,108 @@
OR t2.time2 &lt; t1.time1
</select>
<!-- <update id="insertLastStudyRecord">-->
<!-- -->
<!-- </update>-->
<select id="insertLastStudyRecord" resultType="com.subsidy.vo.opr.InsertLastStudyRecordVO">
SELECT
t1.member_id,
t1.sign_in_date,
t1.ip_address,
DATE_ADD(t2.mt,INTERVAL FLOOR(RAND()*100) SECOND) as mt
FROM
(
SELECT DISTINCT
t.sign_in_date,
t.member_id,
t.ip_address
FROM
sign_in_record t
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( t.sign_in_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )) t1
LEFT JOIN (
SELECT
t1.member_id,
max( t1.maxtime ) AS mt
FROM
(
SELECT
member_id,
max( create_date ) AS maxtime
FROM
vod_play_history
WHERE
delete_date IS NULL
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
GROUP BY
member_id UNION ALL
SELECT
member_id,
max( create_date ) AS maxtime
FROM
exercise_done_result
WHERE
delete_date IS NULL
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
GROUP BY
member_id UNION ALL
SELECT
ask_id,
max( create_date ) AS maxtime
FROM
answering_question
WHERE
delete_date IS NULL
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
GROUP BY
ask_id
) t1
GROUP BY
t1.member_id
) t2 ON t1.member_id = t2.member_id
</select>
<select id="shutdownUser" resultType="long">
SELECT
t1.user_id
FROM
(
SELECT
t.user_id,
max( t.create_date ) AS log_out
FROM
opr_mem_dict t
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
AND t.opr_type = '登出'
GROUP BY
t.user_id
) t1
LEFT JOIN (
SELECT
t.member_id,
max( t.create_date ) AS play_time
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( t.create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
GROUP BY
t.member_id
) t2 ON t1.user_id = t2.member_id
WHERE
t2.member_id IS NOT NULL
AND t1.log_out &lt; t2.play_time
</select>
<insert id="insertOrUpdate">
insert into opr_mem_dict(user_id,opr_type,result,ip_address,create_date)
values (#{userId},#{oprType},#{result},#{ipAddress},#{createDate})
on duplicate key update
user_id=values(user_id),
opr_type=values(opr_type),
result=values(result),
ip_address=values(ip_address),
create_date=values(create_date)
</insert>
</mapper>
......@@ -95,7 +95,7 @@
FROM
class_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
<if test="classType != null and classType != ''">
......@@ -123,7 +123,7 @@
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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,
......@@ -144,7 +144,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
......@@ -158,7 +158,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
......@@ -179,8 +179,9 @@
FROM
activity_detection t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
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}
</select>
......@@ -193,7 +194,7 @@
image_check_record t1
WHERE
class_id =#{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
AND t1.member_id=#{memberId}
......@@ -211,7 +212,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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 = "登出"
......@@ -225,7 +226,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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 = "登录"
......@@ -235,7 +236,7 @@
<select id="loginRecords" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
*
distinct *
FROM
opr_mem_dict t
WHERE
......@@ -243,15 +244,16 @@
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登录"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
AND DATE_FORMAT( DATE_ADD( create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
order by id
</select>
<select id="loginOutRecords" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
*
distinct *
FROM
opr_mem_dict t
WHERE
......@@ -259,18 +261,19 @@
AND t.result = 1
AND t.delete_date IS NULL
AND opr_type = "登出"
AND DATE_FORMAT( DATE_ADD( create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
AND DATE_FORMAT( DATE_ADD( create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
order by id
</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,
t.suspend_length AS pauseTime,
unix_timestamp(subdate( t.create_date, INTERVAL (t.play_length+t.suspend_length)SECOND ))*1000 AS startTime,
unix_timestamp(t.create_date)*1000 AS endTime
FROM
vod_play_history t
......@@ -285,15 +288,17 @@
<select id="dailyExamBasic" resultType="long">
SELECT DISTINCT
class_id
FROM
exercise_done_result t1
WHERE
t1.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
class_id
FROM
exercise_done_result t1
LEFT JOIN class_dict t2 ON t1.class_id = t2.id
WHERE
t1.delete_date IS NULL
AND t2.class_type = #{classType}
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
</select>
<select id="memberIds" parameterType="long" resultType="com.subsidy.model.MemberDO">
......@@ -307,8 +312,8 @@
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
t1.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
And class_id = #{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
and class_id = #{classId}
</select>
<select id="classVodName" parameterType="long" resultType="string">
......@@ -341,7 +346,7 @@
exercise_done_result t1
WHERE
t1.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND class_id = #{classId}
AND member_id = #{memberId}
</select>
......@@ -372,10 +377,11 @@
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 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
and t2.class_type = #{classType}
</select>
<select id="checkClassIds" parameterType="string" resultType="long">
......@@ -386,7 +392,7 @@
left join class_dict t2 on t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
AND DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
......@@ -412,7 +418,7 @@
class_id = #{classId}
AND t1.delete_date IS NULL
and t2.delete_date is null
AND DATE_FORMAT( DATE_ADD( t1.update_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT(
AND DATE_FORMAT( DATE_ADD( t1.update_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT(
NOW(),
'%Y-%m-%d'
)
......@@ -431,7 +437,7 @@
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
class_id = #{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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>
......@@ -451,7 +457,7 @@
WHERE
t1.delete_date is null
and class_id = #{classId}
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
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
......@@ -474,7 +480,7 @@
LEFT JOIN member t2 ON t1.member_id = t2.id
WHERE
t1.delete_date is null
AND DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 2 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
and class_id = #{classId}
AND t1.paper_id IS not NULL
AND t1.result = 1
......@@ -483,4 +489,82 @@
ORDER BY t1.create_date desc
</select>
<select id="vodClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
vod_play_history t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
WHERE
t2.class_Id IS NOT NULL
AND t.class_type = #{classType}
</select>
<select id="examClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
exercise_done_result t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
WHERE
t2.class_Id IS NOT NULL
AND t.class_type = #{classType}
</select>
<select id="answerClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
answering_question t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
) t2 ON t.id = t2.class_id
WHERE
t2.class_Id IS NOT NULL
AND t.class_type = #{classType}
</select>
<select id="imageClassIds" parameterType="string" resultType="long">
SELECT
t.id
FROM
class_dict t
LEFT JOIN (
SELECT DISTINCT
t.class_id AS class_Id
FROM
image_check_record t
WHERE
DATE_FORMAT( DATE_ADD( t.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t.delete_date IS NULL
AND t.result = 1
) t2 ON t.id = t2.class_id
WHERE
t2.class_Id IS NOT NULL
AND t.class_type = #{classType}
AND t.delete_date IS NULL
</select>
</mapper>
......@@ -55,7 +55,7 @@
delete_date IS NULL
AND date(sign_in_date) = date_sub(
curdate(),
INTERVAL 2 DAY)
interval 1 day)
</select>
</mapper>
......@@ -58,7 +58,7 @@
<select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
SELECT
t2.id,
t2.vod_name,
IFNULL( t3.vod_alias_name,t2.vod_name ) as vodName,
t2.vod_length
FROM
course_content t
......@@ -100,7 +100,7 @@
SELECT
id,
member_id,
DATE_SUB( create_date, INTERVAL play_length SECOND ) AS start_date,
DATE_SUB( create_date, INTERVAL (play_length+suspend_length) SECOND ) AS start_date,
create_date AS end_date,
t.play_length,
create_date
......
......@@ -248,9 +248,9 @@
<select id="memberStudy" resultType="com.subsidy.vo.administer.MemberStudyLogVO">
SELECT
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startDate,
DATE_SUB( t1.create_date, INTERVAL (t1.play_length+t1.suspend_length) SECOND ) AS startDate,
t1.create_date AS endDate,
t1.vod_name,
t3.vodName,
'视频学习' AS studyType,
t1.play_length,
IF
......@@ -262,7 +262,8 @@
t.create_date,
t2.vod_name,
t.play_length,
t2.vod_length
t2.vod_length,
t.suspend_length
FROM
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
......@@ -285,6 +286,24 @@
GROUP BY
t.vod_id
) t2 ON t1.vod_id = t2.vod_id
LEFT JOIN (
SELECT
t5.id,
IFNULL( t4.vod_alias_name, t5.vod_name ) AS vodName
FROM
class_dict t1
LEFT JOIN course_dict t2 ON t1.course_id = t2.id
LEFT JOIN course_content t3 ON t2.id = t3.course_id
LEFT JOIN content_vod_mapping t4 ON t3.id = t4.content_id
LEFT JOIN vod_dict t5 ON t5.id = t4.vod_id
WHERE
t1.id = #{classId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
) t3 on t2.vod_id = t3.id
ORDER BY
t1.create_date DESC
</select>
......@@ -293,7 +312,7 @@
SELECT
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startDate,
t1.create_date AS endDate,
t1.vod_name,
t3.vodName,
'视频学习' AS studyType,
t1.play_length,
IF
......@@ -310,7 +329,8 @@
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
t.delete_date is null
and t.class_id = #{classId}
AND t.member_id = #{memberId}
) t1
LEFT JOIN (
......@@ -321,11 +341,30 @@
vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE
t.class_id = #{classId}
t.delete_date is null
and t.class_id = #{classId}
AND t.member_id = #{memberId}
GROUP BY
t.vod_id
) t2 ON t1.vod_id = t2.vod_id
LEFT JOIN (
SELECT
t5.id,
IFNULL( t4.vod_alias_name, t5.vod_name ) AS vodName
FROM
class_dict t1
LEFT JOIN course_dict t2 ON t1.course_id = t2.id
LEFT JOIN course_content t3 ON t2.id = t3.course_id
LEFT JOIN content_vod_mapping t4 ON t3.id = t4.content_id
LEFT JOIN vod_dict t5 ON t5.id = t4.vod_id
WHERE
t1.id = #{classId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
) t3 on t2.vod_id = t3.id
ORDER BY
t1.create_date DESC
</select>
......@@ -366,15 +405,33 @@
</select>
<select id="classMemberPlayLength" parameterType="long" resultType="com.subsidy.vo.vod.ClassMemberPlayLengthVO">
SELECT
SELECT
t.member_id,
t.vod_id,
t3.vod_name,
t6.vodName,
sum( t.play_length ) AS play_length
FROM
vod_play_history t
LEFT JOIN class_member_mapping t2 ON t.member_id = t2.id
left join vod_dict t3 on t.vod_id = t3.id
LEFT JOIN vod_dict t3 ON t.vod_id = t3.id
LEFT JOIN (
SELECT
t5.id,
IFNULL( t4.vod_alias_name, t5.vod_name ) AS vodName
FROM
class_dict t1
LEFT JOIN course_dict t2 ON t1.course_id = t2.id
LEFT JOIN course_content t3 ON t2.id = t3.course_id
LEFT JOIN content_vod_mapping t4 ON t3.id = t4.content_id
LEFT JOIN vod_dict t5 ON t5.id = t4.vod_id
WHERE
t1.id = #{classId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
AND t5.delete_date IS NULL
) t6 ON t3.id = t6.id
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
......@@ -411,6 +468,11 @@
<!-- LIMIT 1-->
<!-- </select>-->
<insert id="insertPlayRecord">
insert into vod_play_history (class_id,vod_id,member_id,play_length,suspend_length,play_record,play_count,create_date)
VALUES (#{classId}, #{vodId}, #{memberId}, #{playLength},#{suspendLength},#{playRecord}, #{playCount},#{createDate})
</insert>
<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!