Commit b86edc62 by 涂亚平

人脸识别订单号改为用uuid生成

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