Commit e53beec4 authored by zhangqingle's avatar zhangqingle

修改接口

parent 42f4e036
...@@ -153,17 +153,22 @@ public class BChapterServiceImpl implements BChapterService { ...@@ -153,17 +153,22 @@ public class BChapterServiceImpl implements BChapterService {
if (bLesson == null){ if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA); throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
} }
//判断课程是否被关闭 // //判断课程是否被关闭
if ("4".equals(bLesson.getReleaseState())){ // if ("4".equals(bLesson.getReleaseState())){
throw new ServiceException(ResultServiceEnums.LESSON_CLOSED); // throw new ServiceException(ResultServiceEnums.LESSON_CLOSED);
} // }
//判断该登录人是否可见该课程 //判断该登录人是否可见该课程
List<String> ids = Arrays.asList(new String[]{curUser.getUserId()}); List<String> ids = Arrays.asList(new String[]{curUser.getUserId()});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO(); MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
int result = bLessonRepository.isInViewRange(curUser,lessonId,departs); int result = bLessonRepository.isInViewRange(curUser,lessonId,departs);
if (result < 1){ if (result < 1){
throw new ServiceException(ResultServiceEnums.NO_ACCESS); throw new ServiceException(ResultServiceEnums.NO_ACCESS);
......
...@@ -624,4 +624,15 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -624,4 +624,15 @@ public class BLessonController extends PaginationController<BLesson> {
bLessonService.getLessonState(lessonId)); bLessonService.getLessonState(lessonId));
} }
@ApiOperation(value = "639 判断可见权限 ", notes = "判断可见权限 ")
@PostMapping(value = "/judgeVisibleAuthority")
public Result judgeVisibleAuthority(CurUser curUser, @Valid String lessonId, BindingResult bindingResult) {
PersistModel data = bLessonService.judgeVisibleAuthority(curUser, lessonId);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
lessonId);
}
} }
...@@ -624,15 +624,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -624,15 +624,15 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
* @param lessonId * @param lessonId
* @return * @return
*/ */
@Update("<script>update b_lesson set person_number = " + @Update("<script>update b_lesson a set a.person_number = (" +
"(select count(1) from b_lesson_person blp " + "select b.bc from (select count(1) bc from b_lesson_person blp " +
" left join b_lesson bl on blp.lesson_id = bl.business_id " + " left join b_lesson bl on blp.lesson_id = bl.business_id " +
" where 1=1 " + " where 1=1 " +
" and blp.del_flag != 1 and blp.flag = 1 " + " and blp.del_flag != 1 and blp.flag = 1 " +
" and bl.lesson_type = #{type} " + " and bl.lesson_type = #{type}" +
" <if test=\"type!=null and type != '' and type == '0'\">and blp.is_finish != 0 </if> " + " <if test=\"type!=null and type != '' and type == '0'\">and blp.is_finish != 0 </if>" +
" and blp.lesson_id = #{lessonId}) " + " and blp.lesson_id = #{lessonId}) as b )" +
" where business_id = #{lessonId} </script> " ) " where business_id = #{lessonId} </script>" )
int personNumberReCount(@Param("lessonId") String lessonId, @Param("type") String lessonType); int personNumberReCount(@Param("lessonId") String lessonId, @Param("type") String lessonType);
/** /**
...@@ -994,7 +994,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -994,7 +994,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
List<BRecommend> queryRecommendByLessonId(@Param("corpId") String corpId, @Param("lessonId")String lessonId); List<BRecommend> queryRecommendByLessonId(@Param("corpId") String corpId, @Param("lessonId")String lessonId);
@Select("<script>select bl.*, blp.business_id lessonPersonId," + @Select("<script>select distinct bl.*, " +
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate ," + " blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate ," +
"CONCAT( " + "CONCAT( " +
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " +
...@@ -1018,7 +1018,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1018,7 +1018,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@ResultMap(value = "TrainBaseResultMap") @ResultMap(value = "TrainBaseResultMap")
BLesson findOneMyTrain(@Param("curUser") CurUser curUser, @Param("lessonId") String lessonId); BLesson findOneMyTrain(@Param("curUser") CurUser curUser, @Param("lessonId") String lessonId);
@Select("<script>select bl.*," + @Select("<script>select distinct bl.*," +
"CONCAT( " + "CONCAT( " +
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " +
"IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " +
......
...@@ -21,13 +21,13 @@ public class FindListLessonDTO { ...@@ -21,13 +21,13 @@ public class FindListLessonDTO {
private String labelId; private String labelId;
@ApiModelProperty(value = "发布时间排序(1升序 0降序)",required = true) @ApiModelProperty(value = "发布时间排序(1升序 0降序)",required = true)
@NotNull
private String releaseDateSort; private String releaseDateSort;
@ApiModelProperty(value = "课程类型 0 课程 1 培训") @ApiModelProperty(value = "课程类型 0 课程 1 培训")
private String lessonType; private String lessonType;
@ApiModelProperty(value = "查询类型 0 全部 1 推荐 2在学 3收藏 4兴趣",required = true) @ApiModelProperty(value = "查询类型 0 全部 1 推荐 2在学 3收藏 4兴趣",required = true)
@NotNull
private String searchType; private String searchType;
private List<String> courseIds; private List<String> courseIds;
......
...@@ -284,4 +284,7 @@ public interface BLessonService{ ...@@ -284,4 +284,7 @@ public interface BLessonService{
*/ */
List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType , CurUser curUser); List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType , CurUser curUser);
PersistModel judgeVisibleAuthority(CurUser curUser, String lessonId);
} }
...@@ -109,6 +109,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -109,6 +109,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
mtUserGetsReqDTO.setIds(uids); mtUserGetsReqDTO.setIds(uids);
//遍历获取部门名 //遍历获取部门名
List<MTUserInfoRspDTO> departs = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> departs = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (departs != null || departs.size() > 0){
studentTrackingRspDTOs.forEach(studentTrackingRspDTO -> { studentTrackingRspDTOs.forEach(studentTrackingRspDTO -> {
departs.forEach(depart->{ departs.forEach(depart->{
if (studentTrackingRspDTO.getPersonId().equals(depart.getId())){ if (studentTrackingRspDTO.getPersonId().equals(depart.getId())){
...@@ -116,6 +117,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService { ...@@ -116,6 +117,7 @@ public class BLessonPersonServiceImpl implements BLessonPersonService {
} }
}); });
}); });
}
return studentTrackingRspDTOs; return studentTrackingRspDTOs;
} }
......
...@@ -164,7 +164,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -164,7 +164,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------ //------------------------------
return bLessonRepository.queryPersonMore(curUser, departs); return bLessonRepository.queryPersonMore(curUser, departs);
} }
...@@ -178,7 +183,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -178,7 +183,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
return bLessonRepository.queryRecommend(curUser, departs); return bLessonRepository.queryRecommend(curUser, departs);
} }
...@@ -192,7 +202,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -192,7 +202,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------ //------------------------------
return bLessonRepository.queryConcern(curUser, departs); return bLessonRepository.queryConcern(curUser, departs);
} }
...@@ -207,7 +222,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -207,7 +222,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(curUser.getCorpId()); mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------ //------------------------------
return bLessonRepository.queryInterested(curUser, departs); return bLessonRepository.queryInterested(curUser, departs);
} }
...@@ -433,7 +453,12 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -433,7 +453,12 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(firstPageQueryDTO.getCorpId()); mtUserGetsReqDTO.setCorpId(firstPageQueryDTO.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
firstPageQueryDTO.setDeparts(departs); firstPageQueryDTO.setDeparts(departs);
List<String> courseIds = null; List<String> courseIds = null;
if (allCourse != null) { if (allCourse != null) {
...@@ -791,12 +816,17 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -791,12 +816,17 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setCorpId(model.getCorpId()); mtUserGetsReqDTO.setCorpId(model.getCorpId());
mtUserGetsReqDTO.setIds(ids); mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO); List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = QueryDepart.queryDepart(mtUserInfoRspDTOList); List<String> departs = new ArrayList<>();
departs.forEach(depart -> { if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
if (StringUtils.isEmpty(depart)) { departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.remove(depart); departs.removeAll(Collections.singleton(null));
} departs.removeAll(Collections.singleton(""));
}); }
// departs.forEach(depart -> {
// if (StringUtils.isEmpty(depart)) {
// departs.remove(depart);
// }
// });
//---------------------------- //----------------------------
model.setDeparts(departs); model.setDeparts(departs);
List<String> courseIds; List<String> courseIds;
...@@ -1097,6 +1127,31 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1097,6 +1127,31 @@ public class BLessonServiceImpl implements BLessonService {
return bLessonRepository.selectMyCollect(lessonType, curUser); return bLessonRepository.selectMyCollect(lessonType, curUser);
} }
@Override
public PersistModel judgeVisibleAuthority(CurUser curUser, String lessonId) {
BLesson bLesson = bLessonRepository.selectInfoById(lessonId);
if (bLesson == null){
throw new ServiceException(ResultServiceEnums.LESSON_NOT_EXISTA);
}
List<String> ids = Arrays.asList(new String[]{curUser.getUserId()});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
int result = bLessonRepository.isInViewRange(curUser,lessonId,departs);
if (result < 1){
throw new ServiceException(ResultServiceEnums.NO_ACCESS);
}
return new PersistModel(1);
}
//遍历标签放入List中 //遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model) { List<BLessonLabel> addLabel(BLesson model) {
//标签集合 //标签集合
......
...@@ -15,6 +15,6 @@ public class GetSubUserIdsByDeptIdsReqDTO { ...@@ -15,6 +15,6 @@ public class GetSubUserIdsByDeptIdsReqDTO {
@ApiModelProperty(value = "部门id集合(可选)", position = 2) @ApiModelProperty(value = "部门id集合(可选)", position = 2)
@Order(3) @Order(3)
private List<Integer> deptIds; private List<Long> deptIds;
} }
...@@ -543,9 +543,10 @@ public class MTCotactApiRequestClient { ...@@ -543,9 +543,10 @@ public class MTCotactApiRequestClient {
} }
GetSubUserIdsByDeptIdsReqDTO getSubUserIdsByDeptIdsReqDTO = new GetSubUserIdsByDeptIdsReqDTO(); GetSubUserIdsByDeptIdsReqDTO getSubUserIdsByDeptIdsReqDTO = new GetSubUserIdsByDeptIdsReqDTO();
getSubUserIdsByDeptIdsReqDTO.setCorpId(Integer.parseInt(corpId)); getSubUserIdsByDeptIdsReqDTO.setCorpId(Integer.parseInt(corpId));
List<Integer> deptIdList = new ArrayList<>(); List<Long> deptIdList = new ArrayList<>();
for (String deptId : deptIdSet) { for (String deptId : deptIdSet) {
deptIdList.add(Integer.parseInt(deptId)); Long a = Long.valueOf(deptId);
deptIdList.add(a);
} }
getSubUserIdsByDeptIdsReqDTO.setDeptIds(deptIdList); getSubUserIdsByDeptIdsReqDTO.setDeptIds(deptIdList);
return contactFeignClient.getSubUserIdsByDeptIds(getSubUserIdsByDeptIdsReqDTO,zxClientType,zxAccountId).getData(); return contactFeignClient.getSubUserIdsByDeptIds(getSubUserIdsByDeptIdsReqDTO,zxClientType,zxAccountId).getData();
......
...@@ -83,9 +83,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter { ...@@ -83,9 +83,9 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
e.getMessage()); e.getMessage());
log.error(message); log.error(message);
if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误” if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误”
result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); ServiceException se = (ServiceException) e;
result.setCode(ResultCode.FAIL).setMessage(e.getMessage()).setData(Result.builder(se.getCode(),message,null));
}else { }else {
result.setCode(ResultCode.ERROR).setMessage(message); result.setCode(ResultCode.ERROR).setMessage(message);
} }
} else { } else {
......
package org.rcisoft.core.exception; package org.rcisoft.core.exception;
import lombok.Data;
import org.rcisoft.core.result.ResultExceptionEnum; import org.rcisoft.core.result.ResultExceptionEnum;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
/** /**
* Created by lcy on 17/11/24. * Created by lcy on 17/11/24.
*/ */
@Data
public class ServiceException extends RuntimeException { public class ServiceException extends RuntimeException {
private static final long serialVersionUID = 3729706443523052156L; private static final long serialVersionUID = 3729706443523052156L;
......
...@@ -31,6 +31,21 @@ public class Result { ...@@ -31,6 +31,21 @@ public class Result {
} }
/**
*
* @param code
* @param message
* @param data
* @return
*/
public static Result builder(Integer code,String message,Object data){
Result result = new Result();
result.setCode(code);
result.setMessage(message);
result.setData(data);
return result;
}
public void setErrorMessage(String message, Object data) { public void setErrorMessage(String message, Object data) {
this.code = ResultCode.FAIL.getCode(); this.code = ResultCode.FAIL.getCode();
......
...@@ -113,3 +113,6 @@ eureka: ...@@ -113,3 +113,6 @@ eureka:
fetch-registry: true fetch-registry: true
service-url: service-url:
defaultZone: http://zx:zgiot@192.168.5.48:7001/eureka defaultZone: http://zx:zgiot@192.168.5.48:7001/eureka
ribbon:
ReadTimeout: 10000
ConnectTimeout: 10000
\ 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