liujc 1 year ago
parent
commit
ab70604cc6

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

@@ -6,7 +6,6 @@ import com.yonge.cooleshow.biz.dal.vo.UserOrderDetailVo;
 import com.yonge.cooleshow.biz.dal.wrapper.TenantActivationCodeWrapper;
 import com.yonge.cooleshow.biz.dal.entity.TenantActivationCode;
 import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 
@@ -76,4 +75,6 @@ public interface TenantActivationCodeService extends IService<TenantActivationCo
                           Long tenantId, Long userId, Long tenantAlbumPurchaseId);
 
     void activeById(String id, Long userId);
+
+    void resend(String code, Long userId, Long tenantId, Long tenantAlbumPurchaseId);
 }

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

@@ -1333,7 +1333,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                 couponInfoService.updateUserOrderCouponInfo(CouponOrderWrapper.builder().orderNo(order.getOrderNo()).reset(true).build());
             } catch (Exception e) {
                 log.warn("直播课成课失败退款 退款失败,退款订单号 {}", order);
-                log.error("直播课成课失败退款 退款失败", e.getCause());
+                log.error("直播课成课失败退款 退款失败", e);
             }
         }
     }

+ 25 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java

@@ -276,6 +276,31 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
 
     }
 
+    @Override
+    public void resend(String code, Long userId, Long tenantId, Long tenantAlbumPurchaseId) {
+        // 查询激活码信息
+        TenantActivationCode one = this.lambdaQuery()
+                .eq(TenantActivationCode::getActivationCode, code)
+                .eq(TenantActivationCode::getTenantId, tenantId)
+                .eq(TenantActivationCode::getTenantAlbumPurchaseId, tenantAlbumPurchaseId)
+                .eq(TenantActivationCode::getSendStatus, EActivationCode.SEND)
+                .last("limit 1")
+                .one();
+        if(one == null) {
+            throw new BizException("当前激活码不可以重发");
+        }
+        if (Boolean.TRUE.equals(one.getActivationStatus())) {
+            throw new BizException("激活码已经被使用");
+        }
+
+        SysUser sysUser = sysUserMapper.selectById(userId);
+        if (sysUser == null) {
+            throw new BizException("用户不存在");
+        }
+        one.setActivationPhone(sysUser.getPhone());
+        this.updateById(one);
+    }
+
 
     /**
      * 添加用户机构专辑激活记录

+ 9 - 0
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/controller/TenantActivationCodeController.java

@@ -139,6 +139,15 @@ public class TenantActivationCodeController extends BaseController {
         return succeed();
     }
 
+
+    @ApiOperation(value = "激活码重发", notes = "机构激活码- 传入 TenantActivationCodeVo.TenantActivationCodeSend")
+    @PostMapping("/resend")
+    public HttpResponseResult<Boolean> resend(@Validated @RequestBody TenantActivationCodeVo.TenantActivationCodeResend send) {
+        TenantInfo tenantInfo = getTenantInfo();
+        tenantActivationCodeService.resend(send.getCode(),send.getUserId(),tenantInfo.getId(),send.getTenantAlbumPurchaseId());
+        return succeed();
+    }
+
     @ApiOperation(value = "激活码发放取消", notes = "传入 激活码的ID")
     @PostMapping("/sendCancel")
     public HttpResponseResult<Boolean> sendCancel(@RequestParam("id") Long id) {

+ 21 - 0
cooleshow-user/user-tenant/src/main/java/com/yonge/cooleshow/tenant/vo/TenantActivationCodeVo.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
 import java.util.ArrayList;
@@ -34,6 +35,26 @@ public class TenantActivationCodeVo {
         private List<Long> studentIdList = new ArrayList<>();
     }
 
+
+    @Data
+    @ApiModel(" TenantActivationCodeSend-机构激活码重发")
+    public static class TenantActivationCodeResend {
+
+
+        @ApiModelProperty("专辑购买记录的ID")
+        @NotNull(message = "专辑购买记录的ID不能为空")
+        private Long tenantAlbumPurchaseId;
+
+        @ApiModelProperty("激活码")
+        @NotBlank(message = "激活码不能为空")
+        private String code;
+
+        @ApiModelProperty("用户ID")
+        @NotNull(message = "用户ID不能为空")
+        private Long userId;
+    }
+
+
     @Data
     @ApiModel(" TenantActivationCode-机构激活码")
     public static class TenantActivationCode {