|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.cms.service.impl;
|
|
|
|
|
|
+import com.ym.mec.cms.dal.dao.SysConfigDao;
|
|
|
import com.ym.mec.cms.dal.dao.SysNewsInformationDao;
|
|
|
import com.ym.mec.cms.dal.dao.SysNewsTypeDao;
|
|
|
import com.ym.mec.cms.dal.entity.SysNewsInformation;
|
|
@@ -17,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
@@ -24,12 +26,14 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType> implements SysNewsTypeService {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysNewsTypeDao sysNewsTypeDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysNewsInformationDao informationDao;
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private WebFeignService webFeignService;
|
|
|
+ @Resource
|
|
|
+ private SysConfigDao sysConfigDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, SysNewsType> getDAO() {
|
|
@@ -61,12 +65,19 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
|
|
|
public List<SysNewsType> listWithTree(Integer id, String memo,Integer userId,String organIds) {
|
|
|
SysNewsType newsType = sysNewsTypeDao.get(id);
|
|
|
+ //获取需要排除的用户编号
|
|
|
+ String excludeUserIds = sysConfigDao.findConfigValue("excludeUserIds");
|
|
|
+ String excludeFunctionIds = null;
|
|
|
+ if(StringUtils.isNotEmpty(excludeUserIds) && excludeUserIds.contains(userId.toString())){
|
|
|
+ //获取需要排除的功能点编号
|
|
|
+ excludeFunctionIds = sysConfigDao.findConfigValue("excludeFunctionIds");
|
|
|
+ }
|
|
|
List<SysNewsType> all = sysNewsTypeDao.findAll(null);
|
|
|
String startTime = DateUtil.format(DateUtil.getFirstDayOfMonth(DateUtil.addMonths(new Date(), -1)),DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
- all.forEach(e -> {
|
|
|
- List<SysNewsInformation> list = informationDao.queryBySubType(e.getId(), memo,organIds);
|
|
|
+ for (SysNewsType e : all) {
|
|
|
+ List<SysNewsInformation> list = informationDao.queryBySubType(e.getId(), memo,organIds,excludeFunctionIds);
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
- list = informationDao.queryBySubType(e.getId(), null,organIds);
|
|
|
+ list = informationDao.queryBySubType(e.getId(), null,organIds,excludeFunctionIds);
|
|
|
}
|
|
|
Iterator<SysNewsInformation> iterator = list.iterator();
|
|
|
SysNewsInformation sni = null;
|
|
@@ -86,7 +97,7 @@ public class SysNewsTypeServiceImpl extends BaseServiceImpl<Integer, SysNewsType
|
|
|
}
|
|
|
}
|
|
|
e.setInformationList(list);
|
|
|
- });
|
|
|
+ }
|
|
|
List<SysNewsType> treeMenus = all.stream()
|
|
|
.filter((e) -> e.getParentId().equals(newsType.getParentId()))
|
|
|
.map((menu) -> menu.setChildren(getChildren(menu, all)))
|