mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-25 00:15:06 +08:00
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java
This commit is contained in:
@ -67,8 +67,8 @@ public class ProductCategoryController {
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得商品分类列表")
|
||||
@PreAuthorize("@ss.hasPermission('product:category:query')")
|
||||
public CommonResult<List<ProductCategoryRespVO>> getCategoryList(@Valid ProductCategoryListReqVO treeListReqVO) {
|
||||
List<ProductCategoryDO> list = categoryService.getEnableCategoryList(treeListReqVO);
|
||||
public CommonResult<List<ProductCategoryRespVO>> getCategoryList(@Valid ProductCategoryListReqVO listReqVO) {
|
||||
List<ProductCategoryDO> list = categoryService.getCategoryList(listReqVO);
|
||||
list.sort(Comparator.comparing(ProductCategoryDO::getSort));
|
||||
return success(ProductCategoryConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.product.controller.admin.category.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@Schema(description = "管理后台 - 商品分类列表查询 Request VO")
|
||||
@Data
|
||||
public class ProductCategoryListReqVO {
|
||||
@ -16,4 +18,7 @@ public class ProductCategoryListReqVO {
|
||||
@Schema(description = "父分类编号", example = "1")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "父分类编号数组", example = "1,2,3")
|
||||
private Collection<Long> parentIds;
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
// TODO 芋艿:后面再看
|
||||
@Tag(name = "用户 APP - 商品浏览记录")
|
||||
@RestController
|
||||
@RequestMapping("/product/browse-history")
|
||||
@ -65,10 +66,9 @@ public class AppProductBrowseHistoryController {
|
||||
@Operation(summary = "获得商品浏览记录分页")
|
||||
@PreAuthenticated
|
||||
public CommonResult<PageResult<AppProductBrowseHistoryRespVO>> getBrowseHistoryPage(AppProductBrowseHistoryPageReqVO reqVO) {
|
||||
ProductBrowseHistoryPageReqVO pageReqVO = BeanUtils.toBean(reqVO, ProductBrowseHistoryPageReqVO.class);
|
||||
pageReqVO.setUserId(getLoginUserId());
|
||||
// 排除用户已删除的(隐藏的)
|
||||
pageReqVO.setUserDeleted(false);
|
||||
ProductBrowseHistoryPageReqVO pageReqVO = BeanUtils.toBean(reqVO, ProductBrowseHistoryPageReqVO.class)
|
||||
.setUserId(getLoginUserId())
|
||||
.setUserDeleted(false); // 排除用户已删除的(隐藏的)
|
||||
PageResult<ProductBrowseHistoryDO> pageResult = productBrowseHistoryService.getBrowseHistoryPage(pageReqVO);
|
||||
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||
return success(PageResult.empty());
|
||||
@ -77,15 +77,9 @@ public class AppProductBrowseHistoryController {
|
||||
// 得到商品 spu 信息
|
||||
Set<Long> spuIds = convertSet(pageResult.getList(), ProductBrowseHistoryDO::getSpuId);
|
||||
Map<Long, ProductSpuDO> spuMap = convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId);
|
||||
|
||||
// 转换 VO 结果
|
||||
PageResult<AppProductBrowseHistoryRespVO> result = BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class,
|
||||
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())).ifPresent(spu -> {
|
||||
vo.setSpuName(spu.getName())
|
||||
.setPicUrl(spu.getPicUrl())
|
||||
.setPrice(spu.getPrice());
|
||||
}));
|
||||
return success(result);
|
||||
return success(BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class,
|
||||
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId()))
|
||||
.ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice()))));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class AppProductBrowseHistoryPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
@ -4,11 +4,12 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 商品 SPU 分页 Request VO")
|
||||
@Data
|
||||
@ -26,9 +27,15 @@ public class AppProductSpuPageReqVO extends PageParam {
|
||||
public static final String RECOMMEND_TYPE_NEW = "new";
|
||||
public static final String RECOMMEND_TYPE_GOOD = "good";
|
||||
|
||||
@Schema(description = "商品 SPU 编号数组", example = "1,3,5")
|
||||
private List<Long> ids;
|
||||
|
||||
@Schema(description = "分类编号", example = "1")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "分类编号数组", example = "1,2,3")
|
||||
private List<Long> categoryIds;
|
||||
|
||||
@Schema(description = "关键字", example = "好看")
|
||||
private String keyword;
|
||||
|
||||
|
@ -21,6 +21,7 @@ public interface ProductCategoryMapper extends BaseMapperX<ProductCategoryDO> {
|
||||
return selectList(new LambdaQueryWrapperX<ProductCategoryDO>()
|
||||
.likeIfPresent(ProductCategoryDO::getName, listReqVO.getName())
|
||||
.eqIfPresent(ProductCategoryDO::getParentId, listReqVO.getParentId())
|
||||
.inIfPresent(ProductCategoryDO::getId, listReqVO.getParentIds())
|
||||
.eqIfPresent(ProductCategoryDO::getStatus, listReqVO.getStatus())
|
||||
.orderByDesc(ProductCategoryDO::getId));
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ public interface ProductCategoryService {
|
||||
* @param listReqVO 查询条件
|
||||
* @return 商品分类列表
|
||||
*/
|
||||
List<ProductCategoryDO> getEnableCategoryList(ProductCategoryListReqVO listReqVO);
|
||||
List<ProductCategoryDO> getCategoryList(ProductCategoryListReqVO listReqVO);
|
||||
|
||||
/**
|
||||
* 获得开启状态的商品分类列表
|
||||
|
@ -161,7 +161,7 @@ public class ProductCategoryServiceImpl implements ProductCategoryService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProductCategoryDO> getEnableCategoryList(ProductCategoryListReqVO listReqVO) {
|
||||
public List<ProductCategoryDO> getCategoryList(ProductCategoryListReqVO listReqVO) {
|
||||
return productCategoryMapper.selectList(listReqVO);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.product.service.history;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.history.vo.ProductBrowseHistoryPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.history.ProductBrowseHistoryDO;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@ -20,6 +21,7 @@ public interface ProductBrowseHistoryService {
|
||||
* @param spuId SPU 编号
|
||||
* @return 编号
|
||||
*/
|
||||
@Async
|
||||
Long createBrowseHistory(Long userId, Long spuId);
|
||||
|
||||
/**
|
||||
@ -30,14 +32,6 @@ public interface ProductBrowseHistoryService {
|
||||
*/
|
||||
void hideUserBrowseHistory(Long userId, Collection<Long> spuId);
|
||||
|
||||
/**
|
||||
* 获得商品浏览记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 商品浏览记录
|
||||
*/
|
||||
ProductBrowseHistoryDO getBrowseHistory(Long id);
|
||||
|
||||
/**
|
||||
* 获取用户记录数量
|
||||
*
|
||||
|
@ -50,7 +50,6 @@ public class ProductBrowseHistoryServiceImpl implements ProductBrowseHistoryServ
|
||||
.setUserId(userId)
|
||||
.setSpuId(spuId);
|
||||
browseHistoryMapper.insert(browseHistory);
|
||||
// 返回
|
||||
return browseHistory.getId();
|
||||
}
|
||||
|
||||
@ -59,11 +58,6 @@ public class ProductBrowseHistoryServiceImpl implements ProductBrowseHistoryServ
|
||||
browseHistoryMapper.updateUserDeletedByUserId(userId, spuIds, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductBrowseHistoryDO getBrowseHistory(Long id) {
|
||||
return browseHistoryMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getBrowseHistoryCount(Long userId, Boolean userDeleted) {
|
||||
return browseHistoryMapper.selectCountByUserIdAndUserDeleted(userId, userDeleted);
|
||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRe
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -154,6 +156,7 @@ public interface ProductSpuService {
|
||||
* @param id 商品 SPU 编号
|
||||
* @param incrCount 增加的数量
|
||||
*/
|
||||
@Async
|
||||
void updateBrowseCount(Long id, int incrCount);
|
||||
|
||||
}
|
||||
|
@ -18,17 +18,16 @@ import cn.iocoder.yudao.module.product.service.brand.ProductBrandService;
|
||||
import cn.iocoder.yudao.module.product.service.category.ProductCategoryService;
|
||||
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||
import com.google.common.collect.Maps;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getMinValue;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO.CATEGORY_LEVEL;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
|
||||
|
||||
@ -220,9 +219,15 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
Set<Long> categoryIds = new HashSet<>();
|
||||
if (pageReqVO.getCategoryId() != null && pageReqVO.getCategoryId() > 0) {
|
||||
categoryIds.add(pageReqVO.getCategoryId());
|
||||
List<ProductCategoryDO> categoryChildren = categoryService.getEnableCategoryList(new ProductCategoryListReqVO()
|
||||
.setParentId(pageReqVO.getCategoryId()).setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
categoryIds.addAll(CollectionUtils.convertList(categoryChildren, ProductCategoryDO::getId));
|
||||
List<ProductCategoryDO> categoryChildren = categoryService.getCategoryList(new ProductCategoryListReqVO()
|
||||
.setStatus(CommonStatusEnum.ENABLE.getStatus()).setParentId(pageReqVO.getCategoryId()));
|
||||
categoryIds.addAll(convertList(categoryChildren, ProductCategoryDO::getId));
|
||||
}
|
||||
if (CollUtil.isNotEmpty(pageReqVO.getCategoryIds())) {
|
||||
categoryIds.addAll(pageReqVO.getCategoryIds());
|
||||
List<ProductCategoryDO> categoryChildren = categoryService.getCategoryList(new ProductCategoryListReqVO()
|
||||
.setStatus(CommonStatusEnum.ENABLE.getStatus()).setParentIds(pageReqVO.getCategoryIds()));
|
||||
categoryIds.addAll(convertList(categoryChildren, ProductCategoryDO::getId));
|
||||
}
|
||||
// 分页查询
|
||||
return productSpuMapper.selectPage(pageReqVO, categoryIds);
|
||||
|
@ -6,6 +6,7 @@ import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
// TODO 芋艿:弱化这个状态
|
||||
/**
|
||||
* 促销活动的状态枚举
|
||||
*
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.controller.admin.reward.vo;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionConditionTypeEnum;
|
||||
import cn.iocoder.yudao.module.promotion.enums.common.PromotionProductScopeEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
@ -50,7 +51,7 @@ public class RewardActivityBaseVO {
|
||||
|
||||
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "商品范围不能为空")
|
||||
@InEnum(value = PromotionConditionTypeEnum.class, message = "商品范围必须是 {value}")
|
||||
@InEnum(value = PromotionProductScopeEnum.class, message = "商品范围必须是 {value}")
|
||||
private Integer productScope;
|
||||
|
||||
@Schema(description = "商品 SPU 编号的数组", example = "1,2,3")
|
||||
|
@ -145,6 +145,7 @@ public class AppActivityController {
|
||||
}
|
||||
|
||||
private void getRewardActivities(Collection<Long> spuIds, LocalDateTime now, List<AppActivityRespVO> activityList) {
|
||||
// TODO @puhui999:有 3 范围,不只 spuId,还有 categoryId,全部
|
||||
List<RewardActivityDO> rewardActivityList = rewardActivityService.getRewardActivityBySpuIdsAndStatusAndDateTimeLt(
|
||||
spuIds, PromotionActivityStatusEnum.RUN.getStatus(), now);
|
||||
if (CollUtil.isEmpty(rewardActivityList)) {
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.promotion.controller.app.reward;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.promotion.controller.app.reward.vo.AppRewardActivityRespVO;
|
||||
import cn.iocoder.yudao.module.promotion.dal.dataobject.reward.RewardActivityDO;
|
||||
import cn.iocoder.yudao.module.promotion.service.reward.RewardActivityService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "用户 App - 满减送活动")
|
||||
@RestController
|
||||
@RequestMapping("/promotion/reward-activity")
|
||||
@Validated
|
||||
public class AppRewardActivityController {
|
||||
|
||||
@Resource
|
||||
private RewardActivityService rewardActivityService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得满减送活动")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<AppRewardActivityRespVO> getRewardActivity(@RequestParam("id") Long id) {
|
||||
RewardActivityDO rewardActivity = rewardActivityService.getRewardActivity(id);
|
||||
return success(BeanUtils.toBean(rewardActivity, AppRewardActivityRespVO.class));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.promotion.controller.app.reward.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.promotion.controller.admin.reward.vo.RewardActivityBaseVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 满减送活动 Response VO")
|
||||
@Data
|
||||
public class AppRewardActivityRespVO {
|
||||
|
||||
@Schema(description = "活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "活动标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "满啦满啦")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "条件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer conditionType;
|
||||
|
||||
@Schema(description = "商品范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer productScope;
|
||||
|
||||
@Schema(description = "商品 SPU 编号的数组", example = "1,2,3")
|
||||
private List<Long> productSpuIds;
|
||||
|
||||
@Schema(description = "优惠规则的数组")
|
||||
private List<RewardActivityBaseVO.Rule> rules;
|
||||
|
||||
}
|
@ -79,13 +79,9 @@ public class ProductStatisticsController {
|
||||
// 处理商品信息
|
||||
Set<Long> spuIds = convertSet(pageResult.getList(), ProductStatisticsDO::getSpuId);
|
||||
Map<Long, ProductSpuRespDTO> spuMap = convertMap(productSpuApi.getSpuList(spuIds), ProductSpuRespDTO::getId);
|
||||
// 拼接返回
|
||||
return success(BeanUtils.toBean(pageResult, ProductStatisticsRespVO.class,
|
||||
// 拼接商品信息
|
||||
item -> Optional.ofNullable(spuMap.get(item.getSpuId())).ifPresent(spu -> {
|
||||
item.setName(spu.getName());
|
||||
item.setPicUrl(spu.getPicUrl());
|
||||
})));
|
||||
item -> Optional.ofNullable(spuMap.get(item.getSpuId()))
|
||||
.ifPresent(spu -> item.setName(spu.getName()).setPicUrl(spu.getPicUrl()))));
|
||||
}
|
||||
|
||||
}
|
@ -27,7 +27,7 @@ public class ProductStatisticsRespVO {
|
||||
@ExcelProperty("商品SPU编号")
|
||||
private Long spuId;
|
||||
|
||||
//region 商品信息
|
||||
// region 商品信息
|
||||
|
||||
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "商品名称")
|
||||
@ExcelProperty("商品名称")
|
||||
@ -37,7 +37,7 @@ public class ProductStatisticsRespVO {
|
||||
@ExcelProperty("商品封面图")
|
||||
private String picUrl;
|
||||
|
||||
//endregion
|
||||
// endregion
|
||||
|
||||
@Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "17505")
|
||||
@ExcelProperty("浏览量")
|
||||
|
@ -49,7 +49,6 @@ public class TradeStatisticsController {
|
||||
@Resource
|
||||
private BrokerageStatisticsService brokerageStatisticsService;
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/summary")
|
||||
@Operation(summary = "获得交易统计")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:query')")
|
||||
@ -75,7 +74,6 @@ public class TradeStatisticsController {
|
||||
ArrayUtil.get(reqVO.getTimes(), 1)));
|
||||
}
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得交易状况明细")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:query')")
|
||||
@ -85,7 +83,6 @@ public class TradeStatisticsController {
|
||||
return success(TradeStatisticsConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出获得交易状况明细 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:export')")
|
||||
@ -98,7 +95,6 @@ public class TradeStatisticsController {
|
||||
ExcelUtils.write(response, "交易状况.xls", "数据", TradeTrendSummaryExcelVO.class, data);
|
||||
}
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/order-count")
|
||||
@Operation(summary = "获得交易订单数量")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:query')")
|
||||
@ -116,7 +112,6 @@ public class TradeStatisticsController {
|
||||
return success(TradeStatisticsConvert.INSTANCE.convert(undeliveredCount, pickUpCount, afterSaleApplyCount, auditingWithdrawCount));
|
||||
}
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/order-comparison")
|
||||
@Operation(summary = "获得交易订单数量")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:query')")
|
||||
@ -124,7 +119,6 @@ public class TradeStatisticsController {
|
||||
return success(tradeOrderStatisticsService.getOrderComparison());
|
||||
}
|
||||
|
||||
// TODO 芋艿:已经 review
|
||||
@GetMapping("/order-count-trend")
|
||||
@Operation(summary = "获得订单量趋势统计")
|
||||
@PreAuthorize("@ss.hasPermission('statistics:trade:query')")
|
||||
|
@ -33,7 +33,7 @@ public class ProductStatisticsDO extends BaseDO {
|
||||
*/
|
||||
private LocalDate time;
|
||||
/**
|
||||
* 商品SPU编号
|
||||
* 商品 SPU 编号
|
||||
*/
|
||||
private Long spuId;
|
||||
/**
|
||||
|
@ -45,4 +45,5 @@ public class ProductStatisticsJob implements JobHandler {
|
||||
String result = productStatisticsService.statisticsProduct(days);
|
||||
return StrUtil.format("商品统计:\n{}", result);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.SortablePageParam;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.PageUtils;
|
||||
import cn.iocoder.yudao.module.statistics.controller.admin.common.vo.DataComparisonRespVO;
|
||||
import cn.iocoder.yudao.module.statistics.controller.admin.product.vo.ProductStatisticsReqVO;
|
||||
import cn.iocoder.yudao.module.statistics.controller.admin.product.vo.ProductStatisticsRespVO;
|
||||
@ -42,8 +42,7 @@ public class ProductStatisticsServiceImpl implements ProductStatisticsService {
|
||||
|
||||
@Override
|
||||
public PageResult<ProductStatisticsDO> getProductStatisticsRankPage(ProductStatisticsReqVO reqVO, SortablePageParam pageParam) {
|
||||
// 默认浏览量倒序
|
||||
MyBatisUtils.buildDefaultSortingField(pageParam, ProductStatisticsDO::getBrowseCount);
|
||||
PageUtils.buildDefaultSortingField(pageParam, ProductStatisticsDO::getBrowseCount); // 默认浏览量倒序
|
||||
return productStatisticsMapper.selectPageGroupBySpuId(reqVO, pageParam);
|
||||
}
|
||||
|
||||
@ -92,31 +91,26 @@ public class ProductStatisticsServiceImpl implements ProductStatisticsService {
|
||||
return dateStr + " 数据已存在,如果需要重新统计,请先删除对应的数据";
|
||||
}
|
||||
|
||||
// 3. 统计数据
|
||||
StopWatch stopWatch = new StopWatch(dateStr);
|
||||
stopWatch.start();
|
||||
|
||||
// 分页统计,避免商品表数据较多时,出现超时问题
|
||||
// 4. 分页统计,避免商品表数据较多时,出现超时问题
|
||||
final int pageSize = 100;
|
||||
for (int pageNo = 1; ; pageNo ++) {
|
||||
for (int pageNo = 1; ; pageNo++) {
|
||||
IPage<ProductStatisticsDO> page = productStatisticsMapper.selectStatisticsResultPageByTimeBetween(
|
||||
Page.of(pageNo, pageSize, false), beginTime, endTime);
|
||||
if (CollUtil.isEmpty(page.getRecords())) {
|
||||
break;
|
||||
}
|
||||
|
||||
// 4.1 计算访客支付转化率(百分比)
|
||||
for (ProductStatisticsDO record : page.getRecords()) {
|
||||
record.setTime(date.toLocalDate());
|
||||
// 计算 访客支付转化率(百分比)
|
||||
if (record.getBrowseUserCount() != null && ObjUtil.notEqual(record.getBrowseUserCount(), 0)) {
|
||||
record.setBrowseConvertPercent(100 * record.getOrderPayCount() / record.getBrowseUserCount());
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 插入数据
|
||||
// 4.2 插入数据
|
||||
productStatisticsMapper.insertBatch(page.getRecords());
|
||||
}
|
||||
|
||||
return stopWatch.prettyPrint();
|
||||
}
|
||||
|
||||
|
@ -87,10 +87,6 @@ public class TradeConfigBaseVO {
|
||||
@PositiveOrZero(message = "用户提现手续费百分比不能是负数")
|
||||
private Integer brokerageWithdrawFeePercent;
|
||||
|
||||
@Schema(description = "提现银行", requiredMode = Schema.RequiredMode.REQUIRED, example = "[0, 1]")
|
||||
@NotEmpty(message = "提现银行不能为空")
|
||||
private List<Integer> brokerageBankNames;
|
||||
|
||||
@Schema(description = "佣金冻结时间(天)", requiredMode = Schema.RequiredMode.REQUIRED, example = "7")
|
||||
@NotNull(message = "佣金冻结时间(天)不能为空")
|
||||
@PositiveOrZero(message = "佣金冻结时间不能是负数")
|
||||
|
@ -103,11 +103,6 @@ public class TradeConfigDO extends BaseDO {
|
||||
* 用户提现手续费百分比
|
||||
*/
|
||||
private Integer brokerageWithdrawFeePercent;
|
||||
/**
|
||||
* 提现银行
|
||||
*/
|
||||
@TableField(typeHandler = IntegerListTypeHandler.class)
|
||||
private List<Integer> brokerageBankNames;
|
||||
/**
|
||||
* 佣金冻结时间(天)
|
||||
*/
|
||||
|
@ -262,7 +262,7 @@ public class AfterSaleServiceImpl implements AfterSaleService {
|
||||
// 记录售后日志
|
||||
AfterSaleLogUtils.setAfterSaleInfo(afterSale.getId(), afterSale.getStatus(),
|
||||
AfterSaleStatusEnum.BUYER_DELIVERY.getStatus(),
|
||||
MapUtil.<String, Object>builder().put("expressName", express.getName())
|
||||
MapUtil.<String, Object>builder().put("deliveryName", express.getName())
|
||||
.put("logisticsNo", deliveryReqVO.getLogisticsNo()).build());
|
||||
|
||||
// TODO 发送售后消息
|
||||
|
@ -83,7 +83,7 @@ public class TradeBrokerageOrderHandler implements TradeOrderHandler {
|
||||
if (order.getBrokerageUserId() == null) {
|
||||
return;
|
||||
}
|
||||
cancelBrokerage(order.getId(), orderItem.getOrderId());
|
||||
cancelBrokerage(order.getBrokerageUserId(), orderItem.getOrderId());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user