|
|
|
@@ -8,6 +8,7 @@ import com.iformall.domain.vo.cockpit.*; |
|
|
|
import com.iformall.enums.EnumShopStatus; |
|
|
|
import com.iformall.enums.EnumUserGender; |
|
|
|
import com.iformall.mapper.WxCUserBasicInfoMapper; |
|
|
|
import com.iformall.mapper.WxCUserCarMapper; |
|
|
|
import com.iformall.mapper.WxShopMapper; |
|
|
|
import com.iformall.mapper.WxUserVisitMapper; |
|
|
|
import com.iformall.service.CockpitScreenService; |
|
|
|
@@ -40,6 +41,8 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { |
|
|
|
private WxShopMapper wxShopMapper; |
|
|
|
@Autowired |
|
|
|
private WxUserVisitMapper wxUserVisitMapper; |
|
|
|
@Autowired |
|
|
|
private WxCUserCarMapper wxCUserCarMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public CountUserGenderVO countUserGender(TenantEntity tenantEntity) { |
|
|
|
@@ -103,37 +106,49 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { |
|
|
|
years.add(DateUtils.getYear(new Date())); |
|
|
|
} |
|
|
|
|
|
|
|
List<CountMonthVO> result = new ArrayList<>(); |
|
|
|
List<MonthDataMapping> mappings = cUserBasicInfoMapper.groupByDate(tenantInfo.getFinalTenantId(), years); |
|
|
|
Map<String, Integer> mappingMap = mappings.stream().collect(Collectors.toMap(MonthDataMapping::getName, MonthDataMapping::getCount)); |
|
|
|
for (int i = 0; i < years.size(); i++) { |
|
|
|
CountMonthVO vo = new CountMonthVO(); |
|
|
|
List<MonthDataVO> months = new ArrayList<>(); |
|
|
|
return getResult(years, mappings); |
|
|
|
} |
|
|
|
|
|
|
|
for (int j = 0; j < 12; j++) { |
|
|
|
MonthDataVO month = new MonthDataVO(); |
|
|
|
month.setMonth(j + 1); |
|
|
|
Integer count = mappingMap.get(years.get(i) + "-" + DateUtils.getMonthStr(j + 1)); |
|
|
|
count = count != null ? count : 0; |
|
|
|
month.setCount(count); |
|
|
|
months.add(month); |
|
|
|
} |
|
|
|
vo.setYear(years.get(i)); |
|
|
|
vo.setMonths(months); |
|
|
|
result.add(vo); |
|
|
|
@Override |
|
|
|
public List<CountMonthVO> countReachUser(TenantEntity tenantInfo, List<Integer> years) { |
|
|
|
if (CollectionUtils.isEmpty(years)) { |
|
|
|
years.add(DateUtils.getYear(new Date())); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
List<MonthDataMapping> mappings = wxUserVisitMapper.groupByDate(tenantInfo.getFinalTenantId(), years); |
|
|
|
return getResult(years, mappings); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CountMonthVO> countReachUser(TenantEntity tenantInfo, List<Integer> years) { |
|
|
|
public List<CountMonthVO> countCar(TenantEntity tenantInfo, List<Integer> years) { |
|
|
|
if (CollectionUtils.isEmpty(years)) { |
|
|
|
years.add(DateUtils.getYear(new Date())); |
|
|
|
} |
|
|
|
|
|
|
|
List<MonthDataMapping> mappings = wxCUserCarMapper.groupByDate(tenantInfo.getFinalTenantId(), years); |
|
|
|
return getResult(years, mappings); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CountOrderTrendVO> countOrderTrend(TenantEntity tenantInfo, Integer year) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CountBasicVO countBasic() { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 拼装某年某月数据 |
|
|
|
* |
|
|
|
* @param years |
|
|
|
* @param mappings |
|
|
|
* @return {@link List}<{@link CountMonthVO}> |
|
|
|
*/ |
|
|
|
private List<CountMonthVO> getResult(List<Integer> years, List<MonthDataMapping> mappings) { |
|
|
|
List<CountMonthVO> result = new ArrayList<>(); |
|
|
|
List<MonthDataMapping> mappings = wxUserVisitMapper.groupByDate(tenantInfo.getFinalTenantId(), years); |
|
|
|
Map<String, Integer> mappingMap = mappings.stream().collect(Collectors.toMap(MonthDataMapping::getName, MonthDataMapping::getCount)); |
|
|
|
for (int i = 0; i < years.size(); i++) { |
|
|
|
CountMonthVO vo = new CountMonthVO(); |
|
|
|
@@ -151,22 +166,6 @@ public class CockpitScreenServiceImpl implements CockpitScreenService { |
|
|
|
vo.setMonths(months); |
|
|
|
result.add(vo); |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CountMonthVO> countCar(TenantEntity tenantInfo, List<Integer> years) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<CountOrderTrendVO> countOrderTrend(TenantEntity tenantInfo, Integer year) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public CountBasicVO countBasic() { |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |