From 6be77ec7c9d46ea454f2a425654bfef74d1769b0 Mon Sep 17 00:00:00 2001 From: tuyp Date: Mon, 10 Jul 2023 14:08:24 +0800 Subject: [PATCH] exportExerciseTest导出新增考试时长字段 --- src/main/java/com/subsidy/common/configure/RenSheConfig.java | 2 ++ src/main/java/com/subsidy/controller/AdministerController.java | 2 +- src/main/java/com/subsidy/controller/DuDaoController.java | 9 +++++---- src/main/java/com/subsidy/controller/RenshejuHistoryController.java | 22 ---------------------- src/main/java/com/subsidy/jobs/DudaoJob.java | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------- src/main/java/com/subsidy/jobs/RenSheJuJob.java | 2 +- src/main/java/com/subsidy/service/DudaoService.java | 2 ++ src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 5 +++-- src/main/java/com/subsidy/service/impl/DudaoServiceImpl.java | 70 ++++++++++++++++++++++++++++++++++++++++++++++------------------------ src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java | 1 - src/main/java/com/subsidy/util/ExcelFormatUtils.java | 2 +- src/main/java/com/subsidy/util/excel/ExcelUtil.java | 10 +++++++--- src/main/java/com/subsidy/util/websocket/WebSocketUtil.java | 1 + src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java | 2 ++ src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java | 2 ++ src/main/resources/application-dev.properties | 3 ++- src/main/resources/application-prod.properties | 3 ++- src/main/resources/application.properties | 2 +- src/main/resources/mapper/CourseContentMapper.xml | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------- src/main/resources/mapper/ExerciseDoneResultMapper.xml | 6 ++++-- src/main/resources/mapper/RenSheJuMapper.xml | 7 ++++--- 21 files changed, 212 insertions(+), 192 deletions(-) delete mode 100644 src/main/java/com/subsidy/controller/RenshejuHistoryController.java diff --git a/src/main/java/com/subsidy/common/configure/RenSheConfig.java b/src/main/java/com/subsidy/common/configure/RenSheConfig.java index 3d260ec..65e7680 100644 --- a/src/main/java/com/subsidy/common/configure/RenSheConfig.java +++ b/src/main/java/com/subsidy/common/configure/RenSheConfig.java @@ -15,4 +15,6 @@ public class RenSheConfig { //私钥 private String secretKey; + //普陀 正式接口 + private String putuo; } diff --git a/src/main/java/com/subsidy/controller/AdministerController.java b/src/main/java/com/subsidy/controller/AdministerController.java index 1fe2380..3b2590e 100644 --- a/src/main/java/com/subsidy/controller/AdministerController.java +++ b/src/main/java/com/subsidy/controller/AdministerController.java @@ -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); diff --git a/src/main/java/com/subsidy/controller/DuDaoController.java b/src/main/java/com/subsidy/controller/DuDaoController.java index b559a76..b2b4a49 100644 --- a/src/main/java/com/subsidy/controller/DuDaoController.java +++ b/src/main/java/com/subsidy/controller/DuDaoController.java @@ -1,10 +1,7 @@ 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 { diff --git a/src/main/java/com/subsidy/controller/RenshejuHistoryController.java b/src/main/java/com/subsidy/controller/RenshejuHistoryController.java deleted file mode 100644 index 03bc5de..0000000 --- a/src/main/java/com/subsidy/controller/RenshejuHistoryController.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.subsidy.controller; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; - -/** - *

- * 人社局推送失败记录表 前端控制器 - *

- * - * @author Tuyp - * @since 2023-02-07 - */ -@RestController -@Api(tags = "人社局推送失败记录表") -@RequestMapping("/rensheju-history-do") -public class RenshejuHistoryController { - -} diff --git a/src/main/java/com/subsidy/jobs/DudaoJob.java b/src/main/java/com/subsidy/jobs/DudaoJob.java index 67e87ad..936af5b 100644 --- a/src/main/java/com/subsidy/jobs/DudaoJob.java +++ b/src/main/java/com/subsidy/jobs/DudaoJob.java @@ -1,58 +1,58 @@ -//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(); + } + } + +} diff --git a/src/main/java/com/subsidy/jobs/RenSheJuJob.java b/src/main/java/com/subsidy/jobs/RenSheJuJob.java index 5227221..3be388c 100644 --- a/src/main/java/com/subsidy/jobs/RenSheJuJob.java +++ b/src/main/java/com/subsidy/jobs/RenSheJuJob.java @@ -157,7 +157,7 @@ public class RenSheJuJob { /** * 删掉有登录数据 做过人脸 没有学习数据(视频+考试+答疑) */ - @Scheduled(cron = "0 01 16 * * ?") + @Scheduled(cron = "0 35 23 * * ?") @Transactional(rollbackFor = Exception.class) public void deleteNoStudyMembers() { diff --git a/src/main/java/com/subsidy/service/DudaoService.java b/src/main/java/com/subsidy/service/DudaoService.java index 1514e01..f7c46f9 100644 --- a/src/main/java/com/subsidy/service/DudaoService.java +++ b/src/main/java/com/subsidy/service/DudaoService.java @@ -7,6 +7,8 @@ import java.io.IOException; public interface DudaoService { + RensheResponseVO all()throws IOException; + RensheResponseVO classBaseInfo() throws IOException; RensheResponseVO classHourBehavior() throws IOException; diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java index e66fa5b..676edd3 100644 --- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java @@ -767,6 +767,7 @@ public class AdministerServiceImpl extends ServiceImpl imageClassIds = dudaoMapper.imageClassIds("0"); - Set 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 classHourBasics = new ArrayList<>(); try { - //前一天新增视频学习数据的班级并且是普陀的 - List dailyStudyInfoVOS = dudaoMapper.dailyStudyInfo("0"); - for (DailyStudyInfoVO dailyStudyInfoVO : dailyStudyInfoVOS) { + + //产生视频学习数据的班级 + List vodClassIds = dudaoMapper.vodClassIds("0"); + + List result = new ArrayList<>(); + + for (Long classId : vodClassIds){ + //产生数据的班级 + List 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") diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index c0e5b28..2b03bf2 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -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; diff --git a/src/main/java/com/subsidy/util/ExcelFormatUtils.java b/src/main/java/com/subsidy/util/ExcelFormatUtils.java index 2fe3180..c0330e2 100644 --- a/src/main/java/com/subsidy/util/ExcelFormatUtils.java +++ b/src/main/java/com/subsidy/util/ExcelFormatUtils.java @@ -10,7 +10,7 @@ public class ExcelFormatUtils { public static final List signList = Arrays.asList("序号", "成员名称", "身份证号", "联系方式", "签到次数", "签到时间","最近签到ip地址","最近签到设备型号"); - public static final List scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数","开始时间","结束时间", "总评价"); + public static final List scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数","开始时间","结束时间","测评时间", "总评价"); public static final List answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"); diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java index 8182d79..2372344 100644 --- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java +++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java @@ -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 { diff --git a/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java b/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java index 6c00456..bbfed41 100644 --- a/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java +++ b/src/main/java/com/subsidy/util/websocket/WebSocketUtil.java @@ -46,6 +46,7 @@ public class WebSocketUtil implements WebSocketHandler { private int reconnectionSeconds = 30; //每次断连间隔重新连接秒 /** + selfExport * 存放建立连接webSocket对象 Map */ public static ConcurrentHashMap webSocketMap = new ConcurrentHashMap(); diff --git a/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java b/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java index 5a7c5ac..96879a1 100644 --- a/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java +++ b/src/main/java/com/subsidy/vo/administer/ExerciseTestVO.java @@ -32,6 +32,8 @@ public class ExerciseTestVO { private String endDate; + private String period; + private String companyName; } diff --git a/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java index b85bc23..f3dbdd7 100644 --- a/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java +++ b/src/main/java/com/subsidy/vo/done/TestScoreInfoVO.java @@ -16,4 +16,6 @@ public class TestScoreInfoVO { private String startDate; private String endDate; + + private Integer diff; } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 1dbb2bb..9df4427 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -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 diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index 6f6a815..ed4a2da 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -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 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index cc0c047..71c7dba 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ # 环境配置 -spring.profiles.active=prod +spring.profiles.active=dev #和CPU数 spring.server.acceptorThreadCount=600 spring.server.minSpareThreads=100 diff --git a/src/main/resources/mapper/CourseContentMapper.xml b/src/main/resources/mapper/CourseContentMapper.xml index 6c56433..0dd672b 100644 --- a/src/main/resources/mapper/CourseContentMapper.xml +++ b/src/main/resources/mapper/CourseContentMapper.xml @@ -45,75 +45,76 @@