Commit b17282a8 by 涂亚平

脚本调整结束,按照时长分配,(第一个脚本)

1 parent 381a1b2f
......@@ -333,7 +333,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null, 0);
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null, 1);
List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
......
......@@ -102,7 +102,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
if (count > 0){
administerDO.setCompanyId(null);
}
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId(),null);
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId(),2);
List<OperatorsVO> operatorsVOS = page.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
//查看公司所在行业
......
......@@ -61,9 +61,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper<ClassHourDictDO>()
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
if (classHourDictDO.getStatus() == 1) {
//查看当天这个人看了多少时间
......@@ -71,10 +71,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour()*3600-total;
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001);
throw new HttpException(13001);
}
}
vodPlayHistoryDO.setPlayCount(1);
......@@ -85,9 +85,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
public String insertHistoryNew(VodPlayHistoryDO vodPlayHistoryDO) {
MemberDO memberDO = memberMapper.selectById(vodPlayHistoryDO.getMemberId());
//查看系统设定的时长
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne (new QueryWrapper<ClassHourDictDO>()
ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper<ClassHourDictDO>()
.lambda()
.eq(ClassHourDictDO::getCompanyId,memberDO.getCompanyId()));
.eq(ClassHourDictDO::getCompanyId, memberDO.getCompanyId()));
if (classHourDictDO.getStatus() == 1) {
//查看当天这个人看了多少时间
......@@ -95,7 +95,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour()*3600-total;
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001);
......@@ -366,10 +366,10 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
.eq(SignInRecordDO::getMemberId, classMemberMappingDO.getMemberId())
.eq(SignInRecordDO::getClassId, classId));
for (SignInRecordDO signInRecordDO : signInRecordDOS) {
for (int k = signInRecordDOS.size() - 1; k >= 0; k--) {
//查看当天这人已经看的视频时长
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.exPlayInfo(classMemberMappingDO.getMemberId(), String.valueOf(classId), signInRecordDO.getSignInDate());
List<VodPlayHistoryDO> vodPlayHistoryDOS = vodPlayHistoryMapper.exPlayInfo(classMemberMappingDO.getMemberId(), String.valueOf(classId), signInRecordDOS.get(k).getSignInDate());
//查看学生一看视频时长
int totalLength = 0;
......@@ -418,14 +418,14 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
vodPlayHistoryDO.setPlayLength(h);
playLength += h;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDO.getSignInDate().plusSeconds(playLength));
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
leftLength = leftLength - h;
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
} else {
vodPlayHistoryDO.setPlayLength(leftLength);
playLength += leftLength;
vodPlayHistoryDO.setVodId(vodDictDOS.get(j).getId());
vodPlayHistoryDO.setPlayDate(signInRecordDO.getSignInDate().plusSeconds(playLength));
vodPlayHistoryDO.setPlayDate(signInRecordDOS.get(k).getSignInDate().plusSeconds(playLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
break;
}
......@@ -448,6 +448,11 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查找课程里的所有视频
List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(classDictDO.getCourseId());
int vodTotalLength = 0;
for (VodDictDO vodDictDO : vodDictDOS) {
vodTotalLength += vodDictDO.getVodLength();
}
//查看每个人看视频的时长
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
......@@ -461,7 +466,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
List<LocalDateTime> localDateTimes = new ArrayList<>();
for (SignInRecordDO signInrecord : signInRecordDOS) {
if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 15) {
if (signInrecord.getSignInDate().getHour() >= 6 && signInrecord.getSignInDate().getHour() < 17) {
localDateTimes.add(signInrecord.getSignInDate());
}
}
......@@ -530,20 +535,27 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//续播
if (vodPlayHistoryDOS.size() > 0) {
VodPlayHistoryDO vodPlayHistoryDO1 = vodPlayHistoryDOS.get(0);
VodDictDO vodDictDO = vodDictMapper.selectById(vodPlayHistoryDO1.getVodId());
//剩下的学习时长
int leftLength = vodDictDO.getVodLength() - vodPlayHistoryDO1.getPlayLength();
if (leftLength > 0) {
totalPlay += leftLength;
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
vodPlayHistoryDO.setPlayLength(leftLength);
vodPlayHistoryDO.setVodId(vodDictDO.getId());
vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(leftLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
int count = this.baseMapper.selectCount(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getVodId, vodPlayHistoryDO1.getVodId())
.eq(VodPlayHistoryDO::getMemberId,classMemberMappingDO.getMemberId()));
if (count <2) {
VodDictDO vodDictDO = vodDictMapper.selectById(vodPlayHistoryDO1.getVodId());
//剩下的学习时长
int leftLength = vodDictDO.getVodLength() - vodPlayHistoryDO1.getPlayLength();
if (leftLength > 0) {
totalPlay += leftLength;
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
vodPlayHistoryDO.setPlayLength(leftLength);
vodPlayHistoryDO.setVodId(vodDictDO.getId());
vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(leftLength));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
}
}
}
......@@ -558,19 +570,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//表示这个视频没有学过
if (count == 0) {
if (totalPlayLength > totalPlay) { //说明今天还可以学
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
if (totalPlay+vodDictDO.getVodLength()<=totalPlayLength){
vodPlayHistoryDO.setPlayLength(vodDictDO.getVodLength());
}else {
vodPlayHistoryDO.setPlayLength(totalPlayLength-totalPlay);
}
vodPlayHistoryDO.setVodId(vodDictDO.getId());
vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(totalPlay));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
vodPlayHistoryDO.setPlayCount(1);
vodPlayHistoryDO.setClassId(classDictDO.getId());
vodPlayHistoryDO.setMemberId(classMemberMappingDO.getMemberId());
vodPlayHistoryDO.setPlayRecord(vodDictDO.getVodLength());
if (totalPlay + vodDictDO.getVodLength() <= totalPlayLength) {
vodPlayHistoryDO.setPlayLength(vodDictDO.getVodLength());
totalPlay += vodDictDO.getVodLength();
} else {
vodPlayHistoryDO.setPlayLength(totalPlayLength - totalPlay);
totalPlay = totalPlayLength;
}
vodPlayHistoryDO.setVodId(vodDictDO.getId());
vodPlayHistoryDO.setPlayDate(localDateTime.plusSeconds(totalPlay));
vodPlayHistoryMapper.insert(vodPlayHistoryDO);
}
}
}
......
package com.subsidy.util;
import com.amdelamar.jhash.Hash;
import com.amdelamar.jhash.algorithms.Type;
import com.amdelamar.jhash.exception.InvalidHashException;
public class EncryptUtil {
/**
* 设置密文密码
*
* @param password 原始密码
* @return 加密密码
*/
public static String encrypt(String password) {
char[] chars = password.toCharArray();
return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).create();
}
/**
* 验证加密密码
*
* @param encryptedPassword 密文密码
* @param plainPassword 明文密码
* @return 验证是否成功
*/
public static boolean verify(String encryptedPassword, String plainPassword) {
char[] chars = plainPassword.toCharArray();
try {
return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).verify(encryptedPassword);
} catch (InvalidHashException e) {
return false;
}
}
}
//package com.subsidy.util;
//
//import com.amdelamar.jhash.Hash;
//import com.amdelamar.jhash.algorithms.Type;
//import com.amdelamar.jhash.exception.InvalidHashException;
//
//public class EncryptUtil {
//
// /**
// * 设置密文密码
// *
// * @param password 原始密码
// * @return 加密密码
// */
// public static String encrypt(String password) {
// char[] chars = password.toCharArray();
// return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).create();
// }
//
// /**
// * 验证加密密码
// *
// * @param encryptedPassword 密文密码
// * @param plainPassword 明文密码
// * @return 验证是否成功
// */
// public static boolean verify(String encryptedPassword, String plainPassword) {
// char[] chars = plainPassword.toCharArray();
// try {
// return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).verify(encryptedPassword);
// } catch (InvalidHashException e) {
// return false;
// }
// }
//}
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
# 端口号
spring.server.port=23459
spring.server.port=23457
#嵌入tomcat配置
#和CPU数
spring.server.acceptorThreadCount=600
......
......@@ -34,14 +34,18 @@
t2.address
FROM
administer t
left join role_administer_mapping t4 on t.id = t4.administer_id
left join company_dict t2 on t.company_id = t2.id
left join company_field_mapping t3 on t2.id = t3.company_id
WHERE
t.delete_date IS NULL
and t2.delete_date is null
and t3.delete_date is null
<if test="role != null">
and t.role = #{role}
<if test="role == 1">
(and t4.role = 1 or t4.role_id = 3)
</if>
<if test="role == 2">
(and t4.role = 2)
</if>
<if test="id != null and id != ''">
and t2.id = #{id}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!