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

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

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

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