Ver Fonte

用户注册数据;用户注册月度重复数据

zoujiajian há 1 ano atrás
pai
commit
1d17a0be0a

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

@@ -0,0 +1,13 @@
+package com.cyksj.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.cyksj.model.entity.UserRepeatMonthStatistics;
+
+/**
+ * 项目名: netflix-job
+ * 文件名: UserRepeatMonthStatisticsMapper
+ * 创建者: JavaZou
+ * 创建时间:2024/9/2 18:06
+ */
+public interface UserRepeatMonthStatisticsMapper extends BaseMapper<UserRepeatMonthStatistics> {
+}

+ 9 - 6
netflix-dao/src/main/java/com/cyksj/mapper/manage/statistics/StatisticsUserDataMapper.java

@@ -18,19 +18,16 @@ import java.util.List;
  *创建时间:2022/11/24 16:21
  */
 public interface StatisticsUserDataMapper extends BaseMapper<StatisticsUserData> {
-	@Select("select count(distinct unionid) from user where created_time between #{yesZeroDate} and #{thisZeroDate} and unionid != ''")
+	@Select("select count(distinct unionid) from user u where created_time between #{yesZeroDate} and #{thisZeroDate} and unionid != '' and not exists(select 1 from user_bind_detail ud where ud.user_id = u.id)")
 	Integer getNumOfNewUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 
-	@Select("select count(distinct unionid) from user where update_time between #{yesZeroDate} and #{thisZeroDate} and unionid != ''")
+	@Select("select count(distinct user_id) from user_access_record where type = 'h5' and update_time between #{yesZeroDate} and #{thisZeroDate}")
 	Integer getNumOfActiveUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 
 	@Select("select count(*) from user where (login_phone != '' or email != '')")
 	Integer getPcTotalOfUser();
 
-	@Select("select count(*) from user where created_time between #{yesZeroDate} and #{thisZeroDate} and (login_phone != '' or email != '')")
-	Integer getPcNumOfNewUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
-
-	@Select("select count(*) from user where update_time between #{yesZeroDate} and #{thisZeroDate} and (login_phone != '' or email != '')")
+	@Select("select count(distinct user_id) from user_access_record where type = 'pc' and update_time between #{yesZeroDate} and #{thisZeroDate}")
 	Integer getPcNumOfActiveUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 
 	@Select("select count(*) from user_distribute_shared where created_time between #{yesZeroDate} and #{thisZeroDate}")
@@ -43,4 +40,10 @@ public interface StatisticsUserDataMapper extends BaseMapper<StatisticsUserData>
 	ExcelRealGoodsData getExportGoodsDonDataBySkuId(@Param("skuId") Long skuId, @Param("start") String start, @Param("end") String end);
 
 	List<RegisterOrderDon> getPlatformHasPaymentOrders(@Param("platform") String platform, @Param("start") String start, @Param("end") String end);
+
+	@Select("select count(*) from user u where created_time between #{yesZeroDate} and #{thisZeroDate} and login_phone != '' and not exists(select 1 from user_bind_detail ud where ud.phone_user_id = u.id)")
+	Integer getPhoneNewUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
+
+	@Select("select count(*) from user u where created_time between #{yesZeroDate} and #{thisZeroDate} and email != '' and not exists(select 1 from user_bind_detail ud where ud.email_user_id = u.id)")
+	Integer getEmailUser(@Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate);
 }

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

@@ -25,7 +25,7 @@ public class StatisticsUserData extends BaseEntity{
 	private Integer numOfNewUser;
 
 	/**
-	 * 活跃用户
+	 * h5活跃用户
 	 */
 	private Integer numOfActiveUser;
 

+ 24 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/UserRepeatMonthStatistics.java

@@ -0,0 +1,24 @@
+package com.cyksj.model.entity;
+
+import com.cyksj.model.BaseEntity;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 项目名: yhlxj
+ * 文件名: userRepeatMonthStatistics
+ * 创建者: JavaZou
+ * 创建时间:2024/9/2 17:08
+ */
+@Getter
+@Setter
+public class UserRepeatMonthStatistics extends BaseEntity {
+	private String statisticsDate;
+
+	/**
+	 * h5重复用户数
+	 */
+	private Integer repeatUserNum;
+
+	private Integer repeatPcUserNum;
+}

+ 5 - 1
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataDayServiceImpl.java

@@ -121,7 +121,11 @@ public class StatisticsDataDayServiceImpl implements StatisticsDataDayService {
 		Number accounts = beanSearcher.searchCount(CorpUserTagView.class, builder.put("tagName", "ct.tag_name = '账号'").build());
 		statisticsUserData.setNumOfCorpAccountUser(accounts.intValue());
 
-		statisticsUserData.setPcNumOfNewUser(statisticsUserDataMapper.getPcNumOfNewUser(yesZeroDate, thisZeroDate));
+		//未参与绑定
+		Integer phoneUsers = statisticsUserDataMapper.getPhoneNewUser(yesZeroDate, thisZeroDate);
+		Integer emailUsers = statisticsUserDataMapper.getEmailUser(yesZeroDate, thisZeroDate);
+		statisticsUserData.setPcNumOfNewUser(phoneUsers + emailUsers);
+
 		statisticsUserData.setPcNumOfActiveUser(statisticsUserDataMapper.getPcNumOfActiveUser(yesZeroDate, thisZeroDate));
 		statisticsUserData.setPcNumOfUser(yesPcNumOfUser + statisticsUserData.getPcNumOfNewUser());
 

+ 16 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

@@ -88,6 +88,8 @@ public class StatisticsDataController {
 
 	private final ChatgptUserMapper chatgptUserMapper;
 
+	private final HttpServletRequest request;
+
 	/**
 	 * 查询头部统计数据
 	 */
@@ -255,7 +257,11 @@ public class StatisticsDataController {
 		statisticsUserDataView.setNumOfUser(total - pcUserNum);
 		statisticsUserDataView.setPcNumOfUser(pcUserNum);
 		statisticsUserDataView.setNumOfNewUser(statisticsUserDataMapper.getNumOfNewUser(thisZero, thisEnd));
-		statisticsUserDataView.setPcNumOfNewUser(statisticsUserDataMapper.getPcNumOfNewUser(thisZero, thisEnd));
+
+		Integer phoneUsers = statisticsUserDataMapper.getPhoneNewUser(thisZero, thisEnd);
+		Integer emailUsers = statisticsUserDataMapper.getEmailUser(thisZero, thisEnd);
+		statisticsUserDataView.setPcNumOfNewUser(phoneUsers + emailUsers);
+
 		statisticsUserDataView.setNumOfActiveUser(statisticsUserDataMapper.getNumOfActiveUser(thisZero, thisEnd));
 		statisticsUserDataView.setPcNumOfActiveUser(statisticsUserDataMapper.getPcNumOfActiveUser(thisZero, thisEnd));
 
@@ -631,4 +637,13 @@ public class StatisticsDataController {
 		SearchResult<OrderCustomerServiceDataView> search = beanSearcher.search(OrderCustomerServiceDataView.class, MapUtils.builder().build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 当月重复注册用户数据
+	 */
+	@GetMapping("/get/repeat/user/data")
+	public Result<SearchResult<UserRepeatMonthStatistics>> getRepeatUserData() {
+		SearchResult<UserRepeatMonthStatistics> search = beanSearcher.search(UserRepeatMonthStatistics.class, MapUtils.flatBuilder(request.getParameterMap()).orderBy(UserRepeatMonthStatistics::getId).desc().build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
 }

+ 5 - 0
netflix-web/src/main/java/com/cyksj/web/controller/user/UserController.java

@@ -285,6 +285,11 @@ public class UserController {
             }
             user.setNickname(request.getNickname());
             isFlag = true;
+            //名称是否重复
+            int count = userService.count(Wrappers.lambdaQuery(User.class)
+                    .eq(User::getNickname, user.getNickname())
+                    .ne(User::getId, user.getId()));
+            if (count > 0) throw BusinessRuntimeException.getInstance("用户昵称已存在");
         }
         if (request.getSex() != null) {
             user.setSex(request.getSex());