|
@@ -8,14 +8,7 @@ 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.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.mapper.*;
|
|
|
import com.pig4cloud.pig.statistics.service.UninstallAnalyseService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -56,6 +49,8 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
private StatInstallRatioMapper statInstallRatioMapper;
|
|
|
@Autowired
|
|
|
private StatPredictMapper statPredictMapper;
|
|
|
+ @Autowired
|
|
|
+ private StatSysDistributeMapper statSysDistributeMapper;
|
|
|
|
|
|
@Override
|
|
|
public UninstallTrendVO getUninstallTrend(GetUninstallTrendDTO dto) {
|
|
@@ -238,11 +233,13 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
|
|
|
Map<String, LocalDate> timeRangeMap = getTimeRangeMap(StringUtils.isEmpty(dto.getType()) ? "week" : dto.getType());
|
|
|
QueryWrapper<MktDeviceTime> wrapper = new QueryWrapper<>();
|
|
|
+ QueryWrapper<MktDeviceCount> countQueryWrapper = new QueryWrapper<>();
|
|
|
+
|
|
|
if (!StringUtils.isEmpty(dto.getType())) {
|
|
|
wrapper.eq("type", dto.getType());
|
|
|
+ countQueryWrapper.eq("type", dto.getType());
|
|
|
}
|
|
|
|
|
|
- // 添加时间范围查询
|
|
|
wrapper.between("stat_date", timeRangeMap.get("startDate"), timeRangeMap.get("endDate"));
|
|
|
// 动态添加其他查询条件
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) wrapper.eq("app_id", dto.getAppId());
|
|
@@ -250,6 +247,18 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) wrapper.eq("app_version", dto.getVersion());
|
|
|
|
|
|
List<MktDeviceTime> list = statDeviceTimeMapper.selectList(wrapper);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ countQueryWrapper.between("stat_date", timeRangeMap.get("startDate"), timeRangeMap.get("endDate"));
|
|
|
+ // 动态添加其他查询条件
|
|
|
+ if (!StringUtils.isEmpty(dto.getAppId())) countQueryWrapper.eq("app_id", dto.getAppId());
|
|
|
+ if (!StringUtils.isEmpty(dto.getChannel())) countQueryWrapper.eq("channel", dto.getChannel());
|
|
|
+ if (!StringUtils.isEmpty(dto.getVersion())) countQueryWrapper.eq("app_version", dto.getVersion());
|
|
|
+
|
|
|
+ List<MktDeviceCount> listCount = statDeviceCountMapper.selectList(countQueryWrapper);
|
|
|
+
|
|
|
+
|
|
|
List<InstallStockVO> voList = new ArrayList<>();
|
|
|
for (MktDeviceTime entity : list) {
|
|
|
InstallStockVO vo = new InstallStockVO();
|
|
@@ -259,8 +268,19 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
vo.setUninstallRate(entity.getRate());
|
|
|
voList.add(vo);
|
|
|
}
|
|
|
+
|
|
|
+ List<HisUnInstallCountVO> hisUnInstallCountVOS = new ArrayList<>();
|
|
|
+ for (MktDeviceCount entity : listCount) {
|
|
|
+ HisUnInstallCountVO vo = new HisUnInstallCountVO();
|
|
|
+ ConfigItem configValue = ConfigUtils.getConfigValue("Count_range", String.valueOf(entity.getCountRange()));
|
|
|
+ vo.setCount(configValue.getLabel());
|
|
|
+ vo.setNum(entity.getNum());
|
|
|
+ vo.setRate(entity.getRate());
|
|
|
+ hisUnInstallCountVOS.add(vo);
|
|
|
+ }
|
|
|
UninstallInsightVO result = new UninstallInsightVO();
|
|
|
result.setLifecycleDistribution(voList);
|
|
|
+ result.setUninstallDistribution(hisUnInstallCountVOS);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -432,8 +452,8 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
List<Map<String, Integer>> list = new ArrayList<>();
|
|
|
for (MktDeviceAction entity : actionList) {
|
|
|
Map<String, Integer> map = new HashMap<>();
|
|
|
- ConfigItem actionType = ConfigUtils.getConfigValue("Action_type", String.valueOf(entity.getActionType()));
|
|
|
- map.put(actionType.getLabel(), entity.getTriggerCount());
|
|
|
+ ConfigItem pageType = ConfigUtils.getConfigValue("page", String.valueOf(entity.getActionValue()));
|
|
|
+ map.put(pageType.getLabel(), entity.getTriggerCount());
|
|
|
|
|
|
list.add(map);
|
|
|
}
|
|
@@ -489,21 +509,21 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
timeRangeMap = getTimeRangeMap(dto.getCycle());
|
|
|
}
|
|
|
|
|
|
- QueryWrapper<MktDeviceTime> wrapper = new QueryWrapper<>();
|
|
|
- if (!StringUtils.isEmpty(dto.getType())){
|
|
|
- wrapper.eq("type", dto.getType());
|
|
|
- }
|
|
|
+ ConfigItem configItem = null;
|
|
|
+ QueryWrapper<MktSysDistribute> wrapper = new QueryWrapper<>();
|
|
|
+
|
|
|
if (!timeRangeMap.isEmpty()){
|
|
|
wrapper.between("stat_date", timeRangeMap.get("startDate"), timeRangeMap.get("endDate"));
|
|
|
}
|
|
|
if (!StringUtils.isEmpty(dto.getAppId())) wrapper.eq("app_id", dto.getAppId());
|
|
|
if (!StringUtils.isEmpty(dto.getChannel())) wrapper.eq("channel", dto.getChannel());
|
|
|
if (!StringUtils.isEmpty(dto.getVersion())) wrapper.eq("app_version", dto.getVersion());
|
|
|
- List<MktDeviceTime> list = statDeviceTimeMapper.selectList(wrapper);
|
|
|
+ List<MktSysDistribute> list = statSysDistributeMapper.selectList( wrapper);
|
|
|
Map<String, List<Map<String, Integer>>> sysMap = new LinkedHashMap<>();
|
|
|
- for (MktDeviceTime entity : list) {
|
|
|
- sysMap.computeIfAbsent(entity.getTimeRange(), k -> new ArrayList<>())
|
|
|
- .add(Collections.singletonMap(entity.getAppVersion(), entity.getDeviceCount()));
|
|
|
+ for (MktSysDistribute entity : list) {
|
|
|
+ configItem = ConfigUtils.getConfigValue("sys_name", String.valueOf(entity.getIcon_name()));
|
|
|
+ sysMap.computeIfAbsent(configItem.getLabel(), k -> new ArrayList<>())
|
|
|
+ .add(Collections.singletonMap(entity.getIcon_key(), entity.getIcon_count()));
|
|
|
}
|
|
|
List<UninstallSYSOV> result = new ArrayList<>();
|
|
|
for (Map.Entry<String, List<Map<String, Integer>>> entry : sysMap.entrySet()) {
|
|
@@ -543,15 +563,20 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
LocalDate now = LocalDate.now();
|
|
|
startDate = now.with(DayOfWeek.MONDAY);
|
|
|
}
|
|
|
-
|
|
|
- if ("week".equalsIgnoreCase(dto.getTimeUnit())) {
|
|
|
- endDate = startDate.with(DayOfWeek.SUNDAY);
|
|
|
- } else if ("month".equalsIgnoreCase(dto.getTimeUnit())) {
|
|
|
- endDate = startDate.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
+ if (!StringUtils.isEmpty(dto.getEndDate())) {
|
|
|
+ endDate = LocalDate.parse(dto.getEndDate());
|
|
|
} else {
|
|
|
- endDate = startDate.with(DayOfWeek.SUNDAY);
|
|
|
+ if ("week".equalsIgnoreCase(dto.getTimeUnit())) {
|
|
|
+ endDate = startDate.with(DayOfWeek.SUNDAY);
|
|
|
+ } else if ("month".equalsIgnoreCase(dto.getTimeUnit())) {
|
|
|
+ endDate = startDate.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
+ } else {
|
|
|
+ endDate = startDate.with(DayOfWeek.SUNDAY);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
wrapper.between("stat_date", startDate, endDate);
|
|
|
|
|
|
List<MktPortrait> portraitList = statPortraitMapper.selectList(wrapper);
|
|
@@ -735,7 +760,7 @@ public class UninstallAnalyseServiceImpl implements UninstallAnalyseService {
|
|
|
String industryLabel = "未知类型";
|
|
|
if (entity.getIndustryType() != null) {
|
|
|
ConfigItem configValue = ConfigUtils.getConfigValue("Industry_type", String.valueOf(entity.getIndustryType()));
|
|
|
- industryLabel = configValue != null ? configValue.getLabel() : "未知类型";
|
|
|
+ industryLabel = !StringUtils.isEmpty(configValue.getLabel()) ? configValue.getLabel() : "未知类型";
|
|
|
}
|
|
|
|
|
|
// 设置占比
|