소스 검색

Merge branch 'master' of http://git.ycjcjy.com/zhiyuxing/estateagents

张延森 5 년 전
부모
커밋
f90ff2e14e

+ 15
- 6
src/main/java/com/huiju/estateagents/controller/StatisticalController.java 파일 보기

@@ -61,12 +61,12 @@ public class StatisticalController {
61 61
      * @return
62 62
      */
63 63
     @GetMapping(value = "/admin/selectUserBehavior")
64
-    public ResponseBean selectUserBehavior(@RequestParam(required = false) Integer pageNum,
65
-                                           @RequestParam(required = false) Integer pageCode,
64
+    public ResponseBean selectUserBehavior(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
65
+                                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
66 66
                                            @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
67 67
                                            @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
68 68
                                            @RequestParam(value = "buildingId", required = false) String buildingId) {
69
-        return iStatisticalService.selectUserBehavior(pageNum, pageCode, startDate, endDate, buildingId);
69
+        return iStatisticalService.selectUserBehavior(pageNum, pageSize, startDate, endDate, buildingId);
70 70
     }
71 71
 
72 72
     /**
@@ -86,9 +86,8 @@ public class StatisticalController {
86 86
      */
87 87
     @GetMapping(value = "/admin/selectUserResource")
88 88
     public ResponseBean selectUserResource(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
89
-                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
90
-                                           @RequestParam(value = "registeredType", required = false) String registeredType) {
91
-        return iStatisticalService.selectUserResource(startDate, endDate, registeredType);
89
+                                           @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate) {
90
+        return iStatisticalService.selectUserResource(startDate, endDate);
92 91
     }
93 92
 
94 93
 
@@ -138,5 +137,15 @@ public class StatisticalController {
138 137
         return iStatisticalService.selectCityUser();
139 138
     }
140 139
 
140
+    /**
141
+     * 意向用户  首页
142
+     * @return
143
+     */
144
+    @GetMapping(value = "/admin/selectIntentionUser")
145
+    public ResponseBean selectIntentionUser(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
146
+                                            @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
147
+                                            @RequestParam(value = "buildingId", required = false) String buildingId) {
148
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, buildingId);
149
+    }
141 150
 
142 151
 }

+ 25
- 1
src/main/java/com/huiju/estateagents/controller/TaBuildingDynamicController.java 파일 보기

@@ -14,6 +14,7 @@ import com.huiju.estateagents.entity.*;
14 14
 import com.huiju.estateagents.mapper.TaActivityDynamicEnlistMapper;
15 15
 import com.huiju.estateagents.mapper.TaBuildingMapper;
16 16
 import com.huiju.estateagents.service.ITaBuildingDynamicService;
17
+import com.huiju.estateagents.service.ITaBuildingService;
17 18
 import com.huiju.estateagents.service.ITaPersonService;
18 19
 import com.huiju.estateagents.service.ITaSaveService;
19 20
 import org.springframework.beans.factory.annotation.Autowired;
@@ -56,6 +57,9 @@ public class TaBuildingDynamicController extends BaseController {
56 57
     @Autowired
57 58
     private ITaSaveService taSaveService;
58 59
 
60
+    @Autowired
61
+    private ITaBuildingService iTaBuildingService;
62
+
59 63
     @InitBinder
60 64
     protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
61 65
         DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@@ -192,6 +196,8 @@ public class TaBuildingDynamicController extends BaseController {
192 196
     public  ResponseBean buildingDynamicAdd(@RequestBody String parameter){
193 197
         ResponseBean responseBean = new ResponseBean();
194 198
         TaBuildingDynamic dynamic = JSONObject.parseObject(parameter, TaBuildingDynamic.class);
199
+        Integer cityId = iTaBuildingService.getCityById(dynamic.getBuildingId());
200
+        dynamic.setCityId(cityId);
195 201
         dynamic.setStatus(1);
196 202
 //        dynamic.setDynamicId(idGen.nextId()+"");
197 203
         dynamic.setPublishDate(LocalDateTime.now());
@@ -205,11 +211,28 @@ public class TaBuildingDynamicController extends BaseController {
205 211
         ResponseBean responseBean = new ResponseBean();
206 212
         TaBuildingDynamic dynamic = JSONObject.parseObject(parameter, TaBuildingDynamic.class);
207 213
         QueryWrapper<TaBuildingDynamic> buildingDynamicQueryWrapper = new QueryWrapper<>();
214
+        Integer cityId = iTaBuildingService.getCityById(dynamic.getBuildingId());
215
+        dynamic.setCityId(cityId);
208 216
         buildingDynamicQueryWrapper.eq("dynamic_id", dynamic.getDynamicId());
209 217
         iBuildingDynamicService.update(dynamic, buildingDynamicQueryWrapper);
210 218
         return responseBean;
211 219
     }
212 220
 
221
+    @RequestMapping(value = "/admin/buildingDynamic/weight" ,method =RequestMethod.PUT)
222
+    public  ResponseBean buildingDynamicWeight(@RequestParam String dynamicId,@RequestParam Integer weight){
223
+        ResponseBean responseBean = new ResponseBean();
224
+        TaBuildingDynamic dynamic = iBuildingDynamicService.getById(dynamicId);
225
+        dynamic.setWeight(weight);
226
+        QueryWrapper<TaBuildingDynamic> dynamicQueryWrapper = new QueryWrapper<>();
227
+        dynamicQueryWrapper.eq("dynamic_id",dynamic);
228
+        if (iBuildingDynamicService.updateById(dynamic)){
229
+            responseBean.addSuccess("成功");
230
+        }else {
231
+            responseBean.addError("失败");
232
+        }
233
+        return responseBean;
234
+    }
235
+
213 236
     @RequestMapping(value = "/admin/buildingDynamic/delete", method = RequestMethod.DELETE)
214 237
     public ResponseBean pageImdelect(@RequestParam(value = "id",required = false)String id) {
215 238
         ResponseBean responseBean = iBuildingDynamicService.buildingDynamicDelete(id);
@@ -290,5 +313,6 @@ public class TaBuildingDynamicController extends BaseController {
290 313
         responseBean.addSuccess("成功");
291 314
         return responseBean;
292 315
     }
293
-    }
316
+
317
+}
294 318
 

+ 8
- 0
src/main/java/com/huiju/estateagents/controller/TaNewsController.java 파일 보기

@@ -9,6 +9,7 @@ import com.huiju.estateagents.common.CommConstant;
9 9
 import com.huiju.estateagents.common.JWTUtils;
10 10
 import com.huiju.estateagents.entity.TaNews;
11 11
 import com.huiju.estateagents.entity.TaPerson;
12
+import com.huiju.estateagents.service.ITaBuildingService;
12 13
 import com.huiju.estateagents.service.ITaNewsService;
13 14
 import com.huiju.estateagents.service.ITaPersonService;
14 15
 import com.huiju.estateagents.service.ITaSaveService;
@@ -50,6 +51,9 @@ public class TaNewsController extends BaseController {
50 51
     @Autowired
51 52
     public ITaSaveService iTaSaveService;
52 53
 
54
+    @Autowired
55
+    public ITaBuildingService iTaBuildingService;
56
+
53 57
 
54 58
     /**
55 59
      * 分页查询列表
@@ -104,6 +108,8 @@ public class TaNewsController extends BaseController {
104 108
      */
105 109
     @RequestMapping(value="/admin/taNews",method= RequestMethod.POST)
106 110
     public ResponseBean taNewsAdd(@RequestBody TaNews taNews){
111
+        Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
112
+        taNews.setCityId(cityId);
107 113
         ResponseBean responseBean = iTaNewsService.addTaNews(taNews);
108 114
         return responseBean;
109 115
     }
@@ -129,6 +135,8 @@ public class TaNewsController extends BaseController {
129 135
     public ResponseBean taNewsUpdate(@PathVariable Integer id,
130 136
                                         @RequestBody TaNews taNews){
131 137
         taNews.setNewsId(id);
138
+        Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
139
+        taNews.setCityId(cityId);
132 140
         ResponseBean responseBean = iTaNewsService.updateTaNews(taNews);
133 141
         return responseBean;
134 142
     }

+ 2
- 0
src/main/java/com/huiju/estateagents/entity/TaBuildingDynamic.java 파일 보기

@@ -169,4 +169,6 @@ public class TaBuildingDynamic implements Serializable {
169 169
      * 活动报名人数
170 170
      */
171 171
     private Integer enlistNum;
172
+
173
+    private Integer weight;
172 174
 }

+ 10
- 0
src/main/java/com/huiju/estateagents/mapper/TaPersonIntentionRecordMapper.java 파일 보기

@@ -5,6 +5,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 5
 import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.huiju.estateagents.entity.TaPersonIntentionRecord;
7 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
9
+
10
+import java.util.Map;
8 11
 
9 12
 /**
10 13
  * <p>
@@ -20,4 +23,11 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
20 23
 
21 24
     IPage<TaPersonIntentionRecord> selectAll(IPage<TaPersonIntentionRecord> page);
22 25
 
26
+    /**
27
+     * 意向用户, 首页统计的 意向用户
28
+     * @param page
29
+     * @param buildingId
30
+     * @return
31
+     */
32
+    IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page, @Param("buildingId") String buildingId);
23 33
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/mapper/TaPersonMapper.java 파일 보기

@@ -145,7 +145,7 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
145 145
     /**
146 146
      * 用户来源 数据列表
147 147
      */
148
-    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate, @Param("registeredType") String registeredType);
148
+    List<Map<String,Object>> selectUserSourceData(@Param("personType") String personType, @Param("startDate")LocalDate startDate, @Param("endDate")LocalDate endDate);
149 149
 
150 150
     // ------------- 用户来源 end ------------
151 151
 

+ 7
- 1
src/main/java/com/huiju/estateagents/service/IStatisticalService.java 파일 보기

@@ -90,6 +90,12 @@ public interface IStatisticalService {
90 90
      * 用户来源 首页
91 91
      * @return
92 92
      */
93
-    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate, String registeredType);
93
+    ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate);
94 94
 
95
+    /**
96
+     * 意向用户 首页
97
+     * @param buildingId
98
+     * @return
99
+     */
100
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId);
95 101
 }

+ 15
- 2
src/main/java/com/huiju/estateagents/service/impl/StatisticalServiceImpl.java 파일 보기

@@ -41,6 +41,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
41 41
     @Autowired
42 42
     private TaNewsMapper taNewsMapper;
43 43
 
44
+    @Autowired
45
+    private TaPersonIntentionRecordMapper taPersonIntentionRecordMapper;
44 46
 
45 47
 
46 48
     @Override
@@ -242,7 +244,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
242 244
 
243 245
 
244 246
     @Override
245
-    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate, String registeredType) {
247
+    public ResponseBean selectUserResource(LocalDate startDate, LocalDate endDate) {
246 248
         ResponseBean responseBean = new ResponseBean();
247 249
         // 用户来源 柱状
248 250
         List<Map<String, Object>> mapList = taPersonMapper.selectUserSourceColumnar(CommConstant.PERSON_REALTY_CONSULTANT, startDate, endDate);
@@ -258,7 +260,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
258 260
         map.put("person_null", person_null);
259 261
 
260 262
         // 用户来源 数据列表
261
-        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate, registeredType);
263
+        List<Map<String, Object>> selectUserSourceData = taPersonMapper.selectUserSourceData(CommConstant.PERSON_ESTATE_AGENT, startDate, endDate);
262 264
 
263 265
         Map<String, Object> result = new HashMap<>();
264 266
         result.put("columnar", mapList);
@@ -338,4 +340,15 @@ public class StatisticalServiceImpl implements IStatisticalService {
338 340
         responseBean.addSuccess(map);
339 341
         return responseBean;
340 342
     }
343
+
344
+    @Override
345
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, String buildingId) {
346
+        ResponseBean responseBean = new ResponseBean();
347
+
348
+        IPage<Map<String,Object>> pg = new Page<>(pageNum, pageSize);
349
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, buildingId);
350
+
351
+        responseBean.addSuccess(page);
352
+        return responseBean;
353
+    }
341 354
 }

+ 1
- 1
src/main/java/com/huiju/estateagents/service/impl/TaBuildingDynamicServiceImpl.java 파일 보기

@@ -107,7 +107,7 @@ public class TaBuildingDynamicServiceImpl extends ServiceImpl<TaBuildingDynamicM
107 107
         QueryWrapper<TaBuildingDynamic> buildingDynamicQueryWrapper = new QueryWrapper<>();
108 108
         buildingDynamicQueryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id", buildingId);
109 109
         buildingDynamicQueryWrapper.eq("status", "1");
110
-        buildingDynamicQueryWrapper.orderByDesc("create_date");
110
+        buildingDynamicQueryWrapper.orderByDesc("weight","create_date");
111 111
         IPage<TaBuildingDynamic> buildingDynamicIPage = buildingDynamicMapper.selectPage(page, buildingDynamicQueryWrapper);
112 112
         List<TaBuildingDynamic> records = buildingDynamicIPage.getRecords();
113 113
         // 判断换当前列表活动状态—1:进行中(展示活动报名截止时间),2:未开始(展示活动报名时间),3:结束(不展示)

+ 18
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml 파일 보기

@@ -13,4 +13,22 @@
13 13
             GROUP BY tpir.person_id
14 14
     </select>
15 15
 
16
+
17
+    <select id="selectIntentionUser" resultType="map">
18
+        SELECT
19
+            tpir.person_name as  personName,
20
+            tp.phone as phone,
21
+            GROUP_CONCAT(tpir.building_name) as buildingName,
22
+            SUM(tpir.intention) as intention
23
+        FROM
24
+            ta_person_intention_record tpir
25
+            LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
26
+            <where>
27
+                <if test="buildingId != null and buildingId != ''">
28
+                    tpir.building_id = #{buildingId}
29
+                </if>
30
+            </where>
31
+        GROUP BY
32
+            tpir.person_id
33
+    </select>
16 34
 </mapper>

+ 71
- 45
src/main/resources/mapper/TaPersonMapper.xml 파일 보기

@@ -246,64 +246,72 @@ FROM
246 246
         SELECT
247 247
         authorization_count_table.date as date,
248 248
         ifnull(authorization_count_table.authorization_count, 0) as authorization_count,
249
-        user_count_table.user_count as user_count
249
+        ifnull(user_count_table.user_count, 0) as user_count
250 250
         FROM
251 251
         (
252 252
             SELECT
253
-              *
253
+            *
254 254
             FROM
255 255
             (
256
-                SELECT
257
-                DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
258
-                FROM
259
-                sequence a
260
-                WHERE
256
+            SELECT
257
+              DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
258
+            FROM
259
+              sequence a
260
+            WHERE
261
+
261 262
                 <if test="startDate == null or endDate == null">
262 263
                     a.rownum <![CDATA[ <= ]]> 7
263 264
                 </if>
264 265
                 <if test="startDate != null or endDate != null">
265 266
                     a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
266 267
                 </if>
268
+
267 269
             ) AS temp_date
268 270
             LEFT JOIN (
269 271
                 SELECT
270
-                COUNT(1) as authorization_count,
271
-                tpvr.visit_time AS visit_time
272
+                  COUNT(1) as authorization_count,
273
+                tp.create_date AS create_date
272 274
                 FROM
273
-                ta_person tp
274
-                INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
275
+                  ta_person tp
275 276
                 where ifnull(tp.person_type, '') != #{personType}
276
-                and tp.phone is NOT NULL
277
-            ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
277
+                  and tp.phone is NOT NULL
278
+                GROUP BY tp.create_date
279
+                ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
280
+
278 281
         ) as authorization_count_table
279 282
         ,
280
-        (SELECT
281
-        *
282
-        FROM
283 283
         (
284
+          SELECT
285
+            *
286
+            FROM
287
+            (
284 288
             SELECT
285
-            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
289
+             DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date
286 290
             FROM
287
-            sequence a
291
+              sequence a
288 292
             WHERE
289
-            <if test="startDate == null or endDate == null">
290
-                a.rownum <![CDATA[ <= ]]> 7
291
-            </if>
292
-            <if test="startDate != null or endDate != null">
293
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
294
-            </if>
293
+
294
+                <if test="startDate == null or endDate == null">
295
+                    a.rownum <![CDATA[ <= ]]> 7
296
+                </if>
297
+                <if test="startDate != null or endDate != null">
298
+                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
299
+                </if>
300
+
295 301
         ) AS temp_date
296 302
         LEFT JOIN (
297 303
             SELECT
298
-            COUNT(1) as user_count,
299
-            tpvr.visit_time AS visit_time
304
+              COUNT(1) as user_count,
305
+            tp.create_date AS create_date
300 306
             FROM
301
-            ta_person tp
302
-            INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
307
+                ta_person tp
303 308
             where ifnull(tp.person_type, '') != #{personType}
304
-        ) AS temp ON temp_date.date = DATE_FORMAT( temp.visit_time , '%Y-%m-%d' )
309
+            GROUP BY tp.create_date
310
+            ) AS temp ON temp_date.date = DATE_FORMAT( temp.create_date , '%Y-%m-%d' )
305 311
 
306 312
         ) as user_count_table
313
+        where
314
+          user_count_table.date = authorization_count_table.date
307 315
         GROUP BY date
308 316
     </select>
309 317
 
@@ -358,29 +366,32 @@ FROM
358 366
     </select>
359 367
 
360 368
     <select id="selectUserSourceData" resultType="map">
369
+
361 370
         select
362 371
             temp_date.date AS date,
363 372
             temp_date.from_name as from_name,
364 373
             temp_date.from_code as from_code,
365 374
             IFNULL(user_count.count, 0) as count,
375
+            IFNULL(registered_count.count,0) as registered,
366 376
             user_count.create_date as create_date
367 377
         FROM
368 378
         (
369 379
             SELECT
370
-                DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
371
-                tempf.from_name as from_name,
372
-                tempf.from_code as from_code
380
+            DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
381
+            tempf.from_name as from_name,
382
+            tempf.from_code as from_code
373 383
             FROM
374
-                sequence a
375
-                ,
376
-                td_person_from tempf
384
+            sequence a
385
+            ,
386
+            td_person_from tempf
377 387
             WHERE
378
-            <if test="startDate == null or endDate == null">
379
-                a.rownum <![CDATA[ <= ]]> 7
380
-            </if>
381
-            <if test="startDate != null or endDate != null">
382
-                a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
383
-            </if>
388
+
389
+                <if test="startDate == null or endDate == null">
390
+                    a.rownum <![CDATA[ <= ]]> 7
391
+                </if>
392
+                <if test="startDate != null or endDate != null">
393
+                    a.rownum <![CDATA[ <= ]]> datediff(#{endDate}, #{startDate})
394
+                </if>
384 395
 
385 396
         ) AS temp_date
386 397
 
@@ -395,13 +406,28 @@ FROM
395 406
             LEFT JOIN td_person_from tpfs
396 407
             ON tps.from_code = tpfs.from_code
397 408
             WHERE tpfs.from_code = tps.from_code
398
-            and ifnull(tps.person_type, '') != #{personType}
399
-            <if test="registeredType == 'registered' and registeredType != ''">
400
-                and tps.phone is not null
401
-            </if>
409
+            and ifnull(tps.person_type, '') != 'Realty Consultant'
410
+
402 411
             GROUP BY tpfs.from_code
403 412
         ) as user_count
404 413
         ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') =  temp_date.date and temp_date.from_code = user_count.from_code
414
+        LEFT JOIN
415
+        (
416
+            SELECT
417
+                ifnull(COUNT(1), 0) as count,
418
+                tps.create_date as create_date,
419
+                tpfs.from_code as from_code,
420
+                tpfs.from_name as from_name
421
+            FROM ta_person tps
422
+            LEFT JOIN td_person_from tpfs
423
+            ON tps.from_code = tpfs.from_code
424
+            WHERE tpfs.from_code = tps.from_code
425
+                and ifnull(tps.person_type, '') != 'Realty Consultant'
426
+                and tps.phone is not null
427
+            GROUP BY tpfs.from_code
428
+        ) as registered_count
429
+        ON DATE_FORMAT(user_count.create_date,'%Y-%m-%d') =  temp_date.date and temp_date.from_code = registered_count.from_code
430
+        order by temp_date.date DESC
405 431
     </select>
406 432
 
407 433
 </mapper>