mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 17:36:47 +08:00
Compare commits
3 Commits
SZX-1293-z
...
zcwy1108-l
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05dc7b984f | ||
|
|
d0e5f8c329 | ||
|
|
2c94b09199 |
@@ -10,6 +10,8 @@ import com.xboe.core.orm.BaseDao;
|
||||
import com.xboe.core.orm.IFieldFilter;
|
||||
import com.xboe.module.course.entity.CourseFile;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
|
||||
@Repository
|
||||
public class CourseFileDao extends BaseDao<CourseFile> {
|
||||
@@ -21,4 +23,5 @@ public class CourseFileDao extends BaseDao<CourseFile> {
|
||||
PageList<CourseFile> page = this.getGenericDao().findPage(pageIndex, pageSize, getEntityClass(), filters,order);
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -54,4 +54,6 @@ public interface ICourseFileService {
|
||||
* @param deleted
|
||||
*/
|
||||
void delete(String id,boolean deleted);
|
||||
|
||||
// void updateDuration(String contentRefId, Integer duration);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.cache.IXaskCache;
|
||||
import com.xboe.core.cache.XaskCacheProvider;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
@@ -14,11 +15,9 @@ import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.*;
|
||||
import com.xboe.module.course.dto.CourseContentDto;
|
||||
import com.xboe.module.course.dto.SortItem;
|
||||
import com.xboe.module.course.entity.CourseAssess;
|
||||
import com.xboe.module.course.entity.CourseContent;
|
||||
import com.xboe.module.course.entity.CourseExam;
|
||||
import com.xboe.module.course.entity.CourseHomeWork;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseFileService;
|
||||
import com.xboe.module.exam.dao.ExamPaperDao;
|
||||
import com.xboe.module.exam.vo.TestQuestionVo;
|
||||
import com.xboe.standard.enums.BoedxContentType;
|
||||
@@ -57,7 +56,8 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
|
||||
@Resource
|
||||
private ExamPaperDao examPaperDao;
|
||||
|
||||
@Resource
|
||||
private ICourseFileService courseFileService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -83,6 +83,7 @@ public class CourseContentServiceImpl implements ICourseContentService {
|
||||
ccDao.save(cc);
|
||||
}else {
|
||||
ccDao.update(cc);
|
||||
// courseFileService.updateDuration(cc.getContentRefId(),cc.getDuration());
|
||||
cc.setSysVersion(ccDao.getVersion(cc.getId()));
|
||||
}
|
||||
//添加或保存其它信息
|
||||
|
||||
@@ -98,4 +98,14 @@ public class CourseFileServiceImpl implements ICourseFileService {
|
||||
public CourseFile get(String id) {
|
||||
return courseFileDao.get(id);
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public void updateDuration(String contentRefId,Integer duration) {
|
||||
// if (duration == null) {
|
||||
// duration = 0;
|
||||
// }
|
||||
// String sql = "UPDATE boe_course_file SET duration = "+ duration+" WHERE id = "+ contentRefId+" ";
|
||||
// courseFileDao.sqlUpdate(sql);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.xboe.system.api;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
@@ -14,6 +11,11 @@ import java.util.Set;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.standard.BaseConstant;
|
||||
import com.xboe.system.assist.entity.XUploadResultDto;
|
||||
import it.sauronsoftware.jave.Encoder;
|
||||
import it.sauronsoftware.jave.MultimediaInfo;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -115,8 +117,23 @@ public class SysUploaderApi extends ApiBaseController{
|
||||
// ex.printStackTrace();
|
||||
log.error("处理失败",ex);
|
||||
}
|
||||
|
||||
return wrap(xur);
|
||||
Long ls = 0L;
|
||||
XUploadResultDto dto=new XUploadResultDto();
|
||||
String fileFullPath = SysConstant.getConfigValue(BaseConstant.CONFIG_UPLOAD_FILES_SAVEPATH) + xur.getFilePath();
|
||||
try {
|
||||
Encoder encoder = new Encoder();
|
||||
MultimediaInfo m = encoder.getInfo(new File(fileFullPath));
|
||||
ls = m.getDuration() / 1000;//秒
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("读取视频时长错误");
|
||||
}
|
||||
dto.setDuration(ls);
|
||||
dto.setDisplayName(xur.getDisplayName());
|
||||
dto.setFilePath(xur.getFilePath());
|
||||
dto.setFileType(xur.getFileType());
|
||||
dto.setHttpPath(xur.getHttpPath());
|
||||
return wrap(dto);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("upload file error ",e);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.xboe.system.assist.entity;
|
||||
|
||||
import com.xboe.core.upload.XUploadResult;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class XUploadResultDto extends XUploadResult {
|
||||
private Long duration;
|
||||
}
|
||||
Reference in New Issue
Block a user