|
|
@@ -2,27 +2,27 @@ package com.cyksj.web.controller.manage.statistics;
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
-import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
-import com.cyksj.mapper.UserMapper;
|
|
|
-import com.cyksj.mapper.manage.statistics.StatisticsUserDataMapper;
|
|
|
-import com.cyksj.model.entity.StatisticsUserData;
|
|
|
import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
+import com.cyksj.mapper.UserMapper;
|
|
|
+import com.cyksj.mapper.manage.CustomerServiceEveryMonthDetailMapper;
|
|
|
+import com.cyksj.mapper.manage.RealGoodsOrderHandleMapper;
|
|
|
import com.cyksj.mapper.manage.statistics.IncrExpiryTimeRecordMapper;
|
|
|
+import com.cyksj.mapper.manage.statistics.StatisticsUserDataMapper;
|
|
|
import com.cyksj.model.entity.GroupsRelation;
|
|
|
import com.cyksj.model.entity.IncrExpiryTimeRecord;
|
|
|
+import com.cyksj.model.entity.StatisticsCustomerServiceEveryMonth;
|
|
|
+import com.cyksj.model.entity.StatisticsUserData;
|
|
|
import com.cyksj.model.request.RenewTimeUpReq;
|
|
|
-import com.cyksj.model.views.BackgroundDataView;
|
|
|
-import com.cyksj.model.views.ExpiredAccountDataView;
|
|
|
-import com.cyksj.model.views.StatisticsUserDataView;
|
|
|
+import com.cyksj.model.views.*;
|
|
|
import com.cyksj.service.mange.statistics.StatisticsDataService;
|
|
|
+import com.cyksj.task.OrderCustomerHandleScheduler;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
-import com.ejlchina.searcher.util.MapUtils;
|
|
|
-import com.ejlchina.searcher.BeanSearcher;
|
|
|
+import com.ejlchina.searcher.param.Operator;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
@@ -30,6 +30,10 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/*
|
|
|
*项目名: netflix
|
|
|
@@ -55,6 +59,10 @@ public class StatisticsDataController {
|
|
|
|
|
|
private final StatisticsUserDataMapper statisticsUserDataMapper;
|
|
|
|
|
|
+ private final CustomerServiceEveryMonthDetailMapper detailMapper;
|
|
|
+
|
|
|
+ private final RealGoodsOrderHandleMapper realGoodsOrderHandleMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询统计数据
|
|
|
*/
|
|
|
@@ -141,16 +149,46 @@ public class StatisticsDataController {
|
|
|
DateTime now = DateTime.now();
|
|
|
DateTime thisZero = DateUtil.beginOfDay(now);
|
|
|
DateTime thisEnd = DateUtil.endOfDay(now);
|
|
|
- Integer wxUserNum = statisticsUserDataMapper.getWxTotalOfUser();
|
|
|
+ Integer total = userMapper.selectCount(null);
|
|
|
Integer pcUserNum = statisticsUserDataMapper.getPcTotalOfUser();
|
|
|
- statisticsUserDataView.setTotalOfUser(wxUserNum + pcUserNum);
|
|
|
- statisticsUserDataView.setNumOfUser(wxUserNum);
|
|
|
+ statisticsUserDataView.setNumOfUser(total - pcUserNum);
|
|
|
statisticsUserDataView.setPcNumOfUser(pcUserNum);
|
|
|
statisticsUserDataView.setNumOfNewUser(statisticsUserDataMapper.getNumOfNewUser(thisZero, thisEnd));
|
|
|
statisticsUserDataView.setPcNumOfNewUser(statisticsUserDataMapper.getPcNumOfNewUser(thisZero, thisEnd));
|
|
|
statisticsUserDataView.setNumOfActiveUser(statisticsUserDataMapper.getNumOfActiveUser(thisZero, thisEnd));
|
|
|
statisticsUserDataView.setPcNumOfActiveUser(statisticsUserDataMapper.getPcNumOfActiveUser(thisZero, thisEnd));
|
|
|
+
|
|
|
+ statisticsUserDataView.setNumOfDistributeUser(statisticsUserDataMapper.getNumOfDistributeUserToday(thisZero, thisEnd));
|
|
|
+ List<CorpUserTagView> corpUserLists = Optional.ofNullable(beanSearcher.searchAll(CorpUserTagView.class, MapUtils.builder().field(CorpUserTagView::getCreatedTime, thisZero, thisEnd).op(Operator.Between).build())).orElse(new ArrayList<>());
|
|
|
+ statisticsUserDataView.setNumOfCorpUser(corpUserLists.size());
|
|
|
+ statisticsUserDataView.setNumOfCorpEquipmentUser(corpUserLists.stream().filter(data -> "设备".equals(data.getTagName())).collect(Collectors.toList()).size());
|
|
|
+ statisticsUserDataView.setNumOfCorpAccountUser(corpUserLists.stream().filter(data -> "账号".equals(data.getTagName())).collect(Collectors.toList()).size());
|
|
|
+
|
|
|
statisticsUserDataView.setUserData(beanSearcher.search(StatisticsUserData.class, MapUtils.flatBuilder(request.getParameterMap()).build()));
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsUserDataView);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 客服分销数据统计
|
|
|
+ */
|
|
|
+ @GetMapping("/get/customer/service/data")
|
|
|
+ public Result<StatisticsCustomerDataView> getCustomerData(Integer type, HttpServletRequest request) throws Exception {
|
|
|
+ DateTime now = DateTime.now();
|
|
|
+ DateTime begin = DateUtil.beginOfMonth(now);
|
|
|
+ String statisticsDate = DateUtil.format(now, "yyyy-MM");
|
|
|
+ List<CustomerServiceHandleOrderToMonthView> toMonthDetail = realGoodsOrderHandleMapper.selectCustomerToMonthData(now, begin, OrderCustomerHandleScheduler.noOrderStatus, type);
|
|
|
+ StatisticsCustomerDataView customerDataView = new StatisticsCustomerDataView();
|
|
|
+ if (!toMonthDetail.isEmpty()) {
|
|
|
+ StatisticsCustomerServiceEveryMonthView toMonth = new StatisticsCustomerServiceEveryMonthView();
|
|
|
+ toMonth.setStatisticsData(statisticsDate);
|
|
|
+ toMonth.setDetails(toMonthDetail);
|
|
|
+ customerDataView.setToMonth(toMonth);
|
|
|
+ }
|
|
|
+ SearchResult<StatisticsCustomerServiceEveryMonth> search = beanSearcher.search(StatisticsCustomerServiceEveryMonth.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
+ search.getDataList().forEach(data -> {
|
|
|
+ data.setDetails(detailMapper.getDetailData(type, data.getId()));
|
|
|
+ });
|
|
|
+ customerDataView.setMonthData(search);
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult(customerDataView);
|
|
|
+ }
|
|
|
}
|