libo лет назад: 4
Родитель
Сommit
1771a18f71
1 измененных файлов с 25 добавлено и 20 удалено
  1. 25 20
      src/main/java/com/tdba/cxb/ares/api/service/UserService.java

+ 25 - 20
src/main/java/com/tdba/cxb/ares/api/service/UserService.java

@@ -78,14 +78,17 @@ public class UserService {
78
                                 .build());
78
                                 .build());
79
                     }
79
                     }
80
                 }
80
                 }
81
+            }
81
 
82
 
82
-                //-- 追溯之前的数据
83
-                if((null != row.getSpread_uid()) && (0 < row.getSpread_uid())){
84
-                    relateList.add(UserRelate.UserRelateBuilder.anUserRelate()
85
-                            .withUid(row.getUid())
86
-                            .withPid(row.getSpread_uid())
87
-                            .withDate(localDate)
88
-                            .build());
83
+            //-- 追溯之前的数据
84
+            if((null != row.getSpread_uid()) && (0 < row.getSpread_uid())){
85
+                relateList.add(UserRelate.UserRelateBuilder.anUserRelate()
86
+                        .withUid(row.getUid())
87
+                        .withPid(row.getSpread_uid())
88
+                        .withDate(localDate)
89
+                        .build());
90
+
91
+                if(0 < num) {
89
                     //推荐人
92
                     //推荐人
90
                     resultList.add(UserCount.UserCountBuilder.anUserCount()
93
                     resultList.add(UserCount.UserCountBuilder.anUserCount()
91
                             .withCreate_time(currentTime)
94
                             .withCreate_time(currentTime)
@@ -94,9 +97,11 @@ public class UserService {
94
                             .withUid(row.getSpread_uid())
97
                             .withUid(row.getSpread_uid())
95
                             .withDate(localDate)
98
                             .withDate(localDate)
96
                             .build());
99
                             .build());
100
+                }
97
 
101
 
98
-                    //往前追溯的推荐人
99
-                    userRelateMapper.selectByUid(row.getSpread_uid()).stream().forEach(innerRow -> {
102
+                //往前追溯的推荐人
103
+                userRelateMapper.selectByUid(row.getSpread_uid()).stream().forEach(innerRow -> {
104
+                    if(0 < num) {
100
                         resultList.add(UserCount.UserCountBuilder.anUserCount()
105
                         resultList.add(UserCount.UserCountBuilder.anUserCount()
101
                                 .withCreate_time(currentTime)
106
                                 .withCreate_time(currentTime)
102
                                 .withNum(num)
107
                                 .withNum(num)
@@ -104,19 +109,19 @@ public class UserService {
104
                                 .withUid(innerRow.getPid())
109
                                 .withUid(innerRow.getPid())
105
                                 .withDate(localDate)
110
                                 .withDate(localDate)
106
                                 .build());
111
                                 .build());
112
+                    }
107
 
113
 
108
-                        relateList.add(UserRelate.UserRelateBuilder.anUserRelate()
109
-                                .withUid(row.getUid())
110
-                                .withPid(innerRow.getPid())
111
-                                .withDate(localDate)
112
-                                .build());
113
-                    });
114
-                }
115
-                if(!relateList.isEmpty()){
116
-                    userRelateMapper.insertSelectiveForeach(relateList);
117
-                }
118
-                relateList.clear();
114
+                    relateList.add(UserRelate.UserRelateBuilder.anUserRelate()
115
+                            .withUid(row.getUid())
116
+                            .withPid(innerRow.getPid())
117
+                            .withDate(localDate)
118
+                            .build());
119
+                });
120
+            }
121
+            if(!relateList.isEmpty()){
122
+                userRelateMapper.insertSelectiveForeach(relateList);
119
             }
123
             }
124
+            relateList.clear();
120
         });
125
         });
121
         if(!resultList.isEmpty()){
126
         if(!resultList.isEmpty()){
122
             userCountMapper.insertSelectiveForeach(resultList);
127
             userCountMapper.insertSelectiveForeach(resultList);