Commit b9001907 by 涂亚平

补贴培训第3次上课熬夜改数据

1 parent 9c71b838
......@@ -80,8 +80,8 @@ public class VodPlayHistoryController {
@GetMapping("testPlays")
@ApiOperation("解决有交叉时间的数据 classId")
public ResponseVO testPlays(@RequestParam("classId") Long classId ){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays(classId));
public ResponseVO testPlays(){
return ResponseData.generateCreatedResponse(0,vodPlayHistoryService.testPlays());
}
@PostMapping("warning")
......
......@@ -10,13 +10,14 @@ import com.subsidy.vo.vod.VodPlayStateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
//@Component
@Component
public class WarningJob {
/**
......@@ -67,11 +68,6 @@ public class WarningJob {
}
}
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// telephones.stream().forEach(x -> {
// smsUtils.sendVerifySMS("SMS_460945631", x, result.toString());
// });
if (result.size()>0){
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
for (String telephone : telephones){
......
......@@ -37,7 +37,7 @@ public interface RenSheJuMapper {
/**
* 前一天新增视频学习数据
*/
List<DailyStudyInfoVO> dailyStudyInfo(String classType);
List<DailyStudyInfoVO> dailyStudyInfo(String classId);
/**
* 前一天活跃度检测列表
......
......@@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.VodPlayStateVO;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -33,7 +34,7 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void playLengthFix(RemainSecondsDTO remainSecondsDTO);
HashSet<Long> testPlays(Long classId);
HashMap<Long, HashSet<Long>> testPlays();
void warning();
......
......@@ -30,6 +30,12 @@ public class DudaoServiceImpl implements DudaoService {
*/
public static final String PREFIX_URL = "http://180.167.195.117:18015/ddproject";
/**
* 正式环境
*/
public static final String PROD_URL = "http://180.167.195.117:18025/ddproject";
@Autowired
private RenSheJuMapper renSheJuMapper;
......
......@@ -102,27 +102,27 @@ public class RenSheJuServiceImpl implements RenSheJuService {
System.out.println(JSONObject.fromObject(classBaseInfoDTO).toString());
// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString());
// Request request = new Request.Builder()
// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass")
// .method("POST", body)
// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
// .addHeader("Content-Type", "application/json")
// .build();
// Response response = client.newCall(request).execute();
//
// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
// if (200 == response.code()) {
// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
// } else {
// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
// }
// renshejuHistoryMapper.insert(renshejuHistoryDO);
// return rensheResponseVO;
return null;
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
// return null;
} else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2);
......@@ -155,7 +155,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List<ClassHourBasic> classHourBasics = new ArrayList<>();
try {
//前一天新增视频学习数据的班级
//看视频的班级
List<DailyStudyInfoVO> dailyStudyInfoVOS = renSheJuMapper.dailyStudyInfo("0");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
ClassHourBasic classHourBasic = new ClassHourBasic();
......@@ -208,35 +208,36 @@ public class RenSheJuServiceImpl implements RenSheJuService {
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
if (classHourBasics.size()>0){
// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
//
// Request request = new Request.Builder()
// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassHourBehavior")
// .method("POST", body)
// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
// .addHeader("Content-Type", "application/json")
// .build();
// Response response = client.newCall(request).execute();
//
// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
// if (200 == response.code()) {
// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
// } else {
// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
// }
// renshejuHistoryMapper.insert(renshejuHistoryDO);
// return rensheResponseVO;
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassHourBehavior")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class);
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString());
if (200 == response.code()) {
renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString());
} else {
renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR);
}
renshejuHistoryMapper.insert(renshejuHistoryDO);
return rensheResponseVO;
}else {
RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO();
renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3);
......
......@@ -635,14 +635,18 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// }
}
public HashSet<Long> testPlays(Long classId) {
public HashMap<Long, HashSet<Long>> testPlays() {
// String[] classIdArr = classIds.split(",");
HashSet<Long> result = new HashSet<>();
// for (String classId : classIdArr) {
//查看当天产生视频学习的班级
List<Long> classIds = vodPlayHistoryMapper.dailyVodRecord();
HashMap<Long, HashSet<Long>> hashMap = new HashMap();
for (Long classId : classIds) {
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, classId));
HashSet<Long> result = new HashSet<>();
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
......@@ -650,7 +654,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
//这一条数据有问题
System.out.println("111111111111111111111" + vodPlayStateVO);
// System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
......@@ -669,8 +673,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
}
// }
return result;
hashMap.put(classId,result);
}
return hashMap;
}
public void warning() {
......@@ -691,7 +696,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() > vodPlayStateVO.getStartDate().getTime()) {
if (!result.contains(vodPlayStateVO1.getClassId())){
if (!result.contains(vodPlayStateVO1.getClassId())) {
result.add(vodPlayStateVO.getClassId());
}
}
......@@ -699,12 +704,13 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
}
}
if (result.size()>0){
List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
for (String telephone : telephones){
smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
}
}
System.out.println(result.toString());
// if (result.size()>0){
// List<String> telephones = Arrays.asList(new String[]{"15201936167", "18201963812", "18217669021"});
// for (String telephone : telephones){
// smsUtils.sendWarning("SMS_460945631", telephone, result.toString());
// }
// }
}
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
......
......@@ -105,25 +105,30 @@
<select id="dailyStudyInfo" resultType="com.subsidy.vo.renshe.DailyStudyInfoVO">
SELECT
t2.class_id AS downCode,
t2.member_id,
DISTINCT
IFNULL(t2.class_id,t7.class_id) AS downCode,
t6.member_id,
t4.user_name AS studentName,
t4.telephone AS phone,
t4.id_card AS identity,
t2.learnTime,
t2.playTime,
IFNULL(t2.learnTime,0),
IFNULL(t2.playTime,0),
t5.loginTime
FROM
(
class_member_mapping t6
LEFT JOIN member t4 ON t4.id = t6.member_id
LEFT JOIN (
SELECT
t3.user_id,
login - logout AS loginTime
login - logout AS loginTime ,
t3.create_date
FROM
(
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS login
unix_timestamp( t1.create_date )) AS login ,
create_date
FROM
opr_mem_dict t1
WHERE
......@@ -138,7 +143,8 @@
SELECT
user_id,
sum(
unix_timestamp( t1.create_date )) AS logout
unix_timestamp( t1.create_date )) AS logout ,
create_date
FROM
opr_mem_dict t1
WHERE
......@@ -149,7 +155,7 @@
GROUP BY
user_id
) t2 ON t3.user_id = t2.user_id
) t5
) t5 on t5.user_id = t4.id
LEFT JOIN (
SELECT
t1.class_id,
......@@ -165,10 +171,11 @@
t1.class_id,
t1.member_id
) t2 ON t5.user_id = t2.member_id
LEFT JOIN class_dict t3 ON t2.class_id = t3.id
LEFT JOIN member t4 ON t2.member_id = t4.id
LEFT JOIN class_dict t3 ON t2.class_id = t3.id and t6.class_id = t3.id
LEFT JOIN image_check_record t7 on t5.user_id = t7.member_id and DATE_FORMAT(t5.create_date,'%Y-%m-%d') = DATE_FORMAT(t7.create_date,'%Y-%m-%d') and t7.result = 1
where t6.delete_date is null and t5.loginTime is not null and IFNULL(t2.class_id,t7.class_id) is not null
<if test="classType != null and classType != ''">
where t3.class_type = #{classType}
and t3.class_type = #{classType}
</if>
</select>
......@@ -254,8 +261,7 @@
</select>
<select id="loginOutRecords" parameterType="long" resultType="com.subsidy.model.OprMemDictDO">
SELECT
distinct *
select distinct *
FROM
opr_mem_dict t
WHERE
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!