Commit b1e0129046b8d2700d0093dbfde99a72a5d24a46
Merge remote-tracking branch 'origin/feature/mall_product' into feature/mall_product
# Conflicts: # sql/mysql/statistics.sql
Showing
25 changed files
with
263 additions
and
309 deletions
sql/mysql/member.sql deleted
sql/mysql/pay_wallet.sql
| ... | ... | @@ -126,7 +126,7 @@ CREATE TABLE `pay_wallet_recharge` ( |
| 126 | 126 | PRIMARY KEY (`id`) USING BTREE |
| 127 | 127 | ) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic; |
| 128 | 128 | |
| 129 | --- 钱包充值套餐菜单脚本 | |
| 129 | +-- 钱包充值套餐,钱包余额菜单脚本 | |
| 130 | 130 | |
| 131 | 131 | INSERT INTO system_menu( |
| 132 | 132 | name, permission, type, sort, parent_id, |
| ... | ... | @@ -136,13 +136,14 @@ VALUES ( |
| 136 | 136 | '钱包管理', '', 1, 5, 1117, |
| 137 | 137 | 'wallet', 'ep:caret-right', '', 0, '' |
| 138 | 138 | ); |
| 139 | -SELECT @parentId := LAST_INSERT_ID(); | |
| 139 | +SELECT @parentId1 := LAST_INSERT_ID(); | |
| 140 | + | |
| 140 | 141 | INSERT INTO system_menu( |
| 141 | 142 | name, permission, type, sort, parent_id, |
| 142 | 143 | path, icon, component, status, component_name |
| 143 | 144 | ) |
| 144 | 145 | VALUES ( |
| 145 | - '充值套餐', '', 2, 2, @parentId, | |
| 146 | + '充值套餐', '', 2, 2, @parentId1, | |
| 146 | 147 | 'wallet-recharge-package', 'fa:leaf', 'pay/wallet/rechargePackage/index', 0, 'WalletRechargePackage' |
| 147 | 148 | ); |
| 148 | 149 | SELECT @parentId := LAST_INSERT_ID(); |
| ... | ... | @@ -180,3 +181,25 @@ VALUES ( |
| 180 | 181 | '钱包充值套餐删除', 'pay:wallet-recharge-package:delete', 3, 4, @parentId, |
| 181 | 182 | '', '', '', 0 |
| 182 | 183 | ); |
| 184 | + | |
| 185 | +INSERT INTO system_menu( | |
| 186 | + name, permission, type, sort, parent_id, | |
| 187 | + path, icon, component, status, component_name | |
| 188 | +) | |
| 189 | +VALUES ( | |
| 190 | + '钱包余额', '', 2, 1, @parentId1, | |
| 191 | + 'wallet-balance', 'fa:leaf', 'pay/wallet/balance/index', 0, 'WalletBalance' | |
| 192 | + ); | |
| 193 | + | |
| 194 | +SELECT @parentId := LAST_INSERT_ID(); | |
| 195 | + | |
| 196 | +-- 按钮 SQL | |
| 197 | +INSERT INTO system_menu( | |
| 198 | + name, permission, type, sort, parent_id, | |
| 199 | + path, icon, component, status | |
| 200 | +) | |
| 201 | +VALUES ( | |
| 202 | + '钱包余额查询', 'pay:wallet:query', 3, 1, @parentId, | |
| 203 | + '', '', '', 0 | |
| 204 | + ); | |
| 205 | + | ... | ... |
sql/mysql/statistics.sql deleted
| 1 | --- 交易统计表 | |
| 2 | -CREATE TABLE trade_statistics | |
| 3 | -( | |
| 4 | - id bigint AUTO_INCREMENT COMMENT '编号,主键自增' | |
| 5 | - PRIMARY KEY, | |
| 6 | - time datetime NOT NULL COMMENT '统计日期', | |
| 7 | - order_create_count int DEFAULT 0 NOT NULL COMMENT '创建订单数', | |
| 8 | - order_pay_count int DEFAULT 0 NOT NULL COMMENT '支付订单商品数', | |
| 9 | - order_pay_price int DEFAULT 0 NOT NULL COMMENT '总支付金额,单位:分', | |
| 10 | - after_sale_count int DEFAULT 0 NOT NULL COMMENT '退款订单数', | |
| 11 | - after_sale_refund_price int DEFAULT 0 NOT NULL COMMENT '总退款金额,单位:分', | |
| 12 | - brokerage_settlement_price int DEFAULT 0 NOT NULL COMMENT '佣金金额(已结算),单位:分', | |
| 13 | - wallet_pay_price int DEFAULT 0 NOT NULL COMMENT '总支付金额(余额),单位:分', | |
| 14 | - recharge_pay_count int DEFAULT 0 NOT NULL COMMENT '充值订单数', | |
| 15 | - recharge_pay_price int DEFAULT 0 NOT NULL COMMENT '充值金额,单位:分', | |
| 16 | - recharge_refund_count int DEFAULT 0 NOT NULL COMMENT '充值退款订单数', | |
| 17 | - recharge_refund_price int DEFAULT 0 NOT NULL COMMENT '充值退款金额,单位:分', | |
| 18 | - creator varchar(64) DEFAULT '' NULL COMMENT '创建者', | |
| 19 | - create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', | |
| 20 | - updater varchar(64) DEFAULT '' NULL COMMENT '更新者', | |
| 21 | - update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | |
| 22 | - deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除', | |
| 23 | - tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号' | |
| 24 | -) | |
| 25 | - COMMENT '交易统计表'; | |
| 26 | - | |
| 27 | -CREATE INDEX trade_statistics_time_index | |
| 28 | - ON trade_statistics (time); | |
| 29 | - | |
| 30 | --- 菜单 | |
| 31 | -INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) | |
| 32 | -VALUES ('统计管理', '', 1, 4, 0, '/statistics', 'ep:data-line', '', ''); | |
| 33 | -SELECT @parentId := LAST_INSERT_ID(); | |
| 34 | --- 交易统计 | |
| 35 | -INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) | |
| 36 | -VALUES ('交易统计', '', 2, 1, @parentId, 'trade', 'fa-solid:credit-card', 'statistics/trade/index', 'TradeStatistics'); | |
| 37 | -SELECT @parentId := LAST_INSERT_ID(); | |
| 38 | -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) | |
| 39 | -VALUES ('交易统计查询', 'statistics:trade:query', 3, 1, @parentId, '', '', '', 0); | |
| 40 | -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) | |
| 41 | -VALUES ('交易统计导出', 'statistics:trade:export', 3, 2, @parentId, '', '', '', 0); | |
| 42 | --- 会员统计 | |
| 43 | -INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name) | |
| 44 | -VALUES ('会员统计', '', 2, 2, @parentId, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics'); | |
| 45 | -SELECT @parentId := LAST_INSERT_ID(); | |
| 46 | -INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status) | |
| 47 | -VALUES ('会员统计查询', 'statistics:member:query', 3, 1, @parentId, '', '', '', 0); | |
| 48 | - | |
| 49 | - |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java
| ... | ... | @@ -111,9 +111,10 @@ public interface ErrorCodeConstants { |
| 111 | 111 | ErrorCode BARGAIN_HELP_CREATE_FAIL_HELP_EXISTS = new ErrorCode(1_013_014_004, "助力失败,您已经助力过了"); |
| 112 | 112 | |
| 113 | 113 | // ========== 文章分类 1-013-015-000 ========== |
| 114 | - ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "分类不存在"); | |
| 114 | + ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "文章分类不存在"); | |
| 115 | + ErrorCode ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES = new ErrorCode(1_013_015_001, "文章分类删除失败,存在关联文章"); | |
| 115 | 116 | |
| 116 | 117 | // ========== 文章管理 1-013-016-000 ========== |
| 117 | - ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章管理不存在"); | |
| 118 | + ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在"); | |
| 118 | 119 | |
| 119 | 120 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleCategoryController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.article; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; |
| 6 | +import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; | |
| 7 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 8 | +import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService; | |
| 5 | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 7 | 11 | import org.springframework.validation.annotation.Validated; |
| 8 | 12 | import org.springframework.web.bind.annotation.RequestMapping; |
| 9 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 10 | 14 | |
| 11 | -import java.util.ArrayList; | |
| 15 | +import javax.annotation.Resource; | |
| 12 | 16 | import java.util.List; |
| 13 | -import java.util.Random; | |
| 14 | 17 | |
| 15 | 18 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 16 | 19 | |
| ... | ... | @@ -20,20 +23,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 20 | 23 | @Validated |
| 21 | 24 | public class AppArticleCategoryController { |
| 22 | 25 | |
| 26 | + @Resource | |
| 27 | + private ArticleCategoryService articleCategoryService; | |
| 28 | + | |
| 23 | 29 | @RequestMapping("/list") |
| 24 | 30 | @Operation(summary = "获得文章分类列表") |
| 25 | - // TODO @芋艿:swagger 注解 | |
| 26 | 31 | public CommonResult<List<AppArticleCategoryRespVO>> getArticleCategoryList() { |
| 27 | - List<AppArticleCategoryRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 28 | - Random random = new Random(); | |
| 29 | - for (int i = 0; i < 10; i++) { | |
| 30 | - AppArticleCategoryRespVO appArticleRespVO = new AppArticleCategoryRespVO(); | |
| 31 | - appArticleRespVO.setId((long) (i + 1)); | |
| 32 | - appArticleRespVO.setName("分类 - " + i); | |
| 33 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 34 | - appArticleRespVOList.add(appArticleRespVO); | |
| 35 | - } | |
| 36 | - return success(appArticleRespVOList); | |
| 32 | + List<ArticleCategoryDO> categoryList = articleCategoryService.getArticleCategoryListByStatus( | |
| 33 | + CommonStatusEnum.ENABLE.getStatus()); | |
| 34 | + // TODO @puhui999:排序下 | |
| 35 | + return success(ArticleCategoryConvert.INSTANCE.convertList04(categoryList)); | |
| 37 | 36 | } |
| 38 | 37 | |
| 39 | 38 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/AppArticleController.java
| ... | ... | @@ -4,16 +4,19 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; | |
| 8 | +import cn.iocoder.yudao.module.promotion.service.article.ArticleService; | |
| 9 | +import io.swagger.v3.oas.annotations.Operation; | |
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 11 | +import io.swagger.v3.oas.annotations.Parameters; | |
| 7 | 12 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 8 | 13 | import org.springframework.validation.annotation.Validated; |
| 9 | 14 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 15 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | 16 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 17 | |
| 13 | -import java.time.LocalDateTime; | |
| 14 | -import java.util.ArrayList; | |
| 18 | +import javax.annotation.Resource; | |
| 15 | 19 | import java.util.List; |
| 16 | -import java.util.Random; | |
| 17 | 20 | |
| 18 | 21 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 19 | 22 | |
| ... | ... | @@ -23,68 +26,34 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 23 | 26 | @Validated |
| 24 | 27 | public class AppArticleController { |
| 25 | 28 | |
| 29 | + @Resource | |
| 30 | + private ArticleService articleService; | |
| 31 | + | |
| 26 | 32 | @RequestMapping("/list") |
| 27 | - // TODO @芋艿:swagger 注解 | |
| 28 | - public CommonResult<List<AppArticleRespVO>> getArticleList(@RequestParam(value = "recommendHot", required = false) Boolean recommendHot, | |
| 29 | - @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { | |
| 30 | - List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 31 | - Random random = new Random(); | |
| 32 | - for (int i = 0; i < 10; i++) { | |
| 33 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 34 | - appArticleRespVO.setId((long) (i + 1)); | |
| 35 | - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); | |
| 36 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 37 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 38 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 39 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 40 | - appArticleRespVO.setDescription("我是详细"); | |
| 41 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 42 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 43 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 44 | - appArticleRespVOList.add(appArticleRespVO); | |
| 45 | - } | |
| 46 | - return success(appArticleRespVOList); | |
| 33 | + @Operation(summary = "获得文章详情列表") | |
| 34 | + @Parameters({ | |
| 35 | + @Parameter(name = "recommendHot", description = "是否热门", example = "false"), // 场景一:查看指定的文章 | |
| 36 | + @Parameter(name = "recommendBanner", description = "是否轮播图", example = "false") // 场景二:查看指定的文章 | |
| 37 | + }) | |
| 38 | + public CommonResult<List<AppArticleRespVO>> getArticleList( | |
| 39 | + @RequestParam(value = "recommendHot", required = false) Boolean recommendHot, | |
| 40 | + @RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) { | |
| 41 | + return success(ArticleConvert.INSTANCE.convertList03( | |
| 42 | + articleService.getArticleCategoryListByRecommend(recommendHot, recommendBanner))); | |
| 47 | 43 | } |
| 48 | 44 | |
| 49 | 45 | @RequestMapping("/page") |
| 50 | - // TODO @芋艿:swagger 注解 | |
| 46 | + @Operation(summary = "获得文章详情分页") | |
| 51 | 47 | public CommonResult<PageResult<AppArticleRespVO>> getArticlePage(AppArticlePageReqVO pageReqVO) { |
| 52 | - List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>(); | |
| 53 | - Random random = new Random(); | |
| 54 | - for (int i = 0; i < 10; i++) { | |
| 55 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 56 | - appArticleRespVO.setId((long) (i + 1)); | |
| 57 | - appArticleRespVO.setTitle("芋道源码 - " + i + "模块"); | |
| 58 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 59 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 60 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png"); | |
| 61 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 62 | - appArticleRespVO.setDescription("我是详细"); | |
| 63 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 64 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 65 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 66 | - appArticleRespVOList.add(appArticleRespVO); | |
| 67 | - } | |
| 68 | - return success(new PageResult<>(appArticleRespVOList, 10L)); | |
| 48 | + return success(ArticleConvert.INSTANCE.convertPage02(articleService.getArticlePage(pageReqVO))); | |
| 69 | 49 | } |
| 70 | 50 | |
| 71 | 51 | @RequestMapping("/get") |
| 72 | - // TODO @芋艿:swagger 注解 | |
| 52 | + @Operation(summary = "获得文章详情") | |
| 53 | + @Parameter(name = "id", description = "文章编号", example = "1024") | |
| 73 | 54 | public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) { |
| 74 | - Random random = new Random(); | |
| 75 | - AppArticleRespVO appArticleRespVO = new AppArticleRespVO(); | |
| 76 | - appArticleRespVO.setId((long) (1)); | |
| 77 | - appArticleRespVO.setTitle("芋道源码 - " + 0 + "模块"); | |
| 78 | - appArticleRespVO.setAuthor("芋道源码"); | |
| 79 | - appArticleRespVO.setCategoryId((long) random.nextInt(10000)); | |
| 80 | - appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (0 + 1) + ".png"); | |
| 81 | - appArticleRespVO.setIntroduction("我是简介"); | |
| 82 | - appArticleRespVO.setDescription("我是详细"); | |
| 83 | - appArticleRespVO.setCreateTime(LocalDateTime.now()); | |
| 84 | - appArticleRespVO.setBrowseCount(random.nextInt(10000)); | |
| 85 | - appArticleRespVO.setSpuId((long) random.nextInt(10000)); | |
| 86 | - appArticleRespVO.setSpuId(633L); | |
| 87 | - return success(appArticleRespVO); | |
| 55 | + return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id))); | |
| 88 | 56 | } |
| 89 | 57 | |
| 58 | + // TODO @puhui999:增加浏览量,实现一个接口;先简单做,用户规模不大,只 +1 即可;ps:uniapp 那边也要接下噢 | |
| 90 | 59 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/article/AppArticleRespVO.java
| ... | ... | @@ -39,11 +39,4 @@ public class AppArticleRespVO { |
| 39 | 39 | @Schema(description = "关联的商品 SPU 编号", example = "1024") |
| 40 | 40 | private Long spuId; |
| 41 | 41 | |
| 42 | -// TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; | |
| 43 | -// @Schema(description = "是否热卖推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 44 | -// private Boolean recommendHot; | |
| 45 | -// | |
| 46 | -// @Schema(description = "是否 Banner 推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | |
| 47 | -// private Boolean recommendBanner; | |
| 48 | - | |
| 49 | 42 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/article/vo/category/AppArticleCategoryRespVO.java
| ... | ... | @@ -16,11 +16,4 @@ public class AppArticleCategoryRespVO { |
| 16 | 16 | @Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png") |
| 17 | 17 | private String picUrl; |
| 18 | 18 | |
| 19 | - // TODO 芋艿:下面 2 个字段,后端要存储,前端不用返回; | |
| 20 | -// @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 21 | -// private Integer status; | |
| 22 | -// | |
| 23 | -// @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 24 | -// private Integer sort; | |
| 25 | - | |
| 26 | 19 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleCategoryConvert.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.convert.article; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*; |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO; | |
| 5 | 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; |
| 6 | 7 | import org.mapstruct.Mapper; |
| 7 | 8 | import org.mapstruct.factory.Mappers; |
| ... | ... | @@ -30,4 +31,6 @@ public interface ArticleCategoryConvert { |
| 30 | 31 | |
| 31 | 32 | List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list); |
| 32 | 33 | |
| 34 | + List<AppArticleCategoryRespVO> convertList04(List<ArticleCategoryDO> categoryList); | |
| 35 | + | |
| 33 | 36 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/article/ArticleConvert.java
| ... | ... | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 8 | 9 | import org.mapstruct.Mapper; |
| 9 | 10 | import org.mapstruct.factory.Mappers; |
| ... | ... | @@ -30,4 +31,10 @@ public interface ArticleConvert { |
| 30 | 31 | |
| 31 | 32 | PageResult<ArticleRespVO> convertPage(PageResult<ArticleDO> page); |
| 32 | 33 | |
| 34 | + AppArticleRespVO convert01(ArticleDO article); | |
| 35 | + | |
| 36 | + PageResult<AppArticleRespVO> convertPage02(PageResult<ArticleDO> articlePage); | |
| 37 | + | |
| 38 | + List<AppArticleRespVO> convertList03(List<ArticleDO> articleCategoryListByRecommendHotAndRecommendBanner); | |
| 39 | + | |
| 33 | 40 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java
| ... | ... | @@ -207,31 +207,30 @@ public interface CombinationActivityConvert { |
| 207 | 207 | /** |
| 208 | 208 | * 转换生成虚拟成团虚拟记录 |
| 209 | 209 | * |
| 210 | - * @param virtualGroupHeadRecords 虚拟成团团长记录列表 | |
| 210 | + * @param virtualGroupHeadRecord 虚拟成团团长记录 | |
| 211 | 211 | * @return 虚拟记录列表 |
| 212 | 212 | */ |
| 213 | - default List<CombinationRecordDO> convertVirtualGroupList(List<CombinationRecordDO> virtualGroupHeadRecords) { | |
| 213 | + // TODO @puhui999:1)方法名,建议改成 convertVirtualRecordList(CombinationRecordDO headRecord);2)第 220 到 225 可以搞成 mapstruct 一个方法,默认都 copy 进去,然后 set 第 226 到 232 的字段 | |
| 214 | + default List<CombinationRecordDO> convertVirtualGroupList(CombinationRecordDO virtualGroupHeadRecord) { | |
| 214 | 215 | List<CombinationRecordDO> createRecords = new ArrayList<>(); |
| 215 | - virtualGroupHeadRecords.forEach(headRecord -> { | |
| 216 | - // 计算需要创建的虚拟成团记录数量 | |
| 217 | - int count = headRecord.getUserSize() - headRecord.getUserCount(); | |
| 218 | - for (int i = 0; i < count; i++) { | |
| 219 | - // 基础信息和团长保持一致 | |
| 220 | - CombinationRecordDO newRecord = new CombinationRecordDO().setActivityId(headRecord.getActivityId()) | |
| 221 | - .setCombinationPrice(headRecord.getCombinationPrice()).setSpuId(headRecord.getSpuId()).setSpuName(headRecord.getSpuName()) | |
| 222 | - .setPicUrl(headRecord.getPicUrl()).setSkuId(headRecord.getSkuId()).setHeadId(headRecord.getId()) | |
| 223 | - .setStatus(headRecord.getStatus()) // 状态保持和创建时一致,创建完成后会接着处理 | |
| 224 | - .setVirtualGroup(headRecord.getVirtualGroup()).setExpireTime(headRecord.getExpireTime()) | |
| 225 | - .setStartTime(headRecord.getStartTime()).setUserSize(headRecord.getUserSize()).setUserCount(headRecord.getUserCount()); | |
| 226 | - // 虚拟信息 | |
| 227 | - newRecord.setCount(0); | |
| 228 | - newRecord.setUserId(0L); | |
| 229 | - newRecord.setNickname(""); | |
| 230 | - newRecord.setAvatar(""); | |
| 231 | - newRecord.setOrderId(0L); | |
| 232 | - createRecords.add(newRecord); | |
| 233 | - } | |
| 234 | - }); | |
| 216 | + // 计算需要创建的虚拟成团记录数量 | |
| 217 | + int count = virtualGroupHeadRecord.getUserSize() - virtualGroupHeadRecord.getUserCount(); | |
| 218 | + for (int i = 0; i < count; i++) { | |
| 219 | + // 基础信息和团长保持一致 | |
| 220 | + CombinationRecordDO newRecord = new CombinationRecordDO().setActivityId(virtualGroupHeadRecord.getActivityId()) | |
| 221 | + .setCombinationPrice(virtualGroupHeadRecord.getCombinationPrice()).setSpuId(virtualGroupHeadRecord.getSpuId()).setSpuName(virtualGroupHeadRecord.getSpuName()) | |
| 222 | + .setPicUrl(virtualGroupHeadRecord.getPicUrl()).setSkuId(virtualGroupHeadRecord.getSkuId()).setHeadId(virtualGroupHeadRecord.getId()) | |
| 223 | + .setStatus(virtualGroupHeadRecord.getStatus()) // 状态保持和创建时一致,创建完成后会接着处理 | |
| 224 | + .setVirtualGroup(virtualGroupHeadRecord.getVirtualGroup()).setExpireTime(virtualGroupHeadRecord.getExpireTime()) | |
| 225 | + .setStartTime(virtualGroupHeadRecord.getStartTime()).setUserSize(virtualGroupHeadRecord.getUserSize()).setUserCount(virtualGroupHeadRecord.getUserCount()); | |
| 226 | + // 虚拟信息 | |
| 227 | + newRecord.setCount(0); | |
| 228 | + newRecord.setUserId(0L); | |
| 229 | + newRecord.setNickname(""); | |
| 230 | + newRecord.setAvatar(""); | |
| 231 | + newRecord.setOrderId(0L); | |
| 232 | + createRecords.add(newRecord); | |
| 233 | + } | |
| 235 | 234 | return createRecords; |
| 236 | 235 | } |
| 237 | 236 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/article/ArticleMapper.java
| ... | ... | @@ -4,9 +4,12 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 8 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 10 | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 10 | 13 | /** |
| 11 | 14 | * 文章管理 Mapper |
| 12 | 15 | * |
| ... | ... | @@ -28,4 +31,16 @@ public interface ArticleMapper extends BaseMapperX<ArticleDO> { |
| 28 | 31 | .orderByDesc(ArticleDO::getId)); |
| 29 | 32 | } |
| 30 | 33 | |
| 34 | + default List<ArticleDO> selectList(Boolean recommendHot, Boolean recommendBanner) { | |
| 35 | + return selectList(new LambdaQueryWrapperX<ArticleDO>() | |
| 36 | + .eqIfPresent(ArticleDO::getRecommendHot, recommendHot) | |
| 37 | + .eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner)); | |
| 38 | + } | |
| 39 | + | |
| 40 | + default PageResult<ArticleDO> selectPage(AppArticlePageReqVO pageReqVO) { | |
| 41 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<ArticleDO>() | |
| 42 | + .eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId())); | |
| 43 | + } | |
| 44 | + | |
| 45 | + | |
| 31 | 46 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationRecordMapper.java
| ... | ... | @@ -127,11 +127,9 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO |
| 127 | 127 | * |
| 128 | 128 | * @return 参加过拼团的用户数 |
| 129 | 129 | */ |
| 130 | - // TODO @puhui999:1)方法名,直接 selectUserCount;2)COUNT(DISTINCT(user_id)) 就可以啦,不用 group by 哈 | |
| 131 | - default Long selectUserDistinctCount() { | |
| 130 | + default Long selectUserCount() { | |
| 132 | 131 | return selectCount(new QueryWrapper<CombinationRecordDO>() |
| 133 | - .select("DISTINCT (user_id)") | |
| 134 | - .groupBy("user_id")); | |
| 132 | + .select("DISTINCT (user_id)")); | |
| 135 | 133 | } |
| 136 | 134 | |
| 137 | 135 | default List<CombinationRecordDO> selectListByHeadIdAndStatusAndExpireTimeLt(Long headId, Integer status, LocalDateTime dateTime) { |
| ... | ... | @@ -141,8 +139,8 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO |
| 141 | 139 | .lt(CombinationRecordDO::getExpireTime, dateTime)); |
| 142 | 140 | } |
| 143 | 141 | |
| 144 | - default List<CombinationRecordDO> selectListByHeadIds(Collection<Long> headIds) { | |
| 145 | - return selectList(new LambdaQueryWrapperX<CombinationRecordDO>().in(CombinationRecordDO::getHeadId, headIds)); | |
| 142 | + default List<CombinationRecordDO> selectListByHeadId(Long headId) { | |
| 143 | + return selectList(CombinationRecordDO::getHeadId, headId); | |
| 146 | 144 | } |
| 147 | 145 | |
| 148 | 146 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleCategoryServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.service.article; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO; |
| 5 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO; |
| 6 | 7 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert; |
| 8 | 9 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; |
| 10 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; | |
| 9 | 11 | import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleCategoryMapper; |
| 12 | +import org.springframework.context.annotation.Lazy; | |
| 10 | 13 | import org.springframework.stereotype.Service; |
| 11 | 14 | import org.springframework.validation.annotation.Validated; |
| 12 | 15 | |
| ... | ... | @@ -14,6 +17,7 @@ import javax.annotation.Resource; |
| 14 | 17 | import java.util.List; |
| 15 | 18 | |
| 16 | 19 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES; | |
| 17 | 21 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; |
| 18 | 22 | |
| 19 | 23 | /** |
| ... | ... | @@ -28,6 +32,10 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { |
| 28 | 32 | @Resource |
| 29 | 33 | private ArticleCategoryMapper articleCategoryMapper; |
| 30 | 34 | |
| 35 | + @Resource | |
| 36 | + @Lazy // 延迟加载,解决循环依赖问题 | |
| 37 | + private ArticleService articleService; | |
| 38 | + | |
| 31 | 39 | @Override |
| 32 | 40 | public Long createArticleCategory(ArticleCategoryCreateReqVO createReqVO) { |
| 33 | 41 | // 插入 |
| ... | ... | @@ -50,7 +58,12 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { |
| 50 | 58 | public void deleteArticleCategory(Long id) { |
| 51 | 59 | // 校验存在 |
| 52 | 60 | validateArticleCategoryExists(id); |
| 53 | - // TODO @puhui999:需要校验下,是不是存在文章 | |
| 61 | + // 校验是不是存在关联文章 | |
| 62 | + // TODO @puhui999:最好获得数量哈; | |
| 63 | + List<ArticleDO> articleList = articleService.getArticleByCategoryId(id); | |
| 64 | + if (CollUtil.isNotEmpty(articleList)) { | |
| 65 | + throw exception(ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES); | |
| 66 | + } | |
| 54 | 67 | |
| 55 | 68 | // 删除 |
| 56 | 69 | articleCategoryMapper.deleteById(id); |
| ... | ... | @@ -74,6 +87,7 @@ public class ArticleCategoryServiceImpl implements ArticleCategoryService { |
| 74 | 87 | |
| 75 | 88 | @Override |
| 76 | 89 | public List<ArticleCategoryDO> getArticleCategoryListByStatus(Integer status) { |
| 90 | + // TODO @puhui999:selectListByStatus | |
| 77 | 91 | return articleCategoryMapper.selectList(ArticleCategoryDO::getStatus, status); |
| 78 | 92 | } |
| 79 | 93 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleService.java
| ... | ... | @@ -4,19 +4,21 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 8 | 9 | |
| 9 | 10 | import javax.validation.Valid; |
| 11 | +import java.util.List; | |
| 10 | 12 | |
| 11 | 13 | /** |
| 12 | - * 文章管理 Service 接口 | |
| 14 | + * 文章详情 Service 接口 | |
| 13 | 15 | * |
| 14 | 16 | * @author HUIHUI |
| 15 | 17 | */ |
| 16 | 18 | public interface ArticleService { |
| 17 | 19 | |
| 18 | 20 | /** |
| 19 | - * 创建文章管理 | |
| 21 | + * 创建文章详情 | |
| 20 | 22 | * |
| 21 | 23 | * @param createReqVO 创建信息 |
| 22 | 24 | * @return 编号 |
| ... | ... | @@ -24,33 +26,58 @@ public interface ArticleService { |
| 24 | 26 | Long createArticle(@Valid ArticleCreateReqVO createReqVO); |
| 25 | 27 | |
| 26 | 28 | /** |
| 27 | - * 更新文章管理 | |
| 29 | + * 更新文章详情 | |
| 28 | 30 | * |
| 29 | 31 | * @param updateReqVO 更新信息 |
| 30 | 32 | */ |
| 31 | 33 | void updateArticle(@Valid ArticleUpdateReqVO updateReqVO); |
| 32 | 34 | |
| 33 | 35 | /** |
| 34 | - * 删除文章管理 | |
| 36 | + * 删除文章详情 | |
| 35 | 37 | * |
| 36 | 38 | * @param id 编号 |
| 37 | 39 | */ |
| 38 | 40 | void deleteArticle(Long id); |
| 39 | 41 | |
| 40 | 42 | /** |
| 41 | - * 获得文章管理 | |
| 43 | + * 获得文章详情 | |
| 42 | 44 | * |
| 43 | 45 | * @param id 编号 |
| 44 | - * @return 文章管理 | |
| 46 | + * @return 文章详情 | |
| 45 | 47 | */ |
| 46 | 48 | ArticleDO getArticle(Long id); |
| 47 | 49 | |
| 48 | 50 | /** |
| 49 | - * 获得文章管理分页 | |
| 51 | + * 获得文章详情分页 | |
| 50 | 52 | * |
| 51 | 53 | * @param pageReqVO 分页查询 |
| 52 | - * @return 文章管理分页 | |
| 54 | + * @return 文章详情分页 | |
| 53 | 55 | */ |
| 54 | 56 | PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO); |
| 55 | 57 | |
| 58 | + /** | |
| 59 | + * 获得文章详情列表 | |
| 60 | + * | |
| 61 | + * @param recommendHot 是否热门 | |
| 62 | + * @param recommendBanner 是否轮播图 | |
| 63 | + * @return 文章详情列表 | |
| 64 | + */ | |
| 65 | + List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner); | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * 获得文章详情分页 | |
| 69 | + * | |
| 70 | + * @param pageReqVO 分页查询 | |
| 71 | + * @return 文章详情分页 | |
| 72 | + */ | |
| 73 | + PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO); | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * 获得指定分类的文章列表 | |
| 77 | + * | |
| 78 | + * @param categoryId 文章分类编号 | |
| 79 | + * @return 文章列表 | |
| 80 | + */ | |
| 81 | + List<ArticleDO> getArticleByCategoryId(Long categoryId); | |
| 82 | + | |
| 56 | 83 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImpl.java
| ... | ... | @@ -4,15 +4,19 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; |
| 6 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert; |
| 9 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO; | |
| 8 | 10 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| 9 | 11 | import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper; |
| 10 | 12 | import org.springframework.stereotype.Service; |
| 11 | 13 | import org.springframework.validation.annotation.Validated; |
| 12 | 14 | |
| 13 | 15 | import javax.annotation.Resource; |
| 16 | +import java.util.List; | |
| 14 | 17 | |
| 15 | 18 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 19 | +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS; | |
| 16 | 20 | import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS; |
| 17 | 21 | |
| 18 | 22 | /** |
| ... | ... | @@ -27,9 +31,14 @@ public class ArticleServiceImpl implements ArticleService { |
| 27 | 31 | @Resource |
| 28 | 32 | private ArticleMapper articleMapper; |
| 29 | 33 | |
| 34 | + @Resource | |
| 35 | + private ArticleCategoryService articleCategoryService; | |
| 36 | + | |
| 30 | 37 | @Override |
| 31 | 38 | public Long createArticle(ArticleCreateReqVO createReqVO) { |
| 32 | - // TODO @puhui999:需要校验分类存在 | |
| 39 | + // 校验分类存在 | |
| 40 | + validateArticleCategoryExists(createReqVO.getCategoryId()); | |
| 41 | + | |
| 33 | 42 | // 插入 |
| 34 | 43 | ArticleDO article = ArticleConvert.INSTANCE.convert(createReqVO); |
| 35 | 44 | articleMapper.insert(article); |
| ... | ... | @@ -41,7 +50,8 @@ public class ArticleServiceImpl implements ArticleService { |
| 41 | 50 | public void updateArticle(ArticleUpdateReqVO updateReqVO) { |
| 42 | 51 | // 校验存在 |
| 43 | 52 | validateArticleExists(updateReqVO.getId()); |
| 44 | - // TODO @puhui999:需要校验分类存在 | |
| 53 | + // 校验分类存在 | |
| 54 | + validateArticleCategoryExists(updateReqVO.getCategoryId()); | |
| 45 | 55 | |
| 46 | 56 | // 更新 |
| 47 | 57 | ArticleDO updateObj = ArticleConvert.INSTANCE.convert(updateReqVO); |
| ... | ... | @@ -62,6 +72,13 @@ public class ArticleServiceImpl implements ArticleService { |
| 62 | 72 | } |
| 63 | 73 | } |
| 64 | 74 | |
| 75 | + private void validateArticleCategoryExists(Long categoryId) { | |
| 76 | + ArticleCategoryDO articleCategory = articleCategoryService.getArticleCategory(categoryId); | |
| 77 | + if (articleCategory == null) { | |
| 78 | + throw exception(ARTICLE_CATEGORY_NOT_EXISTS); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 65 | 82 | @Override |
| 66 | 83 | public ArticleDO getArticle(Long id) { |
| 67 | 84 | return articleMapper.selectById(id); |
| ... | ... | @@ -72,4 +89,19 @@ public class ArticleServiceImpl implements ArticleService { |
| 72 | 89 | return articleMapper.selectPage(pageReqVO); |
| 73 | 90 | } |
| 74 | 91 | |
| 92 | + @Override | |
| 93 | + public List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner) { | |
| 94 | + return articleMapper.selectList(recommendHot, recommendBanner); | |
| 95 | + } | |
| 96 | + | |
| 97 | + @Override | |
| 98 | + public PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO) { | |
| 99 | + return articleMapper.selectPage(pageReqVO); | |
| 100 | + } | |
| 101 | + | |
| 102 | + @Override | |
| 103 | + public List<ArticleDO> getArticleByCategoryId(Long categoryId) { | |
| 104 | + return articleMapper.selectList(ArticleDO::getCategoryId, categoryId); | |
| 105 | + } | |
| 106 | + | |
| 75 | 107 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java
| ... | ... | @@ -247,7 +247,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 247 | 247 | |
| 248 | 248 | @Override |
| 249 | 249 | public Long getCombinationUserCount() { |
| 250 | - return combinationRecordMapper.selectUserDistinctCount(); | |
| 250 | + return combinationRecordMapper.selectUserCount(); | |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | @Override |
| ... | ... | @@ -351,86 +351,87 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 351 | 351 | convertSet(headExpireRecords, CombinationRecordDO::getActivityId)); |
| 352 | 352 | Map<Long, CombinationActivityDO> activityMap = convertMap(activities, CombinationActivityDO::getId); |
| 353 | 353 | |
| 354 | - // TODO @puhui999:这里可以改成“每个团”,处理一次哈;这样 handleExpireRecord、handleVirtualGroupRecord 都改成按团处理,每个是一个小事务; | |
| 355 | - // 3. 校验是否虚拟成团 | |
| 356 | - List<CombinationRecordDO> virtualGroupHeadRecords = new ArrayList<>(); // 虚拟成团 | |
| 357 | - for (Iterator<CombinationRecordDO> iterator = headExpireRecords.iterator(); iterator.hasNext(); ) { | |
| 358 | - CombinationRecordDO record = iterator.next(); | |
| 359 | - // 3.1.不匹配,则直接跳过 | |
| 360 | - CombinationActivityDO activity = activityMap.get(record.getActivityId()); | |
| 361 | - if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的 | |
| 362 | - continue; | |
| 354 | + // 3. 逐个处理拼团,过期 or 虚拟成团 | |
| 355 | + KeyValue<Integer, Integer> keyValue = new KeyValue<>(0, 0); // 统计过期拼团和虚拟成团 | |
| 356 | + for (CombinationRecordDO recordDO : headExpireRecords) { | |
| 357 | + // TODO @puhui999:recordDO 非必要的情况下,不用带 DO;直接 record; | |
| 358 | + try { | |
| 359 | + CombinationActivityDO activity = activityMap.get(recordDO.getActivityId()); | |
| 360 | + if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的 | |
| 361 | + // 3.1. 处理过期的拼团 | |
| 362 | + getSelf().handleExpireRecord(recordDO); | |
| 363 | + keyValue.setKey(keyValue.getKey() + 1); | |
| 364 | + } else { | |
| 365 | + // 3.2. 处理虚拟成团 | |
| 366 | + getSelf().handleVirtualGroupRecord(recordDO); | |
| 367 | + keyValue.setValue(keyValue.getValue() + 1); | |
| 368 | + } | |
| 369 | + } catch (Exception ignored) { // 处理异常继续循环 | |
| 370 | + // TODO @puhui999:需要打印异常日志 | |
| 363 | 371 | } |
| 364 | - // 3.2.匹配,则移除,添加到虚拟成团中,并结束寻找 | |
| 365 | - virtualGroupHeadRecords.add(record); | |
| 366 | - iterator.remove(); | |
| 367 | - break; | |
| 368 | 372 | } |
| 369 | - | |
| 370 | - // 4.处理过期的拼团 | |
| 371 | - getSelf().handleExpireRecord(headExpireRecords); | |
| 372 | - // 5.虚拟成团 | |
| 373 | - getSelf().handleVirtualGroupRecord(virtualGroupHeadRecords); | |
| 374 | - return new KeyValue<>(headExpireRecords.size(), virtualGroupHeadRecords.size()); | |
| 373 | + return keyValue; | |
| 375 | 374 | } |
| 376 | 375 | |
| 377 | 376 | /** |
| 378 | 377 | * 处理过期拼团 |
| 379 | 378 | * |
| 380 | - * @param headExpireRecords 过期拼团团长记录列表 | |
| 379 | + * @param headExpireRecord 过期拼团团长记录列表 | |
| 381 | 380 | */ |
| 382 | 381 | @Transactional(rollbackFor = Exception.class) |
| 383 | - public void handleExpireRecord(List<CombinationRecordDO> headExpireRecords) { | |
| 384 | - if (CollUtil.isEmpty(headExpireRecords)) { | |
| 382 | + public void handleExpireRecord(CombinationRecordDO headExpireRecord) { | |
| 383 | + // TODO @puhui999:这里的 null 其实不用判断。真出现,应该要处个 npe,因为就是要错哈; | |
| 384 | + // TODO @puhui999:headExpireRecord 可以简化成 headRecord | |
| 385 | + if (headExpireRecord == null) { | |
| 385 | 386 | return; |
| 386 | 387 | } |
| 387 | 388 | |
| 388 | 389 | // 1.更新拼团记录 |
| 389 | - List<CombinationRecordDO> headsAndRecords = updateBatchCombinationRecords(headExpireRecords, | |
| 390 | + List<CombinationRecordDO> headsAndRecords = updateBatchCombinationRecords(headExpireRecord, | |
| 390 | 391 | CombinationRecordStatusEnum.FAILED); |
| 392 | + // TODO @puhui999:这里的 null 其实不用判断。真出现,应该要处个 npe,因为就是要错哈; | |
| 391 | 393 | if (headsAndRecords == null) { |
| 392 | 394 | return; |
| 393 | 395 | } |
| 394 | 396 | |
| 395 | - // 2.订单取消 TODO 以现在的取消回滚逻辑好像只能循环了 | |
| 396 | - headsAndRecords.forEach(item -> { | |
| 397 | - tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId()); | |
| 398 | - }); | |
| 397 | + // 2.订单取消 | |
| 398 | + headsAndRecords.forEach(item -> tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId())); | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | 402 | * 处理虚拟拼团 |
| 403 | 403 | * |
| 404 | - * @param virtualGroupHeadRecords 虚拟成团团长记录列表 | |
| 404 | + * @param virtualGroupHeadRecord 虚拟成团团长记录列表 | |
| 405 | 405 | */ |
| 406 | 406 | @Transactional(rollbackFor = Exception.class) |
| 407 | - public void handleVirtualGroupRecord(List<CombinationRecordDO> virtualGroupHeadRecords) { | |
| 408 | - if (CollUtil.isEmpty(virtualGroupHeadRecords)) { | |
| 407 | + public void handleVirtualGroupRecord(CombinationRecordDO virtualGroupHeadRecord) { | |
| 408 | + // TODO @puhui999:这里的 null 其实不用判断。真出现,应该要处个 npe,因为就是要错哈; | |
| 409 | + // TODO @puhui999:headExpireRecord 可以简化成 headRecord | |
| 410 | + if (virtualGroupHeadRecord == null) { | |
| 409 | 411 | return; |
| 410 | 412 | } |
| 411 | 413 | |
| 412 | 414 | // 1. 团员补齐 |
| 413 | - combinationRecordMapper.insertBatch(CombinationActivityConvert.INSTANCE.convertVirtualGroupList(virtualGroupHeadRecords)); | |
| 415 | + combinationRecordMapper.insertBatch(CombinationActivityConvert.INSTANCE.convertVirtualGroupList(virtualGroupHeadRecord)); | |
| 414 | 416 | // 2. 更新拼团记录 |
| 415 | - updateBatchCombinationRecords(virtualGroupHeadRecords, CombinationRecordStatusEnum.SUCCESS); | |
| 417 | + updateBatchCombinationRecords(virtualGroupHeadRecord, CombinationRecordStatusEnum.SUCCESS); | |
| 416 | 418 | } |
| 417 | 419 | |
| 418 | - private List<CombinationRecordDO> updateBatchCombinationRecords(List<CombinationRecordDO> headRecords, CombinationRecordStatusEnum status) { | |
| 419 | - // 1. 查询团成员 | |
| 420 | - List<CombinationRecordDO> records = combinationRecordMapper.selectListByHeadIds( | |
| 421 | - convertSet(headRecords, CombinationRecordDO::getId)); | |
| 420 | + // TODO @puhui999:写下方法注释; | |
| 421 | + private List<CombinationRecordDO> updateBatchCombinationRecords(CombinationRecordDO headRecord, CombinationRecordStatusEnum status) { | |
| 422 | + // 1. 查询团成员(包含团长) | |
| 423 | + List<CombinationRecordDO> records = combinationRecordMapper.selectListByHeadId(headRecord.getId()); | |
| 424 | + // TODO @puhui999:是不是不用判断空哈;例如说,就一个团长,然后过期。 | |
| 422 | 425 | if (CollUtil.isEmpty(records)) { |
| 423 | 426 | return null; |
| 424 | 427 | } |
| 425 | - Map<Long, List<CombinationRecordDO>> recordsMap = convertMultiMap(records, CombinationRecordDO::getHeadId); | |
| 426 | - headRecords.forEach(item -> { | |
| 427 | - recordsMap.get(item.getId()).add(item); // 把团长加进团里 | |
| 428 | - }); | |
| 429 | - // 2.批量更新拼团记录 status 和 失败/成团时间 | |
| 430 | - List<CombinationRecordDO> headsAndRecords = mergeValuesFromMap(recordsMap); | |
| 431 | - List<CombinationRecordDO> updateRecords = new ArrayList<>(headsAndRecords.size()); | |
| 428 | + records.add(headRecord);// 把团长加进去 | |
| 429 | + | |
| 430 | + // 2. 批量更新拼团记录 status 和 endTime | |
| 431 | + List<CombinationRecordDO> updateRecords = new ArrayList<>(records.size()); | |
| 432 | 432 | LocalDateTime now = LocalDateTime.now(); |
| 433 | - headsAndRecords.forEach(item -> { | |
| 433 | + records.forEach(item -> { | |
| 434 | + // TODO @puhui999:record 改成 updateRecord | |
| 434 | 435 | CombinationRecordDO record = new CombinationRecordDO().setId(item.getId()) |
| 435 | 436 | .setStatus(status.getStatus()).setEndTime(now); |
| 436 | 437 | if (CombinationRecordStatusEnum.isSuccess(status.getStatus())) { // 虚拟成团完事更改状态成功后还需要把参与人数修改为成团需要人数 |
| ... | ... | @@ -439,7 +440,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { |
| 439 | 440 | updateRecords.add(record); |
| 440 | 441 | }); |
| 441 | 442 | combinationRecordMapper.updateBatch(updateRecords); |
| 442 | - return headsAndRecords; | |
| 443 | + return records; | |
| 443 | 444 | } |
| 444 | 445 | |
| 445 | 446 | /** | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/article/ArticleServiceImplTest.java
| ... | ... | @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.promotion.service.article; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | 5 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO; |
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.ArticleExportReqVO; | |
| 7 | 6 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO; |
| 8 | 7 | import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO; |
| 9 | 8 | import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO; |
| ... | ... | @@ -13,7 +12,6 @@ import org.junit.jupiter.api.Test; |
| 13 | 12 | import org.springframework.context.annotation.Import; |
| 14 | 13 | |
| 15 | 14 | import javax.annotation.Resource; |
| 16 | -import java.util.List; | |
| 17 | 15 | |
| 18 | 16 | import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.buildBetweenTime; |
| 19 | 17 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| ... | ... | @@ -166,68 +164,4 @@ public class ArticleServiceImplTest extends BaseDbUnitTest { |
| 166 | 164 | assertPojoEquals(dbArticle, pageResult.getList().get(0)); |
| 167 | 165 | } |
| 168 | 166 | |
| 169 | - @Test | |
| 170 | - @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解 | |
| 171 | - public void testGetArticleList() { | |
| 172 | - // mock 数据 | |
| 173 | - ArticleDO dbArticle = randomPojo(ArticleDO.class, o -> { // 等会查询到 | |
| 174 | - o.setCategoryId(null); | |
| 175 | - o.setTitle(null); | |
| 176 | - o.setAuthor(null); | |
| 177 | - o.setPicUrl(null); | |
| 178 | - o.setIntroduction(null); | |
| 179 | - o.setBrowseCount(null); | |
| 180 | - o.setSort(null); | |
| 181 | - o.setStatus(null); | |
| 182 | - o.setSpuId(null); | |
| 183 | - o.setRecommendHot(null); | |
| 184 | - o.setRecommendBanner(null); | |
| 185 | - o.setContent(null); | |
| 186 | - o.setCreateTime(null); | |
| 187 | - }); | |
| 188 | - articleMapper.insert(dbArticle); | |
| 189 | - // 测试 categoryId 不匹配 | |
| 190 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCategoryId(null))); | |
| 191 | - // 测试 title 不匹配 | |
| 192 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setTitle(null))); | |
| 193 | - // 测试 author 不匹配 | |
| 194 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setAuthor(null))); | |
| 195 | - // 测试 picUrl 不匹配 | |
| 196 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setPicUrl(null))); | |
| 197 | - // 测试 introduction 不匹配 | |
| 198 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setIntroduction(null))); | |
| 199 | - // 测试 browseCount 不匹配 | |
| 200 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setBrowseCount(null))); | |
| 201 | - // 测试 sort 不匹配 | |
| 202 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSort(null))); | |
| 203 | - // 测试 status 不匹配 | |
| 204 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setStatus(null))); | |
| 205 | - // 测试 spuId 不匹配 | |
| 206 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setSpuId(null))); | |
| 207 | - // 测试 recommendHot 不匹配 | |
| 208 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendHot(null))); | |
| 209 | - // 测试 recommendBanner 不匹配 | |
| 210 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setRecommendBanner(null))); | |
| 211 | - // 测试 content 不匹配 | |
| 212 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setContent(null))); | |
| 213 | - // 测试 createTime 不匹配 | |
| 214 | - articleMapper.insert(cloneIgnoreId(dbArticle, o -> o.setCreateTime(null))); | |
| 215 | - // 准备参数 | |
| 216 | - ArticleExportReqVO reqVO = new ArticleExportReqVO(); | |
| 217 | - reqVO.setCategoryId(null); | |
| 218 | - reqVO.setTitle(null); | |
| 219 | - reqVO.setAuthor(null); | |
| 220 | - reqVO.setStatus(null); | |
| 221 | - reqVO.setSpuId(null); | |
| 222 | - reqVO.setRecommendHot(null); | |
| 223 | - reqVO.setRecommendBanner(null); | |
| 224 | - reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28)); | |
| 225 | - | |
| 226 | - // 调用 | |
| 227 | - List<ArticleDO> list = articleService.getArticleList(reqVO); | |
| 228 | - // 断言 | |
| 229 | - assertEquals(1, list.size()); | |
| 230 | - assertPojoEquals(dbArticle, list.get(0)); | |
| 231 | - } | |
| 232 | - | |
| 233 | 167 | } | ... | ... |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/member/MemberStatisticsController.java
| ... | ... | @@ -100,6 +100,8 @@ public class MemberStatisticsController { |
| 100 | 100 | return success(memberStatisticsService.getMemberTerminalStatisticsList()); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + // TODO 芋艿:已经 review | |
| 104 | + // TODO @疯狂:要注意 date 的排序; | |
| 103 | 105 | @GetMapping("/user-count-comparison") |
| 104 | 106 | @Operation(summary = "获得用户数量对照") |
| 105 | 107 | @PreAuthorize("@ss.hasPermission('statistics:member:query')") | ... | ... |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/controller/admin/trade/TradeStatisticsController.java
| ... | ... | @@ -130,6 +130,7 @@ public class TradeStatisticsController { |
| 130 | 130 | @Operation(summary = "获得订单量趋势统计") |
| 131 | 131 | @PreAuthorize("@ss.hasPermission('statistics:trade:query')") |
| 132 | 132 | public CommonResult<List<DataComparisonRespVO<TradeOrderTrendRespVO>>> getOrderCountTrendComparison(@Valid TradeOrderTrendReqVO reqVO) { |
| 133 | + // TODO @疯狂:要注意 date 的排序; | |
| 133 | 134 | return success(tradeOrderStatisticsService.getOrderCountTrendComparison(reqVO)); |
| 134 | 135 | } |
| 135 | 136 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/mysql/order/TradeOrderMapper.java
| ... | ... | @@ -92,21 +92,12 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> { |
| 92 | 92 | default TradeOrderDO selectOneByPickUpVerifyCode(String pickUpVerifyCode) { |
| 93 | 93 | return selectOne(TradeOrderDO::getPickUpVerifyCode, pickUpVerifyCode); |
| 94 | 94 | } |
| 95 | - | |
| 96 | - // TODO @puhui999:selectByUserIdAndCombinationActivityIdAndStatus,这样更容易理解哈。 | |
| 97 | - /** | |
| 98 | - * 只针对 combinationActivityId 的查询 | |
| 99 | - * | |
| 100 | - * @param userId 用户编号 | |
| 101 | - * @param activityId 拼团活动编号 | |
| 102 | - * @param status 订单状态 | |
| 103 | - * @return 交易订单 | |
| 104 | - */ | |
| 105 | - default TradeOrderDO selectByUserIdAndActivityIdAndStatus(Long userId, Long activityId, Integer status) { | |
| 95 | + | |
| 96 | + default TradeOrderDO selectByUserIdAndCombinationActivityIdAndStatus(Long userId, Long combinationActivityId, Integer status) { | |
| 106 | 97 | return selectOne(new LambdaQueryWrapperX<TradeOrderDO>() |
| 107 | 98 | .eq(TradeOrderDO::getUserId, userId) |
| 108 | 99 | .eq(TradeOrderDO::getStatus, status) |
| 109 | - .eq(TradeOrderDO::getCombinationActivityId, activityId) | |
| 100 | + .eq(TradeOrderDO::getCombinationActivityId, combinationActivityId) | |
| 110 | 101 | ); |
| 111 | 102 | } |
| 112 | 103 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryService.java
| ... | ... | @@ -42,11 +42,11 @@ public interface TradeOrderQueryService { |
| 42 | 42 | * 获得指定用户,指定活动,指定状态的交易订单 |
| 43 | 43 | * |
| 44 | 44 | * @param userId 用户编号 |
| 45 | - * @param activityId 活动编号 | |
| 45 | + * @param combinationActivityId 活动编号 | |
| 46 | 46 | * @param status 订单状态 |
| 47 | 47 | * @return 交易订单 |
| 48 | 48 | */ |
| 49 | - TradeOrderDO getActivityOrderByUserIdAndActivityIdAndStatus(Long userId, Long activityId, Integer status); | |
| 49 | + TradeOrderDO getOrderByUserIdAndStatusAndCombination(Long userId, Long combinationActivityId, Integer status); | |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * 获得订单列表 | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderQueryServiceImpl.java
| ... | ... | @@ -71,8 +71,8 @@ public class TradeOrderQueryServiceImpl implements TradeOrderQueryService { |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | @Override |
| 74 | - public TradeOrderDO getActivityOrderByUserIdAndActivityIdAndStatus(Long userId, Long activityId, Integer status) { | |
| 75 | - return tradeOrderMapper.selectByUserIdAndActivityIdAndStatus(userId, activityId, status); | |
| 74 | + public TradeOrderDO getOrderByUserIdAndStatusAndCombination(Long userId, Long combinationActivityId, Integer status) { | |
| 75 | + return tradeOrderMapper.selectByUserIdAndCombinationActivityIdAndStatus(userId, combinationActivityId, status); | |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | @Override | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeCombinationOrderHandler.java
| ... | ... | @@ -49,7 +49,7 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { |
| 49 | 49 | order.getCombinationHeadId(), item.getSkuId(), item.getCount()); |
| 50 | 50 | |
| 51 | 51 | // 2. 校验该用户是否存在未支付的拼团活动订单,避免一个拼团可以下多个单子了 |
| 52 | - TradeOrderDO activityOrder = orderQueryService.getActivityOrderByUserIdAndActivityIdAndStatus( | |
| 52 | + TradeOrderDO activityOrder = orderQueryService.getOrderByUserIdAndStatusAndCombination( | |
| 53 | 53 | order.getUserId(), order.getCombinationActivityId(), TradeOrderStatusEnum.UNPAID.getStatus()); |
| 54 | 54 | if (activityOrder != null) { |
| 55 | 55 | throw exception(ORDER_CREATE_FAIL_EXIST_UNPAID); |
| ... | ... | @@ -69,9 +69,8 @@ public class TradeCombinationOrderHandler implements TradeOrderHandler { |
| 69 | 69 | CombinationRecordCreateRespDTO combinationRecord = combinationRecordApi.createCombinationRecord( |
| 70 | 70 | TradeOrderConvert.INSTANCE.convert(order, item)); |
| 71 | 71 | |
| 72 | - // 3. 更新拼团相关信息到订单 | |
| 73 | - // 为什么几个字段都要更新?原因是: | |
| 74 | - // 如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的,设置团长编号这个操作时在订单是否后创建拼团记录时才设置的。 | |
| 72 | + // 3. 更新拼团相关信息到订单。为什么几个字段都要更新? | |
| 73 | + // 原因是:如果创建订单时自己是团长的情况下 combinationHeadId 是为 null 的,设置团长编号这个操作时在订单是否后创建拼团记录时才设置的。 | |
| 75 | 74 | orderUpdateService.updateOrderCombinationInfo(order.getId(), order.getCombinationActivityId(), |
| 76 | 75 | combinationRecord.getCombinationRecordId(), combinationRecord.getCombinationHeadId()); |
| 77 | 76 | } | ... | ... |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/wallet/vo/transaction/PayWalletTransactionRespVO.java
| ... | ... | @@ -24,6 +24,9 @@ public class PayWalletTransactionRespVO { |
| 24 | 24 | @Schema(description = "流水标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "土豆土豆") |
| 25 | 25 | private String title; |
| 26 | 26 | |
| 27 | + @Schema(description = "交易后的余额,单位分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | |
| 28 | + private Long balance; | |
| 29 | + | |
| 27 | 30 | @Schema(description = "交易时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 28 | 31 | private LocalDateTime createTime; |
| 29 | 32 | } | ... | ... |