Browse Source

基础配置

master
张彭杰 1 year ago
parent
commit
56329a29e6
8 changed files with 98 additions and 9 deletions
  1. 4
      dating-agency-mall-entity/src/main/java/com/qniao/dam/domain/aggregate/marriagebounty/valueobj/MarriageBountyOrderProductRecord.java
  2. 15
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/MarriageBountyOrderUserQueryController.java
  3. 22
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/response/MarriageBountyOrderProductRecordVo.java
  4. 20
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/response/MarriageBountyOrderProductSpecRecordVo.java
  5. 20
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/marriagebounty/user/response/UserGetMarriageBountyOrderDetailVo.java
  6. 3
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/service/marriagebounty/MarriageBountyOrderApplicationService.java
  7. 3
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/MarriageBountyOrderQueryService.java
  8. 20
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/marriagebounty/impl/MarriageBountyOrderQueryServiceImpl.java

4
dating-agency-mall-entity/src/main/java/com/qniao/dam/domain/aggregate/marriagebounty/valueobj/MarriageBountyOrderProductRecord.java

@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -17,6 +18,9 @@ public class MarriageBountyOrderProductRecord extends ValueObject<MarriageBounty
@ApiModelProperty("悬赏招亲订单标识")
private Long marriageBountyOrderId;
@ApiModelProperty("奖励金额")
private BigDecimal rewardAmount;
@ApiModelProperty("悬赏招亲订单产品规格记录")
private transient List<MarriageBountyOrderProductSpecRecord> productSpecRecordList = new ArrayList<>();

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

@ -2,6 +2,7 @@ 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.UserGetMarriageBountyOrderDetailVo;
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;
@ -22,15 +23,21 @@ public class MarriageBountyOrderUserQueryController {
@GetMapping("get/marriage-bounty-order/product-info")
@ApiOperation("用户获取悬赏招亲订单信息")
public UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(@Validated UserGetMarriageBountyOrderProductInfoQueryParam queryParam,
public UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(@RequestParam("marriageBountyOrderId") Long marriageBountyOrderId,
@RequestParam("userId") Long userId) {
return marriageBountyOrderQueryService.getMarriageBountyOrderProductInfo(queryParam.getMarriageBountyOrderId());
return marriageBountyOrderQueryService.getMarriageBountyOrderProductInfo(marriageBountyOrderId);
}
@GetMapping("get/marriage-bounty-order/pre-refund-info")
@ApiOperation("用户获取悬赏招亲订单预退款信息")
public UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(@Validated UserGetMarriageBountyOrderPreRefundInfoQueryParam queryParam,
public UserGetMarriageBountyOrderPreRefundInfoVo getMarriageBountyOrderPreRefundInfo(@RequestParam("marriageBountyOrderId") Long marriageBountyOrderId,
@RequestParam("userId") Long userId) {
return marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(queryParam.getMarriageBountyOrderId());
return marriageBountyOrderQueryService.getMarriageBountyOrderPreRefundInfo(marriageBountyOrderId);
}
@GetMapping("get/marriage-bounty-order/detail")
@ApiOperation("用户获取悬赏招亲订单详情")
public UserGetMarriageBountyOrderDetailVo getMarriageBountyOrderDetail(@RequestParam("marriageBountyOrderId") Long marriageBountyOrderId) {
return marriageBountyOrderQueryService.getMarriageBountyOrderDetail(marriageBountyOrderId);
}
}

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

@ -0,0 +1,22 @@
package com.qniao.dam.api.query.marriagebounty.user.response;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;
@Data
public class MarriageBountyOrderProductRecordVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDate createTime;
@ApiModelProperty("奖励金额")
private BigDecimal rewardAmount;
@ApiModelProperty("悬赏招亲订单产品规格记录")
private List<MarriageBountyOrderProductSpecRecordVo> productSpecRecordList;
}

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

@ -0,0 +1,20 @@
package com.qniao.dam.api.query.marriagebounty.user.response;
import com.qniao.dam.domian.aggregate.product.constant.ProductSubCategoryEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class MarriageBountyOrderProductSpecRecordVo {
@ApiModelProperty("产品次分类")
private ProductSubCategoryEnum subCategory;
@ApiModelProperty("原价")
private BigDecimal unitOriginalPrice;
@ApiModelProperty("售价")
private BigDecimal unitSellingPrice;
}

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

@ -0,0 +1,20 @@
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.util.List;
@Data
public class UserGetMarriageBountyOrderDetailVo {
@ApiModelProperty("悬赏招亲唯一标识")
@JsonSerialize(using = ToStringSerializer.class)
private Long marriageBountyOrderId;
@ApiModelProperty("悬赏招亲产品记录")
private List<MarriageBountyOrderProductRecordVo> productRecordList;
}

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

@ -87,10 +87,11 @@ public class MarriageBountyOrderApplicationService extends BaseApplicationServic
orderRewardList.addAll(MarriageBountyOrderReward.build(ProductSubCategoryEnum.MARRIAGE_BOUNTY_RESULT_GIFT, orderItem.getUnitSettlementPrice(), orderItem.getQuantity()));
}
});
marriageBountyOrder.setProductRecordList(Collections.singletonList(productRecord));
marriageBountyOrder.setOrderRewardList(orderRewardList);
marriageBountyOrder.setInsertOrderRewardList(orderRewardList);
marriageBountyOrder.calculateRewardAmount();
productRecord.setRewardAmount(marriageBountyOrder.getRewardAmount());
marriageBountyOrder.setProductRecordList(Collections.singletonList(productRecord));
BaseDomainEvent event = marriageBountyOrderAggregate.create(marriageBountyOrder);
this.sendEvent(event);
} else {

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

@ -1,5 +1,6 @@
package com.qniao.dam.query.marriagebounty;
import com.qniao.dam.api.query.marriagebounty.user.response.UserGetMarriageBountyOrderDetailVo;
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;
@ -14,4 +15,6 @@ public interface MarriageBountyOrderQueryService {
MarriageBountyOrder queryByOrderRel(Long orderRelId);
UserGetMarriageBountyOrderProductInfoVo getMarriageBountyOrderProductInfo(Long marriageBountyOrderId);
UserGetMarriageBountyOrderDetailVo getMarriageBountyOrderDetail(Long marriageBountyOrderId);
}

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

@ -1,8 +1,7 @@
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.api.query.marriagebounty.user.response.*;
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;
@ -17,6 +16,7 @@ import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderRel
import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageBountyOrderRewardDao;
import com.qniao.dam.query.marriagebounty.MarriageBountyOrderQueryService;
import com.qniao.dam.query.product.ProductQueryService;
import com.qniao.framework.utils.TypeConvertUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -35,8 +35,6 @@ 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,
@ -121,4 +119,18 @@ public class MarriageBountyOrderQueryServiceImpl implements MarriageBountyOrderQ
}
return productInfoVo;
}
@Override
public UserGetMarriageBountyOrderDetailVo getMarriageBountyOrderDetail(Long marriageBountyOrderId) {
UserGetMarriageBountyOrderDetailVo detailVo = new UserGetMarriageBountyOrderDetailVo();
MarriageBountyOrder marriageBountyOrder = marriageBountyOrderRepository.load(marriageBountyOrderId);
if (Objects.nonNull(marriageBountyOrder)) {
detailVo.setMarriageBountyOrderId(marriageBountyOrderId);
detailVo.setProductRecordList(
TypeConvertUtils.convertList(marriageBountyOrder.getProductRecordList(), MarriageBountyOrderProductRecordVo.class, (a, b) -> {
b.setProductSpecRecordList(TypeConvertUtils.convert(a.getProductSpecRecordList(), MarriageBountyOrderProductSpecRecordVo.class));
}));
}
return detailVo;
}
}
Loading…
Cancel
Save