Commit 4f1af516 by 涂亚平

中秋代码备份

1 parent f09aa192
......@@ -91,6 +91,14 @@ public class MemberController {
return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO,request));
}
@PostMapping("kexinkuLogin")
@ApiOperation("可信库登录 idCard 身份证号 timestamp 时间戳 sign")
@TimeRequired
public ResponseVO kexinkuLogin(@RequestBody KexinkuLoginDTO kexinkuLoginDTO ){
return ResponseData.generateCreatedResponse(0,memberService.kexinkuLogin(kexinkuLoginDTO));
}
@PostMapping("checkStatus")
@ApiOperation("实名制验证状态 id")
@TimeRequired
......
......@@ -16,6 +16,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 视频播放历史记录表 前端控制器
......@@ -96,4 +98,13 @@ public class VodPlayHistoryController {
vodPlayHistoryService.warning();
}
@PostMapping("criticalData")
@ApiOperation("找出临界那条数据 classId")
public List<Long> criticalData(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
return vodPlayHistoryService.criticalData(vodPlayHistoryDO);
}
}
package com.subsidy.dto.member;
import lombok.Data;
@Data
public class KexinkuLoginDTO {
private String appId;
private String authCorpId;
private String openId;
private String idCard;
private Long timestamp;
private String sign;
}
......@@ -69,7 +69,7 @@ public class WarningJob {
// }
//
// if (result.size()>0){
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones){
// smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
// }
......
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.OprAdmDictDO;
import com.subsidy.model.OprMemDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.opr.GetHistoryVO;
......@@ -56,5 +57,13 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
*/
void insertOrUpdate(Long userId, String oprType, Integer result, String ipAddress, Date createDate);
/**
* 查看某为成员最近登录情况 五天超过次数
*/
List<OprMemDictDO> getLoginInfo(Long userId);
/**
* 清除今天登录失败的记录
*/
void clearTodayLoginData(Long userId);
}
......@@ -2,6 +2,7 @@ package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodPlayHistoryDO;
import com.subsidy.vo.administer.MemberStudyLogVO;
import com.subsidy.vo.member.ContentVodNewVO;
......@@ -126,4 +127,9 @@ public interface VodPlayHistoryMapper extends BaseMapper<VodPlayHistoryDO> {
*/
List<DailyClassMembersVO> dailyClassMembers();
/**
* 找出这个课程学习的人
*/
List<Long> vodMembers(Long classId);
}
......@@ -43,6 +43,8 @@ public interface MemberService extends IService<MemberDO> {
UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO, HttpServletRequest request);
UserRoleVO kexinkuLogin(KexinkuLoginDTO kexinkuLoginDTO);
CheckStatusVO checkStatus(MemberDO memberDO);
String updatePassword(MemberDO memberDO);
......
......@@ -40,4 +40,6 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void warning();
List<Long> criticalData(VodPlayHistoryDO vodPlayHistoryDO);
}
......@@ -243,11 +243,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
oprAdmDictDO.setOprType("登录");
oprAdmDictDO.setResult(0);
oprAdmDictMapper.insert(oprAdmDictDO);
//oprAdmDictDO.setCreateDate(System.currentTimeMillis() + "");
//oprAdmDictDO.setLoginDateFormat(DateFormatUtil.format(new Date(), "yyyyMMdd"));
//oprAdmDictDO.setUserName(administerDO1.getUserName());
//oprAdmDictDO.setCompanyId(administerDO1.getCompanyId());
//mongoTemplate.insert(oprAdmDictDO);
int i = 0;
......@@ -1402,7 +1398,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
memberDO1.setTelephone(s.getTelephone());
memberDO1.setIdCard(s.getIdCard());
memberDO1.setStatus("启用");
memberDO1.setPassword("123456");
memberDO1.setPassword("Ykhl123456");
memberDO1.setAccountNameEn(s.getAccountNameEn());
memberMapper.insert(memberDO1);
......@@ -2095,22 +2091,29 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
newCell.setCellStyle(cellStyle);
newCell.setCellValue(exerciseTestVO.getCount());
//次数
//开始时间
newCell = dataRow.createCell(6);
newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() != 0) {
newCell.setCellValue(exerciseTestVO.getStartDate());
}
//次数
//结束时间
newCell = dataRow.createCell(7);
newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() != 0) {
newCell.setCellValue(exerciseTestVO.getEndDate());
}
//次数
newCell = dataRow.createCell(8);
newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() != 0) {
newCell.setCellValue(exerciseTestVO.getPeriod());
}
newCell = dataRow.createCell(9);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(exerciseTestVO.getScore() >= 60 ? "合格" : "不合格");
rowIndex++;
......
......@@ -93,8 +93,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private CompanyDictMapper companyDictMapper;
// @Autowired
// private OprMemDictMapper oprMemDictMapper;
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Autowired
private JobDictMapper jobDictMapper;
......@@ -121,9 +121,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
private QXueYouConfig qXueYouConfig;
@Autowired
private LiveDictMapper liveDictMapper;
@Autowired
private ActivityDetectionMapper activityDetectionMapper;
@Autowired
......@@ -190,7 +187,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
MemberDO memberDO = new MemberDO();
BeanUtils.copyProperties(addMemberDTO, memberDO);
memberDO.setPassword("123456");
memberDO.setPassword("Ykhl123456");
memberDO.setStatus("启用");
memberDO.setFirstLogin(0);
//公司赋值
......@@ -359,25 +356,41 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
Localstorage.setUser(memberDO);
userRoleVO.setToken(token);
//清空登录失败的数据
oprMemDictMapper.clearTodayLoginData(memberDO.getId());
return userRoleVO;
}
public MemberVO passwordLogin(PasswordLoginDTO passwordLoginDTO, HttpServletRequest request) {
MemberDO memberDO = null;
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getCompanyId, passwordLoginDTO.getCompanyId())
.eq(MemberDO::getAccountName, passwordLoginDTO.getAccountName()));
if (null == memberDO) {
/**
* 从数据库里查
*/
memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getCompanyId, passwordLoginDTO.getCompanyId())
.eq(MemberDO::getAccountName, passwordLoginDTO.getAccountName()));
if (memberDO == null) {
throw new HttpException(10017);
throw new HttpException(10017);
}
/**
* 最近5次都输入失败,5分钟后再验证
*/
List<OprMemDictDO> oprMemDictDOS = oprMemDictMapper.getLoginInfo(memberDO.getId());
boolean flag = false;
for (int i = 0; i < oprMemDictDOS.size(); i++) {
if (oprMemDictDOS.get(i).getResult() == 1) {
flag = true;
break;
}
}
if (!flag && oprMemDictDOS.size() >= 4) {
throw new HttpException(10016);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if (memberDO.getPassword().equals(passwordLoginDTO.getPassword()) && 1 == memberDO.getFirstLogin() && !"冻结".equals(memberDO.getStatus())) {
MemberVO memberVO = new MemberVO();
......@@ -385,15 +398,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName());
memberVO.setQxyStatus(companyDictDO.getQxyStatus());
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setSuperviseName(companyDictDO.getSuperviseName());
memberVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -418,33 +422,63 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
memberTokensMapper.insert(memberTokensDO);
}
//清空登录失败的数据
oprMemDictMapper.clearTodayLoginData(memberDO.getId());
Localstorage.setUser(memberDO);
memberVO.setToken(token);
return memberVO;
} else {
if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10016);
}
if (0 == memberDO.getFirstLogin()) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10015);
}
if ("冻结".equals(memberDO.getStatus())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10014);
}
if (!memberDO.getPassword().equals(passwordLoginDTO.getPassword())) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
oprMemDictDO.setResult(0);
oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
oprMemDictMapper.insert(oprMemDictDO);
int i = 0;
for (OprMemDictDO oad : oprMemDictDOS) {
if (oad.getResult() == 1) {
break;
}
i++;
}
if (i == 0) {
throw new HttpException(10024);
} else if (i == 1) {
throw new HttpException(10023);
} else if (i == 2) {
throw new HttpException(10022);
} else if (i == 3) {
throw new HttpException(10021);
} else {
throw new HttpException(10016);
}
}
}
return null;
}
......@@ -470,12 +504,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14002);
}
......@@ -501,40 +529,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14001);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -567,12 +572,6 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14002);
}
......@@ -586,39 +585,17 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(14001);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
// OprMemDictDO oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(0);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
throw new HttpException(10013);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
//审计日志
// OprMemDictDO oprMemDictDO = oprMemDictMapper.getLatestLoginInfo(memberDO.getId());
// if (null == oprMemDictDO || !(oprMemDictDO.getResult() == 1 && "登录".equals(oprMemDictDO.getOprType()))) {
// oprMemDictDO = new OprMemDictDO();
// oprMemDictDO.setUserId(memberDO.getId());
// oprMemDictDO.setOprType("登录");
// oprMemDictDO.setResult(1);
// oprMemDictDO.setIpAddress(IpAddressUtil.getIpAddress(request));
// oprMemDictMapper.insert(oprMemDictDO);
// }
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
......@@ -633,6 +610,61 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return userRoleVO;
}
public UserRoleVO kexinkuLogin(KexinkuLoginDTO kexinkuLoginDTO) {
UserRoleVO userRoleVO = new UserRoleVO();
// appId:9a79cda9ef6f4a5ha1
// appSecret:552a4147db2d4026bc4e9021acd61ka1
MemberDO memberDO = this.baseMapper.selectOne(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getIdCard, kexinkuLoginDTO.getIdCard()));
if (memberDO == null) {
throw new HttpException(10010);
}
/**
* 时间戳有没有过期
*/
if (kexinkuLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - kexinkuLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
throw new HttpException(14002);
}
//鉴权逻辑 对不对
String preAuthen = "appId=9a79cda9ef6f4a5ha1"
+ "&idCard=" + kexinkuLoginDTO.getIdCard()
+ "&timestamp=" + kexinkuLoginDTO.getTimestamp()
+ "&appSecret=552a4147db2d4026bc4e9021acd61ka1";
String result = SecretUtils.getMD5String(preAuthen);
if (!kexinkuLoginDTO.getSign().equals(result)) {
throw new HttpException(14001);
}
CompanyDictDO companyDictDO = companyDictMapper.selectById(memberDO.getCompanyId());
if ("冻结".equals(memberDO.getStatus())) {
throw new HttpException(10013);
}
BeanUtils.copyProperties(memberDO, userRoleVO);
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setSuperviseName(companyDictDO.getSuperviseName());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
userRoleVO.setLogo(companyDictDO.getLogo());
userRoleVO.setQxyStatus(companyDictDO.getQxyStatus());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
userRoleVO.setRotationImgDictDOS(rotationImgDictDOS);
String token = JwtUtil.generateToken(memberDO.getId(), ConstantUtils.MOBILE_TERMINATE);
userRoleVO.setToken(token);
return userRoleVO;
}
public CheckStatusVO checkStatus(MemberDO memberDO) {
CheckStatusVO checkStatusVO = new CheckStatusVO();
......@@ -648,10 +680,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
.lambda()
.eq(ImageCheckRecordDO::getMemberId, memberDO.getId()));
if (count >0){
if (count > 0) {
checkStatusVO.setIdCardStatus(true);
checkStatusVO.setImageStatus(true);
}else {
} else {
checkStatusVO.setImageStatus(false);
checkStatusVO.setIdCardStatus(false);
}
......@@ -1139,6 +1171,4 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
// }
}
......@@ -12,6 +12,7 @@ import com.subsidy.model.*;
import com.subsidy.service.RenSheJuService;
import com.subsidy.util.OSSUtils;
import com.subsidy.util.RenSheJuConstant;
import com.subsidy.util.SMSUtils;
import com.subsidy.vo.renshe.*;
import net.sf.json.JSONObject;
import okhttp3.*;
......@@ -42,6 +43,8 @@ public class RenSheJuServiceImpl implements RenSheJuService {
@Autowired
private ImageCheckRecordMapper imageCheckRecordMapper;
@Autowired
private SMSUtils smsUtils;
public RensheResponseVO classBaseInfo() throws IOException {
......@@ -71,10 +74,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
Set<Long> classIds = new HashSet<>();
vodClassIds.stream().forEach(x->classIds.add(x));
examClassIds.stream().forEach(x->classIds.add(x));
answerClassIds.stream().forEach(x->classIds.add(x));
imageClassIds.stream().forEach(x->classIds.add(x));
vodClassIds.stream().forEach(x -> classIds.add(x));
examClassIds.stream().forEach(x -> classIds.add(x));
answerClassIds.stream().forEach(x -> classIds.add(x));
imageClassIds.stream().forEach(x -> classIds.add(x));
try {
if (classIds.size() > 0) {
......@@ -138,6 +141,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_2);
}
}
return null;
}
......@@ -151,82 +159,80 @@ public class RenSheJuServiceImpl implements RenSheJuService {
ClassHourBehaviorDTO classHourBehaviorDTO = new ClassHourBehaviorDTO();
classHourBehaviorDTO.setPrivateKey(getSecret());
List<ClassHourBasic> classHourBasics = new ArrayList<>();
try {
//产生视频学习数据的班级
List<Long> vodClassIds = renSheJuMapper.vodClassIds("0");
List<DailyStudyInfoVO> result = new ArrayList<>();
// 产生视频学习数据的班级
List<Long> vodClassIds = renSheJuMapper.vodClassIds("0");
List<DailyStudyInfoVO> result = new ArrayList<>();
// List<Long> vodClassIds = new ArrayList<>();
//
// vodClassIds.add(451L);
for (Long classId : vodClassIds){
try {
for (Long classId : vodClassIds) {
//产生数据的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo(classId);
result.addAll(dailyStudyInfoVOS);
}
for (DailyStudyInfoVO dailyStudyInfoVO : result) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setDownCode(dailyStudyInfoVO.getDownCode());
//上线时间列表
//找到当天每次上线下线时间
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId());
List<LoginList> loginLists = new ArrayList<>();
for (int i = 0; i < loginRecords.size(); i++) {
LoginList loginList = new LoginList();
loginList.setIp(loginRecords.get(i).getIpAddress());
loginList.setStartTime(Timestamp.valueOf(loginRecords.get(i).getCreateDate()).getTime());
loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime());
//查看这个人该时间段的学习记录
List<ChapterList3> chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
if (chapterList3s.size() > 0) {
loginList.setChapterList(chapterList3s);
loginLists.add(loginList);
}
for (DailyStudyInfoVO dailyStudyInfoVO : result) {
ClassHourBasic classHourBasic = new ClassHourBasic();
BeanUtils.copyProperties(dailyStudyInfoVO, classHourBasic);
classHourBasic.setDownCode(dailyStudyInfoVO.getDownCode());
//找到当天每次上线下线时间
//上线时间
List<OprMemDictDO> loginRecords = renSheJuMapper.loginRecords(dailyStudyInfoVO.getMemberId());
//下线时间
List<OprMemDictDO> loginOutRecords = renSheJuMapper.loginOutRecords(dailyStudyInfoVO.getMemberId());
List<LoginList> loginLists = new ArrayList<>();
for (int i = 0; i < loginRecords.size(); i++) {
LoginList loginList = new LoginList();
loginList.setIp(loginRecords.get(i).getIpAddress());
loginList.setStartTime(Timestamp.valueOf(loginRecords.get(i).getCreateDate()).getTime());
loginList.setEndTime(Timestamp.valueOf(loginOutRecords.get(i).getCreateDate()).getTime());
//查看这个人该时间段的学习记录
List<ChapterList3> chapterList3s = renSheJuMapper.dailyStudyRecords(dailyStudyInfoVO.getMemberId(), dailyStudyInfoVO.getDownCode(), loginRecords.get(i).getCreateDate().toString().replace("T", " "), loginOutRecords.get(i).getCreateDate().toString().replace("T", " "));
if (chapterList3s.size() > 0) {
loginList.setChapterList(chapterList3s);
loginLists.add(loginList);
}
classHourBasic.setLoginList(loginLists);
//活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<DailyActivitiesVO> activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId());
for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
ActivityList activityList = new ActivityList();
if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) {
activityList.setAccess(1);
activityList.setErrorInfo(2);
} else {
activityList.setAccess(0);
}
}
classHourBasic.setLoginList(loginLists);
if (0 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(2);
} else if (1 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(1);
}
//活跃度列表
List<ActivityList> activityLists = new ArrayList<>();
List<DailyActivitiesVO> activityDetectionDOS = renSheJuMapper.dailyActivities(dailyStudyInfoVO.getDownCode(), dailyStudyInfoVO.getMemberId());
for (DailyActivitiesVO dailyActivitiesVO : activityDetectionDOS) {
activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
activityLists.add(activityList);
ActivityList activityList = new ActivityList();
if (null == dailyActivitiesVO.getAccess() || 0 == dailyActivitiesVO.getAccess()) {
activityList.setAccess(1);
activityList.setErrorInfo(2);
} else {
activityList.setAccess(0);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
if (0 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(2);
} else if (1 == dailyActivitiesVO.getCheckType()) {
activityList.setActivityDetection(1);
}
activityList.setActivityTime(dailyActivitiesVO.getActivityTime());
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
if (classHourBasics.size()>0){
if (classHourBasics.size() > 0) {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassHourBehavior")
.method("POST", body)
......@@ -246,13 +252,12 @@ public class RenSheJuServiceImpl implements RenSheJuService {
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
}else {
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.NO_DATA);
renshejuHistoryMapper.insert(renshejuHistoryDO);
return null;
}
// return null;
} catch (Exception e) {
......@@ -262,6 +267,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_3);
// }
}
return null;
}
......@@ -397,6 +407,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_4);
}
}
return null;
}
......@@ -485,6 +499,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_5);
}
}
return null;
}
......@@ -497,10 +515,13 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.build();
MediaType mediaType = MediaType.parse("application/json");
//找到昨天做过人脸识别的班级
List<Long> classIds = renSheJuMapper.checkClassIds("0");
// List<Long> classIds = new ArrayList<>();
//
// classIds.add(451L);
for (Long classId : classIds) {
UploadImageDTO uploadImage = new UploadImageDTO();
......@@ -571,7 +592,11 @@ public class RenSheJuServiceImpl implements RenSheJuService {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_6);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
if (null != rensheResponseVO.getCtt()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getMsg());
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
rensheResponseVOS.add(rensheResponseVO);
} else {
......@@ -589,6 +614,10 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadImage).toString());
renshejuHistoryDO.setOutputParam(RenSheJuConstant.PUSH_FAIL);
renshejuHistoryMapper.insert(renshejuHistoryDO);
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_6);
// }
}
}
......@@ -600,7 +629,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
RequestBody body = RequestBody.create(mediaType, "{\"privateKey\":\"" + getSecret() + "\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/getClassCodeByPrivateKey")
......@@ -674,9 +703,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_8);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(uploadClassCodeDTO).toString());
if (200 == response.code()) {
if (null != rensheResponseVO.getCtt()){
if (null != rensheResponseVO.getCtt()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
}else {
} else {
renshejuHistoryDO.setOutputParam(response.body().toString());
}
} else {
......@@ -700,7 +729,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
RequestBody body = RequestBody.create(mediaType, "{\"privateKey\":\"" + getSecret() + "\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/getErrorClass")
.method("POST", body)
......@@ -736,7 +765,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType,"{\"privateKey\":\""+getSecret()+"\"}");
RequestBody body = RequestBody.create(mediaType, "{\"privateKey\":\"" + getSecret() + "\"}");
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/clear")
......
......@@ -55,9 +55,19 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
@Autowired
private SMSUtils smsUtils;
@Autowired
private ExerciseDoneResultMapper exerciseDoneResultMapper;
@Transactional(rollbackFor = Exception.class)
public String insertHistory(VodPlayHistoryDO vodPlayHistoryDO) {
// Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
// .lambda()
// .eq(ExerciseDoneResultDO::getClassId, vodPlayHistoryDO.getClassId())
// .eq(ExerciseDoneResultDO::getMemberId, vodPlayHistoryDO.getMemberId())
// .eq(ExerciseDoneResultDO::getResult, "合格"));
// if (count == 0){
Date date = new Date();
if (vodPlayHistoryDO.getPlayLength() > 8 && vodPlayHistoryDO.getSuspendLength() <= 3000) {
//查看系统设定的时长
......@@ -94,11 +104,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// this.baseMapper.insert(vodPlayHistoryDO);
}
}
// }
return ConstantUtils.ADD_SUCCESS;
}
@Transactional(rollbackFor = Exception.class)
public String insertHistoryNew(InsertHistoryNewDTO insertHistoryNewDTO) {
// Integer count = exerciseDoneResultMapper.selectCount(new QueryWrapper<ExerciseDoneResultDO>()
// .lambda()
// .eq(ExerciseDoneResultDO::getClassId, insertHistoryNewDTO.getClassId())
// .eq(ExerciseDoneResultDO::getMemberId, insertHistoryNewDTO.getMemberId())
// .eq(ExerciseDoneResultDO::getResult, "合格"));
//
// if (count == 0){
Date date = new Date();
if (insertHistoryNewDTO.getPlayLength() > 8 && insertHistoryNewDTO.getSuspendLength() <= 3000) {
VodPlayHistoryDO vodPlayHistoryDO = new VodPlayHistoryDO();
......@@ -136,6 +156,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// this.baseMapper.insert(vodPlayHistoryDO);
}
}
// }
return ConstantUtils.ADD_SUCCESS;
}
......@@ -688,13 +709,41 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
System.out.println(result.toString());
if (result.size() > 0) {
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812"});
for (String telephone : telephones) {
smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
}
}
}
public List<Long> criticalData(VodPlayHistoryDO vodPlayHistoryDO) {
List<Long> result = new ArrayList<>();
List<Long> vodMembers = vodPlayHistoryMapper.vodMembers(vodPlayHistoryDO.getClassId());
VodDictDO vodDictDO = vodDictMapper.selectById(vodPlayHistoryDO.getVodId());
for (Long memberId : vodMembers){
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.selectList(new QueryWrapper<VodPlayHistoryDO>()
.lambda()
.eq(VodPlayHistoryDO::getClassId,vodPlayHistoryDO.getClassId())
.eq(VodPlayHistoryDO::getMemberId,memberId)
.eq(VodPlayHistoryDO::getVodId,vodPlayHistoryDO.getVodId())
.orderByAsc(VodPlayHistoryDO::getCreateDate));
int i = 0 ;
for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS){
i+=vodPlayHistoryDO1.getPlayLength();
if ( i >= vodDictDO.getVodLength()){
result.add(vodPlayHistoryDO1.getId());
break;
}
}
}
return result;
}
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
......@@ -738,13 +787,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
* 随机0-9秒
*/
public int random0to9() {
return (int) (Math.random() * 10+3);
return (int) (Math.random() * 10 + 3);
}
public static void main(String[] args) {
for (int i = 0; i < 50; i++) {
System.out.println((int) (Math.random() * 10)+3);
System.out.println((int) (Math.random() * 10) + 3);
}
// List<Long> list = new ArrayList<Long>();
......
......@@ -62,7 +62,7 @@
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="classSign" resultType="com.subsidy.vo.member.ClassSignVO">
......@@ -83,7 +83,7 @@
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="exerciseTest" resultType="com.subsidy.vo.administer.ExerciseTestVO">
......@@ -104,7 +104,7 @@
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="answerRecord" resultType="com.subsidy.vo.sign.AnswerRecordVO">
......@@ -126,7 +126,7 @@
<if test="userName !=null and userName !=''">
AND t2.user_name LIKE concat('%',#{userName} ,'%')
</if>
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="classActivityDetection" resultType="com.subsidy.vo.administer.MemberDetectionRecordVO">
......@@ -152,7 +152,7 @@
</if>
GROUP BY
t.member_id
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="imageCheckDetail" resultType="com.subsidy.vo.administer.ImageCheckDetailVO">
......@@ -205,7 +205,7 @@
t2.member_id,
t2.class_id
) t2 ON t1.id = t2.member_id
order by CONVERT(t1.user_name USING gbk) ASC
order by t1.account_name ASC
</select>
<select id="operators" parameterType="string" resultType="com.subsidy.vo.administer.OperatorsVO">
......
......@@ -61,7 +61,7 @@
<if test="userName !=null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
order by CONVERT(t2.user_name USING gbk) ASC
order by t2.account_name ASC
</select>
<select id="getMemberClassCount" parameterType="long" resultType="long">
......
......@@ -258,4 +258,32 @@
create_date=values(create_date)
</insert>
<select id="getLoginInfo" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
*
FROM
(
SELECT
*
FROM
opr_mem_dict t
where t.delete_date is null
and t.user_id = #{userId}
and DATE_FORMAT(t.create_date,'%Y-%m-%d') =DATE_FORMAT(now(), '%Y-%m-%d')
and TIMESTAMPDIFF(SECOND,t.create_date,now()) &lt;= 300
ORDER BY
t.create_date DESC
LIMIT 5)t2
</select>
<select id="clearTodayLoginData" parameterType="long">
DELETE
FROM
opr_mem_dict
WHERE
delete_date IS NULL
AND user_id = #{userId}
AND DATE_FORMAT( create_date, '%Y-%m-%d' ) = CURRENT_DATE
</select>
</mapper>
......@@ -467,7 +467,6 @@
AND DATE_FORMAT( DATE_ADD( t1.create_date,interval 1 day), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.paper_id IS NULL
AND t1.result = 1
and t1.member_id
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc
</select>
......@@ -491,7 +490,6 @@
and class_id = #{classId}
AND t1.paper_id IS not NULL
AND t1.result = 1
and t1.member_id
GROUP BY t1.class_id,t1.member_id
ORDER BY t1.create_date desc
</select>
......
......@@ -550,4 +550,14 @@
t.class_id
</select>
<select id="vodMembers" parameterType="long" resultType="long">
SELECT DISTINCT
t.member_id
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
and t.class_id = #{classId}
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!