Commit 5b6126fe by 吕明尚

Merge branch 'dev' into test

parents d36351d0 9ee905dc
......@@ -90,7 +90,7 @@ public class QPServiceImplAspect {
JSONObject jsonObject = JSON.parseObject(params);
//获得出参
String outParams = JSON.toJSONString(result);
saveLog(couponLog, jsonObject);
saveLog(couponLog, jsonObject, UserStatusEnum.USED.getCode());
couponLog.setStatus(YesNoEnum.yes.getDisplay_3());
couponLog.setMessage(outParams);
couponLog.setCreateTime(new Date());
......@@ -128,7 +128,7 @@ public class QPServiceImplAspect {
String params = argsArrayToString(paramNames, joinPoint.getArgs());
//转JSON
JSONObject jsonObject = JSON.parseObject(params);
saveLog(couponLog, jsonObject);
saveLog(couponLog, jsonObject, UserStatusEnum.UNUSED.getCode());
couponLog.setStatus(YesNoEnum.no.getDisplay_3());
couponLog.setNumber(TRY_NUMBER);
couponLog.setCreateTime(new Date());
......@@ -148,20 +148,12 @@ public class QPServiceImplAspect {
}
}
private void saveLog(CouponLog couponLog, JSONObject jsonObject) {
private void saveLog(CouponLog couponLog, JSONObject jsonObject, Integer code) {
couponLog.setCode(jsonObject.getString("code"));
LambdaQueryWrapper<SConsumerCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(SConsumerCoupon::getCouponCode, couponLog.getCode());
lambdaQueryWrapper.in(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode(), UserStatusEnum.USED.getCode());
List<SConsumerCoupon> list = sConsumerCouponService.list(lambdaQueryWrapper);
//过滤只有已使用
SConsumerCoupon one = null;
//判断是否存在已使用的券
if (list.stream().anyMatch(sConsumerCoupon -> sConsumerCoupon.getUseStatus().equals(UserStatusEnum.USED.getCode()))) {
one = list.stream().filter(sConsumerCoupon -> sConsumerCoupon.getUseStatus().equals(UserStatusEnum.USED.getCode())).findFirst().orElse(null);
} else {
one = list.stream().filter(sConsumerCoupon -> sConsumerCoupon.getUseStatus().equals(UserStatusEnum.UNUSED.getCode())).findFirst().orElse(null);
}
lambdaQueryWrapper.eq(SConsumerCoupon::getUseStatus, code);
SConsumerCoupon one = sConsumerCouponService.getOne(lambdaQueryWrapper);
couponLog.setConsumerId(one.getConsumerId());
couponLog.setCouponId(one.getId());
LambdaQueryWrapper<SStore> sStoreLambdaQueryWrapper = new LambdaQueryWrapper<>();
......
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