Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product

This commit is contained in:
puhui999 2023-06-23 00:57:49 +08:00
commit 26f563df57
7 changed files with 217 additions and 29 deletions

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 App - 砍价助力")
@RestController
@RequestMapping("/promotion/bargain-help")
@Validated
public class AppBargainHelpController {
@PostMapping("/create")
@Operation(summary = "创建砍价助力", description = "给拼团记录砍一刀") // 返回结果为砍价金额单位
public CommonResult<Long> createBargainHelp(@RequestBody AppBargainHelpCreateReqVO reqVO) {
return success(20L);
}
@GetMapping("/list")
@Operation(summary = "获得砍价助力列表")
// TODO 芋艿swagger
public CommonResult<List<AppBargainHelpRespVO>> getBargainHelpList(@RequestParam("recordId") Long recordId) {
List<AppBargainHelpRespVO> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
AppBargainHelpRespVO vo = new AppBargainHelpRespVO();
vo.setNickname("用户" + i);
vo.setAvatar("https://www.iocoder.cn/avatar/" + i + ".jpg");
vo.setReducePrice((i + 1) * 100);
vo.setCreateTime(LocalDateTime.now());
list.add(vo);
}
return success(list);
}
}

View File

@ -1,16 +1,17 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain; package cn.iocoder.yudao.module.promotion.controller.app.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO; import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
@ -60,9 +61,85 @@ public class AppBargainRecordController {
detail.setPrice(200); detail.setPrice(200);
detail.setPayPrice(180); detail.setPayPrice(180);
detail.setStatus(1); detail.setStatus(1);
detail.setAction(AppBargainRecordDetailRespVO.ACTION_SUCCESS);
detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
return success(detail); return success(detail);
} }
@GetMapping("/page")
@Operation(summary = "获得砍价记录的分页")
public CommonResult<PageResult<AppBargainRecordRespVO>> getBargainRecordPage(PageParam pageParam) {
PageResult<AppBargainRecordRespVO> page = new PageResult<>();
page.setList(new ArrayList<>());
AppBargainRecordRespVO record1 = new AppBargainRecordRespVO();
record1.setId(1L);
record1.setUserId(1L);
record1.setSpuId(1L);
record1.setSkuId(1L);
record1.setPrice(500);
record1.setActivityId(1L);
record1.setBargainPrice(150);
record1.setPrice(200);
record1.setPayPrice(180);
record1.setStatus(1);
record1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
record1.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
page.getList().add(record1);
AppBargainRecordRespVO record2 = new AppBargainRecordRespVO();
record2.setId(1L);
record2.setUserId(1L);
record2.setSpuId(1L);
record2.setSkuId(1L);
record2.setPrice(500);
record2.setActivityId(1L);
record2.setBargainPrice(150);
record2.setPrice(200);
record2.setPayPrice(280);
record2.setStatus(2);
record2.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
record2.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
page.getList().add(record2);
AppBargainRecordRespVO record3 = new AppBargainRecordRespVO();
record3.setId(1L);
record3.setUserId(1L);
record3.setSpuId(1L);
record3.setSkuId(1L);
record3.setPrice(500);
record3.setActivityId(1L);
record3.setBargainPrice(150);
record3.setPrice(200);
record3.setPayPrice(380);
record3.setStatus(2);
record3.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
record3.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
record3.setOrderId(100L);
page.getList().add(record3);
AppBargainRecordRespVO record4 = new AppBargainRecordRespVO();
record4.setId(1L);
record4.setUserId(1L);
record4.setSpuId(1L);
record4.setSkuId(1L);
record4.setPrice(500);
record4.setActivityId(1L);
record4.setBargainPrice(150);
record4.setPrice(200);
record4.setPayPrice(380);
record4.setStatus(3);
record4.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
record4.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
record4.setOrderId(100L);
page.getList().add(record4);
page.setTotal(1L);
return success(page);
}
@PostMapping("/create")
@Operation(summary = "创建砍价记录", description = "参与拼团活动")
public CommonResult<Long> createBargainRecord(@RequestBody AppBargainRecordCreateReqVO reqVO) {
return success(1L);
}
} }

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "用户 App - 砍价助力的创建 Request VO")
@Data
public class AppBargainHelpCreateReqVO {
@Schema(description = "砍价记录编号", required = true, example = "1024")
@NotNull(message = "砍价记录编号不能为空")
private Long recordId;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 App - 砍价助力 Response VO")
@Data
public class AppBargainHelpRespVO {
@Schema(description = "助力用户的昵称", required = true, example = "1024")
private String nickname;
@Schema(description = "助力用户的头像", required = true, example = "1024")
private String avatar;
@Schema(description = "助力用户的砍价金额", required = true, example = "1024")
private Integer reducePrice;
@Schema(description = "创建时间", required = true, example = "1024")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "用户 App - 砍价记录的创建 Request VO")
@Data
public class AppBargainRecordCreateReqVO {
@Schema(description = "砍价活动编号", required = true, example = "1024")
@NotNull(message = "砍价活动编号不能为空")
private Long activityId;
}

View File

@ -9,12 +9,6 @@ import java.time.LocalDateTime;
@Data @Data
public class AppBargainRecordDetailRespVO { public class AppBargainRecordDetailRespVO {
public static final int ACTION_NONE = 1; // 参与动作 - 未参与可参与
public static final int ACTION_WAITING = 2; // 参与动作 - 参与中等待砍价
public static final int ACTION_SUCCESS = 3; // 参与动作 - 砍价成功待下单
public static final int ACTION_ORDER_CREATE = 4; // 参与动作 - 已下单未付款
public static final int ACTION_ORDER_PAY = 5; // 参与动作 - 已下单已付款
public static final int HELP_ACTION_NONE = 1; // 帮砍动作 - 未帮砍可以帮砍 public static final int HELP_ACTION_NONE = 1; // 帮砍动作 - 未帮砍可以帮砍
public static final int HELP_ACTION_FULL = 2; // 帮砍动作 - 未帮砍无法帮砍可帮砍次数已满) public static final int HELP_ACTION_FULL = 2; // 帮砍动作 - 未帮砍无法帮砍可帮砍次数已满)
public static final int HELP_ACTION_SUCCESS = 3; // 帮砍动作 - 已帮砍 public static final int HELP_ACTION_SUCCESS = 3; // 帮砍动作 - 已帮砍
@ -31,25 +25,9 @@ public class AppBargainRecordDetailRespVO {
private LocalDateTime expireTime; private LocalDateTime expireTime;
private Long orderId; // 有且仅在自己的订单才返回 private Long orderId;
private Boolean payStatus;
private Integer action;
private Integer helpAction; private Integer helpAction;
// 未参与1-可以参与砍价storeBargainUser 为空
// 未参与2-参与次数已满storeBargainUser 为空但是砍价次数已满storeBargainUser 非空已支付但是砍价次数已满 TODO 芋艿这个就不做了
// 参与中3-砍价中storeBargainUser 非空人数未满
// 参与中4-已完成storeBargainUser 非空未创建订单
// 支付的情况
// 8-已生成订单未支付storeBargainUser 不为空status = 3但是订单未支付
// 9-已支付storeBargainUser 不为空status = 3且订单已支付
// 10-取消支付storeBargainUser 不为空status = 3取消支付可忽略
// help 的情况
// 5-可以帮砍 3 对应
// 6-已帮砍其他人的有帮砍过
// 7-帮砍次数已满其他人的帮砍次数已满
} }

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 App - 砍价记录的 Response VO")
@Data
public class AppBargainRecordRespVO {
// TODO @芋艿status如果砍价对应的订单支付超时算失败么砍价的支付时间 expireTime 为准么
private Long id;
private Long userId;
private Long spuId;
private Long skuId;
private Long activityId;
private Integer bargainPrice;
private Integer price;
private Integer payPrice;
private Integer status;
private LocalDateTime expireTime;
private Long orderId;
private Boolean payStatus;
private Long payOrderId;
private String activityName;
private String picUrl;
}