libo 4 anos atrás
pai
commit
03cfb7e398

+ 31 - 32
src/main/java/com/tdba/cxb/ares/api/service/UserService.java

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