|
@@ -220,6 +220,9 @@ public class StatisticsDataController {
|
|
|
statisticsUserDataView.setNumOfCorpAccountUser(accounts.intValue());
|
|
statisticsUserDataView.setNumOfCorpAccountUser(accounts.intValue());
|
|
|
|
|
|
|
|
statisticsUserDataView.setUserData(beanSearcher.search(StatisticsUserData.class, MapUtils.flatBuilder(request.getParameterMap()).build()));
|
|
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);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsUserDataView);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -505,4 +508,34 @@ public class StatisticsDataController {
|
|
|
|
|
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(newUserStatisticsView);
|
|
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();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|