|
@@ -54,6 +54,7 @@ import com.cyksj.model.dto.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.model.manage.dto.ChannelBaiDuDiscountDto;
|
|
import com.cyksj.model.manage.dto.ChannelBaiDuDiscountDto;
|
|
|
import com.cyksj.model.manage.dto.GiftCardDto;
|
|
import com.cyksj.model.manage.dto.GiftCardDto;
|
|
|
|
|
+import com.cyksj.model.manage.request.ReqGoodsSkuSpec;
|
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
import com.cyksj.model.manage.views.GroupsRelationView;
|
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
import com.cyksj.model.manage.views.OrderDonView;
|
|
|
import com.cyksj.model.request.*;
|
|
import com.cyksj.model.request.*;
|
|
@@ -131,6 +132,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
private final GoodsDonMapper goodsDonMapper;
|
|
|
|
|
|
|
|
|
|
+ private final GoodsDonSpecMapper goodsDonSpecMapper;
|
|
|
|
|
+
|
|
|
private final GroupsRelationMapper groupsRelationMapper;
|
|
private final GroupsRelationMapper groupsRelationMapper;
|
|
|
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
private final BeanSearcher beanSearcher;
|
|
@@ -261,6 +264,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
|
|
private final EquipmentActivityReduceMapper equipmentActivityReduceMapper;
|
|
private final EquipmentActivityReduceMapper equipmentActivityReduceMapper;
|
|
|
|
|
|
|
|
|
|
+ private final InformationClickUserRecordMapper informationClickUserRecordMapper;
|
|
|
|
|
+
|
|
|
|
|
+ private final UserCertRecordMapper userCertRecordMapper;
|
|
|
|
|
+
|
|
|
private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
|
|
private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@@ -399,6 +406,23 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
payRequest.setDonMoney(sku.getPrice());
|
|
payRequest.setDonMoney(sku.getPrice());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //租赁商品
|
|
|
|
|
+ if (goodsDon.getType() == 4) {
|
|
|
|
|
+ //是否已实名认证过
|
|
|
|
|
+ List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, user);
|
|
|
|
|
+ Integer count = userCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserCertRecord.class).in(UserCertRecord::getUserId, userIdList));
|
|
|
|
|
+ if (count == 0) throw BusinessRuntimeException.getInstance("请您先完成实名认证..");
|
|
|
|
|
+
|
|
|
|
|
+ //租赁商品押金
|
|
|
|
|
+ BigDecimal rentGoodsDonDeposit = getRentGoodsDonDeposit(goodsId, sku.getSpecIds());
|
|
|
|
|
+ if (rentGoodsDonDeposit == null) throw BusinessRuntimeException.getInstance("应付押金异常..");
|
|
|
|
|
+ BigDecimal sPay = rentGoodsDonDeposit.add(sku.getPrice());
|
|
|
|
|
+ if (payRequest.getDonMoney().compareTo(sPay) < 0) {
|
|
|
|
|
+ payRequest.setDonMoney(sPay);
|
|
|
|
|
+ }
|
|
|
|
|
+ orderDon.setDeposit(rentGoodsDonDeposit);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
orderDon.setMoney(payRequest.getDonMoney());
|
|
orderDon.setMoney(payRequest.getDonMoney());
|
|
|
orderDon.setRealMoney(payRequest.getDonMoney());
|
|
orderDon.setRealMoney(payRequest.getDonMoney());
|
|
|
orderDon.setOriMoney(sku.getPrice());
|
|
orderDon.setOriMoney(sku.getPrice());
|
|
@@ -603,6 +627,13 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
corpInteractiveUserOrderRelationMapper.insert(corpInteractiveUserOrderRelation);
|
|
corpInteractiveUserOrderRelationMapper.insert(corpInteractiveUserOrderRelation);
|
|
|
}
|
|
}
|
|
|
|
|
+ //记录文章下单量
|
|
|
|
|
+ if (payRequest.getInfoId() != null){
|
|
|
|
|
+ InformationClickUserRecord informationClickUserRecord = new InformationClickUserRecord();
|
|
|
|
|
+ informationClickUserRecord.setInfoId(payRequest.getInfoId());
|
|
|
|
|
+ informationClickUserRecord.setOrderId(orderDon.getId());
|
|
|
|
|
+ informationClickUserRecordMapper.insert(informationClickUserRecord);
|
|
|
|
|
+ }
|
|
|
return orderDon;
|
|
return orderDon;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -818,7 +849,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
}
|
|
|
//返还余额
|
|
//返还余额
|
|
|
if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), UserBalanceSourceRecord.Source.close, orderDon.getYhsId());
|
|
|
|
|
|
|
+ userBenefitsService.addUserBalance(orderDon.getUserId(), orderDon.getBalance(), null, null, null, null, false);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//是否是礼品卡 现金支付订单
|
|
//是否是礼品卡 现金支付订单
|
|
@@ -1227,16 +1258,11 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (orderDon.getSkuId() != null) {
|
|
if (orderDon.getSkuId() != null) {
|
|
|
sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
|
|
sku = goodsDonSkuMapper.selectById(orderDon.getSkuId());
|
|
|
}
|
|
}
|
|
|
- orderDon.setStatus(goodsDon.getType() == 1 && goodsDon.getSecondType() == 2 ? OrderDon.Status.complete : OrderDon.Status.hasPayment);
|
|
|
|
|
- updateGroupsTicket(orderDon, goodsDon, sku);
|
|
|
|
|
if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
orderDon.setType(OrderDon.Type.BALANCE);
|
|
orderDon.setType(OrderDon.Type.BALANCE);
|
|
|
orderDon.setPayTime(DateTime.now());
|
|
orderDon.setPayTime(DateTime.now());
|
|
|
}
|
|
}
|
|
|
- this.updateById(orderDon);
|
|
|
|
|
-
|
|
|
|
|
- //调整指定规格车队下次可 停用车位数的时间
|
|
|
|
|
- groupRelationFrontService.adjustGroupsParkingTime(orderDon.getRelationId(), sku);
|
|
|
|
|
|
|
+ unifiedHandlerOrderNotify(orderDon, goodsDon, sku);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void updateCarParkAndSendMsg(GoodsDon goodsDon, GoodsDonSku sku, OrderDon order) {
|
|
public void updateCarParkAndSendMsg(GoodsDon goodsDon, GoodsDonSku sku, OrderDon order) {
|
|
@@ -2257,7 +2283,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
.in(OrderDon::getStatus, List.of(OrderDon.Status.noPayment, OrderDon.Status.close))
|
|
.in(OrderDon::getStatus, List.of(OrderDon.Status.noPayment, OrderDon.Status.close))
|
|
|
.eq(OrderDon::getId, orderDon.getId()));
|
|
.eq(OrderDon::getId, orderDon.getId()));
|
|
|
if (!isSuccess) {
|
|
if (!isSuccess) {
|
|
|
- log.info("支付宝回调商家订单号:{}订单状态已修改", orderDon.getOrderNo());
|
|
|
|
|
|
|
+ log.info("该订单{}状态已修改", orderDon.getOrderNo());
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2280,6 +2306,11 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
//调整指定规格车队下次可 停用车位数的时间
|
|
//调整指定规格车队下次可 停用车位数的时间
|
|
|
groupRelationFrontService.adjustGroupsParkingTime(orderDon.getRelationId(), sku);
|
|
groupRelationFrontService.adjustGroupsParkingTime(orderDon.getRelationId(), sku);
|
|
|
|
|
|
|
|
|
|
+ //余额使用记录
|
|
|
|
|
+ if (orderDon.getBalance().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
|
|
+ userBenefitsService.recordBalanceBySource(orderDon.getUserId(), orderDon.getBalance().negate(), UserBalanceSourceRecord.Source.payment, orderDon.getId(), goodsDon.getTitle() + UserBalanceSourceRecord.Source.payment.getDesc());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
TASK_POOL.execute(()->{
|
|
TASK_POOL.execute(()->{
|
|
|
try {
|
|
try {
|
|
|
//发放积分
|
|
//发放积分
|
|
@@ -2777,7 +2808,28 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
Integer success = userMapper.deductBalance(user.getId(), subBalance, userBalance);
|
|
Integer success = userMapper.deductBalance(user.getId(), subBalance, userBalance);
|
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
|
|
if (success != 1) throw BusinessRuntimeException.getInstance("您的余额不足!");
|
|
|
orderDon.setBalance(subBalance);
|
|
orderDon.setBalance(subBalance);
|
|
|
- userBenefitsService.recordBalanceBySource(user.getId(), BigDecimal.valueOf(-subBalance.longValue()), UserBalanceSourceRecord.Source.payment);
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取租赁商品的应付押金
|
|
|
|
|
+ */
|
|
|
|
|
+ private BigDecimal getRentGoodsDonDeposit(Long goodsId, String specIdsStr) throws Exception {
|
|
|
|
|
+ GoodsDonSpec rentGoodsDonSpec = goodsDonSpecMapper.selectOne(Wrappers.lambdaQuery(GoodsDonSpec.class)
|
|
|
|
|
+ .eq(GoodsDonSpec::getGoodsId, goodsId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ List<Integer> specIds = Jsons.parseList(specIdsStr, Integer.class);
|
|
|
|
|
+ String specsJson = rentGoodsDonSpec.getSpecsJson();
|
|
|
|
|
+ List<ReqGoodsSkuSpec> reqGoodsSkuSpec = Jsons.parseList(specsJson, ReqGoodsSkuSpec.class);
|
|
|
|
|
+ for (ReqGoodsSkuSpec spec : reqGoodsSkuSpec) {
|
|
|
|
|
+ if (spec.getKey().contains("版本")) {
|
|
|
|
|
+ for (ReqGoodsSkuSpec.Node value : spec.getValues()) {
|
|
|
|
|
+ if (specIds.contains(value.getId())) {
|
|
|
|
|
+ return value.getDeposit();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|