libo 4 gadi atpakaļ
vecāks
revīzija
49277e7698

+ 17 - 0
src/main/java/com/tdba/cxb/ares/api/model/UserDto.java

@@ -23,6 +23,9 @@ public class UserDto {
23
      */
23
      */
24
     private Integer num;
24
     private Integer num;
25
 
25
 
26
+    /** 用户ID 多个逗号隔开*/
27
+    private String uid_concat;
28
+
26
     public Integer getUid() {
29
     public Integer getUid() {
27
         return uid;
30
         return uid;
28
     }
31
     }
@@ -47,11 +50,19 @@ public class UserDto {
47
         this.num = num;
50
         this.num = num;
48
     }
51
     }
49
 
52
 
53
+    public String getUid_concat() {
54
+        return uid_concat;
55
+    }
56
+
57
+    public void setUid_concat(String uid_concat) {
58
+        this.uid_concat = uid_concat;
59
+    }
50
 
60
 
51
     public static final class UserDtoBuilder {
61
     public static final class UserDtoBuilder {
52
         private Integer uid;
62
         private Integer uid;
53
         private Integer spread_uid;
63
         private Integer spread_uid;
54
         private Integer num;
64
         private Integer num;
65
+        private String uid_concat;
55
 
66
 
56
         private UserDtoBuilder() {
67
         private UserDtoBuilder() {
57
         }
68
         }
@@ -75,11 +86,17 @@ public class UserDto {
75
             return this;
86
             return this;
76
         }
87
         }
77
 
88
 
89
+        public UserDtoBuilder withUid_concat(String uid_concat) {
90
+            this.uid_concat = uid_concat;
91
+            return this;
92
+        }
93
+
78
         public UserDto build() {
94
         public UserDto build() {
79
             UserDto userDto = new UserDto();
95
             UserDto userDto = new UserDto();
80
             userDto.setUid(uid);
96
             userDto.setUid(uid);
81
             userDto.setSpread_uid(spread_uid);
97
             userDto.setSpread_uid(spread_uid);
82
             userDto.setNum(num);
98
             userDto.setNum(num);
99
+            userDto.setUid_concat(uid_concat);
83
             return userDto;
100
             return userDto;
84
         }
101
         }
85
     }
102
     }

+ 3 - 0
src/main/java/com/tdba/cxb/ares/api/repository/UserRelateMapper.java

@@ -37,4 +37,7 @@ public interface UserRelateMapper {
37
 
37
 
38
     List<DetailListResp> selectByPid(@Param("pid") Integer pid,
38
     List<DetailListResp> selectByPid(@Param("pid") Integer pid,
39
                                      @Param("userType") Integer userType);
39
                                      @Param("userType") Integer userType);
40
+
41
+    Integer updateByUidList(@Param("userType") Integer userType,
42
+                        @Param("uid_concat") String uid_concat);
40
 }
43
 }

+ 5 - 2
src/main/java/com/tdba/cxb/ares/api/service/UserService.java

@@ -1,5 +1,6 @@
1
 package com.tdba.cxb.ares.api.service;
1
 package com.tdba.cxb.ares.api.service;
2
 
2
 
3
+import com.tdba.cxb.ares.api.controller.UserController;
3
 import com.tdba.cxb.ares.api.model.*;
4
 import com.tdba.cxb.ares.api.model.*;
4
 import com.tdba.cxb.ares.api.repository.UserBindMapper;
5
 import com.tdba.cxb.ares.api.repository.UserBindMapper;
5
 import com.tdba.cxb.ares.api.repository.UserCountMapper;
6
 import com.tdba.cxb.ares.api.repository.UserCountMapper;
@@ -152,7 +153,7 @@ public class UserService {
152
                         .withUser_type(UserTypeEnum.DACANG.ordinal())
153
                         .withUser_type(UserTypeEnum.DACANG.ordinal())
153
                         .withCreate_time(currentTime)
154
                         .withCreate_time(currentTime)
154
                         .build());
155
                         .build());
155
-                userRelateMapper.updateByUid(UserTypeEnum.DACANG.ordinal(), row.getSpread_uid());
156
+                userRelateMapper.updateByUidList(UserTypeEnum.DACANG.ordinal(), row.getUid_concat());
156
 
157
 
157
                 userRelateMapper.selectByUid(row.getSpread_uid()).stream().forEach(innerRow -> {
158
                 userRelateMapper.selectByUid(row.getSpread_uid()).stream().forEach(innerRow -> {
158
                     resultList.add(UserCount.UserCountBuilder.anUserCount()
159
                     resultList.add(UserCount.UserCountBuilder.anUserCount()
@@ -172,10 +173,12 @@ public class UserService {
172
                             .withUid(row.getKey())
173
                             .withUid(row.getKey())
173
                             .withUser_type(UserTypeEnum.DACANG.ordinal())
174
                             .withUser_type(UserTypeEnum.DACANG.ordinal())
174
                             .withDate(localDate)
175
                             .withDate(localDate)
175
-                            .withNum(row.getValue().size())
176
+                            .withNum(row.getValue().stream().mapToInt(UserCount::getNum).sum())
176
                             .withCreate_time(currentTime)
177
                             .withCreate_time(currentTime)
177
                             .build()).toList());
178
                             .build()).toList());
178
         }
179
         }
180
+
181
+        //更新
179
     }
182
     }
180
 
183
 
181
     /**
184
     /**

+ 2 - 1
src/main/resources/mapper/UserMapper.xml

@@ -17,7 +17,8 @@
17
     <select id="selectDacang" resultType="com.tdba.cxb.ares.api.model.UserDto">
17
     <select id="selectDacang" resultType="com.tdba.cxb.ares.api.model.UserDto">
18
         select
18
         select
19
             count(1) 'num',
19
             count(1) 'num',
20
-            u.spread_uid
20
+            u.spread_uid,
21
+            group_concat(u.uid) 'uid_concat'
21
         from
22
         from
22
             rrx_da_cang_user da
23
             rrx_da_cang_user da
23
         left join
24
         left join

+ 18 - 0
src/main/resources/mapper/UserRelateMapper.xml

@@ -126,6 +126,24 @@
126
         where uid = #{uid}
126
         where uid = #{uid}
127
     </select>
127
     </select>
128
 
128
 
129
+    <select id="updateByUidList">
130
+        update user_relate set
131
+        <if test="userType == 1">
132
+            is_dacang = 1
133
+        </if>
134
+        <if test="userType == 2">
135
+            is_merchant = 1
136
+        </if>
137
+        <if test="userType == 3">
138
+            is_channel = 1
139
+        </if>
140
+        <if test="userType == 4">
141
+            is_agent = 1
142
+        </if>
143
+
144
+        where uid in ( #{uid_concat} )
145
+    </select>
146
+
129
     <select id="countByUid" resultType="java.lang.Integer">
147
     <select id="countByUid" resultType="java.lang.Integer">
130
         select
148
         select
131
             count(1)
149
             count(1)