提交 86432513 编写于 作者: F fengyongwei
......@@ -5,7 +5,7 @@
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>roncoo-education</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-course</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-course</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-course-common</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-course</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-course-feign</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-course</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-course-service</artifactId>
......
......@@ -11,8 +11,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import com.roncoo.education.course.service.dao.CourseChapterPeriodAuditDao;
import com.roncoo.education.course.service.dao.CourseChapterPeriodDao;
import com.roncoo.education.course.service.dao.CourseVideoDao;
import com.roncoo.education.course.service.dao.FileStorageDao;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseChapterPeriod;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseChapterPeriodAudit;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseVideo;
import com.roncoo.education.course.service.dao.impl.mapper.entity.FileStorage;
import com.roncoo.education.system.common.bean.vo.SysVO;
......@@ -43,12 +47,16 @@ import com.xiaoleilu.hutool.util.ObjectUtil;
public class ApiUploadBiz extends BaseBiz {
@Autowired
private CourseVideoDao courseVideoDao;
private IBossSys bossSys;
@Autowired
private FileStorageDao fileStorageDao;
private CourseChapterPeriodAuditDao courseChapterPeriodAuditDao;
@Autowired
private CourseChapterPeriodDao courseChapterPeriodDao;
@Autowired
private IBossSys bossSys;
private CourseVideoDao courseVideoDao;
@Autowired
private FileStorageDao fileStorageDao;
/**
* 上传视频接口
......@@ -64,7 +72,8 @@ public class ApiUploadBiz extends BaseBiz {
// 获取上传文件的原名
String fileName = videoFile.getOriginalFilename();
boolean fileStatus = true;
List<String> fileTypes = Arrays.asList("avi", "mp4", "flv", "mpg", "mov", "asf", "3gp", "f4v", "wmv", "x-ms-wmv\n");
List<String> fileTypes = Arrays.asList("avi", "mp4", "flv", "mpg", "mov", "asf", "3gp", "f4v", "wmv",
"x-ms-wmv\n");
for (String filetype : fileTypes) {
// 上传文件的原名+小写+后缀
if (fileName.toLowerCase().endsWith(filetype)) {
......@@ -79,7 +88,8 @@ public class ApiUploadBiz extends BaseBiz {
Long videoNo = IdWorker.getId(); // 当作存储到本地的文件名,方便定时任务的处理
// 1、上传到本地
File targetFile = new File(SystemUtil.PERIOD_VIDEO_PATH + videoNo.toString() + "." + StrUtil.getSuffix(fileName));
File targetFile = new File(
SystemUtil.PERIOD_VIDEO_PATH + videoNo.toString() + "." + StrUtil.getSuffix(fileName));
targetFile.setLastModified(System.currentTimeMillis());// 设置最后修改时间
// 判断文件目录是否存在,不存在就创建文件目录
if (!targetFile.getParentFile().exists()) {
......@@ -127,7 +137,8 @@ public class ApiUploadBiz extends BaseBiz {
courseVideoDao.updateById(courseVideo);
// 3、异步上传到阿里云
String videoOasId = AliyunUtil.uploadDoc(PlatformEnum.COURSE, targetFile, BeanUtil.copyProperties(sys, Aliyun.class));
String videoOasId = AliyunUtil.uploadDoc(PlatformEnum.COURSE, targetFile,
BeanUtil.copyProperties(sys, Aliyun.class));
courseVideo.setVideoOasId(videoOasId);
courseVideoDao.updateById(courseVideo);
......@@ -144,6 +155,22 @@ public class ApiUploadBiz extends BaseBiz {
courseVideoDao.updateById(video);
}
// 更新课时审核表视频信息
List<CourseChapterPeriodAudit> periodAuditList = courseChapterPeriodAuditDao.listByVideoNo(videoNo);
for (CourseChapterPeriodAudit periodAudit : periodAuditList) {
periodAudit.setVideoName(courseVideo.getVideoName());
periodAudit.setVideoLength(courseVideo.getVideoLength());
periodAudit.setVideoVid(courseVideo.getVideoVid());
courseChapterPeriodAuditDao.updateById(periodAudit);
}
// 更新课时视频信息
List<CourseChapterPeriod> periodList = courseChapterPeriodDao.listByVideoNo(videoNo);
for (CourseChapterPeriod period : periodList) {
period.setVideoName(courseVideo.getVideoName());
period.setVideoLength(courseVideo.getVideoLength());
period.setVideoVid(courseVideo.getVideoVid());
courseChapterPeriodDao.updateById(period);
}
// 4、成功删除本地文件
if (targetFile.isFile() && targetFile.exists()) {
targetFile.delete();
......@@ -171,7 +198,8 @@ public class ApiUploadBiz extends BaseBiz {
Long fileNo = IdWorker.getId();
// 1、上传到本地
if (sys.getFileType().equals(FileTypeEnum.LOCAL.getCode())) {
File pic = new File(SystemUtil.PIC_STORAGE_PATH + fileNo.toString() + "." + StrUtil.getSuffix(picFile.getOriginalFilename()));
File pic = new File(SystemUtil.PIC_STORAGE_PATH + fileNo.toString() + "."
+ StrUtil.getSuffix(picFile.getOriginalFilename()));
try {
// 判断文件目录是否存在,不存在就创建文件目录
if (!pic.getParentFile().exists()) {
......@@ -191,7 +219,8 @@ public class ApiUploadBiz extends BaseBiz {
return Result.error("上传文件出错,请重新上传");
}
}
return Result.success(AliyunUtil.uploadPic(PlatformEnum.COURSE, picFile, BeanUtil.copyProperties(bossSys.getSys(), Aliyun.class)));
return Result.success(AliyunUtil.uploadPic(PlatformEnum.COURSE, picFile,
BeanUtil.copyProperties(bossSys.getSys(), Aliyun.class)));
}
return Result.error("请选择上传的图片");
}
......@@ -211,7 +240,8 @@ public class ApiUploadBiz extends BaseBiz {
Long fileNo = IdWorker.getId();
// 1、上传到本地
if (sys.getFileType().equals(FileTypeEnum.LOCAL.getCode())) {
File pic = new File(SystemUtil.DOC_STORAGE_PATH + fileNo.toString() + "." + StrUtil.getSuffix(docFile.getOriginalFilename()));
File pic = new File(SystemUtil.DOC_STORAGE_PATH + fileNo.toString() + "."
+ StrUtil.getSuffix(docFile.getOriginalFilename()));
try {
// 判断文件目录是否存在,不存在就创建文件目录
if (!pic.getParentFile().exists()) {
......@@ -231,7 +261,8 @@ public class ApiUploadBiz extends BaseBiz {
return Result.error("上传文件出错,请重新上传");
}
}
return Result.success(AliyunUtil.uploadDoc(PlatformEnum.COURSE, docFile, BeanUtil.copyProperties(bossSys.getSys(), Aliyun.class)));
return Result.success(AliyunUtil.uploadDoc(PlatformEnum.COURSE, docFile,
BeanUtil.copyProperties(bossSys.getSys(), Aliyun.class)));
}
return Result.error("请选择上传的文件");
......
......@@ -10,7 +10,11 @@ import org.springframework.util.StringUtils;
import com.roncoo.education.course.common.bean.qo.CourseVideoQO;
import com.roncoo.education.course.common.bean.vo.CourseVideoVO;
import com.roncoo.education.course.service.dao.CourseChapterPeriodAuditDao;
import com.roncoo.education.course.service.dao.CourseChapterPeriodDao;
import com.roncoo.education.course.service.dao.CourseVideoDao;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseChapterPeriod;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseChapterPeriodAudit;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseVideo;
import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseVideoExample;
import com.roncoo.education.system.common.bean.vo.SysVO;
......@@ -34,12 +38,14 @@ import com.xiaoleilu.hutool.util.ObjectUtil;
*/
@Component
public class BossCourseVideoBiz {
@Autowired
private IBossSys bossSys;
@Autowired
private CourseVideoDao dao;
@Autowired
private IBossSys bossSys;
private CourseChapterPeriodAuditDao courseChapterPeriodAuditDao;
@Autowired
private CourseChapterPeriodDao courseChapterPeriodDao;
public Page<CourseVideoVO> listForPage(CourseVideoQO qo) {
CourseVideoExample example = new CourseVideoExample();
......@@ -117,6 +123,22 @@ public class BossCourseVideoBiz {
dao.updateById(info);
}
}
// 更新课时审核表视频信息
List<CourseChapterPeriodAudit> periodAuditList = courseChapterPeriodAuditDao.listByVideoNo(videoNo);
for (CourseChapterPeriodAudit periodAudit : periodAuditList) {
periodAudit.setVideoLength(result.getDuration());
periodAudit.setVideoVid(result.getVid());
courseChapterPeriodAuditDao.updateById(periodAudit);
}
// 更新课时视频信息
List<CourseChapterPeriod> periodList = courseChapterPeriodDao.listByVideoNo(videoNo);
for (CourseChapterPeriod period : periodList) {
period.setVideoLength(result.getDuration());
period.setVideoVid(result.getVid());
courseChapterPeriodDao.updateById(period);
}
}
// 成功删除本地文件
targetFile.delete();
......
......@@ -73,4 +73,12 @@ public interface CourseChapterPeriodAuditDao {
* @author wuyun
*/
List<CourseChapterPeriodAudit> listByChapterIdAndStatusId(Long chapterId, Integer statusId);
/**
* 根据视频编号获取课时信息
*
* @param videoNo
* @author kyh
*/
List<CourseChapterPeriodAudit> listByVideoNo(Long videoNo);
}
\ No newline at end of file
......@@ -7,19 +7,18 @@ import com.roncoo.education.course.service.dao.impl.mapper.entity.CourseChapterP
import com.roncoo.education.util.base.Page;
public interface CourseChapterPeriodDao {
int save(CourseChapterPeriod record);
int save(CourseChapterPeriod record);
int deleteById(Long id);
int deleteById(Long id);
int updateById(CourseChapterPeriod record);
int updateById(CourseChapterPeriod record);
CourseChapterPeriod getById(Long id);
CourseChapterPeriod getById(Long id);
Page<CourseChapterPeriod> listForPage(int pageCurrent, int pageSize, CourseChapterPeriodExample example);
Page<CourseChapterPeriod> listForPage(int pageCurrent, int pageSize, CourseChapterPeriodExample example);
List<CourseChapterPeriod> listByChapterId(Long chapterId);
/**
* 根据章节编号和状态查找可用的课时信息集合
*
......@@ -38,4 +37,12 @@ public interface CourseChapterPeriodDao {
*/
CourseChapterPeriod getByVideoNo(Long videoNo);
/**
* 根据视频编号查找课时信息
*
* @param videoNo
* @return
*/
List<CourseChapterPeriod> listByVideoNo(Long videoNo);
}
\ No newline at end of file
......@@ -38,14 +38,16 @@ public class CourseChapterPeriodAuditDaoImpl implements CourseChapterPeriodAudit
return this.courseChapterPeriodAuditMapper.selectByPrimaryKey(id);
}
public Page<CourseChapterPeriodAudit> listForPage(int pageCurrent, int pageSize, CourseChapterPeriodAuditExample example) {
public Page<CourseChapterPeriodAudit> listForPage(int pageCurrent, int pageSize,
CourseChapterPeriodAuditExample example) {
int count = this.courseChapterPeriodAuditMapper.countByExample(example);
pageSize = PageUtil.checkPageSize(pageSize);
pageCurrent = PageUtil.checkPageCurrent(count, pageSize, pageCurrent);
int totalPage = PageUtil.countTotalPage(count, pageSize);
example.setLimitStart(PageUtil.countOffset(pageCurrent, pageSize));
example.setPageSize(pageSize);
return new Page<CourseChapterPeriodAudit>(count, totalPage, pageCurrent, pageSize, this.courseChapterPeriodAuditMapper.selectByExample(example));
return new Page<CourseChapterPeriodAudit>(count, totalPage, pageCurrent, pageSize,
this.courseChapterPeriodAuditMapper.selectByExample(example));
}
@Override
......@@ -120,4 +122,12 @@ public class CourseChapterPeriodAuditDaoImpl implements CourseChapterPeriodAudit
example.setOrderByClause("sort asc, id asc");
return this.courseChapterPeriodAuditMapper.selectByExample(example);
}
@Override
public List<CourseChapterPeriodAudit> listByVideoNo(Long videoNo) {
CourseChapterPeriodAuditExample example = new CourseChapterPeriodAuditExample();
Criteria c = example.createCriteria();
c.andVideoNoEqualTo(videoNo);
return this.courseChapterPeriodAuditMapper.selectByExample(example);
}
}
\ No newline at end of file
......@@ -48,7 +48,8 @@ public class CourseChapterPeriodDaoImpl implements CourseChapterPeriodDao {
int totalPage = PageUtil.countTotalPage(count, pageSize);
example.setLimitStart(PageUtil.countOffset(pageCurrent, pageSize));
example.setPageSize(pageSize);
return new Page<CourseChapterPeriod>(count, totalPage, pageCurrent, pageSize, this.courseChapterPeriodMapper.selectByExample(example));
return new Page<CourseChapterPeriod>(count, totalPage, pageCurrent, pageSize,
this.courseChapterPeriodMapper.selectByExample(example));
}
@Override
......@@ -80,4 +81,12 @@ public class CourseChapterPeriodDaoImpl implements CourseChapterPeriodDao {
}
return list.get(0);
}
@Override
public List<CourseChapterPeriod> listByVideoNo(Long videoNo) {
CourseChapterPeriodExample example = new CourseChapterPeriodExample();
Criteria c = example.createCriteria();
c.andVideoNoEqualTo(videoNo);
return this.courseChapterPeriodMapper.selectByExample(example);
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-crontab-plan</artifactId>
......
......@@ -45,6 +45,7 @@ public class VideoCrontab extends BaseController {
if (file.isDirectory()) {// isDirectory是否文件夹
File[] files = file.listFiles();// listFiles是获取该目录下所有文件和目录的绝对路径
for (File targetFile : files) {
if (targetFile.isFile() && targetFile.exists()) {
if (FileUtil.newerThan(targetFile, (System.currentTimeMillis() - 7200000))) {// 上传两个小时内
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-gateway-api</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-server-admin</artifactId>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-server-config</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-server-eureka</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-server-zipkin</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-system</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-system</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-system-common</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-system</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-system-feign</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-system</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-system-service</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-user</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-user</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-user-common</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-user</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-user-feign</artifactId>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education-user</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-user-service</artifactId>
......
......@@ -6,7 +6,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-util</artifactId>
......
......@@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import com.aliyun.oas.utils.StringUtil;
import com.ning.http.util.Base64;
import com.roncoo.education.util.config.SystemUtil;
import com.roncoo.education.util.tools.JSONUtil;
......@@ -66,7 +67,9 @@ public final class PolyvUtil {
*/
public static String getPolyvCode(PolyvCode polyvCode) {
try {
return HttpUtil.encode(Base64.encode(SecureUtil.des(Base64.decode(KEY)).encrypt(JSONUtil.toJSONString(polyvCode))), CHARSET_UTF_8);
return HttpUtil.encode(
Base64.encode(SecureUtil.des(Base64.decode(KEY)).encrypt(JSONUtil.toJSONString(polyvCode))),
CHARSET_UTF_8);
} catch (Exception e) {
logger.error("保利威视,加密出错", e);
return "";
......@@ -81,7 +84,9 @@ public final class PolyvUtil {
*/
public static PolyvCode decode(String code) {
try {
return JSONUtil.parseObject(new String(SecureUtil.des(Base64.decode(KEY)).decrypt(Base64.decode(HttpUtil.decode(code, CHARSET_UTF_8)))), PolyvCode.class);
return JSONUtil.parseObject(new String(
SecureUtil.des(Base64.decode(KEY)).decrypt(Base64.decode(HttpUtil.decode(code, CHARSET_UTF_8)))),
PolyvCode.class);
} catch (Exception e) {
logger.error("保利威视,解密出错", e);
return null;
......@@ -102,7 +107,9 @@ public final class PolyvUtil {
map.put("viewerName", bo.getUserNo());
map.put("extraParams", "HTML5");
map.put("viewerId", bo.getUserNo());
String concated = "extraParams" + map.get("extraParams") + "ts" + map.get("ts") + "userId" + map.get("userId") + "videoId" + map.get("videoId") + "viewerId" + map.get("viewerId") + "viewerIp" + map.get("viewerIp") + "viewerName" + map.get("viewerName");
String concated = "extraParams" + map.get("extraParams") + "ts" + map.get("ts") + "userId" + map.get("userId")
+ "videoId" + map.get("videoId") + "viewerId" + map.get("viewerId") + "viewerIp" + map.get("viewerIp")
+ "viewerName" + map.get("viewerName");
map.put("sign", MD5Util.MD5(secretkey + concated + secretkey).toUpperCase());
String result = post(SystemUtil.POLYV_GETTOKEN, map);
logger.info("保利威视,获取token接口:result={}", result);
......@@ -158,9 +165,12 @@ public final class PolyvUtil {
public static UploadFileResult uploadFile(File file, UploadFile uploadFile, String writetoken) {
Map<String, Object> param = new HashMap<String, Object>();
param.put("writetoken", writetoken);
param.put("JSONRPC", "{\"title\": \"" + uploadFile.getTitle() + "\", \"tag\": \"" + uploadFile.getTag() + "\", \"desc\": \"" + uploadFile.getDesc() + "\"}");
param.put("JSONRPC", "{\"title\": \"" + uploadFile.getTitle() + "\", \"tag\": \"" + uploadFile.getTag()
+ "\", \"desc\": \"" + uploadFile.getDesc() + "\"}");
param.put("cataid", uploadFile.getCataid());
param.put("watermark", uploadFile.getWatermark());
if (StringUtil.isNotBlank(uploadFile.getWatermark())) {
param.put("watermark", uploadFile.getWatermark());
}
String result = postFile(SystemUtil.POLYV_UPLOADVIDEO, param, file);
try {
JSONObject json = JSONObject.fromObject(result);
......@@ -192,7 +202,8 @@ public final class PolyvUtil {
paramMap.put("sign", sign);
String url = SystemUtil.POLYV_DELETEVIDEO.replace("{userid}", useid);
HttpPost httpPost = new HttpPost(url.trim());
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000)
.setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
httpPost.setConfig(requestConfig);
List<BasicNameValuePair> nvps = new ArrayList<>();
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
......@@ -217,7 +228,8 @@ public final class PolyvUtil {
try {
String url = SystemUtil.POLYV_QUESTION;
HttpPost httpPost = new HttpPost(url.trim());
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000)
.setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
httpPost.setConfig(requestConfig);
JSONArray choices = new JSONArray();
for (String value : question.getAnswerList()) {
......@@ -284,7 +296,8 @@ public final class PolyvUtil {
CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build();
try {
HttpPost httpPost = new HttpPost(url.trim());
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(10000)
.setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build();
httpPost.setConfig(requestConfig);
List<NameValuePair> list = new ArrayList<>();
for (Map.Entry<String, Object> m : param.entrySet()) {
......@@ -308,7 +321,8 @@ public final class PolyvUtil {
CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build();
try {
HttpPost httpPost = new HttpPost(url.trim());
httpPost.setConfig(RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3600000).setSocketTimeout(3600000).build());
httpPost.setConfig(RequestConfig.custom().setConnectTimeout(10000).setConnectionRequestTimeout(3600000)
.setSocketTimeout(3600000).build());
MultipartEntityBuilder entity = MultipartEntityBuilder.create();
entity.addPart("Filedata", new FileBody(file));
ContentType contentType = ContentType.create("text/plain", Charset.forName(CHARSET_UTF_8));
......@@ -318,7 +332,7 @@ public final class PolyvUtil {
httpPost.setEntity(entity.build());
return EntityUtils.toString(closeableHttpClient.execute(httpPost).getEntity(), CHARSET_UTF_8);
} catch (Exception e) {
e.printStackTrace();
logger.error("上传到保利威视失败,url={},param={}", url, param, e);
} finally {
try {
closeableHttpClient.close();
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.roncoo</groupId>
<artifactId>roncoo-education</artifactId>
<version>2.0.0-RELEASE</version>
<version>3.0.0-SNAPSHOT</version>
</parent>
<artifactId>roncoo-education-web-boss</artifactId>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册