Browse Source

* bug修复

顾绍勇 5 years ago
parent
commit
e86cda490b

+ 2
- 1
src/main/java/com/huiju/estateagents/controller/StatisticalController.java View File

@@ -160,7 +160,8 @@ public class StatisticalController extends BaseController {
160 160
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
161 161
                                             @RequestParam(value = "buildingId", required = false) String buildingId,
162 162
                                             HttpServletRequest request) {
163
-        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId);
163
+        Integer userId = getUserId(request);
164
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, userId);
164 165
     }
165 166
 
166 167
     /**

+ 4
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java View File

@@ -29,5 +29,8 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
29 29
      * @param buildingId
30 30
      * @return
31 31
      */
32
-    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("orgId") Integer orgId, @Param("buildingId") String buildingId);
32
+    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page,
33
+                                                   @Param("orgId") Integer orgId,
34
+                                                   @Param("buildingId") String buildingId,
35
+                                                   @Param("userId") Integer userId);
33 36
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java View File

@@ -105,7 +105,7 @@ public interface IStatisticalService {
105 105
      * @param buildingId
106 106
      * @return
107 107
      */
108
-    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId);
108
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, Integer userId);
109 109
 
110 110
     /**
111 111
      * 用户来源数据 首页

+ 16
- 15
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java View File

@@ -62,7 +62,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
62 62
     public ResponseBean indexStatistical(Integer orgId) {
63 63
 
64 64
         ResponseBean responseBean = new ResponseBean();
65
-        Map<String,Object> map = new HashMap<>();
65
+        Map<String, Object> map = new HashMap<>();
66 66
 
67 67
         // 总用户数
68 68
         Integer selectUserCount = taPersonMapper.selectUserCount(orgId);
@@ -165,7 +165,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
165 165
                 result.put("data_count", selectBuildingStatisticalSave);
166 166
                 break;
167 167
             case CommConstant.BUILDING_SHARE:
168
-                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical(orgId,"share");
168
+                Map<String, Object> selectBuildingStatisticalShare = taBuildingMapper.selectBuildingStatistical(orgId, "share");
169 169
                 result.put("data_count", selectBuildingStatisticalShare);
170 170
                 break;
171 171
             case CommConstant.ACTIVITY_SAVE:
@@ -217,7 +217,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
217 217
 
218 218
         // 用户来源饼状
219 219
         // 来源置业顾问, 来源客户,其他
220
-        Integer total = taPersonMapper.selectFromNum(orgId, null) ;
220
+        Integer total = taPersonMapper.selectFromNum(orgId, null);
221 221
         Integer person_realty_consultant = taPersonMapper.selectFromNum(orgId, CommConstant.PERSON_REALTY_CONSULTANT);
222 222
         Integer person_estate_agent = taPersonMapper.selectFromNum(orgId, CommConstant.PERSON_ESTATE_CUSTOMER);
223 223
         Integer person_null = total - person_realty_consultant - person_estate_agent;
@@ -230,7 +230,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
230 230
         List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(orgId, CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
231 231
 
232 232
         Map<String, Object> result = new HashMap<>();
233
-        result.put("columnar", new ArrayList<Map<String,Object>>());
233
+        result.put("columnar", new ArrayList<Map<String, Object>>());
234 234
         result.put("pie", map);
235 235
         result.put("data", selectUserSourceData);
236 236
 
@@ -309,11 +309,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
309 309
     }
310 310
 
311 311
     @Override
312
-    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId) {
312
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, Integer userId) {
313 313
         ResponseBean responseBean = new ResponseBean();
314 314
 
315
-        IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
316
-        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId);
315
+        IPage<Map<String, Object>> pg = new Page<>(pageNum, pageSize);
316
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId, userId);
317 317
 
318 318
         responseBean.addSuccess(page);
319 319
         return responseBean;
@@ -330,7 +330,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
330 330
     @Override
331 331
     public ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate) {
332 332
         ResponseBean responseBean = new ResponseBean();
333
-        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId,startDate,endDate);
333
+        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId, startDate, endDate);
334 334
         QueryWrapper<TdWxDict> tdWxDictQueryWrapper = new QueryWrapper<>();
335 335
         tdWxDictQueryWrapper.groupBy("scene_type");
336 336
         List<TdWxDict> tdWxDicts = tdWxDictMapper.selectList(tdWxDictQueryWrapper);
@@ -340,10 +340,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
340 340
             e.setFromData(fromSum);
341 341
             e.setRegisterSum(registerSum);
342 342
         });
343
-        Map<String,Object> map = new HashMap<>();
344
-        map.put("tdWxDicts",tdWxDicts);
345
-        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId,startDate,endDate);
346
-        map.put("list",tableList);
343
+        Map<String, Object> map = new HashMap<>();
344
+        map.put("tdWxDicts", tdWxDicts);
345
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId, startDate, endDate);
346
+        map.put("list", tableList);
347 347
         responseBean.addSuccess(map);
348 348
         return responseBean;
349 349
     }
@@ -359,10 +359,10 @@ public class StatisticalServiceImpl implements IStatisticalService {
359 359
     @Override
360 360
     public ResponseBean selectPersonFromGroupByDay(Integer orgId, LocalDate startDate, LocalDate endDate) {
361 361
         List<TsPersonFromStatistic> dayList = getDayList(startDate, endDate);
362
-        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFromGroupByDay(orgId,startDate,endDate);
362
+        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFromGroupByDay(orgId, startDate, endDate);
363 363
         dayList.forEach(e -> {
364 364
             list.forEach(l -> {
365
-                if (e.getCreateTime().equals(l.getCreateTime())){
365
+                if (e.getCreateTime().equals(l.getCreateTime())) {
366 366
                     e.setFromNum(l.getFromNum());
367 367
                     e.setRegisteredNum(l.getRegisteredNum());
368 368
                 }
@@ -373,12 +373,13 @@ public class StatisticalServiceImpl implements IStatisticalService {
373 373
 
374 374
     /**
375 375
      * 返回时间区间格式
376
+     *
376 377
      * @param startDate
377 378
      * @param endDate
378 379
      * @return
379 380
      */
380 381
     private List<TsPersonFromStatistic> getDayList(LocalDate startDate, LocalDate endDate) {
381
-        if (null == startDate || null == endDate){
382
+        if (null == startDate || null == endDate) {
382 383
             endDate = LocalDate.now();
383 384
             startDate = LocalDate.now().plusDays(-7);
384 385
         }

+ 3
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml View File

@@ -31,6 +31,9 @@
31 31
                     AND tpir.org_id = #{orgId}
32 32
                     AND tp.org_id = #{orgId}
33 33
                 </if>
34
+                <if test="userId != null">
35
+                    AND tpir.building_id IN ( SELECT t3.building_id FROM ta_person_building t3 WHERE t3.user_id = #{userId} )
36
+                </if>
34 37
             </trim>
35 38
         GROUP BY
36 39
             tpir.person_id, tpir.building_id