Compare commits

..

No commits in common. 'master' and '或然科技网站管理平台V1.0' have entirely different histories.

  1. 2
      src/main/java/com/huoran/iasf/IASFApplication.java
  2. 6
      src/main/java/com/huoran/iasf/common/utils/R.java
  3. 5
      src/main/java/com/huoran/iasf/controller/LogoController.java
  4. 49
      src/main/java/com/huoran/iasf/controller/SysColumnController.java
  5. 30
      src/main/java/com/huoran/iasf/controller/SysContentController.java
  6. 38
      src/main/java/com/huoran/iasf/controller/SysFloatingColumnSchemeController.java
  7. 2
      src/main/java/com/huoran/iasf/controller/SysFooterSetupController.java
  8. 1
      src/main/java/com/huoran/iasf/service/SysColumnService.java
  9. 17
      src/main/java/com/huoran/iasf/service/impl/SysColumnServiceImpl.java
  10. 5
      src/main/java/com/huoran/iasf/vo/resp/PageContentRespVO.java

@ -5,7 +5,6 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
@ -14,7 +13,6 @@ import java.net.InetAddress;
@SpringBootApplication @SpringBootApplication
@MapperScan("com.huoran.iasf.mapper") @MapperScan("com.huoran.iasf.mapper")
@Slf4j @Slf4j
@EnableCaching
@ServletComponentScan(basePackages = {"com.huoran.iasf.common.filter"}) //这一句完成了配置,Springboot的”懒理念“真的厉害。 @ServletComponentScan(basePackages = {"com.huoran.iasf.common.filter"}) //这一句完成了配置,Springboot的”懒理念“真的厉害。
public class IASFApplication { public class IASFApplication {

@ -5,8 +5,6 @@ import com.huoran.iasf.common.exception.code.ResponseCodeInterface;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
/** /**
* 返回值R * 返回值R
* *
@ -15,8 +13,8 @@ import java.io.Serializable;
* @date 2022年7月28日 * @date 2022年7月28日
*/ */
@Data @Data
public class R implements Serializable { public class R {
private static final long serialVersionUID = 1L;
/** /**
* 请求响应code0为成功 其他为失败 * 请求响应code0为成功 其他为失败
*/ */

@ -8,8 +8,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -36,8 +34,6 @@ public class LogoController {
* @return R 结果对象包含操作状态信息 * @return R 结果对象包含操作状态信息
*/ */
@PostMapping("/saveOrUpdate") @PostMapping("/saveOrUpdate")
@CacheEvict(value = {"redis_LogoDetails"},
allEntries = true)
@ApiOperation(value = "保存或更新系统logo设置记录", response = Logo.class) @ApiOperation(value = "保存或更新系统logo设置记录", response = Logo.class)
public R saveOrUpdate(@RequestBody @ApiParam(name = "系统logo设置对象", value = "包含系统logo设置详细信息,若id不存在则新建,否则视为更新", required = true) Logo logo) { public R saveOrUpdate(@RequestBody @ApiParam(name = "系统logo设置对象", value = "包含系统logo设置详细信息,若id不存在则新建,否则视为更新", required = true) Logo logo) {
@ -55,7 +51,6 @@ public class LogoController {
@PostMapping("/findById") @PostMapping("/findById")
@ApiOperation(value = "查询详情", response = Logo.class) @ApiOperation(value = "查询详情", response = Logo.class)
@Cacheable(value = "redis_LogoDetails", key = "#siteId")
public R findById(@ApiParam(name = "siteId", value = "主键", required = true) @RequestParam Integer siteId) { public R findById(@ApiParam(name = "siteId", value = "主键", required = true) @RequestParam Integer siteId) {
//根据站点id查询站点信息 //根据站点id查询站点信息
QueryWrapper<Logo> queryWrapper = new QueryWrapper<>(); QueryWrapper<Logo> queryWrapper = new QueryWrapper<>();

@ -1,7 +1,6 @@
package com.huoran.iasf.controller; package com.huoran.iasf.controller;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.huoran.iasf.common.aop.annotation.NoRepeatSubmit; import com.huoran.iasf.common.aop.annotation.NoRepeatSubmit;
@ -19,9 +18,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.RedisConnectionFailureException;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -67,14 +63,12 @@ public class SysColumnController {
@PostMapping("/listWithTree") @PostMapping("/listWithTree")
@ApiOperation(value = "栏目树结构", response = SysColumn.class) @ApiOperation(value = "栏目树结构", response = SysColumn.class)
@Cacheable(value = "redis_listWithTree", key = "#sysColumn.toString()")
public R listWithTree(@RequestBody @Valid PaginationColumnReqVO sysColumn) { public R listWithTree(@RequestBody @Valid PaginationColumnReqVO sysColumn) {
return R.success(service.listWithTree(sysColumn)); return R.success(service.listWithTree(sysColumn));
} }
@PostMapping("/listWithTreeMenuVisible") @PostMapping("/listWithTreeMenuVisible")
@ApiOperation(value = "栏目树结构(前台可见,只展示试单可见的栏目)", response = SysColumn.class) @ApiOperation(value = "栏目树结构(前台可见,只展示试单可见的栏目)", response = SysColumn.class)
@Cacheable(value = "redis_listWithTreeMenuVisible", key = "#sysColumn.toString()")
public R listWithTreeMenuVisible(@RequestBody @Valid PaginationColumnReqVO sysColumn) { public R listWithTreeMenuVisible(@RequestBody @Valid PaginationColumnReqVO sysColumn) {
return R.success(service.listWithTreeMenuVisible(sysColumn)); return R.success(service.listWithTreeMenuVisible(sysColumn));
} }
@ -82,7 +76,6 @@ public class SysColumnController {
@PostMapping("/findById") @PostMapping("/findById")
@ApiOperation(value = "查询详情", response = SysColumn.class) @ApiOperation(value = "查询详情", response = SysColumn.class)
@Cacheable(value = "redis_columnDetails", key = "#id")
public R findById(@RequestParam("id") @ApiParam(value = "主键ID") Integer id) { public R findById(@RequestParam("id") @ApiParam(value = "主键ID") Integer id) {
SysColumn sysColumn = service.getById(id); SysColumn sysColumn = service.getById(id);
if (sysColumn == null) { if (sysColumn == null) {
@ -102,9 +95,6 @@ public class SysColumnController {
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/save") @PostMapping("/save")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "新增", response = SysColumn.class) @ApiOperation(value = "新增", response = SysColumn.class)
public R save(@RequestBody @Valid SysColumn sysColumn) { public R save(@RequestBody @Valid SysColumn sysColumn) {
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>(); QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<SysColumn>();
@ -115,11 +105,8 @@ public class SysColumnController {
return addState ? R.success(sysColumn.getId()) : R.fail("新增失败"); return addState ? R.success(sysColumn.getId()) : R.fail("新增失败");
} }
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "修改", response = SysColumn.class)
@PostMapping("/update") @PostMapping("/update")
@ApiOperation(value = "修改", response = SysColumn.class)
public R update(@RequestBody SysColumn sysColumn) { public R update(@RequestBody SysColumn sysColumn) {
boolean updateState = service.updateById(sysColumn); boolean updateState = service.updateById(sysColumn);
return updateState ? R.success() : R.fail("编辑失败"); return updateState ? R.success() : R.fail("编辑失败");
@ -136,7 +123,8 @@ public class SysColumnController {
@ApiOperation(value = "缓存用户存过的字段") @ApiOperation(value = "缓存用户存过的字段")
public R cacheField(@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId, public R cacheField(@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
@ApiParam(name = "fields", required = true, value = "字段(逗号隔开)") @RequestParam String fields, @ApiParam(name = "fields", required = true, value = "字段(逗号隔开)") @RequestParam String fields,
@ApiParam(name = "siteId", required = true, value = "站点id") @RequestParam Integer siteId) { @ApiParam(name = "siteId", required = true, value = "站点id") @RequestParam Integer siteId
) {
try { try {
String key = "fieldCache_" +"siteId_" +siteId +"userId_"+ userId; String key = "fieldCache_" +"siteId_" +siteId +"userId_"+ userId;
@ -148,6 +136,7 @@ public class SysColumnController {
} }
/** /**
* 根据用户ID和站点ID获取缓存的字段列表 * 根据用户ID和站点ID获取缓存的字段列表
* 该接口通过组合用户ID和站点ID作为键从Redis缓存中获取字段列表如果缓存中不存在相应的数据 * 该接口通过组合用户ID和站点ID作为键从Redis缓存中获取字段列表如果缓存中不存在相应的数据
@ -196,12 +185,7 @@ public class SysColumnController {
@PostMapping("/controlDisplayNavigationMenu") @PostMapping("/controlDisplayNavigationMenu")
@ApiOperation(value = "控制显示导航菜单", response = SysColumn.class) @ApiOperation(value = "控制显示导航菜单", response = SysColumn.class)
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@CachePut(value = "redis_controlDisplayNavigationMenu", key = "#id + ':' + #menuVisible")
public R controlDisplayNavigationMenu(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, @ApiParam(name = "menuVisible", value = "菜单是否可见(默认0可见 1不可见)", required = true) @RequestParam Integer menuVisible) { public R controlDisplayNavigationMenu(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, @ApiParam(name = "menuVisible", value = "菜单是否可见(默认0可见 1不可见)", required = true) @RequestParam Integer menuVisible) {
SysColumn column = new SysColumn(); SysColumn column = new SysColumn();
column.setId(id); column.setId(id);
column.setMenuVisible(menuVisible);//菜单是否可见(默认0可见 1不可见) column.setMenuVisible(menuVisible);//菜单是否可见(默认0可见 1不可见)
@ -211,6 +195,7 @@ public class SysColumnController {
} }
/** /**
* 批量删除栏目及其关联的内容和长页信息 * 批量删除栏目及其关联的内容和长页信息
* 接收一个包含栏目ID的列表遍历这些ID以执行以下操作 * 接收一个包含栏目ID的列表遍历这些ID以执行以下操作
@ -225,9 +210,6 @@ public class SysColumnController {
*/ */
@NoRepeatSubmit @NoRepeatSubmit
@PostMapping("/batchDeletion") @PostMapping("/batchDeletion")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "批量删除栏目", response = SysColumn.class) @ApiOperation(value = "批量删除栏目", response = SysColumn.class)
public R batchDeletion(@ApiParam(name = "ids", value = "栏目ID列表", required = true) @RequestParam List<Integer> ids) { public R batchDeletion(@ApiParam(name = "ids", value = "栏目ID列表", required = true) @RequestParam List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
@ -260,6 +242,7 @@ public class SysColumnController {
} }
@PostMapping("/sameLevelJudgment") @PostMapping("/sameLevelJudgment")
@ApiOperation(value = "同级判重", response = ColumnWeightReqVO.class) @ApiOperation(value = "同级判重", response = ColumnWeightReqVO.class)
public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) { public R sameLevelJudgment(@RequestBody @Valid ColumnWeightReqVO sysColumn) {
@ -276,9 +259,6 @@ public class SysColumnController {
*/ */
@PostMapping("/sortByColumn") @PostMapping("/sortByColumn")
@ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class) @ApiOperation(value = "栏目排序(依据id更改)", response = SysColumn.class)
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
public R sortByColumn(@RequestBody List<SortColumnRespVO> sortColumnRespVOList) { public R sortByColumn(@RequestBody List<SortColumnRespVO> sortColumnRespVOList) {
for (SortColumnRespVO sortInfo : sortColumnRespVOList) { for (SortColumnRespVO sortInfo : sortColumnRespVOList) {
// 获取当前要排序的栏目信息 // 获取当前要排序的栏目信息
@ -286,7 +266,10 @@ public class SysColumnController {
// 构建查询条件,检查同级下是否有名称相同的其他栏目(排除自己) // 构建查询条件,检查同级下是否有名称相同的其他栏目(排除自己)
QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<>(); QueryWrapper<SysColumn> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("column_name", existingColumn.getColumnName()).eq("site_id", existingColumn.getSiteId()).eq("father_id", sortInfo.getFatherId()).ne("id", sortInfo.getId()); // 确保不包括当前正在处理的栏目 queryWrapper.eq("column_name", existingColumn.getColumnName())
.eq("site_id", existingColumn.getSiteId())
.eq("father_id", sortInfo.getFatherId())
.ne("id", sortInfo.getId()); // 确保不包括当前正在处理的栏目
// 执行查询 // 执行查询
List<SysColumn> conflictingColumns = service.list(queryWrapper); List<SysColumn> conflictingColumns = service.list(queryWrapper);
@ -309,8 +292,7 @@ public class SysColumnController {
@ApiOperation("获取一级下的子级栏目") @ApiOperation("获取一级下的子级栏目")
@PostMapping("/getsTheSubColumn") @PostMapping("/getsTheSubColumn")
public R getsTheSubColumn(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, public R getsTheSubColumn(@ApiParam(name = "id", value = "id", required = true) @RequestParam Integer id, @ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) {
@ApiParam(name = "siteId", value = "站点id", required = true) @RequestParam Integer siteId) {
String ids = this.getIds(id); String ids = this.getIds(id);
return service.getsTheSubColumn(id, ids, siteId); return service.getsTheSubColumn(id, ids, siteId);
@ -384,10 +366,7 @@ public class SysColumnController {
@ApiOperation("某一级查全部") @ApiOperation("某一级查全部")
@PostMapping("/oneLevelChecksThemAll") @PostMapping("/oneLevelChecksThemAll")
public R oneLevelChecksThemAll(@ApiParam(name = "id", value = "栏目id", required = true) @RequestParam Integer id, public R oneLevelChecksThemAll(@ApiParam(name = "id", value = "栏目id", required = true) @RequestParam Integer id, @ApiParam(name = "isSort", value = "判断是否为排序接口调用(1为排序接口调用 0我栏目管理列表调用)", required = true) @RequestParam Integer isSort, @ApiParam(name = "ids", value = "主键", required = true) @RequestParam Integer siteId) {
@ApiParam(name = "isSort", value = "判断是否为排序接口调用(1为排序接口调用 0我栏目管理列表调用)", required =
true) @RequestParam Integer isSort, @ApiParam(name = "ids", value = "主键",
required = true) @RequestParam Integer siteId) {
Integer pid = service.oneLevelChecksThemAll(id); Integer pid = service.oneLevelChecksThemAll(id);
String ids = this.getIds(pid); String ids = this.getIds(pid);
@ -404,12 +383,8 @@ public class SysColumnController {
*/ */
@ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)") @ApiOperation("查询栏目下的文章(若选中栏目与子级全部栏目类型一致返回全部文章,反之查询选中栏目下的文章)")
@PostMapping("/queryArticlesByColumnType") @PostMapping("/queryArticlesByColumnType")
@Cacheable(value = "redis_articlesByColumnType", key = "#columnId")
public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) { public R queryArticlesByColumnType(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam Integer columnId) {
String ids = this.getIds(columnId); String ids = this.getIds(columnId);
if (StrUtil.isBlank(ids)) {
return R.fail("栏目类型ID字符串不能为空");
}
return service.queryArticlesByColumnType(ids, columnId); return service.queryArticlesByColumnType(ids, columnId);
} }

@ -23,8 +23,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.RedisConnectionFailureException; import org.springframework.data.redis.RedisConnectionFailureException;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -93,9 +91,6 @@ public class SysContentController {
} }
@PostMapping("/save") @PostMapping("/save")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "新增", response = SysContent.class) @ApiOperation(value = "新增", response = SysContent.class)
public R save(@RequestBody @Valid @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { public R save(@RequestBody @Valid @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) {
@ -115,9 +110,6 @@ public class SysContentController {
@PostMapping("/update") @PostMapping("/update")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "修改", response = SysContent.class) @ApiOperation(value = "修改", response = SysContent.class)
public R update(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) { public R update(@RequestBody @ApiParam(name = "文章管理对象", value = "传入json格式", required = true) SysContent sysContent) {
boolean updateState = service.updateById(sysContent); boolean updateState = service.updateById(sysContent);
@ -126,9 +118,6 @@ public class SysContentController {
@PostMapping("/delete") @PostMapping("/delete")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "删除", response = SysContent.class) @ApiOperation(value = "删除", response = SysContent.class)
public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { public R delete(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>(); UpdateWrapper<SysFilesEntity> queryWrapper = new UpdateWrapper<>();
@ -142,9 +131,6 @@ public class SysContentController {
@PostMapping("/batchDeletion") @PostMapping("/batchDeletion")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "批量删除文章", response = SysContent.class) @ApiOperation(value = "批量删除文章", response = SysContent.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) { public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestParam List<Integer> ids) {
for (Integer id : ids) { for (Integer id : ids) {
@ -166,10 +152,6 @@ public class SysContentController {
@PostMapping("/newlyPublishedArticles") @PostMapping("/newlyPublishedArticles")
@ApiOperation(value = "站点最新发布的文章", response = PageContentReqVO.class) @ApiOperation(value = "站点最新发布的文章", response = PageContentReqVO.class)
@Cacheable(value = "redis_newlyPublishedArticles", key = "#content.toString()")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
public R newlyPublishedArticles(@Valid @RequestBody PageContentReqVO content) { public R newlyPublishedArticles(@Valid @RequestBody PageContentReqVO content) {
return service.newlyPublishedArticles(content); return service.newlyPublishedArticles(content);
} }
@ -201,12 +183,8 @@ public class SysContentController {
@PostMapping("/articleEnableOrDisable") @PostMapping("/articleEnableOrDisable")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "文章启用禁用", response = SysContent.class) @ApiOperation(value = "文章启用禁用", response = SysContent.class)
public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, public R articleEnableOrDisable(@ApiParam(name = "id", value = "文章id", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
@ApiParam(name = "isDisable", value = "是否禁用(0默认,0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<SysContent> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("is_disable", isDisable); updateWrapper.set("is_disable", isDisable);
updateWrapper.eq("id", id); updateWrapper.eq("id", id);
@ -238,9 +216,6 @@ public class SysContentController {
@PostMapping("/articleTopOperation") @PostMapping("/articleTopOperation")
@CacheEvict(value = {"redis_listWithTree", "redis_columnDisplayFloatingBar", "redis_listWithTreeMenuVisible",
"redis_showTheFooterAccordingToTheColumn", "redis_articlesByColumnType", "redis_columnDetails",
"redis_controlDisplayNavigationMenu", "redis_newlyPublishedArticles"}, allEntries = true)
@ApiOperation(value = "文章置顶/取消置顶", response = SysContent.class) @ApiOperation(value = "文章置顶/取消置顶", response = SysContent.class)
public R articleTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) { public R articleTopOperation(@ApiParam(name = "isTop", value = "是否置顶(默认为0 不置顶 1为置顶)", required = true) @RequestParam Integer isTop, @ApiParam(name = "articleId", value = "文章Id", required = true) @RequestParam Integer articleId) {
//是否置顶(默认为0 不置顶 1为置顶) //是否置顶(默认为0 不置顶 1为置顶)
@ -271,7 +246,8 @@ public class SysContentController {
@ApiOperation(value = "缓存用户存过的字段") @ApiOperation(value = "缓存用户存过的字段")
public R cacheField(@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId, public R cacheField(@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
@ApiParam(name = "fields", required = true, value = "字段(逗号隔开)") @RequestParam String fields, @ApiParam(name = "fields", required = true, value = "字段(逗号隔开)") @RequestParam String fields,
@ApiParam(name = "siteId", required = true, value = "站点id") @RequestParam Integer siteId) { @ApiParam(name = "siteId", required = true, value = "站点id") @RequestParam Integer siteId
) {
try { try {
String key = "articleFieldCache_" + "siteId_" + siteId + "userId_" + userId; String key = "articleFieldCache_" + "siteId_" + siteId + "userId_" + userId;

@ -17,7 +17,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.HashSet; import java.util.HashSet;
@ -54,8 +53,7 @@ public class SysFloatingColumnSchemeController {
*/ */
@PostMapping("/saveOrUpdate") @PostMapping("/saveOrUpdate")
@ApiOperation(value = "保存或更新悬浮栏方案记录", response = SysFloatingColumnScheme.class) @ApiOperation(value = "保存或更新悬浮栏方案记录", response = SysFloatingColumnScheme.class)
public R saveOrUpdate(@RequestBody @ApiParam(name = "悬浮栏方案对象", value = "包含悬浮栏方案详细信息,若id不存在则新建,否则视为更新", required = public R saveOrUpdate(@RequestBody @ApiParam(name = "悬浮栏方案对象", value = "包含悬浮栏方案详细信息,若id不存在则新建,否则视为更新", required = true) SysFloatingColumnScheme sysFloatingColumnScheme) {
true) SysFloatingColumnScheme sysFloatingColumnScheme) {
// 校验集合内是否有重复的schemeTitle // 校验集合内是否有重复的schemeTitle
Set<String> schemeTitles = new HashSet<>(); Set<String> schemeTitles = new HashSet<>();
@ -71,10 +69,8 @@ public class SysFloatingColumnSchemeController {
} }
if (sysFloatingColumnScheme.getId() != null&&sysFloatingColumnScheme.getIsDisable()==0){ if (sysFloatingColumnScheme.getId() != null&&sysFloatingColumnScheme.getIsDisable()==0){
ConflictCheckResultVO conflictCheckResultVO = ConflictCheckResultVO conflictCheckResultVO = service.preCheckMultiScopeConflictBeforeUpdate(sysFloatingColumnScheme.getSiteId(),
service.preCheckMultiScopeConflictBeforeUpdate(sysFloatingColumnScheme.getSiteId(), sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications(),sysFloatingColumnScheme.getId());
sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications(),
sysFloatingColumnScheme.getId());
if (conflictCheckResultVO.isHasConflict()) { if (conflictCheckResultVO.isHasConflict()) {
return R.fail(conflictCheckResultVO.getMessage()); return R.fail(conflictCheckResultVO.getMessage());
} }
@ -89,18 +85,15 @@ public class SysFloatingColumnSchemeController {
} }
// 编辑场景下,只有当名称发生改变时才进行校验,并排除当前记录自身 // 编辑场景下,只有当名称发生改变时才进行校验,并排除当前记录自身
else if (!sysFloatingColumnScheme.getSchemeName().equals(service.getById(sysFloatingColumnScheme.getId()).getSchemeName())) { else if (!sysFloatingColumnScheme.getSchemeName().equals(service.getById(sysFloatingColumnScheme.getId()).getSchemeName())) {
if (checkSchemeNameExceptSelf(sysFloatingColumnScheme.getSchemeName(), if (checkSchemeNameExceptSelf(sysFloatingColumnScheme.getSchemeName(), sysFloatingColumnScheme.getSiteId(), sysFloatingColumnScheme.getId())) {
sysFloatingColumnScheme.getSiteId(), sysFloatingColumnScheme.getId())) {
return R.fail("该站点下已存在相同的悬浮栏方案名称"); return R.fail("该站点下已存在相同的悬浮栏方案名称");
} }
} }
//获取floatingColumnSchemeScopeOfApplications中的范围判断是不是0,如果包含为0 //获取floatingColumnSchemeScopeOfApplications中的范围判断是不是0,如果包含为0
List<SysFloatingColumnSchemeScopeOfApplication> floatingColumnSchemeScopeOfApplications = List<SysFloatingColumnSchemeScopeOfApplication> floatingColumnSchemeScopeOfApplications = sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications();
sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications(); for (SysFloatingColumnSchemeScopeOfApplication floatingColumnSchemeScopeOfApplication : floatingColumnSchemeScopeOfApplications) {
for (SysFloatingColumnSchemeScopeOfApplication floatingColumnSchemeScopeOfApplication :
floatingColumnSchemeScopeOfApplications) {
if (floatingColumnSchemeScopeOfApplication.getApplicationScopeId().equals("0")) { if (floatingColumnSchemeScopeOfApplication.getApplicationScopeId().equals("0")) {
sysFloatingColumnScheme.setIsGlobal(1); sysFloatingColumnScheme.setIsGlobal(1);
@ -155,7 +148,6 @@ public class SysFloatingColumnSchemeController {
@PostMapping("/columnDisplayFloatingBar") @PostMapping("/columnDisplayFloatingBar")
@ApiOperation(value = "根据栏目展示悬浮栏", response = SysFloatingColumnSchemeVO.class) @ApiOperation(value = "根据栏目展示悬浮栏", response = SysFloatingColumnSchemeVO.class)
@Cacheable(value = "redis_columnDisplayFloatingBar", key = "#columnId")
public R columnDisplayFloatingBar(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam String columnId) { public R columnDisplayFloatingBar(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam String columnId) {
return service.columnDisplayFloatingBar(columnId); return service.columnDisplayFloatingBar(columnId);
} }
@ -175,8 +167,7 @@ public class SysFloatingColumnSchemeController {
*/ */
@PostMapping("/enableOrDisableScheme") @PostMapping("/enableOrDisableScheme")
@ApiOperation(value = "启用或禁用", response = SysFloatingColumnSchemeVO.class) @ApiOperation(value = "启用或禁用", response = SysFloatingColumnSchemeVO.class)
public R enableOrDisableScheme(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, public R enableOrDisableScheme(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
@ApiParam(name = "isDisable", value = "是否禁用(0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
/* return service.enableOrDisableScheme(id, isDisable);*/ /* return service.enableOrDisableScheme(id, isDisable);*/
//禁启用操作 //禁启用操作
@ -201,8 +192,7 @@ public class SysFloatingColumnSchemeController {
@PostMapping("/checkEnableOrDisable") @PostMapping("/checkEnableOrDisable")
@ApiOperation(value = "检查“启用”或“禁用”()", response = SysFloatingColumnSchemeVO.class) @ApiOperation(value = "检查“启用”或“禁用”()", response = SysFloatingColumnSchemeVO.class)
public R checkEnableOrDisable(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, public R checkEnableOrDisable(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id, @ApiParam(name = "isDisable", value = "是否禁用(0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
@ApiParam(name = "isDisable", value = "是否禁用(0启用 1禁用)", required = true) @RequestParam Integer isDisable) {
return service.checkEnableOrDisable(id, isDisable); return service.checkEnableOrDisable(id, isDisable);
} }
@ -212,10 +202,8 @@ public class SysFloatingColumnSchemeController {
@ApiOperation(value = "查询详情", response = SysFloatingColumnScheme.class) @ApiOperation(value = "查询详情", response = SysFloatingColumnScheme.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) { public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
SysFloatingColumnScheme sysFloatingColumnScheme = service.getById(id); SysFloatingColumnScheme sysFloatingColumnScheme = service.getById(id);
List<SysFloatingColumnSchemeScopeOfApplication> sysFloatingColumnSchemeScopeOfApplications = List<SysFloatingColumnSchemeScopeOfApplication> sysFloatingColumnSchemeScopeOfApplications = floatingColumnSchemeScopeOfApplicationService.getScopeOfApplicationByFloatingBarSchemeId(id);
floatingColumnSchemeScopeOfApplicationService.getScopeOfApplicationByFloatingBarSchemeId(id); List<SysFloatingColumnSchemeModule> getModuleByFloatingBarSchemeId = floatingColumnSchemeModuleService.getModuleByFloatingBarSchemeId(id);
List<SysFloatingColumnSchemeModule> getModuleByFloatingBarSchemeId =
floatingColumnSchemeModuleService.getModuleByFloatingBarSchemeId(id);
sysFloatingColumnScheme.setFloatingColumnSchemeScopeOfApplications(sysFloatingColumnSchemeScopeOfApplications); sysFloatingColumnScheme.setFloatingColumnSchemeScopeOfApplications(sysFloatingColumnSchemeScopeOfApplications);
sysFloatingColumnScheme.setFloatingColumnSchemeModules(getModuleByFloatingBarSchemeId); sysFloatingColumnScheme.setFloatingColumnSchemeModules(getModuleByFloatingBarSchemeId);
return R.success(sysFloatingColumnScheme); return R.success(sysFloatingColumnScheme);
@ -236,8 +224,7 @@ public class SysFloatingColumnSchemeController {
queryWrapper.eq(SysFloatingColumnSchemeModule::getFloatingBarSchemeId, removeId); queryWrapper.eq(SysFloatingColumnSchemeModule::getFloatingBarSchemeId, removeId);
floatingColumnSchemeModuleService.remove(queryWrapper); floatingColumnSchemeModuleService.remove(queryWrapper);
LambdaQueryWrapper<SysFloatingColumnSchemeScopeOfApplication> queryWrapper1 = LambdaQueryWrapper<SysFloatingColumnSchemeScopeOfApplication> queryWrapper1 = new LambdaQueryWrapper<>();
new LambdaQueryWrapper<>();
queryWrapper1.eq(SysFloatingColumnSchemeScopeOfApplication::getFloatingBarSchemeId, removeId); queryWrapper1.eq(SysFloatingColumnSchemeScopeOfApplication::getFloatingBarSchemeId, removeId);
floatingColumnSchemeScopeOfApplicationService.remove(queryWrapper1); floatingColumnSchemeScopeOfApplicationService.remove(queryWrapper1);
} }
@ -293,8 +280,7 @@ public class SysFloatingColumnSchemeController {
private void handleFloatingColumnSchemeScopeOfApplications(SysFloatingColumnScheme sysFloatingColumnScheme) { private void handleFloatingColumnSchemeScopeOfApplications(SysFloatingColumnScheme sysFloatingColumnScheme) {
if (sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications() != null && !sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications().isEmpty()) { if (sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications() != null && !sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications().isEmpty()) {
for (SysFloatingColumnSchemeScopeOfApplication scope : for (SysFloatingColumnSchemeScopeOfApplication scope : sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications()) {
sysFloatingColumnScheme.getFloatingColumnSchemeScopeOfApplications()) {
scope.setFloatingBarSchemeId(sysFloatingColumnScheme.getId()); scope.setFloatingBarSchemeId(sysFloatingColumnScheme.getId());
if (sysFloatingColumnScheme.getId() == null) { if (sysFloatingColumnScheme.getId() == null) {
// 如果悬浮栏方案是新建的,直接保存范围 // 如果悬浮栏方案是新建的,直接保存范围

@ -18,7 +18,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List; import java.util.List;
@ -170,7 +169,6 @@ public class SysFooterSetupController {
@PostMapping("/showTheFooterAccordingToTheColumn") @PostMapping("/showTheFooterAccordingToTheColumn")
@ApiOperation(value = "根据栏目展示页脚", response = SysFloatingColumnSchemeVO.class) @ApiOperation(value = "根据栏目展示页脚", response = SysFloatingColumnSchemeVO.class)
@Cacheable(value = "redis_showTheFooterAccordingToTheColumn", key = "#columnId")
public R columnDisplayFloatingBar(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam String columnId) { public R columnDisplayFloatingBar(@ApiParam(name = "columnId", value = "栏目id", required = true) @RequestParam String columnId) {
return service.showTheFooterAccordingToTheColumn(columnId); return service.showTheFooterAccordingToTheColumn(columnId);
} }

@ -7,7 +7,6 @@ import com.huoran.iasf.vo.req.ColumnWeightReqVO;
import com.huoran.iasf.vo.req.LongPageColumnReqVO; import com.huoran.iasf.vo.req.LongPageColumnReqVO;
import com.huoran.iasf.vo.req.PageContentReqVO; import com.huoran.iasf.vo.req.PageContentReqVO;
import com.huoran.iasf.vo.req.PaginationColumnReqVO; import com.huoran.iasf.vo.req.PaginationColumnReqVO;
import com.huoran.iasf.vo.resp.PageContentRespVO;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;

@ -17,13 +17,8 @@ import com.huoran.iasf.vo.req.ColumnWeightReqVO;
import com.huoran.iasf.vo.req.LongPageColumnReqVO; import com.huoran.iasf.vo.req.LongPageColumnReqVO;
import com.huoran.iasf.vo.req.PaginationColumnReqVO; import com.huoran.iasf.vo.req.PaginationColumnReqVO;
import com.huoran.iasf.vo.resp.PageContentRespVO; import com.huoran.iasf.vo.resp.PageContentRespVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
@ -35,7 +30,6 @@ import java.util.stream.Collectors;
* @日期: 2022-08-01 * @日期: 2022-08-01
*/ */
@Service @Service
@Slf4j
public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn> implements SysColumnService { public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn> implements SysColumnService {
@Autowired @Autowired
@ -43,8 +37,6 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
@Autowired @Autowired
private SysContentMapper contentMapper; private SysContentMapper contentMapper;
@Autowired
private CacheManager cacheManager;
@Override @Override
public boolean sameLevelJudgment(ColumnWeightReqVO column) { public boolean sameLevelJudgment(ColumnWeightReqVO column) {
@ -247,13 +239,6 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
private static final int TEMPLATE_ID_9 = 9; private static final int TEMPLATE_ID_9 = 9;
private static final int LIST_STYLE_ID_73 = 73; private static final int LIST_STYLE_ID_73 = 73;
/**
* 根据栏目类型ID查询相关文章
*
* @param ids 栏目类型ID字符串多个ID以逗号分隔
* @param id 单个栏目类型的ID
* @return 包含查询结果的响应对象
*/
@Override @Override
public R queryArticlesByColumnType(String ids, Integer id) { public R queryArticlesByColumnType(String ids, Integer id) {
// 检查输入参数是否有效 // 检查输入参数是否有效
@ -293,8 +278,6 @@ public class SysColumnServiceImpl extends ServiceImpl<SysColumnMapper, SysColumn
} }
@Override @Override
public List<String> getColumnNamesByIds(Collection<String> applicationScopeIds) { public List<String> getColumnNamesByIds(Collection<String> applicationScopeIds) {
if (CollectionUtils.isEmpty(applicationScopeIds)) { if (CollectionUtils.isEmpty(applicationScopeIds)) {

@ -7,7 +7,6 @@ import com.huoran.iasf.vo.FatherContentRespVO;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -17,8 +16,8 @@ import java.util.List;
* @日期: 2022-08-05 * @日期: 2022-08-05
*/ */
@Data @Data
public class PageContentRespVO implements Serializable { public class PageContentRespVO {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
@ApiModelProperty(value = "主键") @ApiModelProperty(value = "主键")

Loading…
Cancel
Save