Commit d1a98357 authored by luzhuang's avatar luzhuang

feat: 智学2.0 新增new显示字段

parent c830505b
......@@ -74,7 +74,7 @@ public class BCourseController extends PaginationController<BCourse> {
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bCourseRepository.queryFirstLevel(curUser.getCorpId(),num));
bCourseServiceImpl.queryFirstLevel(curUser.getCorpId(),num));
}
@ApiOperation(value = "304 逻辑删除", notes = "根据ID删除一条记录")
......
......@@ -29,4 +29,7 @@ public class QueryCourseResDTO {
@ApiModelProperty(value = "等级")
private String courseLevel;
@ApiModelProperty(value = "new的数量")
private int newCount;
}
......@@ -30,5 +30,7 @@ public interface BCourseService {
*/
List<AllCourseDTO> findAllCourse(String corpId);
List<QueryCourseResDTO> queryFirstLevel(String corpId,int num);
}
......@@ -9,6 +9,8 @@ import org.rcisoft.business.bcourse.dto.AllCourseDTO;
import org.rcisoft.business.bcourse.dto.QueryCourseResDTO;
import org.rcisoft.business.bcourse.entity.BCourse;
import org.rcisoft.business.bcourse.service.BCourseService;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.impl.BLessonServiceImpl;
import org.rcisoft.business.blesson.util.Recursion;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
......@@ -28,6 +30,9 @@ public class BCourseServiceImpl implements BCourseService {
@Autowired
private BCourseRepository bCourseRepository;
@Autowired
private BLessonServiceImpl bLessonService;
@Override
public List<Map<String,Object>> queryBCourse(BCourse model) {
......@@ -245,4 +250,66 @@ public class BCourseServiceImpl implements BCourseService {
return bCourseRepository.findAllCourse(corpId);
}
@Override
public List<QueryCourseResDTO> queryFirstLevel(String corpId,int num) {
List<QueryCourseResDTO> dtoList = bCourseRepository.queryFirstLevel(corpId,num);
return dtoList;
}
/**
* 生产分类中 new 的个数
* @param resDTOS 一级分类带子分类集合
* @return
*/
public List<QueryCourseResDTO> addNewFolder(List<QueryCourseResDTO> resDTOS){
List<BLesson> lessons = bLessonService.queryHomeBLessons();//查询首页显示的所有 课程(isNew 已赋值)
for (QueryCourseResDTO dto : resDTOS){
int num = 0; //属于当前分类的课程数
int secNum = 0 ;//下层分类中的课程数
for (BLesson b : lessons){
if("1".equals(b.getIsNew())){
num++;
}else{
continue;
}
}
if (dto.getChildren() == null)
continue;
for (QueryCourseResDTO dto1 : dto.getChildren()){
int num1 = 0;
int secNum1 = 0 ;//下层分类中的课程数
for (BLesson b : lessons){
if(b.getCourseId().equals(dto1.getKey()) && "1".equals(b.getIsNew())){
num1++;
}else{
continue;
}
}
secNum += num1;
if (dto.getChildren() == null)
continue;
for (QueryCourseResDTO dto2 : dto.getChildren()){
int num2 = 0;
for (BLesson b : lessons){
if(b.getCourseId().equals(dto2.getKey()) && "1".equals(b.getIsNew())){
num2++;
}else{
continue;
}
}
secNum1+=num2;
dto2.setNewCount(num2);
}
secNum += secNum1;
}
}
return resDTOS;
}
}
......@@ -772,5 +772,25 @@ public class BLessonController extends PaginationController<BLesson> {
}
@ApiOperation(value = "644 点击课程", notes = "取消new显示")
@PostMapping(value = "/look")
public Result look(CurUser curUser, String lessonId) {
return Result.builder(bLessonService.look(curUser,lessonId),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
lessonId);
}
@ApiOperation(value = "645555 点击课程", notes = "取消new显示")
@PostMapping(value = "/test")
public Result test (CurUser curUser) {
return Result.builder(bLessonService.test(),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
"lessonId");
}
}
......@@ -1219,5 +1219,25 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
*/
@Select("select business_id from s_user WHERE account_id in (${accountIds}) and corp_id = #{corpId}")
List<String> queryUserIdByAccountId(@Param("accountIds")String accountIds,@Param("corpId") String corpId);
/**
* 查询用户点击课程的数量
* @param userId
* @param lessonId
* @param type
* @return
*/
@Select("select count(0) from b_user_lesson_look where user_id = #{userId} and lesson_id = #{lessonId} and type = #{type}")
int getCountByUserAndLesson(@Param("userId") String userId, @Param("lessonId") String lessonId, @Param("type") String type);
/**
* 插入 数据
* @param userId
* @param lessonId
* @param type
* @return
*/
@Insert("insert into b_user_lesson_look VALUES (UUID(),#{userId},#{lessonId},#{type})")
int insertLook(@Param("userId") String userId,@Param("lessonId") String lessonId,@Param("type") String type);
}
......@@ -283,6 +283,10 @@ public class BLesson extends IdEntity<BLesson> {
@ApiModelProperty(value = "学员id集合")
List<String> personList;
@Transient
@ApiModelProperty(value = "是不是new(0/1)")
private String isNew;
public void initModel(){
// this.setDefaultUrl(global.getDEFAULT_COURSE_LOCATION());
......
......@@ -301,4 +301,8 @@ public interface BLessonService{
List<ExamDto> userManageExamByPagination(PageUtil pageUtil, ExamQueryDto dto);
PersistModel look(CurUser curUser,String lessonId);
PersistModel test();
}
package org.rcisoft.business.blesson.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.map.HashedMap;
......@@ -164,7 +165,7 @@ public class BLessonServiceImpl implements BLessonService {
// bLesson.setLecturerPic(mtUserInfoRspDTO.getAvatar());
// }
// });
setDepAndPic(mtUserInfoRspDTOList,bLesson);
setDepAndPic(mtUserInfoRspDTOList, bLesson);
}
if (LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType())) {
......@@ -241,7 +242,7 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return bLessonRepository.queryPersonMore(curUser, departs);
return addNew(bLessonRepository.queryPersonMore(curUser, departs));
}
@Override
......@@ -259,7 +260,7 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(null));
departs.removeAll(Collections.singleton(""));
}
return bLessonRepository.queryRecommend(curUser, departs);
return addNew(bLessonRepository.queryRecommend(curUser, departs));
}
@Override
......@@ -279,7 +280,7 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return bLessonRepository.queryConcern(curUser, departs);
return addNew(bLessonRepository.queryConcern(curUser, departs));
}
@Override
......@@ -299,13 +300,13 @@ public class BLessonServiceImpl implements BLessonService {
departs.removeAll(Collections.singleton(""));
}
//------------------------------
return bLessonRepository.queryInterested(curUser, departs);
return addNew(bLessonRepository.queryInterested(curUser, departs));
}
@Override
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public PersistModel persist(AddLessonDTO addLessonDTO,CurUser curUser) {
public PersistModel persist(AddLessonDTO addLessonDTO, CurUser curUser) {
if (LessonTypeEnum.TRAIN.getCode().equals(addLessonDTO.getLessonType())) {
try {
......@@ -365,7 +366,7 @@ public class BLessonServiceImpl implements BLessonService {
// List<String> list = bLessonRepository.queryUserIdByAccountId(model.getViewRangePerson(),curUser.getCorpId());
// viewRangePerson = list.toArray(new String[list.size()]) ;
// }
String[] viewRangePerson = getViewRangePerson(addLessonDTO,model.getViewRangePerson(),curUser.getCorpId());
String[] viewRangePerson = getViewRangePerson(addLessonDTO, model.getViewRangePerson(), curUser.getCorpId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
}
if (StringUtils.isNotEmpty(model.getViewRangeDepart())) {
......@@ -390,22 +391,22 @@ public class BLessonServiceImpl implements BLessonService {
//若培训结束时间改变 修改学生签到状态
//查询课程信息
BLesson bLesson = bLessonRepository.selectByPrimaryKey(model.getBusinessId());
if (bLesson != null && LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType()) && model.getTrainOverDate() != null ){
if (bLesson != null && LessonTypeEnum.TRAIN.getCode().equals(bLesson.getLessonType()) && model.getTrainOverDate() != null) {
Date now = new Date();
BLessonPerson updateTrainIsSign = new BLessonPerson();
UserUtil.setCurrentMergeOperation(updateTrainIsSign);
updateTrainIsSign.setLessonId(model.getBusinessId());
String pastTrainIsSign;
if (now.before(model.getTrainOverDate())){
if (now.before(model.getTrainOverDate())) {
//将所有缺勤设置为待参加
updateTrainIsSign.setTrainIsSign("0");
pastTrainIsSign = "1";
}else {
} else {
//将所有待参加学生置为缺勤
updateTrainIsSign.setTrainIsSign("1");
pastTrainIsSign = "0";
}
bLessonPersonRepository.updateTrainIsSignList(updateTrainIsSign,pastTrainIsSign);
bLessonPersonRepository.updateTrainIsSignList(updateTrainIsSign, pastTrainIsSign);
}
if (StringUtils.isNotEmpty(model.getViewRangePerson()) || StringUtils.isNotEmpty(model.getViewRangeDepart())) {
......@@ -438,7 +439,7 @@ public class BLessonServiceImpl implements BLessonService {
// List<String> list = bLessonRepository.queryUserIdByAccountId(model.getViewRangePerson(),curUser.getCorpId());
// viewRangePerson = list.toArray(new String[list.size()]) ;
// }
String[] viewRangePerson = getViewRangePerson(addLessonDTO,model.getViewRangePerson(),curUser.getCorpId());
String[] viewRangePerson = getViewRangePerson(addLessonDTO, model.getViewRangePerson(), curUser.getCorpId());
bViewrangeSons = addBViewrangeSon(bViewrangeSons, viewRangePerson, "0", bViewrange.getBusinessId());
}
if (StringUtils.isNotEmpty(model.getViewRangeDepart())) {
......@@ -472,10 +473,10 @@ public class BLessonServiceImpl implements BLessonService {
//转换json
if (StringUtils.isNotEmpty(addLessonDTO.getTrainFileJson())) {
List<BTrainFile> bTrainFiles = JSONObject.parseArray(addLessonDTO.getTrainFileJson(), BTrainFile.class);
for(BTrainFile b : bTrainFiles){
if("true".equals(replaceHttp) && b.getVideoUrl() != null){
for (BTrainFile b : bTrainFiles) {
if ("true".equals(replaceHttp) && b.getVideoUrl() != null) {
LogUtil.fileChangeLog("----------替换oss链接https----------");
b.setVideoUrl(b.getVideoUrl().replace("http:","https:"));
b.setVideoUrl(b.getVideoUrl().replace("http:", "https:"));
}
}
addLessonDTO.setTrainFileList(bTrainFiles);
......@@ -583,7 +584,7 @@ public class BLessonServiceImpl implements BLessonService {
//将一级分类放入分类集合中
courseIds.add(firstPageQueryDTO.getCourseLevelOne());
}
return bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds);
return addNew(bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds));
}
@Override
......@@ -625,7 +626,7 @@ public class BLessonServiceImpl implements BLessonService {
UserUtil.setCurrentMergeOperation(bLesson);
int line = bLessonRepository.releaseLesson(bLesson);
//查询该讲师发布课程获得积分数
CurUser lecCurUser = new CurUser(bLesson.getCorpId(),bLesson.getLecturerId(),null,null);
CurUser lecCurUser = new CurUser(bLesson.getCorpId(), bLesson.getLecturerId(), null, null);
List<BReleaseValue> bReleaseValueList = bReleaseValueRepository.selectReleaseValueByPersonId(lecCurUser);
//仅第一次发布获得积分
if (ReleaseStateEnum.UNRELEASED.getCode().equals(bLesson.getReleaseState()) && bReleaseValueList != null && bReleaseValueList.size() > 0 && bReleaseValueList.get(0) != null) {
......@@ -1053,15 +1054,15 @@ public class BLessonServiceImpl implements BLessonService {
model.setCourseIds(courseIds);
}
}
if (StringUtils.isNotEmpty(model.getFreeValue()) || StringUtils.isNotEmpty(model.getCostValue()) || StringUtils.isNotEmpty(model.getReturnValue())){
if (StringUtils.isNotEmpty(model.getFreeValue()) || StringUtils.isNotEmpty(model.getCostValue()) || StringUtils.isNotEmpty(model.getReturnValue())) {
String valueScreen = "and (1 = 0 ";
if (StringUtils.isNotEmpty(model.getFreeValue())){
if (StringUtils.isNotEmpty(model.getFreeValue())) {
valueScreen += " or (value_consume = 0 or value_consume is null or value_consume = '' ) ";
}
if (StringUtils.isNotEmpty(model.getCostValue())){
if (StringUtils.isNotEmpty(model.getCostValue())) {
valueScreen += " or (value_consume != 0 and value_consume is not null and value_consume != '' ) ";
}
if (StringUtils.isNotEmpty(model.getReturnValue())){
if (StringUtils.isNotEmpty(model.getReturnValue())) {
valueScreen += " or (value_gain != 0 and value_gain is not null and value_gain != '') ";
}
valueScreen += ")";
......@@ -1069,7 +1070,6 @@ public class BLessonServiceImpl implements BLessonService {
}
List<BLesson> ListAllLesson = null;
//根据不同传值 查询列表页内容 searchType:查询类型 0 全部 1 推荐 2在学 3收藏"
switch (model.getSearchType()) {
......@@ -1161,8 +1161,8 @@ public class BLessonServiceImpl implements BLessonService {
//LZ 判断 曾经是否学完过 奖励积分
if ("2".equals(setTrainIsSignDTO.getTrainIsSign()) && !("2".equals(bLessonPerson.getTrainIsSign())) && !("1".equals(bLessonPerson.getEverFinished())) && bLesson != null) {
//查询课程信息
if(StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0){
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(), "参加!@#培训", bLesson.getValueGain(), "0",bLesson.getBusinessId());
if (StringUtils.isNotEmpty(bLesson.getValueGain()) && Long.parseLong(bLesson.getValueGain()) > 0) {
BPersonValue bPersonValue = new BPersonValue(bLessonPerson.getPersonId(), "参加!@#培训", bLesson.getValueGain(), "0", bLesson.getBusinessId());
addValueEvent(bLessonPerson.getPersonId(), bPersonValue, null);
}
bLessonPerson.setEverFinished("1");
......@@ -1249,7 +1249,7 @@ public class BLessonServiceImpl implements BLessonService {
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
if (bLesson.getValueConsume() != null && !"0".equals(bLesson.getValueConsume()) && !curUser.getUserId().equals(bLesson.getLecturerId())) {
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(), "报名!@#培训", bLesson.getValueConsume(), "1",bLesson.getBusinessId());
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(), "报名!@#培训", bLesson.getValueConsume(), "1", bLesson.getBusinessId());
addValueEvent(curUser.getUserId(), bPersonValue, userInfo.getLockNum());
}
bLessonRepository.personNumberReCount(bLesson.getBusinessId(), "1");
......@@ -1280,7 +1280,7 @@ public class BLessonServiceImpl implements BLessonService {
//扣除对应积分 添加用户积分详情 更新用户积分
//增加用户积分详情
if (bLesson.getValueConsume() != null && !"0".equals(bLesson.getValueConsume()) && !curUser.getUserId().equals(bLesson.getLecturerId())) {
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(), "报名!@#培训", bLesson.getValueConsume(), "1",bLesson.getBusinessId());
BPersonValue bPersonValue = new BPersonValue(curUser.getUserId(), "报名!@#培训", bLesson.getValueConsume(), "1", bLesson.getBusinessId());
addValueEvent(curUser.getUserId(), bPersonValue, userInfo.getLockNum());
}
bLessonRepository.personNumberReCount(bLesson.getBusinessId(), "1");
......@@ -1299,7 +1299,7 @@ public class BLessonServiceImpl implements BLessonService {
if (one.size() > 0) {
return new PersistModel(1);
}
BCollect bCollect = new BCollect(IdGen.uuid(),curUser.getUserId(),lessonId,new Date());
BCollect bCollect = new BCollect(IdGen.uuid(), curUser.getUserId(), lessonId, new Date());
int line = bCollectRepository.insert(bCollect);
//更新课程表收藏个数
bLessonRepository.collectNumberReCount(lessonId);
......@@ -1350,7 +1350,7 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
setDepAndPic(mtUserInfoRspDTOList,bLesson);
setDepAndPic(mtUserInfoRspDTOList, bLesson);
}
//查询报名人数是否小于规定人数
......@@ -1394,11 +1394,10 @@ public class BLessonServiceImpl implements BLessonService {
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = cotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0) {
setDepAndPic(mtUserInfoRspDTOList,bLesson);
setDepAndPic(mtUserInfoRspDTOList, bLesson);
}
int trainApplyCount = bLessonRepository.trainApplyCount(bLesson.getBusinessId());
if (StringUtils.isNotEmpty(bLesson.getMaxApplyPerson()) && !"0".equals(bLesson.getMaxApplyPerson()) && trainApplyCount >= Integer.parseInt(bLesson.getMaxApplyPerson())) {
bLesson.setApplyIsFull("1");
......@@ -1441,7 +1440,7 @@ public class BLessonServiceImpl implements BLessonService {
public List<BLesson> queryCollectByPagination(PageUtil pageUtil, String lessonType, CurUser curUser) {
List<BLesson> bLessonList = bLessonRepository.selectMyCollect(lessonType, curUser);
Date now = new Date();
if (LessonTypeEnum.TRAIN.getCode().equals(lessonType)){
if (LessonTypeEnum.TRAIN.getCode().equals(lessonType)) {
bLessonList.forEach(bLesson -> {
setDateState(bLesson);
if (bLesson.getTrainStartDate() == null || bLesson.getTrainOverDate() == null || bLesson.getTrainSignTime() == null) {
......@@ -1562,6 +1561,33 @@ public class BLessonServiceImpl implements BLessonService {
return list;
}
@Override
public PersistModel look(CurUser curUser, String lessonId) {
int flag = bLessonRepository.getCountByUserAndLesson(curUser.getUserId(), lessonId, "0");
int line = 0;
if (flag > 0) {
line = 1;
} else {
line = bLessonRepository.insertLook(curUser.getUserId(), lessonId, "0");
}
return new PersistModel(line);
}
@Override
public PersistModel test() {
List<BLesson> re = new ArrayList<>();
BLesson b = new BLesson();
b.setBusinessId("123456");
b.setCreateDate(new Date());
BLesson b2 = new BLesson();
b2.setBusinessId("789456");
b2.setCreateDate(new Date());
re.add(b);
re.add(b2);
addNew(re);
return new PersistModel(1);
}
//遍历标签放入List中
List<BLessonLabel> addLabel(BLesson model) {
//标签集合
......@@ -1704,8 +1730,8 @@ public class BLessonServiceImpl implements BLessonService {
bPersonValueRepository.add(bPersonValue);
long nowValue = bPersonValueRepository.findUserValue(personId);
if(nowValue < 0){
throw new ServiceException(ResultServiceEnums.VALUE_HAVE_ERROR);
if (nowValue < 0) {
throw new ServiceException(ResultServiceEnums.VALUE_HAVE_ERROR);
}
//积分变化后 s_user表中value字段重新统计
......@@ -1735,28 +1761,94 @@ public class BLessonServiceImpl implements BLessonService {
return bLesson;
}
void setDepAndPic(List<MTUserInfoRspDTO> mtUserInfoRspDTOList, BLesson bLesson){
void setDepAndPic(List<MTUserInfoRspDTO> mtUserInfoRspDTOList, BLesson bLesson) {
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getDepts() != null && mtUserInfoRspDTO.getDepts().size() > 0 && mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId())) {
//设置部门名
bLesson.setLecturerDeptName(mtUserInfoRspDTO.getDepts().get(0).getName());
}
if (mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId()) && StringUtils.isNotEmpty(mtUserInfoRspDTO.getAvatar())){
if (mtUserInfoRspDTO.getId().equals(bLesson.getLecturerId()) && StringUtils.isNotEmpty(mtUserInfoRspDTO.getAvatar())) {
bLesson.setLecturerPic(mtUserInfoRspDTO.getAvatar());
}
});
}
String[] getViewRangePerson(AddLessonDTO addLessonDTO,String oldViewRangePerson, String corpId){
String[] getViewRangePerson(AddLessonDTO addLessonDTO, String oldViewRangePerson, String corpId) {
String[] viewRangePerson = null;
if (!("1".equals(addLessonDTO.getIsAccountId()))){
if (!("1".equals(addLessonDTO.getIsAccountId()))) {
viewRangePerson = oldViewRangePerson.split(",");
}else {
} else {
//account转为businessId
List<String> list = bLessonRepository.queryUserIdByAccountId(oldViewRangePerson,corpId);
viewRangePerson = list.toArray(new String[list.size()]) ;
List<String> list = bLessonRepository.queryUserIdByAccountId(oldViewRangePerson, corpId);
viewRangePerson = list.toArray(new String[list.size()]);
}
return viewRangePerson;
}
/**
* 新建的课程培训 添加new字段
*
* @param result
* @return
*/
public List<BLesson> addNew(List<BLesson> result) {
CurUser curUser = UserUtil.getCurUser();
String userId = curUser.getUserId();
String corpId = curUser.getCorpId();
BMessage bMessage = new BMessage();
bMessage.setName(MessageEnum.NEWNOTICE.getName());
List<BMessage> messageList = bMessageRepository.queryByNameAndCorp(MessageEnum.NEWNOTICE.getName(),corpId);
if (messageList.size() <= 0)
return result;
BMessage newNotice = messageList.get(0);
//获取当前时间
Calendar c = Calendar.getInstance();
int time = Integer.parseInt(newNotice.getTimeValue());
for (BLesson b : result) {
//step 1 查询look表中是否有对应任何课程的点击记录
int flag = bLessonRepository.getCountByUserAndLesson(userId, b.getBusinessId(), "0");
//step 2 存在则返回,不存在则判断时间 满足条件 setIsNew()
if (flag > 0) {
continue;
} else {
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)) {
b.setIsNew("1");
}
}
}
return result;
}
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public List<BLesson> queryHomeBLessons() {
CurUser curUser = UserUtil.getCurUser();
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(""));
}
FirstPageQueryDTO firstPageQueryDTO = new FirstPageQueryDTO();
firstPageQueryDTO.setDeparts(departs);
List<String> courseIds = null;
return addNew(bLessonRepository.queryHomeBLesson(firstPageQueryDTO, courseIds));
}
}
......@@ -31,6 +31,4 @@ public class PersonValueClientDto {
@ApiModelProperty(value = "积分排序 0正序 1倒序")
public String valueSort;
}
......@@ -8,6 +8,7 @@ public enum MessageEnum {
ZPKC("ZPKC","通知被指派了课程"),
ZPPX("ZPPX","通知被指派了培训"),
ZPKS("ZPKS","通知被指派了考试"),
NEWNOTICE("NEWNOTICE","发布新资源后,显示NEW标识的时间"),
;
MessageEnum(String name,String remarks) {
......
......@@ -6,6 +6,7 @@ import com.itextpdf.text.pdf.PdfCopy;
import com.itextpdf.text.pdf.PdfImportedPage;
import com.itextpdf.text.pdf.PdfReader;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.core.result.Ret;
import org.springframework.stereotype.Component;
import java.io.File;
......@@ -23,10 +24,15 @@ import java.util.List;
@Slf4j
public class CutPdfUtil {
public static void main(String[] args) {
try {
List<String> pdfList = toCutPdf("F:\\桌面整理\\文件\\测试资料\\06_API常用类.pdf","06_API常用类.pdf", 20);
} catch (Exception e) {
e.printStackTrace();
// try {
// List<String> pdfList = toCutPdf("F:\\桌面整理\\文件\\测试资料\\06_API常用类.pdf","06_API常用类.pdf", 20);
// } catch (Exception e) {
// e.printStackTrace();
// }
List<Long> haveJurisList = new ArrayList<>();
System.out.println(haveJurisList);
if (haveJurisList == null || haveJurisList.size() < 1){
System.out.println(haveJurisList);
}
}
......
......@@ -353,6 +353,11 @@ public class SysRoleServiceImpl implements SysRoleService {
UserUtil.setCurrentPersistOperation(bMessage);
bMessage.setRemarks(MessageEnum.ZPKS.getRemarks());
bMessageList.add(bMessage);
//数据属于新消息通知 暂时共用message表
bMessage = new BMessage(MessageEnum.NEWNOTICE.getName(),"","",curUser.getCorpId(),7);
UserUtil.setCurrentPersistOperation(bMessage);
bMessage.setRemarks(MessageEnum.NEWNOTICE.getRemarks());
bMessageList.add(bMessage);
return bMessageRepository.insertList(bMessageList);
}
......
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