libo %!s(int64=4) %!d(string=hai) anos
pai
achega
49277e7698

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

@@ -23,6 +23,9 @@ public class UserDto {
23 23
      */
24 24
     private Integer num;
25 25
 
26
+    /** 用户ID 多个逗号隔开*/
27
+    private String uid_concat;
28
+
26 29
     public Integer getUid() {
27 30
         return uid;
28 31
     }
@@ -47,11 +50,19 @@ public class UserDto {
47 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 61
     public static final class UserDtoBuilder {
52 62
         private Integer uid;
53 63
         private Integer spread_uid;
54 64
         private Integer num;
65
+        private String uid_concat;
55 66
 
56 67
         private UserDtoBuilder() {
57 68
         }
@@ -75,11 +86,17 @@ public class UserDto {
75 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 94
         public UserDto build() {
79 95
             UserDto userDto = new UserDto();
80 96
             userDto.setUid(uid);
81 97
             userDto.setSpread_uid(spread_uid);
82 98
             userDto.setNum(num);
99
+            userDto.setUid_concat(uid_concat);
83 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 38
     List<DetailListResp> selectByPid(@Param("pid") Integer pid,
39 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 1
 package com.tdba.cxb.ares.api.service;
2 2
 
3
+import com.tdba.cxb.ares.api.controller.UserController;
3 4
 import com.tdba.cxb.ares.api.model.*;
4 5
 import com.tdba.cxb.ares.api.repository.UserBindMapper;
5 6
 import com.tdba.cxb.ares.api.repository.UserCountMapper;
@@ -152,7 +153,7 @@ public class UserService {
152 153
                         .withUser_type(UserTypeEnum.DACANG.ordinal())
153 154
                         .withCreate_time(currentTime)
154 155
                         .build());
155
-                userRelateMapper.updateByUid(UserTypeEnum.DACANG.ordinal(), row.getSpread_uid());
156
+                userRelateMapper.updateByUidList(UserTypeEnum.DACANG.ordinal(), row.getUid_concat());
156 157
 
157 158
                 userRelateMapper.selectByUid(row.getSpread_uid()).stream().forEach(innerRow -> {
158 159
                     resultList.add(UserCount.UserCountBuilder.anUserCount()
@@ -172,10 +173,12 @@ public class UserService {
172 173
                             .withUid(row.getKey())
173 174
                             .withUser_type(UserTypeEnum.DACANG.ordinal())
174 175
                             .withDate(localDate)
175
-                            .withNum(row.getValue().size())
176
+                            .withNum(row.getValue().stream().mapToInt(UserCount::getNum).sum())
176 177
                             .withCreate_time(currentTime)
177 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 17
     <select id="selectDacang" resultType="com.tdba.cxb.ares.api.model.UserDto">
18 18
         select
19 19
             count(1) 'num',
20
-            u.spread_uid
20
+            u.spread_uid,
21
+            group_concat(u.uid) 'uid_concat'
21 22
         from
22 23
             rrx_da_cang_user da
23 24
         left join

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

@@ -126,6 +126,24 @@
126 126
         where uid = #{uid}
127 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 147
     <select id="countByUid" resultType="java.lang.Integer">
130 148
         select
131 149
             count(1)