From 85298f8d868afbc9f68aaf1bb146f076e13116e2 Mon Sep 17 00:00:00 2001
From: Administrator
Date: Fri, 26 Nov 2021 18:11:08 +0800
Subject: [PATCH] 视频上传转码替换
---
src/main/java/com/subsidy/common/configure/VODConfig.java | 2 ++
src/main/java/com/subsidy/controller/ClassHourDictController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/main/java/com/subsidy/controller/VodDictController.java | 1 +
src/main/java/com/subsidy/mapper/ClassHourDictMapper.java | 18 ++++++++++++++++++
src/main/java/com/subsidy/model/ClassHourDictDO.java | 39 +++++++++++++++++++++++++++++++++++++++
src/main/java/com/subsidy/service/ClassHourDictService.java | 23 +++++++++++++++++++++++
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java | 88 +++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------
src/main/java/com/subsidy/service/impl/ClassDictServiceImpl.java | 6 +++---
src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java | 21 ++++++++++++++++-----
src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
src/main/java/com/subsidy/util/ConstantUtils.java | 2 +-
src/main/java/com/subsidy/util/DateFormatUtil.java | 5 +----
src/main/java/com/subsidy/util/ExcelFormatUtils.java | 8 ++++----
src/main/java/com/subsidy/util/MathUtil.java | 2 +-
src/main/java/com/subsidy/util/Signature.java | 4 ++++
src/main/java/com/subsidy/util/ZipTestUtils.java | 15 ++++++++-------
src/main/java/com/subsidy/util/ZipUtils.java | 5 +++--
src/main/java/com/subsidy/util/excel/ExcelUtil.java | 16 ++++++++--------
src/main/java/com/subsidy/vo/hour/PollingGetVO.java | 10 ++++++++++
src/main/resources/application-prod.properties | 8 ++++----
src/main/resources/application.properties | 5 +++--
src/main/resources/mapper/ClassHourDictMapper.xml | 23 +++++++++++++++++++++++
23 files changed, 415 insertions(+), 81 deletions(-)
create mode 100644 src/main/java/com/subsidy/controller/ClassHourDictController.java
create mode 100644 src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
create mode 100644 src/main/java/com/subsidy/model/ClassHourDictDO.java
create mode 100644 src/main/java/com/subsidy/service/ClassHourDictService.java
create mode 100644 src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
create mode 100644 src/main/java/com/subsidy/vo/hour/PollingGetVO.java
create mode 100644 src/main/resources/mapper/ClassHourDictMapper.xml
diff --git a/src/main/java/com/subsidy/common/configure/VODConfig.java b/src/main/java/com/subsidy/common/configure/VODConfig.java
index 699cad7..b27c94c 100644
--- a/src/main/java/com/subsidy/common/configure/VODConfig.java
+++ b/src/main/java/com/subsidy/common/configure/VODConfig.java
@@ -22,4 +22,6 @@ public class VODConfig {
private String api;
private String region;
+
+ private Integer classId;
}
diff --git a/src/main/java/com/subsidy/controller/ClassHourDictController.java b/src/main/java/com/subsidy/controller/ClassHourDictController.java
new file mode 100644
index 0000000..19fb9ee
--- /dev/null
+++ b/src/main/java/com/subsidy/controller/ClassHourDictController.java
@@ -0,0 +1,54 @@
+package com.subsidy.controller;
+
+
+import com.subsidy.common.ResponseData;
+import com.subsidy.common.ResponseVO;
+import com.subsidy.common.interceptor.LoginRequired;
+import com.subsidy.model.ClassHourDictDO;
+import com.subsidy.model.VodPlayHistoryDO;
+import com.subsidy.service.ClassHourDictService;
+import com.subsidy.util.ConstantUtils;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import io.swagger.annotations.Api;
+
+/**
+ *
+ * 课时 前端控制器
+ *
+ *
+ * @author DengMin
+ * @since 2021-11-26
+ */
+@RestController
+@Api(tags = "课时")
+@RequestMapping("/classHour")
+public class ClassHourDictController {
+
+ @Autowired
+ private ClassHourDictService classHourDictService;
+
+ @PostMapping("getSetting")
+ @ApiOperation("查看当天设置的最大学习时长")
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO getSetting(){
+ return ResponseData.generateCreatedResponse(0,classHourDictService.getSetting());
+ }
+
+ @PostMapping("updateSetting")
+ @ApiOperation("修改当天设置时长 id classHour status")
+ @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
+ public ResponseVO updateSetting(@RequestBody ClassHourDictDO classHourDictDO){
+ return ResponseData.generateCreatedResponse(0,classHourDictService.updateSetting(classHourDictDO));
+ }
+
+ @PostMapping("pollingGet")
+ @ApiOperation("轮询查询当前这个人当天有没有超过最长时长 memberId playLength")
+ public ResponseVO pollingGet(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
+ return ResponseData.generateCreatedResponse(0,classHourDictService.pollingGet(vodPlayHistoryDO));
+ }
+
+
+}
diff --git a/src/main/java/com/subsidy/controller/VodDictController.java b/src/main/java/com/subsidy/controller/VodDictController.java
index f797c41..0b5e6be 100644
--- a/src/main/java/com/subsidy/controller/VodDictController.java
+++ b/src/main/java/com/subsidy/controller/VodDictController.java
@@ -68,4 +68,5 @@ public class VodDictController {
}
+
}
diff --git a/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java b/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
new file mode 100644
index 0000000..0850873
--- /dev/null
+++ b/src/main/java/com/subsidy/mapper/ClassHourDictMapper.java
@@ -0,0 +1,18 @@
+package com.subsidy.mapper;
+
+import com.subsidy.model.ClassHourDictDO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ *
+ * 课时 Mapper 接口
+ *
+ *
+ * @author DengMin
+ * @since 2021-11-26
+ */
+ @Repository
+public interface ClassHourDictMapper extends BaseMapper {
+
+}
diff --git a/src/main/java/com/subsidy/model/ClassHourDictDO.java b/src/main/java/com/subsidy/model/ClassHourDictDO.java
new file mode 100644
index 0000000..2ea9e58
--- /dev/null
+++ b/src/main/java/com/subsidy/model/ClassHourDictDO.java
@@ -0,0 +1,39 @@
+package com.subsidy.model;
+
+import com.subsidy.util.BaseModel;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ *
+ * 课时
+ *
+ *
+ * @author DengMin
+ * @since 2021-11-26
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("class_hour_dict")
+public class ClassHourDictDO extends BaseModel {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /**
+ * 课时
+ */
+ private Integer classHour;
+
+ /**
+ * 有效/无效
+ */
+ private Integer status;
+
+
+}
diff --git a/src/main/java/com/subsidy/service/ClassHourDictService.java b/src/main/java/com/subsidy/service/ClassHourDictService.java
new file mode 100644
index 0000000..078e6c1
--- /dev/null
+++ b/src/main/java/com/subsidy/service/ClassHourDictService.java
@@ -0,0 +1,23 @@
+package com.subsidy.service;
+
+import com.subsidy.model.ClassHourDictDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.subsidy.model.VodPlayHistoryDO;
+import com.subsidy.vo.hour.PollingGetVO;
+
+/**
+ *
+ * 课时 服务类
+ *
+ *
+ * @author DengMin
+ * @since 2021-11-26
+ */
+public interface ClassHourDictService extends IService {
+
+ ClassHourDictDO getSetting();
+
+ String updateSetting(ClassHourDictDO classHourDictDO);
+
+ PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO);
+}
diff --git a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
index 93e60ca..05321c8 100644
--- a/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
@@ -45,6 +45,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.lang.reflect.Member;
import java.math.BigDecimal;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -254,7 +255,7 @@ public class AdministerServiceImpl extends ServiceImpl=60){
+ if (classDetailVO.getScore() >= 60) {
classDetailVO.setResult("合格");
- }else {
+ } else {
classDetailVO.setResult("不合格");
}
}
- classDetailVO.setClassProcess(i+"/"+vodDictDOS.size());
+ classDetailVO.setClassProcess(i + "/" + vodDictDOS.size());
//答疑
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper()
.lambda()
@@ -410,7 +411,7 @@ public class AdministerServiceImpl extends ServiceImpl vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
@@ -487,12 +488,12 @@ public class AdministerServiceImpl extends ServiceImpl answerRecordVOS = iPage.getRecords();
- if (classDetailDTO.getFlag()){
+ if (classDetailDTO.getFlag()) {
ClassDictDO classDictDO = classDictMapper.selectById(classDetailDTO.getId());
CompanyDictDO companyDictDO = companyDictMapper.selectById(classDictDO.getCompanyId());
CourseDictDO courseDictDO = courseDictMapper.selectById(classDictDO.getCourseId());
@@ -710,7 +711,7 @@ public class AdministerServiceImpl extends ServiceImpl memberDOS1 = memberMapper.selectList(new QueryWrapper()
- //.lambda()
- //.like(MemberDO::getAccountName,accountName)
- //.orderByDesc(MemberDO::getCreateDate));
- //if (memberDOS1.size()>0){
- // MemberDO mem = memberDOS1.get(0);
- // Integer num = Integer.valueOf(mem.getAccountName().substring(mem.getAccountName().length()-4))+1;
- // memberDO1.setAccountName(accountName+num);
- //}else {
+ String accountName = PinyinHelper.toHanYuPinyinString(s.getUserName(), format, "", true);
+ List memberDOS = memberMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(MemberDO::getAccountName, accountName));
+ if (memberDOS.size() > 0) {
+ String usernames = userName(accountName, 0);
+ memberDO1.setAccountName(usernames);
+ } else {
memberDO1.setAccountName(accountName);
- //}
- }catch (BadHanyuPinyinOutputFormatCombination ex) {
+ }
+ } catch (BadHanyuPinyinOutputFormatCombination ex) {
}
- //memberDO1.setAccountName(s.getAccountName());
memberDO1.setTelephone(s.getTelephone());
memberDO1.setIdCard(s.getIdCard());
memberDO1.setStatus("启用");
@@ -834,6 +832,18 @@ public class AdministerServiceImpl extends ServiceImpl memberDOS = memberMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(MemberDO::getAccountName, originName + i));
+ if (memberDOS.size() > 0) {
+ return userName(originName, i);
+ } else {
+ return originName + i;
+ }
+ }
+
public static void membersListExcel(String companyName, String studyDate, String courseName, String title, List headerList, List classDetailVOS, String datePattern, int colWidth, OutputStream out) {
@@ -904,13 +914,13 @@ public class AdministerServiceImpl extends ServiceImpl secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -1125,13 +1135,13 @@ public class AdministerServiceImpl extends ServiceImpl secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -1335,13 +1345,13 @@ public class AdministerServiceImpl extends ServiceImpl secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -1449,17 +1459,17 @@ public class AdministerServiceImpl extends ServiceImpl=60){
+ if (exerciseTestVO.getScore() >= 60) {
newCell.setCellValue("合格");
- }else {
+ } else {
newCell.setCellValue("不合格");
}
@@ -1476,7 +1486,7 @@ public class AdministerServiceImpl extends ServiceImpl headerList, List answerRecordVOS, String datePattern, int colWidth, OutputStream out) {
+ public static void askListExcel(String companyName, String studyDate, String courseName, String title, List headerList, List answerRecordVOS, String datePattern, int colWidth, OutputStream out) {
// 声明一个工作薄
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);//缓存
workbook.setCompressTempFiles(true);
@@ -1544,13 +1554,13 @@ public class AdministerServiceImpl extends ServiceImpl secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -1601,7 +1611,7 @@ public class AdministerServiceImpl extends ServiceImpl memberDOS = this.baseMapper.classMembers(classDictDO.getId());
StringBuilder telephone = new StringBuilder();
- String param = "{\"company\":\""+companyDictDO.getCompanyName()+ "\",course\":\""+courseDictDO.getCourseName()+ "\",\"startDate\":\""+classDictDO1.getStartDate() +"\",\"endDate\":\""+classDictDO1.getEndDate() +"\"}";
+ String param = "{\"company\":\""+companyDictDO.getCompanyName()+ "\",\"course\":\""+courseDictDO.getCourseName()+ "\",\"startDate\":\""+classDictDO1.getStartDate() +"\",\"endDate\":\""+classDictDO1.getEndDate() +"\"}";
if (memberDOS.size()>0){
for (int i = 0 ;i< memberDOS.size();i++){
telephone.append(memberDOS.get(i).getTelephone());
@@ -133,7 +133,7 @@ public class ClassDictServiceImpl extends ServiceImpl
+ * 课时 服务实现类
+ *
+ *
+ * @author DengMin
+ * @since 2021-11-26
+ */
+@Service
+public class ClassHourDictServiceImpl extends ServiceImpl implements ClassHourDictService {
+
+ @Autowired
+ private ClassHourDictMapper classHourDictMapper;
+
+ @Autowired
+ private VodPlayHistoryMapper vodPlayHistoryMapper;
+
+ public ClassHourDictDO getSetting() {
+ ClassHourDictDO classHourDictDO = this.baseMapper.selectOne(null);
+ return classHourDictDO;
+ }
+
+ public String updateSetting(ClassHourDictDO classHourDictDO){
+ this.baseMapper.updateById(classHourDictDO);
+ return ConstantUtils.ADD_SUCCESS;
+ }
+
+ public PollingGetVO pollingGet(VodPlayHistoryDO vodPlayHistoryDO){
+
+ PollingGetVO pollingGetVO = new PollingGetVO();
+
+ //查看系统设定的时长
+ ClassHourDictDO classHourDictDO = classHourDictMapper.selectOne(new QueryWrapper()
+ .lambda()
+ .eq(ClassHourDictDO::getStatus,1));
+ if (null == classHourDictDO){
+ pollingGetVO.setBool(false);
+ return pollingGetVO;
+ }
+
+ //查看当天这个人看了多少时间
+ List vodPlayHistoryDOS = vodPlayHistoryMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodPlayHistoryDO::getMemberId,vodPlayHistoryDO.getMemberId())
+ .eq(VodPlayHistoryDO::getCreateDate, LocalDate.now()));
+
+ int total = 0 ;
+
+ for (VodPlayHistoryDO vodPlayHistoryDO1 : vodPlayHistoryDOS){
+ total += vodPlayHistoryDO1.getPlayLength();
+ }
+
+ //是否超过时长 没超过 false 超过 true
+ if (total + vodPlayHistoryDO.getPlayLength() < classHourDictDO.getClassHour()*60*60){
+ pollingGetVO.setBool(false);
+ }else {
+ pollingGetVO.setBool(true);
+ }
+ return pollingGetVO;
+ }
+
+
+}
diff --git a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
index 19402b5..e933d80 100644
--- a/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
@@ -94,6 +94,15 @@ public class MemberServiceImpl extends ServiceImpl imple
public String deleteMember(MemberDO memberDO) {
this.baseMapper.deleteById(memberDO.getId());
+
+ classMemberMappingMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(ClassMemberMappingDO::getMemberId,memberDO.getId()));
+
+ memberDepartmentMappingMapper.delete(new QueryWrapper()
+ .lambda()
+ .eq(MemberDepartmentMappingDO::getMemberId,memberDO.getId()));
+
return ConstantUtils.DELETE_SUCCESS;
}
@@ -109,8 +118,7 @@ public class MemberServiceImpl extends ServiceImpl imple
Integer count1 = this.baseMapper.selectCount(new QueryWrapper()
.lambda()
- .eq(MemberDO::getAccountName, addMemberDTO.getAccountName())
- .eq(MemberDO::getDepartmentId, addMemberDTO.getDepartmentId()));
+ .eq(MemberDO::getAccountName, addMemberDTO.getAccountName()));
if (count1 > 0) {
throw new HttpException(20002);
@@ -140,7 +148,6 @@ public class MemberServiceImpl extends ServiceImpl imple
Integer count = this.baseMapper.selectCount(new QueryWrapper()
.lambda()
.eq(MemberDO::getTelephone, addMemberDTO.getTelephone())
- .eq(MemberDO::getDepartmentId, addMemberDTO.getDepartmentId())
.ne(MemberDO::getId, addMemberDTO.getId()));
if (count > 0) {
@@ -149,7 +156,6 @@ public class MemberServiceImpl extends ServiceImpl imple
Integer count1 = this.baseMapper.selectCount(new QueryWrapper()
.lambda()
.eq(MemberDO::getAccountName, addMemberDTO.getAccountName())
- .eq(MemberDO::getDepartmentId, addMemberDTO.getDepartmentId())
.ne(MemberDO::getId, addMemberDTO.getId()));
if (count1 > 0) {
@@ -336,7 +342,12 @@ public class MemberServiceImpl extends ServiceImpl imple
memberVodVO.setStatus(false);
if (vodPlayHistoryDOS.size() > 0) {
- memberVodVO.setPercent(MathUtil.intDivCeil(100 * vodPlayHistoryDOS.get(0).getPlayRecord(), vodDictDO.getVodLength()));
+ int length = MathUtil.intDivCeil(100 * vodPlayHistoryDOS.get(0).getPlayRecord(), vodDictDO.getVodLength());
+ if (length>=100){
+ memberVodVO.setPercent(100);
+ }else {
+ memberVodVO.setPercent(length);
+ }
if (memberVodVO.getPercent() >= 80) {
memberVodVO.setStatus(true);
}
diff --git a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
index d3bc1a3..0387d96 100644
--- a/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodDictServiceImpl.java
@@ -3,6 +3,7 @@ package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.configure.VODConfig;
+import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.content.GetContendVodsDTO;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.VodDictMapper;
@@ -12,6 +13,12 @@ import com.subsidy.util.ConstantUtils;
import com.subsidy.util.Signature;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
+import com.tencentcloudapi.common.Credential;
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
+import com.tencentcloudapi.common.profile.ClientProfile;
+import com.tencentcloudapi.common.profile.HttpProfile;
+import com.tencentcloudapi.vod.v20180717.VodClient;
+import com.tencentcloudapi.vod.v20180717.models.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -43,7 +50,7 @@ public class VodDictServiceImpl extends ServiceImpl im
signature.setCurrentTime(System.currentTimeMillis());
signature.setRandom(new Random().nextInt(Integer.MAX_VALUE));
signature.setSignValidDuration(3600 * 24 * 2);
-
+ signature.setClassId(vodConfig.getClassId());
String sign = "";
try {
sign = signature.getUploadSignature();
@@ -61,12 +68,64 @@ public class VodDictServiceImpl extends ServiceImpl im
}
public String deleteVod(VodDictDO vodDictDO) {
+ VodDictDO vodDictDO1 = this.baseMapper.selectById(vodDictDO.getId());
this.baseMapper.deleteById(vodDictDO.getId());
+ try{
+
+ //删除原视频
+ Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
+
+ HttpProfile httpProfile = new HttpProfile();
+ httpProfile.setEndpoint("vod.tencentcloudapi.com");
+
+ ClientProfile clientProfile = new ClientProfile();
+ clientProfile.setHttpProfile(httpProfile);
+
+ VodClient client = new VodClient(cred, "", clientProfile);
+
+ // 实例化一个请求对象,每个接口都会对应一个request对象
+ DeleteMediaRequest req = new DeleteMediaRequest();
+ req.setFileId(vodDictDO1.getVodCode());
+ // 返回的resp是一个DeleteMediaResponse的实例,与请求对象对应
+ client.DeleteMedia(req);
+ } catch (TencentCloudSDKException e) {
+ System.out.println(e.toString());
+ }
+
return ConstantUtils.DELETE_SUCCESS;
}
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
+ //上传后直接转码
+ Credential cred = new Credential(vodConfig.getSecretId(), vodConfig.getSecretKey());
+
+ HttpProfile httpProfile = new HttpProfile();
+ httpProfile.setEndpoint("vod.tencentcloudapi.com");
+
+ ClientProfile clientProfile = new ClientProfile();
+ clientProfile.setHttpProfile(httpProfile);
+
+ VodClient client = new VodClient(cred, "", clientProfile);
+
+ ProcessMediaRequest processMediaRequest = new ProcessMediaRequest();
+ MediaProcessTaskInput mediaProcessTaskInput1 = new MediaProcessTaskInput();
+ TranscodeTaskInput[] transcodeTaskInputs1 = new TranscodeTaskInput[1];
+ TranscodeTaskInput transcodeTaskInput1 = new TranscodeTaskInput();
+ transcodeTaskInput1.setDefinition(ConstantUtils.TEMPLATE_VOD);
+ transcodeTaskInputs1[0] = transcodeTaskInput1;
+ mediaProcessTaskInput1.setTranscodeTaskSet(transcodeTaskInputs1);
+ processMediaRequest.setMediaProcessTask(mediaProcessTaskInput1);
+ processMediaRequest.setFileId(vodDictDO.getVodCode());
+
+ ProcessMediaResponse processMediaResponse = null;
+ try {
+ processMediaResponse = client.ProcessMedia(processMediaRequest);
+ System.out.println(processMediaResponse);
+ } catch (Exception ex) {
+ throw new HttpException(50001);
+ }
+
return ConstantUtils.ADD_SUCCESS;
}
diff --git a/src/main/java/com/subsidy/util/ConstantUtils.java b/src/main/java/com/subsidy/util/ConstantUtils.java
index 2acfc09..977b5e2 100644
--- a/src/main/java/com/subsidy/util/ConstantUtils.java
+++ b/src/main/java/com/subsidy/util/ConstantUtils.java
@@ -44,7 +44,7 @@ public class ConstantUtils {
public static final String NOTICE_NAME = "有课进度通知";
- public static final String TECH_NAME = "有课互联科技";
+ public static final String TECH_NAME = "有课互联学习平台";
public static final String PUBLISH_SUCCESS = "发布成功";
diff --git a/src/main/java/com/subsidy/util/DateFormatUtil.java b/src/main/java/com/subsidy/util/DateFormatUtil.java
index 4ae1409..fc5aced 100644
--- a/src/main/java/com/subsidy/util/DateFormatUtil.java
+++ b/src/main/java/com/subsidy/util/DateFormatUtil.java
@@ -61,10 +61,7 @@ public class DateFormatUtil {
* @return
*/
public static boolean compare(Date d1, Date d2 ) {
- if(d1.after(d2)) {
- return false;
- }
- return true;
+ return !d1.after(d2);
}
/**
diff --git a/src/main/java/com/subsidy/util/ExcelFormatUtils.java b/src/main/java/com/subsidy/util/ExcelFormatUtils.java
index 4c8a077..a109629 100644
--- a/src/main/java/com/subsidy/util/ExcelFormatUtils.java
+++ b/src/main/java/com/subsidy/util/ExcelFormatUtils.java
@@ -6,12 +6,12 @@ import java.util.List;
public class ExcelFormatUtils {
- public static final List memberList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "账号", "联系方式", "签到次数", "课程进度", "培训时长", "答疑数", "测试成绩", "总评价"});
+ public static final List memberList = Arrays.asList("序号", "成员名称", "身份证号码", "账号", "联系方式", "签到次数", "课程进度", "培训时长", "答疑数", "测试成绩", "总评价");
- public static final List signList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "手机号码", "培训时长", "课程进度", "完成率", "签到次数", "签到日期"});
+ public static final List signList = Arrays.asList("序号", "成员名称", "身份证号码", "手机号码", "培训时长", "课程进度", "完成率", "签到次数", "签到日期");
- public static final List scoreList = Arrays.asList(new String[]{"序号", "成员名称", "身份证号码", "手机号码", "测试最高成绩", "测试次数", "总评价"});
+ public static final List scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "手机号码", "测试最高成绩", "测试次数", "总评价");
- public static final List answersList = Arrays.asList(new String[]{"序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间"});
+ public static final List answersList = Arrays.asList("序号", "提问", "答疑", "提问时间", "提问成员", "答疑时间");
}
diff --git a/src/main/java/com/subsidy/util/MathUtil.java b/src/main/java/com/subsidy/util/MathUtil.java
index 26e07a4..580af1a 100644
--- a/src/main/java/com/subsidy/util/MathUtil.java
+++ b/src/main/java/com/subsidy/util/MathUtil.java
@@ -161,7 +161,7 @@ public class MathUtil {
public static String unitFormat(int i) {
String retStr = null;
if (i >= 0 && i < 10) {
- retStr = "0" + Integer.toString(i);
+ retStr = "0" + i;
} else {
retStr = "" + i;
}
diff --git a/src/main/java/com/subsidy/util/Signature.java b/src/main/java/com/subsidy/util/Signature.java
index 87f4c62..594f054 100644
--- a/src/main/java/com/subsidy/util/Signature.java
+++ b/src/main/java/com/subsidy/util/Signature.java
@@ -16,6 +16,7 @@ public class Signature {
private long currentTime;
private int random;
private int signValidDuration;
+ private int classId;
private static final String HMAC_ALGORITHM = "HmacSHA1";
private static final String CONTENT_CHARSET = "UTF-8";
@@ -36,6 +37,7 @@ public class Signature {
contextStr += "¤tTimeStamp=" + currentTime;
contextStr += "&expireTime=" + endTime;
contextStr += "&random=" + random;
+ contextStr += "&classId=" + classId;
try {
Mac mac = Mac.getInstance(HMAC_ALGORITHM);
@@ -76,4 +78,6 @@ public class Signature {
public void setSignValidDuration(int signValidDuration) {
this.signValidDuration = signValidDuration;
}
+
+ public void setClassId(int classId){this.classId = classId;}
}
diff --git a/src/main/java/com/subsidy/util/ZipTestUtils.java b/src/main/java/com/subsidy/util/ZipTestUtils.java
index 925652e..9ed291c 100644
--- a/src/main/java/com/subsidy/util/ZipTestUtils.java
+++ b/src/main/java/com/subsidy/util/ZipTestUtils.java
@@ -13,6 +13,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
+import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.ZipEntry;
@@ -217,7 +218,7 @@ public class ZipTestUtils {
s.setBirthday(new Date());
s.setHeight(i);
s.setWeight(i);
- s.setSex(i / 2 == 0 ? false : true);
+ s.setSex(i / 2 != 0);
list.add(s);
}
//Map headMap = new LinkedHashMap();
@@ -228,7 +229,7 @@ public class ZipTestUtils {
//headMap.put("weight", "体重");
//headMap.put("sex", "性别");
- List memberList = Arrays.asList(new String[]{"成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑"});
+ List memberList = Arrays.asList("成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑");
//导出zip
@@ -255,28 +256,28 @@ public class ZipTestUtils {
String zipname = "test.zip";
response.reset();
response.setContentType("application/x-download");
- response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), "iso-8859-1"));
+ response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), StandardCharsets.ISO_8859_1));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
/**
* 班级成员
*/
- List memberList = Arrays.asList(new String[]{"成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑"});
+ List memberList = Arrays.asList("成员名称","账号","联系方式","签到次数","课程进度","培训时长","评级测试","答疑");
/**
* 注册签到
*/
- List signList = Arrays.asList(new String[]{"成员名称","培训时长","课程进度","完成率"});
+ List signList = Arrays.asList("成员名称","培训时长","课程进度","完成率");
/**
* 测试成绩
*/
- List scoreList = Arrays.asList(new String[]{"成员名称","测试结果","最高分"});
+ List scoreList = Arrays.asList("成员名称","测试结果","最高分");
/**
* 答疑记录
*/
- List answerList = Arrays.asList(new String[]{"提问","答疑","提问时间","提问成员","答疑时间"});
+ List answerList = Arrays.asList("提问","答疑","提问时间","提问成员","答疑时间");
//Map headMap = new LinkedHashMap();
//headMap.put("name", "成员名称");
diff --git a/src/main/java/com/subsidy/util/ZipUtils.java b/src/main/java/com/subsidy/util/ZipUtils.java
index 8cc27e3..d4e9c17 100644
--- a/src/main/java/com/subsidy/util/ZipUtils.java
+++ b/src/main/java/com/subsidy/util/ZipUtils.java
@@ -15,6 +15,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
+import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
@@ -203,7 +204,7 @@ public class ZipUtils {
s.setBirthday(new Date());
s.setHeight(i);
s.setWeight(i);
- s.setSex(i / 2 == 0 ? false : true);
+ s.setSex(i / 2 != 0);
ja.add(s);
}
Map headMap = new LinkedHashMap();
@@ -243,7 +244,7 @@ public class ZipUtils {
String((zipname).
- getBytes(), "iso-8859-1"));
+ getBytes(), StandardCharsets.ISO_8859_1));
for (int i = 1; i < 6; i++) {
String dir = i % 2 == 0 ? "dirA" : "dirB";
ByteArrayOutputStream baos = new ByteArrayOutputStream();
diff --git a/src/main/java/com/subsidy/util/excel/ExcelUtil.java b/src/main/java/com/subsidy/util/excel/ExcelUtil.java
index 81d85ce..fe908b4 100644
--- a/src/main/java/com/subsidy/util/excel/ExcelUtil.java
+++ b/src/main/java/com/subsidy/util/excel/ExcelUtil.java
@@ -313,13 +313,13 @@ public class ExcelUtil {
int[] secondWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] secondHead = new String[2];
- List secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -541,13 +541,13 @@ public class ExcelUtil {
int[] secondWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] secondHead = new String[2];
- List secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -758,13 +758,13 @@ public class ExcelUtil {
int[] secondWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] secondHead = new String[2];
- List secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
@@ -976,13 +976,13 @@ public class ExcelUtil {
int[] secondWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] secondHead = new String[2];
- List secondList = Arrays.asList(new String[]{"培训实施单位:" + companyName, "培训时间:" + studyDate});
+ List secondList = Arrays.asList("培训实施单位:" + companyName, "培训时间:" + studyDate);
//第三行
int[] thirdWidth = new int[2];
// 产生表格标题行,以及设置列宽
String[] thirdHead = new String[2];
- List thirdList = Arrays.asList(new String[]{"培训项目:" + courseName, "培训平台:有课互联系统"});
+ List thirdList = Arrays.asList("培训项目:" + courseName, "培训平台:有课互联系统");
ii = 0;
diff --git a/src/main/java/com/subsidy/vo/hour/PollingGetVO.java b/src/main/java/com/subsidy/vo/hour/PollingGetVO.java
new file mode 100644
index 0000000..ad45014
--- /dev/null
+++ b/src/main/java/com/subsidy/vo/hour/PollingGetVO.java
@@ -0,0 +1,10 @@
+package com.subsidy.vo.hour;
+
+import lombok.Data;
+
+@Data
+public class PollingGetVO {
+
+ private Boolean bool;
+
+}
diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties
index b4a20a5..b8bbf58 100644
--- a/src/main/resources/application-prod.properties
+++ b/src/main/resources/application-prod.properties
@@ -30,7 +30,7 @@ mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
spring.servlet.multipart.max-file-size=2048KB
spring.servlet.multipart.max-request-size=4098KB
-wechat.appId: wx7785293ff5e31f14
-wechat.appSecret: 25d57cad61fc1b45b3afa46d4c35e8f6
-wechat.msgUrl: https://teachai.youkehulian.com/login
-wechat.templateId: Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ
+wechat.appId= wx7785293ff5e31f14
+wechat.appSecret= 25d57cad61fc1b45b3afa46d4c35e8f6
+wechat.msgUrl= https://teachai.youkehulian.com/login
+wechat.templateId= Z1HNPLOrKiHEjfR1KMP-cC-uH3BWqDJIHv365Ev20yQ
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 81ef4bb..d0c0c7e 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
# 文件编码 UTF8
spring.mandatory-file-encoding=UTF-8
@@ -14,7 +14,7 @@ spring.resources.add-mappings=false
mybatis-plus.global-config.banner=false
# mybatis-plus相关配置
-mybatis-plus.m/classSubjectTask/queryTaskDetailapper-locations=classpath:mapper/*.xml
+mybatis-plus.mapper-locations=classpath:mapper/*.xml
# 是否开启自动驼峰命名规则映射
mybatis-plus.configuration.map-underscore-to-camel-case=true
# 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段
@@ -42,6 +42,7 @@ vod.secretId= AKIDOcePHvZ2C5VeYHQGSO5aqtlNxJQLqfz2
vod.secretKey= vjHYRmrfDbw0rWxA7oFcj7F8lDPKCm8E
vod.api= vod.tencentcloudapi.com
vod.region= ap-shanghai
+vod.classId= 848920
# quartz
# 数据持久化方式
diff --git a/src/main/resources/mapper/ClassHourDictMapper.xml b/src/main/resources/mapper/ClassHourDictMapper.xml
new file mode 100644
index 0000000..f96ac25
--- /dev/null
+++ b/src/main/resources/mapper/ClassHourDictMapper.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ create_date,
+ update_date,
+ delete_date,
+ id, class_hour, status
+
+
+
--
libgit2 0.25.0