Browse Source

Merge remote-tracking branch 'origin/zx_online_update_1218' into zx_online_update_1218

zouxuan 2 days ago
parent
commit
cdeb53e8b7

+ 15 - 14
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -1560,6 +1560,9 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                             .set(CourseSchedule::getStatus, CourseScheduleEnum.CANCEL.getCode())
                     );
 
+                    //退款
+                    this.refund(courseGroup);
+
                     // 小组课成课推送
                     if (courseGroup.getType().equals(CourseScheduleEnum.GROUP.getCode())) {
 
@@ -1573,8 +1576,6 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                         this.sendStudentMessage(userIds, courseGroup);
                     }
 
-                    //退款
-                    this.refund(courseGroup);
                 }
                 courseGroup.setUpdatedTime(new Date());
                 this.updateById(courseGroup);
@@ -1598,17 +1599,17 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
         }
 
 
-        List<CourseScheduleStudentPayment> list = courseScheduleStudentPaymentService.list(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
-                .eq(CourseScheduleStudentPayment::getCourseGroupId, courseGroup.getId()));
-        Set<Long> userIds = list.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
-        // 学生
-        Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> mapByIds = sysUserService.getMapByIds((List<Long>) userIds);
-
-        Map<Long, String> receivers = new HashMap<>();
-        for (com.yonge.cooleshow.biz.dal.entity.SysUser value : mapByIds.values()) {
-            receivers.put(value.getId(), value.getPhone());
-        }
         try {
+            List<CourseScheduleStudentPayment> list = courseScheduleStudentPaymentService.list(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
+                    .eq(CourseScheduleStudentPayment::getCourseGroupId, courseGroup.getId()));
+            Set<Long> userIds = list.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
+            // 学生
+            Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> mapByIds = sysUserService.getMapByIds(new ArrayList<>( userIds));
+
+            Map<Long, String> receivers = new HashMap<>();
+            for (com.yonge.cooleshow.biz.dal.entity.SysUser value : mapByIds.values()) {
+                receivers.put(value.getId(), value.getPhone());
+            }
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, success?MessageTypeEnum.GROUP_SUCCESS_STUDENT:MessageTypeEnum.GROUP_FAIL_STUDENT,
                     receivers, null, 0, null, ClientEnum.STUDENT.getCode(), courseGroup.getName());
         } catch (Exception e) {
@@ -1670,9 +1671,9 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                             .forEach(orderDetail -> orderDetailIds.add(orderDetail.getId()));
                 }
                 if (order.getPaymentVersion().equals(EPaymentVersion.V1)) {
-                    userOrderRefundService.orderRefund(order.getOrderNo(), CourseScheduleEnum.valueOf(courseGroup.getType()).name() +"成课失败退款");
+                    userOrderRefundService.orderRefund(order.getOrderNo(), CourseScheduleEnum.valueOf(courseGroup.getType()).getMsg() +"成课失败退款");
                 } else {
-                    userPaymentCoreService.refundPayment(order.getOrderNo(),CourseScheduleEnum.valueOf(courseGroup.getType()).name() +"成课失败退款", orderDetailIds);
+                    userPaymentCoreService.refundPayment(order.getOrderNo(),CourseScheduleEnum.valueOf(courseGroup.getType()).getMsg() +"成课失败退款", orderDetailIds);
                 }
 
                 //退还优惠券

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserPaymentCoreServiceImpl.java

@@ -1742,7 +1742,6 @@ DISCOUNT("畅学卡")
         DistributedLock.of(redissonClient).runIfLockCanGet(lockNameInner, () -> {
             if (StringUtils.isEmpty(paymentOrder.getTransNo()) || reduce.compareTo(BigDecimal.ZERO) == 0) {
                 orderRefundBill.setStatus(TradeStatusEnum.succeeded);
-                userOrderRefundBillService.save(orderRefundBill);
             } else {
                 try {
                     RefundResp refundResp = paymentServiceContext.getPaymentService(paymentOrder.getPaymentVendor()).refund(refundOrder);
@@ -1941,10 +1940,12 @@ DISCOUNT("畅学卡")
                 if (PaymentStatus.FAILED == refundResp.getPaymentStatus()) {
                     userOrderRefundBill.setStatus(TradeStatusEnum.failed);
                     userOrderRefundBill.setPayFailMsg(refundResp.getMsg());
+                    userOrderRefundBill.setTransNo(refundResp.getTransNo());
                 } else  if (PaymentStatus.SUCCESSED == refundResp.getPaymentStatus()) {
                     // 更新退款订单状态
                     userOrderRefundBill.setStatus(TradeStatusEnum.succeeded);
                     userOrderRefundBill.setPayFailMsg("");
+                    userOrderRefundBill.setTransNo(refundResp.getTransNo());
                 }
             } catch (Exception e) {
                 userOrderRefundBill.setStatus(TradeStatusEnum.failed);

+ 1 - 1
pom.xml

@@ -24,7 +24,7 @@
 		<redisson.version>3.11.5</redisson.version>
 		<maven.test.skip>true</maven.test.skip>
 		<cbs.version>1.0.27</cbs.version>
-		<microsvc.version>1.1.4</microsvc.version>
+		<microsvc.version>1.1.9</microsvc.version>
 	</properties>