Commit ba4be424 authored by root's avatar root

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

parents 037e3468 4f17f4f5
...@@ -113,6 +113,15 @@ public class BChapterController extends PaginationController<BChapter> { ...@@ -113,6 +113,15 @@ public class BChapterController extends PaginationController<BChapter> {
MessageConstant.MESSAGE_ALERT_ERROR, MessageConstant.MESSAGE_ALERT_ERROR,
map); map);
} }
@ApiOperation(value = "205 查询章节带进度", notes = "根据lessonId查询章节带进度")
@GetMapping(value = "/queryBChaptersWithProgress")
public Result queryBChaptersWithProgress(CurUser curUser,@Valid QueryChapterListDTO param,BindingResult br) {
Map<String, Object> map = new HashedMap();
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bChapterService.queryBChaptersWithProgress(param));
}
// //
// @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态") // @ApiOperation(value = "更改章节状态", notes = "根据章节ID更改章节状态")
// @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"), // @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar"),
......
...@@ -10,4 +10,7 @@ public class QueryChapterListDTO { ...@@ -10,4 +10,7 @@ public class QueryChapterListDTO {
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") @Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程ID") @ApiModelProperty(value = "课程ID")
private String lessonId; private String lessonId;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@ApiModelProperty(value = "课程ID")
private String studentId;
} }
...@@ -31,7 +31,8 @@ public class QueryChapterListResDTO { ...@@ -31,7 +31,8 @@ public class QueryChapterListResDTO {
private Integer sort; private Integer sort;
@ApiModelProperty(value = "子章节") @ApiModelProperty(value = "子章节")
private List<BChapter> childList; // private List<BChapter> childList;
private List<QueryChapterListResDTO> childList;
@ApiModelProperty(value = "视频地址") @ApiModelProperty(value = "视频地址")
private String videoUrl; private String videoUrl;
...@@ -51,6 +52,9 @@ public class QueryChapterListResDTO { ...@@ -51,6 +52,9 @@ public class QueryChapterListResDTO {
@ApiModelProperty(value = "文件名") @ApiModelProperty(value = "文件名")
private String fileName; private String fileName;
@ApiModelProperty(value = "进度")
private String progress;
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private String businessId; private String businessId;
} }
...@@ -8,6 +8,7 @@ import org.rcisoft.core.aop.PageUtil; ...@@ -8,6 +8,7 @@ import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by gwf on 2017-7-21 15:08:47. * Created by gwf on 2017-7-21 15:08:47.
...@@ -42,6 +43,13 @@ public interface BChapterService{ ...@@ -42,6 +43,13 @@ public interface BChapterService{
*/ */
List<QueryChapterListResDTO> queryBChapters(QueryChapterListDTO model); List<QueryChapterListResDTO> queryBChapters(QueryChapterListDTO model);
/**
* 根据条件查找全部
* @param model
* @return
*/
Map queryBChaptersWithProgress(QueryChapterListDTO model);
/** /**
* 插入 * 插入
* @param model * @param model
......
...@@ -15,6 +15,8 @@ import org.rcisoft.business.blesson.dao.BLessonRepository; ...@@ -15,6 +15,8 @@ import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.bfile.dao.BFileRepository; import org.rcisoft.business.bfile.dao.BFileRepository;
import org.rcisoft.business.bfile.entity.BFile; import org.rcisoft.business.bfile.entity.BFile;
import org.rcisoft.business.brstudentchapter.dao.BRStudentChapterRepository;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
...@@ -56,6 +58,8 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -56,6 +58,8 @@ public class BChapterServiceImpl implements BChapterService {
private BFileRepository bFileRepository; private BFileRepository bFileRepository;
@Autowired @Autowired
private Global global; private Global global;
@Autowired
BRStudentChapterRepository brStudentChapterRepository;
@Override @Override
public BChapter selectOne(String businessId) { public BChapter selectOne(String businessId) {
...@@ -79,6 +83,22 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -79,6 +83,22 @@ public class BChapterServiceImpl implements BChapterService {
public List<QueryChapterListResDTO> queryBChapters(QueryChapterListDTO model) { public List<QueryChapterListResDTO> queryBChapters(QueryChapterListDTO model) {
return queryChapterListResDTO(model); return queryChapterListResDTO(model);
} }
@Override
public Map queryBChaptersWithProgress(QueryChapterListDTO model) {
List<QueryChapterListResDTO> queryChapterListResDTOS = queryChapterListResDTO(model);
queryChapterListResDTOS.stream().forEach(queryChapterListResDTO -> {
queryChapterListResDTO.getChildList().stream().forEach(childList -> {
List<BRStudentChapter> brStudentChapterList = brStudentChapterRepository.queryByStuIdAndChapter(childList.getBusinessId(),model.getStudentId());
if (null != brStudentChapterList && brStudentChapterList.size()>0){
childList.setProgress(brStudentChapterList.get(0).getProgress());
}
});
});
Map map = new HashMap();
map.put("chapterList",queryChapterListResDTOS);
map.put("lessonInfo",bLessonRepository.selectByPrimaryKey(model.getLessonId()));
return map;
}
/** /**
* dto查询章节信息 * dto查询章节信息
......
package org.rcisoft.business.bdiscuss.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.bdiscuss.entity.BDiscuss;
import org.rcisoft.business.bdiscuss.service.BDiscussService;
import java.util.List;
/**
* Created by on 2019-9-25 9:03:09.
*/
@RestController
@RequestMapping("bdiscuss")
public class BDiscussController extends PaginationController<BDiscuss> {
@Autowired
private BDiscussService bDiscussServiceImpl;
@ApiOperation(value="801 添加", notes="添加")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "课程id 修改章节时传入", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "lessonId", value = "课程ID", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "content", value = "评论内容", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "pid", value = "上一级(评论别人的评论需要)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "studentId", value = "评论人id", required = true, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add(@Valid BDiscuss bDiscuss, BindingResult bindingResult) {
// bDiscuss.setToken(getToken());
PersistModel data = bDiscussServiceImpl.save(bDiscuss);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDiscuss);
}
@ApiOperation(value="802 根据课程id查询评论集合", notes="根据课程id查询评论")
@GetMapping("{lessonId:\\w+}")
public Result getDiscussByLessonId(@PathVariable String lessonId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDiscussServiceImpl.getDiscussByLessonId(lessonId));
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) {
BDiscuss bDiscuss = new BDiscuss();
bDiscuss.setBusinessId(id);
// bDiscuss.setToken(getToken());
PersistModel data = bDiscussServiceImpl.remove(bDiscuss);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{id:\\w+}")
public Result update(@Valid BDiscuss bDiscuss, BindingResult bindingResult) {
// bDiscuss.setToken(getToken());
PersistModel data = bDiscussServiceImpl.merge(bDiscuss);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDiscuss);
}
@ApiOperation(value="查看单 ", notes="查看单 ")
@GetMapping("/detail/{id:\\w+}")
public Result detail(@PathVariable String id) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bDiscussServiceImpl.findById(id));
}
}
package org.rcisoft.business.bdiscuss.dao;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.bdiscuss.dto.BDiscussDto;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bdiscuss.entity.BDiscuss;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-9-25 9:03:09.
*/
@Repository
public interface BDiscussRepository extends BaseMapper<BDiscuss> {
/**
* 分页查询 bDiscuss
*
*/
@Select("<script>select * from b_discuss where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BDiscuss> queryBDiscusss(BDiscuss bDiscuss);
@Select("<script> SELECT " +
" bd.*, " +
" su.NAME AS studentName " +
"FROM " +
" b_discuss bd " +
" LEFT JOIN s_user su ON su.business_id = bd.student_id " +
"WHERE " +
" 1 = 1 " +
" AND bd.del_flag = '0' " +
" AND bd.flag = '1' "
+ "<if test=\"lessonId !=null and lessonId != '' \">and bd.lesson_id = #{lessonId} </if> "
+ "<if test=\"pid !=null and pid != '' \">and bd.pid = #{pid} </if> "
+ "<if test=\"pid ==null or pid == '' \">and bd.pid = '-1' </if> "
+ "</script>")
@ResultMap(value = "BaseResultMapDto" )
List<BDiscussDto> getDiscussByLessonId(@Param("lessonId") String lessonId, @Param("pid") String pid);
}
package org.rcisoft.business.bdiscuss.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.business.bdiscuss.entity.BDiscuss;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.List;
/**
* Created with on 2019-9-25 9:03:08.
*/
@Data
public class BDiscussDto extends BDiscuss {
private List<BDiscussDto> bDiscussChildList;
private String studentName;
}
package org.rcisoft.business.bdiscuss.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2019-9-25 9:03:08.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_discuss")
public class BDiscuss extends IdEntity<BDiscuss> {
private String lessonId;
private String pid;
private String content;
private String level;
private String studentId;
}
package org.rcisoft.business.bdiscuss.service;
import org.rcisoft.business.bdiscuss.dto.BDiscussDto;
import org.rcisoft.business.bdiscuss.entity.BDiscuss;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by on 2019-9-25 9:03:09.
*/
public interface BDiscussService {
/**
* 保存
* @param bDiscuss
* @return
*/
PersistModel save(BDiscuss bDiscuss);
/**
* 逻辑删除
* @param bDiscuss
* @return
*/
PersistModel remove(BDiscuss bDiscuss);
/**
* 修改
* @param bDiscuss
* @return
*/
PersistModel merge(BDiscuss bDiscuss);
/**
* 根据id查询
* @param id
* @return
*/
BDiscuss findById(String id);
/**
* 分页查询
* @param bDiscuss
* @return
*/
List<BDiscuss> findAllByPagination(PageUtil<BDiscuss> paginationUtility,
BDiscuss bDiscuss);
List<BDiscussDto> getDiscussByLessonId(String lessonId);
}
package org.rcisoft.business.bdiscuss.service.impl;
import org.rcisoft.business.bdiscuss.dto.BDiscussDto;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.bdiscuss.dao.BDiscussRepository;
import org.rcisoft.business.bdiscuss.entity.BDiscuss;
import org.rcisoft.business.bdiscuss.service.BDiscussService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2019-9-25 9:03:09.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BDiscussServiceImpl implements BDiscussService {
@Autowired
private BDiscussRepository bDiscussRepository;
/**
* 保存 bDiscuss
* @param bDiscuss
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BDiscuss bDiscuss){
//增加操作
UserUtil.setCurrentPersistOperation(bDiscuss);
int line = bDiscussRepository.insertSelective(bDiscuss);
// log.info(UserUtil.getUserInfoProp(bDiscuss.getToken(),UserUtil.USER_USERNAME)+"新增了ID为"+
// bDiscuss.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 逻辑删除
* @param bDiscuss
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BDiscuss bDiscuss){
UserUtil.setCurrentMergeOperation(bDiscuss);
bDiscuss.setDeleted();
int line = bDiscussRepository.logicalDelete(bDiscuss);
// log.info(UserUtil.getUserInfoProp(bDiscuss.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
// bDiscuss.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 修改 bDiscuss
* @param bDiscuss
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel merge(BDiscuss bDiscuss){
UserUtil.setCurrentMergeOperation(bDiscuss);
int line = bDiscussRepository.updateByPrimaryKeySelective(bDiscuss);
// log.info(UserUtil.getUserInfoProp(bDiscuss.getToken(),UserUtil.USER_USERNAME)+"修改了ID为"+
// bDiscuss.getBusinessId()+"的信息");
return new PersistModel(line);
}
/**
* 根据id查询 bDiscuss
* @param id
* @return
*/
public BDiscuss findById(String id){
return bDiscussRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bDiscuss
* @param bDiscuss
* @return
*/
public List<BDiscuss> findAllByPagination(PageUtil<BDiscuss> paginationUtility,
BDiscuss bDiscuss){
bDiscuss.setStart();
bDiscuss.setNotDeleted();
return bDiscussRepository.queryBDiscusss(bDiscuss);
}
@Override
public List<BDiscussDto> getDiscussByLessonId(String lessonId) {
List<BDiscussDto> bDiscussList = bDiscussRepository.getDiscussByLessonId(lessonId,"");
bDiscussList.stream().forEach(bDiscuss -> {
bDiscuss.setBDiscussChildList(bDiscussRepository.getDiscussByLessonId(lessonId,bDiscuss.getBusinessId()));
});
return bDiscussList;
}
}
package org.rcisoft.business.brstudentchapter.controller;
/*固定导入*/
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.common.controller.PaginationController;
import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.exception.ServiceException;
import javax.validation.Valid;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.business.brstudentchapter.service.BRStudentChapterService;
import java.util.List;
/**
* Created by on 2019-9-25 10:01:43.
*/
@RestController
@RequestMapping("brstudentchapter")
public class BRStudentChapterController extends PaginationController<BRStudentChapter> {
@Autowired
private BRStudentChapterService bRStudentChapterServiceImpl;
@ApiOperation(value="添加/更新", notes="添加/更新")
//@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PostMapping(value = "/add")
public Result addOrUpdate(@Valid BRStudentChapterDto brStudentChapterDto, BindingResult bindingResult) {
PersistModel data = bRStudentChapterServiceImpl.save(brStudentChapterDto);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
brStudentChapterDto);
}
}
package org.rcisoft.business.brstudentchapter.dao;
import org.apache.ibatis.annotations.Param;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created with on 2019-9-25 10:01:43.
*/
@Repository
public interface BRStudentChapterRepository extends BaseMapper<BRStudentChapter> {
/**
* 分页查询 bRStudentChapter
*
*/
@Select("<script>select * from b_r_student_chapter where 1=1 "
+ "</script>")
@ResultMap(value = "BRStudentChapterResultMap" )
List<BRStudentChapter> queryBRStudentChapters(BRStudentChapter bRStudentChapter);
/**
* 根据章节id和学生id查询 学生章节中间表数据
* @param
* @return
*/
@Select("<script>select * from b_r_student_chapter brsc where 1=1 "
+ "<if test=\"chapterId !=null and chapterId != '' \">and brsc.chapter_id = #{chapterId} </if> "
+ "<if test=\"studentId !=null and studentId != '' \">and brsc.student_id = #{studentId} </if> "
+ "</script>")
@ResultMap(value = "BRStudentChapterResultMap" )
List<BRStudentChapter> queryByStuIdAndChapter(@Param("chapterId") String chapterId,@Param("studentId") String studentId);
}
package org.rcisoft.business.brstudentchapter.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* Created with on 2019-9-25 10:01:43.
*/
@Data
public class BRStudentChapterDto {
private String chapterId;
private String studentId;
private String progress;
private Integer current;
private Integer duration;
// private Integer score;
//
// private String isComplete;
//
// private String automatic;
//
// private String pptFinish;
//
// private String pdfFinish;
//
// private String videoFinish;
//
// private String paperFinish;
}
package org.rcisoft.business.brstudentchapter.entity;
import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Created with on 2019-9-25 10:01:43.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_r_student_chapter")
public class BRStudentChapter {
// @Id
protected String businessId; // 编号
private String chapterId;
private String studentId;
private Integer score;
private String isComplete;
private String automatic;
private String pptFinish;
private String pdfFinish;
private String videoFinish;
private String paperFinish;
private String progress;
}
package org.rcisoft.business.brstudentchapter.service;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil;
import java.util.List;
/**
* Created by on 2019-9-25 10:01:43.
*/
public interface BRStudentChapterService {
/**
* 保存
* @param bRStudentChapter
* @return
*/
PersistModel save(BRStudentChapterDto bRStudentChapter);
/**
* 根据id查询
* @param id
* @return
*/
BRStudentChapter findById(String id);
/**
* 分页查询
* @param bRStudentChapter
* @return
*/
// List<BRStudentChapter> findAllByPagination(PageUtil<BRStudentChapter> paginationUtility,
// BRStudentChapter bRStudentChapter);
//
}
package org.rcisoft.business.brstudentchapter.service.impl;
import org.rcisoft.business.brstudentchapter.dto.BRStudentChapterDto;
import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.brstudentchapter.dao.BRStudentChapterRepository;
import org.rcisoft.business.brstudentchapter.entity.BRStudentChapter;
import org.rcisoft.business.brstudentchapter.service.BRStudentChapterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.BreakIterator;
import java.text.DecimalFormat;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2019-9-25 10:01:43.
*/
@Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j
public class BRStudentChapterServiceImpl implements BRStudentChapterService {
@Autowired
private BRStudentChapterRepository bRStudentChapterRepository;
/**
* 保存 bRStudentChapter
* @param brStudentChapterDto
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(BRStudentChapterDto brStudentChapterDto){
int line = 0;
List<BRStudentChapter> brStudentChapterList = bRStudentChapterRepository.queryByStuIdAndChapter(brStudentChapterDto.getChapterId(),brStudentChapterDto.getStudentId());
if (null != brStudentChapterList && brStudentChapterList.size() >0){
// DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
// df.format((float)brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration());
BRStudentChapter brStudentChapter = brStudentChapterList.get(0);
if (brStudentChapterDto.getCurrent() == brStudentChapterDto.getDuration()){
// who finish
brStudentChapter.setProgress("100%");
}else
brStudentChapter.setProgress(brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100+"%");
line = bRStudentChapterRepository.updateByPrimaryKey(brStudentChapter);
}else {
BRStudentChapter brStudentChapter = new BRStudentChapter();
brStudentChapter.setBusinessId(IdGen.uuid());
brStudentChapter.setStudentId(brStudentChapterDto.getStudentId());
brStudentChapter.setChapterId(brStudentChapterDto.getChapterId());
if (brStudentChapterDto.getCurrent() == brStudentChapterDto.getDuration()){ // 判断是否已经完成
brStudentChapter.setIsComplete("1");
// brStudentChapter.setAutomatic("1");
brStudentChapter.setProgress("100%");
}else {
brStudentChapter.setIsComplete("0");
// brStudentChapter.setAutomatic("0");
brStudentChapter.setProgress(brStudentChapterDto.getCurrent()/brStudentChapterDto.getDuration()*100+"%");
}
line = bRStudentChapterRepository.insertSelective(brStudentChapter);
}
//增加操作
return new PersistModel(line);
}
/**
* 根据id查询 bRStudentChapter
* @param id
* @return
*/
public BRStudentChapter findById(String id){
return bRStudentChapterRepository.selectByPrimaryKey(id);
}
/**
* 分页查询 bRStudentChapter
* @param bRStudentChapter
* @return
*/
// public List<BRStudentChapter> findAllByPagination(PageUtil<BRStudentChapter> paginationUtility,
// BRStudentChapter bRStudentChapter){
// return bRStudentChapterRepository.queryBRStudentChapters(bRStudentChapter);
// }
}
...@@ -42,10 +42,15 @@ public class SysRoleController extends PaginationController<SysRole> { ...@@ -42,10 +42,15 @@ public class SysRoleController extends PaginationController<SysRole> {
@ApiOperation(value="查询全部角色", notes="查询全部角色") @ApiOperation(value="查询全部角色", notes="查询全部角色")
@GetMapping(value = "/queryRolesAll") @GetMapping(value = "/queryRolesAll")
public GridModel queryRolesAll(CurUser curUser, @Valid FindRolePaginDTO findRolePaginDTO, BindingResult bindingResult){ public Result queryRolesAll(CurUser curUser, @Valid FindRolePaginDTO findRolePaginDTO, BindingResult bindingResult){
sysRoleServiceImpl.queryRolesAll(findRolePaginDTO); sysRoleServiceImpl.queryRolesAll(findRolePaginDTO);
GridModel gridModel = getGridModelResponse(); GridModel gridModel = getGridModelResponse();
return gridModel; // return gridModel;
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
sysRoleServiceImpl.queryRolesAll(findRolePaginDTO));
} }
@ApiOperation(value="增加/修改角色", notes="增加/修改角色") @ApiOperation(value="增加/修改角色", notes="增加/修改角色")
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.bdiscuss.dao.BDiscussRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bdiscuss.entity.BDiscuss">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
<result column="pid" jdbcType="VARCHAR" property="pid"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId"/>
</resultMap>
<resultMap id="BaseResultMapDto" type="org.rcisoft.business.bdiscuss.dto.BDiscussDto">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
<result column="pid" jdbcType="VARCHAR" property="pid"/>
<result column="content" jdbcType="LONGVARCHAR" property="content"/>
<result column="level" jdbcType="VARCHAR" property="level"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.rcisoft.business.brstudentchapter.dao.BRStudentChapterRepository">
<resultMap id="BRStudentChapterResultMap" type="org.rcisoft.business.brstudentchapter.entity.BRStudentChapter">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="chapter_id" jdbcType="VARCHAR" property="chapterId"/>
<result column="student_id" jdbcType="VARCHAR" property="studentId"/>
<result column="score" jdbcType="INTEGER" property="score"/>
<result column="is_complete" jdbcType="VARCHAR" property="isComplete"/>
<result column="automatic" jdbcType="VARCHAR" property="automatic"/>
<result column="ppt_finish" jdbcType="VARCHAR" property="pptFinish"/>
<result column="pdf_finish" jdbcType="VARCHAR" property="pdfFinish"/>
<result column="video_finish" jdbcType="VARCHAR" property="videoFinish"/>
<result column="paper_finish" jdbcType="VARCHAR" property="paperFinish"/>
<result column="progress" jdbcType="VARCHAR" property="progress"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
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