傅行帆 5 anni fa
parent
commit
5a3408b288

+ 21
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticDailyServiceImpl.java Vedi File

@@ -88,9 +88,28 @@ public class TsCustomerStatisticDailyServiceImpl extends ServiceImpl<TsCustomerS
88 88
 		//31天前的日期
89 89
 		LocalDateTime beforeDate = nowDate.plusDays(-31);
90 90
 		//获取31天的日期数据
91
-
92 91
 		List<TsCustomerStatisticDaily> list = customerStatisticDailyMapper.getDailyList(customerType,orgId,nowDate,beforeDate,personId,userId);
93
-		return list;
92
+		//构造31天的数据
93
+		List<TsCustomerStatisticDaily> newList = new ArrayList<>();
94
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
95
+		for (int i = 0; i < 31;i++){
96
+			String newDate = nowDate.plusDays(-i).format(formatter);
97
+			TsCustomerStatisticDaily tsCustomerStatisticDaily = new TsCustomerStatisticDaily();
98
+			tsCustomerStatisticDaily.setOrgId(orgId);
99
+			tsCustomerStatisticDaily.setCustomerNum(0);
100
+			tsCustomerStatisticDaily.setDay(newDate);
101
+			tsCustomerStatisticDaily.setCustomerType(customerType);
102
+			tsCustomerStatisticDaily.setRealtyConsultant(personId);
103
+			newList.add(tsCustomerStatisticDaily);
104
+			//合并数据
105
+			list.forEach(l -> {
106
+				if (newDate.equals(l.getDay())){
107
+					tsCustomerStatisticDaily.setCustomerNum(l.getCustomerNum());
108
+				}
109
+			});
110
+		}
111
+		
112
+		return newList;
94 113
 	}
95 114
 	
96 115
 	/**

+ 21
- 2
src/main/java/com/huiju/estateagents/statistic/service/impl/TsCustomerStatisticMonthlyServiceImpl.java Vedi File

@@ -86,9 +86,28 @@ public class TsCustomerStatisticMonthlyServiceImpl extends ServiceImpl<TsCustome
86 86
 		LocalDateTime nowDate = LocalDateTime.now();
87 87
 		//12个月前的日期
88 88
 		LocalDateTime beforeDate = nowDate.plusMonths(-12);
89
-		//获取31天的日期数据
89
+		//获取12个月数据
90 90
 		List<TsCustomerStatisticMonthly> list = customerStatisticMonthlyMapper.getMonthlyList(customerType,orgId,nowDate,beforeDate,personId,userId);
91
-		return list;
91
+		//构造12个月的数据
92
+		List<TsCustomerStatisticMonthly> newList = new ArrayList<>();
93
+		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
94
+		for (int i = 0; i < 12;i++){
95
+			String newDate = nowDate.plusDays(-i).format(formatter);
96
+			TsCustomerStatisticMonthly tsCustomerStatisticMonthly = new TsCustomerStatisticMonthly();
97
+			tsCustomerStatisticMonthly.setCustomerType(customerType);
98
+			tsCustomerStatisticMonthly.setMonth(newDate);
99
+			tsCustomerStatisticMonthly.setCustomerNum(0);
100
+			tsCustomerStatisticMonthly.setOrgId(orgId);
101
+			tsCustomerStatisticMonthly.setRealtyConsultant(personId);
102
+			newList.add(tsCustomerStatisticMonthly);
103
+			list.forEach(l -> {
104
+				if (newDate.equals(l.getMonth())){
105
+					tsCustomerStatisticMonthly.setCustomerNum(l.getCustomerNum());
106
+				}
107
+			});
108
+		}
109
+		
110
+		return newList;
92 111
 	}
93 112
 	
94 113
 	/**