记得上下班打卡 | git大法好,push需谨慎

Commit 265abaf2 authored by 张国柄's avatar 张国柄

~API:活动:优惠券:领取、使用数量更正;

parent 02c05e7a
...@@ -25,9 +25,9 @@ public class GoblinStoreMgtCouponListVo implements Serializable, Cloneable { ...@@ -25,9 +25,9 @@ public class GoblinStoreMgtCouponListVo implements Serializable, Cloneable {
@ApiModelProperty(position = 14, value = "库存") @ApiModelProperty(position = 14, value = "库存")
private Integer stock; private Integer stock;
@ApiModelProperty(position = 15, value = "领取数量") @ApiModelProperty(position = 15, value = "领取数量")
private Integer receiveNum; private int receiveNum;
@ApiModelProperty(position = 16, value = "使用数量") @ApiModelProperty(position = 16, value = "使用数量")
private Integer usedNum; private int usedNum;
@ApiModelProperty(position = 17, value = "开始时间") @ApiModelProperty(position = 17, value = "开始时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime startTime; private LocalDateTime startTime;
...@@ -37,10 +37,4 @@ public class GoblinStoreMgtCouponListVo implements Serializable, Cloneable { ...@@ -37,10 +37,4 @@ public class GoblinStoreMgtCouponListVo implements Serializable, Cloneable {
@ApiModelProperty(position = 19, value = "创建时间") @ApiModelProperty(position = 19, value = "创建时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR) @JsonFormat(shape=JsonFormat.Shape.STRING, pattern=DateUtil.DATE_FULL_STR)
private LocalDateTime createdAt; private LocalDateTime createdAt;
@ApiModelProperty(position = 20, value = "已领取库存")
private int receiveStock;
@ApiModelProperty(position = 21, value = "已使用库存")
private int usedStock;
} }
...@@ -28,10 +28,10 @@ public class GoblinStoreMgtCouponListVoExcel implements Serializable, Cloneable ...@@ -28,10 +28,10 @@ public class GoblinStoreMgtCouponListVoExcel implements Serializable, Cloneable
private String endTime; private String endTime;
@ExcelProperty("创建时间") @ExcelProperty("创建时间")
private String createdAt; private String createdAt;
@ExcelProperty("已领取库存") @ExcelProperty("领取数量")
private Integer receiveStock; private int receiveNum;
@ExcelProperty("已使用库存") @ExcelProperty("使用数量")
private Integer usedStock; private int usedNum;
@ExcelProperty("总库存") @ExcelProperty("总库存")
private Integer stock; private Integer stock;
...@@ -67,8 +67,8 @@ public class GoblinStoreMgtCouponListVoExcel implements Serializable, Cloneable ...@@ -67,8 +67,8 @@ public class GoblinStoreMgtCouponListVoExcel implements Serializable, Cloneable
this.setStartTime(yyyyMMddHHmmss.format(source.getStartTime())); this.setStartTime(yyyyMMddHHmmss.format(source.getStartTime()));
this.setEndTime(yyyyMMddHHmmss.format(source.getEndTime())); this.setEndTime(yyyyMMddHHmmss.format(source.getEndTime()));
this.setCreatedAt(yyyyMMddHHmmss.format(source.getCreatedAt())); this.setCreatedAt(yyyyMMddHHmmss.format(source.getCreatedAt()));
this.setReceiveStock(source.getReceiveStock()); this.setReceiveNum(source.getReceiveNum());
this.setUsedStock(source.getUsedStock()); this.setUsedNum(source.getUsedNum());
this.setStock(source.getStock()); this.setStock(source.getStock());
return this; return this;
} }
......
...@@ -57,18 +57,18 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer ...@@ -57,18 +57,18 @@ public class GoblinStoreMgtCouponServiceImpl implements IGoblinstoreMgtCouponSer
List<Document> aggregateUserCouponResult = aggregateUserCouponResults.stream() List<Document> aggregateUserCouponResult = aggregateUserCouponResults.stream()
.filter(r -> r.getString("storeCouponId").equals(vo.getStoreCouponId())).collect(Collectors.toList()); .filter(r -> r.getString("storeCouponId").equals(vo.getStoreCouponId())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(aggregateUserCouponResult)) { if (!CollectionUtils.isEmpty(aggregateUserCouponResult)) {
int receiveStock = 0, usedStock = 0; int receiveNum = 0, usedNum = 0;
for (Document aggregateDoc : aggregateUserCouponResult) { for (Document aggregateDoc : aggregateUserCouponResult) {
Integer totalCount = aggregateDoc.getInteger("totalCount"); Integer totalCount = aggregateDoc.getInteger("totalCount");
switch (aggregateDoc.getInteger("state")) {// 用户券状态[1-可用|2-无效|3-已过期|5-已使用] switch (aggregateDoc.getInteger("state")) {// 用户券状态[1-可用|2-无效|3-已过期|5-已使用]
case 5: case 5:
usedStock += totalCount; usedNum += totalCount;
default: default:
receiveStock += totalCount; receiveNum += totalCount;
} }
} }
vo.setReceiveStock(receiveStock); vo.setReceiveNum(receiveNum);
vo.setUsedStock(usedStock); vo.setUsedNum(usedNum);
} }
}); });
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment