|
|
@@ -3,6 +3,12 @@ package com.ym.mec.biz.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+import com.microsvc.toolkit.common.tools.ThreadPool;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.entity.*;
|
|
|
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
@@ -27,13 +33,11 @@ import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
|
-import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
import com.ym.mec.thirdparty.adapay.entity.BaseResult;
|
|
|
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
|
|
|
-import com.ym.mec.thirdparty.yeepay.YeepayPaymentService;
|
|
|
import com.ym.mec.thirdparty.yqpay.*;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -45,8 +49,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
import java.util.*;
|
|
|
@@ -57,99 +59,98 @@ import java.util.stream.Collectors;
|
|
|
import static com.ym.mec.biz.dal.enums.DealStatusEnum.CLOSE;
|
|
|
import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
|
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrder> implements StudentPaymentOrderService {
|
|
|
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentPaymentOrderDao studentPaymentOrderDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private YqPayFeignService yqPayFeignService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentRegistrationService studentRegistrationService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
@Lazy
|
|
|
private VipGroupService vipGroupService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MusicGroupService musicGroupService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SporadicChargeInfoService sporadicChargeInfoService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private PracticeGroupService practiceGroupService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentRepairService studentRepairService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysUserCashAccountService sysUserCashAccountService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SubjectChangeService subjectChangeService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private DegreeRegistrationService degreeRegistrationService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private GoodsService goodsService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentInstrumentService studentInstrumentService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private ReplacementInstrumentActivityService replacementInstrumentActivityService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private ChildrenDayReserveService childrenDayReserveService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MemberRankSettingService memberRankSettingService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private PayService payService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private CloudTeacherOrderService cloudTeacherOrderService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysCouponCodeService sysCouponCodeService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private ActivityUserMapperService activityUserMapperService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private TenantConfigService tenantConfigService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private GoodsProcurementDao goodsProcurementDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysPaymentConfigService sysPaymentConfigService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SellOrderDao sellOrderDao;
|
|
|
@Lazy
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private ContractService contractService;
|
|
|
- @Resource
|
|
|
- private HfMerchantConfigService hfMerchantConfigService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentDao studentDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
- @Resource
|
|
|
- private YeepayPaymentService yeepayPaymentService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentRepairDao studentRepairDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MusicGroupDao musicGroupDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentGoodsSellDao studentGoodsSellDao;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MusicGroupPaymentCalenderAddressService musicGroupPaymentCalenderAddressService;
|
|
|
- @Resource
|
|
|
+ @Autowired
|
|
|
private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
|
|
|
+ @Autowired
|
|
|
+ private PaymentServiceContext paymentServiceContext;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
@Override
|
|
|
@@ -157,8 +158,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
return studentPaymentOrderDao;
|
|
|
}
|
|
|
|
|
|
- private final static Logger LOGGER = LoggerFactory.getLogger(StudentPaymentOrderServiceImpl.class);
|
|
|
-
|
|
|
@Override
|
|
|
public StudentPaymentOrderDao getDao() {
|
|
|
return studentPaymentOrderDao;
|
|
|
@@ -324,48 +323,58 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
Date date = new Date();
|
|
|
|
|
|
- if (payingOrders.size() == 0) {
|
|
|
+ if (CollectionUtils.isEmpty(payingOrders)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- List<String> orderNoList = new ArrayList<String>();
|
|
|
-
|
|
|
for (StudentPaymentOrder payingOrder : payingOrders) {
|
|
|
- //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
|
|
|
- if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo())) {
|
|
|
+ //查询支付超过10分钟的
|
|
|
+ if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 30) {
|
|
|
continue;
|
|
|
}
|
|
|
+ TenantContextHolder.setTenantId(payingOrder.getTenantId());
|
|
|
+ //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
|
|
|
if (payingOrder.getTransNo() == null) {
|
|
|
- orderNoList.add(payingOrder.getOrderNo());
|
|
|
- continue;
|
|
|
- }
|
|
|
- //查询支付超过10分钟的
|
|
|
- if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 10) {
|
|
|
- continue;
|
|
|
+ if ("205".equals(payingOrder.getPaymentAccountNo())){
|
|
|
+ continue;
|
|
|
+ }else {
|
|
|
+ payingOrder.setStatus(CLOSE);
|
|
|
+ payingOrder.setMemo("未拉起,超时未支付关闭");
|
|
|
+ callOrderCallBack(payingOrder);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
}
|
|
|
try {
|
|
|
- updateOrderStatus(date, payingOrder);
|
|
|
+ updateOrderStatus(date, payingOrder);
|
|
|
}catch (Exception e) {
|
|
|
- logger.error("执行[订单状态查询]任务失败", e);
|
|
|
- }
|
|
|
+ logger.error("执行[订单状态查询]任务失败,订单号:{}", payingOrder.getOrderNo(), e);
|
|
|
+ }finally {
|
|
|
+ TenantContextHolder.clearTenantId();
|
|
|
+ }
|
|
|
}
|
|
|
- closeOrders(orderNoList);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public OrderCancelModel updateOrderStatus(Date date, StudentPaymentOrder payingOrder) throws Exception {
|
|
|
|
|
|
- HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(payingOrder.getTenantId(), payingOrder.getPaymentChannel());
|
|
|
+ /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(payingOrder.getTenantId(), payingOrder.getPaymentChannel());
|
|
|
if(hfMerchantConfig == null){
|
|
|
throw new BizException("机构[{}]汇付商户信息找不到", payingOrder.getTenantId());
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(payingOrder.getPaymentChannel());
|
|
|
+// PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(payingOrder.getPaymentChannel());
|
|
|
|
|
|
- OrderCancelModel model = new OrderCancelModel();
|
|
|
- Map<String, Object> payment = new HashMap<String, Object>();
|
|
|
-
|
|
|
+// Map<String, Object> payment = new HashMap<String, Object>();
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(payingOrder.getPaymentChannel() + "_" + payingOrder.getTenantId());
|
|
|
+ if (paymentService == null) {
|
|
|
+ throw new BizException("支付渠道[{}]不支持", payingOrder.getPaymentChannel());
|
|
|
+ }
|
|
|
+ PaymentResp paymentResp = paymentService.query(payingOrder.getTransNo(), payingOrder.getOrderNo());
|
|
|
+ if (paymentResp == null) {
|
|
|
+ throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", payingOrder.getTransNo(), payingOrder.getOrderNo(), payingOrder.getPaymentChannel());
|
|
|
+ }
|
|
|
+/*
|
|
|
if(paymentChannel == PaymentChannelEnum.ADAPAY) {
|
|
|
payment = Payment.queryPayment(payingOrder.getTransNo(), hfMerchantConfig.getMerKey());
|
|
|
}else if(paymentChannel == PaymentChannelEnum.YEEPAY) {
|
|
|
@@ -386,28 +395,49 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
throw new BizException("[{}]支付渠道不支持", payingOrder.getPaymentChannel());
|
|
|
}
|
|
|
|
|
|
- LOGGER.warn("订单[{}]交易主动查询接口返回:{}", payingOrder.getTransNo(), payment);
|
|
|
-
|
|
|
+ LOGGER.warn("订单[{}]交易主动查询接口返回:{}", payingOrder.getTransNo(), payment);*/
|
|
|
Map<String, String> rpMap = new HashMap<>();
|
|
|
rpMap.put("merOrderNo", payingOrder.getOrderNo());
|
|
|
rpMap.put("orderNo", payingOrder.getTransNo());
|
|
|
- rpMap.put("channelType", (String) payment.get("pay_channel"));
|
|
|
- model.setPayChannel((String) payment.get("pay_channel"));
|
|
|
- String status = (String) payment.get("status");
|
|
|
- if (payment.containsKey("error_msg")) {
|
|
|
- rpMap.put("remarks", (String) payment.get("error_msg"));
|
|
|
+ rpMap.put("channelType", paymentResp.getPaymentChannel());
|
|
|
+ OrderCancelModel model = new OrderCancelModel();
|
|
|
+ model.setPayChannel(paymentResp.getPaymentChannel());
|
|
|
+// String status = (String) payment.get("status");
|
|
|
+ if (paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
|
|
|
+ rpMap.put("remarks", paymentResp.getMsg());
|
|
|
+ rpMap.put("tradeState", "0");
|
|
|
+ model.setStatus(false);
|
|
|
+ }else if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
|
|
|
+ rpMap.put("tradeState", "1");
|
|
|
+ model.setStatus(true);
|
|
|
+ } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
|
|
|
+ PaymentClose close = paymentService.close(payingOrder.getTransNo(), "超时未支付关闭", payingOrder.getOrderNo());
|
|
|
+ if (close == null) {
|
|
|
+ log.error("订单关闭失败,orderNo:{}", payingOrder.getOrderNo());
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+ if (close.getStatus() == PaymentStatus.SUCCESSED) {
|
|
|
+ log.info("关闭订单返回:{}", close);
|
|
|
+ payingOrder.setStatus(CLOSE);
|
|
|
+ payingOrder.setMemo("超时未支付关闭");
|
|
|
+ callOrderCallBack(payingOrder);
|
|
|
+ return model;
|
|
|
+ } else {
|
|
|
+ log.info("关闭订单返回:{}", close);
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
- if (status.equals("succeeded")) {
|
|
|
+ /*if (status.equals("succeeded")) {
|
|
|
rpMap.put("tradeState", "1");
|
|
|
model.setStatus(true);
|
|
|
} else if (status.equals("failed")
|
|
|
|| (DateUtil.minutesBetween(DateUtil.addHours(payingOrder.getUpdateTime(), 2),date) > 0)) {
|
|
|
rpMap.put("tradeState", "0");
|
|
|
model.setStatus(false);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- if (status.equals("succeeded") ||
|
|
|
- (status.equals("failed") || payingOrder.getCreateTime().before(DateUtil.addMinutes(new Date(), -35)))) {
|
|
|
+ if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED || paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
|
|
|
try {
|
|
|
updateOrder(rpMap); //更新订单
|
|
|
model.setSuccess(true);
|
|
|
@@ -501,21 +531,45 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
Date date = new Date();
|
|
|
|
|
|
- HfMerchantConfig hfMerchantConfig = null;
|
|
|
-
|
|
|
List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().getRouteOrders(order.getOrderNo());
|
|
|
-
|
|
|
- PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(order.getPaymentChannel());
|
|
|
-
|
|
|
|
|
|
- if(hfMerchantConfig == null){
|
|
|
- hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
|
|
|
- }
|
|
|
+ /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
|
|
|
if(hfMerchantConfig == null){
|
|
|
- throw new BizException("机构[{}][{}]商户信息找不到", order.getTenantId(), order.getPaymentChannel());
|
|
|
+ throw new BizException("机构[{}][{}]商户信息找不到", order.getTenantId(), order.getPaymentChannel());
|
|
|
+ }*/
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
|
|
|
+ for (StudentPaymentRouteOrder routeOrder : routeOrders) {
|
|
|
+ if (routeOrder.getRouteAmount().compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ routeOrder.setServiceFee(BigDecimal.ZERO);
|
|
|
+ routeOrder.setUpdateTime(date);
|
|
|
+ studentPaymentRouteOrderService.getDao().update(routeOrder);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ // 执行分账逻辑
|
|
|
+ DivideReq.DivMember divMember = DivideReq.DivMember.builder()
|
|
|
+ .memberId(routeOrder.getMerNo().equals(ConfigInit.merNo) ? "0" : routeOrder.getMerNo())
|
|
|
+ .amount(routeOrder.getRouteAmount().setScale(2, RoundingMode.HALF_UP))
|
|
|
+ .feeFlag("Y")
|
|
|
+ .build();
|
|
|
+ DivideReq divideReq = DivideReq.builder()
|
|
|
+ .transNo(order.getTransNo())
|
|
|
+ .orderNo(order.getOrderNo())
|
|
|
+ .divideOrderNo(idGeneratorService.generatorId("payment") + "")
|
|
|
+ .divideAmount(divMember.getAmount())
|
|
|
+ .divMembers(Lists.newArrayList(divMember))
|
|
|
+ .build();
|
|
|
+ try {
|
|
|
+ DivideResp divide = paymentService.divide(divideReq);
|
|
|
+ log.info("分账信息返回:{}", divide);
|
|
|
+ routeOrder.setServiceFee(divide.getFeeAmount());
|
|
|
+ routeOrder.setUpdateTime(date);
|
|
|
+ studentPaymentRouteOrderService.getDao().update(routeOrder);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("分账失败 orderId:{}", order.getId(), e);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- StudentPaymentRouteOrder studentPaymentRouteOrder = null;
|
|
|
+
|
|
|
+ /*StudentPaymentRouteOrder studentPaymentRouteOrder = null;
|
|
|
|
|
|
if(paymentChannel == PaymentChannelEnum.ADAPAY) {
|
|
|
|
|
|
@@ -601,7 +655,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
studentPaymentRouteOrderService.getDao().update(spro);
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
@@ -655,7 +709,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
private void closeOrders(List<String> orderNoList) throws Exception {
|
|
|
- if (orderNoList.size() == 0) {
|
|
|
+ if (CollectionUtils.isEmpty(orderNoList)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
@@ -665,15 +719,19 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
List<StudentPaymentOrder> ordersOverTime = findOrdersOverTime(orderNoList, DealStatusEnum.ING, beforeDate);
|
|
|
for (StudentPaymentOrder order : ordersOverTime) {
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
|
|
|
+ if (paymentService == null) {
|
|
|
+ log.error("关闭订单失败,支付渠道[{}]不支持,订单编号{}", order.getPaymentChannel(), order.getOrderNo());
|
|
|
+ }
|
|
|
try {
|
|
|
+ PaymentClose close = paymentService.close(order.getTransNo(), "超时未支付关闭", order.getOrderNo());
|
|
|
TenantContextHolder.setTenantId(order.getTenantId());
|
|
|
- order.setStatus(DealStatusEnum.FAILED);
|
|
|
- order.setMemo("超时未支付关闭");
|
|
|
+ order.setStatus(CLOSE);
|
|
|
+ order.setMemo(close.getMsg());
|
|
|
callOrderCallBack(order);
|
|
|
TenantContextHolder.clearTenantId();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -876,22 +934,35 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public PayStatus queryPayStatus(StudentPaymentOrder studentPaymentOrder) throws Exception {
|
|
|
-
|
|
|
+
|
|
|
String paymentChannel = studentPaymentOrder.getPaymentChannel();
|
|
|
String orderNo = studentPaymentOrder.getOrderNo();
|
|
|
String transNo = studentPaymentOrder.getTransNo();
|
|
|
-
|
|
|
+
|
|
|
if (StringUtils.isBlank(transNo)) {
|
|
|
return PayStatus.FAILED;
|
|
|
}
|
|
|
-
|
|
|
- HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(studentPaymentOrder.getTenantId(), studentPaymentOrder.getPaymentChannel());
|
|
|
+
|
|
|
+ /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(studentPaymentOrder.getTenantId(), studentPaymentOrder.getPaymentChannel());
|
|
|
if(hfMerchantConfig == null){
|
|
|
throw new BizException("机构[{}]汇付商户信息找不到", studentPaymentOrder.getTenantId());
|
|
|
+ }*/
|
|
|
+ PaymentResp paymentResp = paymentServiceContext.getPaymentService(paymentChannel + "_" + studentPaymentOrder.getTenantId())
|
|
|
+ .query(transNo, orderNo);
|
|
|
+ if (paymentResp == null) {
|
|
|
+ throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", transNo, orderNo, paymentChannel);
|
|
|
+ }
|
|
|
+ if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
|
|
|
+ return PayStatus.SUCCESSED;
|
|
|
+ } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
|
|
|
+ return PayStatus.PAYING;
|
|
|
+ }else {
|
|
|
+ return PayStatus.FAILED;
|
|
|
}
|
|
|
-
|
|
|
- if (StringUtils.equals(paymentChannel, "ADAPAY")) {
|
|
|
+
|
|
|
+ /*if (StringUtils.equals(paymentChannel, "ADAPAY")) {
|
|
|
Map<String, Object> payment = Payment.queryPayment(transNo, hfMerchantConfig.getMerKey());
|
|
|
String status = (String) payment.get("status");
|
|
|
if (status.equals("succeeded")) {
|
|
|
@@ -945,7 +1016,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
throw new BizException(result.get("message").toString());
|
|
|
}
|
|
|
- throw new BizException("支付渠道错误");
|
|
|
+ throw new BizException("支付渠道错误");*/
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -1056,22 +1127,49 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public HttpResponseResult checkRepeatPay(StudentPaymentOrder order, Boolean repeatPay) throws Exception {
|
|
|
// 查询订单状态
|
|
|
- PayStatus payStatus = this.queryPayStatus(order);
|
|
|
- if (payStatus == PayStatus.SUCCESSED) {
|
|
|
- throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }
|
|
|
- if (!repeatPay && payStatus == PayStatus.PAYING) {
|
|
|
- return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
|
|
|
+ String paymentChannel = order.getPaymentChannel();
|
|
|
+ String orderNo = order.getOrderNo();
|
|
|
+ String transNo = order.getTransNo();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(transNo)) {
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(paymentChannel + "_" + order.getTenantId());
|
|
|
+ if (paymentService == null) {
|
|
|
+ log.error("获取支付服务异常,稍后请重试,orderNo:{}", order.getOrderNo());
|
|
|
+ throw new BizException("获取支付服务异常,稍后请重试");
|
|
|
+ }
|
|
|
+ PaymentResp paymentResp = paymentService.query(transNo, orderNo);
|
|
|
+ if (paymentResp == null) {
|
|
|
+ log.error("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", transNo, orderNo, paymentChannel);
|
|
|
+ throw new BizException("订单支付状态获取异常,稍后请重试");
|
|
|
+ }
|
|
|
+ if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
|
|
|
+ throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
+ }else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
|
|
|
+ if (!repeatPay) {
|
|
|
+ return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
|
|
|
+ }
|
|
|
+ PaymentClose close = paymentService.close(order.getTransNo(), "超时未支付关闭", order.getOrderNo());
|
|
|
+ if (close == null) {
|
|
|
+ log.error("订单关闭失败,orderNo:{}", order.getOrderNo());
|
|
|
+ throw new BizException("上一笔订单关闭失败,稍后请重试");
|
|
|
+ }
|
|
|
+ if (close.getStatus() != PaymentStatus.SUCCESSED) {
|
|
|
+ log.error("关闭订单失败,orderNo:{},msg:{}", order.getOrderNo(), close.getMsg());
|
|
|
+ throw new BizException("上一笔订单关闭失败,稍后请重试");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return BaseController.failed("该订单已关闭,请重新购买!");
|
|
|
+ }
|
|
|
}
|
|
|
//处理关闭订单
|
|
|
order.setStatus(CLOSE);
|
|
|
- order.setMemo("关闭订单");
|
|
|
-
|
|
|
+ order.setMemo("用户主动关闭订单");
|
|
|
|
|
|
Date nowDate = new Date();
|
|
|
//增加商品库存
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(order.getId());
|
|
|
- String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
+ String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList)
|
|
|
+ .filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
|
|
|
if(StringUtils.isNotBlank(goodsIds)){
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
@@ -1091,7 +1189,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
}
|
|
|
- if(batchUpdateGoodsMap.size() > 0){
|
|
|
+ if(!batchUpdateGoodsMap.isEmpty()){
|
|
|
goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
|
}
|
|
|
}
|
|
|
@@ -1119,9 +1217,9 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (studentRegistration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.APPLY) {
|
|
|
List<StudentPaymentOrder> oldStudentPaymentOrderList = this.queryByCondition(GroupType.MUSIC, musicGroupId, userId, SUCCESS, OrderTypeEnum.APPLY);
|
|
|
//判断是否有成功的订单,如果有,表示已经处理过人数
|
|
|
- if (oldStudentPaymentOrderList == null || oldStudentPaymentOrderList.size() == 0) {
|
|
|
+ if (CollectionUtils.isEmpty(oldStudentPaymentOrderList)) {
|
|
|
List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailService.getOrderDetail(order.getId());
|
|
|
- if (orderDetail != null && orderDetail.size() > 0) {
|
|
|
+ if (CollectionUtils.isNotEmpty(orderDetail)) {
|
|
|
long count = orderDetail.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MUSICAL || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER).count();
|
|
|
MusicGroup musicGroup = musicGroupService.get(musicGroupId);
|
|
|
//如果购买了乐器或者云教练,或者不是会员团,那么关闭订单时人数减一
|
|
|
@@ -1260,14 +1358,18 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (orderByOrderNo == null) {
|
|
|
throw new BizException("未找到原订单");
|
|
|
}
|
|
|
+ HttpResponseResult result = this.checkRepeatPay(orderByOrderNo, true);
|
|
|
+ if (result.getCode() != 200) {
|
|
|
+ throw new BizException(result.getMsg());
|
|
|
+ }
|
|
|
amount = orderByOrderNo.getActualAmount();
|
|
|
balance = orderByOrderNo.getBalancePaymentAmount();
|
|
|
// 已有订单,先关单
|
|
|
- orderByOrderNo.setStatus(CLOSE);
|
|
|
+ /*orderByOrderNo.setStatus(CLOSE);
|
|
|
orderByOrderNo.setMemo("关闭订单");
|
|
|
this.update(orderByOrderNo);
|
|
|
//退优惠券
|
|
|
- sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());
|
|
|
+ sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());*/
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1327,7 +1429,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
studentGoodsSell.setGoodsJson(model.getOrderInfo());
|
|
|
studentGoodsSell.setOrderNo(model.getOrderNo());
|
|
|
List<Integer> couponIdList = model.getCouponIdList();
|
|
|
- if (couponIdList != null && couponIdList.size() > 0) {
|
|
|
+ if (CollectionUtils.isNotEmpty(couponIdList)) {
|
|
|
studentGoodsSell.setCouponIds(StringUtils.join(couponIdList, ","));
|
|
|
}
|
|
|
studentGoodsSell.setTenantId(student.getTenantId());
|
|
|
@@ -1418,13 +1520,13 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
long count = goodsOrderItemVOS.stream().filter(e -> StringUtils.isEmpty(e.getOrderSn())).count();
|
|
|
//如果有空的商品货号,不处理
|
|
|
if(count == 0l){
|
|
|
- List<String> productSns = goodsOrderItemVOS.stream().map(e -> e.getProductSn()).distinct().collect(Collectors.toList());
|
|
|
+ List<String> productSns = goodsOrderItemVOS.stream().map(GoodsOrderItemVO::getProductSn).distinct().collect(Collectors.toList());
|
|
|
List<Goods> goodsList = goodsService.getGoodsDao().findBySns(productSns);
|
|
|
//如果有不匹配的商品货号,不处理
|
|
|
if(CollectionUtils.isEmpty(goodsList) || goodsList.size() < productSns.size()){
|
|
|
return;
|
|
|
}
|
|
|
- Map<String, Goods> goodsSnMap = goodsList.stream().collect(Collectors.groupingBy(e -> e.getSn(),
|
|
|
+ Map<String, Goods> goodsSnMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getSn,
|
|
|
Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0))));
|
|
|
List<StudentPaymentOrderDetail> orderDetails = new ArrayList<>();
|
|
|
List<SellOrder> sellOrders = new ArrayList<>();
|
|
|
@@ -1685,12 +1787,52 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public OrderCancelModel cancelOrder(StudentPaymentOrder order, String reason) {
|
|
|
OrderCancelModel model = new OrderCancelModel();
|
|
|
model.setSuccess(true);
|
|
|
try {
|
|
|
- HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
|
|
|
+ String errorMessage = null;
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
|
|
|
+ if (paymentService == null) {
|
|
|
+ throw new BizException("支付渠道不支持:{}", order.getPaymentChannel());
|
|
|
+ }
|
|
|
+ PaymentResp paymentResp = paymentService.query(order.getTransNo(), order.getOrderNo());
|
|
|
+ if (paymentResp == null) {
|
|
|
+ throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", order.getTransNo(), order.getOrderNo(), order.getPaymentChannel());
|
|
|
+ }
|
|
|
+ if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
|
|
|
+ model.setStatus(true);
|
|
|
+ order.setStatus(SUCCESS);
|
|
|
+ } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
|
|
|
+ // 执行关单操作
|
|
|
+ PaymentClose paymentClose = paymentService.close(order.getTransNo(), reason, order.getOrderNo());
|
|
|
+ model.setSuccess(false);
|
|
|
+ if (Objects.nonNull(paymentClose)) {
|
|
|
+ model.setMessage(paymentClose.getMsg());
|
|
|
+ errorMessage = paymentClose.getMsg();
|
|
|
+ // 订单取消,三方返回异常信息
|
|
|
+ if (StringUtils.isNotEmpty(errorMessage)) {
|
|
|
+ log.warn("cancelPayment orderNo={}, ex={}", order.getOrderNo(), errorMessage);
|
|
|
+ // 记录异常消息
|
|
|
+ ThreadPool.getExecutor().submit(() -> {
|
|
|
+ order.setMemo(paymentClose.getMsg());
|
|
|
+ // 更新订单关单异常信息
|
|
|
+ studentPaymentOrderDao.update(order);
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ model.setSuccess(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ model.setStatus(false);
|
|
|
+ order.setStatus(CLOSE);
|
|
|
+ }else {
|
|
|
+ model.setStatus(false);
|
|
|
+ order.setStatus(CLOSE);
|
|
|
+ order.setMemo(reason);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
|
|
|
if(hfMerchantConfig == null){
|
|
|
throw new BizException("机构[{}]汇付商户信息找不到", order.getTenantId());
|
|
|
}
|
|
|
@@ -1738,7 +1880,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
order.setStatus(CLOSE);
|
|
|
model.setSuccess(success);
|
|
|
model.setMessage(closeInfo.get("msg"));
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (model.getSuccess()) {
|
|
|
TenantContextHolder.setTenantId(order.getTenantId());
|
|
|
callOrderCallBack(order);
|
|
|
@@ -1753,28 +1895,48 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public BaseResult<Map<String, Object>> refund(String orderNo, String notifyUrl, String refundNo) {
|
|
|
|
|
|
- StudentPaymentOrder orderByOrderNo = this.findOrderByOrderNo(orderNo);
|
|
|
- if (orderByOrderNo == null) {
|
|
|
+ StudentPaymentOrder paymentOrder = this.findOrderByOrderNo(orderNo);
|
|
|
+ if (paymentOrder == null) {
|
|
|
throw new BizException("为找到订单");
|
|
|
}
|
|
|
- if (orderByOrderNo.getActualAmount().compareTo(BigDecimal.ZERO) ==0) {
|
|
|
+ if (paymentOrder.getActualAmount().compareTo(BigDecimal.ZERO) ==0) {
|
|
|
throw new BizException("0元订单");
|
|
|
}
|
|
|
-
|
|
|
+ BasePaymentService paymentService = paymentServiceContext.getPaymentService(paymentOrder.getPaymentChannel() + "_" + paymentOrder.getTenantId());
|
|
|
+ if (paymentService == null) {
|
|
|
+ throw new BizException("支付渠道不支持:{}", paymentOrder.getPaymentChannel());
|
|
|
+ }
|
|
|
+ RefundOrder refundOrder = new RefundOrder();
|
|
|
+ refundOrder.setUserId(paymentOrder.getUserId().toString());
|
|
|
+ refundOrder.setMerOrderNo(refundNo);
|
|
|
+ refundOrder.setRefundAmount(paymentOrder.getActualAmount());
|
|
|
+ refundOrder.setOrderAmount(paymentOrder.getActualAmount());
|
|
|
+ refundOrder.setTransNo(paymentOrder.getTransNo());
|
|
|
+ refundOrder.setPaymentOrderNo(paymentOrder.getOrderNo());
|
|
|
+ RefundResp refundResp = paymentService.refund(refundOrder);
|
|
|
+ // 申请请求失败
|
|
|
+ if (PaymentStatus.FAILED == refundResp.getPaymentStatus()) {
|
|
|
+ return BaseResult.failed(refundResp.getMsg());
|
|
|
+ } else {
|
|
|
+ Map<String,Object> param = new HashMap<>();
|
|
|
+ param.put("refundNo",refundNo);
|
|
|
+ return BaseResult.succeed(param);
|
|
|
+ }
|
|
|
+/*
|
|
|
HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(orderByOrderNo.getTenantId(), orderByOrderNo.getPaymentChannel());
|
|
|
if(hfMerchantConfig == null){
|
|
|
throw new BizException("请配置机构的汇付商户信息");
|
|
|
}
|
|
|
return Payment.reversePayment(orderByOrderNo.getTransNo(),hfMerchantConfig.getAppId(),refundNo,
|
|
|
- orderByOrderNo.getActualAmount().setScale(2,BigDecimal.ROUND_HALF_UP).toString(),notifyUrl);
|
|
|
+ orderByOrderNo.getActualAmount().setScale(2, RoundingMode.HALF_UP).toString(),notifyUrl);*/
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map couponAmount(MallCreateOrderModel model) {
|
|
|
- Map payMap = new HashMap();
|
|
|
+ public Map<String,Object> couponAmount(MallCreateOrderModel model) {
|
|
|
+ Map<String,Object> payMap = new HashMap(2);
|
|
|
StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(model.getCouponIdList(), model.getAmount(),false);
|
|
|
payMap.put("mallCouponAmount",studentPaymentOrder.getCouponRemitFee() == null?BigDecimal.ZERO:studentPaymentOrder.getCouponRemitFee());
|
|
|
payMap.put("mallStatus",1);
|
|
|
@@ -1820,7 +1982,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
&& e.getGroupType() != GroupType.MEMBER
|
|
|
&& e.getGroupType() != GroupType.ACTIVITY
|
|
|
&& e.getGroupType() != GroupType.VIP
|
|
|
- && e.getGroupType() != GroupType.LIVE).map(e -> e.getId()).collect(Collectors.toList());
|
|
|
+ && e.getGroupType() != GroupType.LIVE).map(StudentPaymentOrder::getId).collect(Collectors.toList());
|
|
|
Map<Long, List<StudentPaymentOrderExportDto>> feeByTypeMap = new HashMap<>();
|
|
|
Map<Long, BigDecimal> childRepairMap = new HashMap<>();
|
|
|
if (!org.springframework.util.CollectionUtils.isEmpty(otherOrderIds)) {
|
|
|
@@ -1831,7 +1993,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//获取外部订单,将学校商品采购划分为大件乐器
|
|
|
Map<String, StudentPaymentRouteOrder> routeOrderMap = new HashMap<>();
|
|
|
List<String> outOrderNos = studentPaymentOrderExportDtos.stream().filter(e -> e.getGroupType() == GroupType.OUTORDER && e.getType() == OrderTypeEnum.SCHOOL)
|
|
|
- .map(e -> e.getOrderNo()).collect(Collectors.toList());
|
|
|
+ .map(StudentPaymentOrder::getOrderNo).collect(Collectors.toList());
|
|
|
if(CollectionUtils.isNotEmpty(outOrderNos)){
|
|
|
List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().queryByOrderNos(outOrderNos);
|
|
|
if (CollectionUtils.isNotEmpty(routeOrders)){
|
|
|
@@ -1843,7 +2005,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
// List<Integer> organIds = studentPaymentOrderExportDtos.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
|
|
|
Map<Integer, String> userOrganNameMap = this.getMap("organization","id_","name_",true,1,Integer.class,String.class);
|
|
|
//按分部分组
|
|
|
- Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(e -> e.getOrganId()));
|
|
|
+ Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getOrganId));
|
|
|
List<OperatingTotalIncomeDto> incomeDtos = new ArrayList<>();
|
|
|
//承担课程的云教练收入
|
|
|
String month = params.get("month").toString();
|
|
|
@@ -1945,15 +2107,14 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
row.setDegreeFee(row.getActualAmount());
|
|
|
}else {
|
|
|
String[] feeTypes = row.getMemo().split(";");
|
|
|
- List<String> feeTypeList = Arrays.asList(feeTypes);
|
|
|
- for (String feeTypeStr : feeTypeList) {
|
|
|
+ for (String feeTypeStr : feeTypes) {
|
|
|
int index = feeTypeStr.lastIndexOf(":");
|
|
|
if (index < 0) {
|
|
|
continue;
|
|
|
}
|
|
|
BigDecimal typeFee = new BigDecimal(feeTypeStr.substring(index + 1));
|
|
|
if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
|
|
|
+ typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, RoundingMode.DOWN);
|
|
|
}
|
|
|
if (feeTypeStr.contains("VIP")) {
|
|
|
row.setVipCourseFee(typeFee);
|
|
|
@@ -2131,7 +2292,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (CollectionUtils.isEmpty(orderSkuSyncs)) {
|
|
|
return;
|
|
|
}
|
|
|
- List<String> orderNos = orderSkuSyncs.stream().map(e -> e.getOrderNo()).collect(Collectors.toList());
|
|
|
+ List<String> orderNos = orderSkuSyncs.stream().map(OrderSkuSync::getOrderNo).collect(Collectors.toList());
|
|
|
List<SellOrder> sellOrders = sellOrderDao.queryByOrganNos(orderNos);
|
|
|
if (CollectionUtils.isEmpty(sellOrders)) {
|
|
|
return;
|