|
|
@@ -18,6 +18,7 @@ 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.manage.views.OrderDonView;
|
|
|
import com.cyksj.model.views.*;
|
|
|
import com.cyksj.service.mange.CmsAccountService;
|
|
|
import com.cyksj.service.mange.statistics.StatisticsDataService;
|
|
|
@@ -84,6 +85,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
case 1:
|
|
|
//流媒体账号
|
|
|
getStreamingAccountDataView(backgroundDataView, startDate, endDate);
|
|
|
+ //appleOne
|
|
|
+ getAppleOneDataView(backgroundDataView, startDate, endDate);
|
|
|
break;
|
|
|
case 2:
|
|
|
//实物数据
|
|
|
@@ -135,7 +138,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
* 注册账号数据
|
|
|
*/
|
|
|
private void getRegisterAccountData(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
|
|
|
- if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
|
|
|
+ if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
|
|
|
List<RegisterAccountData> registerAccountData = statistics.statisticsRegisterAccountData(startDate, endDate, true);
|
|
|
List<RegisterAccountData> collect = registerAccountData.stream().filter(data -> {
|
|
|
if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
|
|
|
@@ -146,14 +149,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
backgroundDataView.setRegisterAccountDataViews(collect);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<RegisterAccountData> registerAccountData = realGoodsDataMapper.statisticsRegisterAccountData(startDate, endDate);
|
|
|
backgroundDataView.setRegisterAccountDataViews(registerAccountData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, Long start, Long limit) {
|
|
|
+ public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, Long start, Long limit) {
|
|
|
String startDate = null;
|
|
|
String endDate = null;
|
|
|
if (startTime != null) {
|
|
|
@@ -162,12 +165,12 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (endTime != null) {
|
|
|
endDate = DateTime.of(endTime).toString();
|
|
|
}
|
|
|
- IPage<ExpiredAccountDataView> expiredAccountDataViews = accountService.getExpiredAccountView(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString(), start, limit);
|
|
|
+ IPage<ExpiredAccountDataView> expiredAccountDataViews = accountService.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString(), start, limit);
|
|
|
return expiredAccountDataViews;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public 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) {
|
|
|
+ public List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime) {
|
|
|
String startDate = null;
|
|
|
String endDate = null;
|
|
|
if (startTime != null) {
|
|
|
@@ -176,7 +179,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
if (endTime != null) {
|
|
|
endDate = DateTime.of(endTime).toString();
|
|
|
}
|
|
|
- List<ExcelAccountData> expiredAccountDataViews = accountService.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString());
|
|
|
+ List<ExcelAccountData> expiredAccountDataViews = accountService.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString());
|
|
|
return expiredAccountDataViews;
|
|
|
}
|
|
|
|
|
|
@@ -185,11 +188,11 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
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());
|
|
|
+ .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)
|
|
|
+ .onlySelect(RegisterOrderDon::getId)
|
|
|
.build());
|
|
|
backgroundDataView.setFailRegisterNum(errorRegisterNum.intValue());
|
|
|
|
|
|
@@ -212,11 +215,15 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
|
|
|
Integer numOfMonthEmptyTripsNetflix = groupsMapper.selectEmptyNetfilxTrips(skuId);
|
|
|
backgroundDataView.setNumOfMonthEmptyTripsNetflix(numOfMonthEmptyTripsNetflix);
|
|
|
+ Number number = beanSearcher.searchCount(OrderDonView.class, MapUtils.builder().field(OrderDonView::getType, Constant.realGoodsType).op(Operator.InList)
|
|
|
+ .field(OrderDonView::getStatus, OrderDon.Status.hasPayment.name())
|
|
|
+ .build());
|
|
|
+ backgroundDataView.setWaitingSendRealOrder(number.intValue());
|
|
|
return backgroundDataView;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result<String> updateRenewStatus(Integer relationId) {
|
|
|
+ public Result<String> updateRenewStatus(Long relationId) {
|
|
|
GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);
|
|
|
groupsRelation.setRenewStatus(!groupsRelation.getRenewStatus());
|
|
|
groupsRelationMapper.updateById(groupsRelation);
|
|
|
@@ -224,7 +231,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Result<String> updateHandleStatus(Integer relationId) {
|
|
|
+ public Result<String> updateHandleStatus(Long relationId) {
|
|
|
GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);
|
|
|
groupsRelation.setIsHandle(!groupsRelation.getIsHandle());
|
|
|
groupsRelationMapper.updateById(groupsRelation);
|
|
|
@@ -233,24 +240,25 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
|
|
|
private void getAppleOneDataView(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
|
|
|
List<AppleOneData> appleOneData = appleOneDataMapper.statisticsAppleOneData(startDate, endDate);
|
|
|
- if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
|
|
|
+ if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
|
|
|
List<AppleOneData> appleOneData1 = statistics.statisticsAppleOneData(startDate, endDate, true);
|
|
|
List<AppleOneData> collect = appleOneData1.stream().filter(data -> {
|
|
|
if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
|
|
|
data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
|
|
|
+ data.setRefundMoney(getAppleOneRefundMoneyByArea(data.getAreaName(), startDate, endDate));
|
|
|
data.setDistributeOrderMoney(data.getDistributeOrderMoney().divide(BigDecimal.valueOf(100)));
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
backgroundDataView.setAppleOneDataViews(collect);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
backgroundDataView.setAppleOneDataViews(appleOneData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void getStreamingAccountDataView(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
|
|
|
- if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
|
|
|
+ if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
|
|
|
List<StreamingAccountData> streamingAccountData = statistics.statisticsStreamingAccountData(startDate, endDate, true);
|
|
|
List<StreamingAccountData> collect = streamingAccountData.stream().filter(data -> {
|
|
|
if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
|
|
|
@@ -261,9 +269,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
backgroundDataView.setStreamAccountDataViews(collect);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<StreamingAccountData> streamingAccountData = streamingAccountDataMapper.statisticsStreamingData(startDate, endDate);
|
|
|
- Optional.ofNullable(streamingAccountData).ifPresent(list->list.forEach(data->{
|
|
|
+ Optional.ofNullable(streamingAccountData).ifPresent(list -> list.forEach(data -> {
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getId, data.getGoodsId()).last("limit 1"));
|
|
|
if (goodsDon != null) {
|
|
|
data.setAccountName(goodsDon.getTitle());
|
|
|
@@ -275,9 +283,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
}
|
|
|
|
|
|
private void getRealGoodsData(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
|
|
|
- if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
|
|
|
+ if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
|
|
|
List<RealGoodsData> realGoodsData = statistics.statisticsRealGoodsData(startDate, endDate, true);
|
|
|
- List<RealGoodsData> collect = realGoodsData.stream().filter(data ->{
|
|
|
+ List<RealGoodsData> collect = realGoodsData.stream().filter(data -> {
|
|
|
if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
|
|
|
data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
|
|
|
data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
|
|
|
@@ -286,7 +294,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
return false;
|
|
|
}).collect(Collectors.toList());
|
|
|
backgroundDataView.setRealGoodsDataViews(collect);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
List<RealGoodsData> realGoodsData = realGoodsDataMapper.statisticsRealGoodsData(startDate, endDate);
|
|
|
Optional.ofNullable(realGoodsData).ifPresent(list -> list.forEach(data -> {
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getId, data.getGoodsId()).last("limit 1"));
|
|
|
@@ -334,15 +342,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
setGoodsMoneyAndOrder(2, backgroundDataView);
|
|
|
//潮玩
|
|
|
setGoodsMoneyAndOrder(3, backgroundDataView);
|
|
|
-
|
|
|
- //分销金额数据统计
|
|
|
- distribute(backgroundDataView, startDate, endDate);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分销金额信息补充
|
|
|
+ *
|
|
|
* @param backgroundDataView
|
|
|
*/
|
|
|
+ @Override
|
|
|
public void distribute(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
|
|
|
List<DistributeOrdersView> distributeOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
|
|
|
.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
|
|
|
@@ -350,13 +357,13 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
backgroundDataView.setDistributeOrders(distributeOrders.size());
|
|
|
//固定推广者订单
|
|
|
List<DistributeOrdersView> distributePopularizeOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
|
|
|
- .field(DistributeOrdersView::getIsFixedDistribute,true).op(Operator.Equal)
|
|
|
+ .field(DistributeOrdersView::getIsFixedDistribute, true).op(Operator.Equal)
|
|
|
.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
|
|
|
.build())).orElse(new ArrayList<>());
|
|
|
backgroundDataView.setDistributePopularizeOrders(distributePopularizeOrders.size());
|
|
|
//普通分销单数
|
|
|
List<DistributeOrdersView> distributeOriginalOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
|
|
|
- .field(DistributeOrdersView::getIsFixedDistribute,false).op(Operator.Equal)
|
|
|
+ .field(DistributeOrdersView::getIsFixedDistribute, false).op(Operator.Equal)
|
|
|
.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
|
|
|
.build())).orElse(new ArrayList<>());
|
|
|
backgroundDataView.setDistributeOriginalOrders(distributeOriginalOrders.size());
|
|
|
@@ -422,4 +429,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
|
|
|
backgroundDataView.setFashionAccountOfOrder(orderMoney);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private BigDecimal getAppleOneRefundMoneyByArea(String areaName, Date startDate, Date endDate) {
|
|
|
+ Number refundMoneyNumber = beanSearcher.searchSum(OrderDonView.class, MapUtils.builder()
|
|
|
+ .field(OrderDonView::getSpecVal, areaName).op(Operator.Contain)
|
|
|
+ .field(OrderDon::getStatus, OrderDon.Status.refund.name())
|
|
|
+ .field(OrderDon::getCreatedTime, startDate, endDate).op(Operator.Between)
|
|
|
+ .build(), "refundMoney");
|
|
|
+ BigDecimal refundMoney = BigDecimal.valueOf(refundMoneyNumber.intValue()).divide(BigDecimal.valueOf(100));
|
|
|
+ return refundMoney;
|
|
|
+ }
|
|
|
}
|