Commit 8aceea52 authored by luzhuang's avatar luzhuang

feat: 查询newCount

parent 5356397e
...@@ -808,5 +808,18 @@ public class BLessonController extends PaginationController<BLesson> { ...@@ -808,5 +808,18 @@ public class BLessonController extends PaginationController<BLesson> {
gridModel); gridModel);
} }
/**
* @param
* @return
*/
@ApiOperation(value = "647 返回首页模块角标数量", notes = "返回首页模块角标数量", response = BLesson.class)
@GetMapping(value = "/queryNewCount")
public Result queryNewCount(CurUser curUser, BindingResult bindingResult) {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bLessonService.queryNewCount(curUser));
}
} }
package org.rcisoft.business.blesson.dto;
import lombok.Data;
@Data
public class NewCountDTO {
public int recommend;
public int collect;
public int learn;
public int interest;
public int push;
}
...@@ -315,4 +315,6 @@ public interface BLessonService{ ...@@ -315,4 +315,6 @@ public interface BLessonService{
List<BLesson> queryHomeBLessons(CurUser curUser); List<BLesson> queryHomeBLessons(CurUser curUser);
NewCountDTO queryNewCount(CurUser curUser);
} }
...@@ -1935,4 +1935,62 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -1935,4 +1935,62 @@ public class BLessonServiceImpl implements BLessonService {
log.info("-----------addNew---------首页查询课程或培训的总个数----------"+result.size()+"--------------------"); log.info("-----------addNew---------首页查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result); return addNew(result);
} }
@Override
public NewCountDTO queryNewCount(CurUser curUser) {
FindListLessonDTO model = new FindListLessonDTO();
model.setCorpId(curUser.getCorpId());
model.setUserId(curUser.getUserId());
List<String> ids = Arrays.asList(new String[]{model.getUserId()});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(model.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(""));
}
model.setDeparts(departs);
int recommendCount= 0;
int learnCount = 0;
int collectCount = 0;
int interestCount = 0;
int pushCount = 0;
List<BLesson> recommend = addNew(bLessonRepository.queryRecommendListByPagination(model));
List<BLesson> learn = addNew(bLessonRepository.queryLearnListByPagination(model));
List<BLesson> collect = addNew(bLessonRepository.queryCollectListByPagination(model));
List<BLesson> interest = addNew(bLessonRepository.queryInterestedListByPagination(model));
List<BLesson> push = addNew(this.queryPush(model));
for(BLesson bLesson : recommend){
if("1".equals(bLesson.getIsNew())){
recommendCount++;
}
}
for(BLesson bLesson : learn){
if("1".equals(bLesson.getIsNew()))
learnCount++;
}
for(BLesson bLesson : collect){
if("1".equals(bLesson.getIsNew()))
collectCount++;
}
for(BLesson bLesson : interest){
if("1".equals(bLesson.getIsNew()))
interestCount++;
}
for(BLesson bLesson : push){
if("1".equals(bLesson.getIsNew()))
pushCount++;
}
NewCountDTO dto = new NewCountDTO();
dto.setRecommend(recommendCount);
dto.setCollect(collectCount);
dto.setLearn(learnCount);
dto.setInterest(interestCount);
dto.setPush(pushCount);
return dto;
}
} }
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