Commit 7944d5ce by 涂亚平

补贴培训第一次上课

1 parent 2174a9b2
Showing with 1003 additions and 226 deletions
...@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -6,6 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
...@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
@EnableScheduling @EnableScheduling
//@EnableCaching //@EnableCaching
@EnableAsync @EnableAsync
@EnableTransactionManagement
public class MeishuApplication { public class MeishuApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -57,9 +57,6 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -57,9 +57,6 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
@Autowired @Autowired
private MemberTokensMapper memberTokensMapper; private MemberTokensMapper memberTokensMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Override @Override
@CrossOrigin() @CrossOrigin()
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
...@@ -102,11 +99,11 @@ public class AuthenticationInterceptor implements HandlerInterceptor { ...@@ -102,11 +99,11 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
int hour = calendar.get(Calendar.HOUR_OF_DAY); int hour = calendar.get(Calendar.HOUR_OF_DAY);
if (hour<6){ if (hour<6){
OprMemDictDO oprMemDictDO = new OprMemDictDO(); // OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId()); // oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登出"); // oprMemDictDO.setOprType("登出");
oprMemDictDO.setResult(1); // oprMemDictDO.setResult(1);
oprMemDictMapper.insert(oprMemDictDO); // oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(17001); throw new HttpException(17001);
} }
} }
......
...@@ -7,22 +7,13 @@ import com.subsidy.common.interceptor.LoginRequired; ...@@ -7,22 +7,13 @@ import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.*; import com.subsidy.dto.administer.*;
import com.subsidy.model.*; import com.subsidy.model.*;
import com.subsidy.service.AdministerService; import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.*;
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.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.net.InetAddress;
/** /**
* <p> * <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 { ...@@ -60,7 +60,7 @@ public class ExerciseDictController {
@PostMapping("submit") @PostMapping("submit")
@ApiOperation("提交答案 {paperId 卷子id l length memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] startDate:做题时长} ") @ApiOperation("提交答案 {paperId 卷子id l length memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] startDate:做题时长} ")
@LoginRequired // @LoginRequired
@TimeRequired @TimeRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#submitDTO.getClassId()") @CachePut(value = "ResultData" ,key = "'classId_'+#submitDTO.getClassId()")
public ResponseVO submit(@RequestBody SubmitDTO submitDTO){ public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
......
...@@ -122,7 +122,7 @@ public class MemberController { ...@@ -122,7 +122,7 @@ public class MemberController {
@PostMapping("myCertCourses") @PostMapping("myCertCourses")
@ApiOperation("手机端:我的学习--证书课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ") @ApiOperation("手机端:我的学习--证书课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
// @LoginRequired @LoginRequired
@TimeRequired @TimeRequired
public ResponseVO myCertCourses(@RequestBody MyCoursesDTO myCoursesDTO){ public ResponseVO myCertCourses(@RequestBody MyCoursesDTO myCoursesDTO){
return ResponseData.generateCreatedResponse(0,memberService.myCertCourses(myCoursesDTO)); return ResponseData.generateCreatedResponse(0,memberService.myCertCourses(myCoursesDTO));
...@@ -223,13 +223,13 @@ public class MemberController { ...@@ -223,13 +223,13 @@ public class MemberController {
return memberService.polyvInfo(userid,channelId,ts,token); return memberService.polyvInfo(userid,channelId,ts,token);
} }
@RequestMapping("logout") // @RequestMapping("logout")
@ApiOperation("登出 学生id") // @ApiOperation("登出 学生id")
@TimeRequired // @TimeRequired
public ResponseVO logout(@RequestBody String param){ // public ResponseVO logout(@RequestBody String param){
MemberDO memberDO = JSON.parseObject(param, MemberDO.class); // MemberDO memberDO = JSON.parseObject(param, MemberDO.class);
return ResponseData.generateCreatedResponse(0,memberService.logout(memberDO)); // return ResponseData.generateCreatedResponse(0,memberService.logout(memberDO));
} // }
......
...@@ -48,6 +48,7 @@ public class VodPlayHistoryController { ...@@ -48,6 +48,7 @@ public class VodPlayHistoryController {
@ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " + @ApiOperation("记录学生看视频位置 classId班级id vodId 视频id memberId 成员id " +
"playLength 播放时长 playRecord 位点 suspendLength") "playLength 播放时长 playRecord 位点 suspendLength")
@TimeRequired @TimeRequired
// @LoginRequired
public ResponseVO insertHistoryNew(@RequestBody String param){ public ResponseVO insertHistoryNew(@RequestBody String param){
InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class); InsertHistoryNewDTO insertHistoryNewDTO = JSON.parseObject(param, InsertHistoryNewDTO.class);
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO)); return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.insertHistoryNew(insertHistoryNewDTO));
...@@ -55,7 +56,7 @@ public class VodPlayHistoryController { ...@@ -55,7 +56,7 @@ public class VodPlayHistoryController {
@PostMapping("dataFix") @PostMapping("dataFix")
@ApiOperation("每个视频都看一次") @ApiOperation("每个视频都看一次")
// @LoginRequired @LoginRequired
public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){ public void dadaFix(@RequestBody SignDatePlaysDTO dataFixDTO){
vodPlayHistoryService.dataFix(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,14 +5,20 @@ import com.subsidy.common.ResponseData; ...@@ -5,14 +5,20 @@ import com.subsidy.common.ResponseData;
import com.subsidy.mapper.OprMemDictMapper; import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.model.OprMemDictDO; import com.subsidy.model.OprMemDictDO;
import com.subsidy.service.RenSheJuService; import com.subsidy.service.RenSheJuService;
import com.subsidy.util.IpAddressUtil;
import com.subsidy.util.websocket.WebSocketUtil; import com.subsidy.util.websocket.WebSocketUtil;
import com.subsidy.vo.opr.InsertLastStudyRecordVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.WebSocketSession;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -33,7 +39,7 @@ public class RenSheJuJob { ...@@ -33,7 +39,7 @@ public class RenSheJuJob {
* POST-2:班级基本信息信息采集接口 * POST-2:班级基本信息信息采集接口
*/ */
@Scheduled(cron = "0 0 1 * * ?") @Scheduled(cron = "0 0 1 * * ?")
public void classBaseInfo()throws IOException { public void classBaseInfo() throws IOException {
renSheJuService.classBaseInfo(); renSheJuService.classBaseInfo();
} }
...@@ -65,7 +71,7 @@ public class RenSheJuJob { ...@@ -65,7 +71,7 @@ public class RenSheJuJob {
* POST-6 班级活跃度/实名认证照片信息采集接口 * POST-6 班级活跃度/实名认证照片信息采集接口
*/ */
@Scheduled(cron = "0 20 1 * * ?") @Scheduled(cron = "0 20 1 * * ?")
public void uploadImage()throws IOException { public void uploadImage() throws IOException {
renSheJuService.uploadImage(); renSheJuService.uploadImage();
} }
...@@ -73,7 +79,7 @@ public class RenSheJuJob { ...@@ -73,7 +79,7 @@ public class RenSheJuJob {
* POST-7 获取培训待绑定的(班级编号,项目编号)列表 * POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/ */
@Scheduled(cron = "0 25 1 * * ?") @Scheduled(cron = "0 25 1 * * ?")
public void getClassCodeByPrivateKey()throws IOException { public void getClassCodeByPrivateKey() throws IOException {
renSheJuService.getClassCodeByPrivateKey(); renSheJuService.getClassCodeByPrivateKey();
} }
...@@ -81,7 +87,7 @@ public class RenSheJuJob { ...@@ -81,7 +87,7 @@ public class RenSheJuJob {
* POST-8 上下游班级数据绑定接口 * POST-8 上下游班级数据绑定接口
*/ */
@Scheduled(cron = "0 30 1 * * ?") @Scheduled(cron = "0 30 1 * * ?")
public void uploadClassCode()throws IOException { public void uploadClassCode() throws IOException {
renSheJuService.uploadClassCode(); renSheJuService.uploadClassCode();
} }
...@@ -93,26 +99,72 @@ public class RenSheJuJob { ...@@ -93,26 +99,72 @@ public class RenSheJuJob {
// renSheJuService.getErrorClass(); // renSheJuService.getErrorClass();
// } // }
@Scheduled(cron = "00 58 23 * * ?") @Scheduled(cron = "00 50 23 * * ?")
public void cancelLogin(){ @Transactional(rollbackFor = Exception.class)
public void logout(){
//让当前用户下线
ConcurrentHashMap<Long, WebSocketSession> webSocketMap = WebSocketUtil.webSocketMap; 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 { try {
if (null != webSocketMap.get(key)){ if (null != webSocketMap.get(ilsr.getMemberId())) {
webSocketMap.get(key).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001)))); webSocketMap.get(ilsr.getMemberId()).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(17001))));
} }
OprMemDictDO oprMemDictDO = new OprMemDictDO(); } catch (Exception e) {
oprMemDictDO.setResult(1);
oprMemDictDO.setOprType("登出");
oprMemDictDO.setUserId(key);
oprMemDictMapper.insert(oprMemDictDO);
}catch (Exception e){
e.printStackTrace(); 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; ...@@ -14,55 +14,55 @@ import java.io.IOException;
public class ShehuihuaJob { public class ShehuihuaJob {
@Autowired // @Autowired
private ShehuihuaService shehuihuaService; // private ShehuihuaService shehuihuaService;
//
/** // /**
* POST-2 获取培训待绑定的(班级编号,项目编号)列表 // * POST-2 获取培训待绑定的(班级编号,项目编号)列表
*/ // */
@Scheduled(cron = "0 0 2 * * ?") // @Scheduled(cron = "0 0 2 * * ?")
public void getClassCodeByPrivateKey()throws IOException { // public void getClassCodeByPrivateKey()throws IOException {
shehuihuaService.getClassCodeByPrivateKey(); // shehuihuaService.getClassCodeByPrivateKey();
} // }
//
/** // /**
* POST-3:班级基本信息信息采集接口 // * POST-3:班级基本信息信息采集接口
*/ // */
@Scheduled(cron = "0 5 2 * * ?") // @Scheduled(cron = "0 5 2 * * ?")
public void uploadClass() throws IOException { // public void uploadClass() throws IOException {
shehuihuaService.uploadClass(); // shehuihuaService.uploadClass();
} // }
//
/** // /**
* POST-4:考试信息采集接口 // * POST-4:考试信息采集接口
*/ // */
@Scheduled(cron = "0 10 2 * * ?") // @Scheduled(cron = "0 10 2 * * ?")
public void classHourBehavior() throws IOException { // public void classHourBehavior() throws IOException {
shehuihuaService.classHourBehavior(); // shehuihuaService.classHourBehavior();
} // }
//
/** // /**
* POST-5:答疑辅导采集接口 // * POST-5:答疑辅导采集接口
*/ // */
@Scheduled(cron = "0 15 2 * * ?") // @Scheduled(cron = "0 15 2 * * ?")
public void uploadChapterBehavior() throws IOException { // public void uploadChapterBehavior() throws IOException {
shehuihuaService.uploadChapterBehavior(); // shehuihuaService.uploadChapterBehavior();
} // }
//
/** // /**
* POST-6 班级活跃度/实名认证照片信息采集接口 // * POST-6 班级活跃度/实名认证照片信息采集接口
*/ // */
@Scheduled(cron = "0 20 2 * * ?") // @Scheduled(cron = "0 20 2 * * ?")
public void uploadClassAnswerQuestionBehavior()throws IOException { // public void uploadClassAnswerQuestionBehavior()throws IOException {
shehuihuaService.uploadClassAnswerQuestionBehavior(); // shehuihuaService.uploadClassAnswerQuestionBehavior();
} // }
//
/** // /**
* POST-7 获取培训待绑定的(班级编号,项目编号)列表 // * POST-7 获取培训待绑定的(班级编号,项目编号)列表
*/ // */
@Scheduled(cron = "0 25 2 * * ?") // @Scheduled(cron = "0 25 2 * * ?")
public void uploadImage()throws IOException { // public void uploadImage()throws IOException {
shehuihuaService.uploadImage(); // 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; ...@@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprMemDictDO; import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO; import com.subsidy.vo.opr.GetHistoryVO;
import com.subsidy.vo.opr.InsertLastStudyRecordVO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -28,22 +31,30 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> { ...@@ -28,22 +31,30 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
*/ */
OprMemDictDO getLatestLoginInfo(Long userId); OprMemDictDO getLatestLoginInfo(Long userId);
/**
// /** * 当天最后一次登出
// * 当天最后一次登录 */
// */ OprMemDictDO getLatestLogoutInfo(Long userId);
// OprMemDictDO getLatestLogoutInfo(Long userId);
// void deleteData(OprMemDictDO oprMemDictDO);
/** /**
* 查看当天还在线的用户 * 查看当天还在线的用户
*/ */
List<Long> onlineUsers(); 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 { ...@@ -49,8 +49,6 @@ public interface RenSheJuMapper {
*/ */
List<ExamActivitiesVO> examActivities(Long classId,Long memberId); List<ExamActivitiesVO> examActivities(Long classId,Long memberId);
/** /**
* 某人某天累计在线时长 * 某人某天累计在线时长
*/ */
...@@ -74,7 +72,7 @@ public interface RenSheJuMapper { ...@@ -74,7 +72,7 @@ public interface RenSheJuMapper {
/** /**
* 前一天考试通过数据 * 前一天考试通过数据
*/ */
List<Long> dailyExamBasic(); List<Long> dailyExamBasic(String classType);
/** /**
* 前一天做过考试通过数据 * 前一天做过考试通过数据
...@@ -100,7 +98,7 @@ public interface RenSheJuMapper { ...@@ -100,7 +98,7 @@ public interface RenSheJuMapper {
/** /**
* 找到某人当天答疑的记录 * 找到某人当天答疑的记录
*/ */
List<DailyAnswerVO> dailyAnswer(); List<DailyAnswerVO> dailyAnswer(String classType);
/** /**
* 查找前一天做过人脸识别的班级 * 查找前一天做过人脸识别的班级
...@@ -127,4 +125,24 @@ public interface RenSheJuMapper { ...@@ -127,4 +125,24 @@ public interface RenSheJuMapper {
*/ */
List<ClassImageChecksVO> examCheck(Long classId); 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> { ...@@ -101,6 +101,12 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/ */
// Long memberLatestRecord(Long memberId); // 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 getStudyTotal();
double getSubsidyStudyTotal(); 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> { ...@@ -79,5 +79,5 @@ public interface MemberService extends IService<MemberDO> {
PolyvInfoVO polyvInfo(String userid,String channelId,String ts,String token); PolyvInfoVO polyvInfo(String userid,String channelId,String ts,String token);
String logout(MemberDO memberDO); // String logout(MemberDO memberDO);
} }
package com.subsidy.service; package com.subsidy.service;
import com.subsidy.dto.renshe.*;
import com.subsidy.vo.renshe.RensheResponseVO; import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO; import com.subsidy.vo.renshe.RensheStringVO;
......
...@@ -170,7 +170,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa ...@@ -170,7 +170,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
AdministerDO administerDO = new AdministerDO(); AdministerDO administerDO = new AdministerDO();
administerDO.setAccountName(addCompanyDTO.getAccountName()); administerDO.setAccountName(addCompanyDTO.getAccountName());
administerDO.setCompanyId(companyDictDO.getId()); administerDO.setCompanyId(companyDictDO.getId());
administerDO.setPassword("admin123"); administerDO.setPassword("admin321");
administerDO.setStatus("1"); administerDO.setStatus("1");
//administerDO.setRole(1); //administerDO.setRole(1);
administerMapper.insert(administerDO); administerMapper.insert(administerDO);
......
...@@ -3,6 +3,7 @@ package com.subsidy.service.impl; ...@@ -3,6 +3,7 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.GetPaperExerciseDTO;
import com.subsidy.dto.exercise.SubmitDTO; import com.subsidy.dto.exercise.SubmitDTO;
import com.subsidy.mapper.ExerciseDictMapper; import com.subsidy.mapper.ExerciseDictMapper;
...@@ -20,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -39,13 +43,13 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -39,13 +43,13 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
@Autowired @Autowired
private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper; private ExerciseDoneHistoryMapper exerciseDoneHistoryMapper;
public String addExercise(ExerciseDictDO exerciseDictDO){ public String addExercise(ExerciseDictDO exerciseDictDO) {
Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId()); Integer orderNoTmp = this.baseMapper.getMaximumNo(exerciseDictDO.getPaperId());
int orderNo = 1; int orderNo = 1;
if (null!= orderNoTmp) { if (null != orderNoTmp) {
orderNo = orderNoTmp + 1; orderNo = orderNoTmp + 1;
} }
exerciseDictDO.setOrderNo(orderNo); exerciseDictDO.setOrderNo(orderNo);
...@@ -70,6 +74,17 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -70,6 +74,17 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
List<MemberExerciseVO> memberExerciseVOS = submitDTO.getMemberExerciseVOS(); 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; int rightCounts = 0;
for (MemberExerciseVO exerciseVO : memberExerciseVOS) { for (MemberExerciseVO exerciseVO : memberExerciseVOS) {
...@@ -77,13 +92,12 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -77,13 +92,12 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())) { if (exerciseDictDO.getRightAnswer().equals(exerciseVO.getSelectAnswer())) {
exerciseVO.setResult(1); exerciseVO.setResult(1);
rightCounts++; rightCounts++;
}else { } else {
exerciseVO.setResult(0); exerciseVO.setResult(0);
} }
} }
exerciseDoneResultDO.setClassId(submitDTO.getClassId()); exerciseDoneResultDO.setClassId(submitDTO.getClassId());
exerciseDoneResultDO.setRightCounts(rightCounts); exerciseDoneResultDO.setRightCounts(rightCounts);
exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size()); exerciseDoneResultDO.setTotalCounts(memberExerciseVOS.size());
...@@ -94,11 +108,11 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -94,11 +108,11 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
exerciseDoneResultDO.setStartDate(submitDTO.getStartDate()); exerciseDoneResultDO.setStartDate(submitDTO.getStartDate());
int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size()); int score = MathUtil.intDivFloorPercent(rightCounts, memberExerciseVOS.size());
exerciseDoneResultDO.setScore(score); exerciseDoneResultDO.setScore(score);
exerciseDoneResultDO.setResult(score>=60?"合格":"不合格"); exerciseDoneResultDO.setResult(score >= 60 ? "合格" : "不合格");
exerciseDoneResultMapper.insert(exerciseDoneResultDO); exerciseDoneResultMapper.insert(exerciseDoneResultDO);
for (MemberExerciseVO memberExerciseVO : memberExerciseVOS){ for (MemberExerciseVO memberExerciseVO : memberExerciseVOS) {
ExerciseDoneHistoryDO exerciseDoneHistoryDO = new ExerciseDoneHistoryDO(); ExerciseDoneHistoryDO exerciseDoneHistoryDO = new ExerciseDoneHistoryDO();
exerciseDoneHistoryDO.setPaperId(submitDTO.getPaperId()); exerciseDoneHistoryDO.setPaperId(submitDTO.getPaperId());
...@@ -116,7 +130,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe ...@@ -116,7 +130,7 @@ public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, Exe
public IPage<GetPaperExerciseVO> getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO) { public IPage<GetPaperExerciseVO> getPaperExercise(GetPaperExerciseDTO getPaperExerciseDTO) {
Page pager = new Page(getPaperExerciseDTO.getPageNum(), getPaperExerciseDTO.getPageSize()); 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());
} }
} }
...@@ -47,14 +47,14 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { ...@@ -47,14 +47,14 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
MediaType mediaType = MediaType.parse("text/plain"); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/getClassCodeByPrivateKey") .url(renSheConfig.getUrl() + "/import/downstream/social/getClassCodeByPrivateKey")
.method("POST", body) .method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build(); .build();
try { try {
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
...@@ -285,7 +285,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { ...@@ -285,7 +285,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
List<ChapterExamBasic5> chapterExamBasics = new ArrayList<>(); List<ChapterExamBasic5> chapterExamBasics = new ArrayList<>();
//找出前一天产生考试数据的班级 //找出前一天产生考试数据的班级
List<Long> classIds = renSheJuMapper.dailyExamBasic(); List<Long> classIds = renSheJuMapper.dailyExamBasic("1");
try { try {
if (classIds.size() > 0) { if (classIds.size() > 0) {
...@@ -419,7 +419,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { ...@@ -419,7 +419,7 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
//秘钥 //秘钥
uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret()); uploadClassAnswerQuestionBehaviorDTO.setPrivateKey(getSecret());
List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer(); List<DailyAnswerVO> dailyAnswerVOS = renSheJuMapper.dailyAnswer("1");
try { try {
if (dailyAnswerVOS.size() > 0) { if (dailyAnswerVOS.size() > 0) {
...@@ -609,14 +609,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { ...@@ -609,14 +609,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
MediaType mediaType = MediaType.parse("text/plain"); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/getErrorClass") .url(renSheConfig.getUrl() + "/import/downstream/social/getErrorClass")
.method("POST", body) .method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build(); .build();
try { try {
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
...@@ -646,14 +645,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService { ...@@ -646,14 +645,13 @@ public class ShehuihuaServiceImpl implements ShehuihuaService {
OkHttpClient client = new OkHttpClient().newBuilder() OkHttpClient client = new OkHttpClient().newBuilder()
.build(); .build();
// MediaType mediaType = MediaType.parse("text/plain"); MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
.addFormDataPart("privateKey", getSecret())
.build();
Request request = new Request.Builder() Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/social/clear") .url(renSheConfig.getUrl() + "/import/downstream/social/clear")
.method("POST", body) .method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build(); .build();
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class); RensheStringVO rensheStringVO = JSON.parseObject(response.body().string(), RensheStringVO.class);
......
...@@ -6,22 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,22 +6,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.dto.member.GetMemberSignInfoDTO; import com.subsidy.dto.member.GetMemberSignInfoDTO;
import com.subsidy.dto.sign.DataViewDTO; import com.subsidy.dto.sign.DataViewDTO;
import com.subsidy.mapper.AnsweringQuestionMapper; import com.subsidy.mapper.*;
import com.subsidy.mapper.ClassDictMapper; import com.subsidy.model.*;
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.service.SignInRecordService; import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils; import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil; import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.IpAddressUtil; import com.subsidy.util.IpAddressUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO; import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.DataViewVO; import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO; import com.subsidy.vo.sign.SignInStatusVO;
...@@ -54,8 +45,8 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -54,8 +45,8 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
@Autowired @Autowired
private VodPlayHistoryMapper vodPlayHistoryMapper; private VodPlayHistoryMapper vodPlayHistoryMapper;
//@Autowired @Autowired
//private RedisUtil redisUtil; private OprMemDictMapper oprMemDictMapper;
@Autowired @Autowired
private SignInRecordMapper signInRecordMapper; private SignInRecordMapper signInRecordMapper;
...@@ -75,7 +66,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -75,7 +66,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return this.baseMapper.selectPage(pager, new QueryWrapper<SignInRecordDO>() return this.baseMapper.selectPage(pager, new QueryWrapper<SignInRecordDO>()
.lambda() .lambda()
.eq(SignInRecordDO::getMemberId, getMemberSignInfoDTO.getId()) .eq(SignInRecordDO::getMemberId, getMemberSignInfoDTO.getId())
.eq(SignInRecordDO::getClassId,getMemberSignInfoDTO.getClassId()) .eq(SignInRecordDO::getClassId, getMemberSignInfoDTO.getClassId())
.orderByDesc(SignInRecordDO::getCreateDate)); .orderByDesc(SignInRecordDO::getCreateDate));
} }
...@@ -86,19 +77,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -86,19 +77,13 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId()); List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
for (ClassDictDO classDictDO : classDictDOS) { 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>() SignInRecordDO sign = this.baseMapper.selectOne(new QueryWrapper<SignInRecordDO>()
.lambda() .lambda()
.eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId()) .eq(SignInRecordDO::getMemberId, signInRecordDO.getMemberId())
.eq(SignInRecordDO::getClassId, classDictDO.getId()) .eq(SignInRecordDO::getClassId, classDictDO.getId())
.like(SignInRecordDO::getSignInDate, DateFormatUtil.format(new Date(), "yyyy-MM-dd"))); .like(SignInRecordDO::getSignInDate, DateFormatUtil.format(new Date(), "yyyy-MM-dd")));
if(sign != null) { if (sign != null) {
this.baseMapper.deleteById(sign.getId()); this.baseMapper.deleteById(sign.getId());
} }
...@@ -109,6 +94,14 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -109,6 +94,14 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
signInRecordDO.setDeviceNo(signInRecordDO.getDeviceNo()); signInRecordDO.setDeviceNo(signInRecordDO.getDeviceNo());
this.baseMapper.insert(signInRecordDO); 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; return ConstantUtils.ADD_SUCCESS;
} }
...@@ -157,7 +150,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig ...@@ -157,7 +150,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
//视频 //视频
int i = 0; int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) { 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()) { if (totalPlayLength >= vodDictDO.getVodLength()) {
i++; i++;
} }
......
...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -56,11 +57,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -56,11 +57,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired @Autowired
private MemberStudyLengthMapper memberStudyLengthMapper; private MemberStudyLengthMapper memberStudyLengthMapper;
// @Autowired @Transactional(rollbackFor = Exception.class)
// private RedisUtil redisUtil;
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) { public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8) { if (vodPlayHistoryDO.getPlayLength() > 8) {
//查看系统设定的时长 //查看系统设定的时长
ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>() ClassDictDO classDictDO = classDictMapper.selectOne(new QueryWrapper<ClassDictDO>()
...@@ -79,22 +79,29 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -79,22 +79,29 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) { 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 { } else {
vodPlayHistoryDO.setPlayCount(1); 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) { } else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1); 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; return ConstantUtils.ADD_SUCCESS;
} }
@Transactional(rollbackFor = Exception.class)
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) { public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8) { if (insertHistoryNewDTO.getPlayLength() > 8) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO(); VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO); BeanUtils.copyProperties(insertHistoryNewDTO, vodPlayHistoryDO);
...@@ -114,15 +121,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -114,15 +121,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayLength(playLength); vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1); vodPlayHistoryDO.setPlayCount(1);
if (playLength > 5) { 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 { } else {
vodPlayHistoryDO.setPlayCount(1); 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) { } else if (classDictDO.getLimitHour() == 0) {
vodPlayHistoryDO.setPlayCount(1); 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; return ConstantUtils.ADD_SUCCESS;
...@@ -620,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -620,7 +633,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) { 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(","); String[] classIdArr = classIds.split(",");
...@@ -634,22 +647,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -634,22 +647,22 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) { for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面 VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面 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升序排序 //查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate()); // List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推 // //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) { // for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条 // VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
if (l == 0) { // if (l == 0) {
vph1.setPlayDate(vph1.getCreateDate()); // vph1.setPlayDate(vph1.getCreateDate());
} // }
VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条 // VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength() + getRandom1_2()); // LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength() + getRandom1_2());
vph2.setPlayDate(dateTmp); // vph2.setPlayDate(dateTmp);
this.baseMapper.updateById(vph2); // this.baseMapper.updateById(vph2);
} // }
result.add(vodPlayStateVO.getId()); result.add(vodPlayStateVO.getId());
// break; // 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; ...@@ -17,10 +17,10 @@ import java.util.UUID;
public class OSSUtils { public class OSSUtils {
// @Value("${aliyun.oss.accessKeyId}") // @Value("${aliyun.oss.accessKeyId}")
private static String accessKeyId = "LTAIOrpFKrDqsQ2c"; private static String accessKeyId = "LTAI5tPAH7P7WQVeowo517BE";
// @Value("${aliyun.oss.accessKeySecret}") // @Value("${aliyun.oss.accessKeySecret}")
private static String secretAccessKey = "1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G"; private static String secretAccessKey = "0ueqhIfdAZyw5lWlBVSLpAxTtx37RY";
// @Value("${aliyun.oss.endpoint}") // @Value("${aliyun.oss.endpoint}")
private static String endPoint = "oss-cn-beijing.aliyuncs.com"; private static String endPoint = "oss-cn-beijing.aliyuncs.com";
......
...@@ -64,6 +64,7 @@ public class SMSUtils { ...@@ -64,6 +64,7 @@ public class SMSUtils {
throw new Exception(sendSmsResponse.getMessage()); throw new Exception(sendSmsResponse.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
throw new HttpException(70011); 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 ...@@ -25,9 +25,6 @@ spring.datasource.druid.useGlobalDataSourceStat=true
# 控制台日志打印 # 控制台日志打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl 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.appId= wx7785293ff5e31f14
#wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6 #wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6
#wechat.msgUrl= https://teachai.youkehulian.com/login #wechat.msgUrl= https://teachai.youkehulian.com/login
...@@ -51,4 +48,5 @@ qxueyou.securityKey=44420Tlu-P463-9041-2h1q-29Z59qxy ...@@ -51,4 +48,5 @@ qxueyou.securityKey=44420Tlu-P463-9041-2h1q-29Z59qxy
qxueyou.url=https://www.qxueyou.com/auth/user/token qxueyou.url=https://www.qxueyou.com/auth/user/token
renshe.url = https://api.shzypxy.com renshe.url = https://api.shzypxy.com
renshe.secretKey = 111 #renshe.url = http://trial.shzypxy.com/api
\ No newline at end of file renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
\ No newline at end of file
...@@ -14,6 +14,8 @@ spring.server.compression=on ...@@ -14,6 +14,8 @@ spring.server.compression=on
#文件请求大小 #文件请求大小
spring.server.MaxFileSize=300MB spring.server.MaxFileSize=300MB
spring.server.MaxRequestSize=500MB spring.server.MaxRequestSize=500MB
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=50MB
# 文件编码 UTF8 # 文件编码 UTF8
spring.mandatory-file-encoding=UTF-8 spring.mandatory-file-encoding=UTF-8
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
...@@ -40,8 +42,8 @@ spring.cache.ehcache.config=classpath:ehcache.xml ...@@ -40,8 +42,8 @@ spring.cache.ehcache.config=classpath:ehcache.xml
# 阿里云短信 # 阿里云短信
sms.product=Dysmsapi sms.product=Dysmsapi
sms.domain=dysmsapi.aliyuncs.com sms.domain=dysmsapi.aliyuncs.com
sms.accessKeyId=LTAIOrpFKrDqsQ2c sms.accessKeyId=LTAI5tPAH7P7WQVeowo517BE
sms.accessKeySecret=1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G sms.accessKeySecret=0ueqhIfdAZyw5lWlBVSLpAxTtx37RY
#wechat.app-id=wx7785293ff5e31f14 #wechat.app-id=wx7785293ff5e31f14
#wechat.app-secret=25d57cad61fc1b45b3afa46d4c35e8f6 #wechat.app-secret=25d57cad61fc1b45b3afa46d4c35e8f6
#wechat.agentId=1000008 #wechat.agentId=1000008
......
...@@ -74,3 +74,5 @@ meishu.code-message[18001]=已超过当日验证次数上线 ...@@ -74,3 +74,5 @@ meishu.code-message[18001]=已超过当日验证次数上线
meishu.code-message[19001]=验证失败 meishu.code-message[19001]=验证失败
meishu.code-message[20003]=提交时间过短,请稍后尝试
\ No newline at end of file
...@@ -146,6 +146,7 @@ ...@@ -146,6 +146,7 @@
left join company_dict t4 on t2.company_id = t4.id left join company_dict t4 on t2.company_id = t4.id
where t.delete_date IS NULL where t.delete_date IS NULL
AND t2.delete_date IS NULL AND t2.delete_date IS NULL
and t3.delete_date IS NULL
AND t.class_id = #{classId} AND t.class_id = #{classId}
<if test="userName != null and userName !=''"> <if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%') and t2.user_name like concat('%',#{userName} ,'%')
...@@ -184,6 +185,7 @@ ...@@ -184,6 +185,7 @@
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t2.delete_date IS NULL AND t2.delete_date IS NULL
and t3.delete_date IS NULL
<if test="userName != null and userName !=''"> <if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%') and t2.user_name like concat('%',#{userName} ,'%')
</if> </if>
...@@ -226,8 +228,8 @@ ...@@ -226,8 +228,8 @@
<select id="selfExport" parameterType="com.subsidy.model.ClassDictDO" resultType="com.subsidy.dto.administer.SelfExportVO"> <select id="selfExport" parameterType="com.subsidy.model.ClassDictDO" resultType="com.subsidy.dto.administer.SelfExportVO">
SELECT SELECT
t3.user_name, t3.user_name,
t1.vod_name, t7.vodName,
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startTime, DATE_SUB( t1.create_date, INTERVAL (t1.play_length + t1.suspend_length) SECOND ) AS startTime,
t1.create_date AS endTime, t1.create_date AS endTime,
SEC_TO_TIME( t1.play_length ) playLength, SEC_TO_TIME( t1.play_length ) playLength,
IF IF
...@@ -245,7 +247,8 @@ ...@@ -245,7 +247,8 @@
t.create_date, t.create_date,
t2.vod_name, t2.vod_name,
t.play_length, t.play_length,
t2.vod_length t2.vod_length,
t.suspend_length
FROM FROM
vod_play_history t vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
...@@ -269,6 +272,24 @@ ...@@ -269,6 +272,24 @@
) t2 ON t1.vod_id = t2.vod_id ) t2 ON t1.vod_id = t2.vod_id
AND t1.member_id = t2.member_id AND t1.member_id = t2.member_id
AND t1.class_id = t2.class_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 member t3 ON t1.member_id = t3.id
LEFT JOIN class_member_mapping t6 ON t3.id = t6.member_id LEFT JOIN class_member_mapping t6 ON t3.id = t6.member_id
AND t6.class_id = t1.class_id AND t6.class_id = t1.class_id
......
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
FROM FROM
vod_play_history t1 vod_play_history t1
WHERE 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.delete_date IS NULL
</select> </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 @@ ...@@ -309,6 +309,7 @@
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t2.delete_date IS NULL AND t2.delete_date IS NULL
AND t2.id IS NOT NULL
and t.department_id = #{departmentId} and t.department_id = #{departmentId}
<if test="userName != null and userName !=''"> <if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%') and t2.user_name like concat('%',#{userName} ,'%')
......
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
FROM FROM
opr_adm_dict opr_adm_dict
WHERE WHERE
create_date &lt; (NOW() - INTERVAL 2 DAY) create_date &lt; (NOW() -interval 1 day)
</select> </select>
</mapper> </mapper>
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.OprMemDictDO"> <resultMap id="BaseResultMap" type="com.subsidy.model.OprMemDictDO">
<id column="id" property="id" /> <id column="id" property="id"/>
<result column="create_date" property="createDate" /> <result column="create_date" property="createDate"/>
<result column="update_date" property="updateDate" /> <result column="update_date" property="updateDate"/>
<result column="delete_date" property="deleteDate" /> <result column="delete_date" property="deleteDate"/>
<result column="user_id" property="userId" /> <result column="user_id" property="userId"/>
<result column="opr_type" property="oprType" /> <result column="opr_type" property="oprType"/>
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
FROM FROM
opr_mem_dict opr_mem_dict
WHERE WHERE
create_date &lt; (NOW() - INTERVAL 2 DAY) create_date &lt; (NOW() -interval 1 day)
</select> </select>
<select id="getLatestLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO"> <select id="getLatestLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
...@@ -67,26 +67,44 @@ ...@@ -67,26 +67,44 @@
WHERE WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.result = 1 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' ) and DATE_FORMAT( create_date, '%Y-%m-%d' ) = DATE_FORMAT( now(), '%Y-%m-%d' )
order by t.id desc order by t.id desc
limit 1 limit 1
</select> </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">--> <!-- <update id="deleteData" parameterType="com.subsidy.model.OprMemDictDO">-->
<!-- DELETE--> <!-- DELETE-->
<!-- FROM--> <!-- FROM-->
<!-- opr_mem_dict--> <!-- opr_mem_dict-->
<!-- WHERE--> <!-- WHERE-->
<!-- delete_date IS NULL--> <!-- delete_date IS NULL-->
<!-- AND id = #{id}--> <!-- AND id = #{id}-->
<!-- </update>--> <!-- </update>-->
<select id="onlineUsers" resultType="long"> <select id="onlineUsers" resultType="long">
SELECT SELECT
t1.user_id distinct t1.user_id
FROM FROM
( (
SELECT SELECT
...@@ -100,6 +118,7 @@ ...@@ -100,6 +118,7 @@
DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' ) DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' )
AND result = 1 AND result = 1
AND opr_type = "登录" AND opr_type = "登录"
and delete_date IS NULL
GROUP BY GROUP BY
user_id user_id
ORDER BY ORDER BY
...@@ -117,6 +136,7 @@ ...@@ -117,6 +136,7 @@
DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' ) DATE_FORMAT( create_date, '%Y-%m-%d ' ) = DATE_FORMAT( now(), '%Y-%m-%d ' )
AND result = 1 AND result = 1
AND opr_type = "登出" AND opr_type = "登出"
and delete_date is null
GROUP BY GROUP BY
user_id user_id
ORDER BY ORDER BY
...@@ -127,7 +147,108 @@ ...@@ -127,7 +147,108 @@
OR t2.time2 &lt; t1.time1 OR t2.time2 &lt; t1.time1
</select> </select>
<!-- <update id="insertLastStudyRecord">--> <select id="insertLastStudyRecord" resultType="com.subsidy.vo.opr.InsertLastStudyRecordVO">
<!-- --> SELECT
<!-- </update>--> 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> </mapper>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
delete_date IS NULL delete_date IS NULL
AND date(sign_in_date) = date_sub( AND date(sign_in_date) = date_sub(
curdate(), curdate(),
INTERVAL 2 DAY) interval 1 day)
</select> </select>
</mapper> </mapper>
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
<select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO"> <select id="getCourseVods" parameterType="long" resultType="com.subsidy.model.VodDictDO">
SELECT SELECT
t2.id, t2.id,
t2.vod_name, IFNULL( t3.vod_alias_name,t2.vod_name ) as vodName,
t2.vod_length t2.vod_length
FROM FROM
course_content t course_content t
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
SELECT SELECT
id, id,
member_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, create_date AS end_date,
t.play_length, t.play_length,
create_date create_date
......
...@@ -248,9 +248,9 @@ ...@@ -248,9 +248,9 @@
<select id="memberStudy" resultType="com.subsidy.vo.administer.MemberStudyLogVO"> <select id="memberStudy" resultType="com.subsidy.vo.administer.MemberStudyLogVO">
SELECT 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.create_date AS endDate,
t1.vod_name, t3.vodName,
'视频学习' AS studyType, '视频学习' AS studyType,
t1.play_length, t1.play_length,
IF IF
...@@ -262,7 +262,8 @@ ...@@ -262,7 +262,8 @@
t.create_date, t.create_date,
t2.vod_name, t2.vod_name,
t.play_length, t.play_length,
t2.vod_length t2.vod_length,
t.suspend_length
FROM FROM
vod_play_history t vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
...@@ -285,6 +286,24 @@ ...@@ -285,6 +286,24 @@
GROUP BY GROUP BY
t.vod_id t.vod_id
) t2 ON t1.vod_id = t2.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 ORDER BY
t1.create_date DESC t1.create_date DESC
</select> </select>
...@@ -293,7 +312,7 @@ ...@@ -293,7 +312,7 @@
SELECT SELECT
DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startDate, DATE_SUB( t1.create_date, INTERVAL t1.play_length SECOND ) AS startDate,
t1.create_date AS endDate, t1.create_date AS endDate,
t1.vod_name, t3.vodName,
'视频学习' AS studyType, '视频学习' AS studyType,
t1.play_length, t1.play_length,
IF IF
...@@ -310,7 +329,8 @@ ...@@ -310,7 +329,8 @@
vod_play_history t vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE WHERE
t.class_id = #{classId} t.delete_date is null
and t.class_id = #{classId}
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
) t1 ) t1
LEFT JOIN ( LEFT JOIN (
...@@ -321,11 +341,30 @@ ...@@ -321,11 +341,30 @@
vod_play_history t vod_play_history t
LEFT JOIN vod_dict t2 ON t.vod_id = t2.id LEFT JOIN vod_dict t2 ON t.vod_id = t2.id
WHERE WHERE
t.class_id = #{classId} t.delete_date is null
and t.class_id = #{classId}
AND t.member_id = #{memberId} AND t.member_id = #{memberId}
GROUP BY GROUP BY
t.vod_id t.vod_id
) t2 ON t1.vod_id = t2.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 ORDER BY
t1.create_date DESC t1.create_date DESC
</select> </select>
...@@ -369,12 +408,30 @@ ...@@ -369,12 +408,30 @@
SELECT SELECT
t.member_id, t.member_id,
t.vod_id, t.vod_id,
t3.vod_name, t6.vodName,
sum( t.play_length ) AS play_length sum( t.play_length ) AS play_length
FROM FROM
vod_play_history t vod_play_history t
LEFT JOIN class_member_mapping t2 ON t.member_id = t2.id 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 WHERE
t.delete_date IS NULL t.delete_date IS NULL
AND t.class_id = #{classId} AND t.class_id = #{classId}
...@@ -411,6 +468,11 @@ ...@@ -411,6 +468,11 @@
<!-- LIMIT 1--> <!-- LIMIT 1-->
<!-- </select>--> <!-- </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 id="getStudyTotal" resultType="java.lang.Double">
SELECT SELECT
sum( play_length ) sum( play_length )
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!