| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.utils.AuthUtils; |
| | | import org.springblade.common.utils.RoleUtil; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | |
| | | } |
| | | article.setPropertyFlag(1); |
| | | } |
| | | if (userRole.contains("jdgly")) { |
| | | if (userRole.contains("jdgly") || userRole.contains("sqgly")) { |
| | | IDistrictService districtService = SpringUtils.getBean(IDistrictService.class); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId(), null); |
| | | List<DistrictEntity> list = districtService.list(Wrappers.<DistrictEntity>lambdaQuery().in(DistrictEntity::getCommunityCode, regionChildCodesList)); |
| | | if (list.size() > 0) { |
| | | article.setDistrictIdList(list.stream().map(item -> item.getId()).collect(Collectors.toList())); |
| | |
| | | */ |
| | | @Override |
| | | public IPage<ArticleVO> selectArticlePageByApp(IPage<ArticleVO> page, ArticleVO article) { |
| | | // 查询用户小区的id |
| | | String districId = baseMapper.getDistrictId(article.getHouseCode()); |
| | | article.setDistrictId(districId); |
| | | |
| | | // 判断是否管理员 |
| | | if (AuthUtils.isAdministratorOrAdmin(SpringUtils.getRequestParam("roleName"))) { |
| | | IDistrictService districtService = SpringUtils.getBean(IDistrictService.class); |
| | | String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | List<DistrictEntity> list = districtService.list(Wrappers.<DistrictEntity>lambdaQuery() |
| | | .like(DistrictEntity::getCommunityCode, communityCode)); |
| | | if (list.size() > 0) { |
| | | article.setDistrictIdList(list.stream().map(item -> item.getId()).collect(Collectors.toList())); |
| | | } |
| | | } else { |
| | | // 查询用户小区的id |
| | | String districId = baseMapper.getDistrictId(article.getHouseCode()); |
| | | List<String> objects = new ArrayList<>(); |
| | | objects.add(districId); |
| | | article.setDistrictIdList(objects); |
| | | } |
| | | IHouseholdService householdService = SpringUtils.getBean(IHouseholdService.class); |
| | | HouseholdEntity householdEntity = householdService.getOne(Wrappers.<HouseholdEntity>lambdaQuery() |
| | | .eq(HouseholdEntity::getHouseCode, article.getHouseCode()) |
| | | .eq(HouseholdEntity::getAssociatedUserId,AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted,0) |
| | | .eq(HouseholdEntity::getAssociatedUserId, AuthUtil.getUserId()) |
| | | .eq(HouseholdEntity::getIsDeleted, 0) |
| | | .last("limit 1")); |
| | | if (householdEntity != null) { |
| | | article.setHouseholdId(householdEntity.getId()); |
| | |
| | | |
| | | /** |
| | | * 文章信息更新 |
| | | * |
| | | * @param objectUpdateWrapper |
| | | * @param id |
| | | * @param houseCode |
| | |
| | | @Override |
| | | public boolean updateArticle(UpdateWrapper<Article> objectUpdateWrapper, Long id, String houseCode) { |
| | | boolean update = update(null, objectUpdateWrapper); |
| | | if (update){ |
| | | if (update) { |
| | | // 查询对应的文章 |
| | | Article article = getById(id); |
| | | // 只有反诈的有浏览积分 |
| | | if (article.getType()==6) { |
| | | if (article.getType() == 6) { |
| | | // 添加浏览记录信息 |
| | | ArticleIntegralEntity integralEntity = new ArticleIntegralEntity(); |
| | | integralEntity.setScore(article.getScore()); |
| | |
| | | // 返回 |
| | | return update; |
| | | } |
| | | |
| | | /** |
| | | * 查询所有文章数据 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Article> getAllList(int i, int size) { |
| | | return baseMapper.getAllList(i, size); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有文章数据总数 |
| | | * |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int getAllListTotal() { |
| | | return baseMapper.getAllListTotal(); |
| | | } |
| | | } |