Commit d05277a0 authored by luzhuang's avatar luzhuang

Merge remote-tracking branch 'origin/meiteng' into meiteng

parents 46263ca6 fd06730a
...@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,6 +5,8 @@ import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.rcisoft.business.bchapter.dao.BChapterRepository; import org.rcisoft.business.bchapter.dao.BChapterRepository;
import org.rcisoft.business.bchapter.dto.*; import org.rcisoft.business.bchapter.dto.*;
import org.rcisoft.business.bchapter.entity.BChapter; import org.rcisoft.business.bchapter.entity.BChapter;
...@@ -51,10 +53,7 @@ import java.nio.file.Files; ...@@ -51,10 +53,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
...@@ -261,7 +260,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -261,7 +260,7 @@ public class BChapterServiceImpl implements BChapterService {
if (StringUtils.isNotEmpty(model.getIsTest())) { if (StringUtils.isNotEmpty(model.getIsTest())) {
BMaterial bMaterial = new BMaterial(); BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial); UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setLessonId(model.getLessonId()); bMaterial.setLessonId(chapterDTO.getLessonId());
bMaterial.setChapterId(model.getBusinessId()); bMaterial.setChapterId(model.getBusinessId());
bMaterial.setFileName(dto.getFileName()); bMaterial.setFileName(dto.getFileName());
...@@ -269,11 +268,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -269,11 +268,8 @@ public class BChapterServiceImpl implements BChapterService {
bMaterial.setFileTime(dto.getFileTime().substring(0, dto.getFileTime().lastIndexOf("."))); bMaterial.setFileTime(dto.getFileTime().substring(0, dto.getFileTime().lastIndexOf(".")));
} }
if (Integer.parseInt(model.getIsTest()) < 4) { bMaterial.setFileUrl(dto.getVideoUrl());
bMaterial.setFileUrl(model.getVideoUrl());
} else if (Integer.parseInt(model.getIsTest()) >= 4) {
bMaterial.setFileUrl(model.getFileUrl());
}
bMaterial.setType(model.getIsTest()); bMaterial.setType(model.getIsTest());
bMaterial.setUploadType("1"); bMaterial.setUploadType("1");
bMaterial.setFileSize(dto.getFileSize()); bMaterial.setFileSize(dto.getFileSize());
...@@ -320,9 +316,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -320,9 +316,8 @@ public class BChapterServiceImpl implements BChapterService {
public String changeFile(BFile bFile) { public String changeFile(BFile bFile) {
log.debug("****************request + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/") + 1); String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/") + 1);
String filePath = global.getBASE_UPLOAD_SERVER_LOCATION() + global.getCOURSE_LOCATION() + File.separator + bFile.getLessonId(); String filePath = global.getBASE_UPLOAD_SERVER_LOCATION() + global.getCOURSE_LOCATION() + File.separator + bFile.getLessonId();
String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION() + global.getCOURSE_LOCATION() + File.separator + bFile.getLessonId(); String returnBasePath = global.getRETURN_UPLOAD_SERVER_LOCATION() + global.getCOURSE_LOCATION() + File.separator + bFile.getLessonId();
File file = new File(filePath); File file = new File(filePath);
...@@ -359,7 +354,6 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -359,7 +354,6 @@ public class BChapterServiceImpl implements BChapterService {
String downLoadFileUrl = downLoadFile(bFile, file, filePath); String downLoadFileUrl = downLoadFile(bFile, file, filePath);
log.debug("------------------z12-----------------------------downLoadFileUrl:" + filePath + File.separator + downLoadFileUrl); log.debug("------------------z12-----------------------------downLoadFileUrl:" + filePath + File.separator + downLoadFileUrl);
log.debug("------------------z12-----------------------------filePath:" + filePath + File.separator + newName); log.debug("------------------z12-----------------------------filePath:" + filePath + File.separator + newName);
int result = officeToPdf.transformToPdf(filePath + File.separator + downLoadFileUrl, filePath + File.separator + newName); int result = officeToPdf.transformToPdf(filePath + File.separator + downLoadFileUrl, filePath + File.separator + newName);
log.debug("------------------z13-----------------------------"); log.debug("------------------z13-----------------------------");
if (result < 1) { if (result < 1) {
...@@ -374,6 +368,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -374,6 +368,8 @@ public class BChapterServiceImpl implements BChapterService {
bFileRepository.updateByPrimaryKeySelective(bFile); bFileRepository.updateByPrimaryKeySelective(bFile);
} }
log.debug("------------------z16-----------------------------"); log.debug("------------------z16-----------------------------");
log.debug("****************request + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
return returnBasePath + File.separator + newName; return returnBasePath + File.separator + newName;
} }
} else { } else {
...@@ -384,6 +380,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -384,6 +380,7 @@ public class BChapterServiceImpl implements BChapterService {
//下载 //下载
public String downLoadFile(BFile bFile, File file, String filePath) { public String downLoadFile(BFile bFile, File file, String filePath) {
log.debug("****************download + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/") + 1); String name = bFile.getVideoUrl().substring(bFile.getVideoUrl().lastIndexOf("/") + 1);
log.debug("------------------D1-----------------------------" + filePath); log.debug("------------------D1-----------------------------" + filePath);
...@@ -427,7 +424,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -427,7 +424,7 @@ public class BChapterServiceImpl implements BChapterService {
log.debug("------------------D10-----------------------------"); log.debug("------------------D10-----------------------------");
BufferedOutputStream bos = new BufferedOutputStream(fileOut); BufferedOutputStream bos = new BufferedOutputStream(fileOut);
log.debug("------------------D11-----------------------------"); log.debug("------------------D11-----------------------------");
byte[] buf = new byte[4096]; byte[] buf = new byte[1024 * 512];
int length = bis.read(buf); int length = bis.read(buf);
//保存文件 //保存文件
while (length != -1) { while (length != -1) {
...@@ -438,6 +435,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -438,6 +435,7 @@ public class BChapterServiceImpl implements BChapterService {
bis.close(); bis.close();
conn.disconnect(); conn.disconnect();
log.debug("------------------D12-----------------------------"); log.debug("------------------D12-----------------------------");
log.debug("****************download + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage() + "下载文件异常"); log.error(e.getMessage() + "下载文件异常");
throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR); throw new ServiceException(ResultServiceEnums.DOWNLOAD_ERROR);
......
...@@ -40,7 +40,7 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> { ...@@ -40,7 +40,7 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
@Insert("<script>INSERT INTO b_train_file " + @Insert("<script>INSERT INTO b_train_file " +
"(create_date,create_by,update_date,update_by," + "(create_date,create_by,update_date,update_by," +
"del_flag,flag,business_id,remarks" + "del_flag,flag,business_id,remarks, " +
"lesson_id,file_name,video_url,file_url,file_size,type)VALUES" + "lesson_id,file_name,video_url,file_url,file_size,type)VALUES" +
"<foreach collection=\"param\" item=\"item\" separator=\",\">" + "<foreach collection=\"param\" item=\"item\" separator=\",\">" +
"(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy}," + "(#{item.createDate},#{item.createBy},#{item.updateDate},#{item.updateBy}," +
......
...@@ -524,7 +524,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -524,7 +524,7 @@ public class BLessonController extends PaginationController<BLesson> {
* @param * @param
* @return * @return
*/ */
@ApiOperation(value="630 培训学员总数", notes="培训学员总数(已报名 已到场 未到场)") @ApiOperation(value="630 培训学员", notes="培训学员")
@GetMapping(value = "/trainPersons") @GetMapping(value = "/trainPersons")
public Result trainPersons(CurUser curUser,@Valid FindTrainPersonDTO param,BindingResult bindingResult ) { public Result trainPersons(CurUser curUser,@Valid FindTrainPersonDTO param,BindingResult bindingResult ) {
...@@ -570,4 +570,15 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -570,4 +570,15 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.findOneMyTrain(curUser,businessId)); bLessonService.findOneMyTrain(curUser,businessId));
} }
@ApiOperation(value="633 单一查询我主讲培训的信息", notes="单一查询我主讲培训的信息",response = BLesson.class)
@ApiImplicitParam(name = "lessonId", value = "培训课id", required = true, dataType = "varchar")
@GetMapping(value = "/findOneMyTeachTrain")
public Result findOneMyTeachTrain(CurUser curUser,String lessonId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.findOneMyTeachTrain(curUser,lessonId));
}
} }
...@@ -86,7 +86,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -86,7 +86,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" where bl.del_flag != 1 and bl.flag = 1 " + " where bl.del_flag != 1 and bl.flag = 1 " +
" and bl.business_id = #{businessId} " + " and bl.business_id = #{businessId} " +
"</script>") "</script>")
@ResultMap(value = "BaseResultMap") @ResultMap(value = "TrainBaseResultMap")
BLesson selectInfoById(String businessId); BLesson selectInfoById(String businessId);
...@@ -934,7 +934,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -934,7 +934,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
"and les.del_flag != 1 and les.flag = 1 "+ "and les.del_flag != 1 and les.flag = 1 "+
"AND les.corp_id = #{corpId}" + "AND les.corp_id = #{corpId}" +
"<if test='!isAdmin'>" + "<if test='!isAdmin'>" +
"AND les.lecturer_id IN" + "AND les.create_by IN" +
"<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " + "<foreach item='item' index='index' collection='CurUserSet' open='(' close=')' separator=','> " +
"#{item} " + "#{item} " +
"</foreach>" + "</foreach>" +
...@@ -967,6 +967,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -967,6 +967,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap(value = "TrainBaseResultMap") @ResultMap(value = "TrainBaseResultMap")
BLesson findOneMyTrain(@Param("curUser") CurUser curUser, @Param("businessId") String businessId); BLesson findOneMyTrain(@Param("curUser") CurUser curUser, @Param("businessId") String businessId);
@Select("<script>select bl.*, " +
" su.name lecturerName " +
" from b_lesson bl " +
" left join s_user su on bl.lecturer_id = su.business_id " +
" where 1=1 " +
"and bl.del_flag = 0 and bl.flag = 1 " +
"and bl.business_id = #{lessonId} </script>")
@ResultMap(value = "TrainBaseResultMap")
BLesson findOneMyTeachTrain(@Param("curUser") CurUser curUser, @Param("lessonId") String lessonId);
@Select("<script>" + @Select("<script>" +
" select count(1) from b_lesson_person " + " select count(1) from b_lesson_person " +
......
...@@ -37,7 +37,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> { ...@@ -37,7 +37,7 @@ public interface BViewrangeRepository extends BaseMapper<BViewrange> {
" <if test='remarks != null'>remarks=#{remarks},</if> ", " <if test='remarks != null'>remarks=#{remarks},</if> ",
" <if test='lessonId != null'>lesson_id=#{lessonId},</if> ", " <if test='lessonId != null'>lesson_id=#{lessonId},</if> ",
" <if test='type != null'>type=#{type},</if> ", " <if test='type != null'>type=#{type},</if> ",
" <if test='corp_id != null'>corp_id=#{corp_id},</if> ", " <if test='corp_id != null'>corp_id=#{corpId},</if> ",
" </set>", " </set>",
"where lesson_id=#{lessonId}", "where lesson_id=#{lessonId}",
"</script>"}) "</script>"})
......
...@@ -27,9 +27,11 @@ public class AddLessonDTO { ...@@ -27,9 +27,11 @@ public class AddLessonDTO {
private String defaultUrl; private String defaultUrl;
@ApiModelProperty(value = "课程分类",required = true) @ApiModelProperty(value = "课程分类",required = true)
@NotBlank
private String courseId; private String courseId;
@ApiModelProperty(value = "讲师id")
private String lecturerId;
@ApiModelProperty(value = "课程描述") @ApiModelProperty(value = "课程描述")
private String courseDescription; private String courseDescription;
......
package org.rcisoft.business.blesson.entity; package org.rcisoft.business.blesson.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
...@@ -12,6 +13,7 @@ import org.rcisoft.common.component.Global; ...@@ -12,6 +13,7 @@ import org.rcisoft.common.component.Global;
import org.rcisoft.core.entity.IdEntity; import org.rcisoft.core.entity.IdEntity;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
...@@ -109,15 +111,23 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -109,15 +111,23 @@ public class BLesson extends IdEntity<BLesson> {
private String value; private String value;
//---------------培训------------------ //---------------培训------------------
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
@ApiModelProperty(value = "报名开始时间") @ApiModelProperty(value = "报名开始时间")
private Date applyStartDate; private Date applyStartDate;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
@ApiModelProperty(value = "报名结束时间") @ApiModelProperty(value = "报名结束时间")
private Date applyOverDate; private Date applyOverDate;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
@ApiModelProperty(value = "培训开始时间") @ApiModelProperty(value = "培训开始时间")
private Date trainStartDate; private Date trainStartDate;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
@ApiModelProperty(value = "培训结束时间") @ApiModelProperty(value = "培训结束时间")
private Date trainOverDate; private Date trainOverDate;
...@@ -128,6 +138,8 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -128,6 +138,8 @@ public class BLesson extends IdEntity<BLesson> {
@Length(min = 1,max = 255,message = "长度最小为1,最大为255") @Length(min = 1,max = 255,message = "长度最小为1,最大为255")
private String trainAddress; private String trainAddress;
@DateTimeFormat(pattern="yyyy/MM/dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy/MM/dd HH:mm:ss")
@ApiModelProperty(value = "培训签到时间(培训开始前 分钟数)") @ApiModelProperty(value = "培训签到时间(培训开始前 分钟数)")
@Length(min = 1,max = 15,message = "长度最小为1,最大为15") @Length(min = 1,max = 15,message = "长度最小为1,最大为15")
private String trainSignTime; private String trainSignTime;
...@@ -235,8 +247,6 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -235,8 +247,6 @@ public class BLesson extends IdEntity<BLesson> {
UserUtil.setCurrentPersistOperation(this); UserUtil.setCurrentPersistOperation(this);
//设置状态为待发布 //设置状态为待发布
this.setReleaseState("0"); this.setReleaseState("0");
// //设置讲师为登录人
// this.setLecturerId(this.getCreateBy());
//设置初始报名人数为0 //设置初始报名人数为0
this.setPersonNumber("0"); this.setPersonNumber("0");
//设置初始评论人数为0 //设置初始评论人数为0
......
...@@ -69,6 +69,9 @@ public class BLessonPerson extends IdEntity<BLessonPerson> { ...@@ -69,6 +69,9 @@ public class BLessonPerson extends IdEntity<BLessonPerson> {
@Length(min = 1,max = 1,message = "长度最小为1,最大为1") @Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private String trainIsSign; private String trainIsSign;
@ApiModelProperty(value = "报名日期")
private String applyDate;
@ApiModelProperty(value = "签到日期") @ApiModelProperty(value = "签到日期")
private String signDate; private String signDate;
//----------------------------- //-----------------------------
......
...@@ -21,6 +21,5 @@ public class BViewrange extends IdEntity<BViewrange> { ...@@ -21,6 +21,5 @@ public class BViewrange extends IdEntity<BViewrange> {
private String type; private String type;
} }
...@@ -244,4 +244,13 @@ public interface BLessonService{ ...@@ -244,4 +244,13 @@ public interface BLessonService{
*/ */
BLesson findOneMyTrain(CurUser curUser,String businessId); BLesson findOneMyTrain(CurUser curUser,String businessId);
/**
* 单一查询我参加培训的信息
* @param curUser
* @param lessonId
* @return
*/
BLesson findOneMyTeachTrain(CurUser curUser,String lessonId);
} }
...@@ -15,6 +15,7 @@ import org.rcisoft.business.blesson.entity.*; ...@@ -15,6 +15,7 @@ import org.rcisoft.business.blesson.entity.*;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.blesson.util.recursion; import org.rcisoft.business.blesson.util.recursion;
import org.rcisoft.business.blesson.dao.BViewrangeRepository; import org.rcisoft.business.blesson.dao.BViewrangeRepository;
import org.rcisoft.business.bmaterial.dao.BMaterialRepository;
import org.rcisoft.business.bmaterial.entity.BMaterial; import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.rcisoft.common.util.feignDto.*; import org.rcisoft.common.util.feignDto.*;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient; import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
...@@ -76,6 +77,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -76,6 +77,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired @Autowired
private BTrainFileRepository bTrainFileRepository; private BTrainFileRepository bTrainFileRepository;
@Autowired
private BMaterialRepository bMaterialRepository;
@Autowired @Autowired
MTCotactApiRequestClient cotactApiRequestClient; MTCotactApiRequestClient cotactApiRequestClient;
...@@ -223,6 +227,8 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -223,6 +227,8 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO) { public PersistModel persist(AddLessonDTO addLessonDTO) {
BLesson model = new BLesson(); BLesson model = new BLesson();
//取出文件集合
List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList();
BeanUtils.copyProperties(addLessonDTO, model); BeanUtils.copyProperties(addLessonDTO, model);
int line = 0; int line = 0;
...@@ -307,18 +313,23 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -307,18 +313,23 @@ public class BLessonServiceImpl implements BLessonService {
//删除原有文件 //删除原有文件
bTrainFileRepository.deleteByLessonId(model.getBusinessId()); bTrainFileRepository.deleteByLessonId(model.getBusinessId());
//获取b_material中已有的URL
List<String> urls = bMaterialRepository.materialHaveUrl(trainFileList);
//移除已有URL
// urls.forEach(url->{
//
// });
} }
//转换json //转换json
if (StringUtils.isNotEmpty(addLessonDTO.getTrainFileJson())){ if (StringUtils.isNotEmpty(addLessonDTO.getTrainFileJson())){
List<BTrainFile> bTrainFiles ; List<BTrainFile> bTrainFiles = JSONObject.parseArray(addLessonDTO.getTrainFileJson(), BTrainFile.class);
bTrainFiles=JSONObject.parseArray(addLessonDTO.getTrainFileJson(), BTrainFile.class);
addLessonDTO.setTrainFileList(bTrainFiles); addLessonDTO.setTrainFileList(bTrainFiles);
} }
List<BMaterial> bMaterialList = new ArrayList<>(); List<BMaterial> bMaterialList = new ArrayList<>();
//插入b_train_file表 //插入b_train_file表
if (addLessonDTO.getTrainFileList() != null && addLessonDTO.getTrainFileList().size() > 0) { if (trainFileList != null && trainFileList.size() > 0) {
List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList();
for (BTrainFile bTrainFile : trainFileList) { for (BTrainFile bTrainFile : trainFileList) {
bTrainFile.setLessonId(model.getBusinessId()); bTrainFile.setLessonId(model.getBusinessId());
UserUtil.setCurrentPersistOperation(bTrainFile); UserUtil.setCurrentPersistOperation(bTrainFile);
...@@ -335,8 +346,24 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -335,8 +346,24 @@ public class BLessonServiceImpl implements BLessonService {
bMaterialList.add(bMaterial); bMaterialList.add(bMaterial);
} }
bTrainFileRepository.insertTrainFileList(trainFileList); bTrainFileRepository.insertTrainFileList(trainFileList);
//插入资料表
//插入资料表
// BMaterial bMaterial = new BMaterial();
// UserUtil.setCurrentPersistOperation(bMaterial);
// bMaterial.setLessonId(model.getBusinessId());
// bMaterial.setFileName(dto.getFileName());
//
// if (StringUtils.isNotEmpty(dto.getFileTime()) && dto.getFileTime().contains(".")) {
// bMaterial.setFileTime(dto.getFileTime().substring(0, dto.getFileTime().lastIndexOf(".")));
// }
//
// bMaterial.setFileUrl(dto.getVideoUrl());
//
// bMaterial.setType(model.getIsTest());
// bMaterial.setUploadType("1");
// bMaterial.setFileSize(dto.getFileSize());
// bMaterialRepository.insertMaterial(bMaterial);
//
} }
return new PersistModel(line, model); return new PersistModel(line, model);
...@@ -600,11 +627,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -600,11 +627,13 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public ILessonCountDTO trainPersonCount(String lessonId) { public ILessonCountDTO trainPersonCount(String lessonId) {
return bLessonRepository.trainPersonCount(lessonId); return bLessonRepository.trainPersonCount(lessonId);
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLessonPerson> trainPersons(FindTrainPersonDTO param) { public List<BLessonPerson> trainPersons(FindTrainPersonDTO param) {
List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.trainPersons(param); List<BLessonPerson> bLessonPersonList = bLessonPersonRepository.trainPersons(param);
if (bLessonPersonList != null && bLessonPersonList.size()>0){ if (bLessonPersonList != null && bLessonPersonList.size()>0){
...@@ -733,6 +762,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -733,6 +762,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel deleteRecommend(String lessonId) { public PersistModel deleteRecommend(String lessonId) {
List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId); List<String> recommendIds = bRecommendRepository.selectIdByLessonId(lessonId);
...@@ -751,6 +781,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -751,6 +781,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel setTrainIsSign(SetTrainIsSignDTO setTrainIsSignDTO) { public PersistModel setTrainIsSign(SetTrainIsSignDTO setTrainIsSignDTO) {
BLessonPerson bLessonPerson = new BLessonPerson(); BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.setBusinessId(setTrainIsSignDTO.getBusinessId()); bLessonPerson.setBusinessId(setTrainIsSignDTO.getBusinessId());
...@@ -761,6 +792,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -761,6 +792,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel addCollect(CurUser curUser, String lessonId) { public PersistModel addCollect(CurUser curUser, String lessonId) {
AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId, curUser.getCorpId(), curUser.getUserId()); AddMyLearnLessonDTO param = new AddMyLearnLessonDTO(lessonId, curUser.getCorpId(), curUser.getUserId());
List<BCollect> bLessonPersons = bCollectRepository.selectByPersonAndLesson(param); List<BCollect> bLessonPersons = bCollectRepository.selectByPersonAndLesson(param);
...@@ -781,6 +813,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -781,6 +813,7 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public int toTraining(CurUser curUser, String lessonId) { public int toTraining(CurUser curUser, String lessonId) {
BLessonPerson person = new BLessonPerson(); BLessonPerson person = new BLessonPerson();
BLessonPerson bLessonPerson = new BLessonPerson(); BLessonPerson bLessonPerson = new BLessonPerson();
...@@ -806,9 +839,29 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -806,9 +839,29 @@ public class BLessonServiceImpl implements BLessonService {
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public BLesson findOneMyTrain(CurUser curUser, String businessId) { public BLesson findOneMyTrain(CurUser curUser, String businessId) {
BLesson bLesson = bLessonRepository.findOneMyTrain(curUser, businessId); BLesson bLesson = bLessonRepository.findOneMyTrain(curUser, businessId);
if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
}
int trainApplyCount = bLessonRepository.trainApplyCount(bLesson.getBusinessId());
if (StringUtils.isNotEmpty(bLesson.getMaxApplyPerson()) &&trainApplyCount >= Integer.parseInt(bLesson.getMaxApplyPerson())){
bLesson.setApplyIsFull("1");
}else {
bLesson.setApplyIsFull("0");
}
return bLesson;
}
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public BLesson findOneMyTeachTrain(CurUser curUser, String lessonId) {
BLesson bLesson = bLessonRepository.findOneMyTeachTrain(curUser, lessonId);
if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
}
int trainApplyCount = bLessonRepository.trainApplyCount(bLesson.getBusinessId()); int trainApplyCount = bLessonRepository.trainApplyCount(bLesson.getBusinessId());
if (StringUtils.isNotEmpty(bLesson.getMaxApplyPerson()) &&trainApplyCount >= Integer.parseInt(bLesson.getMaxApplyPerson())){ if (StringUtils.isNotEmpty(bLesson.getMaxApplyPerson()) &&trainApplyCount >= Integer.parseInt(bLesson.getMaxApplyPerson())){
bLesson.setApplyIsFull("1"); bLesson.setApplyIsFull("1");
......
package org.rcisoft.business.bmaterial.dao; package org.rcisoft.business.bmaterial.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.bfile.entity.BTrainFile;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bmaterial.entity.BMaterial; import org.rcisoft.business.bmaterial.entity.BMaterial;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
...@@ -33,10 +35,10 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> { ...@@ -33,10 +35,10 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@Insert("<script>insert into b_material " + @Insert("<script>insert into b_material " +
" (business_id,chapter_id,file_name,file_url, " + " (business_id,chapter_id,file_name,file_url, " +
" type,upload_type,file_size,flag,del_flag, " + " type,upload_type,file_size,flag,del_flag, " +
" remarks,create_by,update_by,update_date,create_date,file_time) " + " remarks,create_by,update_by,update_date,create_date,file_time,lesson_id) " +
" values(#{businessId},#{chapterId},#{fileName},#{fileUrl}, " + " values(#{businessId},#{chapterId},#{fileName},#{fileUrl}, " +
" #{type},#{uploadType},#{fileSize},#{flag},#{delFlag}, " + " #{type},#{uploadType},#{fileSize},#{flag},#{delFlag}, " +
" #{remarks},#{createBy},#{updateBy},#{updateDate},#{createDate},#{fileTime}) " + " #{remarks},#{createBy},#{updateBy},#{updateDate},#{createDate},#{fileTime},#{lessonId}) " +
"</script>") "</script>")
int insertMaterial(BMaterial bMaterial); int insertMaterial(BMaterial bMaterial);
...@@ -52,5 +54,14 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> { ...@@ -52,5 +54,14 @@ public interface BMaterialRepository extends BaseMapper<BMaterial> {
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BMaterial> queryMyBMaterialByPagination(CurUser curUser); List<BMaterial> queryMyBMaterialByPagination(CurUser curUser);
@Select("<script>select file_url from b_material " +
" where 1=1 " +
" and del_flag != 1 and flag = 1 " +
" and file_url in "+
"<foreach item='item' index='index' collection='trainFileList' open='(' separator=',' close=')'> #{item.videoUrl} </foreach> " +
"</script>")
List<String> materialHaveUrl(@Param("trainFileList") List<BTrainFile> trainFileList);
} }
...@@ -8,6 +8,7 @@ import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; ...@@ -8,6 +8,7 @@ import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection;
import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
...@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component; ...@@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.ConnectException; import java.net.ConnectException;
import java.util.Date;
/** /**
* Created by Administrator on 2018/1/19. * Created by Administrator on 2018/1/19.
...@@ -84,6 +86,8 @@ public class OfficeToPdf { ...@@ -84,6 +86,8 @@ public class OfficeToPdf {
* @return 1 成功 0 失败 -1 错误 * @return 1 成功 0 失败 -1 错误
*/ */
public synchronized int transformToPdf(String sourceFile, String destFile){ public synchronized int transformToPdf(String sourceFile, String destFile){
log.debug("****************transform + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
OpenOfficeConnection connection = null; OpenOfficeConnection connection = null;
try { try {
File inputFile = new File(sourceFile); File inputFile = new File(sourceFile);
...@@ -100,7 +104,12 @@ public class OfficeToPdf { ...@@ -100,7 +104,12 @@ public class OfficeToPdf {
// connect to an OpenOffice.org instance running on port 8100 // connect to an OpenOffice.org instance running on port 8100
connection = new SocketOpenOfficeConnection( connection = new SocketOpenOfficeConnection(
global.getLibreofficeIp(), global.getLibreofficePort()); global.getLibreofficeIp(), global.getLibreofficePort());
log.debug("****************connect + begin***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
connection.connect(); connection.connect();
log.debug("****************connect + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
// convert // convert
log.debug("----------ZH------------"); log.debug("----------ZH------------");
DocumentConverter converter = new OpenOfficeDocumentConverter( DocumentConverter converter = new OpenOfficeDocumentConverter(
...@@ -114,6 +123,8 @@ public class OfficeToPdf { ...@@ -114,6 +123,8 @@ public class OfficeToPdf {
log.info("开始转换--> "+ sourceFile); log.info("开始转换--> "+ sourceFile);
converter.convert(inputFile,inputDocumentFormat,outputFile,outputDocumentFormat); converter.convert(inputFile,inputDocumentFormat,outputFile,outputDocumentFormat);
log.info("转换完毕--> "+ destFile); log.info("转换完毕--> "+ destFile);
log.debug("****************transform + end***********" + DateFormatUtils.format(new Date(), "HH:mm:ss"));
// close the connection // close the connection
} catch (ConnectException e) { } catch (ConnectException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
<result column="is_apply" jdbcType="VARCHAR" property="isApply"/> <result column="is_apply" jdbcType="VARCHAR" property="isApply"/>
<result column="train_is_sign" jdbcType="VARCHAR" property="trainIsSign"/> <result column="train_is_sign" jdbcType="VARCHAR" property="trainIsSign"/>
<result column="apply_date" jdbcType="VARCHAR" property="applyDate"/>
<result column="sign_date" jdbcType="VARCHAR" property="signDate"/> <result column="sign_date" jdbcType="VARCHAR" property="signDate"/>
</resultMap> </resultMap>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment