diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java b/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java index 3b2c5e9..1147a7d 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java @@ -7,6 +7,7 @@ import com.luoo.user.dto.memberShip.MembershipCodeSearchDto; import com.luoo.user.pojo.MembershipCode; import com.luoo.user.service.MemberShipService; import com.luoo.user.service.MembershipCodeService; +import com.luoo.user.vo.membership.VipSkuVO; import controller.BaseController; import io.swagger.annotations.*; @@ -135,4 +136,11 @@ public class MembershipController extends BaseController { return Result.success(memberShipService.prepay(skuId)); } + @ApiOperation(value = "7.获取会员商品列表", notes = "仅限app用户调用") + @GetMapping("/sku/list") + @GlobalInterceptor(checkAppUserLogin = true) + public Result> getVipSkuList() { + return Result.success(memberShipService.getVipSkuList()); + } + } diff --git a/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java b/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java index 51b3879..5c3b7aa 100644 --- a/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java +++ b/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java @@ -44,10 +44,10 @@ public class JPAEntityListener { @PrePersist public void setCreatedOn(JPABasePojo jpaBasePojo) { log.info("Setting created on {}", jpaBasePojo); - jpaBasePojo.setCreateUser(getCurrentUser().getUserId()); - jpaBasePojo.setUpdateUser(getCurrentUser().getUserId()); - jpaBasePojo.setCreateUserName(getCurrentUser().getNickName()); - jpaBasePojo.setUpdateUserName(getCurrentUser().getNickName()); + jpaBasePojo.setCreateUser(getCurrentUser() != null ? getCurrentUser().getUserId() : "system"); + jpaBasePojo.setUpdateUser(getCurrentUser() != null ? getCurrentUser().getUserId() : "system"); + jpaBasePojo.setCreateUserName(getCurrentUser() != null ? getCurrentUser().getNickName() : "system"); + jpaBasePojo.setUpdateUserName(getCurrentUser() != null ? getCurrentUser().getNickName() : "system"); jpaBasePojo.setCreateTime(LocalDateTime.now()); jpaBasePojo.setUpdateTime(LocalDateTime.now()); jpaBasePojo.setId(String.valueOf(idWorkerStatic.nextId())); @@ -57,8 +57,8 @@ public class JPAEntityListener { @PreUpdate public void setUpdatedOn(JPABasePojo jpaBasePojo) { log.info("Setting updated on {}", jpaBasePojo); - jpaBasePojo.setUpdateUser(getCurrentUser().getUserId()); - jpaBasePojo.setUpdateUserName(getCurrentUser().getNickName()); + jpaBasePojo.setUpdateUser(getCurrentUser() != null ? getCurrentUser().getUserId() : "system"); + jpaBasePojo.setUpdateUserName(getCurrentUser() != null ? getCurrentUser().getNickName() : "system"); jpaBasePojo.setUpdateTime(LocalDateTime.now()); if(jpaBasePojo.getDelFlag() == 2) { diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/VipSku.java b/luoo_user/src/main/java/com/luoo/user/pojo/VipSku.java index 7e74707..806cae7 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/VipSku.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/VipSku.java @@ -41,5 +41,5 @@ public class VipSku extends JPABasePojo { private Integer amount; @ApiModelProperty(value = "苹果产品id") - private String applyProductId; + private String appleProductId; } diff --git a/luoo_user/src/main/java/com/luoo/user/service/MemberShipService.java b/luoo_user/src/main/java/com/luoo/user/service/MemberShipService.java index 7b21a73..d792122 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/MemberShipService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/MemberShipService.java @@ -88,7 +88,7 @@ public class MemberShipService { .days(item.getDays()) .lifeFlag(item.getLifeFlag()) .amount(item.getAmount()) - .applyProductId(item.getApplyProductId()) + .appleProductId(item.getAppleProductId()) .build()).collect(Collectors.toList()); } @@ -223,7 +223,7 @@ public class MemberShipService { QVipSku qVipSku = QVipSku.vipSku; VipSku vipSku = jpaQueryFactory.selectFrom(qVipSku) - .where(qVipSku.applyProductId.eq(type)) + .where(qVipSku.appleProductId.eq(type)) .fetchOne(); if (vipSku != null) { @@ -235,6 +235,7 @@ public class MemberShipService { membershipOrder.setDuration(vipSku.getDays()); dealUserVipCalc(membershipOrder); + membershipOrderDao.save(membershipOrder); } diff --git a/luoo_user/src/main/java/com/luoo/user/vo/membership/VipSkuVO.java b/luoo_user/src/main/java/com/luoo/user/vo/membership/VipSkuVO.java index 28baa22..b0be63e 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/membership/VipSkuVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/membership/VipSkuVO.java @@ -34,5 +34,5 @@ public class VipSkuVO implements Serializable { private Integer amount; @ApiModelProperty(value = "苹果产品id") - private String applyProductId; + private String appleProductId; }