Commit 13fc7fdf authored by luzhuang's avatar luzhuang

feat: 新接口 添加log输出

parent c601b390
......@@ -3,6 +3,7 @@ package org.rcisoft.business.bcourse.service.impl;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.rcisoft.business.bcourse.dao.BCourseRepository;
import org.rcisoft.business.bcourse.dto.AllCourseDTO;
......@@ -25,6 +26,7 @@ import java.util.*;
import java.util.stream.Collectors;
@Service
@Slf4j
public class BCourseServiceImpl implements BCourseService {
@Autowired
......@@ -263,6 +265,7 @@ public class BCourseServiceImpl implements BCourseService {
* @return
*/
public List<QueryCourseResDTO> addNewFolder(List<QueryCourseResDTO> resDTOS){
log.info("-----------addNewFolder----------当前接口查询的一级分类个数---------"+resDTOS.size()+"--------------------");
List<BLesson> lessons = bLessonService.queryHomeBLessons();//查询首页显示的所有 课程(isNew 已赋值)
for (QueryCourseResDTO dto : resDTOS){ //一级分类
int num = 0; //属于当前分类的课程数
......@@ -299,13 +302,16 @@ public class BCourseServiceImpl implements BCourseService {
continue;
}
}
log.info("-----------addNewFolder----------三级分类--"+dto2+"--的new个数-------"+num2+"--------------------");
dto2.setNewCount(num2);//将三级分类包含的 new课数量添加到 分类中
secNum1+=num2; //将三级分类中的 new课数量添加到 二级分类中
}
log.info("-----------addNewFolder---------二级分类--"+dto1+"--的new个数-------"+secNum1+"--------------------");
dto1.setNewCount(secNum1);
secNum += secNum1;//将二级分类下三级分类中的数量添加到 二级分类中
}
log.info("-----------addNewFolder----------一级分类--"+dto+"--的new个数-------"+secNum+"--------------------");
dto.setNewCount(secNum);
}
......
package org.rcisoft.business.blabel.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.blabel.dao.BLabelRepository;
import org.rcisoft.business.blabel.dto.QueryLabelResDTO;
......@@ -22,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Slf4j
public class BLabelServiceImpl implements BLabelService {
@Autowired
......@@ -39,6 +41,7 @@ public class BLabelServiceImpl implements BLabelService {
List<BLabel> labels = bLabelRepository.queryBlabels(lName, corpId);
List<BLesson> lessons = bLessonService.queryHomeBLessons();
log.info("-----------addNewLable----------首页所有课程总个数--"+lessons.size()+"--------------------");
for (BLabel label : labels) {
int num = 0;
......@@ -46,14 +49,12 @@ public class BLabelServiceImpl implements BLabelService {
List<QueryLabelResDTO> labelResDTOS = lesson.getLabelList();
if (labelResDTOS.size() > 0) {
for (QueryLabelResDTO dto : labelResDTOS) {
if (dto.getBusinessId() == label.getBusinessId()) {
if (dto.getBusinessId() == label.getBusinessId())
num++;
} else {
continue;
}
}
}
}
log.info("-----------addNewLable----------当前标签--"+label+"--的new课程个数--"+num+"--------------------");
label.setNewCount(num);
}
......
......@@ -1792,12 +1792,17 @@ 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();
log.info("-----------addNew---------当前登录人信息curUser----------"+curUser+"--------------------");
BMessage bMessage = new BMessage();
bMessage.setName(MessageEnum.NEWNOTICE.getName());
//查询当前企业的 新消息时间 的配置
List<BMessage> messageList = bMessageRepository.queryByNameAndCorp(MessageEnum.NEWNOTICE.getName(),corpId);
log.info("-----------addNew---------新消息配置messageList---------"+messageList+"--------------");
if (messageList.size() <= 0)
return result;
BMessage newNotice = messageList.get(0);
......@@ -1808,24 +1813,21 @@ public class BLessonServiceImpl implements BLessonService {
//step 1 查询look表中是否有对应任何课程的点击记录
int flag = bLessonRepository.getCountByUserAndLesson(userId, b.getBusinessId(), "0");
//step 2 存在则返回,不存在则判断时间 满足条件 setIsNew()
if (flag > 0) {
continue;
} else {
if (flag <= 0) {
//flag <= 0 说明此用户未点击过该课程
Calendar c1 = Calendar.getInstance();
c1.setTime(b.getCreateDate());
if ("1".equals(newNotice.getValueType())) {
c1.add(Calendar.HOUR, time);
} else if ("2".equals(newNotice.getValueType())) {
c1.add(Calendar.DAY_OF_MONTH, time);
} else if ("3".equals(newNotice.getValueType())) {
c1.add(Calendar.WEEK_OF_MONTH, time);
} else if ("4".equals(newNotice.getValueType())) {
c1.add(Calendar.MONTH, time);
}
if (c1.after(c)) {
switch (newNotice.getValueType()){
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));
if (c1.after(c))
b.setIsNew("1");
}
log.info("-----------addNew---------当前课程已设置new-------"+b);
}
}
return result;
......
......@@ -32,7 +32,7 @@
<logger name="java.sql.PreparedStatement" level="DEBUG"/>
<!-- 日志输出级别 -->
<root level="DEBUG">
<root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
......
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