Commit 66d5f750 authored by luzhuang's avatar luzhuang

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

# Conflicts:
#	src/main/java/org/rcisoft/business/blesson/controller/BLessonController.java
parents 5098fe46 507dc3c5
...@@ -139,6 +139,7 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -139,6 +139,7 @@ public class BChapterServiceImpl implements BChapterService {
BChapter bChapter = bChapterRepository.selectByPrimaryKey(queryChapterListResDTO.getPid()); BChapter bChapter = bChapterRepository.selectByPrimaryKey(queryChapterListResDTO.getPid());
if (null != bChapter) { if (null != bChapter) {
queryChapterListResDTO.setPSort(bChapter.getSort()); queryChapterListResDTO.setPSort(bChapter.getSort());
queryChapterListResDTO.setProgress(Integer.parseInt(queryChapterListResDTO.getProgress())*100+"%");
} }
map.put("currentChapter", queryChapterListResDTO); map.put("currentChapter", queryChapterListResDTO);
} else { } else {
......
...@@ -9,6 +9,7 @@ import org.rcisoft.business.bcourse.dto.AllCourseDTO; ...@@ -9,6 +9,7 @@ import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.service.BCourseService; import org.rcisoft.business.bcourse.service.BCourseService;
import org.rcisoft.business.blesson.dto.*; import org.rcisoft.business.blesson.dto.*;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.service.BLessonPersonService; import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.common.component.Global; import org.rcisoft.common.component.Global;
...@@ -19,6 +20,7 @@ import org.rcisoft.core.model.PersistModel; ...@@ -19,6 +20,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
import org.rcisoft.sys.role.service.SysRoleService; import org.rcisoft.sys.role.service.SysRoleService;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -292,7 +294,7 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -292,7 +294,7 @@ public class BLessonController extends PaginationController<BLesson> {
* @return * @return
* @author: zhangqingle * @author: zhangqingle
*/ */
@ApiOperation(value = "615 分页查询我学习", notes = "分页查询我学习", response = BLesson.class) @ApiOperation(value="615 分页查询我学习", notes="分页查询我学习", response = BLessonPerson.class)
@GetMapping(value = "/queryLearnBLessonsByPagination") @GetMapping(value = "/queryLearnBLessonsByPagination")
public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) { public Result queryLearnBLessonsByPagination(CurUser curUser, @Valid ILearnLessonDTO param, BindingResult bindingResult) {
String userId = curUser.getUserId(); String userId = curUser.getUserId();
...@@ -581,6 +583,17 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -581,6 +583,17 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.findOneMyTeachTrain(curUser, lessonId)); bLessonService.findOneMyTeachTrain(curUser, lessonId));
} }
@ApiOperation(value="634 单一查询指派人员", notes="单一查询指派人员",response = SysUser.class)
@ApiImplicitParam(name = "lessonId", value = "培训/课程id", required = true, dataType = "varchar")
@GetMapping(value = "/findAppointPerson")
public Result findAppointPerson(CurUser curUser,String lessonId) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.findAppointPerson(curUser,lessonId));
}
@ApiOperation(value = "634 收藏课程或培训", notes = "收藏课程或培训") @ApiOperation(value = "634 收藏课程或培训", notes = "收藏课程或培训")
@GetMapping(value = "/collectLesson") @GetMapping(value = "/collectLesson")
public Result collectLesson(CurUser curUser, String lessonId) { public Result collectLesson(CurUser curUser, String lessonId) {
......
...@@ -43,7 +43,7 @@ public interface BAppointRepository extends BaseMapper<BAppoint> { ...@@ -43,7 +43,7 @@ public interface BAppointRepository extends BaseMapper<BAppoint> {
+ "and lesson_id = #{lessonId} " + "and lesson_id = #{lessonId} "
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BAppoint> selectByLessonId(AppointLessonDTO param); List<BAppoint> selectByLessonId(@Param("lessonId") String lessonId);
@Insert("<script>" + @Insert("<script>" +
......
...@@ -167,15 +167,11 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> { ...@@ -167,15 +167,11 @@ public interface BLessonPersonRepository extends BaseMapper<BLessonPerson> {
@Update("<script> update b_lesson_person blp left join b_appoint ba" + @Update("<script> update b_lesson_person blp left join b_appoint ba" +
" on blp.appoint_id = ba.business_id " + " on blp.appoint_id = ba.business_id " +
" and ba.del_flag != 1 and ba.flag = 1 " + " and ba.del_flag != 1 and ba.flag = 1 " +
" set blp.flag = '0' " +
" <set>"+ " <set>"+
" <if test=\"updateBy != null and updateBy != ''\">update_by=#{updateBy},</if>"+ " <if test=\"updateBy != null and updateBy != ''\">ba.update_by=#{updateBy},</if>"+
" <if test=\"updateDate != null and updateDate != ''\">update_date=#{updateDate},</if>"+ " <if test=\"updateDate != null \">ba.update_date=#{updateDate},</if>"+
" <if test=\"delFlag != null and delFlag != ''\">del_flag=#{delFlag},</if>"+ " <if test=\"isAppoint != null and isAppoint != ''\">blp.is_appoint=#{isAppoint},</if>"+
" <if test=\"flag != null and flag != ''\">flag=#{flag},</if>"+ " blp.appoint_id=#{appointId},"+
" <if test=\"remarks != null and remarks != ''\">remarks=#{remarks},</if>"+
" <if test=\"isAppoint != null and isAppoint != ''\">is_appoint=#{isAppoint},</if>"+
" appoint_id=#{appointId},"+
" </set>"+ " </set>"+
" where 1=1 " + " where 1=1 " +
" and blp.is_finish != '0' " + " and blp.is_finish != '0' " +
......
...@@ -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=#{corpId},</if> ", " <if test='corpId != null'>corp_id=#{corpId},</if> ",
" </set>", " </set>",
"where lesson_id=#{lessonId}", "where lesson_id=#{lessonId}",
"</script>"}) "</script>"})
......
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
import java.util.Set;
@Data @Data
public class AppointLessonDTO { public class AppointLessonDTO {
...@@ -14,8 +15,11 @@ public class AppointLessonDTO { ...@@ -14,8 +15,11 @@ public class AppointLessonDTO {
@ApiModelProperty(value = "指派范围(人id)多人之间用','隔开" ,required = true) @ApiModelProperty(value = "指派范围(人id)多人之间用','隔开" ,required = true)
private String appointPerson; private String appointPerson;
@ApiModelProperty(value = "指派范围(部门id)多人之间用','隔开" ,required = true)
private String appointDepart;
//指派人id集合 //指派人id集合
private List<String> appointPersonList; private Set<String> appointPersonList;
private String userId; private String userId;
......
...@@ -7,6 +7,7 @@ import org.rcisoft.business.blesson.entity.BLessonPerson; ...@@ -7,6 +7,7 @@ import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.entity.SysUser;
import java.util.List; import java.util.List;
...@@ -264,4 +265,13 @@ public interface BLessonService{ ...@@ -264,4 +265,13 @@ public interface BLessonService{
*/ */
BLesson findOneMyTeachTrain(CurUser curUser,String lessonId); BLesson findOneMyTeachTrain(CurUser curUser,String lessonId);
/**
* 单一查询我参加培训的信息
* @param curUser
* @param lessonId
* @return
*/
List<SysUser> findAppointPerson(CurUser curUser, String lessonId);
} }
...@@ -31,6 +31,7 @@ import org.rcisoft.core.util.IdGen; ...@@ -31,6 +31,7 @@ import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.user.bean.CurUser; import org.rcisoft.sys.user.bean.CurUser;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.entity.SysUser;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -229,10 +230,20 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -229,10 +230,20 @@ 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();
//取出文件集合 BeanUtils.copyProperties(addLessonDTO, model);
//取出trainFileList
List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList(); List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList();
//取出文件集合创建BMaterial集合
// List<BMaterial> bMaterialList = new ArrayList<>();
// if (trainFileList!=null && trainFileList.size()>0){
// BMaterial bMaterial = new BMaterial();
// }
BeanUtils.copyProperties(addLessonDTO, model);
int line = 0; int line = 0;
if (model.getBusinessId() == null) { if (model.getBusinessId() == null) {
...@@ -316,7 +327,9 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -316,7 +327,9 @@ public class BLessonServiceImpl implements BLessonService {
//删除原有文件 //删除原有文件
bTrainFileRepository.deleteByLessonId(model.getBusinessId()); bTrainFileRepository.deleteByLessonId(model.getBusinessId());
//获取b_material中已有的URL //获取b_material中已有的URL
List<String> urls = bMaterialRepository.materialHaveUrl(trainFileList); if (trainFileList != null && trainFileList.size()>0){
List<String> urls = bMaterialRepository.materialHaveUrl(trainFileList);
}
//移除已有URL //移除已有URL
// urls.forEach(url->{ // urls.forEach(url->{
// //
...@@ -539,32 +552,55 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -539,32 +552,55 @@ public class BLessonServiceImpl implements BLessonService {
@Override @Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false) @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) { public PersistModel appointLessonToPerson(AppointLessonDTO appointLessonDTO) {
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson())) { //获取部门中人员
List<String> inDepartPerson = new ArrayList<>();
List<GetAllRspDTO> departPersons = cotactApiRequestClient.getUserByDeptIds(appointLessonDTO.getCorpId(),appointLessonDTO.getAppointDepart());
departPersons.forEach(departPerson->{
inDepartPerson.add(departPerson.getId());
});
//-------------
if (StringUtils.isEmpty(appointLessonDTO.getAppointPerson()) && StringUtils.isEmpty(appointLessonDTO.getAppointDepart())) {
throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE); throw new ServiceException(ResultServiceEnums.INVALID_PARAMETER_VALUE);
} }
//按课程查询指派表是否为空 //按课程查询指派表是否为空
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO); List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(appointLessonDTO.getLessonId());
//将指派人截取放入List中 //将指派人截取放入List中
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
List<String> userIdList = asList(StringUtils.split(appointLessonDTO.getAppointPerson(), ",")); List<String> userIdList = asList(StringUtils.split(appointLessonDTO.getAppointPerson(), ","));
userIds.addAll(userIdList); Set<String> userIdSet = new HashSet<>();
//将部门和人员id放入set中去重
if (userIdList != null && userIdList.size()>0){
userIdSet.addAll(userIdList);
}
if (inDepartPerson != null && inDepartPerson.size()>0){
userIdSet.addAll(inDepartPerson);
}
//去重后放入List
userIds.addAll(new ArrayList<>(userIdSet));
BAppoint bAppoint; BAppoint bAppoint;
//拼接人员和部门中人员
String userAllString = StringUtils.join(userIdSet , ",");
if (bAppoints == null || bAppoints.size() == 0) { if (bAppoints == null || bAppoints.size() == 0) {
//插入指派表 //插入指派表
bAppoint = new BAppoint(); bAppoint = new BAppoint();
bAppoint.setLessonId(appointLessonDTO.getLessonId()); bAppoint.setLessonId(appointLessonDTO.getLessonId());
bAppoint.setAppointerId(appointLessonDTO.getUserId()); bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson()); //将部门人员放入
bAppoint.setDesignatedId(userAllString);
UserUtil.setCurrentPersistOperation(bAppoint); UserUtil.setCurrentPersistOperation(bAppoint);
bAppointRepository.insertAppoint(bAppoint); bAppointRepository.insertAppoint(bAppoint);
} else { } else {
bAppoint = bAppoints.get(0); bAppoint = bAppoints.get(0);
bAppoint.setAppointerId(appointLessonDTO.getUserId()); bAppoint.setAppointerId(appointLessonDTO.getUserId());
bAppoint.setDesignatedId(appointLessonDTO.getAppointPerson()); //将部门人员放入
bAppoint.setDesignatedId(userAllString);
UserUtil.setCurrentMergeOperation(bAppoint); UserUtil.setCurrentMergeOperation(bAppoint);
bAppointRepository.updateByPrimaryKeySelective(bAppoint); bAppointRepository.updateByPrimaryKeySelective(bAppoint);
//删除指派未开始 // //删除指派未开始
bLessonPersonRepository.deleteNotStartByLessonId(appointLessonDTO); // bLessonPersonRepository.deleteNotStartByLessonId(appointLessonDTO);
//指派已开始更新为不指派 //指派已开始更新为不指派
BLessonPerson bLessonPerson = new BLessonPerson(); BLessonPerson bLessonPerson = new BLessonPerson();
bLessonPerson.setIsAppoint("0"); bLessonPerson.setIsAppoint("0");
...@@ -574,7 +610,7 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -574,7 +610,7 @@ public class BLessonServiceImpl implements BLessonService {
bLessonPersonRepository.cancelAppointByPersons(bLessonPerson); bLessonPersonRepository.cancelAppointByPersons(bLessonPerson);
} }
//插入b_lesson_person表 //插入b_lesson_person表
appointLessonDTO.setAppointPersonList(userIds); appointLessonDTO.setAppointPersonList(userIdSet);
//查询已学该课程的学习business_id //查询已学该课程的学习business_id
List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO); List<BLessonPerson> inLessonPersons = bLessonPersonRepository.selectPersonIdByLessonId(appointLessonDTO);
if (inLessonPersons != null && inLessonPersons.size() > 0) { if (inLessonPersons != null && inLessonPersons.size() > 0) {
...@@ -908,6 +944,17 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -908,6 +944,17 @@ public class BLessonServiceImpl implements BLessonService {
return bLesson; return bLesson;
} }
@Override
public List<SysUser> findAppointPerson(CurUser curUser, String lessonId) {
List<BAppoint> bAppoints = bAppointRepository.selectByLessonId(lessonId);
if (bAppoints == null || bAppoints.size()<1){
return new ArrayList<>();
}
BAppoint bAppoint = bAppoints.get(0);
List<String> ids = asList(org.apache.commons.lang.StringUtils.split(bAppoint.getDesignatedId(), ","));
return sysUserMapper.selectByIds(ids);
}
//遍历标签放入List中 //遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model) { List<BLessonLabel> addLabel(BLesson model) {
//标签集合 //标签集合
......
...@@ -248,4 +248,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -248,4 +248,15 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
"(#{item.businessId},#{item.pid},#{item.type},#{item.name},#{item.value},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.remarks},#{item.corpId})"+ "(#{item.businessId},#{item.pid},#{item.type},#{item.name},#{item.value},#{item.createBy},#{item.createDate},#{item.updateBy},#{item.updateDate},#{item.delFlag},#{item.flag},#{item.remarks},#{item.corpId})"+
"</foreach> </script>") "</foreach> </script>")
int initDictionary(List<BDictionary> list); int initDictionary(List<BDictionary> list);
@Select("<script>SELECT * FROM s_user " +
"WHERE 1=1 " +
" and del_flag = 0 " +
" and flag = 1 " +
" and business_id in "+
"<foreach item='item' index='index' collection='ids' open='(' separator=',' close=')'> #{item} </foreach> " +
"</script>")
@ResultMap(value = "BaseResultMap")
List<SysUser> selectByIds(@Param("ids") List<String> ids);
} }
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