Эх сурвалжийг харах

付款说明;小红书人数;双重认证说明

zoujiajian 3 жил өмнө
parent
commit
c266c0e239

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

@@ -2,6 +2,10 @@ package com.cyksj.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.DoubleVerifyClickRecord;
+import com.cyksj.model.views.DoubleVerifyCodeView;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /*
  *项目名: netflix
@@ -10,4 +14,5 @@ import com.cyksj.model.entity.DoubleVerifyClickRecord;
  *创建时间:2023/5/19 18:42
  */
 public interface DoubleVerifyClickRecordMapper extends BaseMapper<DoubleVerifyClickRecord> {
+	List<DoubleVerifyCodeView> getDoubleVerifyCodeList(@Param("userId") long userId, @Param("relationId") Long relationId);
 }

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

@@ -120,6 +120,11 @@ public class GoodsDon extends BaseEntity {
      */
     private Integer maxMonths;
 
+    /**
+     * 付款说明
+     */
+    private String payDesc;
+
     @TableField(exist = false)
     @DbIgnore
     private BigDecimal price;

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

@@ -64,5 +64,10 @@ public class StatisticsUserData extends BaseEntity{
 	 */
 	private Integer numOfCorpAccountUser;
 
+	/**
+	 * 小红书人数
+	 */
+	private Integer numOfRedBookUser;
+
 	private Date statisticsDate;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/request/ReqGoodsSpuInsert.java

@@ -97,4 +97,9 @@ public class ReqGoodsSpuInsert {
     private Integer sortBy;
 
     private Integer virtualSold;
+
+    /**
+     * 付款说明
+     */
+    private String payDesc;
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/GoodsDonViewer.java

@@ -140,6 +140,9 @@ public class GoodsDonViewer {
     @DbField("g.virtual_sold")
     private Integer virtualSold;
 
+    @DbField("g.pay_desc")
+    private String payDesc;
+
     @DbIgnore
     private List<GoodsDonSku> skus;
 

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonView.java

@@ -76,6 +76,9 @@ public class OrderDonView {
     @DbField("g.id")
     private Long goodsId;
 
+    @DbField("g.pay_desc")
+    private String payDesc;
+
     @DbField("sku.is_benefits")
     private Boolean isBenefits;
 

+ 18 - 0
netflix-dao/src/main/java/com/cyksj/model/request/RedBookReq.java

@@ -0,0 +1,18 @@
+package com.cyksj.model.request;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/*
+ *项目名: netflix
+ *文件名: RedBookReq
+ *创建者: JavaZou
+ *创建时间:2023/5/31 10:38
+ */
+@Getter
+@Setter
+public class RedBookReq {
+	private String date;
+
+	private Integer num;
+}

+ 32 - 0
netflix-dao/src/main/java/com/cyksj/model/views/DoubleVerifyCodeView.java

@@ -0,0 +1,32 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: DoubleVerifyCodeView
+ *创建者: JavaZou
+ *创建时间:2023/5/30 13:58
+ */
+@Getter
+@Setter
+public class DoubleVerifyCodeView {
+	@DbField("dr.user_id")
+	private Long userId;
+
+	@DbField("dr.account_id")
+	private Long accountId;
+
+	@DbField("dr.account")
+	private String account;
+
+	@DbField("case when dcr.id is null then 1 else 2 end")
+	private Integer type;
+
+	@DbField("case when dcr.id is null then dr.created_time else dcr.created_time end")
+	private Date createdTime;
+}

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/views/StatisticsUserDataView.java

@@ -65,5 +65,10 @@ public class StatisticsUserDataView {
 	 */
 	private Integer numOfCorpAccountUser;
 
+	/**
+	 * 小红书人数
+	 */
+	private Integer numOfRedBookUser;
+
 	SearchResult<StatisticsUserData> userData;
 }

+ 20 - 0
netflix-dao/src/main/resources/mapper/DoubleVerifyClickRecordMapper.xml

@@ -0,0 +1,20 @@
+<?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.DoubleVerifyClickRecordMapper">
+
+
+    <select id="getDoubleVerifyCodeList" resultType="com.cyksj.model.views.DoubleVerifyCodeView">
+        select *
+        from (select user_id, account_id, relation_id, 1 as `type`, created_time
+              from double_verify_click_record
+              where user_id = #{userId}
+                and relation_id = #{relationId}
+              union all
+              select dr.user_id, dr.account_id, dr.relation_id, 2 as `type`, dcr.created_time
+              from double_verify_click_record dr
+                       inner join double_verify_click_refresh_record dcr
+                                  on dcr.click_id = dr.id and dr.user_id = #{userId} and dr.relation_id = #{relationId})s
+        order by created_time desc
+    </select>
+</mapper>

+ 2 - 1
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -76,7 +76,8 @@
                gdk.spec_val,
                gd.title,
                gd.logo,
-               gd.type as goodsDonType
+               gd.type as goodsDonType,
+               gd.pay_desc
         from `order_don` od
                  left join `goods_don_sku` gdk on gdk.id = od.sku_id
                  left join `goods_don` gd on gd.id = od.goods_id

+ 8 - 2
netflix-service/src/main/java/com/cyksj/task/StatisticsDataScheduler.java

@@ -122,10 +122,12 @@ public class StatisticsDataScheduler {
 	 * 用户数据统计
 	 */
 	private void statisticsUserData(Date yesZeroDate, Date thisZeroDate) {
-		StatisticsUserData yesData = statisticsUserDataMapper.selectOne(Wrappers.lambdaQuery(StatisticsUserData.class).orderByDesc(StatisticsUserData::getId).select(StatisticsUserData::getNumOfUser, StatisticsUserData::getPcNumOfUser).last("limit 1"));
+		StatisticsUserData yesData = statisticsUserDataMapper.selectOne(Wrappers.lambdaQuery(StatisticsUserData.class).orderByDesc(StatisticsUserData::getId)
+				.lt(StatisticsUserData::getStatisticsDate, yesZeroDate)
+				.select(StatisticsUserData::getNumOfUser, StatisticsUserData::getPcNumOfUser).last("limit 1"));
 		Integer yesNumOfUser = yesData == null ? 0 : yesData.getNumOfUser();
 		Integer yesPcNumOfUser = yesData == null ? 0 : yesData.getPcNumOfUser();
-		StatisticsUserData statisticsUserData = new StatisticsUserData();
+		StatisticsUserData statisticsUserData = Optional.ofNullable(statisticsUserDataMapper.selectOne(Wrappers.lambdaQuery(StatisticsUserData.class).eq(StatisticsUserData::getStatisticsDate, yesZeroDate).last("limit 1"))).orElse(new StatisticsUserData());
 		statisticsUserData.setNumOfNewUser(statisticsUserDataMapper.getNumOfNewUser(yesZeroDate, thisZeroDate));
 		statisticsUserData.setNumOfActiveUser(statisticsUserDataMapper.getNumOfActiveUser(yesZeroDate, thisZeroDate));
 		statisticsUserData.setNumOfUser(yesNumOfUser + statisticsUserData.getNumOfNewUser());
@@ -149,6 +151,10 @@ public class StatisticsDataScheduler {
 		statisticsUserData.setPcNumOfUser(yesPcNumOfUser + statisticsUserData.getPcNumOfNewUser());
 
 		statisticsUserData.setStatisticsDate(yesZeroDate);
+		if (statisticsUserData.getId() != null) {
+			statisticsUserDataMapper.updateById(statisticsUserData);
+			return;
+		}
 		statisticsUserDataMapper.insert(statisticsUserData);
 	}
 

+ 10 - 0
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -20,6 +20,7 @@ import com.cyksj.model.dto.DoubleVerifyDto;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.manage.views.GroupsRelationView;
 import com.cyksj.model.request.OrderPayRequest;
+import com.cyksj.model.views.DoubleVerifyCodeView;
 import com.cyksj.model.views.RenewalView;
 import com.cyksj.model.views.UserTicketView;
 import com.cyksj.redis.RedisService;
@@ -293,4 +294,13 @@ public class GroupRelationController {
         return GatewayResponse.SUCCESS.newBuilder().toResult(sb.toString());
     }
 
+    /**
+     * 获取双重验证码记录
+     */
+    @GetMapping("/get/doubleVerify/codeList")
+    public Result<List<DoubleVerifyCodeView>> getDoubleVerifyCodeList(Long relationId) {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        List<DoubleVerifyCodeView> views = doubleVerifyRecordMapper.getDoubleVerifyCodeList(userId, relationId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(views);
+    }
 }

+ 33 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

@@ -220,6 +220,9 @@ public class StatisticsDataController {
 		statisticsUserDataView.setNumOfCorpAccountUser(accounts.intValue());
 
 		statisticsUserDataView.setUserData(beanSearcher.search(StatisticsUserData.class, MapUtils.flatBuilder(request.getParameterMap()).build()));
+		StatisticsUserData statisticsUserData = beanSearcher.searchFirst(StatisticsUserData.class, MapUtils.builder().field(StatisticsUserData::getStatisticsDate, thisZero.toDateStr()).onlySelect(StatisticsUserData::getNumOfRedBookUser).build());
+		Integer numOfRedBookUser = statisticsUserData != null ? statisticsUserData.getNumOfRedBookUser() : 0;
+		statisticsUserDataView.setNumOfRedBookUser(numOfRedBookUser);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsUserDataView);
 	}
 
@@ -505,4 +508,34 @@ public class StatisticsDataController {
 
 		return GatewayResponse.SUCCESS.newBuilder().toResult(newUserStatisticsView);
 	}
+
+	/**
+	 * 更新小红书人数
+	 */
+	@PutMapping("/update/redBookUsers")
+	public Result<String> updateRedBookUsers(@RequestBody List<RedBookReq> redBooks) {
+		DateTime beginOfDay = DateUtil.beginOfDay(DateTime.now());
+		redBooks.forEach(redBook -> {
+			try {
+				DateTime dateTime = DateUtil.parseDate(redBook.getDate());
+				if (dateTime.isAfter(beginOfDay)) {
+					return;
+				}
+				Optional.ofNullable(statisticsUserDataMapper.selectOne(Wrappers.lambdaQuery(StatisticsUserData.class).eq(StatisticsUserData::getStatisticsDate, dateTime).last("limit 1")))
+						.ifPresentOrElse(statistics ->
+										statisticsUserDataMapper.update(null, Wrappers.lambdaUpdate(StatisticsUserData.class)
+												.set(StatisticsUserData::getNumOfRedBookUser, redBook.getNum())
+												.eq(StatisticsUserData::getId, statistics.getId())),
+								() -> {
+									StatisticsUserData statisticsUserData = new StatisticsUserData();
+									statisticsUserData.setNumOfRedBookUser(redBook.getNum());
+									statisticsUserData.setStatisticsDate(dateTime);
+									statisticsUserDataMapper.insert(statisticsUserData);
+								});
+			} catch (Exception e) {
+
+			}
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
 }