Browse Source

基础配置

master
张彭杰 1 year ago
parent
commit
8b9126da4f
11 changed files with 114 additions and 16 deletions
  1. 2
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/marriagebounty/user/MarriageBountyOrderUserCommandController.java
  2. 7
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/marriagebounty/user/request/RefundMarriageBountyOrderDto.java
  3. 11
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/MarriageBountyOrderUserQueryController.java
  4. 10
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/request/UserGetMarriageBountyOrderPreRefundInfoQueryParam.java
  5. 14
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/request/UserGetMarriageBountyOrderProductInfoQueryParam.java
  6. 32
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/response/UserGetMarriageBountyOrderProductInfoVo.java
  7. 4
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/service/marriagebounty/MarriageBountyOrderApplicationService.java
  8. 5
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/MarriageBountyOrderQueryService.java
  9. 42
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/impl/MarriageBountyOrderQueryServiceImpl.java
  10. 2
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java
  11. 1
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java

2
dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/marriagebounty/user/MarriageBountyOrderUserCommandController.java

@ -21,7 +21,7 @@ public class MarriageBountyOrderUserCommandController {
@PostMapping("/refund/marriage-bounty-order")
public void refundMarriageBountyOrder(@RequestBody @Validated RefundMarriageBountyOrderDto dto,
@RequestParam Long userId) {
marriageBountyOrderApplicationService.refund(userId, dto.getMiId());
marriageBountyOrderApplicationService.refund(dto.getMarriageBountyOrderId());
}
}

7
dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/marriagebounty/user/request/RefundMarriageBountyOrderDto.java

@ -7,7 +7,8 @@ import javax.validation.constraints.NotNull;
@Data
public class RefundMarriageBountyOrderDto {
@ApiModelProperty("征婚资料标识")
@NotNull(message = "征婚资料标识不能为空")
private Long miId;
@ApiModelProperty("悬赏招亲唯一标识")
@NotNull(message = "悬赏招亲唯一标识不能为空")
private Long marriageBountyOrderId;
}

11
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/MarriageBountyOrderUserQueryController.java

@ -1,6 +1,8 @@
package com.qniao.dam.api.query.marriagebounty.user;
import com.qniao.dam.api.query.marriagebounty.user.request.UserGetMarriageBountyOrderProductInfoQueryParam;
import com.qniao.dam.api.query.marriagebounty.user.request.UserGetMarriageBountyOrderPreRefundInfoQueryParam;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderProductInfoVo;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderPreRefundInfoVo;
import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService;
import io.swagger.annotations.Api;
@ -18,11 +20,18 @@ public class MarriageBountyOrderUserQueryController {
@Resource
private MarriageBountyOrderQueryService marriageBountyOrderQueryService;
@GetMapping("get/marriage-bounty-order/product-info")
@ApiOperation("用户获取悬赏招亲订单信息")
public UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(@Validated UserGetMarriageBountyOrderProductInfoQueryParam queryParam,
@RequestParam("userId") Long userId) {
return marriageBountyOrderQueryService.getMarriageBountyOrderProductInfo(queryParam.getMarriageBountyOrderId());
}
@GetMapping("get/marriage-bounty-order/pre-refund-info")
@ApiOperation("用户获取悬赏招亲订单预退款信息")
public UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(@Validated UserGetMarriageBountyOrderPreRefundInfoQueryParam queryParam,
@RequestParam("userId") Long userId) {
return marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(userId, queryParam.getMiId());
return marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(queryParam.getMarriageBountyOrderId());
}

10
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/request/UserGetMarriageBountyOrderPreRefundInfoQueryParam.java

@ -1,15 +1,15 @@
package com.qniao.dam.api.query.marriagebounty.user.request;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class UserGetMarriageBountyOrderPreRefundInfoQueryParam {
@ApiModelProperty("征婚资料标识")
@JsonSerialize(using = ToStringSerializer.class)
private Long miId;
@ApiModelProperty("悬赏招亲唯一标识")
@NotNull(message = "悬赏招亲唯一标识不能为空")
private Long marriageBountyOrderId;
}

14
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/request/UserGetMarriageBountyOrderProductInfoQueryParam.java

@ -0,0 +1,14 @@
package com.qniao.dam.api.query.marriagebounty.user.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class UserGetMarriageBountyOrderProductInfoQueryParam {
@ApiModelProperty("悬赏招亲唯一标识")
@NotNull(message = "悬赏招亲唯一标识不能为空")
private Long marriageBountyOrderId;
}

32
dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/response/UserGetMarriageBountyOrderProductInfoVo.java

@ -0,0 +1,32 @@
package com.qniao.dam.api.query.marriagebounty.user.response;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class UserGetMarriageBountyOrderProductInfoVo {
@ApiModelProperty("悬赏招亲唯一标识")
@JsonSerialize(using = ToStringSerializer.class)
private Long marriageBountyOrderId;
@ApiModelProperty("见面费用")
private BigDecimal meetingFee = BigDecimal.ZERO;
@ApiModelProperty("已用见面次数")
private Integer usedMeetingQuantity = 0;
@ApiModelProperty("可用见面次数")
private Integer usableMeetingQuantity = 0;
@ApiModelProperty("结果礼金")
private BigDecimal resultGift = BigDecimal.ZERO;
@ApiModelProperty("奖励金额")
private BigDecimal rewardAmount;
}

4
dating-agency-mall-server/src/main/java/com/qniao/dam/application/service/marriagebounty/MarriageBountyOrderApplicationService.java

@ -112,8 +112,8 @@ public class MarriageBountyOrderApplicationService extends BaseApplicationServic
}
}
public void refund(Long userId, Long miId) {
UserGetMarriageBountyOrderPreRefundInfoVo preRefundInfoVo = marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(userId, miId);
public void refund(Long marriageBountyOrderId) {
UserGetMarriageBountyOrderPreRefundInfoVo preRefundInfoVo = marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(marriageBountyOrderId);
if (!preRefundInfoVo.getRefundable()) {
throw new BizException("不能发起退款");
} else {

5
dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/MarriageBountyOrderQueryService.java

@ -1,6 +1,7 @@
package com.qniao.dam.query.marriagebounty;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderPreRefundInfoVo;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderProductInfoVo;
import com.qniao.dam.domain.aggregate.marriagebounty.entity.MarriageBountyOrder;
import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderPaymentStatusEnum;
import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderStatusEnum;
@ -8,7 +9,9 @@ import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrder
public interface MarriageBountyOrderQueryService {
MarriageBountyOrder queryBy(Long userId, Long miId, MarriageBountyOrderStatusEnum status, MarriageBountyOrderPaymentStatusEnum paymentStatus);
UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(Long userId, Long miId);
UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(Long marriageBountyOrderId);
MarriageBountyOrder queryByOrderRel(Long orderRelId);
UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(Long marriageBountyOrderId);
}

42
dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/impl/MarriageBountyOrderQueryServiceImpl.java

@ -2,10 +2,13 @@ package com.qniao.dam.query.marriagebounty.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderPreRefundInfoVo;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderProductInfoVo;
import com.qniao.dam.domain.aggregate.marriagebounty.entity.MarriageBountyOrder;
import com.qniao.dam.domain.aggregate.marriagebounty.entity.MarriageBountyOrderReward;
import com.qniao.dam.domain.aggregate.marriagebounty.repository.MarriageBountyOrderRepository;
import com.qniao.dam.domain.aggregate.marriagebounty.valueobj.MarriageBountyOrderRel;
import com.qniao.dam.domain.aggregate.product.entity.Product;
import com.qniao.dam.domain.aggregate.productspec.entity.ProductSpec;
import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderPaymentStatusEnum;
import com.qniao.dam.domian.aggregate.marriagebount.constant.MarriageBountyOrderStatusEnum;
import com.qniao.dam.domian.aggregate.product.constant.ProductSubCategoryEnum;
@ -13,10 +16,12 @@ import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderDao
import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderRelDao;
import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderRewardDao;
import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService;
import com.qniao.dam.query.product.ProductQueryService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
@Service
@ -30,6 +35,8 @@ public class MarriageBountyOrderQueryServiceImpl implements MarriageBountyOrderQ
private MarriageBountyOrderRelDao marriageBountyOrderRelDao;
@Resource
private MarriageBountyOrderRewardDao marriageBountyOrderRewardDao;
@Resource
private ProductQueryService productQueryService;
@Override
public MarriageBountyOrder queryBy(Long userId, Long miId, MarriageBountyOrderStatusEnum status,
@ -49,9 +56,9 @@ public class MarriageBountyOrderQueryServiceImpl implements MarriageBountyOrderQ
}
@Override
public UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(Long userId, Long miId) {
public UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(Long marriageBountyOrderId) {
UserGetMarriageBountyOrderPreRefundInfoVo refundInfoVo = new UserGetMarriageBountyOrderPreRefundInfoVo();
MarriageBountyOrder marriageBountyOrder = queryBy(userId, miId, MarriageBountyOrderStatusEnum.MATCHMAKING, MarriageBountyOrderPaymentStatusEnum.PAID);
MarriageBountyOrder marriageBountyOrder = marriageBountyOrderRepository.load(marriageBountyOrderId);
if (Objects.nonNull(marriageBountyOrder)) {
refundInfoVo.setMarriageBountyOrderId(marriageBountyOrder.getId());
BigDecimal refundableMeetingFee = BigDecimal.ZERO;
@ -86,4 +93,35 @@ public class MarriageBountyOrderQueryServiceImpl implements MarriageBountyOrderQ
}
return marriageBountyOrder;
}
@Override
public UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(Long marriageBountyOrderId) {
UserGetMarriageBountyOrderProductInfoVo productInfoVo = null;
MarriageBountyOrder marriageBountyOrder = marriageBountyOrderRepository.load(marriageBountyOrderId);
if (Objects.nonNull(marriageBountyOrder)) {
productInfoVo = new UserGetMarriageBountyOrderProductInfoVo();
productInfoVo.setMarriageBountyOrderId(marriageBountyOrder.getId());
productInfoVo.setRewardAmount(marriageBountyOrder.getRewardAmount());
Product meetingFeeProduct = productQueryService.queryBy(marriageBountyOrder.getUserId(), marriageBountyOrder.getMiId(), ProductSubCategoryEnum.MARRIAGE_BOUNTY_MEETING_FEE);
List<ProductSpec> meetingFeeProductSpecList = productQueryService.listProductSpecBy(meetingFeeProduct.getId());
productInfoVo.setMeetingFee(meetingFeeProductSpecList.get(0).getUnitSellingPrice());
Product resultGiftProduct = productQueryService.queryBy(marriageBountyOrder.getUserId(), marriageBountyOrder.getMiId(), ProductSubCategoryEnum.MARRIAGE_BOUNTY_RESULT_GIFT);
List<ProductSpec> resultGiftProductSpecList = productQueryService.listProductSpecBy(resultGiftProduct.getId());
productInfoVo.setResultGift(resultGiftProductSpecList.get(0).getUnitSellingPrice());
int usedMeetingQuantity = 0;
int usableMeetingQuantity = 0;
for (MarriageBountyOrderReward orderReward : marriageBountyOrder.getOrderRewardList()) {
if (ProductSubCategoryEnum.MARRIAGE_BOUNTY_MEETING_FEE.equals(orderReward.getRewardCategory())) {
if (orderReward.getIsReceive()) {
usedMeetingQuantity++;
} else {
usableMeetingQuantity++;
}
}
}
productInfoVo.setUsedMeetingQuantity(usedMeetingQuantity);
productInfoVo.setUsableMeetingQuantity(usableMeetingQuantity);
}
return productInfoVo;
}
}

2
dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java

@ -12,6 +12,7 @@ import com.qniao.dam.domian.aggregate.product.constant.ProductSubCategoryEnum;
import com.qniao.dam.domian.aggregate.productspec.constant.ProductSpecTermNameEnum;
import com.qniao.framework.utils.PageUtil;
import java.math.BigDecimal;
import java.util.List;
public interface ProductQueryService {
@ -30,4 +31,5 @@ public interface ProductQueryService {
Product queryBy(Long userId, Long miId, ProductSubCategoryEnum subCategory);
List<ProductSpec> listProductSpecBy(Long productId);
}

1
dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java

@ -103,7 +103,6 @@ public class ProductQueryServiceImpl implements ProductQueryService {
}
return productSpecList;
}
@Override
public ProductSpecTerm getTermByName(List<ProductSpecTerm> productSpecTermList, ProductSpecTermNameEnum name) {
ProductSpecTerm productSpecTerm = null;

Loading…
Cancel
Save