张延森 5 anos atrás
pai
commit
bb098d8610

+ 13
- 5
src/main/java/com/huiju/estateagents/controller/TsConsultantKpiController.java Ver arquivo

@@ -57,7 +57,7 @@ public class TsConsultantKpiController extends BaseController {
57 57
      * @return
58 58
      */
59 59
     @RequestMapping(value="/consultant/kpi",method= RequestMethod.GET)
60
-    public ResponseBean tsConsultantKpiList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
60
+    public ResponseBean stsConsultantKpiList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
61 61
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
62 62
                                             // startDate 默认格式 YYYYMMDD
63 63
                                             @RequestParam(value ="startDate", required = false) String startDate,
@@ -100,7 +100,7 @@ public class TsConsultantKpiController extends BaseController {
100 100
      * @return
101 101
      */
102 102
     @RequestMapping(value="/consultant/kpi",method= RequestMethod.POST)
103
-    public ResponseBean tsConsultantKpiList(// startDate 默认格式 YYYYMMDD
103
+    public ResponseBean stsConsultantKpiExport(// startDate 默认格式 YYYYMMDD
104 104
                                             @RequestParam(value ="startDate", required = false) String startDate,
105 105
                                             @RequestParam(value ="endDate", required = false) String endDate,
106 106
                                             @RequestParam(value ="buildingId", required = false) String buildingId,
@@ -163,7 +163,7 @@ public class TsConsultantKpiController extends BaseController {
163 163
      * @return
164 164
      */
165 165
     @GetMapping("/consultant/customer")
166
-    public ResponseBean tsConsultantKpiList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
166
+    public ResponseBean getConsultantCustomers(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
167 167
                                             @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
168 168
                                             @RequestParam(value ="buildingId", required = false) String buildingId,
169 169
                                             @RequestParam(value ="userId") String userId,
@@ -267,6 +267,7 @@ public class TsConsultantKpiController extends BaseController {
267 267
                                                      @RequestParam(value ="userId") String userId,
268 268
                                                      @RequestParam(value ="startDate", required = false) String startDate,
269 269
                                                      @RequestParam(value ="endDate", required = false) String endDate,
270
+                                                   @RequestParam(value ="personId", required = false) String personId,
270 271
                                                      HttpServletRequest request) {
271 272
         LocalDateTime[] dateRange = {null, null};
272 273
         try {
@@ -277,7 +278,7 @@ public class TsConsultantKpiController extends BaseController {
277 278
 
278 279
         Integer orgId = getOrgId(request);
279 280
         IPage<TaPerson> page = new Page<>(pageNum, pageSize);
280
-        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantHomePageTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1]);
281
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantHomePageTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1], personId);
281 282
         return ResponseBean.success(result);
282 283
     }
283 284
 
@@ -435,6 +436,8 @@ public class TsConsultantKpiController extends BaseController {
435 436
                                                   @RequestParam(value ="endDate", required = false) String endDate,
436 437
                                                   @RequestParam(value ="targetType", required = false) String targetType,
437 438
                                                   @RequestParam(value ="targetName", required = false) String targetName,
439
+                                                @RequestParam(value ="userName", required = false) String userName,
440
+                                                @RequestParam(value ="personId", required = false) String personId,
438 441
                                                   HttpServletRequest request) {
439 442
         LocalDateTime[] dateRange = {null, null};
440 443
         try {
@@ -443,9 +446,14 @@ public class TsConsultantKpiController extends BaseController {
443 446
             return ResponseBean.error(e.getMessage(), ResponseBean.ERROR_ILLEGAL_PARAMS);
444 447
         }
445 448
 
449
+        // 如果 personId 与 userName 同时存在, 以 personId 为准
450
+        if (!StringUtils.isEmpty(personId)) {
451
+            userName = null;
452
+        }
453
+
446 454
         Integer orgId = getOrgId(request);
447 455
         IPage<TaPerson> page = new Page<>(pageNum, pageSize);
448
-        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantShareTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1], targetType, targetName);
456
+        IPage<TaPerson> result = iTsConsultantKpiService.getConsultantShareTimes(page, orgId, userId, buildingId, dateRange[0], dateRange[1], targetType, targetName, userName, personId);
449 457
         return ResponseBean.success(result);
450 458
     }
451 459
 

+ 1
- 2
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Ver arquivo

@@ -197,6 +197,5 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
197 197
                                                            @Param("userId") String userId,
198 198
                                                            @Param("buildingId") String buildingId,
199 199
                                                            @Param("startDate") LocalDateTime startDate,
200
-                                                           @Param("endDate") LocalDateTime endDate
201
-                                                            );
200
+                                                           @Param("endDate") LocalDateTime endDate);
202 201
 }

+ 5
- 2
src/main/java/com/huiju/estateagents/mapper/TsConsultantKpiMapper.java Ver arquivo

@@ -96,7 +96,8 @@ public interface TsConsultantKpiMapper extends BaseMapper<TsConsultantKpi> {
96 96
                                                @Param("userId") String userId,
97 97
                                                @Param("buildingId") String buildingId,
98 98
                                                @Param("startDate") LocalDateTime startDate,
99
-                                               @Param("endDate") LocalDateTime endDate);
99
+                                               @Param("endDate") LocalDateTime endDate,
100
+                                               @Param("personId") String personId);
100 101
 
101 102
     /**
102 103
      * 咨询置业人员
@@ -190,5 +191,7 @@ public interface TsConsultantKpiMapper extends BaseMapper<TsConsultantKpi> {
190 191
                                             @Param("startDate") LocalDateTime startDate,
191 192
                                             @Param("endDate") LocalDateTime endDate,
192 193
                                             @Param("targetType") String targetType,
193
-                                            @Param("targetName") String targetName);
194
+                                            @Param("targetName") String targetName,
195
+                                            @Param("userName") String userName,
196
+                                            @Param("personId") String personId);
194 197
 }

+ 2
- 2
src/main/java/com/huiju/estateagents/service/ITsConsultantKpiService.java Ver arquivo

@@ -30,7 +30,7 @@ public interface ITsConsultantKpiService extends IService<TsConsultantKpi> {
30 30
 
31 31
     IPage<TaPerson> getConsultantHomePagePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
32 32
 
33
-    IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
33
+    IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String personId);
34 34
 
35 35
     IPage<TaPerson> getConsultantChatPersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
36 36
 
@@ -40,5 +40,5 @@ public interface ITsConsultantKpiService extends IService<TsConsultantKpi> {
40 40
 
41 41
     IPage<TaPerson> getConsultantSharePersons(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate);
42 42
 
43
-    IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName);
43
+    IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName, String userName, String personId);
44 44
 }

+ 4
- 4
src/main/java/com/huiju/estateagents/service/impl/TsConsultantKpiServiceImpl.java Ver arquivo

@@ -75,8 +75,8 @@ public class TsConsultantKpiServiceImpl extends ServiceImpl<TsConsultantKpiMappe
75 75
     }
76 76
 
77 77
     @Override
78
-    public IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate) {
79
-        return tsConsultantKpiMapper.getConsultantHomePageTimes(page, orgId, userId, buildingId, startDate, endDate);
78
+    public IPage<TaPerson> getConsultantHomePageTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String personId) {
79
+        return tsConsultantKpiMapper.getConsultantHomePageTimes(page, orgId, userId, buildingId, startDate, endDate, personId);
80 80
     }
81 81
 
82 82
     @Override
@@ -103,9 +103,9 @@ public class TsConsultantKpiServiceImpl extends ServiceImpl<TsConsultantKpiMappe
103 103
     }
104 104
 
105 105
     @Override
106
-    public IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName) {
106
+    public IPage<TaPerson> getConsultantShareTimes(IPage<TaPerson> page, Integer orgId, String userId, String buildingId, LocalDateTime startDate, LocalDateTime endDate, String targetType, String targetName, String userName, String personId) {
107 107
         // buildingId 在表里不一定有数据, 实际执行 SQL 中没有这个条件
108
-        return tsConsultantKpiMapper.getConsultantShareTimes(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName);
108
+        return tsConsultantKpiMapper.getConsultantShareTimes(page, orgId, userId, buildingId, startDate, endDate, targetType, targetName, userName, personId);
109 109
     }
110 110
 
111 111
 }

+ 1
- 1
src/main/resources/application-blue.yml Ver arquivo

@@ -6,7 +6,7 @@ spring:
6 6
   datasource:
7 7
     username: root
8 8
     password: LUfZGvh7j1^qA*2c
9
-    url: jdbc:mysql://123.57.65.31:3306/estateagents_test?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
9
+    url: jdbc:mysql://123.57.65.31:3306/estateagents_20200417?useUnicode=true&serverTimezone=GMT%2B8&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
10 10
     driver-class-name: com.mysql.cj.jdbc.Driver
11 11
     initial-size: 10 # 初始化连接数
12 12
     max-active: 20 # 最大连接数

+ 20
- 8
src/main/resources/mapper/TsConsultantKpiMapper.xml Ver arquivo

@@ -13,6 +13,7 @@
13 13
                 t.building_name,
14 14
                 t.user_id,
15 15
                 t.user_name,
16
+                t.phone,
16 17
                 IFNULL(sum( t.new_persons ),0) AS new_persons,
17 18
                 IFNULL(sum( t.share_num ),0) AS share_num,
18 19
                 IFNULL(sum( t.visit_persons ),0) AS visit_persons,
@@ -148,11 +149,12 @@
148 149
         </if>
149 150
         -->
150 151
         AND e.is_first_time = 1
152
+
151 153
         AND t.phone is not null
152 154
 
153 155
 <!--        为了与存储过程一致 -->
154 156
 <!--        AND t.`status` = 1-->
155
-        ORDER BY e.create_date DESC;
157
+        ORDER BY e.create_date DESC
156 158
     </select>
157 159
 
158 160
     <select id="getConsultantHomePagePersons" resultType="com.huiju.estateagents.entity.TaPerson">
@@ -177,8 +179,8 @@
177 179
 
178 180
 <!--        为了与存储过程一致 -->
179 181
 <!--            AND s.`status` = 1-->
180
-        GROUP BY t.person_id
181
-        ORDER BY t.create_date DESC;
182
+        GROUP BY t.person_id, DATE_FORMAT(t.create_date, '%Y%m%d')
183
+        ORDER BY t.create_date DESC
182 184
     </select>
183 185
 
184 186
     <select id="getConsultantHomePageTimes" resultType="com.huiju.estateagents.entity.TaPerson">
@@ -202,7 +204,10 @@
202 204
 
203 205
 <!--        为了与存储过程一致 -->
204 206
 <!--            AND s.`status` = 1-->
205
-        ORDER BY t.create_date DESC;
207
+        <if test="personId != null and personId !=''">
208
+            AND t.person_id = #{personId}
209
+        </if>
210
+        ORDER BY t.create_date DESC
206 211
     </select>
207 212
 
208 213
     <select id="getConsultantChatPersons" resultType="com.huiju.estateagents.entity.TaPerson">
@@ -223,7 +228,7 @@
223 228
 <!--        为了与存储过程一致 -->
224 229
 <!--            AND s.`status` = 1-->
225 230
         GROUP BY
226
-            t.person_id
231
+            t.person_id, DATE_FORMAT(h.create_date, '%Y%m%d')
227 232
         ORDER BY
228 233
             h.create_date DESC
229 234
     </select>
@@ -231,7 +236,7 @@
231 236
     <select id="getConsultantFavor" resultType="com.huiju.estateagents.entity.TaPerson">
232 237
         SELECT
233 238
             t.*,
234
-            max( i.create_date ) AS visit_time
239
+            i.create_date AS visit_time
235 240
         FROM
236 241
             ta_person t
237 242
         INNER JOIN ta_favor i ON i.person_id = t.person_id
@@ -302,14 +307,14 @@
302 307
             </if>
303 308
             -->
304 309
 <!--            AND t.`status` = 1-->
305
-        GROUP BY t.person_id
310
+        GROUP BY t.person_id, DATE_FORMAT(e.create_date, '%Y%m%d')
306 311
         ORDER BY e.create_date DESC
307 312
     </select>
308 313
 
309 314
     <select id="getConsultantShareTimes" resultType="com.huiju.estateagents.entity.TaPerson">
310 315
         SELECT
311 316
             t.*,
312
-            e.create_date as visit_times,
317
+            e.create_date as visit_time,
313 318
             e.target_type,
314 319
             e.target_id,
315 320
             e.target_name
@@ -338,6 +343,13 @@
338 343
                 AND e.building_id = #{buildingId}
339 344
             </if>
340 345
             -->
346
+
347
+        <if test="personId != null and personId !=''">
348
+            AND t.person_id = #{personId}
349
+        </if>
350
+        <if test="userName != null and userName !=''">
351
+            AND t.nickname like concat('%', #{userName} ,'%')
352
+        </if>
341 353
             <!--            AND t.`status` = 1-->
342 354
         ORDER BY e.create_date DESC
343 355
     </select>