Răsfoiți Sursa

推广奖励

wujiefeng 10 luni în urmă
părinte
comite
db460a46e6
23 a modificat fișierele cu 585 adăugiri și 59 ștergeri
  1. 14 0
      RewardClient/src/main/java/com/zhongshu/reward/client/model/ReceiptsDetailModel.java
  2. 81 0
      RewardClient/src/main/java/com/zhongshu/reward/client/model/TransferRulerModel.java
  3. 51 0
      RewardClient/src/main/java/com/zhongshu/reward/client/model/VipUserModel.java
  4. 114 0
      RewardClient/src/main/java/com/zhongshu/reward/client/model/param/TransferRulerParam.java
  5. 2 0
      RewardClient/src/main/java/com/zhongshu/reward/client/model/wallet/WalletReceiptsModel.java
  6. 1 1
      RewardClient/src/main/java/com/zhongshu/reward/client/service/InviteRecordFeignService.java
  7. 0 46
      RewardServer/src/main/java/com/zhongshu/reward/server/core/config/SwagerConfig.java
  8. 38 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/config/SwaggerConfig.java
  9. 35 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/InviteController.java
  10. 39 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/TransferRulerController.java
  11. 24 3
      RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/WalletController.java
  12. 40 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/Impl/WalletReceiptsDaoImpl.java
  13. 3 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/TransferRulerDao.java
  14. 4 1
      RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/WalletReceiptsDao.java
  15. 14 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/extend/WalletReceiptsDaoExtend.java
  16. 2 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/InviteRecord.java
  17. 1 1
      RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/TransferRuler.java
  18. 5 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/WalletReceipts.java
  19. 3 1
      RewardServer/src/main/java/com/zhongshu/reward/server/core/service/Impl/InviteRecordFeignServiceImpl.java
  20. 66 0
      RewardServer/src/main/java/com/zhongshu/reward/server/core/service/TransferRulerService.java
  21. 40 3
      RewardServer/src/main/java/com/zhongshu/reward/server/core/service/WalletReceiptsService.java
  22. 3 2
      RewardServer/src/main/java/com/zhongshu/reward/server/core/service/WalletService.java
  23. 5 1
      RewardServer/src/main/resources/application-dev.yml

+ 14 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/ReceiptsDetailModel.java

@@ -0,0 +1,14 @@
+package com.zhongshu.reward.client.model;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+
+@Data
+public class ReceiptsDetailModel {
+}

+ 81 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/TransferRulerModel.java

@@ -0,0 +1,81 @@
+package com.zhongshu.reward.client.model;
+
+import com.zhongshu.reward.client.type.TimeUnitType;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+@Data
+public class TransferRulerModel {
+
+    private String id;
+
+    private Long updateTime;
+
+    private Long createTime;
+
+    /**
+     * 单笔最小提现金额
+     */
+    private BigDecimal minTotal = BigDecimal.ZERO;
+
+    /**
+     * 单笔最大提现金额
+     */
+    private BigDecimal maxTotal = BigDecimal.ZERO;
+
+    /**
+     * 单日最大转账金额
+     */
+    private BigDecimal dayMaxTotal = BigDecimal.ZERO;
+
+    /**
+     * 提现手续费
+     */
+    private BigDecimal commission = BigDecimal.ZERO;
+
+    /**
+     * 提现次数
+     */
+    private Integer size;
+
+    /**
+     * 时间单位
+     */
+    private TimeUnitType timeUnit;
+
+    /**
+     * 每月开始号数
+     */
+    private Integer startDay;
+
+    /**
+     * 每月结束号数
+     */
+    private Integer endDay;
+
+    /**
+     * 每日开始时
+     */
+    private Integer startHour;
+
+    /**
+     * 每日开始分
+     */
+    private Integer startMinute;
+
+    /**
+     * 每日结束时
+     */
+    private Integer endHour;
+
+    /**
+     * 每日结束分
+     */
+    private Integer endMinute;
+
+}

+ 51 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/VipUserModel.java

@@ -0,0 +1,51 @@
+package com.zhongshu.reward.client.model;
+
+import com.zhongshu.reward.client.type.ReceiptsStatus;
+import com.zhongshu.reward.client.type.ReceiptsType;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.math.BigDecimal;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+@Data
+public class VipUserModel {
+
+    @ApiModelProperty("金额")
+    private BigDecimal total = BigDecimal.ZERO;
+
+    @ApiModelProperty("到账类型")
+    private ReceiptsType receiptsType;
+
+    @ApiModelProperty("状态")
+    private ReceiptsStatus status;
+
+    @ApiModelProperty("预计到账时间")
+    private Long estimatedTime;
+
+    @ApiModelProperty("实际到账时间")
+    private Long receiptsTime;
+
+    @ApiModelProperty("注册时间")
+    private Long registerTime;
+
+    @ApiModelProperty("会员等级")
+    private String planningId;
+
+    @ApiModelProperty("套餐名称")
+    private String planningName;
+
+    @ApiModelProperty("订购时间")
+    private Long operateTime;
+
+    @ApiModelProperty("电话")
+    private String phone;
+
+//    @ApiModelProperty("套餐")
+//    private String saleModalId;
+
+}

+ 114 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/param/TransferRulerParam.java

@@ -0,0 +1,114 @@
+package com.zhongshu.reward.client.model.param;
+
+import com.zhongshu.reward.client.type.TimeUnitType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.annotations.ApiParam;
+import lombok.Data;
+import org.checkerframework.checker.units.qual.min;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+@Data
+public class TransferRulerParam {
+
+    private String id;
+
+    /**
+     * 单笔最小提现金额
+     */
+    @ApiModelProperty("单笔最小提现金额")
+    @Max(value = 200000, message = "单笔提现金额不得超过 2000")
+    @Min(value = 30, message = "单笔提现金额不得低于 3")
+    private BigDecimal minTotal = BigDecimal.ZERO;
+
+    /**
+     * 单笔最大提现金额
+     */
+    @ApiModelProperty("单笔最大提现金额")
+    @Max(value = 200000, message = "单笔提现金额不得超过 2000")
+    @Max(value = 30, message = "单笔提现金额不得低于3")
+    private BigDecimal maxTotal = BigDecimal.ZERO;
+
+    /**
+     * 单日最大转账金额
+     */
+    @ApiModelProperty("单日最大转账金额")
+    @Max(value = 2000, message = "单日最大转账金额不得超过 100000")
+    private BigDecimal dayMaxTotal = BigDecimal.ZERO;
+
+    /**
+     * 提现手续费
+     */
+    @ApiModelProperty("提现手续费")
+    private BigDecimal commission = BigDecimal.ZERO;
+
+    /**
+     * 提现次数
+     */
+    @ApiModelProperty("提现次数")
+    @Max(value = 2000, message = "单日最大转账金额不得超过 100000")
+
+    private Integer size;
+
+    /**
+     * 时间单位
+     */
+    @ApiModelProperty("时间单位")
+    private TimeUnitType timeUnit;
+
+    /**
+     * 每月开始号数
+     */
+    @ApiModelProperty("每月开始号数")
+    @Max(value = 31, message = "超出月份天数")
+    @Max(value = 1, message = "日数最小为1")
+    private Integer startDay;
+
+    /**
+     * 每月结束号数
+     */
+    @ApiModelProperty("每月结束号数")
+    @Max(value = 31, message = "超出月份天数")
+    @Max(value = 1, message = "日数最小为1")
+    private Integer endDay;
+
+    /**
+     * 每日开始时
+     */
+    @ApiModelProperty("每日开始时")
+    @Max(value = 23, message = "不过超过23时")
+    @Max(value = 0, message = "不得小于0时")
+    private Integer startHour;
+
+    /**
+     * 每日开始分
+     */
+    @Max(value = 23, message = "不过超过23时")
+    @Max(value = 0, message = "不得小于0时")
+    @ApiModelProperty("每日开始分")
+    private Integer startMinute;
+
+    /**
+     * 每日结束时
+     */
+    @Max(value = 59, message = "不过超过59分")
+    @Max(value = 0, message = "不得小于0分")
+    @ApiModelProperty("每日结束时")
+    private Integer endHour;
+
+    /**
+     * 每日结束分
+     */
+    @Max(value = 59, message = "不过超过59分")
+    @Max(value = 0, message = "不得小于0分")
+    @ApiModelProperty("每日结束分")
+    private Integer endMinute;
+}

+ 2 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/wallet/WalletReceiptsModel.java

@@ -2,6 +2,7 @@ package com.zhongshu.reward.client.model.wallet;
 
 import com.zhongshu.reward.client.type.ReceiptsStatus;
 import com.zhongshu.reward.client.type.ReceiptsType;
+import com.zhongshu.vip.client.model.param.VipUserParam;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -52,4 +53,5 @@ public class WalletReceiptsModel {
      * 外部订单号
      */
     private String outTradeNo;
+
 }

+ 1 - 1
RewardClient/src/main/java/com/zhongshu/reward/client/service/InviteRecordFeignService.java

@@ -16,5 +16,5 @@ public interface InviteRecordFeignService {
 
     @ApiOperation("邀请")
     @RequestMapping(value = "goodsDetail", method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE})
-    void invite(@RequestParam("phone") String phone, @RequestParam("userId") String userId, @RequestParam("inviteUserId") String inviteUserId, @RequestParam("userType")UserType userType);
+    void invite(@RequestParam("phone") String phone, @RequestParam("userId") String userId, @RequestParam("inviteUserId") String inviteUserId, @RequestParam("userType")UserType userType, @RequestParam("registerTime") Long registerTime);
 }

+ 0 - 46
RewardServer/src/main/java/com/zhongshu/reward/server/core/config/SwagerConfig.java

@@ -1,46 +0,0 @@
-package com.zhongshu.reward.server.core.config;
-
-import com.github.microservice.components.swagger.config.SwaggerConfiguration;
-import io.swagger.annotations.Api;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-@Configuration
-@EnableSwagger2
-@Import(SwaggerConfiguration.class)
-public class SwagerConfig {
-
-    @Value("${spring.application.name}")
-    private String applicationName;
-    @Bean
-    public Docket defaultApi() {
-        return new Docket(DocumentationType.SWAGGER_2)
-                .host("https://api.dev.zonelife.cn/")
-                .apiInfo(apiInfo())
-                .groupName(applicationName)
-                .select()
-                // 添加@Api注解才显示
-                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
-                .paths(PathSelectors.any())
-                .build();
-    }
-
-    /**
-     * swagger-api接口描述信息
-     */
-    private ApiInfo apiInfo() {
-        return new ApiInfoBuilder()
-                .title(applicationName)
-                .version("1.0.0")
-                .build();
-    }
-}

+ 38 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/config/SwaggerConfig.java

@@ -0,0 +1,38 @@
+package com.zhongshu.reward.server.core.config;
+
+import com.github.microservice.components.swagger.config.SwaggerConfiguration;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Import;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+@Configuration
+@EnableSwagger2
+@Import(SwaggerConfiguration.class)
+public class SwaggerConfig {
+
+
+//    @Value("${spring.application.name}")
+//    private String applicationName;
+//    @Bean
+//    public Docket defaultApi() {
+//        return new Docket(DocumentationType.SWAGGER_2)
+//                .host("https://api.dev.zonelife.cn/")
+//                .apiInfo(apiInfo())
+//                .groupName(applicationName)
+//                .select()
+//                // 添加@Api注解才显示
+//                .apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
+//                .paths(PathSelectors.any())
+//                .build();
+//    }
+//
+//    /**
+//     * swagger-api接口描述信息
+//     */
+//    private ApiInfo apiInfo() {
+//        return new ApiInfoBuilder()
+//                .title(applicationName)
+//                .version("1.0.0")
+//                .build();
+//    }
+}

+ 35 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/InviteController.java

@@ -0,0 +1,35 @@
+package com.zhongshu.reward.server.core.controller.wallet;
+
+import com.github.microservice.auth.security.annotations.ResourceAuth;
+import com.github.microservice.auth.security.type.AuthType;
+import com.zhongshu.reward.server.core.domain.WalletReceipts;
+import com.zhongshu.reward.server.core.service.WalletReceiptsService;
+import io.swagger.annotations.Api;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("/invite")
+@Api(tags = "推广邀请")
+public class InviteController {
+
+    @Autowired
+    WalletReceiptsService walletReceiptsService;
+
+    @Operation(summary = "邀请奖励明细", description = "邀请奖励明细")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @GetMapping(value = "inviteDetail")
+    public Object receiptsDetail(Integer year, Integer month){
+        return walletReceiptsService.receiptsDetail(year, month);
+    }
+}

+ 39 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/TransferRulerController.java

@@ -0,0 +1,39 @@
+package com.zhongshu.reward.server.core.controller.wallet;
+
+import com.github.microservice.auth.security.annotations.ResourceAuth;
+import com.github.microservice.auth.security.type.AuthType;
+import com.zhongshu.reward.client.model.param.TransferRulerParam;
+import com.zhongshu.reward.server.core.service.TransferRulerService;
+import io.swagger.annotations.Api;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+@Slf4j
+@RestController
+@RequestMapping("/transferRuler")
+@Api(tags = "提现规则设置")
+public class TransferRulerController {
+
+    @Autowired
+    TransferRulerService transferRulerService;
+
+    @Operation(summary = "新增/修改提现规则", description = "新增/修改提现规则")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @PostMapping("saveOrUpdate")
+    public Object saveOrUpdate(@RequestBody TransferRulerParam param){
+        return transferRulerService.saveOrUpdate(param);
+    }
+
+    @Operation(summary = "获取提现规则", description = "获取提现规则")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @GetMapping("getRuler")
+    public Object getRuler(){
+        return transferRulerService.getRuler();
+    }
+}

+ 24 - 3
RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/wallet/WalletController.java

@@ -4,8 +4,11 @@ import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
 import com.zhongshu.reward.client.model.param.QueryTransferParam;
 import com.zhongshu.reward.client.model.param.WalletTransferParam;
+import com.zhongshu.reward.server.core.domain.WalletReceipts;
+import com.zhongshu.reward.server.core.service.WalletReceiptsService;
 import com.zhongshu.reward.server.core.service.WalletService;
 import com.zhongshu.reward.server.core.service.WxTransferService;
+import io.swagger.annotations.Api;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import lombok.extern.slf4j.Slf4j;
@@ -20,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 @Slf4j
 @RestController
 @RequestMapping("/wallet")
-@Tag(name = "钱包")
+@Api(tags = "钱包")
 public class WalletController {
 
     @Autowired
@@ -29,11 +32,14 @@ public class WalletController {
     @Autowired
     WxTransferService wxTransferService;
 
+    @Autowired
+    WalletReceiptsService walletReceiptsService;
+
     @Operation(summary = "获取(开通)当前用户钱包信息", description = "获取(开通)当前用户钱包信息")
     @ResourceAuth(value = "user", type = AuthType.User)
     @GetMapping ("getWallet")
-    public Object getWalletByUser(@RequestParam(name = "userId") String userId){
-        return walletService.getWallet(userId);
+    public Object getWalletByUser(){
+        return walletService.getWallet();
     }
 
     @Operation(summary = "发起提现", description = "发起提现")
@@ -51,4 +57,19 @@ public class WalletController {
         return wxTransferService.queryTransfer(param.getWalletId(), param.getYear(), param.getMonth());
     }
 
+    @Operation(summary = "查询即将到账", description = "查询即将到账")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @GetMapping (value = "listByWallet")
+    public Object listByWallet(){
+        return walletReceiptsService.listByWallet();
+    }
+
+    @Operation(summary = "查询即将到账详情", description = "查询即将到账详情")
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @GetMapping (value = "receiptsDetail")
+    public Object receiptsDetail(String receiptsId){
+        return walletReceiptsService.receiptsDetail(receiptsId);
+    }
+
+
 }

+ 40 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/Impl/WalletReceiptsDaoImpl.java

@@ -0,0 +1,40 @@
+package com.zhongshu.reward.server.core.dao.Impl;
+
+import com.zhongshu.reward.server.core.dao.WalletReceiptsDao;
+import com.zhongshu.reward.server.core.dao.extend.WalletReceiptsDaoExtend;
+import com.zhongshu.reward.server.core.domain.WalletReceipts;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+
+import java.util.List;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+public class WalletReceiptsDaoImpl implements WalletReceiptsDaoExtend {
+
+    @Autowired
+    MongoTemplate mongoTemplate;
+
+    @Override
+    public List<WalletReceipts> inviteDetail(String inviteUserId, Long startTime, Long endTime) {
+        Criteria criteria = new Criteria();
+        if (null != startTime){
+            criteria.and("createTime").gte(startTime);
+        }
+
+        if (null != endTime){
+            criteria.and("createTime").lte(endTime);
+        }
+
+        criteria.and("inviteUserId").is(inviteUserId);
+        Query query = Query.query(criteria);
+        query.with(Sort.by(Sort.Order.desc("createTime")));
+
+        return mongoTemplate.find(query, WalletReceipts.class);
+    }
+}

+ 3 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/TransferRulerDao.java

@@ -9,4 +9,7 @@ import com.zhongshu.reward.server.core.domain.TransferRuler;
  */
 public interface TransferRulerDao extends MongoDao<TransferRuler> {
 
+    TransferRuler findTop1ById(String id);
+
+
 }

+ 4 - 1
RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/WalletReceiptsDao.java

@@ -1,6 +1,7 @@
 package com.zhongshu.reward.server.core.dao;
 
 import com.github.microservice.components.data.mongo.mongo.dao.MongoDao;
+import com.zhongshu.reward.server.core.dao.extend.WalletReceiptsDaoExtend;
 import com.zhongshu.reward.server.core.domain.WalletReceipts;
 
 import java.util.List;
@@ -9,9 +10,11 @@ import java.util.List;
  * @author wjf
  * @date 2024/8/6
  */
-public interface WalletReceiptsDao extends MongoDao<WalletReceipts> {
+public interface WalletReceiptsDao extends MongoDao<WalletReceipts>, WalletReceiptsDaoExtend {
 
     List<WalletReceipts> findByWallet_IdOrderByCreateTimeDesc(String walletId);
 
     WalletReceipts findTopByOutTradeNo(String outTradeNo);
+
+    WalletReceipts findTop1ById(String id);
 }

+ 14 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/dao/extend/WalletReceiptsDaoExtend.java

@@ -0,0 +1,14 @@
+package com.zhongshu.reward.server.core.dao.extend;
+
+import com.zhongshu.reward.server.core.domain.WalletReceipts;
+
+import java.util.List;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+public interface WalletReceiptsDaoExtend {
+
+    List<WalletReceipts> inviteDetail(String inviteUserId, Long startTime, Long endTime);
+}

+ 2 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/InviteRecord.java

@@ -41,4 +41,6 @@ public class InviteRecord extends SuperEntity {
      */
     private UserType userType;
 
+    private Long registerTime;
+
 }

+ 1 - 1
RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/TransferRuler.java

@@ -79,7 +79,7 @@ public class TransferRuler extends SuperEntity {
     private Integer endHour;
 
     /**
-     * 每日结束
+     * 每日结束
      */
     private Integer endMinute;
 

+ 5 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/domain/WalletReceipts.java

@@ -30,6 +30,11 @@ public class WalletReceipts extends SuperEntity {
     @DBRef(lazy = true)
     private Wallet wallet;
 
+    /**
+     * 邀请人id
+     */
+    private String inviteUserId;
+
     /**
      * 被邀请人id
      */

+ 3 - 1
RewardServer/src/main/java/com/zhongshu/reward/server/core/service/Impl/InviteRecordFeignServiceImpl.java

@@ -12,6 +12,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 import java.util.Objects;
@@ -37,7 +38,7 @@ public class InviteRecordFeignServiceImpl implements InviteRecordFeignService {
      * @param inviteUserId
      * @param userType
      */
-    public void invite(String phone, String userId, String inviteUserId, UserType userType){
+    public void invite(String phone, String userId, String inviteUserId, UserType userType, Long registerTime){
         //查询有无邀请记录
         if (inviteRecordDao.existsByUserId(userId)){
            log.info("已被其他用户邀请");
@@ -47,6 +48,7 @@ public class InviteRecordFeignServiceImpl implements InviteRecordFeignService {
             inviteRecord.setInviteUserId(inviteUserId);
             inviteRecord.setUserType(userType);
             inviteRecord.setPhone(phone);
+            inviteRecord.setRegisterTime(registerTime);
             inviteRecordDao.save(inviteRecord);
         }
     }

+ 66 - 0
RewardServer/src/main/java/com/zhongshu/reward/server/core/service/TransferRulerService.java

@@ -0,0 +1,66 @@
+package com.zhongshu.reward.server.core.service;
+
+import com.github.microservice.core.util.result.content.ResultContent;
+import com.github.microservice.core.util.result.content.ResultState;
+import com.zhongshu.reward.client.model.TransferRulerModel;
+import com.zhongshu.reward.client.model.param.TransferRulerParam;
+import com.zhongshu.reward.server.core.dao.TransferRulerDao;
+import com.zhongshu.reward.server.core.domain.TransferRuler;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Example;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @author wjf
+ * @date 2024/8/12
+ */
+@Service
+public class TransferRulerService {
+
+    @Autowired
+    TransferRulerDao transferRulerDao;
+
+
+    public Object saveOrUpdate(TransferRulerParam param){
+        if (StringUtils.isNotEmpty(param.getId())){
+            TransferRuler transferRuler = transferRulerDao.findTop1ById(param.getId());
+            if (ObjectUtils.isEmpty(transferRuler)){
+                return ResultContent.build(ResultState.Fail, "规则不存在");
+            }
+            BeanUtils.copyProperties(param, transferRuler);
+            transferRulerDao.save(transferRuler);
+            return ResultContent.buildContent(toModel(transferRuler));
+        }else {
+            List<TransferRuler> all = transferRulerDao.findAll();
+            if (!all.isEmpty()){
+                return ResultContent.build(ResultState.Fail, "已设置规则,请勿重复添加");
+            }
+            TransferRuler transferRuler = new TransferRuler();
+            BeanUtils.copyProperties(param, transferRuler);
+            transferRulerDao.save(transferRuler);
+            return ResultContent.buildContent(toModel(transferRuler));
+        }
+    }
+
+    public Object getRuler(){
+        List<TransferRuler> all = transferRulerDao.findAll(Example.of(TransferRuler.builder().build()));
+        if (all.isEmpty()){
+            return ResultContent.build(ResultState.Success);
+        }
+        return ResultContent.buildContent(toModel(all.get(0)));
+    }
+
+    TransferRulerModel toModel(TransferRuler transferRuler){
+        TransferRulerModel model = new TransferRulerModel();
+        if (ObjectUtils.isNotEmpty(transferRuler)){
+            BeanUtils.copyProperties(transferRuler, model);
+        }
+        return model;
+    }
+}

+ 40 - 3
RewardServer/src/main/java/com/zhongshu/reward/server/core/service/WalletReceiptsService.java

@@ -1,7 +1,9 @@
 package com.zhongshu.reward.server.core.service;
 
+import com.github.microservice.auth.security.helper.AuthHelper;
 import com.github.microservice.core.util.result.content.ResultContent;
 import com.github.microservice.core.util.result.content.ResultState;
+import com.zhongshu.reward.client.model.VipUserModel;
 import com.zhongshu.reward.client.model.wallet.WalletReceiptsModel;
 import com.zhongshu.reward.client.type.ReceiptsStatus;
 import com.zhongshu.reward.client.type.ReceiptsType;
@@ -16,9 +18,9 @@ import com.zhongshu.reward.server.core.domain.Wallet;
 import com.zhongshu.reward.server.core.domain.WalletReceipts;
 import com.zhongshu.reward.server.core.util.DateUtils;
 import com.zhongshu.vip.client.model.param.VipUserParam;
-import com.zswl.cloud.bdb.client.vo.PromotionLogVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.ObjectUtils;
+import org.jetbrains.annotations.NotNull;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,6 +54,9 @@ public class WalletReceiptsService {
     @Autowired
     InviteRecordDao inviteRecordDao;
 
+    @Autowired
+    AuthHelper authHelper;
+
 
     /**
      * 邀请返利入账
@@ -124,11 +129,43 @@ public class WalletReceiptsService {
         return ResultContent.build(ResultState.Success);
     }
 
-    public Object listByWallet(String walletId){
-        List<WalletReceipts> list = walletReceiptsDao.findByWallet_IdOrderByCreateTimeDesc(walletId);
+    public Object listByWallet(){
+        String userId = authHelper.getCurrentUser().getUserId();
+        Wallet wallet = walletService.getWalletByUserId(userId);
+        List<WalletReceipts> list = walletReceiptsDao.findByWallet_IdOrderByCreateTimeDesc(wallet.getId());
         return ResultContent.buildContent(list.stream().map(this::toModel).collect(Collectors.toList()));
     }
 
+    public Object receiptsDetail(String receiptsId){
+        WalletReceipts walletReceipts = walletReceiptsDao.findTop1ById(receiptsId);
+        if (ObjectUtils.isEmpty(walletReceipts)){
+            return ResultContent.build(ResultState.Fail, "记录不存在");
+        }
+        VipUserRecord vipUserRecord = walletReceipts.getVipUserRecord();
+        VipUserModel vipUserModel = new VipUserModel();
+        BeanUtils.copyProperties(vipUserRecord, vipUserModel);
+        BeanUtils.copyProperties(walletReceipts, vipUserModel);
+        return ResultContent.buildContent(vipUserModel);
+    }
+
+    public Object receiptsDetail(Integer year, Integer month){
+        String userId = authHelper.getCurrentUser().getUserId();
+        Long monthStartTime = DateUtils.getMonthStartTime(year, month);
+        Long monthEndTime = DateUtils.getMonthEndTime(year, month);
+        List<WalletReceipts> walletReceipts = walletReceiptsDao.inviteDetail(userId, monthStartTime, monthEndTime);
+        return ResultContent.buildContent(walletReceipts.stream().map(this::toVipUserModel).collect(Collectors.toList()));
+    }
+
+    private VipUserModel toVipUserModel(WalletReceipts walletReceipts) {
+        VipUserModel vipUserModel = new VipUserModel();
+        if (ObjectUtils.isNotEmpty(walletReceipts)){
+            VipUserRecord vipUserRecord = walletReceipts.getVipUserRecord();
+            BeanUtils.copyProperties(vipUserRecord, vipUserModel);
+            BeanUtils.copyProperties(walletReceipts, vipUserModel);
+        }
+        return vipUserModel;
+    }
+
     WalletReceiptsModel toModel(WalletReceipts walletReceipts){
         WalletReceiptsModel model = new WalletReceiptsModel();
         if (null != walletReceipts){

+ 3 - 2
RewardServer/src/main/java/com/zhongshu/reward/server/core/service/WalletService.java

@@ -25,11 +25,12 @@ public class WalletService {
     @Autowired
     WalletDao walletDao;
 
+
     /**
      * 获取当前登录用户(开通)钱包
      */
-    public ResultContent getWallet(String userId){
-        Wallet wallet = getWalletByUserId(userId);
+    public ResultContent getWallet(){
+        Wallet wallet = getWalletByUserId(null);
         return ResultContent.buildContent(toModel(wallet));
     }
 

+ 5 - 1
RewardServer/src/main/resources/application-dev.yml

@@ -10,11 +10,15 @@ spring:
     database: 6
 
 swagger:
-  packageName: "com.zhongshu.reward.core.controller"
+  packageName: "com.zhongshu.reward.server.core.controller"
   title: ${project.artifactId}
   description: ${project.description}
   version: "1.0"
   enable: true
+  global-request-parameters:
+    - name: "accessToken"
+      description: "用户访问令牌"
+      parameterType: "HEADER"
 
 payment:
   mer_no: 89852017372911Y