Commit 2f273c7d authored by zhangqingle's avatar zhangqingle

修改接口

parent 91cf2b29
......@@ -137,6 +137,9 @@ public class BChapterServiceImpl implements BChapterService {
map.put("chapterList", queryChapterListResDTOS);
map.put("totalProgress", i == 0 ? "0%" : df.format((float) percent / i) + "%");
BLesson bLesson = bLessonRepository.selectByPrimaryKey(lessonId);
if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
}
//查询该课程是否收藏
int collectCount = bCollectRepository.selectCountbyLessonAndUser(curUser,bLesson.getBusinessId());
if (collectCount>0){
......
......@@ -33,6 +33,7 @@ public interface BTrainFileRepository extends BaseMapper<BTrainFile> {
+ "and del_flag != 1 "
+ "and flag = 1 "
+ "and lesson_id = #{lessonId} "
+ " order by sort asc "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BTrainFile> queryByLessonId(@Param("lessonId") String lessonId);
......
......@@ -34,6 +34,8 @@ public class BTrainFile extends IdEntity<BTrainFile> {
private String fileSize;
@ApiModelProperty(value = "文件类型 2PPT 3PDF 4word 5txt 6zip 7png 8xlsx")
private String type;
@ApiModelProperty(value = "用于排序 不用传值")
private String sort;
}
......
package org.rcisoft.business.blesson.dao;
import org.rcisoft.business.blesson.entity.BHot;
import org.rcisoft.core.base.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* Created with on 2019-10-25 22:38:38.
*/
@Repository
public interface BHotRepository extends BaseMapper<BHot> {
}
......@@ -628,6 +628,16 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
" and lesson_id = #{lessonId})" +
" </script>" )
int collectNumberReCount(String lessonId);
/**
* 重新统计热度
* @param lessonId
* @return
*/
@Update("<script>update b_lesson set hot_number = " +
"(select count(1) from b_hot where 1=1 " +
" and lesson_id = #{lessonId})" +
" </script>" )
int hotNumberReCount(String lessonId);
/**
* 列表页分页查询全部课程
......
package org.rcisoft.business.blesson.entity;
import lombok.*;
import javax.persistence.*;
/**
* Created with on 2019-10-25 22:38:37.
*/
@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "b_hot")
public class BHot {
private String businessId;
private String personId;
private String lessonId;
}
......@@ -9,10 +9,7 @@ import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.dao.BLessonPersonRepository;
import org.rcisoft.business.blesson.entity.BLessonPerson;
import org.rcisoft.business.blesson.service.BLessonPersonService;
import org.rcisoft.common.util.feignDto.MTGetUserByDeptIdsRspDTO;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.feignDto.UserGetPageListByDeptCascadeRspDTO;
import org.rcisoft.common.util.feignDto.*;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
......@@ -79,15 +76,15 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
@Override
public List<StudentTrackingRspDTO> studentTrackingByPagination(PageUtil pageUtil, StudentTrackingDTO studentTrackingDTO) {
List<Long> deptIds = new ArrayList<>();
// List<Long> deptIds = new ArrayList<>();
if(StringUtils.isNotEmpty(studentTrackingDTO.getDepartId())){
// deptIds.add(Long.parseLong(studentTrackingDTO.getDepartId()));
// List<MTGetUserByDeptIdsRspDTO> datas = mtCotactApiRequestClient.userGetUserByDeptIds(studentTrackingDTO.getCorpId(),deptIds);
List<UserGetPageListByDeptCascadeRspDTO> datas = mtCotactApiRequestClient.allUserListByDept(studentTrackingDTO.getCorpId(),studentTrackingDTO.getDepartId());
List<UserGetStudentTrackingRspDTO> datas = mtCotactApiRequestClient.allUserListByDeptAtStuTrack(studentTrackingDTO.getCorpId(),studentTrackingDTO.getDepartId());
if (datas != null && datas.size()>0){
List<String> userIdsInDepart = new ArrayList<>();
datas.forEach(data->{
studentTrackingDTO.getUserIdsInDepart().add(data.getId());
userIdsInDepart.add(data.getId());
});
studentTrackingDTO.setUserIdsInDepart(userIdsInDepart);
}
}
List<StudentTrackingRspDTO> studentTrackingRspDTOs = bLessonPersonRepository.studentTrackingByPagination(studentTrackingDTO);
......
......@@ -80,6 +80,9 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
private BTrainFileRepository bTrainFileRepository;
@Autowired
private BHotRepository bHotRepository;
@Autowired
private BMaterialRepository bMaterialRepository;
......@@ -116,6 +119,13 @@ public class BLessonServiceImpl implements BLessonService {
}
bLesson.setViewRangeDepartList(selectDepartByLessonIds);
}
//客户端 手机端 每次点击插入热度表 并重新统计课程热度
if ("1".equals(bLesson.getIsCollect())){
bHotRepository.insertSelective(new BHot(IdGen.uuid(),curUser.getUserId(),bLesson.getBusinessId()));
bLessonRepository.hotNumberReCount(bLesson.getBusinessId());
}
return bLesson;
}
......@@ -334,10 +344,14 @@ public class BLessonServiceImpl implements BLessonService {
List<BTrainFile> trainFileList = addLessonDTO.getTrainFileList();
if (trainFileList != null && trainFileList.size() > 0) {
List<BMaterial> bMaterialList = new ArrayList<>();
int sortNum = 0;
for (BTrainFile bTrainFile : trainFileList) {
bTrainFile.setLessonId(model.getBusinessId());
UserUtil.setCurrentPersistOperation(bTrainFile);
//设置sort 用于返回为上传时顺序
bTrainFile.setSort(String.valueOf(sortNum));
sortNum++;
//设置资料表值
BMaterial bMaterial = new BMaterial();
UserUtil.setCurrentPersistOperation(bMaterial);
bMaterial.setLessonName(model.getLessonName());
......@@ -374,6 +388,9 @@ public class BLessonServiceImpl implements BLessonService {
}
//更新
//获取
}
return new PersistModel(line, model);
}
......@@ -849,7 +866,7 @@ public class BLessonServiceImpl implements BLessonService {
bCollect.setLessonId(lessonId);
bCollect.setPersonId(curUser.getUserId());
int line = bCollectRepository.insertSelective(bCollect);
//重新同级课程收藏数
//重新统计课程收藏数
bLessonRepository.collectNumberReCount(lessonId);
return new PersistModel(line);
}
......
......@@ -173,6 +173,24 @@ public interface ContactFeignClient {
@RequestParam("zxClientType") String zxClientType,
@RequestParam("zxAccountId") Long zxAccountId);
/**
* 通过部门id获取部门下所有子成员(学员跟踪)
* @param corpId
* @param deptId
* @param pageNum
* @param pageSize
* @param zxClientType
* @param zxAccountId
* @return
*/
@RequestMapping(value = "/user/pagelist_by_dept_cascade",method = RequestMethod.GET)
Ret<DeptAllUserPageRspDTO<UserGetStudentTrackingRspDTO>> allUserListByDeptStuTrack(@RequestParam("corpId") Long corpId,
@RequestParam("deptId") String deptId,
@RequestParam("pageNum") Integer pageNum,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("zxClientType") String zxClientType,
@RequestParam("zxAccountId") Long zxAccountId);
/**
* 获取多个部门下用户
* @param zxClientType
......
package org.rcisoft.common.util.feignDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.core.annotation.Order;
import java.util.List;
/**
* <p>
* 企业部门单个查询返回值
* </p>
*
* @author yuechen
* @since 2018-08-17
*/
@Getter
@Setter
@ApiModel("企业部门单个查询返回值")
public class DeptGetStudentTrackingDTO {
@ApiModelProperty(value = "企业部门id", position = 0)
@Order(0)
private String id;
@ApiModelProperty(value = "企业id", position = 1)
@Order(1)
private String corpId;
@ApiModelProperty(value = "部门企业内唯一标识, 外部系统用", position = 2)
@Order(2)
private String outerId;
@ApiModelProperty(value = "名称", position = 3)
@Order(3)
private String name;
@ApiModelProperty(value = "父部门id", position = 4)
@Order(4)
private String pid;
@ApiModelProperty(value = "所有父部门id, 逗号分隔, id长度17,200最多11级", position = 5)
@Order(5)
private String pids;
@ApiModelProperty(value = "是否创建im聊天组(0-否, 1-是)", position = 6)
@Order(6)
private Integer isCreateImgroup;
@ApiModelProperty(value = "同级部门顺序", position = 7)
@Order(7)
private Integer sort;
@ApiModelProperty(value = "是否是事业部(0-否, 1-是)", position = 8)
@Order(8)
private Integer isBiz;
@ApiModelProperty(value = "全路径", position = 9)
@Order(9)
private List<DeptGetStudentTrackingDTO> path;
private String managers;
@ApiModelProperty(value = "部门人数", position = 11)
@Order(11)
private int userCnt;
@ApiModelProperty(value = "创建人账号id", position = 30)
@Order(30)
private String creator;
@ApiModelProperty(value = "创建时间", position = 31)
@Order(32)
private Long createAt;
@ApiModelProperty(value = "更新人账号id", position = 34)
@Order(34)
private String updator;
@ApiModelProperty(value = "更新时间", position = 35)
@Order(35)
private Long updateAt;
@ApiModelProperty(value = "职位", position = 36)
@Order(36)
private String position;
@ApiModelProperty(value = "是否有子部门", position = 36)
@Order(37)
private String flag;
private String group;
private String owner;
private String groupMembers;
}
package org.rcisoft.common.util.feignDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.core.annotation.Order;
import java.util.List;
@Getter
@Setter
@ApiModel("通过部门查询企业用户分页列表返回值, 包括子部门用户")
public class UserGetStudentTrackingRspDTO {
@ApiModelProperty(value = "企业用户id", position = 0)
@Order(0)
private String id;
@ApiModelProperty(value = "企业id", position = 1)
@Order(1)
private String corpId;
@ApiModelProperty(value = "用户企业内唯一标识, 外部系统用", position = 2)
@Order(2)
private String outerId;
@ApiModelProperty(value = "账号id", position = 3)
@Order(3)
private String accountId;
@ApiModelProperty(value = "姓名", position = 4)
@Order(4)
private String name;
@ApiModelProperty(value = "手机号", position = 5)
@Order(5)
private String mobile;
@ApiModelProperty(value = "电话", position = 6)
@Order(6)
private String tel;
@ApiModelProperty(value = "企业邮箱", position = 7)
@Order(7)
private String email;
@ApiModelProperty(value = "状态(0-未激活, 1-正常, 2-锁定, 3-离职)", position = 8)
@Order(8)
private Integer status;
@ApiModelProperty(value = "工号", position = 9)
@Order(9)
private String jobNumber;
@ApiModelProperty(value = "办公地点", position = 10)
@Order(10)
private String workPlace;
@ApiModelProperty(value = "入职时间", position = 11)
@Order(11)
private Long hiredDate;
@ApiModelProperty(value = "离职时间", position = 12)
@Order(12)
private Long leaveDate;
@ApiModelProperty(value = "是否隐藏手机号(0-否,1-是)", position = 14)
@Order(14)
private Integer isHideMobile;
@ApiModelProperty(value = "备注", position = 15)
@Order(15)
private String remark;
@ApiModelProperty(value = "im账号", position = 16)
@Order(16)
private String imAccount;
@ApiModelProperty(value = "所属部门", position = 17)
@Order(17)
private List<DeptGetStudentTrackingDTO> depts;
@ApiModelProperty(value = "创建人账号id", position = 30)
@Order(30)
private Long creator;
@ApiModelProperty(value = "创建时间", position = 31)
@Order(32)
private String createAt;
@ApiModelProperty(value = "更新人账号id", position = 34)
@Order(34)
private String updator;
@ApiModelProperty(value = "更新时间", position = 35)
@Order(35)
private Long updateAt;
}
......@@ -468,6 +468,17 @@ public class MTCotactApiRequestClient {
deptId,1,10000,zxClientType,zxAccountId).getData().getList();
}
/**
* 获取部门下所有子部门内人员(学员追踪)
* @param corpId
* @param deptId
* @return
*/
public List<UserGetStudentTrackingRspDTO> allUserListByDeptAtStuTrack(String corpId,String deptId){
return contactFeignClient.allUserListByDeptStuTrack(Long.parseLong(corpId),
deptId,1,10000,zxClientType,zxAccountId).getData().getList();
}
/**
* 根据多个部门id获取部门内人员
* @param corpId
......
......@@ -347,6 +347,20 @@ public class SysUserServiceImpl implements SysUserService {
public MyInfoDTO queryMyInfo(CurUser curUser) {
MyInfoDTO myInfoDTOCount = sysUserMapper.queryMyLessonCount(curUser);
MyInfoDTO myInfoDTO = sysUserMapper.queryMyInfo(curUser);
//获取头像等信息
List<String> ids = new ArrayList<>();
ids.add(curUser.getUserId());
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getId().equals(curUser.getUserId())){
//设置部门名
myInfoDTO.setName(mtUserInfoRspDTO.getName());
myInfoDTO.setHeadPic(mtUserInfoRspDTO.getAvatar());
}
});
myInfoDTO.setLessonCount(myInfoDTOCount.getLessonCount());
myInfoDTO.setTrainCount(myInfoDTOCount.getTrainCount());
myInfoDTO.setNotFinishedExam(myInfoDTOCount.getNotFinishedExam());
......
......@@ -16,6 +16,7 @@
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="sort" jdbcType="VARCHAR" property="sort"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
......
<?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.bhot.dao.BHotRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.blesson.entity.BHot">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="person_id" jdbcType="VARCHAR" property="personId"/>
<result column="lesson_id" jdbcType="VARCHAR" property="lessonId"/>
</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