Selaa lähdekoodia

cps推广后台

zoujiajian 3 vuotta sitten
vanhempi
sitoutus
8cb08ae2d6
55 muutettua tiedostoa jossa 1833 lisäystä ja 133 poistoa
  1. 13 0
      netflix-dao/src/main/java/com/cyksj/mapper/DistributeOrdersDeductPointsRecordMapper.java
  2. 5 0
      netflix-dao/src/main/java/com/cyksj/mapper/GoodsDonMapper.java
  3. 4 1
      netflix-dao/src/main/java/com/cyksj/mapper/UserMapper.java
  4. 15 0
      netflix-dao/src/main/java/com/cyksj/mapper/manage/cps/UserDistributePopularizeMapper.java
  5. 11 2
      netflix-dao/src/main/java/com/cyksj/mapper/manage/distribute/DistributeWaitingSendPointsMapper.java
  6. 5 0
      netflix-dao/src/main/java/com/cyksj/mapper/manage/distribute/UserDistributeMapper.java
  7. 5 0
      netflix-dao/src/main/java/com/cyksj/model/dto/AuthRedirect.java
  8. 5 0
      netflix-dao/src/main/java/com/cyksj/model/dto/GzhBodyDto.java
  9. 22 0
      netflix-dao/src/main/java/com/cyksj/model/entity/DistributeOrdersDeductPointsRecord.java
  10. 27 0
      netflix-dao/src/main/java/com/cyksj/model/entity/UserDistributePopularize.java
  11. 5 0
      netflix-dao/src/main/java/com/cyksj/model/entity/UserDistributeShared.java
  12. 11 1
      netflix-dao/src/main/java/com/cyksj/model/request/LoginReq.java
  13. 22 0
      netflix-dao/src/main/java/com/cyksj/model/views/BrokenLineCpsUserWMoneyView.java
  14. 43 0
      netflix-dao/src/main/java/com/cyksj/model/views/CpsUserDistributeDetailView.java
  15. 22 0
      netflix-dao/src/main/java/com/cyksj/model/views/CpsUserWMoneyStatisticsDataView.java
  16. 52 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeOrdersDetailView.java
  17. 40 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeOrdersStatisticsView.java
  18. 28 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserDistributePopularizeObjs.java
  19. 50 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserDistributePopularizeView.java
  20. 24 0
      netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeRateView.java
  21. 77 0
      netflix-dao/src/main/resources/mapper/DistributeWaitingSendPointsMapper.xml
  22. 23 0
      netflix-dao/src/main/resources/mapper/UserDistributeMapper.xml
  23. 15 0
      netflix-dao/src/main/resources/mapper/UserDistributePopularizeMapper.xml
  24. 28 0
      netflix-service/src/main/java/com/cyksj/common/EnvCommonService.java
  25. 4 0
      netflix-service/src/main/java/com/cyksj/config/wxlogin/WxOpenPlatYHLXLoginConfig.java
  26. 1 0
      netflix-service/src/main/java/com/cyksj/redis/RedisService.java
  27. 1 1
      netflix-service/src/main/java/com/cyksj/service/authorization/AuthorizationService.java
  28. 2 2
      netflix-service/src/main/java/com/cyksj/service/authorization/impl/AuthorizationServiceImpl.java
  29. 29 0
      netflix-service/src/main/java/com/cyksj/service/cps/CpsManageService.java
  30. 20 0
      netflix-service/src/main/java/com/cyksj/service/cps/CpsPopularizeService.java
  31. 134 0
      netflix-service/src/main/java/com/cyksj/service/cps/impl/CpsManageServiceImpl.java
  32. 88 0
      netflix-service/src/main/java/com/cyksj/service/cps/impl/CpsPopularizeServiceImpl.java
  33. 2 1
      netflix-service/src/main/java/com/cyksj/service/distribute/DistributeService.java
  34. 2 1
      netflix-service/src/main/java/com/cyksj/service/distribute/impl/DistributeServiceImpl.java
  35. 17 3
      netflix-service/src/main/java/com/cyksj/service/gzh/factory/EventMsgService.java
  36. 2 0
      netflix-service/src/main/java/com/cyksj/service/mail/MailService.java
  37. 9 4
      netflix-service/src/main/java/com/cyksj/service/mail/impl/MailServiceImpl.java
  38. 69 13
      netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java
  39. 23 0
      netflix-service/src/main/java/com/cyksj/service/user/UserPointsService.java
  40. 1 1
      netflix-service/src/main/java/com/cyksj/service/user/UserService.java
  41. 64 0
      netflix-service/src/main/java/com/cyksj/service/user/impl/UserPointsServiceImpl.java
  42. 20 18
      netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java
  43. 1 1
      netflix-service/src/main/java/com/cyksj/service/wechat/WeChatService.java
  44. 4 3
      netflix-service/src/main/java/com/cyksj/service/wechat/impl/WeChatServiceImpl.java
  45. 6 12
      netflix-service/src/main/java/com/cyksj/task/Scheduler.java
  46. 277 0
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsBackLoginController.java
  47. 106 0
      netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsPopularizeController.java
  48. 2 2
      netflix-web/src/main/java/com/cyksj/web/controller/distribute/EquipmentDistributeController.java
  49. 6 12
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java
  50. 4 4
      netflix-web/src/main/java/com/cyksj/web/controller/market/TaskFrontController.java
  51. 54 34
      netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java
  52. 7 17
      netflix-web/src/main/java/com/cyksj/web/controller/user/DistributePopularizeController.java
  53. 326 0
      netflix-web/src/main/java/com/cyksj/web/util/StpCpsManageUser.java
  54. 0 0
      netflix-web/src/main/resources/application-dev.yml
  55. 0 0
      netflix-web/src/main/resources/application-prd.yml

+ 13 - 0
netflix-dao/src/main/java/com/cyksj/mapper/DistributeOrdersDeductPointsRecordMapper.java

@@ -0,0 +1,13 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.DistributeOrdersDeductPointsRecord;
+
+/*
+ *项目名: netflix
+ *文件名: DistributeOrdersDeductPointsRecordMapper
+ *创建者: JavaZou
+ *创建时间:2023/5/23 13:58
+ */
+public interface DistributeOrdersDeductPointsRecordMapper extends BaseMapper<DistributeOrdersDeductPointsRecord> {
+}

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/mapper/GoodsDonMapper.java

@@ -5,6 +5,7 @@ import com.cyksj.model.entity.GoodsDon;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * @author chan
@@ -17,4 +18,8 @@ public interface GoodsDonMapper extends BaseMapper<GoodsDon> {
 			" and gd.status is true and gd.type = 2" +
 			" order by gdk.price limit 1")
 	BigDecimal selectMinPriceSkuByGoodsId(Long goodsId);
+
+	@Select("select distinct g.id,g.title from order_don o inner join (select user_id from user_distribute_shared where shared_id = #{cpsUserId}) us on us.user_id = o.user_id and o.is_fixed_distribute is true and o.relation_id != 0 and o.status not in ('close','noPayment')" +
+			" inner join goods_don g on o.goods_id = g.id order by g.id")
+	List<GoodsDon> getDistributeGoodsDetail(Long cpsUserId);
 }

+ 4 - 1
netflix-dao/src/main/java/com/cyksj/mapper/UserMapper.java

@@ -24,7 +24,7 @@ public interface UserMapper extends BaseMapper<User> {
     @Update("update user set points = points - #{points} where id = #{id} and points >= #{points} and points > 0")
     Integer subPoints(@Param("id") Long id, @Param("points") BigDecimal points);
 
-    @Update("update user set points = points + #{addPoints} where id = #{id} and points = #{originalPoints} and points >=0")
+    @Update("update user set points = points + #{addPoints} where id = #{id} and points = #{originalPoints}")
     Integer updatePoints(@Param("id") Long id, @Param("originalPoints") BigDecimal originalPoints, @Param("addPoints") BigDecimal addPoints);
 
     @Update("update user set active_points = active_points - #{subPoints} where active_points > 0 and active_points >= #{subPoints} and id = #{userId}")
@@ -32,4 +32,7 @@ public interface UserMapper extends BaseMapper<User> {
 
     @Select("select id from user where nickname like concat(#{nickname},'%')")
     List<Long> selectListByNickname(String nickname);
+
+    @Update("update user set points = points - #{deductPoints} where id = #{id} and points = #{originalPoints}")
+    Integer subPointsNegative(@Param("id") Long userId, @Param("originalPoints") BigDecimal originalPoints, @Param("deductPoints") BigDecimal deductPoints);
 }

+ 15 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/cps/UserDistributePopularizeMapper.java

@@ -0,0 +1,15 @@
+package com.cyksj.mapper.manage.cps;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.UserDistributePopularize;
+import com.cyksj.model.views.UserDistributePopularizeView;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributePopularizeMapper
+ *创建者: JavaZou
+ *创建时间:2023/5/15 15:56
+ */
+public interface UserDistributePopularizeMapper extends BaseMapper<UserDistributePopularize> {
+	UserDistributePopularizeView getDefaultPopularizeDetail(long cpsUserId);
+}

+ 11 - 2
netflix-dao/src/main/java/com/cyksj/mapper/manage/distribute/DistributeWaitingSendPointsMapper.java

@@ -1,10 +1,15 @@
 package com.cyksj.mapper.manage.distribute;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.DistributeWaitingSendPoints;
+import com.cyksj.model.views.BrokenLineCpsUserWMoneyView;
+import com.cyksj.model.views.CpsUserWMoneyStatisticsDataView;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
+import java.util.List;
+
 /*
  *项目名: netflix
  *文件名: DistributeWaitingSendPointsMapper
@@ -13,6 +18,10 @@ import org.apache.ibatis.annotations.Update;
  */
 public interface DistributeWaitingSendPointsMapper extends BaseMapper<DistributeWaitingSendPoints> {
 
-	@Update("update distribute_waiting_send_points set send_status = #{status} where order_id = #{orderId}")
-	void updateOrderStatus(@Param("orderId") Long orderId, @Param("status") DistributeWaitingSendPoints.Status status);
+	@Update("update distribute_waiting_send_points set send_status = #{status} where order_id = #{orderId} and send_status != 'success'")
+	Integer updateOrderStatus(@Param("orderId") Long orderId, @Param("status") DistributeWaitingSendPoints.Status status);
+
+	List<CpsUserWMoneyStatisticsDataView> getWMoneyStatisticsDataView(@Param("cpsUserId") Long cpsUserId, @Param("first") DateTime first, @Param("end") DateTime end, @Param("today") Boolean today);
+
+	BrokenLineCpsUserWMoneyView getWMoneyStatisticsDate(@Param("cpsUserId") Long cpsUserId, @Param("first") DateTime first, @Param("end") DateTime end, @Param("today") Boolean today);
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/distribute/UserDistributeMapper.java

@@ -1,6 +1,7 @@
 package com.cyksj.mapper.manage.distribute;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.User;
 import com.cyksj.model.entity.UserDistribute;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,4 +22,8 @@ public interface UserDistributeMapper extends BaseMapper<UserDistribute> {
 	BigDecimal getHasPayOrdersBySharedId(@Param("userId") Long userId, @Param("noOrderStatus") List<String> noOrderStatus, @Param("startTime") String startTime, @Param("endTime") String endTime);
 
 	BigDecimal countHasPayBySharedId(@Param("userId") Long userId, @Param("noOrderStatus") List<String> noOrderStatus, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+	User getUserDistributeDetail(@Param("loginPhone") String loginPhone, @Param("email") String email);
+
+	Integer getDistributeGoodsRateByUidAndGid(@Param("userId") Long userId, @Param("goodsId") Long goodsId);
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/AuthRedirect.java

@@ -37,4 +37,9 @@ public class AuthRedirect {
      * 推广id
      */
     private Long pid;
+
+    /**
+     * 固定推广code
+     */
+    private String dsCode;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/GzhBodyDto.java

@@ -33,4 +33,9 @@ public class GzhBodyDto {
 	 * 登录手机号
 	 */
 	private String loginPhone;
+
+	/**
+	 * 固定推广code
+	 */
+	private String dsCode;
 }

+ 22 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/DistributeOrdersDeductPointsRecord.java

@@ -0,0 +1,22 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: DistributeOrdersDeductPointsRecord
+ *创建者: JavaZou
+ *创建时间:2023/5/23 13:57
+ */
+@Getter
+@Setter
+public class DistributeOrdersDeductPointsRecord extends BaseEntity{
+	private Long userId;
+
+	private Long orderId;
+
+	private BigDecimal deductPoints;
+}

+ 27 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/UserDistributePopularize.java

@@ -0,0 +1,27 @@
+package com.cyksj.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotEmpty;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributePopularize
+ *创建者: JavaZou
+ *创建时间:2023/5/15 15:55
+ */
+@Getter
+@Setter
+public class UserDistributePopularize extends BaseEntity{
+	private Long userId;
+
+	@NotEmpty(message = "分销链接名称必填")
+	private String name;
+
+	private String code;
+
+	private String remark;
+
+	private Boolean deleted;
+}

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/UserDistributeShared.java

@@ -26,4 +26,9 @@ public class UserDistributeShared extends BaseEntity{
 	 * 邀请方式备注
 	 */
 	private String remark;
+
+	/**
+	 * cps后台自定义推广链接id
+	 */
+	private Long dsPopularizeId;
 }

+ 11 - 1
netflix-dao/src/main/java/com/cyksj/model/request/LoginPhoneReq.java → netflix-dao/src/main/java/com/cyksj/model/request/LoginReq.java

@@ -11,7 +11,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class LoginPhoneReq {
+public class LoginReq {
 	private String phone;
 
 	/**
@@ -19,6 +19,11 @@ public class LoginPhoneReq {
 	 */
 	private String email;
 
+	/**
+	 * 登录
+	 */
+	private String login;
+
 	/**
 	 * 验证码
 	 */
@@ -43,4 +48,9 @@ public class LoginPhoneReq {
 	 * 推广id
 	 */
 	private Long popularizeId;
+
+	/**
+	 * 固定推广code
+	 */
+	private String dsCode;
 }

+ 22 - 0
netflix-dao/src/main/java/com/cyksj/model/views/BrokenLineCpsUserWMoneyView.java

@@ -0,0 +1,22 @@
+package com.cyksj.model.views;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: BrokenLineCpsUserWMoneyView
+ *创建者: JavaZou
+ *创建时间:2023/5/16 11:34
+ */
+@Getter
+@Setter
+public class BrokenLineCpsUserWMoneyView {
+	private String firstDate;
+
+	private String lastDate;
+
+	private List<CpsUserWMoneyStatisticsDataView> dataView;
+}

+ 43 - 0
netflix-dao/src/main/java/com/cyksj/model/views/CpsUserDistributeDetailView.java

@@ -0,0 +1,43 @@
+package com.cyksj.model.views;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: CpsUserDistributeDetailView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 10:14
+ */
+@Getter
+@Setter
+public class CpsUserDistributeDetailView {
+
+	/**
+	 * 待入账金额
+	 */
+	private BigDecimal wMoney;
+
+	/**
+	 * 返现金额
+	 */
+	private BigDecimal reMoney;
+
+	/**
+	 * 待提现金额
+	 */
+	private BigDecimal wApplyMoney;
+
+	/**
+	 * 已提现金额
+	 */
+	private BigDecimal gotApplyMoney;
+
+	/**
+	 * 各平台分销比例
+	 */
+	private List<UserDistributeRateView> rateViews;
+}

+ 22 - 0
netflix-dao/src/main/java/com/cyksj/model/views/CpsUserWMoneyStatisticsDataView.java

@@ -0,0 +1,22 @@
+package com.cyksj.model.views;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: CpsUserWMoneyStatisticsDataView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 10:51
+ */
+@Getter
+@Setter
+public class CpsUserWMoneyStatisticsDataView {
+	private int hour;
+
+	private BigDecimal money;
+
+	private String date;
+}

+ 52 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeOrdersDetailView.java

@@ -0,0 +1,52 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributeOrdersDetailView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 11:50
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select o.id,o.user_id,o.goods_id,o.sku_id,o.money,o.refund_money,o.coupon_money,o.created_time from order_don o inner join (select user_id from user_distribute_shared where :sharedId:) us on us.user_id = o.user_id where o.is_fixed_distribute is true and o.relation_id != 0 and o.status not in ('close','noPayment') :time:) od" +
+		" left join goods_don g on g.id = od.goods_id" +
+		" left join distribute_waiting_send_points dp on dp.order_id = od.id")
+public class UserDistributeOrdersDetailView {
+
+	@DbField("select nickname from user where id = od.user_id limit 1")
+	private String nickname;
+
+	@JsonIgnore
+	@DbField("g.id")
+	private Long goodsId;
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("select spec_val from goods_don_sku where id = od.sku_id limit 1")
+	private String specVal;
+
+	@DbField("cast(od.money/100 as decimal(10,2))")
+	private BigDecimal money;
+
+	@DbField("od.coupon_money")
+	private BigDecimal couponMoney;
+
+	@DbField("TRUNCATE(dp.points/1000,2)")
+	private BigDecimal reMoney = BigDecimal.ZERO;
+
+	@DbField("dp.send_status")
+	private String sendStatus;
+
+	@DbField("od.created_time")
+	private Date createdTime;
+}

+ 40 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeOrdersStatisticsView.java

@@ -0,0 +1,40 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributeOrdersStatisticsView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 11:32
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select o.id,o.user_id,o.goods_id,o.money,o.refund_money,o.status from order_don o inner join (select user_id from user_distribute_shared where :sharedId:) us on us.user_id = o.user_id where o.is_fixed_distribute is true and o.relation_id != 0 and o.status not in ('close','noPayment') :time:) od left join goods_don g on g.id = od.goods_id" +
+		" left join distribute_waiting_send_points dp on dp.order_id = od.id",
+		groupBy = "od.goods_id,g.title")
+public class UserDistributeOrdersStatisticsView {
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("cast(sum(od.money)/100 as decimal(10,2))")
+	private BigDecimal distributeOrderMoney;
+
+	@DbField("count(od.id)")
+	private Integer orders;
+
+	@DbField("cast(sum(if(dp.send_status != 'close',od.money,0))/100 as decimal(10,2))")
+	private BigDecimal takeMoney;
+
+	@DbField("count(if(od.status = 'refund',1,NULL))")
+	private Integer refundOrders;
+
+	@DbField("cast(sum(if(od.status = 'refund',od.refund_money,0))/100 as decimal(10,2))")
+	private BigDecimal refundMoney;
+}

+ 28 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserDistributePopularizeObjs.java

@@ -0,0 +1,28 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.SearchResult;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributePopularizeObjs
+ *创建者: JavaZou
+ *创建时间:2023/5/22 11:14
+ */
+@Getter
+@Setter
+public class UserDistributePopularizeObjs {
+
+	private String popularizeLink;
+
+	private Integer orders;
+
+	private BigDecimal ordersMoney;
+
+	private String name;
+
+	SearchResult<UserDistributePopularizeView> views;
+}

+ 50 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserDistributePopularizeView.java

@@ -0,0 +1,50 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.DbIgnore;
+import com.ejlchina.searcher.bean.SearchBean;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributePopularizeView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 17:38
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(select id,name,remark,code,created_time from user_distribute_popularize where deleted is true :userId:) dp left join order_don od on od.ds_popularize_id = dp.id" +
+		" and od.status not in ('close','noPayment') and od.relation_id != 0 and is_fixed_distribute is true" +
+		" left join distribute_waiting_send_points dsp on dsp.order_id = od.id and dsp.send_status in ('success','waiting')",
+		groupBy = "dp.id,dp.name,dp.code,dp.remark,dp.created_time")
+public class UserDistributePopularizeView {
+	@DbField("dp.id")
+	private Long id;
+
+	@DbField("dp.name")
+	private String name;
+
+	@DbField("dp.code")
+	@JsonIgnore
+	private String code;
+
+	@DbIgnore
+	private String popularizeLink;
+
+	@DbField("count(if(dsp.id is NULL,NULL,1))")
+	private Integer orders;
+
+	@DbField("ifnull(cast(sum(if(dsp.id is NULL,0,money))/100 as decimal(11,2)),0)")
+	private BigDecimal ordersMoney;
+
+	@DbField("dp.remark")
+	private String remark;
+
+	@DbField("dp.created_time")
+	private Date createTime;
+}

+ 24 - 0
netflix-dao/src/main/java/com/cyksj/model/views/UserDistributeRateView.java

@@ -0,0 +1,24 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+/*
+ *项目名: netflix
+ *文件名: UserDistributeRateView
+ *创建者: JavaZou
+ *创建时间:2023/5/15 10:02
+ */
+@Getter
+@Setter
+@SearchBean(tables = "goods_don g left join user_plat_distribute_rate upr on upr.goods_id = g.id :distribute_id:",
+		where = "g.type = 1 and g.deleted is true and g.status is true")
+public class UserDistributeRateView {
+	@DbField("g.title")
+	private String title;
+
+	@DbField("upr.rate")
+	private Integer rate = 0;
+}

+ 77 - 0
netflix-dao/src/main/resources/mapper/DistributeWaitingSendPointsMapper.xml

@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.cyksj.mapper.manage.distribute.DistributeWaitingSendPointsMapper">
+
+    <select id="getWMoneyStatisticsDataView"
+            resultType="com.cyksj.model.views.CpsUserWMoneyStatisticsDataView">
+        select
+        <if test="today">
+            date_format(send_time, '%H') as `hour`,
+        </if>
+        <if test="!today">
+            date_format(send_time, '%Y-%m-%d') `date`,
+        </if>
+        TRUNCATE(ifnull(sum(points),0)/ 1000,2) money
+        from `distribute_waiting_send_points`
+        where shared_id = #{cpsUserId}
+        and send_status = 'waiting'
+        <choose>
+            <when test="today">
+                <if test="first != null">
+                    and send_time >= #{first}
+                </if>
+                <if test="end != null">
+                    and send_time &lt;= #{end}
+                </if>
+                group by date_format(send_time, '%H')
+                order by date_format(send_time, '%H')
+            </when>
+            <otherwise>
+                <if test="first != null">
+                    and date_format(send_time, '%Y-%m-%d') >= #{first}
+                </if>
+                <if test="end != null">
+                    and date_format(send_time, '%Y-%m-%d') &lt; #{end}
+                </if>
+                group by date_format(send_time, '%Y-%m-%d')
+                order by date_format(send_time, '%Y-%m-%d')
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="getWMoneyStatisticsDate" resultType="com.cyksj.model.views.BrokenLineCpsUserWMoneyView">
+        select min(curdate) as firstDate,
+        max(curdate) as lastDate from (select
+        <if test="today">
+            date_format(send_time, '%H') as `curdate`
+        </if>
+        <if test="!today">
+            date_format(send_time, '%Y-%m-%d') `curdate`
+        </if>
+        from `distribute_waiting_send_points`
+        where shared_id = #{cpsUserId}
+        and send_status = 'waiting'
+        <choose>
+            <when test="today">
+                <if test="first != null">
+                    and send_time >= #{first}
+                </if>
+                <if test="end != null">
+                    and send_time &lt;= #{end}
+                </if>
+                group by date_format(send_time, '%H')
+            </when>
+            <otherwise>
+                <if test="first != null">
+                    and date_format(send_time, '%Y-%m-%d') >= #{first}
+                </if>
+                <if test="end != null">
+                    and date_format(send_time, '%Y-%m-%d') &lt; #{end}
+                </if>
+                group by date_format(send_time, '%Y-%m-%d')
+            </otherwise>
+        </choose>
+        )s
+    </select>
+</mapper>

+ 23 - 0
netflix-dao/src/main/resources/mapper/UserDistributeMapper.xml

@@ -51,4 +51,27 @@
             and od.created_time &lt; #{endTime}
         </if>
     </select>
+
+    <select id="getUserDistributeDetail" resultType="com.cyksj.model.entity.User">
+        select u.* from (select * from user
+        <where>
+            <if test="loginPhone!=null and loginPhone != ''">
+                login_phone = #{loginPhone}
+            </if>
+            <if test="email != null and email != ''">
+                and email = #{email}
+            </if>
+            limit 1
+        </where>
+        )u inner join user_distribute ud on ud.user_id = u.id and ud.deleted is true
+    </select>
+
+    <select id="getDistributeGoodsRateByUidAndGid" resultType="java.lang.Integer">
+        select udr.rate
+        from (select shared_id from user_distribute_shared where user_id = #{userId} limit 1) us
+                 inner join user_distribute ud on ud.user_id = us.shared_id
+                 inner join user_plat_distribute_rate udr
+                            on udr.distribute_id = ud.id
+        where udr.goods_id = #{goodsId}
+    </select>
 </mapper>

+ 15 - 0
netflix-dao/src/main/resources/mapper/UserDistributePopularizeMapper.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper">
+
+    <select id="getDefaultPopularizeDetail" resultType="com.cyksj.model.views.UserDistributePopularizeView">
+        select count(od.id) orders,
+               ifnull(cast(sum(money)/100 as decimal(11,2)),0) ordersMoney
+        from (select user_id from user_distribute_shared where shared_id = #{cpsUserId}) us
+                 inner join order_don od
+                            on od.user_id = us.user_id and od.status not in ('close', 'noPayment') and
+                               od.is_fixed_distribute is true and od.ds_popularize_id = 0
+                 inner join distribute_waiting_send_points dp on dp.order_id = od.id
+            and dp.send_status in ('success', 'waiting')
+    </select>
+</mapper>

+ 28 - 0
netflix-service/src/main/java/com/cyksj/common/EnvCommonService.java

@@ -5,6 +5,8 @@ import lombok.Setter;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.PostConstruct;
+
 /*
  *项目名: netflix
  *文件名: EnvCommon
@@ -20,6 +22,10 @@ public class EnvCommonService {
 
 	public static final String active_prd = "prd";
 
+	public static String DISTRIBUTE_DEFAULT_URL_PREFIX;
+
+	public static String DISTRIBUTE_DESIGN_URL_PREFIX;
+
 	@Value(value = "${spring.profiles.active}")
 	private String env;
 
@@ -33,4 +39,26 @@ public class EnvCommonService {
 	public String getDomain() {
 		return this.getHost().substring(0, this.getHost().indexOf("8081"));
 	}
+
+	public String getDomain2() {
+		return this.getHost().substring(0, this.getHost().indexOf("/8081"));
+	}
+
+	public Boolean isPrdEnv() {
+		return EnvCommonService.active_prd.equals(getEnv());
+	}
+
+	@PostConstruct
+	public void getDistributeUrl() {
+		DISTRIBUTE_DEFAULT_URL_PREFIX = getDomain();
+		if (!DISTRIBUTE_DEFAULT_URL_PREFIX.endsWith("/")) {
+			DISTRIBUTE_DEFAULT_URL_PREFIX += "/";
+		}
+		if (!isPrdEnv()) {
+			DISTRIBUTE_DEFAULT_URL_PREFIX += "yinhe/web";
+		}
+		DISTRIBUTE_DEFAULT_URL_PREFIX += "?sharedId=%s";
+
+		DISTRIBUTE_DESIGN_URL_PREFIX = DISTRIBUTE_DEFAULT_URL_PREFIX.replace("sharedId", "dsCode");
+	}
 }

+ 4 - 0
netflix-service/src/main/java/com/cyksj/config/wxlogin/WxOpenPlatYHLXLoginConfig.java

@@ -31,5 +31,9 @@ public class WxOpenPlatYHLXLoginConfig {
 
 	private String loginUrl;
 
+	private String cpsRedirectUri;
+
+	private String cpsLoginUrl;
+
 	private String remark;
 }

+ 1 - 0
netflix-service/src/main/java/com/cyksj/redis/RedisService.java

@@ -604,6 +604,7 @@ public class RedisService {
         BUSINESS_FIRST_ORDER_USER_KEY("business_first_order_user_key:%s:", "商务分销首单提成key", 60l),
         PC_WEB_CACHE("pc_web_cache", "官网首页平台缓存", 5 * 60),
         H5_WEB_CACHE("h5_web_cache", "h5首页平台缓存", 5 * 60),
+        CPS_BACK_LOGIN_KEY("cps_back_login:", "cps商务后台登录key", 3 * 60),
         ;
 
         private String name;

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/authorization/AuthorizationService.java

@@ -20,5 +20,5 @@ public interface AuthorizationService {
 
     JsSdkTicket getJsTicket(String appId, String url) throws Exception;
 
-    String createWxAuthLoginUrl(String state);
+    String createWxAuthLoginUrl(String state, Boolean isCpsLogin);
 }

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/authorization/impl/AuthorizationServiceImpl.java

@@ -62,8 +62,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
     }
 
     @Override
-    public String createWxAuthLoginUrl(String state) {
-        return weChatService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), URLEncoder.encode(wxOpenPlatYHLXLoginConfig.getRedirectUri(), StandardCharsets.UTF_8));
+    public String createWxAuthLoginUrl(String state, Boolean isCpsLogin) {
+        return weChatService.createWxAuthLoginUrl(state, wxOpenPlatYHLXLoginConfig.getAppId(), URLEncoder.encode(isCpsLogin ? wxOpenPlatYHLXLoginConfig.getCpsRedirectUri() : wxOpenPlatYHLXLoginConfig.getRedirectUri(), StandardCharsets.UTF_8));
     }
 
 }

+ 29 - 0
netflix-service/src/main/java/com/cyksj/service/cps/CpsManageService.java

@@ -0,0 +1,29 @@
+package com.cyksj.service.cps;
+
+import cn.hutool.core.date.DateTime;
+import com.cyksj.model.entity.User;
+import com.cyksj.model.views.BrokenLineCpsUserWMoneyView;
+import com.cyksj.model.views.CpsUserWMoneyStatisticsDataView;
+
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: CpsManageService
+ *创建者: JavaZou
+ *创建时间:2023/5/12 11:18
+ */
+public interface CpsManageService {
+	/**
+	 * 获取登录验证码
+	 * @param type 1手机号、2邮箱
+	 * @param login
+	 */
+	void getLoginCode(Integer type, String login);
+
+	User login(Integer type, String login, String code);
+
+	List<CpsUserWMoneyStatisticsDataView> getWMoneyStatisticsDataView(Long cpsUserId, DateTime first, DateTime end);
+
+	BrokenLineCpsUserWMoneyView getWMoneyStatisticsDate(Long cpsUserId, DateTime first, DateTime end);
+}

+ 20 - 0
netflix-service/src/main/java/com/cyksj/service/cps/CpsPopularizeService.java

@@ -0,0 +1,20 @@
+package com.cyksj.service.cps;
+
+import com.cyksj.model.entity.UserDistributePopularize;
+import com.cyksj.model.views.UserDistributePopularizeView;
+
+/*
+ *项目名: netflix
+ *文件名: CpsPopularizeService
+ *创建者: JavaZou
+ *创建时间:2023/5/15 16:01
+ */
+public interface CpsPopularizeService {
+	void insert(UserDistributePopularize popularize);
+
+	void update(UserDistributePopularize popularize);
+
+	void deleteById(long cpsUserId, Long id);
+
+	UserDistributePopularizeView getDefaultPopularizeDetail(long cpsUserId);
+}

+ 134 - 0
netflix-service/src/main/java/com/cyksj/service/cps/impl/CpsManageServiceImpl.java

@@ -0,0 +1,134 @@
+package com.cyksj.service.cps.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Validator;
+import cn.hutool.core.util.StrUtil;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.util.SmsUtil;
+import com.cyksj.common.util.StringUtil;
+import com.cyksj.mapper.manage.distribute.DistributeWaitingSendPointsMapper;
+import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
+import com.cyksj.model.entity.User;
+import com.cyksj.model.views.BrokenLineCpsUserWMoneyView;
+import com.cyksj.model.views.CpsUserWMoneyStatisticsDataView;
+import com.cyksj.redis.RedisService;
+import com.cyksj.service.cps.CpsManageService;
+import com.cyksj.service.mail.MailService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: CpsManageServiceImpl
+ *创建者: JavaZou
+ *创建时间:2023/5/12 11:18
+ */
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class CpsManageServiceImpl implements CpsManageService {
+
+	private final MailService mailService;
+
+	private final RedisService redisService;
+
+	private final DistributeWaitingSendPointsMapper waitingSendPointsMapper;
+
+	private final UserDistributeMapper userDistributeMapper;
+
+	@Override
+	public void getLoginCode(Integer type, String login) {
+		if (type > 2) {
+			throw BusinessRuntimeException.getInstance("");
+		}
+		//是否是渠道分销用户
+		String phone = null;
+		String email = null;
+		if (type == 1) phone = login;
+		else if (type == 2) email = login;
+		User user = userDistributeMapper.getUserDistributeDetail(phone, email);
+		if (user == null) throw BusinessRuntimeException.getInstance("只支持渠道分销用户登录");
+		String CACHE_LOGIN_KEY = RedisService.key.CPS_BACK_LOGIN_KEY.getName() + login;
+		Object o = redisService.get(CACHE_LOGIN_KEY);
+		Long expire = redisService.getExpire(CACHE_LOGIN_KEY);
+		if (o != null && expire >= 3 * 60 - 10) {
+			throw BusinessRuntimeException.getInstance("获取验证码过于频繁");
+		}
+		String code = StringUtil.getRandomCodeStr(6);
+		if (type == 1) {
+			if (!Validator.isMobile(login)) {
+				throw BusinessRuntimeException.getInstance("请输入正确的手机号");
+			}
+			SmsUtil.sendTencent(login, code);
+		} else if (type == 2) {
+			if (!Validator.isEmail(login)) {
+				throw BusinessRuntimeException.getInstance("请输入正确的邮箱");
+			}
+			mailService.sendLoginCodeEmailToPeople(code, login);
+		}
+		redisService.set(CACHE_LOGIN_KEY, code, RedisService.key.CPS_BACK_LOGIN_KEY.getTimeout());
+	}
+
+	@Override
+	public User login(Integer type, String login, String code) {
+		String phone = null;
+		String email = null;
+		if (type == null) {
+			type = 1;
+		}
+		if (type > 2) {
+			throw BusinessRuntimeException.getInstance("");
+		}
+		if (type == 1) phone = login;
+		if (type == 2) email = login;
+		if (StrUtil.isEmpty(code)) {
+			throw BusinessRuntimeException.getInstance("请输入验证码");
+		}
+		String CACHE_LOGIN_KEY = RedisService.key.CPS_BACK_LOGIN_KEY.getName();
+		if (type == 1) {
+			if (!Validator.isMobile(phone)) {
+				throw BusinessRuntimeException.getInstance("请输入正确的手机号");
+			}
+			CACHE_LOGIN_KEY += phone;
+		} else if (type == 2) {
+			if (!Validator.isEmail(email)) {
+				throw BusinessRuntimeException.getInstance("请输入正确的手机号");
+			}
+			CACHE_LOGIN_KEY += email;
+		}
+		String cache_code = (String) redisService.get(CACHE_LOGIN_KEY);
+		if (StrUtil.isBlank(cache_code) || !cache_code.equals(code)) {
+			throw BusinessRuntimeException.getInstance("验证码错误");
+		}
+		User user = userDistributeMapper.getUserDistributeDetail(phone, email);
+		if (user == null) throw BusinessRuntimeException.getInstance("用户不存在");
+		redisService.del(CACHE_LOGIN_KEY);
+		return user;
+	}
+
+	@Override
+	public List<CpsUserWMoneyStatisticsDataView> getWMoneyStatisticsDataView(Long cpsUserId, DateTime first, DateTime end) {
+		boolean today = isToday(first, end);
+		return waitingSendPointsMapper.getWMoneyStatisticsDataView(cpsUserId, first, end, today);
+	}
+
+	@Override
+	public BrokenLineCpsUserWMoneyView getWMoneyStatisticsDate(Long cpsUserId, DateTime first, DateTime end) {
+		boolean today = isToday(first, end);
+		return waitingSendPointsMapper.getWMoneyStatisticsDate(cpsUserId, first, end, today);
+	}
+
+	public boolean isToday(DateTime first, DateTime end) {
+		boolean today = false;
+		if (first != null && end != null) {
+			if (DateUtil.beginOfDay(DateTime.now()).equals(first) && (DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(end) || DateUtil.endOfDay(DateTime.now()).equals(end))) {
+				today = true;
+			}
+		}
+		return today;
+	}
+}

+ 88 - 0
netflix-service/src/main/java/com/cyksj/service/cps/impl/CpsPopularizeServiceImpl.java

@@ -0,0 +1,88 @@
+package com.cyksj.service.cps.impl;
+
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.RandomUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper;
+import com.cyksj.model.entity.UserDistributePopularize;
+import com.cyksj.model.views.UserDistributePopularizeView;
+import com.cyksj.service.cps.CpsPopularizeService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+
+/*
+ *项目名: netflix
+ *文件名: CpsPopularizeServiceImpl
+ *创建者: JavaZou
+ *创建时间:2023/5/15 16:01
+ */
+@Service
+@RequiredArgsConstructor
+@Slf4j
+public class CpsPopularizeServiceImpl implements CpsPopularizeService {
+	private final UserDistributePopularizeMapper popularizeMapper;
+
+	@Override
+	public void insert(UserDistributePopularize popularize) {
+		saveOrUpdate(popularize);
+	}
+
+	@Override
+	public void update(UserDistributePopularize popularize) {
+		Long popularizeId = popularize.getId();
+		if (popularizeId == null) throw BusinessRuntimeException.getInstance("链接不存在");
+		saveOrUpdate(popularize);
+	}
+
+	@Override
+	public void deleteById(long cpsUserId, Long id) {
+
+		popularizeMapper.update(null, Wrappers.lambdaUpdate(UserDistributePopularize.class)
+				.set(UserDistributePopularize::getDeleted, false)
+				.eq(UserDistributePopularize::getUserId, cpsUserId)
+				.eq(UserDistributePopularize::getId, id));
+	}
+
+	public void saveOrUpdate(UserDistributePopularize popularize) {
+		Long popularizeId = popularize.getId();
+		String name = popularize.getName();
+		String remark = popularize.getRemark();
+		Long userId = popularize.getUserId();
+		if (name.length() > 128) {
+			throw BusinessRuntimeException.getInstance("链接名称过长");
+		}
+		if (StrUtil.isNotBlank(remark) && remark.length() > 200) {
+			throw BusinessRuntimeException.getInstance("备注过长");
+		}
+		if (popularizeId == null) {
+			boolean isSuccess = false;
+			String code = null;
+			while (!isSuccess) {
+				try {
+					code = RandomUtil.randomString(6);
+					popularize.setCode(code);
+					popularizeMapper.insert(popularize);
+					isSuccess = true;
+				} catch (DuplicateKeyException e) {
+					log.info("重复推广链接码code:{},重新获取code", code);
+				}
+			}
+			return;
+		}
+		Assert.notNull(popularizeMapper.selectById(popularizeId), "链接不存在");
+		popularizeMapper.update(null, Wrappers.lambdaUpdate(UserDistributePopularize.class)
+				.set(UserDistributePopularize::getName, name)
+				.set(UserDistributePopularize::getRemark, remark)
+				.eq(UserDistributePopularize::getId, popularizeId)
+				.eq(UserDistributePopularize::getUserId, userId));
+	}
+
+	@Override
+	public UserDistributePopularizeView getDefaultPopularizeDetail(long cpsUserId) {
+		return popularizeMapper.getDefaultPopularizeDetail(cpsUserId);
+	}
+}

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/distribute/DistributeService.java

@@ -17,6 +17,7 @@ public interface DistributeService {
 	 * 保存分销邀请记录
 	 * sharedId: 邀请人
 	 * userId: 被邀请人
+	 * dsPopularizeId: 后台自定义推广链接id
 	 */
-	void saveDistributionInvitation(Long sharedId, Long userId);
+	void saveDistributionInvitation(Long sharedId, Long userId, Long dsPopularizeId);
 }

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/distribute/impl/DistributeServiceImpl.java

@@ -116,11 +116,12 @@ public class DistributeServiceImpl implements DistributeService {
 	}
 
 	@Override
-	public void saveDistributionInvitation(Long sharedId, Long userId) {
+	public void saveDistributionInvitation(Long sharedId, Long userId, Long dsPopularizeId) {
 		UserDistributeShared userDistributeShared = new UserDistributeShared();
 		userDistributeShared.setSharedId(sharedId);
 		//存在分销
 		userDistributeShared.setUserId(userId);
+		userDistributeShared.setDsPopularizeId(dsPopularizeId);
 		try {
 			userDistributeSharedMapper.insert(userDistributeShared);
 			TaskType taskType = taskTypeMapper.selectOne(Wrappers.lambdaQuery(TaskType.class)

+ 17 - 3
netflix-service/src/main/java/com/cyksj/service/gzh/factory/EventMsgService.java

@@ -12,12 +12,13 @@ import com.cyksj.common.util.StringUtil;
 import com.cyksj.config.WeChatConfig;
 import com.cyksj.mapper.UserMapper;
 import com.cyksj.mapper.WxAppMapper;
-import com.cyksj.mapper.WxSyncLogMapper;
 import com.cyksj.mapper.gzh.UserGzhRelationMapper;
+import com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper;
 import com.cyksj.model.dto.GzhBodyDto;
 import com.cyksj.model.dto.GzhUnionidUserinfo;
 import com.cyksj.model.dto.MsgEvent;
 import com.cyksj.model.entity.User;
+import com.cyksj.model.entity.UserDistributePopularize;
 import com.cyksj.model.entity.UserGzhRelation;
 import com.cyksj.model.entity.WxApp;
 import com.cyksj.redis.RedisService;
@@ -61,7 +62,7 @@ public class EventMsgService implements GzhMsgService {
 
 	private final WeChatConfig weChatConfig;
 
-	private final WxSyncLogMapper wxSyncLogMapper;
+	private final UserDistributePopularizeMapper distributePopularizeMapper;
 
 	private final BindTaskService bindTaskService;
 
@@ -150,10 +151,23 @@ public class EventMsgService implements GzhMsgService {
 			}
 			userMapper.insert(user);
 			Long userId = user.getId();
+			Long dsPopularizeId = null;
 			if (gzhDto != null) {
 				Long sharedId = gzhDto.getSharedId();
+				String dsCode = gzhDto.getDsCode();
+				if (StrUtil.isNotBlank(dsCode)) {
+					dsCode = dsCode.trim();
+					UserDistributePopularize distributePopularize = distributePopularizeMapper.selectOne(Wrappers.lambdaQuery(UserDistributePopularize.class)
+							.eq(UserDistributePopularize::getCode, dsCode)
+							.select(UserDistributePopularize::getUserId, UserDistributePopularize::getId).last("limit 1"));
+					if (distributePopularize != null) {
+						log.info("渠道sharedId:{}设置固定推广链接PC扫码用户分销", distributePopularize.getUserId());
+						sharedId = distributePopularize.getUserId();
+						dsPopularizeId = distributePopularize.getId();
+					}
+				}
 				if (sharedId != null) {
-					distributeService.saveDistributionInvitation(sharedId, user.getId());
+					distributeService.saveDistributionInvitation(sharedId, user.getId(), dsPopularizeId);
 				}
 				Long popularizeId = gzhDto.getPopularizeId();
 				if (popularizeId != null) {

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/mail/MailService.java

@@ -13,5 +13,7 @@ public interface MailService {
 	 */
 	String sendLoginCodeEmailToPeople(Integer digit, String toAddress);
 
+	Boolean sendLoginCodeEmailToPeople(String code, String toAddress);
+
 	void sendEmailMsgToPeople(String people, String subject, String msg);
 }

+ 9 - 4
netflix-service/src/main/java/com/cyksj/service/mail/impl/MailServiceImpl.java

@@ -32,10 +32,7 @@ public class MailServiceImpl implements MailService {
 	public String sendLoginCodeEmailToPeople(Integer digit, String toAddress) {
 		// 生成验证码
 		String code = StringUtil.getRandomCodeStr(digit);
-		String subject = "【银河录像局】登录验证码";
-		String content = String.format("尊敬的用户,您的验证码为%s,此验证码仅用于银河录像。【银河录像局】", code);
-		boolean flag = sendMail(toAddress, subject, content);
-		if (flag) {
+		if (sendLoginCodeEmailToPeople(code, toAddress)) {
 			//删除之前的验证码缓存key
 			String key = RedisService.key.EMAIL_CODE_KEY.getNameFormat(toAddress);
 			redisService.del(key);
@@ -46,6 +43,14 @@ public class MailServiceImpl implements MailService {
 		return null;
 	}
 
+	@Override
+	public Boolean sendLoginCodeEmailToPeople(String code, String toAddress) {
+		String subject = "【银河录像局】登录验证码";
+		String content = String.format("尊敬的用户,您的验证码为%s,此验证码仅用于银河录像。【银河录像局】", code);
+		boolean flag = sendMail(toAddress, subject, content);
+		return flag;
+	}
+
 	@Override
 	public void sendEmailMsgToPeople(String people, String subject, String msg) {
 		log.info("发送邮件至用户:{}开始", people);

+ 69 - 13
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -76,6 +76,7 @@ import com.cyksj.service.relation.GroupRelationClearService;
 import com.cyksj.service.relation.GroupRelationFrontService;
 import com.cyksj.service.sys.SysConfigService;
 import com.cyksj.service.template.TemplateCommonService;
+import com.cyksj.service.user.UserPointsService;
 import com.cyksj.service.wechat.WeChatService;
 import com.cyksj.task.JobManager;
 import com.ejlchina.searcher.BeanSearcher;
@@ -203,6 +204,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 
 	private final UserBindDetailMapper userBindDetailMapper;
 
+	private final UserPointsService userPointsService;
+
 	private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
 
 	@Transactional(rollbackFor = Throwable.class)
@@ -349,6 +352,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 					UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, userDistributeShared.getSharedId()));
 					if (userDistribute != null) {
 						orderDon.setIsFixedDistribute(true);
+						orderDon.setDsPopularizeId(userDistributeShared.getDsPopularizeId());
 					}
 				}
 			}
@@ -750,6 +754,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, userDistributeShared.getSharedId()));
 				if (userDistribute != null) {
 					orderDon.setIsFixedDistribute(true);
+					orderDon.setDsPopularizeId(userDistributeShared.getDsPopularizeId());
 				}
 			}
 		}
@@ -958,9 +963,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		//修改订单状态
 		orderDon.setStatus(OrderDon.Status.refund);
 		orderDon.setRefundMoney(wxOrderRefundReq.getRefundMoney());
-		if (orderDon.getIsDistribute()) {
-			distributeWaitingSendPointsMapper.updateOrderStatus(orderDon.getId(), DistributeWaitingSendPoints.Status.close);
-		}
 		orderDonMapper.updateById(orderDon);
 		//记录退款信息
 		final String outNo = outRefundNo;
@@ -1038,10 +1040,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				AliPayRefundRep.AlipayTradeRefundResponse res = aliPayRefundRep.getResponse();
 				orderDon.setRefundMoney(res.getRefundFee().multiply(BigDecimal.valueOf(100)));
 			} else orderDon.setRefundMoney(BigDecimal.ZERO);
-			if (orderDon.getIsDistribute()) {
-				distributeWaitingSendPointsMapper.updateOrderStatus(orderDon.getId(), DistributeWaitingSendPoints.Status.close);
-			}
-			orderDonMapper.updateById(orderDon);
 			//记录退款信息
 			THREAD_POOL_TASK_EXECUTOR.execute(()->{
 				refundRecord(orderDon, goodsDon, sku, outNo);
@@ -1056,6 +1054,38 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				} catch (Exception e) {
 					log.error("zfb减少抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
 				}
+				if (orderDon.getIsDistribute()) {
+					DistributeWaitingSendPoints distributeWaitingSendPoints = distributeWaitingSendPointsMapper.selectOne(Wrappers.lambdaQuery(DistributeWaitingSendPoints.class).eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId()).last("limit 1"));
+					if (distributeWaitingSendPoints != null) {
+						Integer success = distributeWaitingSendPointsMapper.updateOrderStatus(orderDon.getId(), DistributeWaitingSendPoints.Status.close);
+						//是否积分已经发送
+						if (success != 1 && orderDon.getIsFixedDistribute()) {
+							//扣除固定推广者积分
+							BigDecimal refundMoney = orderDon.getRefundMoney();
+							BigDecimal money = orderDon.getMoney();
+							BigDecimal needSubPoints = distributeWaitingSendPoints.getPoints();
+							if (refundMoney.compareTo(money) == 0) {
+								userPointsService.deductDistributePoints(orderDon.getId(), distributeWaitingSendPoints.getSharedId(), needSubPoints);
+
+								distributeWaitingSendPointsMapper.update(null, Wrappers.lambdaUpdate(DistributeWaitingSendPoints.class)
+										.set(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close)
+										.eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId())
+										.ne(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close));
+							} else {
+								Integer thisGoodsRate = Optional.ofNullable(userDistributeMapper.getDistributeGoodsRateByUidAndGid(orderDon.getUserId(), orderDon.getGoodsId())).orElse(0);
+								if (thisGoodsRate > 0) {
+									needSubPoints = refundMoney.multiply(BigDecimal.valueOf(thisGoodsRate).divide(BigDecimal.valueOf(10))).multiply(BigDecimal.valueOf(1000));
+									userPointsService.deductDistributePoints(orderDon.getId(), distributeWaitingSendPoints.getSharedId(), needSubPoints);
+
+									distributeWaitingSendPointsMapper.update(null, Wrappers.lambdaUpdate(DistributeWaitingSendPoints.class)
+											.set(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close)
+											.eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId())
+											.ne(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close));
+								}
+							}
+						}
+					}
+				}
 			});
 			//虚物订单退款,清出车队,车票变为已过期
 			clearUnrealGoodsDetail(orderDon, goodsDon, sku);
@@ -1063,6 +1093,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 				//zfb订单退款,返还优惠券
 				updateOrderDonCouponStatus(orderDon);
 			}
+			orderDonMapper.updateById(orderDon);
 			return GatewayResponse.SUCCESS.newBuilder().toResult("退款成功");
 		}
 		throw BusinessRuntimeException.getInstance("退款失败,e:{0}", response.getBody());
@@ -1261,12 +1292,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			orderDon.setRefundMoney(refundMoney);
 			orderDonMapper.updateById(orderDon);
 		}
-		if (orderDon.getIsDistribute()) {
-			DistributeWaitingSendPoints distributeWaitingSendPoints = distributeWaitingSendPointsMapper.selectOne(Wrappers.lambdaQuery(DistributeWaitingSendPoints.class).eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId()).last("limit 1"));
-			if (distributeWaitingSendPoints != null && distributeWaitingSendPoints.getSendStatus() != DistributeWaitingSendPoints.Status.close) {
-				distributeWaitingSendPointsMapper.updateOrderStatus(orderDon.getId(), DistributeWaitingSendPoints.Status.close);
-			}
-		}
 		if (orderDon.getCouponUserId() != 0) {
 			Object obj = redisService.get(String.format("%s-%s", orderDon.getId(), orderDon.getCouponUserId()));
 			if (obj == null) {
@@ -1287,6 +1312,37 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			} catch (Exception e) {
 				log.error("wx减少抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
 			}
+			if (orderDon.getIsDistribute()) {
+				DistributeWaitingSendPoints distributeWaitingSendPoints = distributeWaitingSendPointsMapper.selectOne(Wrappers.lambdaQuery(DistributeWaitingSendPoints.class).eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId()).last("limit 1"));
+				if (distributeWaitingSendPoints != null) {
+					Integer success = distributeWaitingSendPointsMapper.updateOrderStatus(orderDon.getId(), DistributeWaitingSendPoints.Status.close);
+					//是否产生过积分
+					if (success != 1 && orderDon.getIsFixedDistribute()) {
+						//扣除固定推广者积分
+						BigDecimal money = orderDon.getMoney();
+						BigDecimal needSubPoints = distributeWaitingSendPoints.getPoints();
+						if (refundMoney.compareTo(money) == 0) {
+							userPointsService.deductDistributePoints(orderDon.getId(), distributeWaitingSendPoints.getSharedId(), needSubPoints);
+
+							distributeWaitingSendPointsMapper.update(null, Wrappers.lambdaUpdate(DistributeWaitingSendPoints.class)
+									.set(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close)
+									.eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId())
+									.ne(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close));
+						} else {
+							Integer thisGoodsRate = Optional.ofNullable(userDistributeMapper.getDistributeGoodsRateByUidAndGid(orderDon.getUserId(), orderDon.getGoodsId())).orElse(0);
+							if (thisGoodsRate > 0) {
+								needSubPoints = refundMoney.multiply(BigDecimal.valueOf(thisGoodsRate).divide(BigDecimal.valueOf(10))).multiply(BigDecimal.valueOf(1000));
+								userPointsService.deductDistributePoints(orderDon.getId(), distributeWaitingSendPoints.getSharedId(), needSubPoints);
+
+								distributeWaitingSendPointsMapper.update(null, Wrappers.lambdaUpdate(DistributeWaitingSendPoints.class)
+										.set(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close)
+										.eq(DistributeWaitingSendPoints::getOrderId, orderDon.getId())
+										.ne(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.close));
+							}
+						}
+					}
+				}
+			}
 		});
 	}
 

+ 23 - 0
netflix-service/src/main/java/com/cyksj/service/user/UserPointsService.java

@@ -0,0 +1,23 @@
+package com.cyksj.service.user;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: UserPointsService
+ *创建者: JavaZou
+ *创建时间:2023/5/18 16:06
+ */
+public interface UserPointsService {
+	/**
+	 * 扣除用户分销积分
+	 * @param userId 用户ID
+	 * @param deductPoints 扣除积分
+	 */
+	void deductDistributePoints(Long orderId, Long userId, BigDecimal deductPoints);
+
+	/**
+	 * 增加积分
+	 */
+	void addDistributePoints(Long userId, BigDecimal addPoints);
+}

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/user/UserService.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 public interface UserService extends IService<User> {
 
-    User saveAuth(GzhOAuth2UserInfo userinfo, Long sharedId, Integer dsType, Long pid);
+    User saveAuth(GzhOAuth2UserInfo userinfo, Long sharedId, Integer dsType, Long pid, String dsCode);
 
     UserWhoami whoami(long userId);
 

+ 64 - 0
netflix-service/src/main/java/com/cyksj/service/user/impl/UserPointsServiceImpl.java

@@ -0,0 +1,64 @@
+package com.cyksj.service.user.impl;
+
+import com.cyksj.mapper.DistributeOrdersDeductPointsRecordMapper;
+import com.cyksj.mapper.UserMapper;
+import com.cyksj.model.entity.DistributeOrdersDeductPointsRecord;
+import com.cyksj.model.entity.User;
+import com.cyksj.service.user.UserPointsService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+
+/*
+ *项目名: netflix
+ *文件名: UserPointsServiceImpl
+ *创建者: JavaZou
+ *创建时间:2023/5/18 16:06
+ */
+@Service
+@RequiredArgsConstructor
+public class UserPointsServiceImpl implements UserPointsService {
+	private final UserMapper userMapper;
+
+	private final DistributeOrdersDeductPointsRecordMapper distributeOrdersDeductPointsRecordMapper;
+
+	@Override
+	public void deductDistributePoints(Long orderId, Long userId, BigDecimal deductPoints) {
+		while (true) {
+			User user = userMapper.selectById(userId);
+			if (user == null) break;
+			BigDecimal points = user.getPoints();
+			Integer success = userMapper.subPointsNegative(userId, points, deductPoints);
+			if (success == 1){
+				//记录积分已发送后,退款后扣除积分记录
+				deductRecord(orderId, userId, deductPoints);
+				break;
+			}
+		}
+	}
+
+	@Override
+	public void addDistributePoints(Long userId, BigDecimal addPoints) {
+		while (true) {
+			User user = userMapper.selectById(userId);
+			if (user == null) break;
+			BigDecimal points = user.getPoints();
+			Integer success = userMapper.updatePoints(user.getId(), points, addPoints);
+			if (success == 1) break;
+		}
+	}
+
+	public void deductRecord(Long orderId, Long userId, BigDecimal deductPoints) {
+		try {
+			DistributeOrdersDeductPointsRecord record = new DistributeOrdersDeductPointsRecord();
+			record.setOrderId(orderId);
+			record.setUserId(userId);
+			record.setDeductPoints(deductPoints);
+			distributeOrdersDeductPointsRecordMapper.insert(record);
+		} catch (DuplicateKeyException e) {
+
+		}
+	}
+}

+ 20 - 18
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -9,11 +9,9 @@ import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.common.task.GlobalThreadPoolTaskExecutor;
 import com.cyksj.common.util.Jsons;
-import com.cyksj.config.WeChatConfig;
 import com.cyksj.mapper.UserMapper;
-import com.cyksj.mapper.UserTransferLogMapper;
-import com.cyksj.mapper.WxSyncLogMapper;
 import com.cyksj.mapper.channel.ChannelPopularizeMapper;
+import com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper;
 import com.cyksj.mapper.market.task.UserBindDetailMapper;
 import com.cyksj.model.dto.GzhOAuth2UserInfo;
 import com.cyksj.model.dto.UserWhoami;
@@ -24,7 +22,6 @@ import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
 import com.cyksj.service.mange.coupon.CouponCommonService;
 import com.cyksj.service.sys.SysConfigService;
 import com.cyksj.service.user.UserService;
-import com.ejlchina.searcher.BeanSearcher;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -42,12 +39,6 @@ import java.util.Optional;
 @Service
 @RequiredArgsConstructor
 public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
-    private final WeChatConfig weChatConfig;
-
-    private final UserTransferLogMapper userTransferLogMapper;
-
-    private final WxSyncLogMapper wxSyncLogMapper;
-
     private final DistributeService distributeService;
 
     private final EquipmentDistributeService equipDistributeService;
@@ -56,22 +47,22 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 
 	private final CouponCommonService couponCommonService;
 
-	private final BeanSearcher beanSearcher;
-
 	private final RedisService redisService;
 
 	private final SysConfigService sysConfigService;
 
 	private final UserBindDetailMapper userBindDetailMapper;
 
+	private final UserDistributePopularizeMapper distributePopularizeMapper;
+
 	private static final GlobalThreadPoolTaskExecutor TASK_POOL = GlobalThreadPoolTaskExecutor.getInstance();
 
 	@Override
-    public User saveAuth(GzhOAuth2UserInfo info, Long sharedId, Integer dsType, Long pid) {
-        final String unionid = info.getUnionid();
-        if (StrUtil.isEmpty(unionid)) {
-            throw BusinessRuntimeException.getInstance("授权操作异常,请刷新页面");
-        }
+	public User saveAuth(GzhOAuth2UserInfo info, Long sharedId, Integer dsType, Long pid, String dsCode) {
+		final String unionid = info.getUnionid();
+		if (StrUtil.isEmpty(unionid)) {
+			throw BusinessRuntimeException.getInstance("授权操作异常,请刷新页面");
+		}
 
 		User user = getSyncUser(info.getOpenid(), info.getUnionid(), null);
 
@@ -101,9 +92,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		} else {
 			this.updateById(user);
 		}
+		Long dsPopularizeId = null;
+		if (StrUtil.isNotBlank(dsCode)) {
+			UserDistributePopularize distributePopularize = distributePopularizeMapper.selectOne(Wrappers.lambdaQuery(UserDistributePopularize.class)
+					.eq(UserDistributePopularize::getCode, dsCode)
+					.select(UserDistributePopularize::getUserId, UserDistributePopularize::getId).last("limit 1"));
+			if (distributePopularize != null) {
+				log.info("渠道sharedId:{}设置固定推广链接用户分销", distributePopularize.getUserId());
+				sharedId = distributePopularize.getUserId();
+				dsPopularizeId = distributePopularize.getId();
+			}
+		}
 		if (sharedId != null && isNewUser) {
 			if (dsType == null || dsType == 1) {
-				distributeService.saveDistributionInvitation(sharedId, user.getId());
+				distributeService.saveDistributionInvitation(sharedId, user.getId(), dsPopularizeId);
 			}
 		}
 		Long userId = user.getId();

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/wechat/WeChatService.java

@@ -77,7 +77,7 @@ public interface WeChatService {
      * 获取公众号带参数的临时二维码
      * @return
      */
-    WxGzhQrCodeTicketRep getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String loginPhone) throws Exception;
+    WxGzhQrCodeTicketRep getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String loginPhone, String dsCode) throws Exception;
 
     /**
      * 获取公众号带参数的永久二维码

+ 4 - 3
netflix-service/src/main/java/com/cyksj/service/wechat/impl/WeChatServiceImpl.java

@@ -482,7 +482,7 @@ public class WeChatServiceImpl implements WeChatService {
     }
 
     @Override
-    public WxGzhQrCodeTicketRep getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String loginPhone) throws Exception {
+    public WxGzhQrCodeTicketRep getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String loginPhone, String dsCode) throws Exception {
         SysConfig sysConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
                 .eq(SysConfig::getSysKey, Constant.QR_CODE_WX_APP_ID).last("limit 1"));
         String appid = null;
@@ -512,12 +512,13 @@ public class WeChatServiceImpl implements WeChatService {
         if (200 != response.statusCode()) {
             throw BusinessRuntimeException.getInstance("获取微信登录二维码失败: " + response.body());
         }
-        if (sharedId != null || popularizeId != null || StrUtil.isNotBlank(loginPhone)) {
+        if (sharedId != null || popularizeId != null || StrUtil.isNotBlank(loginPhone) || StrUtil.isNotBlank(dsCode)) {
             GzhBodyDto gzhBodyDto = new GzhBodyDto()
                     .setSharedId(sharedId)
                     .setPopularizeId(popularizeId)
                     .setDsType(dsType)
-                    .setLoginPhone(loginPhone);
+                    .setLoginPhone(loginPhone)
+                    .setDsCode(dsCode);
             String state = Codec.DoBase64.custom().setData(Jsons.toJson(gzhBodyDto)).encodeAsText();
             redisService.set(RedisService.key.WX_GZH_QRCODE_SHARED_LOGIN.getNameFormat(scene_str), state, RedisService.key.WX_GZH_QRCODE_SHARED_LOGIN.getTimeout());
         }

+ 6 - 12
netflix-service/src/main/java/com/cyksj/task/Scheduler.java

@@ -31,6 +31,7 @@ import com.cyksj.service.register.RegisterOrderDonService;
 import com.cyksj.service.register.SpotifyService;
 import com.cyksj.service.relation.GroupRelationClearService;
 import com.cyksj.service.template.TemplateCommonService;
+import com.cyksj.service.user.UserPointsService;
 import com.cyksj.service.wechat.WeChatService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.param.Operator;
@@ -102,6 +103,8 @@ public class Scheduler {
 
         private final CmsUserMapper cmsUserMapper;
 
+	    private final UserPointsService userPointsService;
+
 
     /**
      * 每5分钟清理过期账号
@@ -247,18 +250,9 @@ public class Scheduler {
             } else {
                 wait.setSendStatus(DistributeWaitingSendPoints.Status.success);
                 log.info("更新用户积分开始=====>");
-                while (true) {
-                    user = userMapper.selectById(sharedId);
-                    if (user == null) {
-                        break;
-                    }
-                    Integer update = userMapper.updatePoints(user.getId(), user.getPoints(), wait.getPoints());
-                    if (update == 1) {
-                        distributeWaitingSendPointsMapper.updateById(wait);
-                        log.info("分销积分表订单id:{}发放积分success", wait.getOrderId());
-                        break;
-                    }
-                }
+	            userPointsService.addDistributePoints(sharedId, wait.getPoints());
+	            distributeWaitingSendPointsMapper.updateById(wait);
+	            log.info("分销积分表订单id:{}发放积分success", wait.getOrderId());
             }
         });
     }

+ 277 - 0
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsBackLoginController.java

@@ -0,0 +1,277 @@
+package com.cyksj.web.controller.cps;
+
+import cn.hutool.core.codec.Base64;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.cyksj.common.annotation.NoSubmit;
+import com.cyksj.common.exception.BusinessRuntimeException;
+import com.cyksj.common.snowflake.Sequence;
+import com.cyksj.common.util.Codec;
+import com.cyksj.common.util.Jsons;
+import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
+import com.cyksj.dto.Result;
+import com.cyksj.enums.GatewayResponse;
+import com.cyksj.mapper.GoodsDonMapper;
+import com.cyksj.mapper.UserMapper;
+import com.cyksj.mapper.manage.distribute.UserDistributeMapper;
+import com.cyksj.model.dto.AuthRedirect;
+import com.cyksj.model.dto.AuthToken;
+import com.cyksj.model.dto.GzhOAuth2UserInfo;
+import com.cyksj.model.entity.*;
+import com.cyksj.model.request.LoginReq;
+import com.cyksj.model.views.*;
+import com.cyksj.redis.RedisService;
+import com.cyksj.service.authorization.AuthorizationService;
+import com.cyksj.service.cps.CpsManageService;
+import com.cyksj.service.wechat.WeChatService;
+import com.cyksj.web.util.StpCpsManageUser;
+import com.cyksj.web.util.StpUserUtil;
+import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.SearchResult;
+import com.ejlchina.searcher.util.MapBuilder;
+import com.ejlchina.searcher.util.MapUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.Optional;
+
+/*
+ *项目名: netflix
+ *文件名: CpsBackLoginController
+ *创建者: JavaZou
+ *创建时间:2023/5/12 11:00
+ */
+@RestController
+@RequestMapping("/cps/manage")
+@RequiredArgsConstructor
+public class CpsBackLoginController {
+	private final CpsManageService cpsManageService;
+
+	private final BeanSearcher beanSearcher;
+
+	private final HttpServletRequest request;
+
+	private final GoodsDonMapper goodsDonMapper;
+
+	private final RedisService redisService;
+
+	private final static Sequence SEQUENCE = new Sequence(0);
+
+	private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
+
+	private final AuthorizationService authorizationService;
+
+	private final WeChatService weChatService;
+
+	private final UserMapper userMapper;
+
+	private final UserDistributeMapper userDistributeMapper;
+
+	/**
+	 * 获取登录验证码
+	 */
+	@GetMapping("/get/LoginCode")
+	@NoSubmit
+	public Result getLoginCode(@RequestParam(defaultValue = "1") Integer type, String login) {
+		cpsManageService.getLoginCode(type, login);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+
+	/**
+	 * 手机号、邮箱登录
+	 */
+	@PostMapping("/login")
+	public Result login(@RequestBody LoginReq loginReq) {
+		User user = cpsManageService.login(loginReq.getType(), loginReq.getLogin(), loginReq.getCode());
+		StpCpsManageUser.login(user.getId());
+		String cpsToken = StpCpsManageUser.getTokenValue();
+		JSONObject re = new JSONObject();
+		re.putOpt("satoken-cpsUser", cpsToken);
+		re.putOpt("img", user.getHeadimgurl());
+		re.putOpt("nickname", user.getNickname());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(re.toString());
+	}
+
+	/**
+	 * cps后台微信授权登录
+	 */
+	@GetMapping("/wx/authLogin")
+	public Result<String> wxAuthorize() throws Exception {
+		String wxAuthUrl = redisService.getStr(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat(wxOpenPlatYHLXLoginConfig.getAppId()));
+		Long mappingId = SEQUENCE.nextId();
+		redisService.set(mappingId.toString(), wxOpenPlatYHLXLoginConfig.getCpsLoginUrl(), 60 * 60 * 24L);
+		AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId);
+		String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
+		if (StrUtil.isEmpty(wxAuthUrl)) {
+			wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, true);
+		}
+		return GatewayResponse.SUCCESS.newBuilder().toResult(wxAuthUrl);
+	}
+
+	/**
+	 * 网页微信授权后跳转
+	 */
+	@GetMapping("/wx/authLogin/baseRedirect")
+	public void wxAuthLoginRedirect(String code, String state, HttpServletResponse response) throws Exception {
+
+		AuthToken token = weChatService.getAuthToken(code, wxOpenPlatYHLXLoginConfig.getAppId());
+		GzhOAuth2UserInfo userinfo = weChatService.getUserInfo(token.getAccessToken(), token.getOpenid());
+		String unionId = userinfo.getUnionid();
+		String openId = userinfo.getOpenid();
+		User user = Optional.ofNullable(
+				userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getUnionid, unionId)
+						.orderByAsc(User::getId)
+						.last("limit 1")))
+				.orElseGet(() -> userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getOpenId, openId)
+						.orderByAsc(User::getId)
+						.last("limit 1")));
+		if (user == null) throw BusinessRuntimeException.getInstance("用户信息不存在");
+		UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, user.getId()).select(UserDistribute::getId).last("limit 1"));
+		if (userDistribute == null) throw BusinessRuntimeException.getInstance("只支持渠道分销用户登录");
+
+		//写回登陆信息
+		StpCpsManageUser.login(user.getId());
+		response.addHeader("satoken-cpsUser", StpCpsManageUser.getTokenValue());
+
+		Cookie cookie = new Cookie("satoken-cpsUser", StpCpsManageUser.getTokenValue());
+		cookie.setMaxAge(31536000);
+		cookie.setPath("/");
+		response.addCookie(cookie);
+		JSONObject jsonObject = new JSONObject();
+		jsonObject.putOpt("img", user.getHeadimgurl());
+		jsonObject.putOpt("nickname", user.getNickname());
+
+		Cookie userInfo = new Cookie("info", Base64.encode(jsonObject.toString()));
+		cookie.setMaxAge(31536000);
+		cookie.setPath("/");
+		response.addCookie(userInfo);
+		// 转跳参数
+		String json = Codec.DoBase64.custom().setData(state).decodeAsText();
+		AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
+		String url = redisService.getStr(re.getMappingId().toString());
+		response.sendRedirect(url.contains("?") ? url + "&t=" + StpUserUtil.getTokenValue() : url + "?t=" + StpUserUtil.getTokenValue());
+	}
+
+	/**
+	 * 个人分销平台数据详情
+	 */
+	@GetMapping("/get/distribute/detail")
+	public Result<CpsUserDistributeDetailView> getDistributeDetail() {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		User user = beanSearcher.searchFirst(User.class, MapUtils.builder().field(User::getId, cpsUserId).onlySelect(User::getPoints).build());
+		BigDecimal thresholdPoints = BigDecimal.valueOf(1000);
+		BigDecimal wApplyMoney = user.getPoints().divide(thresholdPoints, 2, RoundingMode.DOWN);
+		//已提现
+		Number gotApplyMoney = beanSearcher.searchSum(DistributeMoneyApply.class, MapUtils.builder()
+				.field(DistributeMoneyApply::getUserId, cpsUserId)
+				.field(DistributeMoneyApply::getVerifyStatus, DistributeMoneyApply.Status.success.name())
+				.build(), "money");
+		Number reMoneyPoints = beanSearcher.searchSum(DistributeWaitingSendPoints.class, MapUtils.builder().field(DistributeWaitingSendPoints::getSharedId, cpsUserId).field(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.success.name()).build(), "points");
+		Number wMoneyPoints = beanSearcher.searchSum(DistributeWaitingSendPoints.class, MapUtils.builder().field(DistributeWaitingSendPoints::getSharedId, cpsUserId).field(DistributeWaitingSendPoints::getSendStatus, DistributeWaitingSendPoints.Status.waiting.name()).build(), "points");
+		List<UserDistributeRateView> rateViews = beanSearcher.searchAll(UserDistributeRateView.class, MapUtils.builder()
+				.put("distribute_id", String.format("and distribute_id = (select id from user_distribute where user_id = %s and deleted is true limit 1)", cpsUserId))
+				.orderBy(UserDistributeRateView::getRate).desc()
+				.build());
+		CpsUserDistributeDetailView detailView = new CpsUserDistributeDetailView();
+		detailView.setRateViews(rateViews);
+		detailView.setWMoney(BigDecimal.valueOf(wMoneyPoints.doubleValue()).divide(thresholdPoints, 2, RoundingMode.DOWN));
+		detailView.setReMoney(BigDecimal.valueOf(reMoneyPoints.doubleValue()).divide(thresholdPoints, 2, RoundingMode.DOWN));
+
+		detailView.setWApplyMoney(wApplyMoney);
+		detailView.setGotApplyMoney(BigDecimal.valueOf(gotApplyMoney.doubleValue()).divide(BigDecimal.valueOf(100)));
+		return GatewayResponse.SUCCESS.newBuilder().toResult(detailView);
+	}
+
+	/**
+	 * 待入账数据统计
+	 */
+	@GetMapping("/get/wMoney/statisticsData")
+	public Result<BrokenLineCpsUserWMoneyView> getWMoneyStatisticsDataView(Long firstDate, Long lastDate) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		DateTime first = null;
+		DateTime end = null;
+		if (firstDate != null) {
+			first = DateUtil.date(firstDate);
+		}
+		if (lastDate != null) {
+			end = DateUtil.date(lastDate);
+		}
+		BrokenLineCpsUserWMoneyView brokenLineCpsUserWMoneyView = Optional.ofNullable(cpsManageService.getWMoneyStatisticsDate(cpsUserId, first, end)).orElse(new BrokenLineCpsUserWMoneyView());
+		List<CpsUserWMoneyStatisticsDataView> dataView = cpsManageService.getWMoneyStatisticsDataView(cpsUserId, first, end);
+		brokenLineCpsUserWMoneyView.setDataView(dataView);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(brokenLineCpsUserWMoneyView);
+	}
+
+	/**
+	 * 分销订单收入统计
+	 */
+	@GetMapping("/get/distribute/orders/statistics")
+	public Result<SearchResult<UserDistributeOrdersStatisticsView>> getUserDistributeOrdersStatisticsView(Long firstDate, Long lastDate) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		String first = null;
+		String end = null;
+		String timeSql = StrUtil.EMPTY;
+		if (firstDate != null) {
+			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
+			timeSql += String.format(" and o.created_time >= '%s'", first);
+		}
+		if (lastDate != null) {
+			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
+			timeSql += String.format(" and o.created_time < '%s'", end);
+		}
+		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+		builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
+		if (StrUtil.isNotEmpty(timeSql)) {
+			builder.put("time", timeSql);
+		}
+		SearchResult<UserDistributeOrdersStatisticsView> search = beanSearcher.search(UserDistributeOrdersStatisticsView.class, builder.build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+	/**
+	 * 分销订单收入详细
+	 */
+	@GetMapping("/get/distribute/orders/detail")
+	public Result<SearchResult<UserDistributeOrdersDetailView>> getUserDistributeOrdersDetailView(Long firstDate, Long lastDate) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		String first = null;
+		String end = null;
+		String timeSql = StrUtil.EMPTY;
+		if (firstDate != null) {
+			first = DateUtil.format(DateTime.of(firstDate), "yyyy-MM-dd HH:mm:ss");
+			timeSql += String.format(" and o.created_time >= '%s'", first);
+		}
+		if (lastDate != null) {
+			end = DateUtil.format(DateTime.of(lastDate), "yyyy-MM-dd HH:mm:ss");
+			timeSql += String.format(" and o.created_time < '%s'", end);
+		}
+		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+		builder.put("sharedId", String.format("shared_id = %s", cpsUserId));
+		if (StrUtil.isNotEmpty(timeSql)) {
+			builder.put("time", timeSql);
+		}
+		SearchResult<UserDistributeOrdersDetailView> search = beanSearcher.search(UserDistributeOrdersDetailView.class, builder.build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+	/**
+	 * 分销商品列表
+	 */
+	@GetMapping("/get/goods")
+	public Result<List<GoodsDon>> getGoodsList() {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		List<GoodsDon> goodsDons = goodsDonMapper.getDistributeGoodsDetail(cpsUserId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(goodsDons);
+	}
+}

+ 106 - 0
netflix-web/src/main/java/com/cyksj/web/controller/cps/CpsPopularizeController.java

@@ -0,0 +1,106 @@
+package com.cyksj.web.controller.cps;
+
+import com.cyksj.common.EnvCommonService;
+import com.cyksj.common.annotation.NoSubmit;
+import com.cyksj.dto.Result;
+import com.cyksj.enums.GatewayResponse;
+import com.cyksj.model.entity.UserDistributePopularize;
+import com.cyksj.model.views.UserDistributePopularizeView;
+import com.cyksj.service.cps.CpsPopularizeService;
+import com.cyksj.web.util.StpCpsManageUser;
+import com.ejlchina.searcher.BeanSearcher;
+import com.ejlchina.searcher.SearchResult;
+import com.ejlchina.searcher.util.MapBuilder;
+import com.ejlchina.searcher.util.MapUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.math.BigDecimal;
+import java.util.Optional;
+
+/*
+ *项目名: netflix
+ *文件名: CpsPopularizeController
+ *创建者: JavaZou
+ *创建时间:2023/5/15 15:03
+ */
+@RestController
+@RequestMapping("/cps/manage/popularize")
+@RequiredArgsConstructor
+public class CpsPopularizeController {
+	private final CpsPopularizeService cpsPopularizeService;
+
+	private final BeanSearcher beanSearcher;
+
+	private final HttpServletRequest request;
+
+	private final EnvCommonService envCommonService;
+
+	/**
+	 * 渠道推广链接列表
+	 */
+	@GetMapping("/get")
+	public Result<SearchResult<UserDistributePopularizeView>> getList() {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
+		builder.put("userId", String.format("and user_id = %s", cpsUserId));
+		SearchResult<UserDistributePopularizeView> search = beanSearcher.search(UserDistributePopularizeView.class, builder.build());
+		String domain = envCommonService.getDomain();
+		search.getDataList().forEach(data -> {
+			data.setPopularizeLink(String.format(envCommonService.DISTRIBUTE_DESIGN_URL_PREFIX, data.getCode()));
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+	/**
+	 * 默认链接详情
+	 */
+	@GetMapping("/get/default")
+	public Result<UserDistributePopularizeView> getDefaultDetail() {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		UserDistributePopularizeView view = Optional.ofNullable(cpsPopularizeService.getDefaultPopularizeDetail(cpsUserId)).orElseGet(()->{
+			UserDistributePopularizeView newPopularizeView = new UserDistributePopularizeView();
+			newPopularizeView.setOrders(0);
+			newPopularizeView.setOrdersMoney(BigDecimal.ZERO);
+			return newPopularizeView;
+		});
+		view.setPopularizeLink(String.format(envCommonService.DISTRIBUTE_DEFAULT_URL_PREFIX, cpsUserId));
+		return GatewayResponse.SUCCESS.newBuilder().toResult(view);
+	}
+
+	/**
+	 * 新增推广链接
+	 */
+	@PostMapping("/post")
+	@NoSubmit
+	public Result<String> insert(@RequestBody UserDistributePopularize popularize) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		popularize.setUserId(cpsUserId);
+		cpsPopularizeService.insert(popularize);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(String.format("%s?dsCode=%s", envCommonService.getDomain2(), popularize.getCode()));
+	}
+
+	/**
+	 * 编辑推广链接
+	 */
+	@PutMapping("/put")
+	@NoSubmit
+	public Result<String> update(@RequestBody UserDistributePopularize popularize) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		popularize.setUserId(cpsUserId);
+		cpsPopularizeService.update(popularize);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+	/**
+	 * 删除推广链接
+	 */
+	@DeleteMapping("/delete/{id}")
+	@NoSubmit
+	public Result<String> deleteById(@PathVariable Long id) {
+		long cpsUserId = StpCpsManageUser.getLoginIdAsLong();
+		cpsPopularizeService.deleteById(cpsUserId, id);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+}

+ 2 - 2
netflix-web/src/main/java/com/cyksj/web/controller/distribute/EquipmentDistributeController.java

@@ -17,7 +17,7 @@ import com.cyksj.mapper.manage.distribute.equipment.EquipmentUserDistributeInvit
 import com.cyksj.model.dto.EquipmentConfigDto;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.request.LoginPhoneReq;
+import com.cyksj.model.request.LoginReq;
 import com.cyksj.model.request.ReceiveBenefitsReq;
 import com.cyksj.model.views.CouponUserView;
 import com.cyksj.model.views.EquipmentCouponView;
@@ -201,7 +201,7 @@ public class EquipmentDistributeController {
 	 * 已登录的用户 实物分销
 	 */
 	@PostMapping("/hasLogged")
-	public Result<String> hasLogged(@RequestBody LoginPhoneReq req) {
+	public Result<String> hasLogged(@RequestBody LoginReq req) {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		DateTime now = DateTime.now();
 		User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class).eq(User::getId, userId)

+ 6 - 12
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -26,6 +26,7 @@ import com.cyksj.model.views.*;
 import com.cyksj.service.distribute.DistributeService;
 import com.cyksj.service.mange.business.UserBusinessRateService;
 import com.cyksj.service.mange.statistics.StatisticsDataService;
+import com.cyksj.service.user.UserPointsService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
@@ -88,6 +89,8 @@ public class DistributeController {
 
 	private final BusinessDistributeDefaultRateConfigMapper businessDefaultRateConfigMapper;
 
+	private final UserPointsService userPointsService;
+
 	/**
 	 * 添加固定推广者
 	 */
@@ -315,18 +318,9 @@ public class DistributeController {
 		}
 		if (DistributeMoneyApply.Status.fail.name().equals(distributeApplyMoneyReq.getVerifyStatus())) {
 			distributeMoneyApply.setReason(distributeApplyMoneyReq.getReason());
-			while (true) {
-				User user = userMapper.selectById(distributeMoneyApply.getUserId());
-				if (user == null) {
-					break;
-				}
-				BigDecimal points = user.getPoints();
-				Integer update = userMapper.updatePoints(user.getId(), points, distributeMoneyApply.getPoints());
-				if (update == 1) {
-					log.info("归还积分:{}至用户{}结束", distributeMoneyApply.getPoints(), user.getId());
-					break;
-				}
-			}
+			Long userId = distributeMoneyApply.getUserId();
+			userPointsService.addDistributePoints(userId, distributeMoneyApply.getPoints());
+			log.info("归还积分:{}至用户{}结束", distributeMoneyApply.getPoints(), userId);
 		}
 		if (DistributeMoneyApply.Status.success.name().equals(distributeApplyMoneyReq.getVerifyStatus())) {
 			if (StrUtil.isBlank(distributeApplyMoneyReq.getImg())) {

+ 4 - 4
netflix-web/src/main/java/com/cyksj/web/controller/market/TaskFrontController.java

@@ -10,7 +10,7 @@ import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.market.task.UserBindDetailMapper;
 import com.cyksj.model.entity.TaskFollowPlatVerify;
 import com.cyksj.model.entity.UserBindDetail;
-import com.cyksj.model.request.LoginPhoneReq;
+import com.cyksj.model.request.LoginReq;
 import com.cyksj.model.request.TaskFollowReq;
 import com.cyksj.model.views.TaskFrontView;
 import com.cyksj.redis.RedisService;
@@ -80,7 +80,7 @@ public class TaskFrontController {
 	 */
 	@PostMapping("/bind/phone")
 	@NoSubmit
-	public Result<String> bindPhone(@RequestBody LoginPhoneReq phoneReq) {
+	public Result<String> bindPhone(@RequestBody LoginReq phoneReq) {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		bindTaskService.bindPhone(userId, phoneReq.getPhone(), phoneReq.getCode(), true);
 		return GatewayResponse.SUCCESS.newBuilder().toResult("绑定手机号成功");
@@ -90,7 +90,7 @@ public class TaskFrontController {
 	 * 绑定邮箱
 	 */
 	@PostMapping("/bind/email")
-	public Result<String> bindEmail(@RequestBody LoginPhoneReq phoneReq) {
+	public Result<String> bindEmail(@RequestBody LoginReq phoneReq) {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		if (!Validator.isEmail(phoneReq.getEmail())) {
 			throw BusinessRuntimeException.getInstance("请输入正确的邮箱");
@@ -132,7 +132,7 @@ public class TaskFrontController {
 	 * 修改手机号
 	 */
 	@PutMapping("/put/bind/phone")
-	public Result<String> updateBindPhone(@RequestBody LoginPhoneReq phoneReq) {
+	public Result<String> updateBindPhone(@RequestBody LoginReq phoneReq) {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		bindTaskService.updateBindPhone(userId, phoneReq.getPhone(), phoneReq.getCode());
 		return GatewayResponse.SUCCESS.newBuilder().toResult("更换手机号成功");

+ 54 - 34
netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java

@@ -22,19 +22,20 @@ import com.cyksj.config.wxlogin.WxOpenPlatYHLXLoginConfig;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.PhoneCodeMapper;
+import com.cyksj.mapper.manage.cps.UserDistributePopularizeMapper;
 import com.cyksj.model.dto.AuthRedirect;
 import com.cyksj.model.dto.AuthToken;
 import com.cyksj.model.dto.GzhOAuth2UserInfo;
 import com.cyksj.model.dto.JsSdkTicket;
 import com.cyksj.model.entity.PhoneCode;
 import com.cyksj.model.entity.User;
-import com.cyksj.model.request.LoginPhoneReq;
+import com.cyksj.model.entity.UserDistributePopularize;
+import com.cyksj.model.request.LoginReq;
 import com.cyksj.model.response.LoginPhoneRep;
 import com.cyksj.model.response.WxGzhQrCodeTicketRep;
 import com.cyksj.redis.RedisService;
 import com.cyksj.service.authorization.AuthorizationService;
 import com.cyksj.service.distribute.DistributeService;
-import com.cyksj.service.distribute.equipment.EquipmentDistributeService;
 import com.cyksj.service.mail.MailService;
 import com.cyksj.service.template.TemplateCommonService;
 import com.cyksj.service.user.UserService;
@@ -89,10 +90,10 @@ public class AuthorizationController {
 
     private final DistributeService distributeService;
 
-    private final EquipmentDistributeService equipDistributeService;
+    private final UserDistributePopularizeMapper distributePopularizeMapper;
 
     @GetMapping(value = "/weChat")
-    public void base(String url, Long sharedId, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
+    public void base(String url, String dsCode, Long sharedId, Integer dsType, Long popularizeId, String authType, HttpServletResponse response) throws Exception {
 
         log.info("微信授权转跳. url: {},authType:{}",url,authType);
 
@@ -102,7 +103,10 @@ public class AuthorizationController {
 
         Long mappingId = SEQUENCE.nextId();
         redisService.set(mappingId.toString(),url,60*60*24L);
-        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId);
+        if (StrUtil.isNotBlank(dsCode)) {
+            dsCode = dsCode.trim();
+        }
+        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId).setDsCode(dsCode);
         String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
 
         response.sendRedirect(authorizationService.createUrl(state,authType));
@@ -199,14 +203,17 @@ public class AuthorizationController {
      * 网页微信授权登录
      */
     @GetMapping("/wx/authLogin")
-    public Result<String> wxAuthorize(Long sharedId, Integer dsType, Long popularizeId) throws Exception {
+    public Result<String> wxAuthorize(Long sharedId, Integer dsType, Long popularizeId, String dsCode) throws Exception {
         String wxAuthUrl = redisService.getStr(RedisService.key.WX_LOGIN_AUTH_URI.getNameFormat(wxOpenPlatYHLXLoginConfig.getAppId()));
         Long mappingId = SEQUENCE.nextId();
         redisService.set(mappingId.toString(), wxOpenPlatYHLXLoginConfig.getLoginUrl(), 60 * 60 * 24L);
-        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId);
+        if (StrUtil.isNotBlank(dsCode)) {
+            dsCode = dsCode.trim();
+        }
+        AuthRedirect redirect = new AuthRedirect().setMappingId(mappingId).setSharedId(sharedId).setDsType(dsType).setPid(popularizeId).setDsCode(dsCode);
         String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
         if (StrUtil.isEmpty(wxAuthUrl)) {
-            wxAuthUrl = authorizationService.createWxAuthLoginUrl(state);
+            wxAuthUrl = authorizationService.createWxAuthLoginUrl(state, false);
         }
         return GatewayResponse.SUCCESS.newBuilder().toResult(wxAuthUrl);
     }
@@ -226,9 +233,9 @@ public class AuthorizationController {
      * 网页扫描微信公众号二维码 临时凭证ticket  关注后登录
      */
     @GetMapping("/wx/gzh/login/qrCode")
-    public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId) throws Exception {
+    public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String dsCode) throws Exception {
         //获取gzh带参数的二维码
-        WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, dsType, popularizeId, null);
+        WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(sharedId, dsType, popularizeId, null, dsCode);
         return GatewayResponse.SUCCESS.newBuilder().toResult(result);
     }
 
@@ -237,7 +244,7 @@ public class AuthorizationController {
      */
     @GetMapping("/wx/gzh/qrCode")
     public Result<WxGzhQrCodeTicketRep> getWxGzhBindQrcode(String loginPhone) throws Exception {
-        WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(null, null, null, loginPhone);
+        WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(null, null, null, loginPhone, null);
         return GatewayResponse.SUCCESS.newBuilder().toResult(result);
     }
 
@@ -343,14 +350,14 @@ public class AuthorizationController {
      */
     @PostMapping("/login/phone")
     @NoSubmit
-    public Result<LoginPhoneRep> loginByPhone(@RequestBody LoginPhoneReq loginPhoneReq) throws Exception {
+    public Result<LoginPhoneRep> loginByPhone(@RequestBody LoginReq LoginReq) throws Exception {
         LambdaQueryWrapper<User> wrapper = Wrappers.lambdaQuery(User.class).last("limit 1");
-        if (loginPhoneReq.getType() == 1) {
-            if (StrUtil.hasEmpty(loginPhoneReq.getPhone(), loginPhoneReq.getCode())) {
+        if (LoginReq.getType() == 1) {
+            if (StrUtil.hasEmpty(LoginReq.getPhone(), LoginReq.getCode())) {
                 throw BusinessRuntimeException.getInstance("请输入对应信息");
             }
             DateTime now = DateTime.now();
-            PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, loginPhoneReq.getPhone()).last("limit 1"));
+            PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, LoginReq.getPhone()).last("limit 1"));
             if (phoneCode == null || StrUtil.isEmpty(phoneCode.getCode())) {
                 throw BusinessRuntimeException.getInstance("请重新获取手机验证码");
             }
@@ -360,50 +367,63 @@ public class AuthorizationController {
             if (now.isAfter(afterFiveMinutes)) {
                 throw BusinessRuntimeException.getInstance("手机验证码已失效,请重新获取");
             }
-            if (!StrUtil.equals(loginPhoneReq.getCode(), phoneCode.getCode())) {
+            if (!StrUtil.equals(LoginReq.getCode(), phoneCode.getCode())) {
                 throw BusinessRuntimeException.getInstance("手机验证码错误,请重新输入");
             }
-            wrapper.eq(User::getLoginPhone, loginPhoneReq.getPhone());
-        }else if (loginPhoneReq.getType() == 2){
-            if (StrUtil.isEmpty(loginPhoneReq.getEmail())) {
+            wrapper.eq(User::getLoginPhone, LoginReq.getPhone());
+        }else if (LoginReq.getType() == 2){
+            if (StrUtil.isEmpty(LoginReq.getEmail())) {
                 throw BusinessRuntimeException.getInstance("邮箱不能为空");
             }
-            String code = redisService.getStr(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginPhoneReq.getEmail()));
+            String code = redisService.getStr(RedisService.key.EMAIL_CODE_KEY.getNameFormat(LoginReq.getEmail()));
             if (StrUtil.isEmpty(code)) {
                 throw BusinessRuntimeException.getInstance("邮箱验证码已失效,请重新获取");
             }
-            if (!StrUtil.equals(loginPhoneReq.getCode(), code)) {
+            if (!StrUtil.equals(LoginReq.getCode(), code)) {
                 throw BusinessRuntimeException.getInstance("邮箱验证码错误,请重新输入");
             }
-            wrapper.eq(User::getEmail, loginPhoneReq.getEmail());
-            redisService.del(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginPhoneReq.getEmail()));
+            wrapper.eq(User::getEmail, LoginReq.getEmail());
+            redisService.del(RedisService.key.EMAIL_CODE_KEY.getNameFormat(LoginReq.getEmail()));
         }else {
             throw BusinessRuntimeException.getInstance("系统异常,请刷新页面重新操作");
         }
         //保存用户信息
         User user = userService.getOne(wrapper);
-        Long sharedId = loginPhoneReq.getSharedId();
+        String dsCode = LoginReq.getDsCode();
+        Long sharedId = LoginReq.getSharedId();
+        Long dsPopularizeId = null;
+        if (StrUtil.isNotBlank(dsCode)) {
+            dsCode = dsCode.trim();
+            UserDistributePopularize distributePopularize = distributePopularizeMapper.selectOne(Wrappers.lambdaQuery(UserDistributePopularize.class)
+                    .eq(UserDistributePopularize::getCode, dsCode)
+                    .select(UserDistributePopularize::getUserId, UserDistributePopularize::getId).last("limit 1"));
+            if (distributePopularize != null) {
+                log.info("渠道sharedId:{}设置固定推广链接PC用户分销", distributePopularize.getUserId());
+                sharedId = distributePopularize.getUserId();
+                dsPopularizeId = distributePopularize.getId();
+            }
+        }
         if (user == null) {
             user = new User();
-            if (loginPhoneReq.getPopularizeId() != null) {
-                user.setPopularizeId(loginPhoneReq.getPopularizeId());
+            if (LoginReq.getPopularizeId() != null) {
+                user.setPopularizeId(LoginReq.getPopularizeId());
             }
-            if (loginPhoneReq.getType() == 1) {
-                user.setLoginPhone(loginPhoneReq.getPhone());
-            } else if (loginPhoneReq.getType() == 2) {
-                user.setEmail(loginPhoneReq.getEmail());
+            if (LoginReq.getType() == 1) {
+                user.setLoginPhone(LoginReq.getPhone());
+            } else if (LoginReq.getType() == 2) {
+                user.setEmail(LoginReq.getEmail());
             }
             String name = Constant.DEFAULT_NAME;
-            if (loginPhoneReq.getType() == 2) {
+            if (LoginReq.getType() == 2) {
                 name += "@";
             }
-            user.setNickname(String.format("%s%s", name, Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.MD5).setStringData(String.format("%s%s", user.getId(), loginPhoneReq.getType() == 1 ? user.getLoginPhone() : user.getEmail())).toHexString().substring(0, 6)));
+            user.setNickname(String.format("%s%s", name, Codec.DoDigest.custom().setAlgorithm(Codec.DoDigest.Algorithm.MD5).setStringData(String.format("%s%s", user.getId(), LoginReq.getType() == 1 ? user.getLoginPhone() : user.getEmail())).toHexString().substring(0, 6)));
             //默认头像
             user.setHeadimgurl(Constant.DEFAULT_HEAD_IMG);
             userService.save(user);
             //新用户分销
             if (sharedId != null) {
-                distributeService.saveDistributionInvitation(sharedId, user.getId());
+                distributeService.saveDistributionInvitation(sharedId, user.getId(), dsPopularizeId);
             }
         }
         //写回登陆信息
@@ -420,7 +440,7 @@ public class AuthorizationController {
         String json = Codec.DoBase64.custom().setData(state).decodeAsText();
         AuthRedirect re = Jsons.parseObject(json, AuthRedirect.class);
         //保存用户信息
-        User user = userService.saveAuth(userinfo, re.getSharedId(), re.getDsType(), re.getPid());
+        User user = userService.saveAuth(userinfo, re.getSharedId(), re.getDsType(), re.getPid(), re.getDsCode());
         if (user == null) {
             throw BusinessRuntimeException.getInstance("系统错误,请重新授权");
         }

+ 7 - 17
netflix-web/src/main/java/com/cyksj/web/controller/user/DistributePopularizeController.java

@@ -30,6 +30,7 @@ import com.cyksj.model.views.DistributePopularizeView;
 import com.cyksj.model.views.UserDistributeView;
 import com.cyksj.service.order.OrderDonService;
 import com.cyksj.model.views.*;
+import com.cyksj.service.user.UserPointsService;
 import com.cyksj.web.util.StpUserUtil;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
@@ -80,6 +81,8 @@ public class DistributePopularizeController {
 
 	private final OrderDonService orderService;
 
+	private final UserPointsService userPointsService;
+
 	/**
 	 * 推广订单明细
 	 */
@@ -124,10 +127,9 @@ public class DistributePopularizeController {
 	public Result<DistributePopularizeView> getDetail() {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		DistributePopularizeView distributePopularizeView = new DistributePopularizeView();
-		String domain = envCommonService.getHost();
-		String domainSub = domain.substring(0, domain.indexOf("8081"));
+		String dsUrl = String.format(envCommonService.DISTRIBUTE_DEFAULT_URL_PREFIX, userId);
 //		distributePopularizeView.setUrl(String.format("https://%s/8081/api/auth/weChat?url=https://%s/yinhe/web&sharedId=%s", domain, domain, userId));
-		distributePopularizeView.setUrl(String.format("%syinhe/web?sharedId=%s", domainSub, userId));
+		distributePopularizeView.setUrl(dsUrl);
 		distributePopularizeView.setUrlCode(QrCodeUtil.generateAsBase64(distributePopularizeView.getUrl(), QrConfig.create(), "png"));
 		User user = userMapper.selectById(userId);
 		distributePopularizeView.setGotPoints(user.getPoints());
@@ -268,13 +270,7 @@ public class DistributePopularizeController {
 				} else {
 					distributeMoneyApply.setVerifyStatus(DistributeMoneyApply.Status.fail);
 					distributeMoneyApply.setReason(alipayResponse.getSubMsg());
-					while (true) {
-						User db = userMapper.selectById(userId);
-						Integer success = userMapper.updatePoints(user.getId(), db.getPoints(), distributeMoneyApply.getPoints());
-						if (success == 1) {
-							break;
-						}
-					}
+					userPointsService.addDistributePoints(userId, distributeMoneyApply.getPoints());
 					if (StrUtil.equals(alipayResponse.getSubCode(), "SECURITY_CHECK_FAILED")) {
 						return GatewayResponse.FAIL.newBuilder().setMsg("当前支付宝提现人数较多,请稍后再试").toResult();
 					}
@@ -284,13 +280,7 @@ public class DistributePopularizeController {
 			try {
 				distributeMoneyApplyMapper.insert(distributeMoneyApply);
 			} catch (Exception e) {
-				while (true) {
-					User db = userMapper.selectById(userId);
-					Integer success = userMapper.updatePoints(user.getId(), db.getPoints(), distributeMoneyApply.getPoints());
-					if (success == 1) {
-						break;
-					}
-				}
+				userPointsService.addDistributePoints(userId, distributeMoneyApply.getPoints());
 				return GatewayResponse.FAIL.newBuilder().setMsg("网络错误,请重试").toResult();
 			}
 			return GatewayResponse.SUCCESS.newBuilder().toResult(distributeMoneyApply);

+ 326 - 0
netflix-web/src/main/java/com/cyksj/web/util/StpCpsManageUser.java

@@ -0,0 +1,326 @@
+package com.cyksj.web.util;
+
+import cn.dev33.satoken.fun.SaFunction;
+import cn.dev33.satoken.session.SaSession;
+import cn.dev33.satoken.stp.SaLoginModel;
+import cn.dev33.satoken.stp.SaTokenInfo;
+import cn.dev33.satoken.stp.StpLogic;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/*
+ *项目名: netflix
+ *文件名: StpCpsManageUser
+ *创建者: JavaZou
+ *创建时间:2023/5/12 12:21
+ */
+@Component
+public class StpCpsManageUser {
+	// 使用匿名子类 重写`stpLogic对象`的一些方法
+	public static StpLogic stpLogic = new StpLogic("cpsUser") {
+		// 重写 StpLogic 类下的 `splicingKeyTokenName` 函数,返回一个与 `StpUtil` 不同的token名称, 防止冲突
+		@Override
+		public String splicingKeyTokenName() {
+			return super.splicingKeyTokenName() + "-cpsUser";
+		}
+		// 同理你可以按需重写一些其它方法 ...
+	};
+
+	public StpCpsManageUser() {
+	}
+
+	public static String getLoginType() {
+		return stpLogic.getLoginType();
+	}
+
+	public static String getTokenName() {
+		return stpLogic.getTokenName();
+	}
+
+	public static void setTokenValue(String tokenValue, int cookieTimeout) {
+		stpLogic.setTokenValue(tokenValue, cookieTimeout);
+	}
+
+	public static String getTokenValue() {
+		return stpLogic.getTokenValue();
+	}
+
+	public static SaTokenInfo getTokenInfo() {
+		return stpLogic.getTokenInfo();
+	}
+
+	public static void login(Object id) {
+		stpLogic.login(id);
+	}
+
+	public static void login(Object id, String device) {
+		stpLogic.login(id, device);
+	}
+
+	public static void login(Object id, boolean isLastingCookie) {
+		stpLogic.login(id, isLastingCookie);
+	}
+
+	public static void login(Object id, SaLoginModel loginModel) {
+		stpLogic.login(id, loginModel);
+	}
+
+	public static void logout() {
+		stpLogic.logout();
+	}
+
+	public static void logoutByTokenValue(String tokenValue) {
+		stpLogic.logoutByTokenValue(tokenValue);
+	}
+
+	public static void logoutByLoginId(Object loginId) {
+		stpLogic.logoutByLoginId(loginId);
+	}
+
+	public static void logoutByLoginId(Object loginId, String device) {
+		stpLogic.logoutByLoginId(loginId, device);
+	}
+
+	public static boolean isLogin() {
+		return stpLogic.isLogin();
+	}
+
+	public static void checkLogin() {
+		stpLogic.checkLogin();
+	}
+
+	public static Object getLoginId() {
+		return stpLogic.getLoginId();
+	}
+
+	public static <T> T getLoginId(T defaultValue) {
+		return stpLogic.getLoginId(defaultValue);
+	}
+
+	public static Object getLoginIdDefaultNull() {
+		return stpLogic.getLoginIdDefaultNull();
+	}
+
+	public static String getLoginIdAsString() {
+		return stpLogic.getLoginIdAsString();
+	}
+
+	public static int getLoginIdAsInt() {
+		return stpLogic.getLoginIdAsInt();
+	}
+
+	public static long getLoginIdAsLong() {
+		return stpLogic.getLoginIdAsLong();
+	}
+
+	public static Object getLoginIdByToken(String tokenValue) {
+		return stpLogic.getLoginIdByToken(tokenValue);
+	}
+
+	public static SaSession getSessionByLoginId(Object loginId, boolean isCreate) {
+		return stpLogic.getSessionByLoginId(loginId, isCreate);
+	}
+
+	public static SaSession getSessionBySessionId(String sessionId) {
+		return stpLogic.getSessionBySessionId(sessionId);
+	}
+
+	public static SaSession getSessionByLoginId(Object loginId) {
+		return stpLogic.getSessionByLoginId(loginId);
+	}
+
+	public static SaSession getSession(boolean isCreate) {
+		return stpLogic.getSession(isCreate);
+	}
+
+	public static SaSession getSession() {
+		return stpLogic.getSession();
+	}
+
+	public static SaSession getTokenSessionByToken(String tokenValue) {
+		return stpLogic.getTokenSessionByToken(tokenValue);
+	}
+
+	public static SaSession getTokenSession() {
+		return stpLogic.getTokenSession();
+	}
+
+	public static void checkActivityTimeout() {
+		stpLogic.checkActivityTimeout();
+	}
+
+	public static void updateLastActivityToNow() {
+		stpLogic.updateLastActivityToNow();
+	}
+
+	public static long getTokenTimeout() {
+		return stpLogic.getTokenTimeout();
+	}
+
+	public static long getSessionTimeout() {
+		return stpLogic.getSessionTimeout();
+	}
+
+	public static long getTokenSessionTimeout() {
+		return stpLogic.getTokenSessionTimeout();
+	}
+
+	public static long getTokenActivityTimeout() {
+		return stpLogic.getTokenActivityTimeout();
+	}
+
+	public static boolean hasRole(Object loginId, String role) {
+		return stpLogic.hasRole(loginId, role);
+	}
+
+	public static boolean hasRole(String role) {
+		return stpLogic.hasRole(role);
+	}
+
+	public static void checkRole(String role) {
+		stpLogic.checkRole(role);
+	}
+
+	public static void checkRoleAnd(String... roleArray) {
+		stpLogic.checkRoleAnd(roleArray);
+	}
+
+	public static void checkRoleOr(String... roleArray) {
+		stpLogic.checkRoleOr(roleArray);
+	}
+
+	public static boolean hasPermission(Object loginId, String permission) {
+		return stpLogic.hasPermission(loginId, permission);
+	}
+
+	public static boolean hasPermission(String permission) {
+		return stpLogic.hasPermission(permission);
+	}
+
+	public static void checkPermission(String permission) {
+		stpLogic.checkPermission(permission);
+	}
+
+	public static void checkPermissionAnd(String... permissionArray) {
+		stpLogic.checkPermissionAnd(permissionArray);
+	}
+
+	public static void checkPermissionOr(String... permissionArray) {
+		stpLogic.checkPermissionOr(permissionArray);
+	}
+
+	public static String getTokenValueByLoginId(Object loginId) {
+		return stpLogic.getTokenValueByLoginId(loginId);
+	}
+
+	public static String getTokenValueByLoginId(Object loginId, String device) {
+		return stpLogic.getTokenValueByLoginId(loginId, device);
+	}
+
+	public static List<String> getTokenValueListByLoginId(Object loginId) {
+		return stpLogic.getTokenValueListByLoginId(loginId);
+	}
+
+	public static List<String> getTokenValueListByLoginId(Object loginId, String device) {
+		return stpLogic.getTokenValueListByLoginId(loginId, device);
+	}
+
+	public static String getLoginDevice() {
+		return stpLogic.getLoginDevice();
+	}
+
+	public static List<String> searchTokenValue(String keyword, int start, int size) {
+		return stpLogic.searchTokenValue(keyword, start, size);
+	}
+
+	public static List<String> searchSessionId(String keyword, int start, int size) {
+		return stpLogic.searchSessionId(keyword, start, size);
+	}
+
+	public static List<String> searchTokenSessionId(String keyword, int start, int size) {
+		return stpLogic.searchTokenSessionId(keyword, start, size);
+	}
+
+	public static void disable(Object loginId, long disableTime) {
+		stpLogic.disable(loginId, disableTime);
+	}
+
+	public static boolean isDisable(Object loginId) {
+		return stpLogic.isDisable(loginId);
+	}
+
+	public static long getDisableTime(Object loginId) {
+		return stpLogic.getDisableTime(loginId);
+	}
+
+	public static void untieDisable(Object loginId) {
+		stpLogic.untieDisable(loginId);
+	}
+
+	public static void switchTo(Object loginId) {
+		stpLogic.switchTo(loginId);
+	}
+
+	public static void endSwitch() {
+		stpLogic.endSwitch();
+	}
+
+	public static boolean isSwitch() {
+		return stpLogic.isSwitch();
+	}
+
+	public static void switchTo(Object loginId, SaFunction function) {
+		stpLogic.switchTo(loginId, function);
+	}
+
+	public static void openSafe(long safeTime) {
+		stpLogic.openSafe(safeTime);
+	}
+
+	public static boolean isSafe() {
+		return stpLogic.isSafe();
+	}
+
+	public static void checkSafe() {
+		stpLogic.checkSafe();
+	}
+
+	public static long getSafeTime() {
+		return stpLogic.getSafeTime();
+	}
+
+	public static void closeSafe() {
+		stpLogic.closeSafe();
+	}
+
+	/** @deprecated */
+	@Deprecated
+	public static String getLoginKey() {
+		return stpLogic.getLoginType();
+	}
+
+	/** @deprecated */
+	@Deprecated
+	public static void setLoginId(Object loginId) {
+		stpLogic.login(loginId);
+	}
+
+	/** @deprecated */
+	@Deprecated
+	public static void setLoginId(Object loginId, String device) {
+		stpLogic.login(loginId, device);
+	}
+
+	/** @deprecated */
+	@Deprecated
+	public static void setLoginId(Object loginId, boolean isLastingCookie) {
+		stpLogic.login(loginId, isLastingCookie);
+	}
+
+	/** @deprecated */
+	@Deprecated
+	public static void setLoginId(Object loginId, SaLoginModel loginModel) {
+		stpLogic.login(loginId, loginModel);
+	}
+}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
netflix-web/src/main/resources/application-dev.yml


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
netflix-web/src/main/resources/application-prd.yml


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä