Commit 6be77ec7 by 涂亚平

exportExerciseTest导出新增考试时长字段

1 parent af0e0279
......@@ -15,4 +15,6 @@ public class RenSheConfig {
//私钥
private String secretKey;
//普陀 正式接口
private String putuo;
}
......@@ -123,7 +123,7 @@ public class AdministerController {
@PostMapping("exportExerciseTest")
@ApiOperation("班级管理--测评成绩 id 班级id userName paperId")
@LoginRequired
// @LoginRequired
public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO) throws Exception {
classDetailDTO.setFlag(true);
administerService.exportExerciseTest(classDetailDTO);
......
package com.subsidy.controller;
import com.subsidy.dto.renshe.*;
import com.subsidy.service.DudaoService;
import com.subsidy.service.RenSheJuService;
import com.subsidy.vo.renshe.RensheResponseVO;
import com.subsidy.vo.renshe.RensheStringVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,7 +10,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.List;
@RestController
@Api(tags = "普陀区人社督导")
......@@ -23,6 +19,11 @@ public class DuDaoController {
@Autowired
private DudaoService dudaoService;
@PostMapping("all")
public RensheResponseVO all() throws IOException{
return dudaoService.all();
}
@PostMapping("classBaseInfo")
@ApiOperation("POST-1:班级基本信息信息采集接口")
public RensheResponseVO classBaseInfo() throws IOException {
......
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 人社局推送失败记录表 前端控制器
* </p>
*
* @author Tuyp
* @since 2023-02-07
*/
@RestController
@Api(tags = "人社局推送失败记录表")
@RequestMapping("/rensheju-history-do")
public class RenshejuHistoryController {
}
//package com.subsidy.jobs;
//
//import com.subsidy.service.DudaoService;
//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;
//
///**
// * 企业职工线上培训
// */
//@Component
//public class DudaoJob {
//
// @Value("${spring.profiles.active}")
// private String env;
//
// @Autowired
// private DudaoService dudaoService;
//
// @Scheduled(cron = "0 0 2 * * ?")
// public void classBaseInfo() throws IOException {
// if ("prod".equals(env)){
// dudaoService.classBaseInfo();
// }
// }
//
// @Scheduled(cron = "0 5 2 * * ?")
// public void classHourBehavior() throws IOException {
// if ("prod".equals(env)){
// dudaoService.classHourBehavior();
// }
// }
//
// @Scheduled(cron = "0 10 2 * * ?")
// public void uploadChapterBehavior() throws IOException {
// if ("prod".equals(env)){
// dudaoService.uploadChapterBehavior();
// }
// }
//
// @Scheduled(cron = "0 15 2 * * ?")
// public void uploadClassAnswerQuestionBehavior() throws IOException {
// if ("prod".equals(env)){
// dudaoService.uploadClassAnswerQuestionBehavior();
// }
// }
//
// @Scheduled(cron = "0 20 2 * * ?")
// public void uploadClassCode()throws IOException {
// if ("prod".equals(env)){
// dudaoService.uploadClassCode();
// }
// }
//
//}
package com.subsidy.jobs;
import com.subsidy.service.DudaoService;
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;
/**
* 企业职工线上培训
*/
@Component
public class DudaoJob {
@Value("${spring.profiles.active}")
private String env;
@Autowired
private DudaoService dudaoService;
@Scheduled(cron = "0 0 2 * * ?")
public void classBaseInfo() throws IOException {
if ("prod".equals(env)){
dudaoService.classBaseInfo();
}
}
@Scheduled(cron = "0 5 2 * * ?")
public void classHourBehavior() throws IOException {
if ("prod".equals(env)){
dudaoService.classHourBehavior();
}
}
@Scheduled(cron = "0 10 2 * * ?")
public void uploadChapterBehavior() throws IOException {
if ("prod".equals(env)){
dudaoService.uploadChapterBehavior();
}
}
@Scheduled(cron = "0 15 2 * * ?")
public void uploadClassAnswerQuestionBehavior() throws IOException {
if ("prod".equals(env)){
dudaoService.uploadClassAnswerQuestionBehavior();
}
}
@Scheduled(cron = "0 20 2 * * ?")
public void uploadClassCode()throws IOException {
if ("prod".equals(env)){
dudaoService.uploadClassCode();
}
}
}
......@@ -157,7 +157,7 @@ public class RenSheJuJob {
/**
* 删掉有登录数据 做过人脸 没有学习数据(视频+考试+答疑)
*/
@Scheduled(cron = "0 01 16 * * ?")
@Scheduled(cron = "0 35 23 * * ?")
@Transactional(rollbackFor = Exception.class)
public void deleteNoStudyMembers() {
......
......@@ -7,6 +7,8 @@ import java.io.IOException;
public interface DudaoService {
RensheResponseVO all()throws IOException;
RensheResponseVO classBaseInfo() throws IOException;
RensheResponseVO classHourBehavior() throws IOException;
......
......@@ -767,6 +767,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
exerciseTestVO.setEndDate(testScoreInfoVO.getEndDate());
exerciseTestVO.setScore(testScoreInfoVO.getScore());
exerciseTestVO.setResult(testScoreInfoVO.getResult());
exerciseTestVO.setPeriod(MathUtil.exerciseLength(testScoreInfoVO.getDiff()));
//测评次数
exerciseTestVO.setCount(testScoreInfoVO.getCnt());
} else {
......@@ -1418,9 +1419,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
memberDepartmentMappingMapper.insert(memberDepartmentMappingDO);
}
}
System.out.println(failMembers);
});
} catch (
Exception e) {
} catch (Exception e) {
e.printStackTrace();
throw new HttpException(10001);
}
......
package com.subsidy.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.configure.RenSheConfig;
import com.subsidy.dto.renshe.*;
import com.subsidy.mapper.*;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.DudaoMapper;
import com.subsidy.mapper.RenSheJuMapper;
import com.subsidy.mapper.RenshejuHistoryMapper;
import com.subsidy.model.*;
import com.subsidy.service.DudaoService;
import com.subsidy.service.RenSheJuService;
import com.subsidy.util.OSSUtils;
import com.subsidy.util.DudaoConstant;
import com.subsidy.vo.renshe.*;
import net.sf.json.JSONObject;
......@@ -19,22 +19,23 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.*;
@Service
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";
// /**
// * 测试环境
// */
// 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 RenSheConfig renSheConfig;
@Autowired
private RenSheJuMapper renSheJuMapper;
......@@ -48,6 +49,17 @@ public class DudaoServiceImpl implements DudaoService {
@Autowired
private DudaoMapper dudaoMapper;
public RensheResponseVO all()throws IOException{
classBaseInfo();
classHourBehavior();
uploadChapterBehavior();
uploadClassAnswerQuestionBehavior();
uploadClassCode();
return new RensheResponseVO();
}
public RensheResponseVO classBaseInfo() throws IOException {
OkHttpClient client = new OkHttpClient().newBuilder()
......@@ -74,7 +86,6 @@ public class DudaoServiceImpl implements DudaoService {
//人脸识别
List<Long> imageClassIds = dudaoMapper.imageClassIds("0");
Set<Long> classIds = new HashSet<>();
vodClassIds.stream().forEach(x->classIds.add(x));
......@@ -109,7 +120,7 @@ public class DudaoServiceImpl implements DudaoService {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/classbasicinformation/insertClassBasicInformation")
.url(renSheConfig.getPutuo() + "/classbasicinformation/insertClassBasicInformation")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
......@@ -163,9 +174,19 @@ public class DudaoServiceImpl implements DudaoService {
List<ClassHourBasic> classHourBasics = new ArrayList<>();
try {
//前一天新增视频学习数据的班级并且是普陀的
List<DailyStudyInfoVO> dailyStudyInfoVOS = dudaoMapper.dailyStudyInfo("0");
for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) {
//产生视频学习数据的班级
List<Long> vodClassIds = dudaoMapper.vodClassIds("0");
List<DailyStudyInfoVO> result = new ArrayList<>();
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());
......@@ -216,9 +237,10 @@ public class DudaoServiceImpl implements DudaoService {
activityLists.add(activityList);
}
classHourBasic.setActivityList(activityLists);
classHourBasics.add(classHourBasic);
}
classHourBehaviorDTO.setClassHourBasic(classHourBasics);
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
......@@ -227,7 +249,7 @@ public class DudaoServiceImpl implements DudaoService {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/learnduration/insertLearnDuration")
.url(renSheConfig.getPutuo() + "/learnduration/insertLearnDuration")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
......@@ -366,7 +388,7 @@ public class DudaoServiceImpl implements DudaoService {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadChapterBehaviorDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/examinformation/insertExamInformation")
.url(renSheConfig.getPutuo() + "/examinformation/insertExamInformation")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
......@@ -459,7 +481,7 @@ public class DudaoServiceImpl implements DudaoService {
System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadClassAnswerQuestionBehaviorDTO));
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadClassAnswerQuestionBehaviorDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/answertutor/insertAnswerTutor")
.url(renSheConfig.getPutuo() + "/answertutor/insertAnswerTutor")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
......@@ -527,7 +549,7 @@ public class DudaoServiceImpl implements DudaoService {
try {
RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadClassCodeDTO).toString());
Request request = new Request.Builder()
.url(PREFIX_URL + "/bindclass/insertBindClass")
.url(renSheConfig.getPutuo() + "/bindclass/insertBindClass")
.method("POST", body)
.addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)")
.addHeader("Content-Type", "application/json")
......
......@@ -18,7 +18,6 @@ import okhttp3.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.sql.Timestamp;
......
......@@ -10,7 +10,7 @@ public class ExcelFormatUtils {
public static final List<String> signList = Arrays.asList("序号", "成员名称", "身份证号", "联系方式", "签到次数", "签到时间","最近签到ip地址","最近签到设备型号");
public static final List<String> scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数","开始时间","结束时间", "总评价");
public static final List<String> scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数","开始时间","结束时间","测评时间", "总评价");
public static final List<String> answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间");
......
......@@ -940,7 +940,7 @@ public class ExcelUtil {
sheet.addMergedRegion(cellRangeAddress21);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress21, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 6);
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 9);
sheet.addMergedRegion(cellRangeAddress22);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress22, sheet, workbook); //给合并过的单元格加边框
......@@ -952,11 +952,11 @@ public class ExcelUtil {
//第三行 2
SXSSFRow thirdRow = sheet.createRow(2); //第二行 rowIndex =1
CellRangeAddress cellRangeAddress31 = new CellRangeAddress(2, 2, 0, 4);
CellRangeAddress cellRangeAddress31 = new CellRangeAddress(2, 2, 0, 3);
sheet.addMergedRegion(cellRangeAddress31);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress31, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 5, 8);
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 4, 9);
sheet.addMergedRegion(cellRangeAddress32);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress32, sheet, workbook); //给合并过的单元格加边框
thirdRow.createCell(0).setCellValue(thirdHead[0]);
......@@ -1035,6 +1035,10 @@ public class ExcelUtil {
newCell = dataRow.createCell(8);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(exerciseTestVO.getPeriod());
newCell = dataRow.createCell(9);
newCell.setCellStyle(cellStyle);
if (exerciseTestVO.getScore() >= 60) {
newCell.setCellValue("合格");
} else {
......
......@@ -46,6 +46,7 @@ public class WebSocketUtil implements WebSocketHandler {
private int reconnectionSeconds = 30; //每次断连间隔重新连接秒
/**
selfExport
* 存放建立连接webSocket对象 Map<memberId,session>
*/
public static ConcurrentHashMap<Long, WebSocketSession> webSocketMap = new ConcurrentHashMap();
......
......@@ -32,6 +32,8 @@ public class ExerciseTestVO {
private String endDate;
private String period;
private String companyName;
}
......@@ -16,4 +16,6 @@ public class TestScoreInfoVO {
private String startDate;
private String endDate;
private Integer diff;
}
......@@ -57,4 +57,5 @@ qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy
qxueyou.url=https://dev.qxueyou.com/auth/user/token
renshe.url = https://test.shzypxy.com
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
\ No newline at end of file
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
renshe.putuo = http://180.167.195.117:18015/ddproject
\ No newline at end of file
......@@ -49,4 +49,5 @@ qxueyou.url=https://www.qxueyou.com/auth/user/token
renshe.url = https://api.shzypxy.com
#renshe.url = http://trial.shzypxy.com/api
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
\ No newline at end of file
renshe.secretKey = ad927f0b-6a39-43a7-bac7-163baef1fff7
renshe.putuo = http://180.167.195.117:18025/ddproject
\ No newline at end of file
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
#和CPU数
spring.server.acceptorThreadCount=600
spring.server.minSpareThreads=100
......
......@@ -45,75 +45,76 @@
<select id="contentVodProcess" resultType="com.subsidy.vo.member.MemberVodVO">
SELECT
t3.id,
t3.vod_url,
t3.vod_name,
t3.vod_type,
t3.vod_length,
t3.play_record,
if(t3.vod_length - t3.sumPlay > 0, TRUNCATE(t3.vod_length - t3.sumPlay,0), 0 ) AS leftLength,
if(TRUNCATE( t3.sumPlay * 100 / t3.vod_length,2) &lt; 100,TRUNCATE( t3.sumPlay * 100 / t3.vod_length, 2),100) AS percent
t3.id,
t3.vod_url,
t3.vod_alias_name as vod_name,
t3.vod_type,
t3.vod_length,
t3.play_record,
if(t3.vod_length - t3.sumPlay > 0, TRUNCATE(t3.vod_length - t3.sumPlay,0), 0 ) AS leftLength,
if(TRUNCATE( t3.sumPlay * 100 / t3.vod_length,2) &lt; 100,TRUNCATE( t3.sumPlay * 100 / t3.vod_length, 2),100) AS percent
FROM
(
SELECT
t.id,
t.vod_url,
t.vod_name,
t.vod_type,
t.vod_length,
t.order_no,
ifnull( t2.sumPlay, 0 ) AS sumPlay,
t4.play_record
FROM
vod_dict t
LEFT JOIN content_vod_mapping cvm ON cvm.vod_id = t.id
LEFT JOIN (
SELECT
t.vod_id,
t.member_id,
sum( t.play_length ) AS sumPlay
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.class_id = #{classId}
GROUP BY
t.vod_id,
t.member_id,
t.class_id
) t2 ON t.id = t2.vod_id
LEFT JOIN (
SELECT
t.member_id,
t.vod_id,
t2.play_record
FROM
(
SELECT
t.member_id,
t.vod_id,
max( t.id ) AS id
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
and t.class_id = #{classId}
GROUP BY
t.member_id,
t.vod_id,
t.class_id
) t
LEFT JOIN vod_play_history t2 ON t.id = t2.id
) t4 ON t2.vod_id = t4.vod_id
WHERE
t.delete_date IS NULL
AND cvm.delete_date IS NULL
and cvm.content_id = #{contentId}
) t3
(
SELECT
t.id,
t.vod_url,
cvm.vod_alias_name,
t.vod_type,
t.vod_length,
cvm.order_no as or1,
t.order_no as or2,
ifnull( t2.sumPlay, 0 ) AS sumPlay,
t4.play_record
FROM
vod_dict t
LEFT JOIN content_vod_mapping cvm ON cvm.vod_id = t.id
LEFT JOIN (
SELECT
t.vod_id,
t.member_id,
sum( t.play_length ) AS sumPlay
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.class_id = #{classId}
GROUP BY
t.vod_id,
t.member_id,
t.class_id
) t2 ON t.id = t2.vod_id
LEFT JOIN (
SELECT
t.member_id,
t.vod_id,
t2.play_record
FROM
(
SELECT
t.member_id,
t.vod_id,
max( t.id ) AS id
FROM
vod_play_history t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
and t.class_id = #{classId}
GROUP BY
t.member_id,
t.vod_id,
t.class_id
) t
LEFT JOIN vod_play_history t2 ON t.id = t2.id
) t4 ON t2.vod_id = t4.vod_id
WHERE
t.delete_date IS NULL
AND cvm.delete_date IS NULL
and cvm.content_id = #{contentId}
) t3
ORDER BY
t3.order_no
t3.or1,t3.or2
</select>
<select id="contentFiles" parameterType="long" resultType="com.subsidy.model.FileDictDO">
......
......@@ -125,7 +125,8 @@
t1.result,
t2.cnt,
t1.startDate,
t1.endDate
t1.endDate,
t1.diff
FROM
(
SELECT
......@@ -136,7 +137,8 @@
IF
( ( t.score )>= 60, '合格', '不合格' ) AS result,
t.start_date startDate,
t.create_date as endDate
t.create_date as endDate,
TIMESTAMPDIFF( SECOND, t.start_date, t.create_date ) AS diff
FROM
exercise_done_result t
LEFT JOIN paper_dict t2 ON t.paper_id = t2.id
......
......@@ -130,7 +130,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.create_date, interval 1 day ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登出"
AND result = 1
......@@ -146,7 +146,7 @@
FROM
opr_mem_dict t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.create_date, interval 1 day ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND opr_type = "登录"
AND result = 1
......@@ -164,8 +164,9 @@
FROM
vod_play_history t1
WHERE
DATE_FORMAT( DATE_ADD( t1.create_date, INTERVAL 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
DATE_FORMAT( DATE_ADD( t1.create_date, interval 1 day ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t1.delete_date IS NULL
AND t1.class_id = #{classId}
GROUP BY
t1.class_id,
t1.member_id
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!