master:系统调优;
parent
c11ee0eb6b
commit
a9fa919a1c
|
|
@ -15,7 +15,6 @@ import com.ruoyi.xkt.service.IUserFavoritesService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -33,10 +32,6 @@ public class UserFavoritesController extends XktBaseController {
|
|||
|
||||
final IUserFavoritesService userFavService;
|
||||
|
||||
/**
|
||||
* 新增用户收藏商品
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:favorites:add')")
|
||||
@ApiOperation(value = "用户收藏商品", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "用户收藏商品", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/batch")
|
||||
|
|
@ -44,21 +39,12 @@ public class UserFavoritesController extends XktBaseController {
|
|||
return success(userFavService.create(BeanUtil.toBean(favoriteVO, UserFavoriteDTO.class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收藏列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:favorites:list')")
|
||||
@ApiOperation(value = "获取用户收藏列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/page")
|
||||
public R<Page<UserFavoritePageResDTO>> page(@Validated @RequestBody UserFavoritePageVO pageVO) {
|
||||
return R.ok(userFavService.page(BeanUtil.toBean(pageVO, UserFavoritePageDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量加入进货车
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:favorites:add')")
|
||||
@ApiOperation(value = "批量加入进货车", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "批量加入进货车", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/batch/shopping-cart")
|
||||
|
|
@ -66,11 +52,6 @@ public class UserFavoritesController extends XktBaseController {
|
|||
return success(userFavService.batchAddToShoppingCart(BeanUtil.toBean(batchVO, UserFavBatchAddToShopCartDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量取消收藏
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('system:favorites:add')")
|
||||
@ApiOperation(value = "批量取消收藏", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "批量取消收藏", businessType = BusinessType.INSERT)
|
||||
@DeleteMapping("/batch")
|
||||
|
|
@ -78,5 +59,4 @@ public class UserFavoritesController extends XktBaseController {
|
|||
return success(userFavService.batchDelete(BeanUtil.toBean(batchDeleteVO, UserFavBatchDeleteDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ public class UserSubscriptionsController extends XktBaseController {
|
|||
return R.ok(userSubService.page(BeanUtil.toBean(pageVO, UserSubscPageDTO.class)));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "用户取消关注档口", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "用户取消关注档口", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/batch")
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 每晚12点25同步档口商品销售数据
|
||||
* 每晚12点25同步商品最新分类排序
|
||||
*/
|
||||
@Transactional
|
||||
public void dailyCategorySort() {
|
||||
|
|
@ -273,7 +273,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 每晚12点40给商品打标
|
||||
* 每晚12点40更新商品标签
|
||||
*/
|
||||
@Transactional
|
||||
public void dailyProdTag() throws IOException {
|
||||
|
|
@ -519,7 +519,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 每晚22:00:10更新广告位轮次状态 将biddingTempStatus赋值给biddingStatus
|
||||
* 每晚22:00:10更新广告位竞价状态 将biddingTempStatus赋值给biddingStatus
|
||||
*/
|
||||
@Transactional
|
||||
public void updateAdvertRoundBiddingStatus() throws ParseException {
|
||||
|
|
@ -555,7 +555,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 通过定时任务将symbol存放到redis中
|
||||
* 凌晨00:00:30通过定时任务将symbol存放到redis中
|
||||
*/
|
||||
public void saveSymbolToRedis() {
|
||||
advertRoundService.initAdvertLockMap();
|
||||
|
|
@ -651,7 +651,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 每晚凌晨3点更新系统热搜到redis中
|
||||
* 每晚凌晨2:10更新系统热搜到redis中
|
||||
*/
|
||||
@Transactional
|
||||
public void dailyUpdateSearchHotToRedis() {
|
||||
|
|
@ -841,7 +841,7 @@ public class XktTask {
|
|||
}
|
||||
|
||||
/**
|
||||
* 统计图搜热款
|
||||
* 凌晨2:30更新统计图搜热款
|
||||
*/
|
||||
public void imgSearchTopProductStatistics() {
|
||||
log.info("-------------统计图搜热款开始-------------");
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ public class PictureSearchServiceImpl implements IPictureSearchService {
|
|||
@Autowired
|
||||
private StoreProductStatisticsMapper storeProdStatisticsMapper;
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public List<StoreProdViewDTO> searchProductByPic(SearchRequestDTO requestDTO) {
|
||||
|
|
@ -66,6 +65,7 @@ public class PictureSearchServiceImpl implements IPictureSearchService {
|
|||
// TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作
|
||||
// TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作
|
||||
// TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作
|
||||
// TODO 校验当前登录者角色,若非电商卖家 或 管理员 或 超级管理员,则不可操作
|
||||
|
||||
Assert.notEmpty(requestDTO.getPicKey());
|
||||
SysFile sysFile = new SysFile().setFileUrl(requestDTO.getPicKey()).setFileName(requestDTO.getPicName()).setFileSize(requestDTO.getPicSize());
|
||||
|
|
@ -78,22 +78,25 @@ public class PictureSearchServiceImpl implements IPictureSearchService {
|
|||
pictureSearch.setDelFlag(Constants.UNDELETED);
|
||||
pictureSearchMapper.insert(pictureSearch);
|
||||
//搜索
|
||||
List<ProductMatchDTO> results = pictureService.searchProductByPicKey(requestDTO.getPicKey(),
|
||||
requestDTO.getNum());
|
||||
List<ProductMatchDTO> results = pictureService.searchProductByPicKey(requestDTO.getPicKey(), requestDTO.getNum());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
for (ProductMatchDTO result : results) {
|
||||
//图搜次数+1
|
||||
redisCache.valueIncr(CacheConstants.PRODUCT_STATISTICS_IMG_SEARCH_COUNT, result.getStoreProductId());
|
||||
}
|
||||
});
|
||||
// 以图搜款广告
|
||||
List<PicSearchAdvertDTO> picSearchAdverts = websitePCService.getPicSearchList();
|
||||
// 没有搜出结果,则直接返回广告
|
||||
if (CollectionUtils.isEmpty(results)) {
|
||||
return BeanUtil.copyToList(picSearchAdverts, StoreProdViewDTO.class);
|
||||
}
|
||||
// 档口商品显示的基本属性
|
||||
List<StoreProdViewDTO> storeProdViewAttrList = this.storeProdMapper.getStoreProdViewAttr(results.stream()
|
||||
.map(ProductMatchDTO::getStoreProductId).distinct().collect(Collectors.toList()),
|
||||
java.sql.Date.valueOf(LocalDate.now()), java.sql.Date.valueOf(LocalDate.now().minusMonths(2)));
|
||||
java.sql.Date.valueOf(LocalDate.now().minusMonths(2)), java.sql.Date.valueOf(LocalDate.now()));
|
||||
// 设置商品标签
|
||||
storeProdViewAttrList.stream().filter(x -> StringUtils.isNotBlank(x.getTagStr())).forEach(x -> x.setTags(StrUtil.split(x.getTagStr(), ",")));
|
||||
// 以图搜款广告
|
||||
List<PicSearchAdvertDTO> picSearchAdverts = websitePCService.getPicSearchList();
|
||||
// 将广告插入到预定位置
|
||||
return insertAdvertsIntoList(storeProdViewAttrList, BeanUtil.copyToList(picSearchAdverts, StoreProdViewDTO.class), Constants.PIC_SEARCH_INSERT_POSITIONS);
|
||||
}
|
||||
|
|
@ -149,6 +152,9 @@ public class PictureSearchServiceImpl implements IPictureSearchService {
|
|||
* @return 合并后的列表
|
||||
*/
|
||||
public static <T> List<T> insertAdvertsIntoList(List<T> dataList, List<T> adverts, Set<Integer> positions) {
|
||||
if (CollectionUtils.isEmpty(adverts)) {
|
||||
return dataList;
|
||||
}
|
||||
List<T> mergedList = new ArrayList<>(dataList); // 先拷贝原始数据
|
||||
int advertIndex = 0;
|
||||
// 遍历所有广告插入位置
|
||||
|
|
|
|||
|
|
@ -1208,7 +1208,7 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
List<Store> storeList = this.storeMapper.selectByIds(oneMonthList.stream().map(AdvertRound::getStoreId).collect(Collectors.toList()));
|
||||
// 获取商品显示的基本属性
|
||||
List<StoreProdViewDTO> storeProdViewList = this.storeProdMapper.getStoreProdViewAttr(storeProdIdList,
|
||||
java.sql.Date.valueOf(LocalDate.now()), java.sql.Date.valueOf(LocalDate.now().minusMonths(2)));
|
||||
java.sql.Date.valueOf(LocalDate.now().minusMonths(2)), java.sql.Date.valueOf(LocalDate.now()));
|
||||
Map<Long, StoreProdViewDTO> viewMap = storeProdViewList.stream().collect(Collectors.toMap(StoreProdViewDTO::getStoreProdId, Function.identity()));
|
||||
// 档口标签
|
||||
List<DailyStoreTag> storeTagList = this.dailyStoreTagMapper.selectList(new LambdaQueryWrapper<DailyStoreTag>()
|
||||
|
|
@ -1704,6 +1704,9 @@ public class WebsitePCServiceImpl implements IWebsitePCService {
|
|||
* @return 合并后的列表
|
||||
*/
|
||||
public static <T> List<T> insertAdvertsIntoList(List<T> dataList, List<T> adverts, Set<Integer> positions) {
|
||||
if (CollectionUtils.isEmpty(adverts)) {
|
||||
return dataList;
|
||||
}
|
||||
List<T> mergedList = new ArrayList<>(dataList); // 先拷贝原始数据
|
||||
int advertIndex = 0;
|
||||
// 遍历所有广告插入位置
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sp.id AS storeProdId,
|
||||
sp.prod_art_num,
|
||||
sp.prod_title,
|
||||
SUM( sps.img_search_count ) AS img_search_count,
|
||||
SUM( IFNULL( sps.img_search_count, 0 ) ) AS img_search_count,
|
||||
sf.file_url AS mainPicUrl,
|
||||
GROUP_CONCAT( DISTINCT dpt.tag ORDER BY dpt.type ) AS tagStr,
|
||||
sp.store_id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue