|
@@ -8,7 +8,14 @@ import com.pig4cloud.pig.statistics.api.dto.uninstall.*;
|
|
|
import com.pig4cloud.pig.statistics.api.entity.ConfigItem;
|
|
|
import com.pig4cloud.pig.statistics.api.entity.uninstall.*;
|
|
|
import com.pig4cloud.pig.statistics.api.vo.uninstall.*;
|
|
|
-import com.pig4cloud.pig.statistics.mapper.*;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatTrendSummaryMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatDeviceTimeMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatDeviceCountMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatDeviceInterfereMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatDeviceActionMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatPortraitMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatPredictMapper;
|
|
|
+import com.pig4cloud.pig.statistics.mapper.StatInstallRatioMapper;
|
|
|
import com.pig4cloud.pig.statistics.service.UninstallAnalyseService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -34,21 +41,21 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
private static final Random random = new Random();
|
|
|
|
|
|
@Autowired
|
|
|
- private MktTrendSummaryMapper mktTrendSummaryMapper;
|
|
|
+ private StatTrendSummaryMapper statTrendSummaryMapper;
|
|
|
@Autowired
|
|
|
- private MktDeviceTimeMapper mktDeviceTimeMapper;
|
|
|
+ private StatDeviceTimeMapper statDeviceTimeMapper;
|
|
|
@Autowired
|
|
|
- private MktDeviceCountMapper mktDeviceCountMapper;
|
|
|
+ private StatDeviceCountMapper statDeviceCountMapper;
|
|
|
@Autowired
|
|
|
- private MktDeviceInterfereMapper mktDeviceInterfereMapper;
|
|
|
+ private StatDeviceInterfereMapper statDeviceInterfereMapper;
|
|
|
@Autowired
|
|
|
- private MktDeviceActionMapper mktDeviceActionMapper;
|
|
|
+ private StatDeviceActionMapper statDeviceActionMapper;
|
|
|
@Autowired
|
|
|
- private MktPortraitMapper mktPortraitMapper;
|
|
|
+ private StatPortraitMapper statPortraitMapper;
|
|
|
@Autowired
|
|
|
- private MktInstallUninstallRatioMapper mktInstallUninstallRatioMapper;
|
|
|
+ private StatInstallRatioMapper statInstallRatioMapper;
|
|
|
@Autowired
|
|
|
- private MktPredictMapper mktPredictMapper;
|
|
|
+ private StatPredictMapper statPredictMapper;
|
|
|
|
|
|
@Override
|
|
|
public UninstallTrendVO getUninstallTrend(GetUninstallTrendDTO dto) {
|
|
@@ -96,7 +103,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
wrapper.eq("app_version", dto.getVersion());
|
|
|
}
|
|
|
wrapper.eq("stat_cycle", timeUnit);
|
|
|
- List<MktTrendSummary> list = mktTrendSummaryMapper.selectList(wrapper);
|
|
|
+ List<MktTrendSummary> list = statTrendSummaryMapper.selectList(wrapper);
|
|
|
|
|
|
UninstallTrendVO vo = new UninstallTrendVO();
|
|
|
|
|
@@ -152,7 +159,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
wrapper.between("stat_date", dto.getStartDate(), dto.getEndDate());
|
|
|
}
|
|
|
|
|
|
- List<MktTrendSummary> list = mktTrendSummaryMapper.selectList(wrapper);
|
|
|
+ List<MktTrendSummary> list = statTrendSummaryMapper.selectList(wrapper);
|
|
|
log.info("查询结果数量: {}", list.size());
|
|
|
|
|
|
// 使用Stream API优化分组和统计逻辑
|
|
@@ -231,7 +238,10 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
|
|
|
Map<String, LocalDate> timeRangeMap = getTimeRangeMap(StringUtils.isEmpty(dto.getType()) ? "week" : dto.getType());
|
|
|
QueryWrapper<MktDeviceTime> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("type", dto.getType());
|
|
|
+ if (!StringUtils.isEmpty(dto.getType())) {
|
|
|
+ wrapper.eq("type", dto.getType());
|
|
|
+ }
|
|
|
+
|
|
|
// 添加时间范围查询
|
|
|
wrapper.between("stat_date", timeRangeMap.get("startDate"), timeRangeMap.get("endDate"));
|
|
|
// 动态添加其他查询条件
|
|
@@ -239,7 +249,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) wrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) wrapper.eq("app_version", dto.getVersion());
|
|
|
|
|
|
- List<MktDeviceTime> list = mktDeviceTimeMapper.selectList(wrapper);
|
|
|
+ List<MktDeviceTime> list = statDeviceTimeMapper.selectList(wrapper);
|
|
|
List<InstallStockVO> voList = new ArrayList<>();
|
|
|
for (MktDeviceTime entity : list) {
|
|
|
InstallStockVO vo = new InstallStockVO();
|
|
@@ -313,7 +323,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) timeWrapper.eq("app_id", dto.getAppId());
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) timeWrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) timeWrapper.eq("app_version", dto.getVersion());
|
|
|
- List<MktDeviceTime> timeList = mktDeviceTimeMapper.selectList(timeWrapper);
|
|
|
+ List<MktDeviceTime> timeList = statDeviceTimeMapper.selectList(timeWrapper);
|
|
|
List<UninstallTimeDiffVO> timeDiffs = new ArrayList<>();
|
|
|
for (MktDeviceTime entity : timeList) {
|
|
|
UninstallTimeDiffVO vo = new UninstallTimeDiffVO();
|
|
@@ -330,7 +340,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) countWrapper.eq("app_id", dto.getAppId());
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) countWrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) countWrapper.eq("app_version", dto.getVersion());
|
|
|
- List<MktDeviceCount> countList = mktDeviceCountMapper.selectList(countWrapper);
|
|
|
+ List<MktDeviceCount> countList = statDeviceCountMapper.selectList(countWrapper);
|
|
|
List<UninstallBeforeSevenVO> beforeSevens = new ArrayList<>();
|
|
|
for (MktDeviceCount entity : countList) {
|
|
|
UninstallBeforeSevenVO vo = new UninstallBeforeSevenVO();
|
|
@@ -375,7 +385,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) interfereWrapper.eq("app_id", dto.getAppId());
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) interfereWrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) interfereWrapper.eq("app_version", dto.getVersion());
|
|
|
- List<MktDeviceInterfere> interfereList = mktDeviceInterfereMapper.selectList(interfereWrapper);
|
|
|
+ List<MktDeviceInterfere> interfereList = statDeviceInterfereMapper.selectList(interfereWrapper);
|
|
|
Map<String, Map<String, Integer>> interfereMap = new LinkedHashMap<>();
|
|
|
for (MktDeviceInterfere entity : interfereList) {
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
@@ -418,7 +428,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) actionWrapper.eq("app_id", dto.getAppId());
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) actionWrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) actionWrapper.eq("app_version", dto.getVersion());
|
|
|
- List<MktDeviceAction> actionList = mktDeviceActionMapper.selectList(actionWrapper);
|
|
|
+ List<MktDeviceAction> actionList = statDeviceActionMapper.selectList(actionWrapper);
|
|
|
List<Map<String, Integer>> list = new ArrayList<>();
|
|
|
for (MktDeviceAction entity : actionList) {
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
@@ -440,10 +450,10 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
|
|
|
@Override
|
|
|
public List<UninstallOfterAPPOV> uninstallAfter(GetUninstallInsightDTO dto) {
|
|
|
- // 这里只做演示,实际可查mkt_device_time或相关表
|
|
|
+ // 这里只做演示,实际可查stat_device_time或相关表
|
|
|
QueryWrapper<MktDeviceTime> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("type", "after");
|
|
|
- List<MktDeviceTime> list = mktDeviceTimeMapper.selectList(wrapper);
|
|
|
+ List<MktDeviceTime> list = statDeviceTimeMapper.selectList(wrapper);
|
|
|
List<UninstallOfterAPPOV> result = new ArrayList<>();
|
|
|
for (MktDeviceTime entity : list) {
|
|
|
UninstallOfterAPPOV vo = new UninstallOfterAPPOV();
|
|
@@ -459,7 +469,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
public List<UninstallSYSOV> uninstallSys(GetUninstallInsightDTO dto) {
|
|
|
QueryWrapper<MktDeviceTime> wrapper = new QueryWrapper<>();
|
|
|
wrapper.eq("type", "sys");
|
|
|
- List<MktDeviceTime> list = mktDeviceTimeMapper.selectList(wrapper);
|
|
|
+ List<MktDeviceTime> list = statDeviceTimeMapper.selectList(wrapper);
|
|
|
Map<String, List<Map<String, Integer>>> sysMap = new LinkedHashMap<>();
|
|
|
for (MktDeviceTime entity : list) {
|
|
|
sysMap.computeIfAbsent(entity.getTimeRange(), k -> new ArrayList<>())
|
|
@@ -514,7 +524,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
|
|
|
wrapper.between("stat_date", startDate, endDate);
|
|
|
|
|
|
- List<MktPortrait> portraitList = mktPortraitMapper.selectList(wrapper);
|
|
|
+ List<MktPortrait> portraitList = statPortraitMapper.selectList(wrapper);
|
|
|
|
|
|
// 1. 卸载数量统计
|
|
|
UninstallPortraitSumOV sum = new UninstallPortraitSumOV();
|
|
@@ -618,7 +628,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
wrapper.between("stat_date", dto.getStartDate(), dto.getEndDate());
|
|
|
}
|
|
|
|
|
|
- List<MktPredict> predictList = mktPredictMapper.selectList(wrapper);
|
|
|
+ List<MktPredict> predictList = statPredictMapper.selectList(wrapper);
|
|
|
|
|
|
List<UninstallPredictVO> result = new ArrayList<>();
|
|
|
|
|
@@ -672,7 +682,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
wrapper.between("stat_date", dto.getStartDate(), dto.getEndDate());
|
|
|
}
|
|
|
|
|
|
- List<MktInstallUninstallRatio> ratioList = mktInstallUninstallRatioMapper.selectList(wrapper);
|
|
|
+ List<MktInstallUninstallRatio> ratioList = statInstallRatioMapper.selectList(wrapper);
|
|
|
|
|
|
// 按日期分组,每个日期对应多个行业-占比
|
|
|
Map<Date, List<MktInstallUninstallRatio>> dateGroups = ratioList.stream()
|
|
@@ -722,4 +732,4 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
// 使用PageUtils工具类处理分页
|
|
|
return PageUtils.buildPage(allData, pageNum, pageSize);
|
|
|
}
|
|
|
-}
|
|
|
+}
|