Explorar el Código

fix 注册账号、网飞空车位数据与后台数据拆分

fix 注册账号、网飞空车位数据与后台数据拆分
zoujiajian hace 3 años
padre
commit
6a4e8dd6ce

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/StatisticsDataService.java

@@ -24,4 +24,6 @@ public interface StatisticsDataService {
 	Result<String> updateHandleStatus(Integer relationId);
 
 	List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime);
+
+	BackgroundDataView getTitleData();
 }

+ 39 - 30
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -18,7 +18,10 @@ import com.cyksj.mapper.manage.statistics.StreamingAccountDataMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.manage.views.GroupsRelationView;
-import com.cyksj.model.views.*;
+import com.cyksj.model.views.BackgroundDataView;
+import com.cyksj.model.views.DistributeOrdersView;
+import com.cyksj.model.views.ExpiredAccountDataView;
+import com.cyksj.model.views.GoodsDonSkuView;
 import com.cyksj.service.mange.CmsAccountService;
 import com.cyksj.service.mange.statistics.StatisticsDataService;
 import com.cyksj.service.order.OrderDonService;
@@ -170,6 +173,41 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		return expiredAccountDataViews;
 	}
 
+	@Override
+	public BackgroundDataView getTitleData() {
+		BackgroundDataView backgroundDataView = new BackgroundDataView();
+		Number waitingRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
+				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.hasPayment.name()).op(Operator.Equal)
+				.onlySelect(RegisterOrderDon ::getId).build());
+		backgroundDataView.setWaitingRegisterNum(waitingRegisterNum.intValue());
+		Number errorRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
+				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.error.name()).op(Operator.Equal)
+				.onlySelect(RegisterOrderDon ::getId)
+				.build());
+		backgroundDataView.setFailRegisterNum(errorRegisterNum.intValue());
+
+		//netflix
+		GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder()
+				.field(GoodsDonSkuView::getGoodsTitle, "Netflix")
+				.field(GoodsDonSkuView::getSpecVal, "月付").op(Operator.Contain).build());
+		Long skuId = goodsDonSkuView.getSkuId();
+
+		Integer numOfMonthNetflix = groupsMapper.selectCount(Wrappers.lambdaQuery(GroupsTrips.class)
+				.eq(GroupsTrips::getSkuId, skuId));
+		backgroundDataView.setNumOfMonthNetflix(numOfMonthNetflix);
+
+
+		Integer numOfMonthEmptyRelationNetflix = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
+				.field(GroupsRelationView::getSkuId, skuId)
+				.field(GroupsRelationView::getUserId, 0)
+				.build()).intValue();
+		backgroundDataView.setNumOfMonthEmptyRelationNetflix(numOfMonthEmptyRelationNetflix);
+
+		Integer numOfMonthEmptyTripsNetflix = groupsMapper.selectEmptyNetfilxTrips(skuId);
+		backgroundDataView.setNumOfMonthEmptyTripsNetflix(numOfMonthEmptyTripsNetflix);
+		return backgroundDataView;
+	}
+
 	@Override
 	public Result<String> updateRenewStatus(Integer relationId) {
 		GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);
@@ -279,37 +317,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		//已到期主账号
 		List<Account> expiredAccounts = Optional.ofNullable(accountService.list(Wrappers.lambdaQuery(Account.class).le(Account::getExpiryTime, now))).orElse(new ArrayList<>());
 		backgroundDataView.setTotalExpiredAccountNum(expiredAccounts.size());
-		Number waitingRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
-				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.hasPayment.name()).op(Operator.Equal)
-				.onlySelect(RegisterOrderDon ::getId).build());
-		backgroundDataView.setWaitingRegisterNum(waitingRegisterNum.intValue());
-		Number errorRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
-				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.error.name()).op(Operator.Equal)
-				.onlySelect(RegisterOrderDon ::getId)
-				.build());
-		backgroundDataView.setFailRegisterNum(errorRegisterNum.intValue());
 		//分销金额数据统计
 		distribute(backgroundDataView, startDate, endDate);
-
-		//netflix
-		GoodsDonSkuView goodsDonSkuView = beanSearcher.searchFirst(GoodsDonSkuView.class, MapUtils.builder()
-				.field(GoodsDonSkuView::getGoodsTitle, "Netflix")
-				.field(GoodsDonSkuView::getSpecVal, "月付").op(Operator.Contain).build());
-		Long skuId = goodsDonSkuView.getSkuId();
-
-		Integer numOfMonthNetflix = groupsMapper.selectCount(Wrappers.lambdaQuery(GroupsTrips.class)
-				.eq(GroupsTrips::getSkuId, skuId));
-		backgroundDataView.setNumOfMonthNetflix(numOfMonthNetflix);
-
-
-		Integer numOfMonthEmptyRelationNetflix = beanSearcher.searchCount(GroupsRelationView.class, MapUtils.builder()
-				.field(GroupsRelationView::getSkuId, skuId)
-				.field(GroupsRelationView::getUserId, 0)
-				.build()).intValue();
-		backgroundDataView.setNumOfMonthEmptyRelationNetflix(numOfMonthEmptyRelationNetflix);
-
-		Integer numOfMonthEmptyTripsNetflix = groupsMapper.selectEmptyNetfilxTrips(skuId);
-		backgroundDataView.setNumOfMonthEmptyTripsNetflix(numOfMonthEmptyTripsNetflix);
 	}
 
 	/**

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

@@ -369,4 +369,13 @@ public class StatisticsDataController {
 		SearchResult<SignStatisticsData> search = beanSearcher.search(SignStatisticsData.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 注册账号、网飞空车位数据
+	 */
+	@GetMapping("/get/title/data")
+	public Result<BackgroundDataView> getTitleData() {
+		BackgroundDataView views = statisticsDataService.getTitleData();
+		return GatewayResponse.SUCCESS.newBuilder().toResult(views);
+	}
 }