|
@@ -4,13 +4,14 @@ import com.baomidou.mybatisplus.core.toolkit.Assert;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.dto.Result;
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
|
|
+import com.cyksj.model.entity.GoodsDonCategory;
|
|
|
import com.cyksj.model.entity.HomeManagementConfig;
|
|
import com.cyksj.model.entity.HomeManagementConfig;
|
|
|
-import com.cyksj.model.entity.HomeManagementConfigUserClickRecord;
|
|
|
|
|
import com.cyksj.model.request.HomeManageConfigReq;
|
|
import com.cyksj.model.request.HomeManageConfigReq;
|
|
|
import com.cyksj.model.views.HomeManagementAvailableGoodsView;
|
|
import com.cyksj.model.views.HomeManagementAvailableGoodsView;
|
|
|
import com.cyksj.model.views.HomeManagementConfigView;
|
|
import com.cyksj.model.views.HomeManagementConfigView;
|
|
|
import com.cyksj.redis.RedisService;
|
|
import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.home.HomeManagementConfigService;
|
|
import com.cyksj.service.home.HomeManagementConfigService;
|
|
|
|
|
+import com.cyksj.service.mange.GoodsDonCategoryService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
@@ -39,6 +40,8 @@ public class HomeManageConfigController {
|
|
|
|
|
|
|
|
private final RedisService redisService;
|
|
private final RedisService redisService;
|
|
|
|
|
|
|
|
|
|
+ private final GoodsDonCategoryService goodsDonCategoryService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 新增首页配置
|
|
* 新增首页配置
|
|
|
*/
|
|
*/
|
|
@@ -54,7 +57,7 @@ public class HomeManageConfigController {
|
|
|
@PutMapping("/put")
|
|
@PutMapping("/put")
|
|
|
public Result<String> updateConfig(@RequestBody HomeManageConfigReq config) {
|
|
public Result<String> updateConfig(@RequestBody HomeManageConfigReq config) {
|
|
|
homeManagementConfigService.saveOrUpdateConfig(config);
|
|
homeManagementConfigService.saveOrUpdateConfig(config);
|
|
|
- Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
|
|
|
|
|
|
|
+ Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
|
|
|
redisService.del(keys.toArray(String[]::new));
|
|
redisService.del(keys.toArray(String[]::new));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
@@ -69,11 +72,33 @@ public class HomeManageConfigController {
|
|
|
Assert.notNull(byId, "配置不存在");
|
|
Assert.notNull(byId, "配置不存在");
|
|
|
byId.setStatus(!byId.getStatus());
|
|
byId.setStatus(!byId.getStatus());
|
|
|
homeManagementConfigService.updateById(byId);
|
|
homeManagementConfigService.updateById(byId);
|
|
|
- Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
|
|
|
|
|
|
|
+ Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
|
|
|
redisService.del(keys.toArray(String[]::new));
|
|
redisService.del(keys.toArray(String[]::new));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 配置 一键上下架
|
|
|
|
|
+ */
|
|
|
|
|
+ @PutMapping("/batch/update/status/{status}")
|
|
|
|
|
+ public Result<String> batchUpdateStatus(@RequestBody List<Long> ids, @PathVariable Boolean status) {
|
|
|
|
|
+ homeManagementConfigService.update(null, Wrappers.lambdaUpdate(HomeManagementConfig.class)
|
|
|
|
|
+ .set(HomeManagementConfig::getStatus, status)
|
|
|
|
|
+ .in(HomeManagementConfig::getId, ids));
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 分类 一键上下架
|
|
|
|
|
+ */
|
|
|
|
|
+ @PutMapping("/batch/update/category/status/{status}")
|
|
|
|
|
+ public Result<String> batchUpdateCategoryStatus(@RequestBody List<Long> ids, @PathVariable Boolean status) {
|
|
|
|
|
+ goodsDonCategoryService.update(null, Wrappers.lambdaUpdate(GoodsDonCategory.class)
|
|
|
|
|
+ .set(GoodsDonCategory::getStatus, status)
|
|
|
|
|
+ .in(GoodsDonCategory::getId, ids));
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 配置排序
|
|
* 配置排序
|
|
|
*/
|
|
*/
|
|
@@ -85,7 +110,7 @@ public class HomeManageConfigController {
|
|
|
Integer sorted = config.getSorted();
|
|
Integer sorted = config.getSorted();
|
|
|
byId.setSorted(sorted);
|
|
byId.setSorted(sorted);
|
|
|
homeManagementConfigService.updateById(byId);
|
|
homeManagementConfigService.updateById(byId);
|
|
|
- Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
|
|
|
|
|
|
|
+ Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
|
|
|
redisService.del(keys.toArray(String[]::new));
|
|
redisService.del(keys.toArray(String[]::new));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
@@ -99,7 +124,7 @@ public class HomeManageConfigController {
|
|
|
.set(HomeManagementConfig::getDeleted, false)
|
|
.set(HomeManagementConfig::getDeleted, false)
|
|
|
.eq(HomeManagementConfig::getId, id)
|
|
.eq(HomeManagementConfig::getId, id)
|
|
|
.eq(HomeManagementConfig::getDeleted, true));
|
|
.eq(HomeManagementConfig::getDeleted, true));
|
|
|
- Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "homeManage" + "*");
|
|
|
|
|
|
|
+ Set<String> keys = redisService.keys(RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "*");
|
|
|
redisService.del(keys.toArray(String[]::new));
|
|
redisService.del(keys.toArray(String[]::new));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
@@ -112,11 +137,6 @@ public class HomeManageConfigController {
|
|
|
SearchResult<HomeManagementConfigView> search = beanSearcher.search(HomeManagementConfigView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
SearchResult<HomeManagementConfigView> search = beanSearcher.search(HomeManagementConfigView.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(HomeManagementConfigView::getType, type.name())
|
|
.field(HomeManagementConfigView::getType, type.name())
|
|
|
.build());
|
|
.build());
|
|
|
- search.getDataList().forEach(data -> {
|
|
|
|
|
- Number number = beanSearcher.searchCount(HomeManagementConfigUserClickRecord.class, MapUtils.builder()
|
|
|
|
|
- .field(HomeManagementConfigUserClickRecord::getConfigId, data.getId()).build());
|
|
|
|
|
- data.setClick(number.intValue());
|
|
|
|
|
- });
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(search);
|
|
|
}
|
|
}
|
|
|
|
|
|