Commit f01cc1ec authored by luzhuang's avatar luzhuang

feat: 添加日志

parent 13fc7fdf
......@@ -785,10 +785,10 @@ public class BLessonController extends PaginationController<BLesson> {
@ApiOperation(value = "645555 点击课程", notes = "取消new显示")
@PostMapping(value = "/test")
public Result test () {
return Result.builder(bLessonService.test(),
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
"lessonId");
bLessonService.test());
}
......
......@@ -303,6 +303,6 @@ public interface BLessonService{
PersistModel look(CurUser curUser,String lessonId);
PersistModel test();
List<BLesson> test();
}
......@@ -241,8 +241,9 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return addNew(bLessonRepository.queryPersonMore(curUser, departs));
List<BLesson> result = bLessonRepository.queryPersonMore(curUser, departs);
log.info("-----------addNew---------大家都在学查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
@Override
......@@ -260,7 +261,9 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
return addNew(bLessonRepository.queryRecommend(curUser, departs));
List<BLesson> result = bLessonRepository.queryRecommend(curUser, departs);
log.info("-----------addNew---------企业推荐查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
@Override
......@@ -279,8 +282,10 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return addNew(bLessonRepository.queryConcern(curUser, departs));
List<BLesson> result = bLessonRepository.queryConcern(curUser, departs);
log.info("-----------addNew---------最受关注查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
@Override
......@@ -299,8 +304,10 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return addNew(bLessonRepository.queryInterested(curUser, departs));
List<BLesson> result = bLessonRepository.queryInterested(curUser, departs);
log.info("-----------addNew---------可能感兴趣查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
......@@ -584,7 +591,9 @@ public class BLessonServiceImpl implements BLessonService {
//将一级分类放入分类集合中
courseIds.add(firstPageQueryDTO.getCourseLevelOne());
}
return addNew(bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds));
List<BLesson> result = bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds);
log.info("-----------addNew---------首页查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
@Override
......@@ -1574,7 +1583,7 @@ public class BLessonServiceImpl implements BLessonService {
}
@Override
public PersistModel test() {
public List<BLesson> test() {
List<BLesson> re = new ArrayList<>();
BLesson b = new BLesson();
b.setBusinessId("123456");
......@@ -1584,8 +1593,7 @@ public class BLessonServiceImpl implements BLessonService {
b2.setCreateDate(new Date());
re.add(b);
re.add(b2);
addNew(re);
return new PersistModel(1);
return addNew(re);
}
//遍历标签放入List中
......@@ -1792,11 +1800,12 @@ public class BLessonServiceImpl implements BLessonService {
* @return
*/
public List<BLesson> addNew(List<BLesson> result) {
log.info("-----------addNew---------当前查询课程或培训的总个数----------"+result.size()+"--------------------");
//获取当前登录人信息
CurUser curUser = UserUtil.getCurUser();
String userId = curUser.getUserId();
String corpId = curUser.getCorpId();
// String userId = curUser.getUserId();
// String corpId = curUser.getCorpId();
String userId = "123";
String corpId = "6";
log.info("-----------addNew---------当前登录人信息curUser----------"+curUser+"--------------------");
BMessage bMessage = new BMessage();
bMessage.setName(MessageEnum.NEWNOTICE.getName());
......@@ -1812,10 +1821,10 @@ public class BLessonServiceImpl implements BLessonService {
for (BLesson b : result) {
//step 1 查询look表中是否有对应任何课程的点击记录
int flag = bLessonRepository.getCountByUserAndLesson(userId, b.getBusinessId(), "0");
//step 2 存在则返回,不存在则判断时间 满足条件 setIsNew()
//step 2 存在则返回,不存在则判断时间 满足条件 setIsNew() flag <= 0 说明此用户未点击过该课程
if (flag <= 0) {
//flag <= 0 说明此用户未点击过该课程
Calendar c1 = Calendar.getInstance();
//获取课程的添加时间
Calendar c1 = DateUtil.calendar(b.getCreateDate());
c1.setTime(b.getCreateDate());
switch (newNotice.getValueType()){
case "1" : c1.add(Calendar.HOUR, time); break;
......@@ -1823,11 +1832,11 @@ public class BLessonServiceImpl implements BLessonService {
case "3" : c1.add(Calendar.WEEK_OF_MONTH, time); break;
case "4" : c1.add(Calendar.MONTH, time); break;
}
log.info("-----------addNew-------当前时间--"+DateUtil.date(c)+"new标志结束时间"+DateUtil.date(c1));
if (c1.after(c))
log.info("-----------addNew-------当前时间--"+DateUtil.date(c)+"--new标志结束时间--"+DateUtil.date(c1));
if (c1.after(c)){
b.setIsNew("1");
log.info("-----------addNew---------当前课程已设置new-------"+b);
}
}
}
return result;
......@@ -1836,11 +1845,14 @@ public class BLessonServiceImpl implements BLessonService {
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryHomeBLessons() {
CurUser curUser = UserUtil.getCurUser();
log.info("--------获取当前用户人---"+curUser);
List<String> ids = Arrays.asList(new String[]{curUser.getUserId()});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(curUser.getCorpId());
mtUserGetsReqDTO.setIds(ids);
log.info("------------mtUserGetsReqDTO--------"+mtUserGetsReqDTO);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
log.info("------------mtUserInfoRspDTOList--------"+mtUserInfoRspDTOList);
List<String> departs = new ArrayList<>();
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
departs = QueryDepart.queryDepart(mtUserInfoRspDTOList);
......@@ -1850,7 +1862,34 @@ public class BLessonServiceImpl implements BLessonService {
FirstPageQueryDTO firstPageQueryDTO = new FirstPageQueryDTO();
firstPageQueryDTO.setDeparts(departs);
List<String> courseIds = null;
return addNew(bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds));
log.info("----------firstPageQueryDTO---------"+firstPageQueryDTO);
List<BLesson> result = bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds);
log.info("-----------addNew---------首页查询课程或培训的总个数----------"+result.size()+"--------------------");
return addNew(result);
}
public static void main(String[] args) {
//获取当前时间
Calendar c = Calendar.getInstance();
int time = 2;
//step 1 查询look表中是否有对应任何课程的点击记录
int flag =0;
//step 2 存在则返回,不存在则判断时间 满足条件 setIsNew()
if (flag <= 0) {
//flag <= 0 说明此用户未点击过该课程
Calendar c1 = Calendar.getInstance();
switch ("3"){
case "1" : c1.add(Calendar.HOUR, time); break;
case "2" : c1.add(Calendar.DAY_OF_MONTH, time); break;
case "3" : c1.add(Calendar.WEEK_OF_MONTH, time); break;
case "4" : c1.add(Calendar.MONTH, time); break;
}
log.info("-----------addNew-------当前时间--"+DateUtil.date(c)+"--new标志结束时间--"+DateUtil.date(c1));
log.info(c1.after(c)+"");
log.info(DateUtil.date(c1).after(DateUtil.date(c))+"");
}
}
}
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