|
@@ -2,12 +2,15 @@ package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
+import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
|
|
|
+import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
|
|
|
import com.ym.mec.biz.dal.dto.PageInfoOrder;
|
|
|
import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
|
|
|
import com.ym.mec.biz.dal.entity.Goods;
|
|
|
import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.SporadicOrderQueryInfo;
|
|
|
import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
|
|
@@ -15,7 +18,9 @@ import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
+import com.ym.mec.thirdparty.adapay.ConfigInit;
|
|
|
import com.ym.mec.thirdparty.adapay.Payment;
|
|
|
import com.ym.mec.thirdparty.yqpay.Msg;
|
|
|
import com.ym.mec.thirdparty.yqpay.RsqMsg;
|
|
@@ -25,6 +30,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.snaker.engine.entity.Order;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -62,6 +68,12 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
private SubjectChangeService subjectChangeService;
|
|
|
@Autowired
|
|
|
private DegreeRegistrationService degreeRegistrationService;
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
|
|
|
+ @Autowired
|
|
|
+ private IdGeneratorService idGeneratorService;
|
|
|
+ @Autowired
|
|
|
+ private SysConfigDao sysConfigDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Long, StudentPaymentOrder> getDAO() {
|
|
@@ -162,7 +174,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
if (payingOrders.size() == 0) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
List<String> orderNoList = new ArrayList<String>();
|
|
|
|
|
|
for (StudentPaymentOrder payingOrder : payingOrders) {
|
|
@@ -220,6 +231,11 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
//增加用户余额
|
|
|
sysUserCashAccountService.updateBalance(order.getUserId(), order.getActualAmount(),
|
|
|
PlatformCashAccountDetailTypeEnum.REFUNDS, memo + ",订单号:" + order.getOrderNo());
|
|
|
+
|
|
|
+ if (order.getPaymentChannel().equals("ADAPAY")
|
|
|
+ && !rpMap.containsKey("simulation")) {
|
|
|
+ confirmOrder(order);
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -238,9 +254,41 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
}
|
|
|
order.setPaymentBusinessChannel(rpMap.get("channelType"));
|
|
|
|
|
|
+ if (status.equals(DealStatusEnum.SUCCESS) && order.getPaymentChannel().equals("ADAPAY")
|
|
|
+ && !rpMap.containsKey("simulation")) {
|
|
|
+ confirmOrder(order);
|
|
|
+ }
|
|
|
+
|
|
|
callOrderCallBack(order);
|
|
|
}
|
|
|
|
|
|
+ private Boolean confirmOrder(StudentPaymentOrder order) throws Exception {
|
|
|
+ String delayRouteStartDate = sysConfigDao.findConfigValue("delay_route_start_date");
|
|
|
+ if (order.getCreateTime().before(Objects.requireNonNull(DateUtil.stringToDate(delayRouteStartDate, "yyyy-MM-dd HH:mm:ss")))) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderDao.getRouteOrders(order.getOrderNo());
|
|
|
+ for (StudentPaymentRouteOrder routeOrder : routeOrders) {
|
|
|
+ Map<String, Object> divMember = new HashMap<>();
|
|
|
+ divMember.put("member_id", routeOrder.getMerNo());//分佣账户
|
|
|
+ divMember.put("amount", routeOrder.getRouteAmount().setScale(2, BigDecimal.ROUND_HALF_UP));//分佣金额
|
|
|
+ divMember.put("fee_flag", "Y");
|
|
|
+ if (routeOrder.getMerNo().equals(ConfigInit.merNo)) {
|
|
|
+ divMember.put("member_id", 0);
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> divMembers = new ArrayList<>();
|
|
|
+ divMembers.add(divMember);
|
|
|
+
|
|
|
+ Map<String, Object> confirm = new HashMap<>();
|
|
|
+ confirm.put("payment_id", order.getTransNo());
|
|
|
+ confirm.put("order_no", idGeneratorService.generatorId("payment"));
|
|
|
+ confirm.put("confirm_amt", routeOrder.getRouteAmount());
|
|
|
+ confirm.put("div_members", divMembers);
|
|
|
+ Payment.createConfirm(confirm);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
//Date date = new Date();
|
|
|
// BigDecimal balance = BigDecimal.ZERO;
|
|
|
// MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
|
|
@@ -418,6 +466,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
|
|
|
|
|
|
@Override
|
|
|
public List<StudentPaymentOrder> getUserOrderByType(Integer userId, OrderTypeEnum type, DealStatusEnum status) {
|
|
|
- return studentPaymentOrderDao.getUserOrderByType(userId,type,status);
|
|
|
+ return studentPaymentOrderDao.getUserOrderByType(userId, type, status);
|
|
|
}
|
|
|
}
|