Browse Source

基础配置

master
张彭杰 1 year ago
parent
commit
3ddd57a26b
9 changed files with 175 additions and 87 deletions
  1. 5
      dating-agency-mall-server/pom.xml
  2. 3
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/order/user/request/UserSubmitSiteActivityOrderDto.java
  3. 3
      dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/order/user/response/UserSubmitOrderVo.java
  4. 46
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/externalorder/ExternalOrderEventHandler.java
  5. 75
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/order/OrderEventHandler.java
  6. 94
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/service/order/OrderApplicationService.java
  7. 23
      dating-agency-mall-server/src/main/java/com/qniao/dam/domain/service/order/SubmitSiteActivityOrderDomainService.java
  8. 2
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java
  9. 11
      dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java

5
dating-agency-mall-server/pom.xml

@ -96,6 +96,11 @@
<artifactId>dating-agency-uec-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.qniao</groupId>
<artifactId>dating-agency-service-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>

3
dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/order/user/request/UserSubmitSiteActivityOrderDto.java

@ -15,7 +15,4 @@ public class UserSubmitSiteActivityOrderDto {
@ApiModelProperty("征婚资料标识")
@NotNull
private Long miId;
@ApiModelProperty("是否开通会员")
private Boolean openVip = false;
}

3
dating-agency-mall-server/src/main/java/com/qniao/dam/api/command/order/user/response/UserSubmitOrderVo.java

@ -20,4 +20,7 @@ public class UserSubmitOrderVo {
@JsonSerialize(using = ToStringSerializer.class)
private Long paymentOrderId;
@ApiModelProperty("是否免费结算")
private Boolean freeSettlement = false;
}

46
dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/externalorder/ExternalOrderEventHandler.java

@ -12,8 +12,10 @@ import com.qniao.dam.domian.aggregate.paymentorder.constant.PaymentOrderStatusEn
import com.qniao.dam.infrastructure.constant.MqExchange;
import com.qniao.dam.infrastructure.constant.MqQueue;
import com.qniao.dam.infrastructure.persistent.dao.domain.ExternalOrderRelDao;
import com.qniao.dam.infrastructure.persistent.dao.domain.SiteActivityDao;
import com.qniao.dam.query.paymentchannelorder.PaymentChannelOrderQueryService;
import com.qniao.dam.query.paymentorder.PaymentOrderQueryService;
import com.qniao.das.domian.aggregate.siteactivity.SiteActivity;
import com.qniao.das.domian.aggregate.siteactivity.event.SiteActivityCancelEvent;
import com.qniao.domain.BaseApplicationService;
import lombok.extern.slf4j.Slf4j;
@ -44,6 +46,8 @@ public class ExternalOrderEventHandler extends BaseApplicationService {
private PaymentOrderRefundApplicationService paymentOrderRefundApplicationService;
@Resource
private ExternalOrderRelAggregate externalOrderRelAggregate;
@Resource
private SiteActivityDao siteActivityDao;
@RabbitListener(bindings = @QueueBinding(value = @Queue(MqQueue.CANCEL_SITE_ACTIVITY),
exchange = @Exchange(value = MqExchange.CANCEL_SITE_ACTIVITY,
@ -51,26 +55,30 @@ public class ExternalOrderEventHandler extends BaseApplicationService {
public void handleConfirmMeeting(SiteActivityCancelEvent event) {
try {
log.error("接收到线下活动订单取消事件:{}", event);
ExternalOrderRel externalOrderRel = externalOrderRelDao.queryCompletedBy(event.getExternalId(), event.getUserId(), ExternalOrderTypeEnum.SITE_ACTIVITY);
if (Objects.nonNull(externalOrderRel)) {
externalOrderRel.setStatus(ExternalOrderRelStatus.CANCELED);
externalOrderRelAggregate.save(externalOrderRel);
List<PaymentOrderRefund> paymentOrderRefundList = new ArrayList<>();
List<PaymentOrder> paymentOrderList = paymentOrderQueryService.listByOrderId(Collections.singletonList(externalOrderRel.getOrderId()), PaymentOrderStatusEnum.PAID);
for (PaymentOrder paymentOrder : paymentOrderList) {
PaymentOrderRefund paymentOrderRefund = new PaymentOrderRefund();
PaymentChannelOrder paymentChannelOrder = paymentChannelOrderQueryService.queryByTxnOrderId(paymentOrder.getId());
paymentOrderRefund.setTradeOrderId(paymentOrder.getOrderId());
paymentOrderRefund.setPaymentOrderId(paymentOrder.getId());
paymentOrderRefund.setPaymentChannelOrder(paymentChannelOrder.getId());
paymentOrderRefund.setPaymentMethod(paymentOrder.getPaymentMethod());
paymentOrderRefund.setTransactionId(paymentChannelOrder.getExtOrderNo());
paymentOrderRefund.setOrderAmount(paymentChannelOrder.getAmount());
paymentOrderRefund.setRefundAmount(paymentChannelOrder.getAmount());
paymentOrderRefundList.add(paymentOrderRefund);
SiteActivity siteActivity = siteActivityDao.selectById(event.getExternalId());
//社群活动允许退款
if (Objects.nonNull(siteActivity.getActivityType()) && siteActivity.getActivityType() == 1) {
ExternalOrderRel externalOrderRel = externalOrderRelDao.queryCompletedBy(event.getExternalId(), event.getUserId(), ExternalOrderTypeEnum.SITE_ACTIVITY);
if (Objects.nonNull(externalOrderRel)) {
externalOrderRel.setStatus(ExternalOrderRelStatus.CANCELED);
externalOrderRelAggregate.save(externalOrderRel);
List<PaymentOrderRefund> paymentOrderRefundList = new ArrayList<>();
List<PaymentOrder> paymentOrderList = paymentOrderQueryService.listByOrderId(Collections.singletonList(externalOrderRel.getOrderId()), PaymentOrderStatusEnum.PAID);
for (PaymentOrder paymentOrder : paymentOrderList) {
PaymentOrderRefund paymentOrderRefund = new PaymentOrderRefund();
PaymentChannelOrder paymentChannelOrder = paymentChannelOrderQueryService.queryByTxnOrderId(paymentOrder.getId());
paymentOrderRefund.setTradeOrderId(paymentOrder.getOrderId());
paymentOrderRefund.setPaymentOrderId(paymentOrder.getId());
paymentOrderRefund.setPaymentChannelOrder(paymentChannelOrder.getId());
paymentOrderRefund.setPaymentMethod(paymentOrder.getPaymentMethod());
paymentOrderRefund.setTransactionId(paymentChannelOrder.getExtOrderNo());
paymentOrderRefund.setOrderAmount(paymentChannelOrder.getAmount());
paymentOrderRefund.setRefundAmount(paymentChannelOrder.getAmount());
paymentOrderRefundList.add(paymentOrderRefund);
}
//发起微信退款
paymentOrderRefundApplicationService.refund(paymentOrderRefundList);
}
//发起微信退款
paymentOrderRefundApplicationService.refund(paymentOrderRefundList);
}
} catch (Exception e) {
log.error("接收到线下活动订单取消事件处理异常", e);

75
dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/order/OrderEventHandler.java

@ -4,7 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.eventbus.Subscribe;
import com.qniao.dam.application.service.marriagebounty.MarriageBountyOrderApplicationService;
import com.qniao.dam.application.service.order.OrderApplicationService;
import com.qniao.dam.application.service.right.RightApplicationService;
import com.qniao.dam.domain.aggregate.activity.entity.Activity;
import com.qniao.dam.domain.aggregate.activity.repository.ActivityRepository;
import com.qniao.dam.domain.aggregate.externalorder.ExternalOrderRelAggregate;
import com.qniao.dam.domain.aggregate.externalorder.entity.ExternalOrderRel;
import com.qniao.dam.domain.aggregate.order.OrderAggregate;
@ -27,11 +30,14 @@ import com.qniao.dam.domian.aggregate.product.constant.ProductTypeEnum;
import com.qniao.dam.infrastructure.constant.MqExchange;
import com.qniao.dam.infrastructure.persistent.dao.domain.ExternalOrderRelDao;
import com.qniao.dam.infrastructure.persistent.dao.domain.MarriageInformationDao;
import com.qniao.dam.infrastructure.persistent.dao.domain.SiteActivityDao;
import com.qniao.dam.infrastructure.utils.SnowFlakeUtil;
import com.qniao.dam.query.product.ProductQueryService;
import com.qniao.das.domian.aggregate.marriageinformation.MarriageInformation;
import com.qniao.das.domian.aggregate.siteactivity.SiteActivity;
import com.qniao.dau.application.UecServerApplicationService;
import com.qniao.domain.BaseApplicationService;
import com.qniao.domain.BaseDomainEvent;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Component;
@ -73,6 +79,12 @@ public class OrderEventHandler extends BaseApplicationService {
@Resource
private OrderAggregate orderAggregate;
@Resource
private SiteActivityDao siteActivityDao;
@Resource
private ActivityRepository activityRepository;
@Resource
private OrderApplicationService orderApplicationService;
@Resource
private SnowFlakeUtil snowFlakeUtil;
@Resource
private AmqpTemplate amqpTemplate;
@ -115,10 +127,8 @@ public class OrderEventHandler extends BaseApplicationService {
if (Objects.nonNull(externalOrderRel)) {
externalOrderRel.setStatus(ExternalOrderRelStatus.COMPLETED);
externalOrderRelAggregate.save(externalOrderRel);
if (ExternalOrderTypeEnum.VIP_PRODUCT.equals(externalOrderRel.getType())) {
//购买vip套餐赠送下线参与机会
if (ExternalOrderTypeEnum.SITE_ACTIVITY.equals(externalOrderRel.getType())) {
giftSiteActivityOrder(externalOrderRel.getExternalId(), order.getUserId(), order.getMiId());
} else if (ExternalOrderTypeEnum.SITE_ACTIVITY.equals(externalOrderRel.getType())) {
//发送订单完成事件
sendCompletedMQ(externalOrderRel, order);
}
@ -129,21 +139,52 @@ public class OrderEventHandler extends BaseApplicationService {
}
private void giftSiteActivityOrder(Long externalId, Long userId, Long miId) {
SiteActivity siteActivity = siteActivityDao.selectById(externalId);
MarriageInformation marriageInformation = marriageInformationDao.selectById(miId);
Product product = productQueryService.querySiteActivityBy(externalId, marriageInformation.getGenderCode());
Order order = Order.build(userId, miId, OrderBelongingEnum.CUSTOMER, marriageInformation.getNickName(), OrderTypeEnum.NORMAL);
ProductSpec productSpec = product.getProductSpecList().get(0);
OrderItem orderItem = OrderItem.build(productSpec.getProductId(), productSpec.getId(), product.getProductType(), product.getMainCategory(), product.getSubCategory(),
product.getProductTitle(), BigDecimal.ZERO, 1);
orderItem.setSettlementAmount(BigDecimal.ZERO);
order.setSettlementAmount(BigDecimal.ZERO);
order.setOrderItemList(Collections.singletonList(orderItem));
//设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
orderAggregate.complete(order);
ExternalOrderRel externalOrderRel = ExternalOrderRel.build(externalId, order.getId(), ExternalOrderTypeEnum.SITE_ACTIVITY, ExternalOrderRelStatus.COMPLETED);
externalOrderRelDao.insert(externalOrderRel);
sendCompletedMQ(externalOrderRel, order);
// 收费项 0 道具 1 收费活动
if (Objects.nonNull(siteActivity.getChargeType())) {
if (siteActivity.getChargeType() == 0) {
// 道具
Product product = productQueryService.queryById(siteActivity.getVipActivityId());
Order order = Order.build(userId, miId, OrderBelongingEnum.CUSTOMER, marriageInformation.getNickName(), OrderTypeEnum.NORMAL);
ProductSpec productSpec = product.getProductSpecList().get(0);
OrderItem orderItem = OrderItem.build(productSpec.getProductId(), productSpec.getId(), product.getProductType(), product.getMainCategory(), product.getSubCategory(),
product.getProductTitle(), BigDecimal.ZERO, 1);
orderItem.setSettlementAmount(BigDecimal.ZERO);
order.setSettlementAmount(BigDecimal.ZERO);
order.setOrderItemList(Collections.singletonList(orderItem));
//设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
BaseDomainEvent event = orderAggregate.complete(order);
this.sendEvent(event);
} else if (siteActivity.getChargeType() == 1) {
// 收费活动
Order order = new Order();
order.setUserId(userId);
order.setMiId(miId);
order.setActivityId(siteActivity.getVipActivityId());
order.setGroupType(1);
Activity activity = activityRepository.load(siteActivity.getVipActivityId());
List<OrderItem> orderItemList = new ArrayList<>();
activity.getActivityProductList().forEach(activityProduct -> {
OrderItem orderItem = new OrderItem();
orderItem.setProductSpecId(activityProduct.getProductSpecId());
orderItem.setQuantity(1);
orderItemList.add(orderItem);
});
order.setOrderItemList(orderItemList);
//1. 填充订单信息 + 同类型权益不同规格限制购买和提醒
orderApplicationService.fillOrderInfo(order);
order.getOrderItemList().forEach(orderItem -> {
orderItem.setSettlementAmount(BigDecimal.ZERO);
});
order.setSettlementAmount(BigDecimal.ZERO);
//设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
BaseDomainEvent event = orderAggregate.complete(order);
this.sendEvent(event);
}
}
}
private void sendCompletedMQ(ExternalOrderRel externalOrderRel, Order order) {

94
dating-agency-mall-server/src/main/java/com/qniao/dam/application/service/order/OrderApplicationService.java

@ -34,10 +34,16 @@ import com.qniao.dam.query.matchmaker.MatchmakerQueryService;
import com.qniao.dam.query.order.OrderQueryService;
import com.qniao.dam.query.product.ProductQueryService;
import com.qniao.dam.query.right.RightQueryService;
import com.qniao.das.application.DatingAgencyServiceApplicationService;
import com.qniao.das.application.request.CalculateSiteActivityFeeDto;
import com.qniao.das.application.response.CalculateSiteActivityFeeVo;
import com.qniao.das.domian.aggregate.marriageinformation.MarriageInformation;
import com.qniao.das.domian.aggregate.marriageinformation.constant.GenderEnum;
import com.qniao.das.domian.aggregate.siteactivity.SiteActivity;
import com.qniao.das.domian.aggregate.vip.VIPEnum;
import com.qniao.dau.domain.aggregate.matchmaker.entity.Matchmaker;
import com.qniao.domain.BaseApplicationService;
import com.qniao.domain.BaseDomainEvent;
import com.qniao.framework.exception.BizException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -50,7 +56,7 @@ import java.util.List;
import java.util.Objects;
@Service
public class OrderApplicationService {
public class OrderApplicationService extends BaseApplicationService {
@Resource
private SubmitOrderDomainService submitOrderDomainService;
@ -79,9 +85,9 @@ public class OrderApplicationService {
@Resource
private SiteActivityDao siteActivityDao;
@Resource
private ActivityRepository activityRepository;
@Resource
private RightQueryService rightQueryService;
@Resource
private DatingAgencyServiceApplicationService datingAgencyServiceApplicationService;
@Value("${marriage_bounty_meeting_quantity:5}")
private Integer marriageBountyMeetingQuantity;
@ -96,13 +102,13 @@ public class OrderApplicationService {
//1. 填充订单信息 + 同类型权益不同规格限制购买和提醒
fillOrderInfo(order);
//2. 订单金额计算
countOrderAmount(order);
countOrderAmount(order, false);
//3. 设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
//4. 组织付款单信息
PaymentOrder paymentOrder = makePaymentOrder(order);
submitOrderDomainService.handle(order, paymentOrder);
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId());
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId(), false);
}
public PaymentOrder makePaymentOrder(Order order) {
@ -113,7 +119,7 @@ public class OrderApplicationService {
return paymentOrder;
}
public void countOrderAmount(Order order) {
public void countOrderAmount(Order order, Boolean allowFree) {
if (CollUtil.isNotEmpty(order.getOrderItemList())) {
BigDecimal totalSettlementAmount = BigDecimal.ZERO;
for (OrderItem orderItem : order.getOrderItemList()) {
@ -121,13 +127,13 @@ public class OrderApplicationService {
totalSettlementAmount = totalSettlementAmount.add(orderItem.getSettlementAmount());
}
order.setSettlementAmount(totalSettlementAmount);
if (order.getSettlementAmount().compareTo(BigDecimal.ZERO) <= 0) {
if (!allowFree && order.getSettlementAmount().compareTo(BigDecimal.ZERO) <= 0) {
throw new BizException("订单金额应该大于0");
}
}
}
private void fillOrderInfo(Order order) {
public void fillOrderInfo(Order order) {
order.setOrderType(OrderTypeEnum.NORMAL);
if (CollUtil.isNotEmpty(order.getOrderItemList())) {
for (OrderItem orderItem : order.getOrderItemList()) {
@ -180,13 +186,13 @@ public class OrderApplicationService {
//2. 填充订单信息
fillMarriageBountyOrderInfo(order, productList);
//3. 订单金额计算
countOrderAmount(order);
countOrderAmount(order, false);
//4. 设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
//5. 组装付款单信息
PaymentOrder paymentOrder = makePaymentOrder(order);
submitOrderDomainService.handle(order, paymentOrder);
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId());
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId(), false);
}
private void handleProduct(Product product,
@ -270,41 +276,49 @@ public class OrderApplicationService {
SiteActivity siteActivity = siteActivityDao.selectById(dto.getSiteActivityId());
Order order = null;
PaymentOrder paymentOrder = null;
if (dto.getOpenVip()) {
//开通会员送活动
order = new Order();
order.setUserId(userId);
order.setMiId(dto.getMiId());
order.setActivityId(siteActivity.getVipActivityId());
order.setGroupType(1);
Activity activity = activityRepository.load(siteActivity.getVipActivityId());
List<OrderItem> orderItemList = new ArrayList<>();
activity.getActivityProductList().forEach(activityProduct -> {
OrderItem orderItem = new OrderItem();
orderItem.setProductSpecId(activityProduct.getProductSpecId());
orderItem.setQuantity(1);
orderItemList.add(orderItem);
});
order.setOrderItemList(orderItemList);
//1. 填充订单信息 + 同类型权益不同规格限制购买和提醒
fillOrderInfo(order);
} else {
//是否vip
boolean vip = rightQueryService.checkUserVipRight(userId, dto.getMiId()).getVip();
//报名参加活动
order = Order.build(userId, dto.getMiId(), OrderBelongingEnum.CUSTOMER, marriageInformation.getNickName(), OrderTypeEnum.NORMAL);
ProductSpec productSpec = product.getProductSpecList().get(0);
OrderItem orderItem = OrderItem.build(productSpec.getProductId(), productSpec.getId(), product.getProductType(), product.getMainCategory(), product.getSubCategory(),
product.getProductTitle(), siteActivity.calculateFee(GenderEnum.get(marriageInformation.getGenderCode()), vip), 1);
order.setOrderItemList(Collections.singletonList(orderItem));
// if (dto.getOpenVip()) {
// //开通会员送活动
// order = new Order();
// order.setUserId(userId);
// order.setMiId(dto.getMiId());
// order.setActivityId(siteActivity.getVipActivityId());
// order.setGroupType(1);
// Activity activity = activityRepository.load(siteActivity.getVipActivityId());
// List<OrderItem> orderItemList = new ArrayList<>();
// activity.getActivityProductList().forEach(activityProduct -> {
// OrderItem orderItem = new OrderItem();
// orderItem.setProductSpecId(activityProduct.getProductSpecId());
// orderItem.setQuantity(1);
// orderItemList.add(orderItem);
// });
// order.setOrderItemList(orderItemList);
// //1. 填充订单信息 + 同类型权益不同规格限制购买和提醒
// fillOrderInfo(order);
// } else {
//是否vip
boolean vip = rightQueryService.checkUserVipRight(userId, dto.getMiId()).getVip();
//报名参加活动
order = Order.build(userId, dto.getMiId(), OrderBelongingEnum.CUSTOMER, marriageInformation.getNickName(), OrderTypeEnum.NORMAL);
ProductSpec productSpec = product.getProductSpecList().get(0);
//todo feign 获取活动应付金额
CalculateSiteActivityFeeDto calculateDto = new CalculateSiteActivityFeeDto(dto.getSiteActivityId(), userId,
dto.getMiId(), vip ? VIPEnum.YES.getValue() : VIPEnum.NO.getValue());
CalculateSiteActivityFeeVo calculateVo = datingAgencyServiceApplicationService.calculateSiteActivityFeeBySdk(calculateDto);
if (calculateVo.getUnitOriginalPrice().compareTo(BigDecimal.ZERO) <= 0) {
throw new BizException("下单异常");
}
OrderItem orderItem = OrderItem.build(productSpec.getProductId(), productSpec.getId(), product.getProductType(), product.getMainCategory(), product.getSubCategory(),
product.getProductTitle(), calculateVo.getUnitSettlementPrice(), 1);
order.setOrderItemList(Collections.singletonList(orderItem));
// }
//2. 订单金额计算
countOrderAmount(order);
countOrderAmount(order, true);
//3. 设置订单号
order.setOrderCode(snowFlakeUtil.getSnowflakeOrderCode());
//4. 组织付款单信息
paymentOrder = makePaymentOrder(order);
submitSiteActivityOrderDomainService.handle(order, paymentOrder, dto.getSiteActivityId(), dto.getOpenVip());
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId());
List<BaseDomainEvent> eventList = submitSiteActivityOrderDomainService.handle(order, paymentOrder, dto.getSiteActivityId());
this.sendEvent(eventList);
return new UserSubmitOrderVo(order.getId(), paymentOrder.getId(), Objects.isNull(paymentOrder.getId()));
}
}

23
dating-agency-mall-server/src/main/java/com/qniao/dam/domain/service/order/SubmitSiteActivityOrderDomainService.java

@ -8,10 +8,14 @@ import com.qniao.dam.domain.aggregate.paymentorder.PaymentOrderAggregate;
import com.qniao.dam.domain.aggregate.paymentorder.entity.PaymentOrder;
import com.qniao.dam.domian.aggregate.externalorder.constant.ExternalOrderRelStatus;
import com.qniao.dam.domian.aggregate.externalorder.constant.ExternalOrderTypeEnum;
import com.qniao.domain.BaseDomainEvent;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@Service
public class SubmitSiteActivityOrderDomainService {
@ -24,12 +28,19 @@ public class SubmitSiteActivityOrderDomainService {
private ExternalOrderRelAggregate externalOrderRelAggregate;
@Transactional(rollbackFor = Exception.class)
public void handle(Order order, PaymentOrder paymentOrder, Long siteActivityId, Boolean openVip) {
orderAggregate.submit(order);
paymentOrder.setOrderId(order.getId());
paymentOrderAggregate.create(paymentOrder);
ExternalOrderRel externalOrderRel = ExternalOrderRel.build(siteActivityId, order.getId(),
openVip ? ExternalOrderTypeEnum.VIP_PRODUCT : ExternalOrderTypeEnum.SITE_ACTIVITY, ExternalOrderRelStatus.INIT);
public List<BaseDomainEvent> handle(Order order, PaymentOrder paymentOrder, Long siteActivityId) {
List<BaseDomainEvent> eventList = new ArrayList<>();
if (order.getSettlementAmount().compareTo(BigDecimal.ZERO) == 0) {
//免费
eventList.add(orderAggregate.complete(order));
} else {
//付费
orderAggregate.submit(order);
paymentOrder.setOrderId(order.getId());
paymentOrderAggregate.create(paymentOrder);
}
ExternalOrderRel externalOrderRel = ExternalOrderRel.build(siteActivityId, order.getId(), ExternalOrderTypeEnum.SITE_ACTIVITY, ExternalOrderRelStatus.INIT);
externalOrderRelAggregate.save(externalOrderRel);
return eventList;
}
}

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

@ -37,4 +37,6 @@ public interface ProductQueryService {
UserGetMatchmakerFranchiseInfoVo getMatchmakerFranchiseInfo();
Product querySiteActivityBy(Long siteActivityId, Integer genderCode);
Product queryById(Long id);
}

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

@ -149,6 +149,13 @@ public class ProductQueryServiceImpl implements ProductQueryService {
return siteActivityProduct;
}
@Override
public Product queryById(Long id) {
Product product = productDao.selectById(id);
product.setProductSpecList(listProductSpecBy(product.getId()));
return product;
}
@Override
public ProductSpecTerm getTermByName(List<ProductSpecTerm> productSpecTermList, ProductSpecTermNameEnum name) {
ProductSpecTerm productSpecTerm = null;
@ -187,8 +194,8 @@ public class ProductQueryServiceImpl implements ProductQueryService {
@Override
public UserPageProductByCustomerGroupVo getPageProductByCustomerDetails(Long id) {
List<UserPageProductByCustomerGroupVo> vos = getPageProductByCustomer(id);
if(!vos.isEmpty()){
List<UserPageProductByCustomerGroupVo> vos = getPageProductByCustomer(id);
if (!vos.isEmpty()) {
return vos.get(0);
}
return new UserPageProductByCustomerGroupVo();

Loading…
Cancel
Save