瀏覽代碼

fix log4j

Your Name 3 年之前
父節點
當前提交
7b374f30e6
共有 100 個檔案被更改,包括 13089 行新增11410 行删除
  1. 1
    1
      pom.xml
  2. 6
    2
      src/main/java/com/yunzhi/marketing/base/BaseController.java
  3. 598
    598
      src/main/java/com/yunzhi/marketing/center/taUser/controller/TaUserController.java
  4. 2
    2
      src/main/java/com/yunzhi/marketing/common/CommConstant.java
  5. 2
    1
      src/main/java/com/yunzhi/marketing/common/JWTUtils.java
  6. 11
    0
      src/main/java/com/yunzhi/marketing/controller/ExtendContentController.java
  7. 6
    6
      src/main/java/com/yunzhi/marketing/controller/StatisticalController.java
  8. 74
    19
      src/main/java/com/yunzhi/marketing/controller/TaBuildingController.java
  9. 9
    2
      src/main/java/com/yunzhi/marketing/controller/TaBuildingPanoramaController.java
  10. 30
    1
      src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java
  11. 11
    5
      src/main/java/com/yunzhi/marketing/controller/TaNewsController.java
  12. 74
    0
      src/main/java/com/yunzhi/marketing/controller/TaOrgCityController.java
  13. 831
    820
      src/main/java/com/yunzhi/marketing/controller/TaPersonController.java
  14. 10
    2
      src/main/java/com/yunzhi/marketing/controller/TaPolicyController.java
  15. 6
    1
      src/main/java/com/yunzhi/marketing/controller/TaPosterController.java
  16. 1130
    1129
      src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java
  17. 6
    1
      src/main/java/com/yunzhi/marketing/controller/TaShareContentController.java
  18. 5
    0
      src/main/java/com/yunzhi/marketing/dto/AverageReportDTO.java
  19. 40
    0
      src/main/java/com/yunzhi/marketing/dto/TaOrgCityDTO.java
  20. 6
    0
      src/main/java/com/yunzhi/marketing/entity/TaLiveActivity.java
  21. 2
    2
      src/main/java/com/yunzhi/marketing/excel/StatsBuilding.java
  22. 73
    0
      src/main/java/com/yunzhi/marketing/excel/searchHouse/AddedValue.java
  23. 84
    0
      src/main/java/com/yunzhi/marketing/excel/searchHouse/BuyRoom.java
  24. 48
    0
      src/main/java/com/yunzhi/marketing/excel/searchHouse/Overseas.java
  25. 56
    0
      src/main/java/com/yunzhi/marketing/excel/searchHouse/Rent.java
  26. 265
    265
      src/main/java/com/yunzhi/marketing/interceptor/AccessInterceptor.java
  27. 2
    1
      src/main/java/com/yunzhi/marketing/job/CustomerTimeJob.java
  28. 2
    2
      src/main/java/com/yunzhi/marketing/mapper/TaBuildingMapper.java
  29. 3
    2
      src/main/java/com/yunzhi/marketing/mapper/TaLiveActivityMapper.java
  30. 2
    1
      src/main/java/com/yunzhi/marketing/mapper/TaPersonIntentionRecordMapper.java
  31. 2
    0
      src/main/java/com/yunzhi/marketing/mapper/TaPersonMapper.java
  32. 1
    1
      src/main/java/com/yunzhi/marketing/mapper/TaRecommendCustomerMapper.java
  33. 2
    0
      src/main/java/com/yunzhi/marketing/po/TaRecommendCustomerPO.java
  34. 5
    5
      src/main/java/com/yunzhi/marketing/service/IStatisticalService.java
  35. 2
    2
      src/main/java/com/yunzhi/marketing/service/ITaLiveActivityService.java
  36. 1
    1
      src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java
  37. 11
    11
      src/main/java/com/yunzhi/marketing/service/impl/StatisticalServiceImpl.java
  38. 502
    502
      src/main/java/com/yunzhi/marketing/service/impl/TaBuildingDynamicServiceImpl.java
  39. 1320
    1320
      src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java
  40. 3
    3
      src/main/java/com/yunzhi/marketing/service/impl/TaLiveActivityServiceImpl.java
  41. 235
    235
      src/main/java/com/yunzhi/marketing/service/impl/TaNewsServiceImpl.java
  42. 4
    2
      src/main/java/com/yunzhi/marketing/service/impl/TaPersonFromRecordServiceImpl.java
  43. 2
    1
      src/main/java/com/yunzhi/marketing/service/impl/TaPersonServiceImpl.java
  44. 25
    26
      src/main/java/com/yunzhi/marketing/service/impl/TaPersonVisitRecordServiceImpl.java
  45. 1761
    1741
      src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java
  46. 1
    1
      src/main/java/com/yunzhi/marketing/statistic/controller/TsUserBehaviorStatisticController.java
  47. 5
    0
      src/main/java/com/yunzhi/marketing/statistic/entity/TsPersonFromStatistic.java
  48. 4
    1
      src/main/java/com/yunzhi/marketing/statistic/entity/TsUserBehaviorStatistic.java
  49. 3
    3
      src/main/java/com/yunzhi/marketing/statistic/mapper/TsPersonFromStatisticMapper.java
  50. 1
    1
      src/main/java/com/yunzhi/marketing/statistic/mapper/TsUserBehaviorStatisticMapper.java
  51. 2
    1
      src/main/java/com/yunzhi/marketing/statistic/service/ITsUserBehaviorStatisticService.java
  52. 2
    2
      src/main/java/com/yunzhi/marketing/statistic/service/impl/TsUserBehaviorStatisticServiceImpl.java
  53. 5
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/BuildingChannelController.java
  54. 7
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/BuildingSpecialRoomController.java
  55. 23
    12
      src/main/java/com/yunzhi/marketing/xlk/controller/CustomerInfoController.java
  56. 9
    8
      src/main/java/com/yunzhi/marketing/xlk/controller/CustomerSignatoryController.java
  57. 1
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/PcIndexStatisticsController.java
  58. 153
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/SceneLogController.java
  59. 118
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/SearchHouseController.java
  60. 7
    0
      src/main/java/com/yunzhi/marketing/xlk/controller/TrendController.java
  61. 31
    1
      src/main/java/com/yunzhi/marketing/xlk/controller/VideoController.java
  62. 2
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/CustomerPreparatory.java
  63. 2
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/CustomerSignatory.java
  64. 2
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/CustomerVisit.java
  65. 66
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/SceneLog.java
  66. 5
    0
      src/main/java/com/yunzhi/marketing/xlk/entity/Video.java
  67. 5
    0
      src/main/java/com/yunzhi/marketing/xlk/mapper/CustomerSignatoryMapper.java
  68. 28
    0
      src/main/java/com/yunzhi/marketing/xlk/mapper/SceneLogMapper.java
  69. 3
    0
      src/main/java/com/yunzhi/marketing/xlk/mapper/SearchHouseMapper.java
  70. 3
    0
      src/main/java/com/yunzhi/marketing/xlk/service/ICustomerSignatoryService.java
  71. 23
    0
      src/main/java/com/yunzhi/marketing/xlk/service/ISceneLogService.java
  72. 8
    0
      src/main/java/com/yunzhi/marketing/xlk/service/ISearchHouseService.java
  73. 6
    1
      src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java
  74. 48
    1
      src/main/java/com/yunzhi/marketing/xlk/service/impl/CustomerInfoServiceImpl.java
  75. 6
    0
      src/main/java/com/yunzhi/marketing/xlk/service/impl/CustomerSignatoryServiceImpl.java
  76. 9
    0
      src/main/java/com/yunzhi/marketing/xlk/service/impl/IPcStatisticsServiceimpl.java
  77. 1
    1
      src/main/java/com/yunzhi/marketing/xlk/service/impl/InstitutionServiceImpl.java
  78. 54
    0
      src/main/java/com/yunzhi/marketing/xlk/service/impl/SceneLogServiceImpl.java
  79. 67
    0
      src/main/java/com/yunzhi/marketing/xlk/service/impl/SearchHouseServiceImpl.java
  80. 41
    0
      src/main/java/com/yunzhi/marketing/xlk/vo/BuildingLogVO.java
  81. 101
    0
      src/main/java/com/yunzhi/marketing/xlk/vo/CustomerSignatoryVO.java
  82. 196
    0
      src/main/java/com/yunzhi/marketing/xlk/vo/ExportSearchHouseVO.java
  83. 17
    0
      src/main/java/com/yunzhi/marketing/xlk/vo/QuestionnaireVO.java
  84. 3
    3
      src/main/resources/application-prod.yml
  85. 2
    1
      src/main/resources/mapper/TaBuildingDynamicMapper.xml
  86. 889
    851
      src/main/resources/mapper/TaBuildingMapper.xml
  87. 20
    28
      src/main/resources/mapper/TaChannelMapper.xml
  88. 17
    4
      src/main/resources/mapper/TaLiveActivityMapper.xml
  89. 7
    0
      src/main/resources/mapper/TaPersonIntentionRecordMapper.xml
  90. 747
    738
      src/main/resources/mapper/TaPersonMapper.xml
  91. 459
    455
      src/main/resources/mapper/TaPersonVisitRecordMapper.xml
  92. 27
    18
      src/main/resources/mapper/TaRecommendCustomerMapper.xml
  93. 17
    21
      src/main/resources/mapper/TsConsultantKpiMapper.xml
  94. 2470
    2492
      src/main/resources/mapper/statistic/TaActivityStaticMapper.xml
  95. 24
    16
      src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml
  96. 17
    12
      src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml
  97. 20
    3
      src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml
  98. 32
    21
      src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml
  99. 2
    1
      src/main/resources/mapper/xlk/BuildingChannelMapper.xml
  100. 0
    0
      src/main/resources/mapper/xlk/ChannelCustomerMapper.xml

+ 1
- 1
pom.xml 查看文件

@@ -10,7 +10,7 @@
10 10
 	</parent>
11 11
 	<groupId>com.yunzhi</groupId>
12 12
 	<artifactId>marketing</artifactId>
13
-	<version>v1.0.24</version>
13
+	<version>v1.0.39</version>
14 14
 	<name>marketing-cloud</name>
15 15
 	<description>新联康营销云</description>
16 16
 

+ 6
- 2
src/main/java/com/yunzhi/marketing/base/BaseController.java 查看文件

@@ -117,7 +117,7 @@ public class BaseController {
117 117
     public String getInstitutionId(String buildingId) {
118 118
         TaBuilding building = taBuildingService.getById(buildingId);
119 119
         if (null == building){
120
-            return "01";
120
+            return "1";
121 121
         }
122 122
         return building.getInstitutionId();
123 123
     }
@@ -131,7 +131,11 @@ public class BaseController {
131 131
     public List<String> getInstitutionIds(HttpServletRequest request) {
132 132
         TaUser taUser = taUserService.getById(getUserId(request));
133 133
         List<Institution> list = iInstitutionService.getAllByUser(taUser);
134
-        return list.stream().map(Institution::getInstitutionId).collect(Collectors.toList());
134
+        List<String> institutions = list.stream().map(Institution::getInstitutionId).collect(Collectors.toList());
135
+        if (institutions.contains("01")) {
136
+            return null;
137
+        }
138
+        return institutions;
135 139
     }
136 140
 
137 141
     /**

+ 598
- 598
src/main/java/com/yunzhi/marketing/center/taUser/controller/TaUserController.java
文件差異過大導致無法顯示
查看文件


+ 2
- 2
src/main/java/com/yunzhi/marketing/common/CommConstant.java 查看文件

@@ -459,8 +459,8 @@ public class CommConstant {
459 459
     //分享活动
460 460
     public static final Object GROUP_ACTIVITY = "groupActivity";
461 461
     public static final String TARGET_TYPE_H5 = "H5";
462
-    public static final String ACTIVITY_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/checkin/index\"}";
463
-    public static final String LIVE_ACTIVITY_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"onlineSelling/pages/live/index\"}";
462
+    public static final String ACTIVITY_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/index/activityDetail/index\"}";
463
+    public static final String LIVE_ACTIVITY_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/video/liveDetail/index\"}";
464 464
     public static final String DRAINAGE_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"pages/project/h5Page\"}";
465 465
     public static final String HOUSE_QRCODE = "{\"scene\":\"id=#0&type=#1\",\"page\":\"onlineSelling/pages/houseList/index\"}";
466 466
 

+ 2
- 1
src/main/java/com/yunzhi/marketing/common/JWTUtils.java 查看文件

@@ -97,7 +97,8 @@ public class JWTUtils {
97 97
         // 有效期 7 天
98 98
         Calendar calendar = Calendar.getInstance();
99 99
         calendar.setTime(new Date());
100
-        calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+7);
100
+        calendar.add(Calendar.DAY_OF_WEEK, 2);
101
+//        calendar.set(Calendar.DAY_OF_MONTH,calendar.get(Calendar.DAY_OF_MONTH)+7);
101 102
 
102 103
         return Jwts.builder().setClaims(subject).setExpiration(calendar.getTime()).signWith(key).compact();
103 104
     }

+ 11
- 0
src/main/java/com/yunzhi/marketing/controller/ExtendContentController.java 查看文件

@@ -236,7 +236,18 @@ public class ExtendContentController extends BaseController {
236 236
     @RequestMapping(value="/admin/extendContent/{id}",method= RequestMethod.PUT)
237 237
     public ResponseBean extendContentUpdate(@PathVariable Integer id,
238 238
                                         @RequestBody ExtendContent extendContent,HttpServletRequest request){
239
+
239 240
         ResponseBean responseBean = new ResponseBean();
241
+        ExtendContent origin = iExtendContentService.getById(id);
242
+        if (null == origin) {
243
+            responseBean.addError("未找到更新内容");
244
+            return responseBean;
245
+        }
246
+
247
+        if (null == extendContent.getStatus()) {
248
+            extendContent.setStatus(origin.getStatus());
249
+        }
250
+
240 251
         extendContent.setContentId(id);
241 252
         try {
242 253
             if (extendContent.getCityId() == null){

+ 6
- 6
src/main/java/com/yunzhi/marketing/controller/StatisticalController.java 查看文件

@@ -77,7 +77,7 @@ public class StatisticalController extends BaseController {
77 77
     public ResponseBean changeNewsUserCount(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
78 78
                                             @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)  LocalDate endDate,
79 79
                                             HttpServletRequest request) {
80
-        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate);
80
+        return iStatisticalService.changeNewsUserCount(getOrgId(request), startDate, endDate,null);
81 81
     }
82 82
 
83 83
     /**
@@ -198,7 +198,7 @@ public class StatisticalController extends BaseController {
198 198
                                             @RequestParam(value = "pageSize", defaultValue = "2") Integer pageSize,
199 199
                                             @RequestParam(value = "buildingId", required = false) String buildingId,
200 200
                                             HttpServletRequest request) {
201
-        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request));
201
+        return iStatisticalService.selectIntentionUser(pageNum, pageSize, getOrgId(request), buildingId, getTaPersonBuildingListByUserId(request), getInstitutionIds(request));
202 202
     }
203 203
 
204 204
     /**
@@ -228,7 +228,7 @@ public class StatisticalController extends BaseController {
228 228
     public ResponseBean selectPersonFrom(@RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate startDate,
229 229
                                          @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) LocalDate endDate,
230 230
                                             HttpServletRequest request) {
231
-        return iStatisticalService.selectPersonFrom(getOrgId(request), startDate,endDate);
231
+        return iStatisticalService.selectPersonFrom(getOrgId(request), startDate,endDate,null);
232 232
     }
233 233
 
234 234
     /**
@@ -267,7 +267,7 @@ public class StatisticalController extends BaseController {
267 267
                                                 @RequestParam(value = "sortField", required = false) String sortField,
268 268
                                                 @RequestParam(value = "sortOrder", required = false) String sortOrder,
269 269
                                                 HttpServletRequest request) {
270
-        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder);
270
+        return iStatisticalService.getStatsTableList(pageNum,pageSize,getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),sortField,sortOrder,getInstitutionIds(request));
271 271
     }
272 272
 
273 273
     /**
@@ -285,7 +285,7 @@ public class StatisticalController extends BaseController {
285 285
         ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), StatsBuilding.class).registerWriteHandler(new CustomCellWriteHandler()).build();
286 286
         // 设置 sheet, 同一个sheet只需要设置一次
287 287
         WriteSheet writeSheet = EasyExcel.writerSheet("项目统计").build();
288
-        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request));
288
+        List<StatsBuilding> list = iStatisticalService.getExportTableList(getOrgId(request), startDate, endDate,buildingId, getTaPersonBuildingListByUserId(request),getInstitutionIds(request));
289 289
         excelWriter.write(list, writeSheet);
290 290
         // finish 会帮忙关闭流
291 291
         excelWriter.finish();
@@ -354,7 +354,7 @@ public class StatisticalController extends BaseController {
354 354
         response.setContentType("application/octet-stream");
355 355
         response.setCharacterEncoding("utf-8");
356 356
         response.setHeader("Content-disposition", "attachment;filename=新增用户.xlsx");
357
-        ResponseBean responseBean = iStatisticalService.selectPersonFrom(getOrgId(request), startDate, endDate);
357
+        ResponseBean responseBean = iStatisticalService.selectPersonFrom(getOrgId(request), startDate, endDate,getInstitutionIds(request));
358 358
         List<List<String>> headerList = headerList(responseBean.getData());
359 359
         List<List<String>> dataList = dataList(responseBean.getData(),userType);
360 360
         EasyExcel.write(response.getOutputStream()).head(headerList).sheet("新增用户").doWrite(dataList);

+ 74
- 19
src/main/java/com/yunzhi/marketing/controller/TaBuildingController.java 查看文件

@@ -1,15 +1,15 @@
1 1
 package com.yunzhi.marketing.controller;
2 2
 
3 3
 
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 6
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 7
 import com.yunzhi.marketing.base.BaseController;
6 8
 import com.yunzhi.marketing.base.ResponseBean;
7 9
 import com.yunzhi.marketing.common.CommConstant;
8 10
 import com.yunzhi.marketing.common.StringUtils;
9
-import com.yunzhi.marketing.entity.TaBuilding;
10
-import com.yunzhi.marketing.entity.TaOrg;
11
-import com.yunzhi.marketing.entity.TaPerson;
12
-import com.yunzhi.marketing.entity.TaPersonBuilding;
11
+import com.yunzhi.marketing.entity.*;
12
+import com.yunzhi.marketing.mapper.TaBuildingApartmentMapper;
13 13
 import com.yunzhi.marketing.mapper.TaBuildingMapper;
14 14
 import com.yunzhi.marketing.mapper.TaOrgMapper;
15 15
 import com.yunzhi.marketing.reportCustomerAop.ReportCustomer;
@@ -17,6 +17,7 @@ import com.yunzhi.marketing.service.ITaBuildingService;
17 17
 import com.yunzhi.marketing.service.ITaPersonBuildingService;
18 18
 import com.yunzhi.marketing.service.ITaPersonService;
19 19
 import com.yunzhi.marketing.service.ITaSaveService;
20
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
20 21
 import io.swagger.annotations.Api;
21 22
 import io.swagger.annotations.ApiImplicitParam;
22 23
 import io.swagger.annotations.ApiImplicitParams;
@@ -62,6 +63,11 @@ public class TaBuildingController extends BaseController {
62 63
     @Autowired
63 64
     ITaPersonBuildingService taPersonBuildingService;
64 65
 
66
+    @Autowired
67
+    private ISceneLogService iSceneLogService;
68
+
69
+    @Autowired
70
+    TaBuildingApartmentMapper taBuildingApartmentMapper;
65 71
 
66 72
     /**
67 73
      * 楼盘详情
@@ -160,7 +166,27 @@ public class TaBuildingController extends BaseController {
160 166
     })
161 167
     @PutMapping("/admin/building/update")
162 168
     public ResponseBean buildingUpdate(@RequestBody String parameter, HttpServletRequest request) {
163
-        return taBuildingService.buildingUpdate(parameter, getOrgId(request));
169
+        ResponseBean responseBean = taBuildingService.buildingUpdate(parameter, getOrgId(request));
170
+        JSONObject object = JSONObject.parseObject(parameter);
171
+        TaBuilding building = object.toJavaObject(TaBuilding.class);
172
+        iSceneLogService.saveLogs(getUserId(request),"building",building.getBuildingId());
173
+        return responseBean;
174
+    }
175
+
176
+    /**
177
+     * 获取项目更新日志
178
+     */
179
+    @ApiOperation(value = "获取项目更新日志", notes = "获取项目更新日志")
180
+    @ApiImplicitParams({
181
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageNum", value = "第几页"),
182
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageSize", value = "一页多少行"),
183
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "buildingId", value = "项目id"),
184
+    })
185
+    @GetMapping("/admin/building/logs")
186
+    public ResponseBean buildingUpdate(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
187
+                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
188
+                                       @RequestParam(value = "buildingId", required = false) String buildingId, HttpServletRequest request) {
189
+        return iSceneLogService.getBuildingLogs(pageNum,pageSize,buildingId, getTaPersonBuildingListByUserId(request), getInstitutionIds(request));
164 190
     }
165 191
 
166 192
     /**
@@ -175,7 +201,11 @@ public class TaBuildingController extends BaseController {
175 201
     })
176 202
     @RequestMapping(value = "/admin/building/add", method = RequestMethod.POST)
177 203
     public ResponseBean buildingAdd(@RequestBody String parameter, HttpServletRequest request) {
178
-        return taBuildingService.buildingAdd(parameter, getOrgId(request), getUserId(request));
204
+        ResponseBean responseBean = taBuildingService.buildingAdd(parameter, getOrgId(request), getUserId(request));
205
+        JSONObject object = JSONObject.parseObject(parameter);
206
+        TaBuilding building = object.toJavaObject(TaBuilding.class);
207
+        iSceneLogService.saveLogs(getUserId(request),"building",building.getBuildingId());
208
+        return responseBean;
179 209
     }
180 210
 
181 211
     /**
@@ -190,7 +220,11 @@ public class TaBuildingController extends BaseController {
190 220
     })
191 221
     @RequestMapping(value = "/admin/building/update/status", method = RequestMethod.PUT)
192 222
     public ResponseBean buildingUpdateStatus(@RequestBody String parameter, HttpServletRequest request) {
193
-        return taBuildingService.buildingUpdateStatus(parameter, getOrgId(request));
223
+        ResponseBean responseBean = taBuildingService.buildingUpdateStatus(parameter, getOrgId(request));
224
+        JSONObject jsonobject = JSONObject.parseObject(parameter);
225
+        String id = jsonobject.getString("id");
226
+        iSceneLogService.saveLogs(getUserId(request),"building",id);
227
+        return responseBean;
194 228
     }
195 229
 
196 230
     /**
@@ -206,7 +240,9 @@ public class TaBuildingController extends BaseController {
206 240
     })
207 241
     @RequestMapping(value = "/admin/building/delete/{id}", method = RequestMethod.DELETE)
208 242
     public ResponseBean buildingdelete(@PathVariable("id") String id, HttpServletRequest request) {
209
-        return taBuildingService.buildingdelete(id, getOrgId(request));
243
+        ResponseBean buildingdelete = taBuildingService.buildingdelete(id, getOrgId(request));
244
+        iSceneLogService.saveLogs(getUserId(request),"building",id);
245
+        return buildingdelete;
210 246
     }
211 247
 
212 248
     /**
@@ -218,8 +254,11 @@ public class TaBuildingController extends BaseController {
218 254
      */
219 255
     @ApiOperation(value = "添加户型", notes = "添加户型")
220 256
     @RequestMapping(value = "/admin/buildingApartment/add", method = RequestMethod.POST)
221
-    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session) {
222
-        return taBuildingService.buildingApartmentAdd(parameter);
257
+    public ResponseBean buildingApartment(@RequestBody String parameter, HttpSession session,HttpServletRequest request) {
258
+        ResponseBean responseBean = taBuildingService.buildingApartmentAdd(parameter);
259
+        TaBuildingApartment building = JSONObject.parseObject(parameter, TaBuildingApartment.class);
260
+        iSceneLogService.saveLogs(getUserId(request),"apartment",building.getBuildingId());
261
+        return responseBean;
223 262
     }
224 263
 
225 264
     /**
@@ -230,8 +269,11 @@ public class TaBuildingController extends BaseController {
230 269
      */
231 270
     @ApiOperation(value = "户型编辑", notes = "户型编辑")
232 271
     @RequestMapping(value = "/admin/buildingApartment/update", method = RequestMethod.PUT)
233
-    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter) {
234
-        return taBuildingService.buildingApartmentUpdate(parameter);
272
+    public ResponseBean buildingApartmentUpdate(@RequestBody String parameter,HttpServletRequest request) {
273
+        ResponseBean responseBean = taBuildingService.buildingApartmentUpdate(parameter);
274
+        TaBuildingApartment building = JSONObject.parseObject(parameter, TaBuildingApartment.class);
275
+        iSceneLogService.saveLogs(getUserId(request),"apartment",building.getBuildingId());
276
+        return responseBean;
235 277
     }
236 278
 
237 279
     /**
@@ -400,8 +442,13 @@ public class TaBuildingController extends BaseController {
400 442
      * @return
401 443
      */
402 444
     @RequestMapping(value = "/admin/apartment/deleted/{id}", method = RequestMethod.DELETE)
403
-    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id) {
404
-        return taBuildingService.apartmentDel(id);
445
+    public ResponseBean apartmentDeleted(@PathVariable(value = "id") String id,HttpServletRequest request) {
446
+        ResponseBean responseBean = taBuildingService.apartmentDel(id);
447
+        QueryWrapper<TaBuildingApartment> buildingApartmentQueryWrapper = new QueryWrapper<>();
448
+        buildingApartmentQueryWrapper.eq("apartment_id", id);
449
+        TaBuildingApartment buildingApartment = taBuildingApartmentMapper.selectOne(buildingApartmentQueryWrapper);
450
+        iSceneLogService.saveLogs(getUserId(request),"apartment",buildingApartment.getBuildingId());
451
+        return responseBean;
405 452
     }
406 453
 
407 454
     /**
@@ -463,16 +510,24 @@ public class TaBuildingController extends BaseController {
463 510
 
464 511
     @ApiOperation(value = "admin - 解绑驻场人员", notes = "admin - 解绑驻场人员")
465 512
     @DeleteMapping(value = "/admin/marketing/{id}")
466
-    public  ResponseBean buildingDynamicFinish(@PathVariable String id) {
513
+    public  ResponseBean buildingDynamicFinish(@PathVariable String id,HttpServletRequest request) {
467 514
         ResponseBean responseBean = new ResponseBean();
468 515
         TaPersonBuilding taPersonBuilding = taPersonBuildingService.getById(id);
469 516
 
470 517
         boolean state = taPersonBuildingService.removeById(id);
471 518
         if (state) {
472
-            TaPerson taPerson = iTaPersonService.getById(taPersonBuilding.getPersonId());
473
-            // 成为驻场顾问并绑定楼盘
474
-            taPerson.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
475
-            iTaPersonService.updateById(taPerson);
519
+            // 查询下是否还有其他的楼盘驻场
520
+            LambdaQueryWrapper<TaPersonBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
521
+            lambdaQueryWrapper.eq(TaPersonBuilding::getPersonId,taPersonBuilding.getPersonId());
522
+            List<TaPersonBuilding> list = taPersonBuildingService.list(lambdaQueryWrapper);
523
+            if (list.size() < 1) {
524
+                TaPerson taPerson = iTaPersonService.getById(taPersonBuilding.getPersonId());
525
+                // 成为驻场顾问并绑定楼盘
526
+                taPerson.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
527
+                iTaPersonService.updateById(taPerson);
528
+                iSceneLogService.saveLogs(getUserId(request),"marketing",taPersonBuilding.getBuildingId());
529
+            }
530
+
476 531
             responseBean.addSuccess("解绑成功");
477 532
         }else {
478 533
             responseBean.addError("请检查是否存在驻场人员");

+ 9
- 2
src/main/java/com/yunzhi/marketing/controller/TaBuildingPanoramaController.java 查看文件

@@ -8,6 +8,7 @@ import com.yunzhi.marketing.entity.TaBuildingApartment;
8 8
 import com.yunzhi.marketing.entity.TaBuildingPanorama;
9 9
 import com.yunzhi.marketing.service.ITaBuildingApartmentService;
10 10
 import com.yunzhi.marketing.service.ITaBuildingPanoramaService;
11
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
11 12
 import org.slf4j.Logger;
12 13
 import org.slf4j.LoggerFactory;
13 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -40,6 +41,9 @@ public class TaBuildingPanoramaController extends BaseController {
40 41
     @Autowired
41 42
     private ITaBuildingApartmentService taBuildingApartmentService;
42 43
 
44
+    @Autowired
45
+    private ISceneLogService iSceneLogService;
46
+
43 47
     /**
44 48
      * 查询列表
45 49
      * @return
@@ -126,6 +130,7 @@ public class TaBuildingPanoramaController extends BaseController {
126 130
                 taBuildingPanorama.setContent(apartment.getApartmentName());
127 131
             }
128 132
             if (iTaBuildingPanoramaService.save(taBuildingPanorama)){
133
+                iSceneLogService.saveLogs(getUserId(request),"panorama",taBuildingPanorama.getBuildingId());
129 134
                 responseBean.addSuccess(taBuildingPanorama);
130 135
             }else {
131 136
                 responseBean.addError("fail");
@@ -144,13 +149,14 @@ public class TaBuildingPanoramaController extends BaseController {
144 149
      */
145 150
     @ResponseBody
146 151
     @RequestMapping(value="/admin/panorama/{id}", method= RequestMethod.DELETE)
147
-    public ResponseBean taBuildingPanoramaDelete(@PathVariable Integer id){
152
+    public ResponseBean taBuildingPanoramaDelete(@PathVariable Integer id,HttpServletRequest request){
148 153
         ResponseBean responseBean = new ResponseBean();
149 154
         try {
150 155
             TaBuildingPanorama taBuildingPanorama = new TaBuildingPanorama();
151 156
             taBuildingPanorama.setPanoramaId(id);
152 157
             taBuildingPanorama.setStatus(CommConstant.STATUS_UNACCALIMED);
153 158
             if(iTaBuildingPanoramaService.updateById(taBuildingPanorama)){
159
+                iSceneLogService.saveLogs(getUserId(request),"panorama",taBuildingPanorama.getBuildingId());
154 160
                 responseBean.addSuccess("success");
155 161
             }else {
156 162
                 responseBean.addError("fail");
@@ -171,11 +177,12 @@ public class TaBuildingPanoramaController extends BaseController {
171 177
      */
172 178
     @RequestMapping(value="/admin/panorama/{id}",method= RequestMethod.PUT)
173 179
     public ResponseBean taBuildingPanoramaUpdate(@PathVariable Integer id,
174
-                                        @RequestBody TaBuildingPanorama taBuildingPanorama){
180
+                                        @RequestBody TaBuildingPanorama taBuildingPanorama,HttpServletRequest request){
175 181
         ResponseBean responseBean = new ResponseBean();
176 182
         try {
177 183
             taBuildingPanorama.setPanoramaId(id);
178 184
             if (iTaBuildingPanoramaService.updateById(taBuildingPanorama)){
185
+                iSceneLogService.saveLogs(getUserId(request),"panorama",taBuildingPanorama.getBuildingId());
179 186
                 responseBean.addSuccess(taBuildingPanorama);
180 187
             }else {
181 188
                 responseBean.addError("fail");

+ 30
- 1
src/main/java/com/yunzhi/marketing/controller/TaLiveActivityController.java 查看文件

@@ -224,6 +224,34 @@ public class TaLiveActivityController extends BaseController {
224 224
         return responseBean;
225 225
     }
226 226
 
227
+    /**
228
+     * 推首页
229
+     *
230
+     * @param id             实体ID
231
+     * @return
232
+     */
233
+    @RequestMapping(value = "/admin/home/live/{id}", method = RequestMethod.PUT)
234
+    public ResponseBean taLiveActivityHome(@PathVariable Integer id,HttpServletRequest request) {
235
+        ResponseBean responseBean = new ResponseBean();
236
+        try {
237
+            TaLiveActivity taLiveActivity = iTaLiveActivityService.getById(id);
238
+            if (CommConstant.NOT_PUBLISH.equals(taLiveActivity.getIsHome())) {
239
+                taLiveActivity.setIsHome(CommConstant.IS_PUBLISH);
240
+            }else if (CommConstant.IS_PUBLISH.equals(taLiveActivity.getIsHome())) {
241
+                taLiveActivity.setIsHome(CommConstant.NOT_PUBLISH);
242
+            }
243
+            taLiveActivity.setUpdateDate(LocalDateTime.now());
244
+            taLiveActivity.setUpdateUser(getUserId(request).toString());
245
+            iTaLiveActivityService.updateById(taLiveActivity);
246
+            responseBean.addSuccess(taLiveActivity);
247
+        } catch (Exception e) {
248
+            e.printStackTrace();
249
+            logger.error("taLiveActivityUpdate -=- {}", e.toString());
250
+            responseBean.addError(e.getMessage());
251
+        }
252
+        return responseBean;
253
+    }
254
+
227 255
     /**
228 256
      * 根据id查询对象
229 257
      *
@@ -306,6 +334,7 @@ public class TaLiveActivityController extends BaseController {
306 334
                                                      @RequestParam(value = "name", required = false) String name,
307 335
                                                      @RequestParam(value = "process", required = false) Integer process,
308 336
                                                      @RequestParam(value = "newHouse", required = false) Boolean newHouse,
337
+                                                     @RequestParam(value = "isHome", required = false) Boolean isHome,
309 338
                                                      HttpServletRequest request) {
310 339
         if (process != null) {
311 340
             return getPureLiveActivity(pageNum, pageSize, cityId, buildingId, name, process, request);
@@ -315,7 +344,7 @@ public class TaLiveActivityController extends BaseController {
315 344
         try {
316 345
             Integer orgId = getOrgId(request);
317 346
             IPage<LiveAndVideoVO> pg = new Page<>(pageNum, pageSize);
318
-            IPage<LiveAndVideoVO> result = iTaLiveActivityService.getWxLiveActivityAndVideo(pg, orgId, cityId, buildingId, name, newHouse);
347
+            IPage<LiveAndVideoVO> result = iTaLiveActivityService.getWxLiveActivityAndVideo(pg, orgId, cityId, buildingId, name, newHouse, isHome);
319 348
             responseBean.addSuccess(result);
320 349
 
321 350
         } catch (Exception e) {

+ 11
- 5
src/main/java/com/yunzhi/marketing/controller/TaNewsController.java 查看文件

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.yunzhi.marketing.base.BaseController;
6 6
 import com.yunzhi.marketing.base.ResponseBean;
7 7
 import com.yunzhi.marketing.common.CommConstant;
8
+import com.yunzhi.marketing.common.StringUtils;
8 9
 import com.yunzhi.marketing.entity.TaNews;
9 10
 import com.yunzhi.marketing.entity.TaPerson;
10 11
 import com.yunzhi.marketing.reportCustomerAop.ReportCustomer;
@@ -126,10 +127,12 @@ public class TaNewsController extends BaseController {
126 127
     })
127 128
     @RequestMapping(value="/admin/taNews",method= RequestMethod.POST)
128 129
     public ResponseBean taNewsAdd(@RequestBody TaNews taNews, HttpServletRequest request){
129
-        Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
130
-        taNews.setCityId(cityId);
131 130
         taNews.setOrgId(getOrgId(request));
132
-        taNews.setInstitutionId(getInstitutionId(taNews.getBuildingId()));
131
+        if (!StringUtils.isEmpty(taNews.getBuildingId())){
132
+            Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
133
+            taNews.setCityId(cityId);
134
+            taNews.setInstitutionId(getInstitutionId(taNews.getBuildingId()));
135
+        }
133 136
         ResponseBean responseBean = iTaNewsService.addTaNews(taNews);
134 137
         return responseBean;
135 138
     }
@@ -161,8 +164,11 @@ public class TaNewsController extends BaseController {
161 164
                                         @RequestBody TaNews taNews,
162 165
                                      HttpServletRequest request){
163 166
         taNews.setNewsId(id);
164
-        Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
165
-        taNews.setCityId(cityId);
167
+        if (!StringUtils.isEmpty(taNews.getBuildingId())){
168
+            Integer cityId = iTaBuildingService.getCityById(taNews.getBuildingId());
169
+            taNews.setCityId(cityId);
170
+        }
171
+
166 172
         taNews.setOrgId(getOrgId(request));
167 173
         ResponseBean responseBean = iTaNewsService.updateTaNews(taNews);
168 174
         if ("1".equals(String.valueOf(taNews.getNewsStatus()))){

+ 74
- 0
src/main/java/com/yunzhi/marketing/controller/TaOrgCityController.java 查看文件

@@ -0,0 +1,74 @@
1
+package com.yunzhi.marketing.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.marketing.base.BaseController;
7
+import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.StringUtils;
9
+import com.yunzhi.marketing.dto.TaOrgCityDTO;
10
+import com.yunzhi.marketing.entity.TaOrgCity;
11
+import com.yunzhi.marketing.entity.TaSalesBatch;
12
+import com.yunzhi.marketing.mapper.TaOrgCityMapper;
13
+import io.swagger.annotations.Api;
14
+import io.swagger.annotations.ApiImplicitParam;
15
+import io.swagger.annotations.ApiImplicitParams;
16
+import io.swagger.annotations.ApiOperation;
17
+import org.springframework.beans.BeanUtils;
18
+import org.springframework.beans.factory.annotation.Autowired;
19
+import org.springframework.web.bind.annotation.*;
20
+
21
+import javax.servlet.http.HttpServletRequest;
22
+
23
+@RestController
24
+@RequestMapping("/api")
25
+@Api(value = "立森-开城市接口全部用新的以前的不管他了", tags = "立森-开城市接口全部用新的以前的不管他了")
26
+public class TaOrgCityController extends BaseController {
27
+
28
+    @Autowired
29
+    private TaOrgCityMapper taOrgCityMapper;
30
+
31
+    @ApiOperation(value = "获取此项目的城市集合", notes = "获取此项目的城市集合")
32
+    @ApiImplicitParams({
33
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageNum", value = "第几页"),
34
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "pageSize", value = "一页多少行"),
35
+            @ApiImplicitParam(dataTypeClass = String.class, paramType = "query", name = "parentid", value = "父级id 不传查询所以  100000 查询的是省级机构"),
36
+    })
37
+    @GetMapping(value = "/admin/city/list")
38
+    public ResponseBean adminTdCityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
39
+                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
40
+                                        @RequestParam(value = "parentid", required = false) String parentid,
41
+                                        HttpServletRequest request) {
42
+        ResponseBean responseBean = new ResponseBean<>();
43
+        IPage<TaOrgCity> pg = new Page<>(pageNum, pageSize);
44
+        Integer orgId = getOrgId(request);
45
+        LambdaQueryWrapper<TaOrgCity> queryWrapper = new LambdaQueryWrapper<>();
46
+        queryWrapper.eq(TaOrgCity::getOrgId,orgId);
47
+        queryWrapper.eq(TaOrgCity::getStatus,1);
48
+        queryWrapper.eq(!StringUtils.isEmpty(parentid),TaOrgCity::getParentid,parentid);
49
+        IPage<TaOrgCity> taOrgCityIPage = taOrgCityMapper.selectPage(pg, queryWrapper);
50
+        responseBean.addSuccess(taOrgCityIPage);
51
+        return responseBean;
52
+    }
53
+
54
+    @ApiOperation(value = "添加此项目的城市", notes = "添加此项目的城市")
55
+    @PostMapping(value = "/admin/city/add")
56
+    public ResponseBean addCity(@RequestBody TaOrgCityDTO taOrgCityDTO, HttpServletRequest request) {
57
+        ResponseBean responseBean = new ResponseBean<>();
58
+        TaOrgCity taOrgCity = new TaOrgCity();
59
+        BeanUtils.copyProperties(taOrgCityDTO,taOrgCity);
60
+        taOrgCity.setOrgId(getOrgId(request));
61
+        taOrgCity.setStatus(1);
62
+        taOrgCityMapper.insert(taOrgCity);
63
+        responseBean.addSuccess(taOrgCity);
64
+        return responseBean;
65
+    }
66
+
67
+    @ApiOperation(value = "删除此项目的城市", notes = "添加此项目的城市")
68
+    @DeleteMapping(value = "/admin/org/city/{id}")
69
+    public ResponseBean deleteCity(@PathVariable Integer id, HttpServletRequest request) {
70
+        LambdaQueryWrapper<TaOrgCity> queryWrapper = new LambdaQueryWrapper<>();
71
+        queryWrapper.eq(TaOrgCity::getCityId,id);
72
+        return ResponseBean.success(taOrgCityMapper.delete(queryWrapper));
73
+    }
74
+}

+ 831
- 820
src/main/java/com/yunzhi/marketing/controller/TaPersonController.java
文件差異過大導致無法顯示
查看文件


+ 10
- 2
src/main/java/com/yunzhi/marketing/controller/TaPolicyController.java 查看文件

@@ -221,10 +221,18 @@ public class TaPolicyController extends BaseController {
221 221
     public ResponseBean taPolicyUpdate(@PathVariable Integer id,
222 222
                                         @RequestBody TaPolicy taPolicy,
223 223
                                        HttpServletRequest request){
224
-        ResponseBean responseBean = new ResponseBean();
225
-        try {
226 224
 
225
+        TaPolicy origin = iTaPolicyService.getById(id);
226
+        if (null == origin || !id.equals(taPolicy.getPolicyId())) {
227
+            return ResponseBean.error("未找到编辑内容", ResponseBean.ERROR_ILLEGAL_PARAMS);
228
+        }
227 229
 
230
+        if (null == taPolicy.getPublishStatus()) {
231
+            taPolicy.setPublishStatus(origin.getPublishStatus());
232
+        }
233
+
234
+        ResponseBean responseBean = new ResponseBean();
235
+        try {
228 236
             if(taPolicy.getPublishStatus().equals(CommConstant.IS_PUBLISH)){
229 237
                 taPolicy.setPublishDate(LocalDateTime.now());
230 238
                 String personId = getPersonId(request);

+ 6
- 1
src/main/java/com/yunzhi/marketing/controller/TaPosterController.java 查看文件

@@ -11,6 +11,7 @@ import com.yunzhi.marketing.entity.TaBuilding;
11 11
 import com.yunzhi.marketing.entity.TaPoster;
12 12
 import com.yunzhi.marketing.service.ITaBuildingService;
13 13
 import com.yunzhi.marketing.service.TaPosterService;
14
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
14 15
 import org.slf4j.Logger;
15 16
 import org.slf4j.LoggerFactory;
16 17
 import org.springframework.beans.factory.annotation.Autowired;
@@ -45,6 +46,8 @@ public class TaPosterController extends BaseController {
45 46
     @Autowired
46 47
     private ITaBuildingService iTaBuildingService;
47 48
 
49
+    @Autowired
50
+    private ISceneLogService iSceneLogService;
48 51
 
49 52
     /**
50 53
      * 分页查询列表
@@ -91,6 +94,7 @@ public class TaPosterController extends BaseController {
91 94
                 // 为了兼容 小程序3.0 -> v3.4的后端
92 95
                 updateBuildingPoster(poster);
93 96
                 responseBean.addSuccess(poster);
97
+                iSceneLogService.saveLogs(getUserId(request),"poster",poster.getTargetId());
94 98
             } else {
95 99
                 responseBean.addError("fail");
96 100
             }
@@ -150,7 +154,7 @@ public class TaPosterController extends BaseController {
150 154
      */
151 155
     @RequestMapping(value = "/admin/poster/{id}", method = RequestMethod.PUT)
152 156
     public ResponseBean posterUpdate(@PathVariable Integer id,
153
-                                     @RequestBody TaPoster poster) {
157
+                                     @RequestBody TaPoster poster,HttpServletRequest request) {
154 158
         ResponseBean responseBean = new ResponseBean();
155 159
         poster.setPosterId(id);
156 160
         try {
@@ -159,6 +163,7 @@ public class TaPosterController extends BaseController {
159 163
                 // 为了兼容 小程序3.0 -> v3.4的后端
160 164
                 updateBuildingPoster(poster);
161 165
                 responseBean.addSuccess(poster);
166
+                iSceneLogService.saveLogs(getUserId(request),"poster",poster.getTargetId());
162 167
             } else {
163 168
                 responseBean.addError("fail");
164 169
             }

+ 1130
- 1129
src/main/java/com/yunzhi/marketing/controller/TaRecommendCustomerController.java
文件差異過大導致無法顯示
查看文件


+ 6
- 1
src/main/java/com/yunzhi/marketing/controller/TaShareContentController.java 查看文件

@@ -8,6 +8,7 @@ import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.common.CommConstant;
9 9
 import com.yunzhi.marketing.entity.TaShareContent;
10 10
 import com.yunzhi.marketing.service.TaShareContentService;
11
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
11 12
 import org.slf4j.Logger;
12 13
 import org.slf4j.LoggerFactory;
13 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +40,8 @@ public class TaShareContentController extends BaseController {
39 40
     @Autowired
40 41
     public TaShareContentService iShareContentService;
41 42
 
43
+    @Autowired
44
+    private ISceneLogService iSceneLogService;
42 45
 
43 46
     /**
44 47
      * 分页查询列表
@@ -80,6 +83,7 @@ public class TaShareContentController extends BaseController {
80 83
             shareContent.setCreateDate(LocalDateTime.now());
81 84
             if (iShareContentService.save(shareContent)){
82 85
                 responseBean.addSuccess(shareContent);
86
+                iSceneLogService.saveLogs(getUserId(request),"shareContent",shareContent.getTargetId());
83 87
             }else {
84 88
                 responseBean.addError("fail");
85 89
             }
@@ -121,12 +125,13 @@ public class TaShareContentController extends BaseController {
121 125
      */
122 126
     @RequestMapping(value="/admin/shareContent/{id}",method= RequestMethod.PUT)
123 127
     public ResponseBean shareContentUpdate(@PathVariable Integer id,
124
-                                        @RequestBody TaShareContent shareContent){
128
+                                        @RequestBody TaShareContent shareContent,HttpServletRequest request){
125 129
         ResponseBean responseBean = new ResponseBean();
126 130
         shareContent.setShareContentId(id);
127 131
         try {
128 132
             if (iShareContentService.updateById(shareContent)){
129 133
                 responseBean.addSuccess(shareContent);
134
+                iSceneLogService.saveLogs(getUserId(request),"shareContent",shareContent.getTargetId());
130 135
             }else {
131 136
                 responseBean.addError("fail");
132 137
             }

+ 5
- 0
src/main/java/com/yunzhi/marketing/dto/AverageReportDTO.java 查看文件

@@ -33,4 +33,9 @@ public class AverageReportDTO {
33 33
      * 性别
34 34
      */
35 35
     private Integer sex;
36
+
37
+    /**
38
+     * 置业顾问-内场接待
39
+     */
40
+    private String realtyConsultant;
36 41
 }

+ 40
- 0
src/main/java/com/yunzhi/marketing/dto/TaOrgCityDTO.java 查看文件

@@ -0,0 +1,40 @@
1
+package com.yunzhi.marketing.dto;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+
12
+/**
13
+ * <p>
14
+ * 菜单表 不同系统,菜单不一致
15
+ * </p>
16
+ *
17
+ * @author jobob
18
+ * @since 2019-09-11
19
+ */
20
+@Data
21
+@EqualsAndHashCode(callSuper = false)
22
+@Accessors(chain = true)
23
+public class TaOrgCityDTO implements Serializable {
24
+
25
+    /**
26
+     * 省份id
27
+     * 城市id
28
+     */
29
+    private Integer cityId;
30
+
31
+    /**
32
+     * 省市区名称
33
+     */
34
+    private String name;
35
+
36
+    /**
37
+     * 上级ID
38
+     */
39
+    private Integer parentid;
40
+}

+ 6
- 0
src/main/java/com/yunzhi/marketing/entity/TaLiveActivity.java 查看文件

@@ -96,6 +96,12 @@ public class TaLiveActivity implements Serializable {
96 96
 
97 97
     private Integer status;
98 98
 
99
+    /**
100
+     * 是否首页
101
+     */
102
+
103
+    private Integer isHome;
104
+
99 105
     /**
100 106
      * 二维码
101 107
      */

+ 2
- 2
src/main/java/com/yunzhi/marketing/excel/StatsBuilding.java 查看文件

@@ -47,8 +47,8 @@ public class StatsBuilding {
47 47
      * 观看次数
48 48
      */
49 49
     @ColumnWidth(15)
50
-    @ExcelProperty(value = "访问次数", index = 5)
51
-    private Integer pvNum;
50
+    @ExcelProperty(value = "成交量", index = 5)
51
+    private Integer cjNum;
52 52
 
53 53
 
54 54
     @ExcelIgnore

+ 73
- 0
src/main/java/com/yunzhi/marketing/excel/searchHouse/AddedValue.java 查看文件

@@ -0,0 +1,73 @@
1
+package com.yunzhi.marketing.excel.searchHouse;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class AddedValue {
11
+
12
+    @ColumnWidth(15)
13
+    @ExcelProperty(value = "姓名", index = 0)
14
+    private String nickname;
15
+
16
+    @ColumnWidth(15)
17
+    @ExcelProperty(value = "电话", index = 1)
18
+    private String phone;
19
+
20
+    @ColumnWidth(15)
21
+    @ExcelProperty(value = "性别", index = 2)
22
+    private String gender;
23
+
24
+    @ColumnWidth(15)
25
+    @ExcelProperty(value = "意向区域", index = 3)
26
+    private String name;
27
+
28
+
29
+    @ColumnWidth(15)
30
+    @ExcelProperty(value = "客户预算", index = 4)
31
+    private String maxPrice;
32
+
33
+
34
+    @ColumnWidth(15)
35
+    @ExcelProperty(value = "房屋现状", index = 5)
36
+    private String houseStatus;
37
+
38
+
39
+    @ColumnWidth(15)
40
+    @ExcelProperty(value = "房屋面积", index = 6)
41
+    private String area;
42
+
43
+
44
+    @ColumnWidth(15)
45
+    @ExcelProperty(value = "家装模式", index = 7)
46
+    private String type;
47
+
48
+
49
+    @ColumnWidth(15)
50
+    @ExcelProperty(value = "家装侧重点", index = 8)
51
+    private String important;
52
+
53
+    @ColumnWidth(15)
54
+    @ExcelProperty(value = "家装风格", index = 9)
55
+    private String style;
56
+
57
+    @ColumnWidth(15)
58
+    @ExcelProperty(value = "关键诉求", index = 10)
59
+    private String mostImportant;
60
+
61
+    @ColumnWidth(15)
62
+    @ExcelProperty(value = "特殊功能区", index = 11)
63
+    private String special;
64
+
65
+    @ColumnWidth(15)
66
+    @ExcelProperty(value = "是否智能家居", index = 12)
67
+    private String samrt;
68
+
69
+    @ColumnWidth(15)
70
+    @ExcelProperty(value = "提交时间", index = 13)
71
+    private String createdTime;
72
+
73
+}

+ 84
- 0
src/main/java/com/yunzhi/marketing/excel/searchHouse/BuyRoom.java 查看文件

@@ -0,0 +1,84 @@
1
+package com.yunzhi.marketing.excel.searchHouse;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.format.DateTimeFormat;
5
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
6
+import lombok.Data;
7
+
8
+import java.time.LocalDateTime;
9
+import java.util.Date;
10
+
11
+@Data
12
+public class BuyRoom {
13
+
14
+
15
+    @ColumnWidth(15)
16
+    @ExcelProperty(value = "姓名", index = 0)
17
+    private String nickname;
18
+
19
+    @ColumnWidth(15)
20
+    @ExcelProperty(value = "电话", index = 1)
21
+    private String phone;
22
+
23
+    @ColumnWidth(15)
24
+    @ExcelProperty(value = "性别", index = 2)
25
+    private String gender;
26
+
27
+    @ColumnWidth(15)
28
+    @ExcelProperty(value = "意向区域", index = 3)
29
+    private String name;
30
+
31
+
32
+    @ColumnWidth(15)
33
+    @ExcelProperty(value = "购房预算", index = 4)
34
+    private String maxPrice;
35
+
36
+
37
+    @ColumnWidth(15)
38
+    @ExcelProperty(value = "房屋类型", index = 5)
39
+    private String isNew;
40
+
41
+
42
+    @ColumnWidth(15)
43
+    @ExcelProperty(value = "意向居室", index = 6)
44
+    private String layout;
45
+
46
+
47
+    @ColumnWidth(15)
48
+    @ExcelProperty(value = "购房目的", index = 7)
49
+    private String purpose;
50
+
51
+
52
+    @ColumnWidth(15)
53
+    @ExcelProperty(value = "侧重优势", index = 8)
54
+    private String advantage;
55
+
56
+    @ColumnWidth(15)
57
+    @ExcelProperty(value = "社区要求", index = 9)
58
+    private String facility;
59
+
60
+    @ColumnWidth(15)
61
+    @ExcelProperty(value = "面积要求", index = 10)
62
+    private String area;
63
+
64
+    @ColumnWidth(15)
65
+    @ExcelProperty(value = "朝向要求", index = 11)
66
+    private String orientation;
67
+
68
+    @ColumnWidth(15)
69
+    @ExcelProperty(value = "楼层要求", index = 12)
70
+    private String isHigh;
71
+
72
+    @ColumnWidth(15)
73
+    @ExcelProperty(value = "楼龄要求", index = 13)
74
+    private String buildingAge;
75
+
76
+    @ColumnWidth(15)
77
+    @ExcelProperty(value = "客户备注", index = 14)
78
+    private String remark;
79
+
80
+    @ColumnWidth(15)
81
+    @ExcelProperty(value = "提交时间", index = 15)
82
+    private String createdTime;
83
+
84
+}

+ 48
- 0
src/main/java/com/yunzhi/marketing/excel/searchHouse/Overseas.java 查看文件

@@ -0,0 +1,48 @@
1
+package com.yunzhi.marketing.excel.searchHouse;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class Overseas {
11
+
12
+
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "姓名", index = 0)
15
+    private String nickname;
16
+
17
+    @ColumnWidth(15)
18
+    @ExcelProperty(value = "电话", index = 1)
19
+    private String phone;
20
+
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "性别", index = 2)
23
+    private String gender;
24
+
25
+    @ColumnWidth(15)
26
+    @ExcelProperty(value = "意向区域", index = 3)
27
+    private String name;
28
+
29
+
30
+    @ColumnWidth(15)
31
+    @ExcelProperty(value = "购房预算", index = 4)
32
+    private String maxPrice;
33
+
34
+
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "房屋类型", index = 5)
37
+    private String isNew;
38
+
39
+
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "购房目的", index = 6)
42
+    private String layout;
43
+
44
+    @ColumnWidth(15)
45
+    @ExcelProperty(value = "提交时间", index = 7)
46
+    private String createdTime;
47
+
48
+}

+ 56
- 0
src/main/java/com/yunzhi/marketing/excel/searchHouse/Rent.java 查看文件

@@ -0,0 +1,56 @@
1
+package com.yunzhi.marketing.excel.searchHouse;
2
+
3
+import com.alibaba.excel.annotation.ExcelProperty;
4
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class Rent {
11
+
12
+
13
+    @ColumnWidth(15)
14
+    @ExcelProperty(value = "姓名", index = 0)
15
+    private String nickname;
16
+
17
+    @ColumnWidth(15)
18
+    @ExcelProperty(value = "电话", index = 1)
19
+    private String phone;
20
+
21
+    @ColumnWidth(15)
22
+    @ExcelProperty(value = "性别", index = 2)
23
+    private String gender;
24
+
25
+    @ColumnWidth(15)
26
+    @ExcelProperty(value = "意向区域", index = 3)
27
+    private String name;
28
+
29
+
30
+    @ColumnWidth(15)
31
+    @ExcelProperty(value = "购房预算", index = 4)
32
+    private String maxPrice;
33
+
34
+
35
+    @ColumnWidth(15)
36
+    @ExcelProperty(value = "租房偏好", index = 5)
37
+    private String preference;
38
+
39
+
40
+    @ColumnWidth(15)
41
+    @ExcelProperty(value = "居室要求", index = 6)
42
+    private String layout;
43
+
44
+    @ColumnWidth(15)
45
+    @ExcelProperty(value = "其他要求", index = 7)
46
+    private String purpose;
47
+
48
+    @ColumnWidth(15)
49
+    @ExcelProperty(value = "客户备注", index = 8)
50
+    private String remark;
51
+
52
+    @ColumnWidth(15)
53
+    @ExcelProperty(value = "提交时间", index = 9)
54
+    private String createdTime;
55
+
56
+}

+ 265
- 265
src/main/java/com/yunzhi/marketing/interceptor/AccessInterceptor.java 查看文件

@@ -1,265 +1,265 @@
1
-package com.yunzhi.marketing.interceptor;
2
-
3
-import com.alibaba.fastjson.JSONObject;
4
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
-import com.yunzhi.marketing.base.ResponseBean;
6
-import com.yunzhi.marketing.center.sysUser.entity.SysToken;
7
-import com.yunzhi.marketing.center.sysUser.service.ISysTokenService;
8
-import com.yunzhi.marketing.center.taUser.entity.TaButtonUriMap;
9
-import com.yunzhi.marketing.center.taUser.entity.TaUserRole;
10
-import com.yunzhi.marketing.center.taUser.service.ITaButtonUriMapService;
11
-import com.yunzhi.marketing.center.taUser.service.ITaUserRoleService;
12
-import com.yunzhi.marketing.common.JWTUtils;
13
-import com.yunzhi.marketing.common.StringUtils;
14
-import com.yunzhi.marketing.entity.SysButtonInMenu;
15
-import com.yunzhi.marketing.entity.TaRoleButton;
16
-import com.yunzhi.marketing.service.ISysButtonInMenuService;
17
-import com.yunzhi.marketing.service.ITaRoleButtonService;
18
-import com.yunzhi.marketing.third.service.ITaThirdPartyMiniappConfigService;
19
-import io.jsonwebtoken.*;
20
-import lombok.extern.slf4j.Slf4j;
21
-import org.springframework.beans.factory.annotation.Autowired;
22
-import org.springframework.stereotype.Component;
23
-import org.springframework.web.servlet.HandlerInterceptor;
24
-import org.springframework.web.servlet.ModelAndView;
25
-
26
-import javax.servlet.http.HttpServletRequest;
27
-import javax.servlet.http.HttpServletResponse;
28
-import java.util.List;
29
-import java.util.Map;
30
-
31
-@Slf4j
32
-@Component
33
-public class AccessInterceptor implements HandlerInterceptor {
34
-    
35
-    @Autowired
36
-    private ISysTokenService sysTokenService;
37
-    
38
-    @Autowired
39
-    private ITaUserRoleService taUserRoleService;
40
-    
41
-    @Autowired
42
-    private ITaRoleButtonService taRoleButtonService;
43
-    
44
-    @Autowired
45
-    private ISysButtonInMenuService sysButtonInMenuService;
46
-    
47
-    @Autowired
48
-    private ITaButtonUriMapService taButtonUriMapService;
49
-    
50
-    @Autowired
51
-    private ITaThirdPartyMiniappConfigService taThirdPartyMiniappConfigService;
52
-    
53
-    private String[] whiteList = {
54
-            "/wx/chat", // 聊天暂时不鉴权
55
-            "/api/wx/login",
56
-            "/api/wx/tdCity",
57
-            "/api/wx/preload",
58
-            "/api/admin/signin",
59
-            "/api/taCheckin/activity",
60
-            "/api/wx/qrcode/scene",
61
-		    "/api/center/signin",
62
-            "/api/channel/signin",
63
-		    "/api/admin/taUser/signin",
64
-            "/swagger-resources/configuration/ui",
65
-            "/swagger-resources",
66
-            "/v2/api-docs",
67
-            "/swagger-resources/configuration",
68
-            "/swagger-ui.html",
69
-            "/webjars",
70
-            "/webjars/springfox-swagger-ui",
71
-            "/webjars/springfox-swagger-ui/css/typography.css",
72
-            "/clean/menurole",
73
-            "/clean/buttonrole",
74
-            "/api/admin/taPersonFromRecord",
75
-            "/api/notify",//微信支付所有回调放过
76
-            "/api/refund/",//微信退款所有回调放过
77
-            "/api/fadd/",//所有的法大大回调放过
78
-            "/api/third",
79
-            "/api/third/redirect/",
80
-            "/file/",
81
-            "/api/official/" // 官网接口
82
-    };
83
-
84
-    /*
85
-     * 视图渲染之后的操作
86
-     */
87
-    @Override
88
-    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
89
-            throws Exception {
90
-
91
-    }
92
-
93
-    /*
94
-     * 处理请求完成后视图渲染之前的处理操作
95
-     */
96
-    @Override
97
-    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
98
-            throws Exception {
99
-
100
-    }
101
-
102
-    @Override
103
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
104
-        log.info("接口请求路径是{}",request.getRequestURI());
105
-        //第三方权限校验
106
-        String tokenHeader = request.getHeader("x-token");
107
-        if (!StringUtils.isEmpty(tokenHeader)){
108
-            String appidHeader = request.getHeader("x-appid");
109
-            String nowHeader = request.getHeader("x-time");
110
-            String thirdState = taThirdPartyMiniappConfigService.checkToken(tokenHeader,appidHeader,nowHeader);
111
-            if (thirdState.equals("success")){
112
-                return true;
113
-            }
114
-    
115
-            ResponseBean resp = ResponseBean.error(thirdState , ResponseBean.ERROR_AUTH_FAIL);
116
-            response.addHeader("Content-type", "application/json");
117
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
118
-            return false;
119
-        }
120
-
121
-        // 白名单跳过
122
-        if (inWhiteList(request)) {
123
-            return true;
124
-        }
125
-
126
-        // 微信头必须对
127
-        if (!checkMiniApp(request)) {
128
-            ResponseBean resp = ResponseBean.error("请使用微信请求接口", ResponseBean.ERROR_ILLEGAL_PARAMS);
129
-
130
-            response.addHeader("Content-type", "application/json");
131
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
132
-            return false;
133
-        }
134
-
135
-        // 消息头必须包含 authorization 字段
136
-        String jwtHeader = request.getHeader("authorization");
137
-        if (null == jwtHeader || "".equals(jwtHeader)) {
138
-            ResponseBean resp = ResponseBean.error("请先进行系统登录操作", ResponseBean.ERROR_AUTH_FAIL);
139
-
140
-            response.addHeader("Content-type", "application/json");
141
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
142
-            return false;
143
-        }
144
-
145
-        String[] jwtAuths = jwtHeader.split("Bearer ");
146
-        if (null == jwtAuths || jwtAuths.length < 2 || StringUtils.isEmpty(jwtAuths[1])) {
147
-            ResponseBean resp = ResponseBean.error("权限验证非法, 数据格式不正确", ResponseBean.ERROR_AUTH_FAIL);
148
-
149
-            response.addHeader("Content-type", "application/json");
150
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
151
-            return false;
152
-        }
153
-
154
-        try {
155
-            // 只尝试去解析
156
-            Jwts.parser().setSigningKey(JWTUtils.key).parseClaimsJws(jwtAuths[1]);
157
-        } catch (ExpiredJwtException e) {
158
-            ResponseBean resp = ResponseBean.error("权限验证非法, 身份信息已过期", ResponseBean.ERROR_AUTH_EXPIRED);
159
-            response.addHeader("Content-type", "application/json");
160
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
161
-            return false;
162
-
163
-        } catch (JwtException e) {
164
-            ResponseBean resp = ResponseBean.error("权限验证非法, " + e.getMessage(), ResponseBean.ERROR_AUTH_FAIL);
165
-
166
-
167
-            response.addHeader("Content-type", "application/json");
168
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
169
-            return false;
170
-        }
171
-
172
-        //添加如果执行了登出操作提示先进行登录
173
-        SysToken sysToken = sysTokenService.getById(jwtAuths[1]);
174
-        if (null == sysToken){
175
-            ResponseBean resp = ResponseBean.error("请先进行系统登录操作", ResponseBean.ERROR_AUTH_FAIL);
176
-
177
-            response.addHeader("Content-type", "application/json");
178
-            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
179
-            return false;
180
-        }
181
-
182
-//        按钮权限校验
183
-//        boolean state = checkButtonRole(request);
184
-//        if (!state){
185
-//            ResponseBean resp = ResponseBean.error("权限验证非法" , ResponseBean.ERROR_AUTH_FAIL);
186
-//
187
-//            response.addHeader("Content-type", "application/json");
188
-//            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
189
-//            return false;
190
-//        }
191
-        
192
-        return true;
193
-    }
194
-    
195
-    //检验按钮权限
196
-    private boolean checkButtonRole(HttpServletRequest request) {
197
-        String action = request.getHeader("x-action");
198
-        if(StringUtils.isEmpty(action)){
199
-            return false;
200
-        }
201
-        //根据路径匹配code 一致继续 否则无权限
202
-        String requestURI = request.getRequestURI();
203
-        String method = request.getMethod();
204
-        TaButtonUriMap taButtonUriMap = taButtonUriMapService.getByURI(requestURI+":"+method);
205
-        if (null == taButtonUriMap){
206
-            return true;
207
-        }
208
-    
209
-        
210
-        if (!taButtonUriMap.getButtonCode().equals(action)){
211
-            return false;
212
-        }
213
-        
214
-        //根据code查询按钮权限
215
-        Map map = JWTUtils.getUserIdAndOrgId(request);
216
-        QueryWrapper<SysButtonInMenu> sysButtonInMenuQueryWrapper = new QueryWrapper<>();
217
-        sysButtonInMenuQueryWrapper.eq("code",action);
218
-        SysButtonInMenu sysButtonInMenu = sysButtonInMenuService.getOne(sysButtonInMenuQueryWrapper);
219
-        if (null == sysButtonInMenu){
220
-            return false;
221
-        }
222
-        //查询角色
223
-        QueryWrapper<TaRoleButton> taRoleButtonQueryWrapper = new QueryWrapper<>();
224
-        taRoleButtonQueryWrapper.eq("btn_id",sysButtonInMenu.getBtnId());
225
-        List<TaRoleButton> taRoleButtonList = taRoleButtonService.list(taRoleButtonQueryWrapper);
226
-        if (taRoleButtonList.size() < 1){
227
-            return true;
228
-        }
229
-        //查询用户
230
-        QueryWrapper<TaUserRole> taUserRoleQueryWrapper = new QueryWrapper<>();
231
-        taUserRoleQueryWrapper.eq("user_id",map.get("userId"));
232
-        TaUserRole taUserRole = taUserRoleService.getOne(taUserRoleQueryWrapper);
233
-        for (TaRoleButton taRoleButton : taRoleButtonList){
234
-            if (taRoleButton.getRoleId().equals(taUserRole.getRoleId())){
235
-                return true;
236
-            }
237
-        }
238
-        
239
-        return false;
240
-    }
241
-    
242
-    private boolean checkMiniApp(HttpServletRequest request) {
243
-        String requestURI = request.getRequestURI();
244
-
245
-        // 非微信请求
246
-        if (!requestURI.startsWith("/api/wx")) {
247
-            return true;
248
-        }
249
-
250
-        String ua = request.getHeader("user-agent");
251
-        return ua.contains("micromessenger") || ua.contains("MicroMessenger");
252
-    }
253
-
254
-    private boolean inWhiteList(HttpServletRequest request) {
255
-        String requestURI = request.getRequestURI();
256
-
257
-        for (String it : whiteList) {
258
-            if (requestURI.startsWith(it)) {
259
-                return true;
260
-            }
261
-        }
262
-
263
-        return false;
264
-    }
265
-}
1
+package com.yunzhi.marketing.interceptor;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5
+import com.yunzhi.marketing.base.ResponseBean;
6
+import com.yunzhi.marketing.center.sysUser.entity.SysToken;
7
+import com.yunzhi.marketing.center.sysUser.service.ISysTokenService;
8
+import com.yunzhi.marketing.center.taUser.entity.TaButtonUriMap;
9
+import com.yunzhi.marketing.center.taUser.entity.TaUserRole;
10
+import com.yunzhi.marketing.center.taUser.service.ITaButtonUriMapService;
11
+import com.yunzhi.marketing.center.taUser.service.ITaUserRoleService;
12
+import com.yunzhi.marketing.common.JWTUtils;
13
+import com.yunzhi.marketing.common.StringUtils;
14
+import com.yunzhi.marketing.entity.SysButtonInMenu;
15
+import com.yunzhi.marketing.entity.TaRoleButton;
16
+import com.yunzhi.marketing.service.ISysButtonInMenuService;
17
+import com.yunzhi.marketing.service.ITaRoleButtonService;
18
+import com.yunzhi.marketing.third.service.ITaThirdPartyMiniappConfigService;
19
+import io.jsonwebtoken.*;
20
+import lombok.extern.slf4j.Slf4j;
21
+import org.springframework.beans.factory.annotation.Autowired;
22
+import org.springframework.stereotype.Component;
23
+import org.springframework.web.servlet.HandlerInterceptor;
24
+import org.springframework.web.servlet.ModelAndView;
25
+
26
+import javax.servlet.http.HttpServletRequest;
27
+import javax.servlet.http.HttpServletResponse;
28
+import java.util.List;
29
+import java.util.Map;
30
+
31
+@Slf4j
32
+@Component
33
+public class AccessInterceptor implements HandlerInterceptor {
34
+    
35
+    @Autowired
36
+    private ISysTokenService sysTokenService;
37
+    
38
+    @Autowired
39
+    private ITaUserRoleService taUserRoleService;
40
+    
41
+    @Autowired
42
+    private ITaRoleButtonService taRoleButtonService;
43
+    
44
+    @Autowired
45
+    private ISysButtonInMenuService sysButtonInMenuService;
46
+    
47
+    @Autowired
48
+    private ITaButtonUriMapService taButtonUriMapService;
49
+    
50
+    @Autowired
51
+    private ITaThirdPartyMiniappConfigService taThirdPartyMiniappConfigService;
52
+    
53
+    private String[] whiteList = {
54
+            "/wx/chat", // 聊天暂时不鉴权
55
+            "/api/wx/login",
56
+            "/api/wx/tdCity",
57
+            "/api/wx/preload",
58
+            "/api/admin/signin",
59
+            "/api/taCheckin/activity",
60
+            "/api/wx/qrcode/scene",
61
+		    "/api/center/signin",
62
+            "/api/channel/signin",
63
+		    "/api/admin/taUser/signin",
64
+            "/swagger-resources/configuration/ui",
65
+            "/swagger-resources",
66
+            "/v2/api-docs",
67
+            "/swagger-resources/configuration",
68
+            "/swagger-ui.html",
69
+            "/webjars",
70
+            "/webjars/springfox-swagger-ui",
71
+            "/webjars/springfox-swagger-ui/css/typography.css",
72
+            "/clean/menurole",
73
+            "/clean/buttonrole",
74
+            "/api/admin/taPersonFromRecord",
75
+            "/api/notify",//微信支付所有回调放过
76
+            "/api/refund/",//微信退款所有回调放过
77
+            "/api/fadd/",//所有的法大大回调放过
78
+            "/api/third",
79
+            "/api/third/redirect/",
80
+            "/file/",
81
+            "/api/official/" // 官网接口
82
+    };
83
+
84
+    /*
85
+     * 视图渲染之后的操作
86
+     */
87
+    @Override
88
+    public void afterCompletion(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, Exception arg3)
89
+            throws Exception {
90
+
91
+    }
92
+
93
+    /*
94
+     * 处理请求完成后视图渲染之前的处理操作
95
+     */
96
+    @Override
97
+    public void postHandle(HttpServletRequest arg0, HttpServletResponse arg1, Object arg2, ModelAndView arg3)
98
+            throws Exception {
99
+
100
+    }
101
+
102
+    @Override
103
+    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
104
+        log.info("接口请求路径是{}",request.getRequestURI());
105
+        //第三方权限校验
106
+        String tokenHeader = request.getHeader("x-token");
107
+        if (!StringUtils.isEmpty(tokenHeader)){
108
+            String appidHeader = request.getHeader("x-appid");
109
+            String nowHeader = request.getHeader("x-time");
110
+            String thirdState = taThirdPartyMiniappConfigService.checkToken(tokenHeader,appidHeader,nowHeader);
111
+            if (thirdState.equals("success")){
112
+                return true;
113
+            }
114
+    
115
+            ResponseBean resp = ResponseBean.error(thirdState , ResponseBean.ERROR_AUTH_FAIL);
116
+            response.addHeader("Content-type", "application/json");
117
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
118
+            return false;
119
+        }
120
+
121
+        // 白名单跳过
122
+        if (inWhiteList(request)) {
123
+            return true;
124
+        }
125
+
126
+        // 微信头必须对
127
+        if (!checkMiniApp(request)) {
128
+            ResponseBean resp = ResponseBean.error("请使用微信请求接口", ResponseBean.ERROR_ILLEGAL_PARAMS);
129
+
130
+            response.addHeader("Content-type", "application/json");
131
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
132
+            return false;
133
+        }
134
+
135
+        // 消息头必须包含 authorization 字段
136
+        String jwtHeader = request.getHeader("authorization");
137
+        if (null == jwtHeader || "".equals(jwtHeader)) {
138
+            ResponseBean resp = ResponseBean.error("请先进行系统登录操作", ResponseBean.ERROR_AUTH_FAIL);
139
+
140
+            response.addHeader("Content-type", "application/json");
141
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
142
+            return false;
143
+        }
144
+
145
+        String[] jwtAuths = jwtHeader.split("Bearer ");
146
+        if (null == jwtAuths || jwtAuths.length < 2 || StringUtils.isEmpty(jwtAuths[1])) {
147
+            ResponseBean resp = ResponseBean.error("权限验证非法, 数据格式不正确", ResponseBean.ERROR_AUTH_FAIL);
148
+
149
+            response.addHeader("Content-type", "application/json");
150
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
151
+            return false;
152
+        }
153
+
154
+        try {
155
+            // 只尝试去解析
156
+            Jwts.parser().setSigningKey(JWTUtils.key).parseClaimsJws(jwtAuths[1]);
157
+        } catch (ExpiredJwtException e) {
158
+            ResponseBean resp = ResponseBean.error("身份信息已过期,请刷新网页重新登录", ResponseBean.ERROR_AUTH_EXPIRED);
159
+            response.addHeader("Content-type", "application/json");
160
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
161
+            return false;
162
+
163
+        } catch (JwtException e) {
164
+            ResponseBean resp = ResponseBean.error("权限验证非法, " + e.getMessage(), ResponseBean.ERROR_AUTH_FAIL);
165
+
166
+
167
+            response.addHeader("Content-type", "application/json");
168
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
169
+            return false;
170
+        }
171
+
172
+        //添加如果执行了登出操作提示先进行登录
173
+        SysToken sysToken = sysTokenService.getById(jwtAuths[1]);
174
+        if (null == sysToken){
175
+            ResponseBean resp = ResponseBean.error("请先进行系统登录操作", ResponseBean.ERROR_AUTH_FAIL);
176
+
177
+            response.addHeader("Content-type", "application/json");
178
+            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
179
+            return false;
180
+        }
181
+
182
+//        按钮权限校验
183
+//        boolean state = checkButtonRole(request);
184
+//        if (!state){
185
+//            ResponseBean resp = ResponseBean.error("权限验证非法" , ResponseBean.ERROR_AUTH_FAIL);
186
+//
187
+//            response.addHeader("Content-type", "application/json");
188
+//            response.getOutputStream().write(JSONObject.toJSONBytes(resp));
189
+//            return false;
190
+//        }
191
+        
192
+        return true;
193
+    }
194
+    
195
+    //检验按钮权限
196
+    private boolean checkButtonRole(HttpServletRequest request) {
197
+        String action = request.getHeader("x-action");
198
+        if(StringUtils.isEmpty(action)){
199
+            return false;
200
+        }
201
+        //根据路径匹配code 一致继续 否则无权限
202
+        String requestURI = request.getRequestURI();
203
+        String method = request.getMethod();
204
+        TaButtonUriMap taButtonUriMap = taButtonUriMapService.getByURI(requestURI+":"+method);
205
+        if (null == taButtonUriMap){
206
+            return true;
207
+        }
208
+    
209
+        
210
+        if (!taButtonUriMap.getButtonCode().equals(action)){
211
+            return false;
212
+        }
213
+        
214
+        //根据code查询按钮权限
215
+        Map map = JWTUtils.getUserIdAndOrgId(request);
216
+        QueryWrapper<SysButtonInMenu> sysButtonInMenuQueryWrapper = new QueryWrapper<>();
217
+        sysButtonInMenuQueryWrapper.eq("code",action);
218
+        SysButtonInMenu sysButtonInMenu = sysButtonInMenuService.getOne(sysButtonInMenuQueryWrapper);
219
+        if (null == sysButtonInMenu){
220
+            return false;
221
+        }
222
+        //查询角色
223
+        QueryWrapper<TaRoleButton> taRoleButtonQueryWrapper = new QueryWrapper<>();
224
+        taRoleButtonQueryWrapper.eq("btn_id",sysButtonInMenu.getBtnId());
225
+        List<TaRoleButton> taRoleButtonList = taRoleButtonService.list(taRoleButtonQueryWrapper);
226
+        if (taRoleButtonList.size() < 1){
227
+            return true;
228
+        }
229
+        //查询用户
230
+        QueryWrapper<TaUserRole> taUserRoleQueryWrapper = new QueryWrapper<>();
231
+        taUserRoleQueryWrapper.eq("user_id",map.get("userId"));
232
+        TaUserRole taUserRole = taUserRoleService.getOne(taUserRoleQueryWrapper);
233
+        for (TaRoleButton taRoleButton : taRoleButtonList){
234
+            if (taRoleButton.getRoleId().equals(taUserRole.getRoleId())){
235
+                return true;
236
+            }
237
+        }
238
+        
239
+        return false;
240
+    }
241
+    
242
+    private boolean checkMiniApp(HttpServletRequest request) {
243
+        String requestURI = request.getRequestURI();
244
+
245
+        // 非微信请求
246
+        if (!requestURI.startsWith("/api/wx")) {
247
+            return true;
248
+        }
249
+
250
+        String ua = request.getHeader("user-agent");
251
+        return ua.contains("micromessenger") || ua.contains("MicroMessenger");
252
+    }
253
+
254
+    private boolean inWhiteList(HttpServletRequest request) {
255
+        String requestURI = request.getRequestURI();
256
+
257
+        for (String it : whiteList) {
258
+            if (requestURI.startsWith(it)) {
259
+                return true;
260
+            }
261
+        }
262
+
263
+        return false;
264
+    }
265
+}

+ 2
- 1
src/main/java/com/yunzhi/marketing/job/CustomerTimeJob.java 查看文件

@@ -5,6 +5,7 @@ import com.yunzhi.marketing.common.CommConstant;
5 5
 import com.yunzhi.marketing.entity.TaRecommendCustomer;
6 6
 import com.yunzhi.marketing.service.ITaRecommendCustomerService;
7 7
 import org.springframework.beans.factory.annotation.Autowired;
8
+import org.springframework.scheduling.annotation.Scheduled;
8 9
 
9 10
 import java.time.LocalDateTime;
10 11
 import java.util.List;
@@ -14,7 +15,7 @@ public class CustomerTimeJob {
14 15
     @Autowired
15 16
     private ITaRecommendCustomerService taRecommendCustomerService;
16 17
 
17
-    //    @Scheduled(cron = "* 0/1 * * * ?")
18
+    @Scheduled(cron = "0 0 0 * * ?")
18 19
     private void customerTimeJob() {
19 20
         LocalDateTime nowDate = LocalDateTime.now();
20 21
         LocalDateTime beforeTime = nowDate.plusDays(-15);

+ 2
- 2
src/main/java/com/yunzhi/marketing/mapper/TaBuildingMapper.java 查看文件

@@ -153,7 +153,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
153 153
      * @param personBuildingList
154 154
      * @return
155 155
      */
156
-    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sortField") String sortField,@Param("orderType") String orderType);
156
+    IPage<StatsBuilding> getStatsTableList(IPage<StatsBuilding> page, @Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("sortField") String sortField,@Param("orderType") String orderType,@Param("institutionIds") List<String> institutionIds);
157 157
 
158 158
     /**
159 159
      * 获取导出的数据
@@ -164,7 +164,7 @@ public interface TaBuildingMapper extends BaseMapper<TaBuilding> {
164 164
      * @param personBuildingList
165 165
      * @return
166 166
      */
167
-    List<StatsBuilding> getExportTableList(@Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
167
+    List<StatsBuilding> getExportTableList(@Param("orgId") Integer orgId, @Param("startDate")  LocalDate startDate, @Param("endDate")  LocalDate endDate, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,@Param("institutionIds") List<String> institutionIds);
168 168
 
169 169
     /**
170 170
      * 获取单独building的折线图数据

+ 3
- 2
src/main/java/com/yunzhi/marketing/mapper/TaLiveActivityMapper.java 查看文件

@@ -56,9 +56,10 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
56 56
                                                     @Param("buildingId") String buildingId,
57 57
                                                     @Param("orgId") Integer orgId,
58 58
                                                     @Param("name") String name,
59
-                                                    @Param("newHouse") Boolean newHouse);
59
+                                                    @Param("newHouse") Boolean newHouse,
60
+                                                    @Param("isHome") Boolean isHome);
60 61
 
61
-    IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg,
62
+    IPage<LiveAndVideoVO> getWxPureLiveActivityList(IPage<TaLiveActivity> pg,
62 63
                                                     @Param("cityId") Integer cityId,
63 64
                                                     @Param("buildingId") String buildingId,
64 65
                                                     @Param("orgId") Integer orgId,

+ 2
- 1
src/main/java/com/yunzhi/marketing/mapper/TaPersonIntentionRecordMapper.java 查看文件

@@ -35,7 +35,8 @@ public interface TaPersonIntentionRecordMapper extends BaseMapper<TaPersonIntent
35 35
     IPage<Map<String, Object>> selectIntentionUser(IPage<Map<String, Object>> page,
36 36
                                                    @Param("orgId") Integer orgId,
37 37
                                                    @Param("buildingId") String buildingId,
38
-                                                   @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
38
+                                                   @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
39
+                                                   @Param("institutionIds") List<String> institutions);
39 40
 
40 41
     List<IntentionUser> selectExportIntentionUser(@Param("orgId") Integer orgId,@Param("buildingId") String buildingId,@Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingListByUserId);
41 42
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/mapper/TaPersonMapper.java 查看文件

@@ -262,4 +262,6 @@ public interface TaPersonMapper extends BaseMapper<TaPerson> {
262 262
     Integer cancelConsulatant(@Param("personId") String personId);
263 263
 
264 264
     IPage<TaPerson> getMarketingList(Page<TaBuildingDynamic> page,@Param("buildingId") String buildingId);
265
+
266
+    TaPerson getByPhone(@Param("phone") String phone);
265 267
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/mapper/TaRecommendCustomerMapper.java 查看文件

@@ -40,7 +40,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
40 40
 
41 41
     IPage<TaRecommendCustomer> getRepCustomerList(IPage<TaRecommendCustomer> page, @Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel, @Param("entryType") String entryType, @Param("verifyStatus") String verifyStatus, @Param("sex") Integer sex, @Param("orgId") Integer orgId, @Param("personBuildingList") List<TaPersonBuilding> personBuildingList);
42 42
 
43
-    IPage<TaPerson> getIndependentAgents(IPage<TaPerson> page, @Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId);
43
+    IPage<TaPerson> getIndependentAgents(IPage<TaPerson> page, @Param("personId") String personId, @Param("name") String name, @Param("tel") String tel, @Param("channelId") String channelId, @Param("orgId") Integer orgId);
44 44
 
45 45
     /**
46 46
      * 公客

+ 2
- 0
src/main/java/com/yunzhi/marketing/po/TaRecommendCustomerPO.java 查看文件

@@ -47,4 +47,6 @@ public class TaRecommendCustomerPO {
47 47
     private Integer channelId;
48 48
 
49 49
     private String channelName;
50
+
51
+    private String recommendPersonType;
50 52
 }

+ 5
- 5
src/main/java/com/yunzhi/marketing/service/IStatisticalService.java 查看文件

@@ -109,7 +109,7 @@ public interface IStatisticalService {
109 109
      * @param buildingId
110 110
      * @return
111 111
      */
112
-    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
112
+    ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutions);
113 113
 
114 114
     /**
115 115
      * 用户来源数据 首页
@@ -118,7 +118,7 @@ public interface IStatisticalService {
118 118
      * @param endDate
119 119
      * @return
120 120
      */
121
-    ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate);
121
+    ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions);
122 122
 
123 123
     /**
124 124
      * 用户来源数据统计折线图
@@ -148,7 +148,7 @@ public interface IStatisticalService {
148 148
      * @param taPersonBuildingListByUserId
149 149
      * @return
150 150
      */
151
-    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,String sortField,String sortOrder);
151
+    ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,String sortField,String sortOrder,List<String> inistions);
152 152
 
153 153
     /**
154 154
      * 获取需要导出的数据
@@ -159,7 +159,7 @@ public interface IStatisticalService {
159 159
      * @param taPersonBuildingListByUserId
160 160
      * @return
161 161
      */
162
-    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId);
162
+    List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutionIds);
163 163
 
164 164
     /**
165 165
      * 按时间获取此楼盘的数据折线图
@@ -214,7 +214,7 @@ public interface IStatisticalService {
214 214
      * @param endDate
215 215
      * @return
216 216
      */
217
-    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate);
217
+    ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions);
218 218
 
219 219
     /**
220 220
      * 人员城市分布

+ 2
- 2
src/main/java/com/yunzhi/marketing/service/ITaLiveActivityService.java 查看文件

@@ -73,7 +73,7 @@ public interface ITaLiveActivityService extends IService<TaLiveActivity> {
73 73
      * @param name
74 74
      * @return
75 75
      */
76
-    IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse);
76
+    IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse,Boolean isHome);
77 77
 
78
-    IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process);
78
+    IPage<LiveAndVideoVO> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process);
79 79
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/service/ITaRecommendCustomerService.java 查看文件

@@ -47,7 +47,7 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
47 47
 
48 48
     IPage<TaRecommendCustomer> getRepCustomerList(int pageNumber, int pageSize, String building, String name, String tel, String consultName, String consultTel, String entryType, String verifyStatus, Integer sex, Integer orgId, List<TaPersonBuilding> taPersonBuildingList);
49 49
 
50
-    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String name, String tel, String channelId, Integer orgId);
50
+    IPage<TaPerson> getIndependentAgents(int pageNumber, int pageSize, String personId, String name, String tel, String channelId, Integer orgId);
51 51
 
52 52
 
53 53
     TaRecommendCustomer getCustomerDetail(String customerId, int pageNumber, int pageSize, List<TaPersonBuilding> taPersonBuildingList, String buildingId);

+ 11
- 11
src/main/java/com/yunzhi/marketing/service/impl/StatisticalServiceImpl.java 查看文件

@@ -320,11 +320,11 @@ public class StatisticalServiceImpl implements IStatisticalService {
320 320
     }
321 321
 
322 322
     @Override
323
-    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId) {
323
+    public ResponseBean selectIntentionUser(Integer pageNum, Integer pageSize, Integer orgId, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId,List<String> institutions) {
324 324
         ResponseBean responseBean = new ResponseBean();
325 325
 
326 326
         IPage<Map<String, Object>> pg = new Page<>(pageNum, pageSize);
327
-        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId, taPersonBuildingListByUserId);
327
+        IPage<Map<String, Object>> page = taPersonIntentionRecordMapper.selectIntentionUser(pg, orgId, buildingId, taPersonBuildingListByUserId,institutions);
328 328
 
329 329
         responseBean.addSuccess(page);
330 330
         return responseBean;
@@ -339,9 +339,9 @@ public class StatisticalServiceImpl implements IStatisticalService {
339 339
      * @return
340 340
      */
341 341
     @Override
342
-    public ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate) {
342
+    public ResponseBean selectPersonFrom(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions) {
343 343
         ResponseBean responseBean = new ResponseBean();
344
-        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId, startDate, endDate);
344
+        List<TsPersonFromStatistic> list = tsPersonFromStatisticMapper.selectPersonFrom(orgId, startDate, endDate,institutions);
345 345
         QueryWrapper<TdWxDict> tdWxDictQueryWrapper = new QueryWrapper<>();
346 346
         tdWxDictQueryWrapper.groupBy("scene_type");
347 347
         List<TdWxDict> tdWxDicts = tdWxDictMapper.selectList(tdWxDictQueryWrapper);
@@ -353,7 +353,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
353 353
         });
354 354
         Map<String, Object> map = new HashMap<>();
355 355
         map.put("tdWxDicts", tdWxDicts);
356
-        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId, startDate, endDate);
356
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectPersonFromGroupByData(orgId, startDate, endDate,institutions);
357 357
         map.put("list", tableList);
358 358
         responseBean.addSuccess(map);
359 359
         return responseBean;
@@ -455,7 +455,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
455 455
      * @return
456 456
      */
457 457
     @Override
458
-    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,String sortField,String sortOrder) {
458
+    public ResponseBean getStatsTableList(Integer pageNum, Integer pageSize, Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,String sortField,String sortOrder,List<String> institutionIds) {
459 459
         String orderType = "asc";
460 460
         if ("descend".equals(sortOrder)){
461 461
             orderType = "desc";
@@ -467,7 +467,7 @@ public class StatisticalServiceImpl implements IStatisticalService {
467 467
             orderType = "desc";
468 468
         }
469 469
         IPage<StatsBuilding> pg = new Page<>(pageNum, pageSize);
470
-        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList,sortField,orderType);
470
+        IPage<StatsBuilding> page = taBuildingMapper.getStatsTableList(pg, orgId, startDate, endDate, buildingId, personBuildingList,sortField,orderType,institutionIds);
471 471
         return ResponseBean.success(page);
472 472
     }
473 473
 
@@ -482,8 +482,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
482 482
      * @return
483 483
      */
484 484
     @Override
485
-    public List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList) {
486
-        return taBuildingMapper.getExportTableList(orgId, startDate, endDate, buildingId, personBuildingList);
485
+    public List<StatsBuilding> getExportTableList(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<TaPersonBuilding> personBuildingList,List<String> institutionIds) {
486
+        return taBuildingMapper.getExportTableList(orgId, startDate, endDate, buildingId, personBuildingList,institutionIds);
487 487
     }
488 488
 
489 489
     /**
@@ -585,8 +585,8 @@ public class StatisticalServiceImpl implements IStatisticalService {
585 585
      * @return
586 586
      */
587 587
     @Override
588
-    public ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate) {
589
-        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectNewLinePersonFromGroupByData(orgId, startDate, endDate);
588
+    public ResponseBean changeNewsUserCount(Integer orgId, LocalDate startDate, LocalDate endDate,List<String> institutions) {
589
+        List<TsPersonFromStatistic> tableList = tsPersonFromStatisticMapper.selectNewLinePersonFromGroupByData(orgId, startDate, endDate,institutions);
590 590
         return ResponseBean.success(tableList);
591 591
     }
592 592
 

+ 502
- 502
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingDynamicServiceImpl.java
文件差異過大導致無法顯示
查看文件


+ 1320
- 1320
src/main/java/com/yunzhi/marketing/service/impl/TaBuildingServiceImpl.java
文件差異過大導致無法顯示
查看文件


+ 3
- 3
src/main/java/com/yunzhi/marketing/service/impl/TaLiveActivityServiceImpl.java 查看文件

@@ -210,13 +210,13 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
210 210
      * @return
211 211
      */
212 212
     @Override
213
-    public IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse) {
214
-        IPage<LiveAndVideoVO> wxLiveActivityAndVideo = taLiveActivityMapper.getWxLiveActivityAndVideo(pg, cityId, buildingId, orgId, name, newHouse);
213
+    public IPage<LiveAndVideoVO> getWxLiveActivityAndVideo(IPage<LiveAndVideoVO> pg, Integer orgId, Integer cityId, String buildingId, String name, Boolean newHouse,Boolean isHome) {
214
+        IPage<LiveAndVideoVO> wxLiveActivityAndVideo = taLiveActivityMapper.getWxLiveActivityAndVideo(pg, cityId, buildingId, orgId, name, newHouse, isHome);
215 215
         return wxLiveActivityAndVideo;
216 216
     }
217 217
 
218 218
     @Override
219
-    public IPage<TaLiveActivity> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process) {
219
+    public IPage<LiveAndVideoVO> getWxPureLiveActivityList(IPage<TaLiveActivity> pg, Integer orgId, Integer cityId, String buildingId, String name, Integer process) {
220 220
         return taLiveActivityMapper.getWxPureLiveActivityList(pg, cityId, buildingId, orgId, name, process);
221 221
     }
222 222
 }

+ 235
- 235
src/main/java/com/yunzhi/marketing/service/impl/TaNewsServiceImpl.java 查看文件

@@ -1,235 +1,235 @@
1
-package com.yunzhi.marketing.service.impl;
2
-
3
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
-import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
-import com.yunzhi.marketing.base.ResponseBean;
8
-import com.yunzhi.marketing.common.BeanTools;
9
-import com.yunzhi.marketing.common.CommConstant;
10
-import com.yunzhi.marketing.common.StringUtils;
11
-import com.yunzhi.marketing.exception.EstaException;
12
-import com.yunzhi.marketing.mapper.TaFavorMapper;
13
-import com.yunzhi.marketing.mapper.TaNewsMapper;
14
-import com.yunzhi.marketing.mapper.TaSaveMapper;
15
-import com.yunzhi.marketing.entity.*;
16
-import com.yunzhi.marketing.service.*;
17
-import org.springframework.beans.factory.annotation.Autowired;
18
-import org.springframework.stereotype.Service;
19
-
20
-import java.time.LocalDateTime;
21
-import java.util.List;
22
-import java.util.stream.Collectors;
23
-
24
-/**
25
- * <p>
26
- * 资讯表  服务实现类
27
- * </p>
28
- *
29
- * @author jobob
30
- * @since 2019-07-25
31
- */
32
-@Service
33
-public class TaNewsServiceImpl extends ServiceImpl<TaNewsMapper, TaNews> implements ITaNewsService {
34
-
35
-    @Autowired
36
-    private ITaNewsTypeService iTaNewsTypeService;
37
-
38
-    @Autowired
39
-    private ITaBuildingService iTaBuildingService;
40
-
41
-    @Autowired
42
-    private TaFavorMapper taFavorMapper;
43
-
44
-    @Autowired
45
-    private TaNewsMapper taNewsMapper;
46
-
47
-    @Autowired
48
-    private TaSaveMapper taSaveMapper;
49
-
50
-    @Autowired
51
-    private TaPosterService taPosterService;
52
-
53
-    @Autowired
54
-    private TaShareContentService taShareContentService;
55
-
56
-
57
-    @Override
58
-    public ResponseBean getList(Integer pageNum, Integer pageSize, String buildingId, Integer orgId, Integer newsTypeId, Integer newsStatus, String title, Integer cityId, List<TaPersonBuilding> personBuildingList,List<String> institutionIds) {
59
-        ResponseBean responseBean = new ResponseBean();
60
-
61
-        IPage<TaNews> page = new Page<>();
62
-        page.setCurrent(pageNum);
63
-        page.setSize(pageSize);
64
-
65
-        QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
66
-        taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id", buildingId);
67
-        taNewsQueryWrapper.eq(orgId != null,"org_id", orgId);
68
-        taNewsQueryWrapper.eq(newsTypeId != null,"news_type_id", newsTypeId);
69
-        taNewsQueryWrapper.eq(newsStatus != null, "news_status", newsStatus);
70
-        taNewsQueryWrapper.eq("status", 1);
71
-        taNewsQueryWrapper.eq(cityId != null, "city_id", cityId);
72
-        taNewsQueryWrapper.like(title!=null,"news_name", title);
73
-        taNewsQueryWrapper.in("institution_id",institutionIds);
74
-        taNewsQueryWrapper.in(personBuildingList.size() > 0,"building_id",personBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList()));
75
-        taNewsQueryWrapper.orderByAsc("news_status");
76
-        taNewsQueryWrapper.orderByDesc("weight","create_date");
77
-        IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
78
-
79
-//        injectType(taNewsIPage.getRecords());
80
-
81
-        responseBean.addSuccess(taNewsIPage);
82
-        return responseBean;
83
-    }
84
-
85
-    private void injectType(List<TaNews> records) {
86
-        records.forEach(e -> {
87
-            TaNewsType newsType = iTaNewsTypeService.getById(e.getNewsTypeId());
88
-            e.setNewsType(newsType);
89
-        });
90
-    }
91
-
92
-    @Override
93
-    public ResponseBean getTaNewsById(Integer newsId) {
94
-        ResponseBean responseBean = new ResponseBean();
95
-        if (null == newsId) {
96
-            responseBean.addError("编号不能为空!");
97
-        }
98
-        TaNews data = this.getById(newsId);
99
-        data.setPosters(taPosterService.getPostersForTarget(newsId.toString(), CommConstant.POSTER_CONTENT_TYPE_NEWS));
100
-        data.setShareContents(taShareContentService.getPostersForTarget(newsId.toString(),CommConstant.POSTER_CONTENT_TYPE_NEWS));
101
-        responseBean.addSuccess(data);
102
-        return  responseBean;
103
-    }
104
-
105
-    @Override
106
-    public ResponseBean updateTaNews(TaNews taNews) {
107
-        ResponseBean responseBean = new ResponseBean();
108
-        TaNews oldNews = this.getById(taNews.getNewsId());
109
-        if (null == oldNews) {
110
-            responseBean.addError("资讯不存在!");
111
-            return responseBean;
112
-        }
113
-
114
-        //-- 校验 公司,楼盘,资讯类型
115
-        check(taNews);
116
-
117
-        BeanTools.copyProperties(taNews, oldNews);
118
-        this.updateById(oldNews);
119
-        responseBean.addSuccess(oldNews);
120
-        return responseBean;
121
-    }
122
-
123
-    @Override
124
-    public ResponseBean addTaNews(TaNews taNews) {
125
-        ResponseBean responseBean = new ResponseBean();
126
-        check(taNews);
127
-
128
-        taNews.setCreateDate(LocalDateTime.now());
129
-        taNews.setStatus(1);
130
-        taNews.setNewsStatus(1);
131
-        this.save(taNews);
132
-        responseBean.addSuccess(taNews);
133
-        return responseBean;
134
-    }
135
-
136
-    private void check(TaNews taNews) {
137
-        //-- 校验 公司,楼盘,资讯类型
138
-        // TODO 公司校验没有写 taNews.getOrgId()
139
-
140
-        TaBuilding taBuilding = iTaBuildingService.getById(taNews.getBuildingId());
141
-        if (null == taBuilding) {
142
-            throw new EstaException("楼盘不存在!");
143
-        }
144
-//        TaNewsType taNewsType = iTaNewsTypeService.getById(taNews.getNewsTypeId());
145
-//        if (null == taNewsType) {
146
-//            throw new EstaException("资讯类型不存在!");
147
-//        }
148
-    }
149
-
150
-    @Override
151
-    public ResponseBean deleteTaNews(Integer newsId) {
152
-        ResponseBean responseBean = getTaNewsById(newsId);
153
-        if (1 == responseBean.getCode()) {
154
-            return responseBean;
155
-        }
156
-        TaNews taNews = (TaNews) responseBean.getData();
157
-        if (null == taNews) {
158
-            responseBean.addError("数据不存!");
159
-        }
160
-
161
-        // 修改状态
162
-        taNews.setStatus(0);
163
-        this.updateById(taNews);
164
-
165
-        responseBean.addSuccess(taNews);
166
-        return responseBean;
167
-    }
168
-
169
-    @Override
170
-    public ResponseBean getWxTaNewsById(Integer newsId,String personId) {
171
-        ResponseBean responseBean = getTaNewsById(newsId);
172
-        if (1 == responseBean.getCode()) {
173
-            return responseBean;
174
-        }
175
-        TaNews taNews = (TaNews) responseBean.getData();
176
-        if (null == taNews) {
177
-            responseBean.addError("数据不存!");
178
-        }else {
179
-            QueryWrapper<TaSave> saveQueryWrapper = new QueryWrapper<>();
180
-            saveQueryWrapper.eq("tagert_type", CommConstant.FAVOR_NEWS);
181
-            saveQueryWrapper.eq("person_id",personId);
182
-            saveQueryWrapper.eq("saved_target",taNews.getNewsId());
183
-            Integer num = taSaveMapper.selectCount(saveQueryWrapper);
184
-            if (num>0){
185
-                taNews.setIsSave(CommConstant.STATUS_NORMAL);
186
-            }else {
187
-                taNews.setIsSave(CommConstant.STATUS_UNACCALIMED);
188
-            }
189
-        }
190
-        //阅读量加一
191
-        taNewsMapper.setFieldNum(String.valueOf(newsId), "pv_num", 1);
192
-        responseBean.addSuccess(taNews);
193
-        return responseBean;
194
-    }
195
-
196
-    @Override
197
-    public ResponseBean wxTaPvNum(Integer id) {
198
-        ResponseBean responseBean = getTaNewsById(id);
199
-        if (1 == responseBean.getCode()) {
200
-            return responseBean;
201
-        }
202
-        TaNews taNews = (TaNews) responseBean.getData();
203
-        if (null == taNews) {
204
-            responseBean.addError("数据不存!");
205
-        }
206
-
207
-        taNewsMapper.setFieldNum(String.valueOf(id), "pv_num", 1);
208
-
209
-        responseBean.addSuccess((Object)"");
210
-        return responseBean;
211
-    }
212
-
213
-    @Override
214
-    public IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,Integer cityId,boolean mine,Integer orgId) {
215
-        IPage<TaNews> page = new Page<>(pageNum, pageSize);
216
-
217
-        QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
218
-        taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
219
-        taNewsQueryWrapper.in(null != targets && targets.size() > 0, "news_id", targets);
220
-        taNewsQueryWrapper.eq(null != cityId && cityId != 0,"city_id",cityId);
221
-        taNewsQueryWrapper.eq("org_id",orgId);
222
-        taNewsQueryWrapper.eq("status", 1);
223
-        taNewsQueryWrapper.eq("news_status", 0);
224
-        taNewsQueryWrapper.orderByDesc("weight","create_date");
225
-        IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
226
-        IPage<TaNews> pageEmpty = new Page<>(pageNum, pageSize);
227
-//        injectType(taNewsIPage.getRecords());
228
-        if (targets.size()<=0 && mine){
229
-            return pageEmpty;
230
-        }else {
231
-            return taNewsIPage;
232
-        }
233
-
234
-    }
235
-}
1
+package com.yunzhi.marketing.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
+import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.common.BeanTools;
9
+import com.yunzhi.marketing.common.CommConstant;
10
+import com.yunzhi.marketing.common.StringUtils;
11
+import com.yunzhi.marketing.exception.EstaException;
12
+import com.yunzhi.marketing.mapper.TaFavorMapper;
13
+import com.yunzhi.marketing.mapper.TaNewsMapper;
14
+import com.yunzhi.marketing.mapper.TaSaveMapper;
15
+import com.yunzhi.marketing.entity.*;
16
+import com.yunzhi.marketing.service.*;
17
+import org.springframework.beans.factory.annotation.Autowired;
18
+import org.springframework.stereotype.Service;
19
+
20
+import java.time.LocalDateTime;
21
+import java.util.List;
22
+import java.util.stream.Collectors;
23
+
24
+/**
25
+ * <p>
26
+ * 资讯表  服务实现类
27
+ * </p>
28
+ *
29
+ * @author jobob
30
+ * @since 2019-07-25
31
+ */
32
+@Service
33
+public class TaNewsServiceImpl extends ServiceImpl<TaNewsMapper, TaNews> implements ITaNewsService {
34
+
35
+    @Autowired
36
+    private ITaNewsTypeService iTaNewsTypeService;
37
+
38
+    @Autowired
39
+    private ITaBuildingService iTaBuildingService;
40
+
41
+    @Autowired
42
+    private TaFavorMapper taFavorMapper;
43
+
44
+    @Autowired
45
+    private TaNewsMapper taNewsMapper;
46
+
47
+    @Autowired
48
+    private TaSaveMapper taSaveMapper;
49
+
50
+    @Autowired
51
+    private TaPosterService taPosterService;
52
+
53
+    @Autowired
54
+    private TaShareContentService taShareContentService;
55
+
56
+
57
+    @Override
58
+    public ResponseBean getList(Integer pageNum, Integer pageSize, String buildingId, Integer orgId, Integer newsTypeId, Integer newsStatus, String title, Integer cityId, List<TaPersonBuilding> personBuildingList,List<String> institutionIds) {
59
+        ResponseBean responseBean = new ResponseBean();
60
+
61
+        IPage<TaNews> page = new Page<>();
62
+        page.setCurrent(pageNum);
63
+        page.setSize(pageSize);
64
+
65
+        QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
66
+        taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id", buildingId);
67
+        taNewsQueryWrapper.eq(orgId != null,"org_id", orgId);
68
+        taNewsQueryWrapper.eq(newsTypeId != null,"news_type_id", newsTypeId);
69
+        taNewsQueryWrapper.eq(newsStatus != null, "news_status", newsStatus);
70
+        taNewsQueryWrapper.eq("status", 1);
71
+        taNewsQueryWrapper.eq(cityId != null, "city_id", cityId);
72
+        taNewsQueryWrapper.like(title!=null,"news_name", title);
73
+        taNewsQueryWrapper.in("institution_id",institutionIds);
74
+        taNewsQueryWrapper.in(personBuildingList.size() > 0,"building_id",personBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList()));
75
+        taNewsQueryWrapper.orderByAsc("news_status");
76
+        taNewsQueryWrapper.orderByDesc("weight","create_date");
77
+        IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
78
+
79
+//        injectType(taNewsIPage.getRecords());
80
+
81
+        responseBean.addSuccess(taNewsIPage);
82
+        return responseBean;
83
+    }
84
+
85
+    private void injectType(List<TaNews> records) {
86
+        records.forEach(e -> {
87
+            TaNewsType newsType = iTaNewsTypeService.getById(e.getNewsTypeId());
88
+            e.setNewsType(newsType);
89
+        });
90
+    }
91
+
92
+    @Override
93
+    public ResponseBean getTaNewsById(Integer newsId) {
94
+        ResponseBean responseBean = new ResponseBean();
95
+        if (null == newsId) {
96
+            responseBean.addError("编号不能为空!");
97
+        }
98
+        TaNews data = this.getById(newsId);
99
+        data.setPosters(taPosterService.getPostersForTarget(newsId.toString(), CommConstant.POSTER_CONTENT_TYPE_NEWS));
100
+        data.setShareContents(taShareContentService.getPostersForTarget(newsId.toString(),CommConstant.POSTER_CONTENT_TYPE_NEWS));
101
+        responseBean.addSuccess(data);
102
+        return  responseBean;
103
+    }
104
+
105
+    @Override
106
+    public ResponseBean updateTaNews(TaNews taNews) {
107
+        ResponseBean responseBean = new ResponseBean();
108
+        TaNews oldNews = this.getById(taNews.getNewsId());
109
+        if (null == oldNews) {
110
+            responseBean.addError("资讯不存在!");
111
+            return responseBean;
112
+        }
113
+
114
+        //-- 校验 公司,楼盘,资讯类型
115
+//        check(taNews);
116
+
117
+        BeanTools.copyProperties(taNews, oldNews);
118
+        this.updateById(oldNews);
119
+        responseBean.addSuccess(oldNews);
120
+        return responseBean;
121
+    }
122
+
123
+    @Override
124
+    public ResponseBean addTaNews(TaNews taNews) {
125
+        ResponseBean responseBean = new ResponseBean();
126
+//        check(taNews);
127
+
128
+        taNews.setCreateDate(LocalDateTime.now());
129
+        taNews.setStatus(1);
130
+        taNews.setNewsStatus(1);
131
+        this.save(taNews);
132
+        responseBean.addSuccess(taNews);
133
+        return responseBean;
134
+    }
135
+
136
+    private void check(TaNews taNews) {
137
+        //-- 校验 公司,楼盘,资讯类型
138
+        // TODO 公司校验没有写 taNews.getOrgId()
139
+
140
+        TaBuilding taBuilding = iTaBuildingService.getById(taNews.getBuildingId());
141
+        if (null == taBuilding) {
142
+            throw new EstaException("楼盘不存在!");
143
+        }
144
+//        TaNewsType taNewsType = iTaNewsTypeService.getById(taNews.getNewsTypeId());
145
+//        if (null == taNewsType) {
146
+//            throw new EstaException("资讯类型不存在!");
147
+//        }
148
+    }
149
+
150
+    @Override
151
+    public ResponseBean deleteTaNews(Integer newsId) {
152
+        ResponseBean responseBean = getTaNewsById(newsId);
153
+        if (1 == responseBean.getCode()) {
154
+            return responseBean;
155
+        }
156
+        TaNews taNews = (TaNews) responseBean.getData();
157
+        if (null == taNews) {
158
+            responseBean.addError("数据不存!");
159
+        }
160
+
161
+        // 修改状态
162
+        taNews.setStatus(0);
163
+        this.updateById(taNews);
164
+
165
+        responseBean.addSuccess(taNews);
166
+        return responseBean;
167
+    }
168
+
169
+    @Override
170
+    public ResponseBean getWxTaNewsById(Integer newsId,String personId) {
171
+        ResponseBean responseBean = getTaNewsById(newsId);
172
+        if (1 == responseBean.getCode()) {
173
+            return responseBean;
174
+        }
175
+        TaNews taNews = (TaNews) responseBean.getData();
176
+        if (null == taNews) {
177
+            responseBean.addError("数据不存!");
178
+        }else {
179
+            QueryWrapper<TaSave> saveQueryWrapper = new QueryWrapper<>();
180
+            saveQueryWrapper.eq("tagert_type", CommConstant.FAVOR_NEWS);
181
+            saveQueryWrapper.eq("person_id",personId);
182
+            saveQueryWrapper.eq("saved_target",taNews.getNewsId());
183
+            Integer num = taSaveMapper.selectCount(saveQueryWrapper);
184
+            if (num>0){
185
+                taNews.setIsSave(CommConstant.STATUS_NORMAL);
186
+            }else {
187
+                taNews.setIsSave(CommConstant.STATUS_UNACCALIMED);
188
+            }
189
+        }
190
+        //阅读量加一
191
+        taNewsMapper.setFieldNum(String.valueOf(newsId), "pv_num", 1);
192
+        responseBean.addSuccess(taNews);
193
+        return responseBean;
194
+    }
195
+
196
+    @Override
197
+    public ResponseBean wxTaPvNum(Integer id) {
198
+        ResponseBean responseBean = getTaNewsById(id);
199
+        if (1 == responseBean.getCode()) {
200
+            return responseBean;
201
+        }
202
+        TaNews taNews = (TaNews) responseBean.getData();
203
+        if (null == taNews) {
204
+            responseBean.addError("数据不存!");
205
+        }
206
+
207
+        taNewsMapper.setFieldNum(String.valueOf(id), "pv_num", 1);
208
+
209
+        responseBean.addSuccess((Object)"");
210
+        return responseBean;
211
+    }
212
+
213
+    @Override
214
+    public IPage<TaNews> getWxList(Integer pageNum, Integer pageSize, String buildingId, List<String> targets,Integer cityId,boolean mine,Integer orgId) {
215
+        IPage<TaNews> page = new Page<>(pageNum, pageSize);
216
+
217
+        QueryWrapper<TaNews> taNewsQueryWrapper = new QueryWrapper<>();
218
+        taNewsQueryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
219
+        taNewsQueryWrapper.in(null != targets && targets.size() > 0, "news_id", targets);
220
+        taNewsQueryWrapper.eq(null != cityId && cityId != 0,"city_id",cityId);
221
+        taNewsQueryWrapper.eq("org_id",orgId);
222
+        taNewsQueryWrapper.eq("status", 1);
223
+        taNewsQueryWrapper.eq("news_status", 0);
224
+        taNewsQueryWrapper.orderByDesc("weight","create_date");
225
+        IPage<TaNews> taNewsIPage = this.page(page, taNewsQueryWrapper);
226
+        IPage<TaNews> pageEmpty = new Page<>(pageNum, pageSize);
227
+//        injectType(taNewsIPage.getRecords());
228
+        if (targets.size()<=0 && mine){
229
+            return pageEmpty;
230
+        }else {
231
+            return taNewsIPage;
232
+        }
233
+
234
+    }
235
+}

+ 4
- 2
src/main/java/com/yunzhi/marketing/service/impl/TaPersonFromRecordServiceImpl.java 查看文件

@@ -52,7 +52,7 @@ public class TaPersonFromRecordServiceImpl extends ServiceImpl<TaPersonFromRecor
52 52
         taPersonFromRecord.setEventType(taPersonVisitRecord.getEventType());
53 53
         taPersonFromRecord.setSceneId(taPersonVisitRecord.getSceneId());
54 54
         TdWxDict tdWxDict = tdWxDictMapper.selectById(taPersonVisitRecord.getSceneId());
55
-        taPersonFromRecord.setSceneType(null == tdWxDict ? "" : tdWxDict.getSceneType());
55
+        taPersonFromRecord.setSceneType(null == tdWxDict ? "other" : tdWxDict.getSceneType());
56 56
         taPersonFromRecord.setSharePersonId(taPersonVisitRecord.getSharePersonId());
57 57
         taPersonFromRecord.setTargetId(taPersonVisitRecord.getTargetId());
58 58
         QueryWrapper<TaPersonFromRecord> queryWrapper = new QueryWrapper<>();
@@ -74,6 +74,8 @@ public class TaPersonFromRecordServiceImpl extends ServiceImpl<TaPersonFromRecor
74 74
     public void personFromStatistic() {
75 75
         List<TsPersonFromStatistic> list =  taPersonFromRecordMapper.getNowDataList();
76 76
         tsPersonFromStatisticMapper.deleteByData();
77
-        tsPersonFromStatisticMapper.insertStatisticList(list);
77
+        if (list.size() > 0){
78
+            tsPersonFromStatisticMapper.insertStatisticList(list);
79
+        }
78 80
     }
79 81
 }

+ 2
- 1
src/main/java/com/yunzhi/marketing/service/impl/TaPersonServiceImpl.java 查看文件

@@ -287,7 +287,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
287 287
     }
288 288
 
289 289
     @Override
290
-    public ResponseBean getCardDetail(String openid, String id,String personId) {
290
+    public ResponseBean getCardDetail(String openid, String id, String personId) {
291 291
         // 卡片人员
292 292
         TaPerson person = taPersonMapper.selectById(id);
293 293
         if (null == person) {
@@ -325,6 +325,7 @@ public class TaPersonServiceImpl extends ServiceImpl<TaPersonMapper, TaPerson> i
325 325
         result.put("description", user.getDescription());
326 326
         result.put("department", user.getDepartment());
327 327
         result.put("picture", user.getPhoto());
328
+        result.put("photo", user.getPhoto());
328 329
         result.put("hotNum", person.getHotNum());
329 330
         result.put("likeNum", person.getLikeNum());
330 331
         result.put("pvNum", person.getPvNum());

+ 25
- 26
src/main/java/com/yunzhi/marketing/service/impl/TaPersonVisitRecordServiceImpl.java 查看文件

@@ -9,15 +9,11 @@ import com.yunzhi.marketing.common.CommConstant;
9 9
 import com.yunzhi.marketing.common.StringUtils;
10 10
 import com.yunzhi.marketing.drainage.entity.TaDrainage;
11 11
 import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
12
-import com.yunzhi.marketing.mapper.HelpActivityMapper;
13
-import com.yunzhi.marketing.mapper.TaBuildingDynamicMapper;
14
-import com.yunzhi.marketing.mapper.TaNewsMapper;
15
-import com.yunzhi.marketing.mapper.TaPersonMapper;
16
-import com.yunzhi.marketing.mapper.TaPersonVisitRecordMapper;
17
-import com.yunzhi.marketing.mapper.TaRecommendCustomerMapper;
18
-import com.yunzhi.marketing.mapper.TaShareActivityMapper;
12
+import com.yunzhi.marketing.mapper.*;
19 13
 import com.yunzhi.marketing.entity.*;
20 14
 import com.yunzhi.marketing.service.*;
15
+import com.yunzhi.marketing.xlk.entity.Video;
16
+import com.yunzhi.marketing.xlk.mapper.VideoMapper;
21 17
 import org.springframework.beans.factory.annotation.Autowired;
22 18
 import org.springframework.stereotype.Service;
23 19
 
@@ -43,12 +39,12 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
43 39
 	
44 40
 	@Autowired
45 41
 	private TaBuildingDynamicMapper taBuildingDynamicMapper;
46
-	
42
+
47 43
 	@Autowired
48
-	private TaShareActivityMapper taShareActivityMapper;
49
-	
44
+	private TaLiveActivityMapper taLiveActivityMapper;
45
+
50 46
 	@Autowired
51
-	private HelpActivityMapper helpActivityMapper;
47
+	private VideoMapper videoMapper;
52 48
 	
53 49
 	@Autowired
54 50
 	private TaNewsMapper taNewsMapper;
@@ -90,39 +86,42 @@ public class TaPersonVisitRecordServiceImpl extends ServiceImpl<TaPersonVisitRec
90 86
 		IPage<TaPersonVisitRecord> result = personVisitRecordMapper.getPersonVisitRecordList(pg,taRecommendCustomer.getPersonId());
91 87
 		List<TaPersonVisitRecord> records = result.getRecords();
92 88
 		records.forEach(e -> {
89
+			if (StringUtils.isEmpty(e.getTargetId())){
90
+				return;
91
+			}
93 92
 			//获取活动标题
94
-			if ("activity".equals(e.getEventType()) && null != e.getTargetId()){
93
+			if ("activity".equals(e.getEventType()) || "house".equals(e.getEventType()) || "dymic".equals(e.getEventType()) || "look".equals(e.getEventType())) {
95 94
 				TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
96
-				if (null != taBuildingDynamic){
95
+				if (null != taBuildingDynamic) {
97 96
 					e.setActivityName(taBuildingDynamic.getTitle());
98 97
 				}
99
-				
98
+
100 99
 			}
101 100
 			//获取拼团标题
102
-			if ("group".equals(e.getEventType()) && null != e.getTargetId()){
103
-				TaShareActivity taShareActivity = taShareActivityMapper.selectById(e.getTargetId());
104
-				if (null != taShareActivity){
105
-					e.setActivityName(taShareActivity.getActivityName());
101
+			if ("live".equals(e.getEventType()) && null != e.getTargetId()) {
102
+				TaLiveActivity taLiveActivity = taLiveActivityMapper.selectById(e.getTargetId());
103
+				if (null != taLiveActivity) {
104
+					e.setActivityName(taLiveActivity.getLiveActivityTitle());
106 105
 				}
107 106
 			}
108 107
 			//获取助力标题
109
-			if ("help".equals(e.getEventType()) && null != e.getTargetId()){
110
-				HelpActivity helpActivity = helpActivityMapper.selectById(e.getTargetId());
111
-				if (null != helpActivity){
112
-					e.setActivityName(helpActivity.getTitle());
108
+			if ("video".equals(e.getEventType()) && null != e.getTargetId()) {
109
+				Video video = videoMapper.selectById(e.getTargetId());
110
+				if (null != video) {
111
+					e.setActivityName(video.getName());
113 112
 				}
114 113
 			}
115 114
 			//获取咨询标题
116
-			if ("news".equals(e.getEventType()) && null != e.getTargetId()){
115
+			if ("news".equals(e.getEventType()) && null != e.getTargetId()) {
117 116
 				TaNews taNews = taNewsMapper.selectById(e.getTargetId());
118
-				if (null != taNews){
117
+				if (null != taNews) {
119 118
 					e.setActivityName(taNews.getNewsName());
120 119
 				}
121 120
 			}
122 121
 			//获取H5活动标题
123
-			if ("h5".equals(e.getEventType()) && null != e.getTargetId()){
122
+			if ("h5".equals(e.getEventType()) && null != e.getTargetId()) {
124 123
 				TaDrainage taDrainage = taDrainageMapper.selectById(e.getTargetId());
125
-				if (null != taDrainage){
124
+				if (null != taDrainage) {
126 125
 					e.setActivityName(taDrainage.getName());
127 126
 				}
128 127
 			}

+ 1761
- 1741
src/main/java/com/yunzhi/marketing/service/impl/TaRecommendCustomerServiceImpl.java
文件差異過大導致無法顯示
查看文件


+ 1
- 1
src/main/java/com/yunzhi/marketing/statistic/controller/TsUserBehaviorStatisticController.java 查看文件

@@ -158,6 +158,6 @@ public class TsUserBehaviorStatisticController extends BaseController {
158 158
                                            @RequestParam(value = "org", required = false) String org,
159 159
                                            HttpServletRequest request) {
160 160
         Integer orgId = StringUtils.isEmpty(org) ? getOrgId(request) : Integer.valueOf(org);
161
-        return iTsUserBehaviorStatisticService.selectUserBehavior(orgId, startDate, endDate, buildingId);
161
+        return iTsUserBehaviorStatisticService.selectUserBehavior(orgId, startDate, endDate, buildingId,null);
162 162
     }
163 163
 }

+ 5
- 0
src/main/java/com/yunzhi/marketing/statistic/entity/TsPersonFromStatistic.java 查看文件

@@ -66,4 +66,9 @@ public class TsPersonFromStatistic implements Serializable {
66 66
      */
67 67
     @TableField(exist = false)
68 68
     private String createTime;
69
+
70
+    /**
71
+     * 组织机构id
72
+     */
73
+    private String institutionId;
69 74
 }

+ 4
- 1
src/main/java/com/yunzhi/marketing/statistic/entity/TsUserBehaviorStatistic.java 查看文件

@@ -60,5 +60,8 @@ public class TsUserBehaviorStatistic implements Serializable {
60 60
      */
61 61
     private LocalDateTime createDate;
62 62
 
63
-
63
+    /**
64
+     * 组织机构id
65
+     */
66
+    private String institutionId;
64 67
 }

+ 3
- 3
src/main/java/com/yunzhi/marketing/statistic/mapper/TsPersonFromStatisticMapper.java 查看文件

@@ -21,13 +21,13 @@ public interface TsPersonFromStatisticMapper extends BaseMapper<TsPersonFromStat
21 21
 
22 22
     void insertStatisticList(List<TsPersonFromStatistic> list);
23 23
 
24
-    List<TsPersonFromStatistic> selectPersonFrom(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
24
+    List<TsPersonFromStatistic> selectPersonFrom(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
25 25
 
26 26
     List<TsPersonFromStatistic> selectPersonFromGroupByDay(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
27 27
 
28
-    List<TsPersonFromStatistic> selectPersonFromGroupByData(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate);
28
+    List<TsPersonFromStatistic> selectPersonFromGroupByData(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
29 29
 
30 30
     void deleteByData();
31 31
 
32
-    List<TsPersonFromStatistic> selectNewLinePersonFromGroupByData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate);
32
+    List<TsPersonFromStatistic> selectNewLinePersonFromGroupByData(@Param("orgId") Integer orgId,@Param("startDate") LocalDate startDate,@Param("endDate") LocalDate endDate,@Param("institutionIds") List<String> institutions);
33 33
 }

+ 1
- 1
src/main/java/com/yunzhi/marketing/statistic/mapper/TsUserBehaviorStatisticMapper.java 查看文件

@@ -24,5 +24,5 @@ public interface TsUserBehaviorStatisticMapper extends BaseMapper<TsUserBehavior
24 24
 
25 25
     int deleteByDate();
26 26
 
27
-    List<PersonPO>  seleBehaviorListByDate(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId);
27
+    List<PersonPO>  seleBehaviorListByDate(@Param("orgId") Integer orgId, @Param("startDate") LocalDate startDate, @Param("endDate") LocalDate endDate, @Param("buildingId") String buildingId,@Param("institutionIds") List<String> institutions);
28 28
 }

+ 2
- 1
src/main/java/com/yunzhi/marketing/statistic/service/ITsUserBehaviorStatisticService.java 查看文件

@@ -5,6 +5,7 @@ import com.yunzhi.marketing.base.ResponseBean;
5 5
 import com.yunzhi.marketing.statistic.entity.TsUserBehaviorStatistic;
6 6
 
7 7
 import java.time.LocalDate;
8
+import java.util.List;
8 9
 
9 10
 /**
10 11
  * <p>
@@ -26,5 +27,5 @@ public interface ITsUserBehaviorStatisticService extends IService<TsUserBehavior
26 27
      * @param buildingId
27 28
      * @return
28 29
      */
29
-    ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId);
30
+    ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<String> institutionIds);
30 31
 }

+ 2
- 2
src/main/java/com/yunzhi/marketing/statistic/service/impl/TsUserBehaviorStatisticServiceImpl.java 查看文件

@@ -52,9 +52,9 @@ public class TsUserBehaviorStatisticServiceImpl extends ServiceImpl<TsUserBehavi
52 52
      * @return
53 53
      */
54 54
     @Override
55
-    public ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId) {
55
+    public ResponseBean selectUserBehavior(Integer orgId, LocalDate startDate, LocalDate endDate, String buildingId, List<String> institutionIds) {
56 56
         ResponseBean responseBean = new ResponseBean();
57
-        List<PersonPO> tsUserBehaviorStatistics = tsUserBehaviorStatisticMapper.seleBehaviorListByDate(orgId, startDate, endDate, buildingId);
57
+        List<PersonPO> tsUserBehaviorStatistics = tsUserBehaviorStatisticMapper.seleBehaviorListByDate(orgId, startDate, endDate, buildingId,institutionIds);
58 58
         Map<String, Object> map = new HashMap<>();
59 59
         map.put("selectUserBehavior", tsUserBehaviorStatistics);
60 60
         responseBean.addSuccess(map);

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/BuildingChannelController.java 查看文件

@@ -11,6 +11,7 @@ import com.yunzhi.marketing.xlk.dto.BuildingChannelDTO;
11 11
 import com.yunzhi.marketing.xlk.dto.MarkingChannelCustomerDTO;
12 12
 import com.yunzhi.marketing.xlk.entity.BuildingChannel;
13 13
 import com.yunzhi.marketing.xlk.service.IBuildingChannelService;
14
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
14 15
 import io.swagger.annotations.Api;
15 16
 import io.swagger.annotations.ApiOperation;
16 17
 import org.slf4j.Logger;
@@ -49,6 +50,8 @@ public class BuildingChannelController extends BaseController {
49 50
     @Autowired
50 51
     private ITaBuildingService taBuildingService;
51 52
 
53
+    @Autowired
54
+    private ISceneLogService iSceneLogService;
52 55
     /**
53 56
      * 保存对象
54 57
      * @param buildingChannelDTO 实体对象
@@ -62,6 +65,7 @@ public class BuildingChannelController extends BaseController {
62 65
         ResponseBean responseBean = new ResponseBean();
63 66
         try {
64 67
             if (saveData(buildingChannelDTO, getOrgId(request))){
68
+                iSceneLogService.saveLogs(getUserId(request),"channel",buildingChannelDTO.getBuildingId());
65 69
                 responseBean.addSuccess("添加成功");
66 70
             }else {
67 71
                 responseBean.addError("fail");
@@ -91,6 +95,7 @@ public class BuildingChannelController extends BaseController {
91 95
 
92 96
             // 重新添加
93 97
             if (saveData(buildingChannelDTO, getOrgId(request))){
98
+                iSceneLogService.saveLogs(getUserId(request),"channel",buildingChannelDTO.getBuildingId());
94 99
                 responseBean.addSuccess("修改成功");
95 100
             }else {
96 101
                 responseBean.addError("fail");

+ 7
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/BuildingSpecialRoomController.java 查看文件

@@ -10,6 +10,7 @@ import com.yunzhi.marketing.service.ITaBuildingService;
10 10
 import com.yunzhi.marketing.xlk.dto.BuildingSpecialRoomDTO;
11 11
 import com.yunzhi.marketing.xlk.entity.BuildingSpecialRoom;
12 12
 import com.yunzhi.marketing.xlk.service.IBuildingSpecialRoomService;
13
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
13 14
 import io.swagger.annotations.Api;
14 15
 import io.swagger.annotations.ApiOperation;
15 16
 import org.slf4j.Logger;
@@ -42,6 +43,8 @@ public class BuildingSpecialRoomController extends BaseController {
42 43
     @Autowired
43 44
     public ITaBuildingService iTaBuildingService;
44 45
 
46
+    @Autowired
47
+    private ISceneLogService iSceneLogService;
45 48
 
46 49
     /**
47 50
      * 分页查询列表
@@ -105,6 +108,7 @@ public class BuildingSpecialRoomController extends BaseController {
105 108
             buildingSpecialRoom.setOrgId(orgId);
106 109
             buildingSpecialRoom.setCreateDate(LocalDateTime.now());
107 110
             if (iBuildingSpecialRoomService.save(buildingSpecialRoom)){
111
+                iSceneLogService.saveLogs(getUserId(request),"buildingSpecialRoom",buildingSpecialRoom.getBuildingId());
108 112
                 responseBean.addSuccess(buildingSpecialRoom);
109 113
             }else {
110 114
                 responseBean.addError("fail");
@@ -127,7 +131,9 @@ public class BuildingSpecialRoomController extends BaseController {
127 131
     public ResponseBean buildingSpecialRoomDelete(@PathVariable String id, @RequestHeader("authorization") String token, HttpServletRequest request){
128 132
         ResponseBean responseBean = new ResponseBean();
129 133
         try {
134
+            BuildingSpecialRoom buildingSpecialRoom = iBuildingSpecialRoomService.getById(id);
130 135
             if(iBuildingSpecialRoomService.removeById(id)){
136
+                iSceneLogService.saveLogs(getUserId(request),"buildingSpecialRoom",buildingSpecialRoom.getBuildingId());
131 137
                 responseBean.addSuccess("success");
132 138
             }else {
133 139
                 responseBean.addError("fail");
@@ -156,6 +162,7 @@ public class BuildingSpecialRoomController extends BaseController {
156 162
             BeanUtils.copyProperties(buildingSpecialRoomDTO,buildingSpecialRoom);
157 163
             buildingSpecialRoom.setSpecialRoomId(id);
158 164
             if (iBuildingSpecialRoomService.updateById(buildingSpecialRoom)){
165
+                iSceneLogService.saveLogs(getUserId(request),"buildingSpecialRoom",buildingSpecialRoom.getBuildingId());
159 166
                 responseBean.addSuccess(buildingSpecialRoom);
160 167
             }else {
161 168
                 responseBean.addError("fail");

+ 23
- 12
src/main/java/com/yunzhi/marketing/xlk/controller/CustomerInfoController.java 查看文件

@@ -194,24 +194,35 @@ public class CustomerInfoController extends BaseController {
194 194
             LambdaQueryWrapper<CustomerInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
195 195
             lambdaQueryWrapper.eq(CustomerInfo::getCustomerId,customerId);
196 196
             CustomerInfo oldCustomerInfo = iCustomerInfoService.getOne(lambdaQueryWrapper);
197
-            if (iCustomerInfoService.updateById(customerInfo)){
198
-                // 记录到修改记录表中
199
-                CustomerInfoModifyRecord customerInfoModifyRecord = new CustomerInfoModifyRecord();
200
-                customerInfoModifyRecord.setCreateDate(LocalDateTime.now());
201
-                customerInfoModifyRecord.setCustomerInfoId(oldCustomerInfo.getCustomerId());
202
-                customerInfoModifyRecord.setModifyPersonId(person.getPersonId());
203
-                customerInfoModifyRecord.setOrgId(orgId);
204
-                customerInfoModifyRecord.setContent(JSONObject.toJSONString(customerInfo));
205
-                customerInfoModifyRecordService.save(customerInfoModifyRecord);
206
-                responseBean.addSuccess(customerInfo);
197
+            if (oldCustomerInfo == null){
198
+                iCustomerInfoService.save(customerInfo);
207 199
             }else {
208
-                responseBean.addError("fail");
200
+                customerInfo.setCustomerInfoId(oldCustomerInfo.getCustomerInfoId());
201
+                iCustomerInfoService.updateById(customerInfo);
209 202
             }
203
+            // 修改客户性别
204
+            TaRecommendCustomer customer = iTaRecommendCustomerService.getById(customerId);
205
+            if (null != customer) {
206
+                customer.setSex(customerInfo.getSex());
207
+                customer.setName(customerInfo.getName());
208
+                customer.setPhone(customerInfo.getPhone());
209
+                iTaRecommendCustomerService.updateById(customer);
210
+            }
211
+
212
+            // 记录到修改记录表中
213
+            CustomerInfoModifyRecord customerInfoModifyRecord = new CustomerInfoModifyRecord();
214
+            customerInfoModifyRecord.setCreateDate(LocalDateTime.now());
215
+            customerInfoModifyRecord.setCustomerInfoId(oldCustomerInfo.getCustomerId());
216
+            customerInfoModifyRecord.setModifyPersonId(person.getPersonId());
217
+            customerInfoModifyRecord.setOrgId(orgId);
218
+            customerInfoModifyRecord.setContent(JSONObject.toJSONString(customerInfo));
219
+            customerInfoModifyRecordService.save(customerInfoModifyRecord);
210 220
         }catch (Exception e){
211 221
             e.printStackTrace();
212 222
             logger.error("customerInfoUpdate -=- {}",e.toString());
213 223
             responseBean.addError(e.getMessage());
214 224
         }
225
+        responseBean.addSuccess(customerInfo);
215 226
         return responseBean;
216 227
     }
217 228
 
@@ -236,7 +247,7 @@ public class CustomerInfoController extends BaseController {
236 247
                 customerInfo = new CustomerInfo();
237 248
             }
238 249
             customerInfo.setName(customer.getName());
239
-//            customerInfo.setSex(customer.getSex());
250
+            customerInfo.setSex(customer.getSex());
240 251
             customerInfo.setPhone(customer.getPhone());
241 252
             customerInfo.setPicture(customer.getPicture());
242 253
 

+ 9
- 8
src/main/java/com/yunzhi/marketing/xlk/controller/CustomerSignatoryController.java 查看文件

@@ -7,6 +7,7 @@ import com.yunzhi.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.xlk.entity.CustomerSignatory;
9 9
 import com.yunzhi.marketing.xlk.service.ICustomerSignatoryService;
10
+import com.yunzhi.marketing.xlk.vo.CustomerSignatoryVO;
10 11
 import io.swagger.annotations.Api;
11 12
 import io.swagger.annotations.ApiOperation;
12 13
 import org.slf4j.Logger;
@@ -48,20 +49,20 @@ public class CustomerSignatoryController extends BaseController {
48 49
      * @param pageSize
49 50
      * @return
50 51
      */
51
-    @ApiOperation(value = "", notes = "")
52
-    @RequestMapping(value="/customerSignatory",method= RequestMethod.GET)
52
+    @ApiOperation(value = "获取成交或者签约数据", notes = "获取成交或者签约数据")
53
+    @RequestMapping(value="/admin/customerSignatory",method= RequestMethod.GET)
53 54
     public ResponseBean customerSignatoryList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
54 55
                                               @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
56
+                                              @RequestParam(value ="buildingId",required = false) String buildingId,
57
+                                              @RequestParam(value ="name",required = false) String name,
58
+                                              @RequestParam(value ="phone",required = false) String phone,
59
+                                              @RequestParam(value ="type",required = false) String type,
55 60
                                               @RequestHeader("authorization") String token, HttpServletRequest request){
56 61
         ResponseBean responseBean = new ResponseBean();
57 62
         try {
58 63
             //使用分页插件
59
-		    IPage<CustomerSignatory> pg = new Page<>(pageNum, pageSize);
60
-            LambdaQueryWrapper<CustomerSignatory> queryWrapper = new LambdaQueryWrapper<>();
61
-            queryWrapper.eq(CustomerSignatory::getOrgId,getOrgId(request));
62
-            queryWrapper.orderByDesc(CustomerSignatory::getCreateDate);
63
-
64
-            IPage<CustomerSignatory> result = iCustomerSignatoryService.page(pg, queryWrapper);
64
+		    IPage<CustomerSignatoryVO> pg = new Page<>(pageNum, pageSize);
65
+            IPage<CustomerSignatoryVO> result = iCustomerSignatoryService.getCustomerSignatoryList(pg, buildingId,name,phone,type,getOrgId(request));
65 66
             responseBean.addSuccess(result);
66 67
         }catch (Exception e){
67 68
             e.printStackTrace();

+ 1
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/PcIndexStatisticsController.java 查看文件

@@ -99,6 +99,7 @@ public class PcIndexStatisticsController extends BaseController {
99 99
         pcStatisticsDTO.setStartTime(startDate);
100 100
         pcStatisticsDTO.setEndTime(endDate);
101 101
         pcStatisticsDTO.setCityId(cityId);
102
+        pcStatisticsDTO.setInstitutionIds(getInstitutionIds(request));
102 103
         return pcStatisticsService.getStatsBarList(taUser, pcStatisticsDTO);
103 104
     }
104 105
 

+ 153
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/SceneLogController.java 查看文件

@@ -0,0 +1,153 @@
1
+package com.yunzhi.marketing.xlk.controller;
2
+
3
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.marketing.base.BaseController;
7
+import com.yunzhi.marketing.base.ResponseBean;
8
+import com.yunzhi.marketing.xlk.entity.SceneLog;
9
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
10
+import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.slf4j.Logger;
13
+import org.slf4j.LoggerFactory;
14
+import org.springframework.beans.factory.annotation.Autowired;
15
+import org.springframework.web.bind.annotation.*;
16
+
17
+import javax.servlet.http.HttpServletRequest;
18
+
19
+/**
20
+ * <p>
21
+    * 业务日志记录表  前端控制器
22
+    * </p>
23
+ *
24
+ * @author jobob
25
+ * @since 2021-10-08
26
+ */
27
+@RestController
28
+@RequestMapping("/api")
29
+@Api(value = "", tags = "xlk-")
30
+public class SceneLogController extends BaseController {
31
+
32
+    private final Logger logger = LoggerFactory.getLogger(SceneLogController.class);
33
+
34
+    @Autowired
35
+    public ISceneLogService iSceneLogService;
36
+
37
+
38
+    /**
39
+     * 分页查询列表
40
+     * @param pageNum
41
+     * @param pageSize
42
+     * @return
43
+     */
44
+    @ApiOperation(value = "", notes = "")
45
+    @RequestMapping(value="/sceneLog",method= RequestMethod.GET)
46
+    public ResponseBean sceneLogList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
47
+                                     @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
48
+                                     @RequestHeader("authorization") String token, HttpServletRequest request){
49
+        ResponseBean responseBean = new ResponseBean();
50
+        try {
51
+            //使用分页插件
52
+		    IPage<SceneLog> pg = new Page<>(pageNum, pageSize);
53
+            LambdaQueryWrapper<SceneLog> queryWrapper = new LambdaQueryWrapper<>();
54
+
55
+            IPage<SceneLog> result = iSceneLogService.page(pg, queryWrapper);
56
+            responseBean.addSuccess(result);
57
+        }catch (Exception e){
58
+            e.printStackTrace();
59
+            logger.error("sceneLogList -=- {}",e.toString());
60
+            responseBean.addError(e.getMessage());
61
+        }
62
+        return responseBean;
63
+    }
64
+
65
+    /**
66
+     * 保存对象
67
+     * @param sceneLog 实体对象
68
+     * @return
69
+     */
70
+    @ApiOperation(value = "", notes = "")
71
+    @RequestMapping(value="/sceneLog",method= RequestMethod.POST)
72
+    public ResponseBean sceneLogAdd(@RequestBody SceneLog sceneLog, @RequestHeader("authorization") String token, HttpServletRequest request){
73
+        ResponseBean responseBean = new ResponseBean();
74
+        try {
75
+            if (iSceneLogService.save(sceneLog)){
76
+                responseBean.addSuccess(sceneLog);
77
+            }else {
78
+                responseBean.addError("fail");
79
+            }
80
+        }catch (Exception e){
81
+            e.printStackTrace();
82
+            logger.error("sceneLogAdd -=- {}",e.toString());
83
+            responseBean.addError(e.getMessage());
84
+        }
85
+        return responseBean;
86
+    }
87
+
88
+    /**
89
+     * 根据id删除对象
90
+     * @param id  实体ID
91
+     */
92
+    @ApiOperation(value = "", notes = "")
93
+    @ResponseBody
94
+    @RequestMapping(value="/sceneLog/{id}", method= RequestMethod.DELETE)
95
+    public ResponseBean sceneLogDelete(@PathVariable String id, @RequestHeader("authorization") String token, HttpServletRequest request){
96
+        ResponseBean responseBean = new ResponseBean();
97
+        try {
98
+            if(iSceneLogService.removeById(id)){
99
+                responseBean.addSuccess("success");
100
+            }else {
101
+                responseBean.addError("fail");
102
+            }
103
+        }catch (Exception e){
104
+            e.printStackTrace();
105
+            logger.error("sceneLogDelete -=- {}",e.toString());
106
+            responseBean.addError(e.getMessage());
107
+        }
108
+        return responseBean;
109
+    }
110
+
111
+    /**
112
+     * 修改对象
113
+     * @param id  实体ID
114
+     * @param sceneLog 实体对象
115
+     * @return
116
+     */
117
+    @ApiOperation(value = "", notes = "")
118
+    @RequestMapping(value="/sceneLog/{id}",method= RequestMethod.PUT)
119
+    public ResponseBean sceneLogUpdate(@PathVariable String id,
120
+                                       @RequestBody SceneLog sceneLog, @RequestHeader("authorization") String token, HttpServletRequest request){
121
+        ResponseBean responseBean = new ResponseBean();
122
+        try {
123
+            if (iSceneLogService.updateById(sceneLog)){
124
+                responseBean.addSuccess(sceneLog);
125
+            }else {
126
+                responseBean.addError("fail");
127
+            }
128
+        }catch (Exception e){
129
+            e.printStackTrace();
130
+            logger.error("sceneLogUpdate -=- {}",e.toString());
131
+            responseBean.addError(e.getMessage());
132
+        }
133
+        return responseBean;
134
+    }
135
+
136
+    /**
137
+     * 根据id查询对象
138
+     * @param id  实体ID
139
+     */
140
+    @ApiOperation(value = "", notes = "")
141
+    @RequestMapping(value="/sceneLog/{id}",method= RequestMethod.GET)
142
+    public ResponseBean sceneLogGet(@PathVariable String id, @RequestHeader("authorization") String token, HttpServletRequest request){
143
+        ResponseBean responseBean = new ResponseBean();
144
+        try {
145
+            responseBean.addSuccess(iSceneLogService.getById(id));
146
+        }catch (Exception e){
147
+            e.printStackTrace();
148
+            logger.error("sceneLogDelete -=- {}",e.toString());
149
+            responseBean.addError(e.getMessage());
150
+        }
151
+        return responseBean;
152
+    }
153
+}

+ 118
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/SearchHouseController.java 查看文件

@@ -1,5 +1,9 @@
1 1
 package com.yunzhi.marketing.xlk.controller;
2 2
 
3
+import com.alibaba.excel.EasyExcel;
4
+import com.alibaba.excel.ExcelWriter;
5
+import com.alibaba.excel.write.metadata.WriteSheet;
6
+import com.alibaba.fastjson.JSONArray;
3 7
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
4 8
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
5 9
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -9,12 +13,19 @@ import com.yunzhi.marketing.base.ResponseBean;
9 13
 import com.yunzhi.marketing.common.CommConstant;
10 14
 import com.yunzhi.marketing.common.StringUtils;
11 15
 import com.yunzhi.marketing.entity.*;
16
+import com.yunzhi.marketing.excel.IntentionUser;
17
+import com.yunzhi.marketing.excel.handler.CustomCellWriteHandler;
18
+import com.yunzhi.marketing.excel.searchHouse.AddedValue;
19
+import com.yunzhi.marketing.excel.searchHouse.BuyRoom;
20
+import com.yunzhi.marketing.excel.searchHouse.Overseas;
21
+import com.yunzhi.marketing.excel.searchHouse.Rent;
12 22
 import com.yunzhi.marketing.service.*;
13 23
 import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
14 24
 import com.yunzhi.marketing.xlk.dto.SearchHouseReplayDTO;
15 25
 import com.yunzhi.marketing.xlk.entity.Curriculum;
16 26
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
17 27
 import com.yunzhi.marketing.xlk.service.ISearchHouseService;
28
+import com.yunzhi.marketing.xlk.vo.ExportSearchHouseVO;
18 29
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
19 30
 import io.swagger.annotations.Api;
20 31
 import io.swagger.annotations.ApiOperation;
@@ -26,7 +37,11 @@ import org.springframework.beans.factory.annotation.Autowired;
26 37
 import org.springframework.web.bind.annotation.*;
27 38
 
28 39
 import javax.servlet.http.HttpServletRequest;
40
+import javax.servlet.http.HttpServletResponse;
41
+import java.io.IOException;
29 42
 import java.time.LocalDateTime;
43
+import java.time.format.DateTimeFormatter;
44
+import java.util.ArrayList;
30 45
 import java.util.HashMap;
31 46
 import java.util.List;
32 47
 import java.util.Map;
@@ -98,6 +113,109 @@ public class SearchHouseController extends BaseController {
98 113
         return responseBean;
99 114
     }
100 115
 
116
+    /**
117
+     * 导出数据列表
118
+     * @return
119
+     */
120
+    @ApiOperation(value = "admin-导出帮我找房列表", notes = "admin-导出帮我找房列表")
121
+    @RequestMapping(value="/admin/exportHouse",method= RequestMethod.GET)
122
+    public void exportHouse(@RequestParam(value ="type") Integer type,
123
+                                    @RequestParam(value ="name", required = false) String name,
124
+                                    @RequestParam(value ="phone", required = false) String phone,
125
+                                    @RequestParam(value ="status", required = false) String status,
126
+                                    @RequestHeader("authorization") String token, HttpServletRequest request, HttpServletResponse response) throws IOException {
127
+        response.setContentType("application/octet-stream");
128
+        response.setCharacterEncoding("utf-8");
129
+        response.setHeader("Content-disposition", "attachment;filename=帮我找房.xlsx");
130
+        SearchHouseVO searchHouse = new SearchHouseVO();
131
+        searchHouse.setOrgId(getOrgId(request));
132
+        searchHouse.setType(type);
133
+        searchHouse.setNickname(name);
134
+        searchHouse.setPhone(phone);
135
+        searchHouse.setStatus(status);
136
+        List<ExportSearchHouseVO> result = iSearchHouseService.selectExportHouseList(searchHouse);
137
+
138
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
139
+        if (searchHouse.getType() == 4) {
140
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), AddedValue.class).registerWriteHandler(new CustomCellWriteHandler()).build();
141
+            // 设置 sheet, 同一个sheet只需要设置一次
142
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
143
+            List<AddedValue> list = new ArrayList<>();
144
+            result.forEach(e -> {
145
+                AddedValue addedValue = new AddedValue();
146
+                String format = formatter.format(e.getCreatedTime());
147
+                addedValue.setCreatedTime(format);
148
+                e.setGender("未知");
149
+                if (StringUtils.isEmpty(e.getGender())) {
150
+                    e.setGender(e.getGender().equals("1") ? "男" : e.getGender().equals("2") ? "女" : "未知");
151
+                }
152
+                BeanUtils.copyProperties(e,addedValue);
153
+                list.add(addedValue);
154
+            });
155
+            excelWriter.write(list, writeSheet);
156
+            // finish 会帮忙关闭流
157
+            excelWriter.finish();
158
+        }else if (searchHouse.getType() == 1) {
159
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), BuyRoom.class).registerWriteHandler(new CustomCellWriteHandler()).build();
160
+            // 设置 sheet, 同一个sheet只需要设置一次
161
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
162
+            List<BuyRoom> list = new ArrayList<>();
163
+            result.forEach(e -> {
164
+                BuyRoom buyRoom = new BuyRoom();
165
+                String format = formatter.format(e.getCreatedTime());
166
+                buyRoom.setCreatedTime(format);
167
+                e.setGender("未知");
168
+                if (StringUtils.isEmpty(e.getGender())) {
169
+                    e.setGender(e.getGender().equals("1") ? "男" : e.getGender().equals("2") ? "女" : "未知");
170
+                }
171
+
172
+                BeanUtils.copyProperties(e,buyRoom);
173
+                list.add(buyRoom);
174
+            });
175
+            excelWriter.write(list, writeSheet);
176
+            // finish 会帮忙关闭流
177
+            excelWriter.finish();
178
+        }else if (searchHouse.getType() == 3) {
179
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), Overseas.class).registerWriteHandler(new CustomCellWriteHandler()).build();
180
+            // 设置 sheet, 同一个sheet只需要设置一次
181
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
182
+            List<Overseas> list = new ArrayList<>();
183
+            result.forEach(e -> {
184
+                Overseas overseas = new Overseas();
185
+                String format = formatter.format(e.getCreatedTime());
186
+                overseas.setCreatedTime(format);
187
+                e.setGender("未知");
188
+                if (StringUtils.isEmpty(e.getGender())) {
189
+                    e.setGender(e.getGender().equals("1") ? "男" : e.getGender().equals("2") ? "女" : "未知");
190
+                }
191
+                BeanUtils.copyProperties(e,overseas);
192
+                list.add(overseas);
193
+            });
194
+            excelWriter.write(list, writeSheet);
195
+            // finish 会帮忙关闭流
196
+            excelWriter.finish();
197
+        }else if (searchHouse.getType() == 2) {
198
+            ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream(), Rent.class).registerWriteHandler(new CustomCellWriteHandler()).build();
199
+            // 设置 sheet, 同一个sheet只需要设置一次
200
+            WriteSheet writeSheet = EasyExcel.writerSheet("帮我找房").build();
201
+            List<Rent> list = new ArrayList<>();
202
+            result.forEach(e -> {
203
+                Rent rent = new Rent();
204
+                String format = formatter.format(e.getCreatedTime());
205
+                rent.setCreatedTime(format);
206
+                e.setGender("未知");
207
+                if (StringUtils.isEmpty(e.getGender())) {
208
+                    e.setGender(e.getGender().equals("1") ? "男" : e.getGender().equals("2") ? "女" : "未知");
209
+                }
210
+                BeanUtils.copyProperties(e,rent);
211
+                list.add(rent);
212
+            });
213
+            excelWriter.write(list, writeSheet);
214
+            // finish 会帮忙关闭流
215
+            excelWriter.finish();
216
+        }
217
+    }
218
+
101 219
     /**
102 220
      * 保存对象
103 221
      * @param searchHouseDTO 实体对象

+ 7
- 0
src/main/java/com/yunzhi/marketing/xlk/controller/TrendController.java 查看文件

@@ -7,6 +7,7 @@ import com.yunzhi.marketing.base.BaseController;
7 7
 import com.yunzhi.marketing.base.ResponseBean;
8 8
 import com.yunzhi.marketing.xlk.dto.TrendDTO;
9 9
 import com.yunzhi.marketing.xlk.entity.Trend;
10
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
10 11
 import com.yunzhi.marketing.xlk.service.ITrendService;
11 12
 import io.swagger.annotations.Api;
12 13
 import io.swagger.annotations.ApiOperation;
@@ -44,6 +45,8 @@ public class TrendController extends BaseController {
44 45
     @Autowired
45 46
     public ITrendService iTrendService;
46 47
 
48
+    @Autowired
49
+    private ISceneLogService iSceneLogService;
47 50
 
48 51
     /**
49 52
      * 分页查询列表
@@ -93,6 +96,7 @@ public class TrendController extends BaseController {
93 96
             trend.setOrgId(getOrgId(request));
94 97
             trend.setCreateDate(LocalDateTime.now());
95 98
             if (iTrendService.save(trend)){
99
+                iSceneLogService.saveLogs(getUserId(request),"trend",trend.getBuildingId());
96 100
                 responseBean.addSuccess(trend);
97 101
             }else {
98 102
                 responseBean.addError("fail");
@@ -116,6 +120,8 @@ public class TrendController extends BaseController {
116 120
         ResponseBean responseBean = new ResponseBean();
117 121
         try {
118 122
             if(iTrendService.removeById(id)){
123
+                Trend trend = iTrendService.getById(id);
124
+                iSceneLogService.saveLogs(getUserId(request),"trend",trend.getBuildingId());
119 125
                 responseBean.addSuccess("success");
120 126
             }else {
121 127
                 responseBean.addError("fail");
@@ -144,6 +150,7 @@ public class TrendController extends BaseController {
144 150
             BeanUtils.copyProperties(trendDTO,trend);
145 151
             trend.setTrendId(id);
146 152
             if (iTrendService.updateById(trend)){
153
+                iSceneLogService.saveLogs(getUserId(request),"trend",trend.getBuildingId());
147 154
                 responseBean.addSuccess(trend);
148 155
             }else {
149 156
                 responseBean.addError("fail");

+ 31
- 1
src/main/java/com/yunzhi/marketing/xlk/controller/VideoController.java 查看文件

@@ -6,8 +6,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 7
 import com.yunzhi.marketing.base.BaseController;
8 8
 import com.yunzhi.marketing.base.ResponseBean;
9
+import com.yunzhi.marketing.common.CommConstant;
9 10
 import com.yunzhi.marketing.common.StringUtils;
10 11
 import com.yunzhi.marketing.entity.TaBuilding;
12
+import com.yunzhi.marketing.entity.TaLiveActivity;
11 13
 import com.yunzhi.marketing.entity.TaPerson;
12 14
 import com.yunzhi.marketing.service.ITaBuildingService;
13 15
 import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
@@ -75,7 +77,7 @@ public class VideoController extends BaseController {
75 77
             //使用分页插件
76 78
 		    IPage<Video> pg = new Page<>(pageNum, pageSize);
77 79
             LambdaQueryWrapper<Video> queryWrapper = new LambdaQueryWrapper<>();
78
-            queryWrapper.eq(!StringUtils.isEmpty(name),Video::getName,name);
80
+            queryWrapper.like(!StringUtils.isEmpty(name),Video::getName, "%" + name + "%");
79 81
             queryWrapper.eq(Video::getOrgId,getOrgId(request));
80 82
             queryWrapper.in(Video::getInstitutionId,getInstitutionIds(request));
81 83
             queryWrapper.orderByDesc(Video::getWeight);
@@ -178,6 +180,34 @@ public class VideoController extends BaseController {
178 180
         return responseBean;
179 181
     }
180 182
 
183
+    /**
184
+     * 推首页
185
+     *
186
+     * @param id             实体ID
187
+     * @return
188
+     */
189
+    @RequestMapping(value = "/admin/home/video/{id}", method = RequestMethod.PUT)
190
+    public ResponseBean taLiveActivityHome(@PathVariable String id,HttpServletRequest request) {
191
+        ResponseBean responseBean = new ResponseBean();
192
+        try {
193
+            Video video = iVideoService.getById(id);
194
+            if (CommConstant.NOT_PUBLISH.equals(video.getIsHome())) {
195
+                video.setIsHome(CommConstant.IS_PUBLISH);
196
+            }else if (CommConstant.IS_PUBLISH.equals(video.getIsHome())) {
197
+                video.setIsHome(CommConstant.NOT_PUBLISH);
198
+            }
199
+            video.setUpdatedTime(LocalDateTime.now());
200
+            video.setUpdatedBy(getUserId(request).toString());
201
+            iVideoService.updateById(video);
202
+            responseBean.addSuccess(video);
203
+        } catch (Exception e) {
204
+            e.printStackTrace();
205
+            logger.error("taLiveActivityUpdate -=- {}", e.toString());
206
+            responseBean.addError(e.getMessage());
207
+        }
208
+        return responseBean;
209
+    }
210
+
181 211
     /**
182 212
      * 根据id查询对象
183 213
      * @param id  实体ID

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerPreparatory.java 查看文件

@@ -91,4 +91,6 @@ public class CustomerPreparatory implements Serializable {
91 91
      * 渠道ID
92 92
      */
93 93
     private Integer channelId;
94
+
95
+    private String channelCustomerId;
94 96
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerSignatory.java 查看文件

@@ -114,4 +114,6 @@ public class CustomerSignatory implements Serializable {
114 114
     private LocalDateTime successDate ;
115 115
     /** 类型 */
116 116
     private String type ;
117
+
118
+    private String channelCustomerId;
117 119
 }

+ 2
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/CustomerVisit.java 查看文件

@@ -93,4 +93,6 @@ public class CustomerVisit implements Serializable {
93 93
     private Integer channelId;
94 94
 
95 95
     private LocalDateTime visitDate;
96
+
97
+    private String channelCustomerId;
96 98
 }

+ 66
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/SceneLog.java 查看文件

@@ -0,0 +1,66 @@
1
+package com.yunzhi.marketing.xlk.entity;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import lombok.Data;
7
+import lombok.EqualsAndHashCode;
8
+import lombok.experimental.Accessors;
9
+
10
+import java.io.Serializable;
11
+import java.time.LocalDateTime;
12
+
13
+/**
14
+ * <p>
15
+ * 业务日志记录表 
16
+ * </p>
17
+ *
18
+ * @author jobob
19
+ * @since 2021-10-08
20
+ */
21
+@Data
22
+@EqualsAndHashCode(callSuper = false)
23
+@Accessors(chain = true)
24
+@TableName("xlk_scene_log")
25
+public class SceneLog implements Serializable {
26
+
27
+    private static final long serialVersionUID = 1L;
28
+
29
+    /**
30
+     * 组织结构id
31
+     */
32
+    @TableId(type = IdType.UUID)
33
+    private String id;
34
+
35
+    /**
36
+     * 日志类型
37
+     */
38
+    private String type;
39
+
40
+    /**
41
+     * 日志主键
42
+     */
43
+    private String uuid;
44
+
45
+    /**
46
+     * 更新人
47
+     */
48
+    private String updateId;
49
+
50
+    /**
51
+     * 更新人姓名
52
+     */
53
+    private String updateName;
54
+
55
+    /**
56
+     * 更新时间
57
+     */
58
+    private LocalDateTime updateTime;
59
+
60
+    /**
61
+     * 更新内容
62
+     */
63
+    private String content;
64
+
65
+
66
+}

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/entity/Video.java 查看文件

@@ -97,6 +97,11 @@ public class Video implements Serializable {
97 97
      */
98 98
     private String remark;
99 99
 
100
+    /**
101
+     * 是否推首页
102
+     */
103
+    private Integer isHome;
104
+
100 105
     /**
101 106
      * 视频地址
102 107
      */

+ 5
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/CustomerSignatoryMapper.java 查看文件

@@ -1,8 +1,11 @@
1 1
 package com.yunzhi.marketing.xlk.mapper;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
4 5
 import com.yunzhi.marketing.xlk.entity.CustomerSignatory;
6
+import com.yunzhi.marketing.xlk.vo.CustomerSignatoryVO;
5 7
 import org.apache.ibatis.annotations.Mapper;
8
+import org.apache.ibatis.annotations.Param;
6 9
 
7 10
 /**
8 11
  * <p>
@@ -15,4 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
15 18
 @Mapper
16 19
 public interface CustomerSignatoryMapper extends BaseMapper<CustomerSignatory> {
17 20
 
21
+    IPage<CustomerSignatoryVO> getCustomerSignatoryList(IPage<CustomerSignatoryVO> pg, @Param("buildingId") String buildingId,@Param("name") String name,
22
+                                                        @Param("phone") String phone,@Param("type") String type, @Param("orgId") Integer orgId);
18 23
 }

+ 28
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/SceneLogMapper.java 查看文件

@@ -0,0 +1,28 @@
1
+package com.yunzhi.marketing.xlk.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.baomidou.mybatisplus.core.metadata.IPage;
5
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
+import com.yunzhi.marketing.entity.TaBuilding;
7
+import com.yunzhi.marketing.entity.TaPersonBuilding;
8
+import com.yunzhi.marketing.xlk.entity.SceneLog;
9
+import com.yunzhi.marketing.xlk.vo.BuildingLogVO;
10
+import org.apache.ibatis.annotations.Mapper;
11
+import org.apache.ibatis.annotations.Param;
12
+
13
+import java.util.List;
14
+import java.util.Map;
15
+
16
+/**
17
+ * <p>
18
+ * 业务日志记录表  Mapper 接口
19
+ * </p>
20
+ *
21
+ * @author jobob
22
+ * @since 2021-10-08
23
+ */
24
+@Mapper
25
+public interface SceneLogMapper extends BaseMapper<SceneLog> {
26
+
27
+    IPage<BuildingLogVO> getBuildingLogs(Page<BuildingLogVO> page, @Param("buildingId") String buildingId, @Param("personBuildingList") List<TaPersonBuilding> taPersonBuildingList, @Param("institutionIds") List<String> institutionIds);
28
+}

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/mapper/SearchHouseMapper.java 查看文件

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.yunzhi.marketing.entity.TaBuilding;
6 6
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
7
+import com.yunzhi.marketing.xlk.vo.ExportSearchHouseVO;
7 8
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
8 9
 import org.apache.ibatis.annotations.Mapper;
9 10
 import org.apache.ibatis.annotations.Param;
@@ -33,4 +34,6 @@ public interface SearchHouseMapper extends BaseMapper<SearchHouse> {
33 34
                                            @Param("minPrice") Integer minPrice,
34 35
                                            @Param("maxPrice") Integer maxPrice,
35 36
                                            @Param("limit") Integer limit);
37
+
38
+    List<ExportSearchHouseVO> selectExportHouseList(@Param("params") SearchHouseVO searchHouse);
36 39
 }

+ 3
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ICustomerSignatoryService.java 查看文件

@@ -1,7 +1,9 @@
1 1
 package com.yunzhi.marketing.xlk.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.baomidou.mybatisplus.extension.service.IService;
4 5
 import com.yunzhi.marketing.xlk.entity.CustomerSignatory;
6
+import com.yunzhi.marketing.xlk.vo.CustomerSignatoryVO;
5 7
 
6 8
 /**
7 9
  * <p>
@@ -13,4 +15,5 @@ import com.yunzhi.marketing.xlk.entity.CustomerSignatory;
13 15
  */
14 16
 public interface ICustomerSignatoryService extends IService<CustomerSignatory> {
15 17
 
18
+    IPage<CustomerSignatoryVO> getCustomerSignatoryList(IPage<CustomerSignatoryVO> pg, String buildingId, String name, String phone, String type, Integer orgId);
16 19
 }

+ 23
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ISceneLogService.java 查看文件

@@ -0,0 +1,23 @@
1
+package com.yunzhi.marketing.xlk.service;
2
+
3
+import com.baomidou.mybatisplus.extension.service.IService;
4
+import com.yunzhi.marketing.base.ResponseBean;
5
+import com.yunzhi.marketing.entity.TaPersonBuilding;
6
+import com.yunzhi.marketing.xlk.entity.SceneLog;
7
+
8
+import java.util.List;
9
+
10
+/**
11
+ * <p>
12
+ * 业务日志记录表  服务类
13
+ * </p>
14
+ *
15
+ * @author jobob
16
+ * @since 2021-10-08
17
+ */
18
+public interface ISceneLogService extends IService<SceneLog> {
19
+
20
+    void saveLogs(Integer userId, String type, String uuid);
21
+
22
+    ResponseBean getBuildingLogs(Integer pageNum, Integer pageSize, String buildingId, List<TaPersonBuilding> taPersonBuildingListByUserId, List<String> institutionIds);
23
+}

+ 8
- 0
src/main/java/com/yunzhi/marketing/xlk/service/ISearchHouseService.java 查看文件

@@ -6,6 +6,7 @@ import com.yunzhi.marketing.base.ResponseBean;
6 6
 import com.yunzhi.marketing.entity.TaBuilding;
7 7
 import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
8 8
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
9
+import com.yunzhi.marketing.xlk.vo.ExportSearchHouseVO;
9 10
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
10 11
 
11 12
 import java.util.List;
@@ -37,4 +38,11 @@ public interface ISearchHouseService extends IService<SearchHouse> {
37 38
      * @return
38 39
      */
39 40
     List<TaBuilding> getRecommendBuildings(Integer orgId, SearchHouseDTO searchHouseDTO);
41
+
42
+    /**
43
+     * 获取导出的数据集合
44
+     * @param searchHouse
45
+     * @return
46
+     */
47
+    List<ExportSearchHouseVO> selectExportHouseList(SearchHouseVO searchHouse);
40 48
 }

+ 6
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/ChannelCustomerServiceImpl.java 查看文件

@@ -155,6 +155,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
155 155
 
156 156
 
157 157
         customerVisit.setCreateDate(LocalDateTime.now());
158
+        customerVisit.setChannelCustomerId(channelCustomerDTO.getChannelCustomerId());
158 159
         customerVisitMapper.insert(customerVisit);
159 160
 
160 161
         return ResponseBean.success("审核成功");
@@ -242,6 +243,8 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
242 243
                 recommendCustomer.setCirculationTime(LocalDateTime.now());
243 244
                 recommendCustomer.setName(customerVisit.getName());
244 245
                 taRecommendCustomerMapper.updateById(recommendCustomer);
246
+            }else {
247
+                return ResponseBean.error("该客户已到访", ResponseBean.ERROR_UNAVAILABLE);
245 248
             }
246 249
         }else if ("customer".equals(params.getType())) {
247 250
             // 置业顾问 经纪人推荐的客户
@@ -340,8 +343,10 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
340 343
      */
341 344
     @Override
342 345
     public ResponseBean preparatoryCustomer(MarkingPreparatoryCustomerDTO params) {
346
+        CustomerPreparatory customerPreparatory = params.getCustomerPreparatory();
343 347
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getCustomerId());
344 348
         taRecommendCustomer.setStatus(CommConstant.CUSTOMER_PREPARATORY);
349
+        taRecommendCustomer.setRealtyConsultant(customerPreparatory.getRealtyConsultant());
345 350
         taRecommendCustomerMapper.updateById(taRecommendCustomer);
346 351
 
347 352
         LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -352,7 +357,6 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
352 357
             channelCustomerMapper.updateById(customer);
353 358
         }
354 359
 
355
-        CustomerPreparatory customerPreparatory = params.getCustomerPreparatory();
356 360
         customerPreparatory.setCreateDate(LocalDateTime.now());
357 361
         customerPreparatory.setBuildingId(taRecommendCustomer.getBuildingId());
358 362
         customerPreparatory.setRecommendPerson(taRecommendCustomer.getRecommendPerson());
@@ -387,6 +391,7 @@ public class ChannelCustomerServiceImpl extends ServiceImpl<ChannelCustomerMappe
387 391
         CustomerSignatory customerSignatory = params.getCustomerSignatory();
388 392
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.selectById(params.getCustomerId());
389 393
         taRecommendCustomer.setStatus(CommConstant.CUSTOMER_COMMISSION);
394
+        taRecommendCustomer.setRealtyConsultant(customerSignatory.getRealtyConsultant());
390 395
         taRecommendCustomerMapper.updateById(taRecommendCustomer);
391 396
 
392 397
         LambdaQueryWrapper<ChannelCustomer> channelCustomerLambdaQueryWrapper = new LambdaQueryWrapper<>();

+ 48
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/CustomerInfoServiceImpl.java 查看文件

@@ -6,11 +6,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.yunzhi.marketing.common.StringUtils;
8 8
 import com.yunzhi.marketing.drainage.entity.TaDrainage;
9
+import com.yunzhi.marketing.drainage.mapper.TaDrainageMapper;
9 10
 import com.yunzhi.marketing.entity.*;
10 11
 import com.yunzhi.marketing.mapper.*;
11 12
 import com.yunzhi.marketing.service.IMiniAppService;
12 13
 import com.yunzhi.marketing.xlk.entity.CustomerInfo;
14
+import com.yunzhi.marketing.xlk.entity.Video;
13 15
 import com.yunzhi.marketing.xlk.mapper.CustomerInfoMapper;
16
+import com.yunzhi.marketing.xlk.mapper.VideoMapper;
14 17
 import com.yunzhi.marketing.xlk.service.ICustomerInfoService;
15 18
 import com.yunzhi.marketing.xlk.vo.CustomerInfoVO;
16 19
 import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +50,19 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
47 50
     @Autowired
48 51
     private TaBuildingDynamicMapper taBuildingDynamicMapper;
49 52
 
53
+    @Autowired
54
+    private TaLiveActivityMapper taLiveActivityMapper;
55
+
56
+    @Autowired
57
+    private VideoMapper videoMapper;
58
+
59
+    @Autowired
60
+    private TaNewsMapper taNewsMapper;
61
+
62
+    @Autowired
63
+    private TaDrainageMapper taDrainageMapper;
64
+
65
+
50 66
     /**
51 67
      * 获取其他信息
52 68
      *
@@ -65,14 +81,45 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
65 81
         if (!StringUtils.isEmpty(personId)) {
66 82
             List<TaPersonVisitRecord> records = taPersonVisitRecordMapper.visitRecordByPersonIdNew(personId);
67 83
             records.forEach(e -> {
84
+                if (StringUtils.isEmpty(e.getTargetId())){
85
+                    return;
86
+                }
68 87
                 //获取活动标题
69
-                if ("activity".equals(e.getEventType()) && null != e.getTargetId()) {
88
+                if ("activity".equals(e.getEventType()) || "house".equals(e.getEventType()) || "dymic".equals(e.getEventType()) || "look".equals(e.getEventType())) {
70 89
                     TaBuildingDynamic taBuildingDynamic = taBuildingDynamicMapper.selectById(e.getTargetId());
71 90
                     if (null != taBuildingDynamic) {
72 91
                         e.setActivityName(taBuildingDynamic.getTitle());
73 92
                     }
74 93
 
75 94
                 }
95
+                //获取拼团标题
96
+                if ("live".equals(e.getEventType()) && null != e.getTargetId()) {
97
+                    TaLiveActivity taLiveActivity = taLiveActivityMapper.selectById(e.getTargetId());
98
+                    if (null != taLiveActivity) {
99
+                        e.setActivityName(taLiveActivity.getLiveActivityTitle());
100
+                    }
101
+                }
102
+                //获取助力标题
103
+                if ("video".equals(e.getEventType()) && null != e.getTargetId()) {
104
+                    Video video = videoMapper.selectById(e.getTargetId());
105
+                    if (null != video) {
106
+                        e.setActivityName(video.getName());
107
+                    }
108
+                }
109
+                //获取咨询标题
110
+                if ("news".equals(e.getEventType()) && null != e.getTargetId()) {
111
+                    TaNews taNews = taNewsMapper.selectById(e.getTargetId());
112
+                    if (null != taNews) {
113
+                        e.setActivityName(taNews.getNewsName());
114
+                    }
115
+                }
116
+                //获取H5活动标题
117
+                if ("h5".equals(e.getEventType()) && null != e.getTargetId()) {
118
+                    TaDrainage taDrainage = taDrainageMapper.selectById(e.getTargetId());
119
+                    if (null != taDrainage) {
120
+                        e.setActivityName(taDrainage.getName());
121
+                    }
122
+                }
76 123
             });
77 124
             customerInfoVO.setPersonVisitRecords(records);
78 125
             customerInfoVO.setVisitTimes(records.size());

+ 6
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/CustomerSignatoryServiceImpl.java 查看文件

@@ -1,9 +1,11 @@
1 1
 package com.yunzhi.marketing.xlk.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 5
 import com.yunzhi.marketing.xlk.entity.CustomerSignatory;
5 6
 import com.yunzhi.marketing.xlk.mapper.CustomerSignatoryMapper;
6 7
 import com.yunzhi.marketing.xlk.service.ICustomerSignatoryService;
8
+import com.yunzhi.marketing.xlk.vo.CustomerSignatoryVO;
7 9
 import org.springframework.stereotype.Service;
8 10
 
9 11
 /**
@@ -17,4 +19,8 @@ import org.springframework.stereotype.Service;
17 19
 @Service
18 20
 public class CustomerSignatoryServiceImpl extends ServiceImpl<CustomerSignatoryMapper, CustomerSignatory> implements ICustomerSignatoryService {
19 21
 
22
+    @Override
23
+    public IPage<CustomerSignatoryVO> getCustomerSignatoryList(IPage<CustomerSignatoryVO> pg, String buildingId, String name, String phone, String type, Integer orgId) {
24
+        return this.baseMapper.getCustomerSignatoryList(pg,buildingId,name,phone,type,orgId);
25
+    }
20 26
 }

+ 9
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/IPcStatisticsServiceimpl.java 查看文件

@@ -88,6 +88,15 @@ public class IPcStatisticsServiceimpl implements IPcStatisticsService {
88 88
         PcStatisticsDTO statisticsDTO = new PcStatisticsDTO();
89 89
         statisticsDTO.setOrgId(taUser.getOrgId());
90 90
         PcStatisticsVO userOriginStatistics = pcStatisticsMapper.getUserOriginStatistics(statisticsDTO);
91
+        if (null == userOriginStatistics.getConsultantNum()){
92
+            userOriginStatistics.setConsultantNum(0);
93
+        }
94
+        if (null == userOriginStatistics.getCustomerNum()){
95
+            userOriginStatistics.setCustomerNum(0);
96
+        }
97
+        if (null == userOriginStatistics.getEstageNum()){
98
+            userOriginStatistics.setEstageNum(0);
99
+        }
91 100
         Integer otherNum = userOriginStatistics.getAllPersonNum() - userOriginStatistics.getConsultantNum() - userOriginStatistics.getCustomerNum() -userOriginStatistics.getEstageNum();
92 101
         userOriginStatistics.setOrherNum(otherNum);
93 102
         return ResponseBean.success(userOriginStatistics);

+ 1
- 1
src/main/java/com/yunzhi/marketing/xlk/service/impl/InstitutionServiceImpl.java 查看文件

@@ -74,7 +74,7 @@ public class InstitutionServiceImpl extends ServiceImpl<InstitutionMapper, Insti
74 74
     public ResponseBean deleteByinstitutionCode(String id) {
75 75
         Institution institution = institutionMapper.selectById(id);
76 76
         LambdaQueryWrapper<Institution> queryWrapper = new LambdaQueryWrapper<>();
77
-        queryWrapper.likeLeft(Institution::getInstitutionCode,institution.getInstitutionCode());
77
+        queryWrapper.likeRight(Institution::getInstitutionCode,institution.getInstitutionCode());
78 78
         List<Institution> institutions = institutionMapper.selectList(queryWrapper);
79 79
         if (institutions.size() > 1) {
80 80
             return ResponseBean.error("请先删除子公司", ResponseBean.ERROR_UNAVAILABLE);

+ 54
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/SceneLogServiceImpl.java 查看文件

@@ -0,0 +1,54 @@
1
+package com.yunzhi.marketing.xlk.service.impl;
2
+
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
4
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6
+import com.yunzhi.marketing.base.ResponseBean;
7
+import com.yunzhi.marketing.center.taUser.entity.TaUser;
8
+import com.yunzhi.marketing.center.taUser.mapper.TaUserMapper;
9
+import com.yunzhi.marketing.entity.TaBuilding;
10
+import com.yunzhi.marketing.entity.TaPersonBuilding;
11
+import com.yunzhi.marketing.xlk.entity.SceneLog;
12
+import com.yunzhi.marketing.xlk.mapper.SceneLogMapper;
13
+import com.yunzhi.marketing.xlk.service.ISceneLogService;
14
+import com.yunzhi.marketing.xlk.vo.BuildingLogVO;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.stereotype.Service;
17
+
18
+import java.time.LocalDateTime;
19
+import java.util.List;
20
+import java.util.Map;
21
+
22
+/**
23
+ * <p>
24
+ * 业务日志记录表  服务实现类
25
+ * </p>
26
+ *
27
+ * @author jobob
28
+ * @since 2021-10-08
29
+ */
30
+@Service
31
+public class SceneLogServiceImpl extends ServiceImpl<SceneLogMapper, SceneLog> implements ISceneLogService {
32
+
33
+    @Autowired
34
+    private TaUserMapper taUserMapper;
35
+
36
+    @Override
37
+    public void saveLogs(Integer userId, String type, String uuid) {
38
+        TaUser taUser = taUserMapper.selectById(userId);
39
+        SceneLog sceneLog = new SceneLog();
40
+        sceneLog.setType(type);
41
+        sceneLog.setUuid(uuid);
42
+        sceneLog.setUpdateId(String.valueOf(userId));
43
+        sceneLog.setUpdateName(taUser.getUserName());
44
+        sceneLog.setUpdateTime(LocalDateTime.now());
45
+        this.baseMapper.insert(sceneLog);
46
+    }
47
+
48
+    @Override
49
+    public ResponseBean getBuildingLogs(Integer pageNum, Integer pageSize, String buildingId, List<TaPersonBuilding> taPersonBuildingList, List<String> InstitutionIds) {
50
+        Page<BuildingLogVO> page = new Page<>(pageNum, pageSize);
51
+        IPage<BuildingLogVO> buildings = this.baseMapper.getBuildingLogs(page, buildingId, taPersonBuildingList, InstitutionIds);
52
+        return ResponseBean.success(buildings);
53
+    }
54
+}

+ 67
- 0
src/main/java/com/yunzhi/marketing/xlk/service/impl/SearchHouseServiceImpl.java 查看文件

@@ -1,5 +1,8 @@
1 1
 package com.yunzhi.marketing.xlk.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONArray;
5
+import com.alibaba.fastjson.JSONObject;
3 6
 import com.baomidou.mybatisplus.core.metadata.IPage;
4 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 8
 import com.yunzhi.marketing.base.ResponseBean;
@@ -12,11 +15,15 @@ import com.yunzhi.marketing.xlk.dto.SearchHouseDTO;
12 15
 import com.yunzhi.marketing.xlk.entity.SearchHouse;
13 16
 import com.yunzhi.marketing.xlk.mapper.SearchHouseMapper;
14 17
 import com.yunzhi.marketing.xlk.service.ISearchHouseService;
18
+import com.yunzhi.marketing.xlk.vo.ExportSearchHouseVO;
19
+import com.yunzhi.marketing.xlk.vo.QuestionnaireVO;
15 20
 import com.yunzhi.marketing.xlk.vo.SearchHouseVO;
16 21
 import io.swagger.models.auth.In;
17 22
 import org.springframework.beans.factory.annotation.Autowired;
18 23
 import org.springframework.stereotype.Service;
19 24
 
25
+import java.lang.reflect.Field;
26
+import java.lang.reflect.Method;
20 27
 import java.util.List;
21 28
 
22 29
 /**
@@ -117,6 +124,66 @@ public class SearchHouseServiceImpl extends ServiceImpl<SearchHouseMapper, Searc
117 124
         return searchHouseMapper.getRecommendBuildings(orgId, cityId, null, minPriceW, maxPriceW, minPrice, maxPrice, limit);
118 125
     }
119 126
 
127
+    /**
128
+     * 获取导出的数据集合
129
+     *
130
+     * @param searchHouse
131
+     * @return
132
+     */
133
+    @Override
134
+    public List<ExportSearchHouseVO> selectExportHouseList(SearchHouseVO searchHouse) {
135
+        List<ExportSearchHouseVO> searchHouseVOS = searchHouseMapper.selectExportHouseList(searchHouse);
136
+        searchHouseVOS.forEach(e -> {
137
+            String questionnaire = e.getQuestionnaire();
138
+            List<QuestionnaireVO> questionnaireVO = JSON.parseArray(questionnaire,QuestionnaireVO.class);
139
+            questionnaireVO.forEach(s -> {
140
+                try {
141
+                    Field declaredField = e.getClass().getDeclaredField(s.getKey());
142
+                    String name = declaredField.getName();
143
+                    String subName = name.substring(0, 1).toUpperCase() + name.substring(1);
144
+                    Method method = e.getClass().getMethod("set" + subName,String.class);
145
+                    String result = String.valueOf(s.getResult());
146
+                    String type = s.getType();
147
+                    String resultId = null == s.getResultId() ? null : String.valueOf(s.getResultId());
148
+                    if (searchHouse.getType() == 4) {
149
+                        if (name == "maxPrice"){
150
+                            Integer price = Integer.valueOf(result) / 10000;
151
+                            result = String.valueOf(price);
152
+                        }
153
+                    }else if (searchHouse.getType() == 1) {
154
+                        if (name == "maxPrice"){
155
+                            Integer price = Integer.valueOf(result) / 10000;
156
+                            result = String.valueOf(price);
157
+                        }
158
+                        if (type == "checkbox") {
159
+                            result = resultId;
160
+                        }
161
+                        if (type == "checkboxs") {
162
+                            JSONArray optionArr = JSONArray.parseArray(String.valueOf(s.getOptions()));
163
+                        }
164
+                    }else if (searchHouse.getType() == 3) {
165
+                        if (name == "maxPrice"){
166
+                            Integer price = Integer.valueOf(result) / 10000;
167
+                            result = String.valueOf(price);
168
+                        }
169
+                        if (type == "checkbox") {
170
+                            result = resultId;
171
+                        }
172
+                    }
173
+                    if ("purpose".equals(name)|| "advantage".equals(name)|| "facility".equals(name)|| "important".equals(name)||
174
+                    "style".equals(name)|| "mostImportant".equals(name)|| "special".equals(name)) {
175
+                        result = result.replace("[","").replace("]","");
176
+                    }
177
+                    method.invoke(e,result);
178
+                } catch (Exception ex) {
179
+                    ex.printStackTrace();
180
+                }
181
+            });
182
+
183
+        });
184
+        return searchHouseVOS;
185
+    }
186
+
120 187
     private Integer[] getUnitPriceRange(Integer minPriceW, Integer maxPriceW, Integer areaResultId) {
121 188
         long minPrice = minPriceW * 10000;
122 189
         long maxPrice = maxPriceW * 10000;

+ 41
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/BuildingLogVO.java 查看文件

@@ -0,0 +1,41 @@
1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import lombok.Data;
6
+
7
+import java.time.LocalDateTime;
8
+
9
+@Data
10
+public class BuildingLogVO {
11
+
12
+    /**
13
+     * 组织结构id
14
+     */
15
+    private String id;
16
+
17
+    /**
18
+     * 更新人
19
+     */
20
+    private String updateId;
21
+
22
+    /**
23
+     * 更新人姓名
24
+     */
25
+    private String updateName;
26
+
27
+    /**
28
+     * 更新时间
29
+     */
30
+    private LocalDateTime updateTime;
31
+
32
+    /**
33
+     * 楼盘名称
34
+     */
35
+    private String buildingName;
36
+
37
+    /**
38
+     * 楼盘id
39
+     */
40
+    private String buildingId;
41
+}

+ 101
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/CustomerSignatoryVO.java 查看文件

@@ -0,0 +1,101 @@
1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import com.baomidou.mybatisplus.annotation.TableName;
7
+import com.yunzhi.marketing.entity.TaBuildingApartment;
8
+import lombok.Data;
9
+import lombok.EqualsAndHashCode;
10
+import lombok.experimental.Accessors;
11
+
12
+import java.io.Serializable;
13
+import java.time.LocalDateTime;
14
+
15
+/**
16
+ * <p>
17
+ * 客户签约单 
18
+ * </p>
19
+ *
20
+ * @author jobob
21
+ * @since 2021-07-30
22
+ */
23
+@Data
24
+public class CustomerSignatoryVO implements Serializable {
25
+
26
+    private static final long serialVersionUID = 1L;
27
+
28
+    /**
29
+     * 主键
30
+     */
31
+    @TableId(type = IdType.UUID)
32
+    private String customerSignatoryId;
33
+
34
+    /**
35
+     * 客户id
36
+     */
37
+    private String customerId;
38
+
39
+    /**
40
+     * 楼盘id
41
+     */
42
+    private String buildingId;
43
+
44
+    /**
45
+     * 客户姓名
46
+     */
47
+    private String name;
48
+
49
+
50
+    /**
51
+     * 创建时间
52
+     */
53
+    private LocalDateTime createDate;
54
+
55
+    /**
56
+     * 备注
57
+     */
58
+    private String remark;
59
+
60
+    /**
61
+     * 业绩分成人
62
+     */
63
+    private String dividendsName;
64
+
65
+    /**
66
+     * 比例
67
+     */
68
+    private String proportion;
69
+
70
+    /**
71
+     * 户型
72
+     */
73
+    private String houseType;
74
+    /**
75
+     * 户型
76
+     */
77
+    private String houseTypeName;
78
+
79
+    /** 房屋信息 */
80
+    private String houseInfo;
81
+
82
+    /**
83
+     * 金额
84
+     */
85
+    private String price;
86
+
87
+
88
+    /** 类型 */
89
+    private String type ;
90
+
91
+    private String picture;
92
+
93
+    private String  sex;
94
+    private String  phone;
95
+    private String  buildingName;
96
+
97
+    private String recommendName;
98
+    private String recommendTel;
99
+    private String realtyConsultantName;
100
+    private String realtyConsultantTel;
101
+}

+ 196
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/ExportSearchHouseVO.java 查看文件

@@ -0,0 +1,196 @@
1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import com.baomidou.mybatisplus.annotation.IdType;
4
+import com.baomidou.mybatisplus.annotation.TableField;
5
+import com.baomidou.mybatisplus.annotation.TableId;
6
+import com.baomidou.mybatisplus.annotation.TableName;
7
+import com.yunzhi.marketing.entity.TaBuilding;
8
+import com.yunzhi.marketing.xlk.entity.SearchHouse;
9
+import lombok.Data;
10
+import lombok.EqualsAndHashCode;
11
+import lombok.experimental.Accessors;
12
+
13
+import java.io.Serializable;
14
+import java.time.LocalDateTime;
15
+import java.util.List;
16
+
17
+/**
18
+ * <p>
19
+ * 帮我找房 
20
+ * </p>
21
+ *
22
+ * @author jobob
23
+ * @since 2021-05-19
24
+ */
25
+@Data
26
+@EqualsAndHashCode(callSuper = false)
27
+@Accessors(chain = true)
28
+@TableName("xlk_search_house")
29
+public class ExportSearchHouseVO implements Serializable {
30
+
31
+    /**
32
+     * 主键
33
+     */
34
+    @TableId(type = IdType.UUID)
35
+    private String id;
36
+
37
+    /**
38
+     * 创建人小程序人员
39
+     */
40
+    private String personId;
41
+
42
+    /**
43
+     * 创建时间
44
+     */
45
+    @TableField("CREATED_TIME")
46
+    private LocalDateTime createdTime;
47
+
48
+    /**
49
+     * 更新人
50
+     */
51
+    @TableField("UPDATED_BY")
52
+    private String updatedBy;
53
+
54
+    /**
55
+     * 更新时间
56
+     */
57
+    @TableField("UPDATED_TIME")
58
+    private LocalDateTime updatedTime;
59
+
60
+    /**
61
+     * 公司id
62
+     */
63
+    @TableField("ORG_ID")
64
+    private Integer orgId;
65
+
66
+    /**
67
+     * 意向区域
68
+     */
69
+    private String intentArea;
70
+
71
+    /**
72
+     * 总预算范围最小价格
73
+     */
74
+    private String minPrice;
75
+
76
+    /**
77
+     * 总预算范围最大价格
78
+     */
79
+    private String maxPrice;
80
+
81
+
82
+    /**
83
+     * 0待回访,1已回访,2无效
84
+     */
85
+    private String status;
86
+
87
+    /**
88
+     * 审核结果
89
+     */
90
+    private String auditRemark;
91
+
92
+    /**
93
+     * 备注
94
+     */
95
+    private String remark;
96
+
97
+    /**
98
+     * 问卷json字符串
99
+     */
100
+    private String questionnaire;
101
+
102
+    private String avatarurl;
103
+
104
+    private String nickname;
105
+
106
+    private String phone;
107
+
108
+    private String gender;
109
+
110
+    private String name;
111
+
112
+    /**
113
+     * 房屋现状
114
+     */
115
+    private String houseStatus;
116
+
117
+    /**
118
+     * 房屋面积
119
+     */
120
+    private String area;
121
+
122
+    /**
123
+     * 家装模式
124
+     */
125
+    private String type;
126
+
127
+    /**
128
+     * 家装侧重点
129
+     */
130
+    private String important;
131
+    /**
132
+     * 家装风格
133
+     */
134
+    private String style;
135
+    /**
136
+     * 关键诉求
137
+     */
138
+    private String mostImportant;
139
+
140
+    /**
141
+     * 特殊功能区
142
+     */
143
+    private String special;
144
+
145
+    /**
146
+     * 是否智能家居
147
+     */
148
+    private String samrt;
149
+
150
+    /**
151
+     * 房屋类型
152
+     */
153
+    private String isNew;
154
+
155
+    /**
156
+     * 意向居室
157
+     */
158
+    private String layout;
159
+
160
+    /***
161
+     * 购房目的
162
+     */
163
+    private String purpose;
164
+
165
+    /**
166
+     * 侧重优势
167
+     */
168
+    private String advantage;
169
+
170
+    /**
171
+     * 社区要求
172
+     */
173
+    private String facility;
174
+
175
+    /**
176
+     * 朝向要求
177
+     */
178
+    private String orientation;
179
+
180
+    /**
181
+     * 楼层要求
182
+     */
183
+    private String isHigh;
184
+
185
+    /**
186
+     * 楼龄要求
187
+     */
188
+    private String buildingAge;
189
+
190
+    /**
191
+     * 租房偏好
192
+     */
193
+    private String preference;
194
+
195
+
196
+}

+ 17
- 0
src/main/java/com/yunzhi/marketing/xlk/vo/QuestionnaireVO.java 查看文件

@@ -0,0 +1,17 @@
1
+package com.yunzhi.marketing.xlk.vo;
2
+
3
+import lombok.Data;
4
+
5
+@Data
6
+public class QuestionnaireVO {
7
+
8
+    private String key;
9
+
10
+    private String type;
11
+
12
+    private Object result;
13
+
14
+    private Object resultId;
15
+
16
+    private Object options;
17
+}

+ 3
- 3
src/main/resources/application-prod.yml 查看文件

@@ -6,7 +6,7 @@ spring:
6 6
   datasource:
7 7
     username: marketing
8 8
     password: u@cSFJ5*kS9hGP7a
9
-    url: jdbc:mysql://localhost:3306/marketing-cloud?useUnicode=true&serverTimezone=Asia/Shanghai&characterEncoding=utf8&allowMultiQueries=true&autoReconnect=true&zeroDateTimeBehavior=convertToNull
9
+    url: jdbc:mysql://210.13.107.60:3306/marketing-cloud?useUnicode=true&serverTimezone=Asia/Shanghai&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 # 最大连接数
@@ -14,8 +14,8 @@ spring:
14 14
     max-idle: 8 # 最大空闲数
15 15
   servlet:
16 16
     multipart:
17
-      max-file-size: 10MB
18
-      max-request-size: 50MB
17
+      max-file-size: 1024MB
18
+      max-request-size: 4096MB
19 19
 
20 20
 #日志配置
21 21
 logging:

+ 2
- 1
src/main/resources/mapper/TaBuildingDynamicMapper.xml 查看文件

@@ -46,7 +46,8 @@
46 46
             and tbd.org_id = #{orgId}
47 47
         </if>
48 48
         <if test="time != null">
49
-            and TO_DAYS(tbd.create_date) = TO_DAYS(#{time})
49
+            and TO_DAYS(tbd.start_date) &lt;= TO_DAYS(#{time})
50
+            and TO_DAYS(tbd.end_date) &gt;= TO_DAYS(#{time})
50 51
         </if>
51 52
         <if test="institutionIds != null and institutionIds.size > 0">
52 53
             AND tbd.institution_id in

+ 889
- 851
src/main/resources/mapper/TaBuildingMapper.xml
文件差異過大導致無法顯示
查看文件


+ 20
- 28
src/main/resources/mapper/TaChannelMapper.xml 查看文件

@@ -163,14 +163,12 @@
163 163
         WHERE
164 164
         t.`event` in ( 'detail', 'house_list' , 'poster')
165 165
         AND t.event_type IN (
166
-        'activity',
167
-        'help',
168
-        'group',
169
-        'h5',
170
-        'news',
171
-        'building',
166
+        'dymic',
167
+        'house',
168
+        'look',
172 169
         'live',
173
-        'house'
170
+        'news',
171
+        'building'
174 172
         )
175 173
         <if test="targetId != null and targetId != ''">
176 174
             and t.target_id = #{targetId}
@@ -225,14 +223,12 @@
225 223
         WHERE
226 224
         t.`event` in ( 'detail', 'house_list' , 'poster')
227 225
         AND t.event_type IN (
228
-        'activity',
229
-        'help',
230
-        'group',
231
-        'h5',
232
-        'news',
233
-        'building',
226
+        'dymic',
227
+        'house',
228
+        'look',
234 229
         'live',
235
-        'house'
230
+        'news',
231
+        'building'
236 232
         )
237 233
         AND t.org_id = #{orgId}
238 234
         AND DATE_FORMAT(t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
@@ -359,14 +355,12 @@
359 355
         WHERE
360 356
         t.`event` in ( 'detail', 'house_list', 'poster' )
361 357
         AND t.event_type IN (
362
-        'activity',
363
-        'help',
364
-        'group',
365
-        'h5',
366
-        'news',
367
-        'building',
358
+        'dymic',
359
+        'house',
360
+        'look',
368 361
         'live',
369
-        'house'
362
+        'news',
363
+        'building'
370 364
         )
371 365
         <if test="targetId != null and targetId != ''">
372 366
             and t.target_id = #{targetId}
@@ -421,14 +415,12 @@
421 415
         WHERE
422 416
         t.`event` in ( 'detail', 'house_list', 'poster' )
423 417
         AND t.event_type IN (
424
-        'activity',
425
-        'help',
426
-        'group',
427
-        'h5',
428
-        'news',
429
-        'building',
418
+        'dymic',
419
+        'house',
420
+        'look',
430 421
         'live',
431
-        'house'
422
+        'news',
423
+        'building'
432 424
         )
433 425
         AND t.org_id = #{orgId}
434 426
         AND DATE_FORMAT( t.visit_time, '%Y-%m-%d' ) >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')

+ 17
- 4
src/main/resources/mapper/TaLiveActivityMapper.xml 查看文件

@@ -106,6 +106,9 @@
106 106
         <if test="newHouse">
107 107
             and t.is_new_house = #{newHouse}
108 108
         </if>
109
+        <if test="isHome">
110
+            and t.is_home = #{isHome}
111
+        </if>
109 112
     UNION
110 113
         SELECT
111 114
             t.video_id as id,
@@ -134,10 +137,20 @@
134 137
         <if test="newHouse">
135 138
             and t.is_new_house = #{newHouse}
136 139
         </if>
140
+        <if test="isHome">
141
+            and t.is_home = #{isHome}
142
+        </if>
137 143
     </select>
138
-    <select id="getWxPureLiveActivityList" resultType="com.yunzhi.marketing.entity.TaLiveActivity">
144
+    <select id="getWxPureLiveActivityList" resultType="com.yunzhi.marketing.po.LiveAndVideoVO">
139 145
         SELECT
140
-         t.*
146
+            t.live_activity_id as id,
147
+            t.live_activity_title AS title,
148
+            t.live_start_date AS start_time,
149
+            t.live_end_date AS end_time,
150
+            IFNULL(t.list_img, t.detail_img) as images,
151
+            a.building_name,
152
+            b.NAME AS city_name,
153
+            "live" as type
141 154
         FROM
142 155
         ta_live_activity t
143 156
         LEFT JOIN ta_building a ON t.building_id = a.building_id
@@ -154,10 +167,10 @@
154 167
         <if test="buildingId != null and buildingId != ''">
155 168
             and t.building_id = #{buildingId}
156 169
         </if>
157
-        <if test="process = 1">
170
+        <if test="process == 1">
158 171
             and t.live_start_date &gt; now()
159 172
         </if>
160
-        <if test="process = 2">
173
+        <if test="process == 2">
161 174
             and t.live_start_date &lt; now()
162 175
             and t.live_end_date &gt; now()
163 176
         </if>

+ 7
- 0
src/main/resources/mapper/TaPersonIntentionRecordMapper.xml 查看文件

@@ -23,6 +23,7 @@
23 23
         FROM
24 24
             ta_person_intention_record tpir
25 25
             LEFT JOIN ta_person tp on tpir.person_id = tp.person_id
26
+            Left join ta_building tb on tpir.building_id = tb.building_id
26 27
             <trim prefix="where" prefixOverrides="and | or">
27 28
                 <if test="buildingId != null and buildingId != ''">
28 29
                     tpir.building_id = #{buildingId}
@@ -37,6 +38,12 @@
37 38
                         #{personBuilding.buildingId}
38 39
                     </foreach>
39 40
                 </if>
41
+                <if test="institutionIds != null and institutionIds.size > 0">
42
+                    AND tb.institution_id in
43
+                    <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
44
+                        #{item}
45
+                    </foreach>
46
+                </if>
40 47
             </trim>
41 48
         GROUP BY
42 49
             tpir.person_id, tpir.building_id

+ 747
- 738
src/main/resources/mapper/TaPersonMapper.xml
文件差異過大導致無法顯示
查看文件


+ 459
- 455
src/main/resources/mapper/TaPersonVisitRecordMapper.xml 查看文件

@@ -1,455 +1,459 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
-<mapper namespace="com.yunzhi.marketing.mapper.TaPersonVisitRecordMapper">
4
-
5
-    <sql id="columnSql">
6
-        <trim suffixOverrides=",">
7
-            t.record_id,
8
-            t.person_id,
9
-            c.person_type,
10
-            t.visit_time,
11
-            t.leave_time,
12
-            t.visit_duration,
13
-            t.event,
14
-            t.data,
15
-            t.activity,
16
-            t.org_id,
17
-            t.building_id,
18
-            t.event_type,
19
-            t.target_id,
20
-            t.consultant_id,
21
-            t.share_person_id,
22
-        </trim>
23
-    </sql>
24
-
25
-    <select id="visitRecordByPersonId" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
26
-        select
27
-            t.* ,
28
-            b.parent_type_id from ta_person_visit_record t
29
-        left join td_biz_event_type b on t.event_type = b.type_id
30
-        where t.person_id = #{personId}
31
-        <if test="personBuildingList != null and personBuildingList.size > 0">
32
-            AND (b.parent_type_id = 'public' or t.building_id in
33
-            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
34
-                #{personBuilding.buildingId}
35
-            </foreach>
36
-            )
37
-        </if>
38
-        <if test="buildingId != null and buildingId != ''">
39
-            AND (b.parent_type_id = 'public' or t.building_id = #{buildingId} )
40
-        </if>
41
-        order by t.visit_time desc
42
-    </select>
43
-
44
-    <select id="visitRecordByPersonIdNew" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
45
-        select
46
-        t.* ,
47
-        b.parent_type_id from ta_person_visit_record t
48
-        left join td_biz_event_type b on t.event_type = b.type_id
49
-        where t.person_id = #{personId}
50
-        order by t.visit_time desc
51
-    </select>
52
-
53
-    <select id="selectAll" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
54
-        SELECT
55
-            tpvr.record_id as recordId,
56
-            tpvr.person_id as personId,
57
-            tpvr.person_type as personType,
58
-            tpvr.building_id as buildingId,
59
-            tpvr.activity as activity,
60
-            tpvr.event as event,
61
-            tpvr.event_type as eventType,
62
-            tpvr.visit_duration as visitDuration,
63
-            (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as visitTime,
64
-            (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as leaveTime,
65
-            ifnull(tp.name, tp.nickname) as userName,
66
-            tbe.event_name as eventName,
67
-            COUNT(1) as accessCount
68
-        FROM
69
-            ta_person_visit_record tpvr
70
-            LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
71
-            LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
72
-            <trim prefix="where" prefixOverrides="and | or">
73
-                tpvr.org_id = #{orgId}
74
-                and tp.org_id = #{orgId}
75
-                <if test="startDate != null and endDate != null">
76
-                    and tpvr.visit_time between #{startDate} and #{endDate}
77
-                </if>
78
-                <if test="buildingId != null and buildingId != ''">
79
-                    and tpvr.building_id = #{buildingId}
80
-                </if>
81
-                <if test="eventType != null and eventType != ''">
82
-                    and tpvr.event_type = #{eventType}
83
-                </if>
84
-                <if test="event != null and event != ''">
85
-                    and tpvr.event = #{event}
86
-                </if>
87
-                <if test="activity != null and activity != ''">
88
-                    and tpvr.activity = #{activity}
89
-                </if>
90
-            </trim>
91
-
92
-        GROUP BY tpvr.person_id, tpvr.event
93
-        ORDER BY 	accessCount DESC,tpvr.visit_time DESC
94
-    </select>
95
-    <select id="getPersonVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
96
-        SELECT
97
-            t.*,
98
-            b.building_name
99
-        FROM
100
-            ta_person_visit_record t
101
-            LEFT JOIN ta_building b ON t.building_id = b.building_id
102
-        WHERE
103
-            t.person_id = #{personId}
104
-        ORDER BY
105
-            t.visit_time DESC
106
-    </select>
107
-
108
-    <select id="getDurationByPersonId" resultType="java.lang.Integer">
109
-        select SUM(visit_duration) from ta_person_visit_record where person_id = #{personId}
110
-    </select>
111
-
112
-    <select id="getFirstVisitTimeByPersonId" resultType="java.time.LocalDateTime">
113
-        select visit_time from ta_person_visit_record where person_id = #{personId} order by visit_time asc limit 1
114
-    </select>
115
-    <select id="getWxVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
116
-        SELECT
117
-            t.* ,
118
-	        p.`name` as user_name,
119
-	        p.`nickname` as nickname,
120
-	        p.avatarurl,
121
-	        d.name as activity_name,
122
-	        d.create_date
123
-        FROM
124
-            ( SELECT * FROM ta_person_visit_record WHERE org_id = #{orgId} and event_type = #{eventType} AND consultant_id = #{userId} and person_id != #{personId} ORDER BY visit_time DESC LIMIT 999) t
125
-            left JOIN ta_person p on t.person_id = p.person_id
126
-            LEFT join ta_drainage d on t.target_id = d.drainage_id
127
-        GROUP BY
128
-            t.person_id
129
-        ORDER BY
130
-	        t.visit_time DESC
131
-    </select>
132
-
133
-    <select id="getWxActivityVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
134
-        SELECT
135
-            t.share_from_id, t.share_person as consultant_id, t.share_person_type, t.person_id, t.target_type, t.target_id, t.create_date as visit_time, t.org_id ,t.building_id, t.status, t.is_first_time,
136
-	        p.`name` as user_name,
137
-	        p.`nickname` as nickname,
138
-	        p.avatarurl
139
-        FROM
140
-            ( SELECT * FROM ta_share_person_from WHERE org_id = #{orgId} and target_id = #{targetId} AND (share_person = #{userId} or share_person = #{personId}) and target_type = #{eventType} ORDER BY create_date DESC LIMIT 999) t
141
-            left JOIN ta_person p on t.person_id = p.person_id
142
-            where t.person_id != #{personId}
143
-        GROUP BY
144
-            t.person_id
145
-        ORDER BY
146
-	        t.create_date DESC
147
-    </select>
148
-
149
-
150
-    <select id="getWxVisitRecordActivityList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
151
-            SELECT
152
-                t.*,
153
-                d.NAME AS activity_name,
154
-                d.create_date
155
-            FROM
156
-                ( SELECT * FROM ta_person_visit_record WHERE event_type = #{eventType} AND consultant_id = #{userId} AND person_id = #{personId} ORDER BY visit_time DESC ) t
157
-                LEFT JOIN ta_drainage d ON t.target_id = d.drainage_id
158
-            GROUP BY
159
-                t.target_id
160
-            ORDER BY
161
-	            t.visit_time DESC
162
-    </select>
163
-
164
-    <select id="getDrainageVisitRecord" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
165
-        select * from (
166
-            select
167
-            t.share_person as share_person_id,
168
-            t.person_id,
169
-            c.person_type,
170
-            t.create_date as visit_time,
171
-            t.target_type as event_type,
172
-            t.target_id as target_id,
173
-            b.name as drainageName,
174
-            d.building_name as buildingName,
175
-            tn.news_name as newsName,
176
-            tha.title as helpActivityName,
177
-            tsa.activity_name as groupActivityName,
178
-            tbd.title as activityName,
179
-            b.drainage_id
180
-            from ta_share_person_from t
181
-            left join ta_drainage b on t.target_id = b.drainage_id
182
-            left join ta_building d on t.target_id = d.building_id
183
-            left join ta_news tn on t.target_id = tn.news_id
184
-            left join ta_help_activity tha on t.target_id = tha.help_activity_id
185
-            left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
186
-            left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
187
-            left join ta_person c on t.org_id = c.org_id and (t.share_person = c.person_id or t.share_person = c.user_id)
188
-            where t.org_id = #{orgId}
189
-            and t.target_type in ('h5_share','group_share','help_share','news_share','dynamic_share','building_share')
190
-            <if test="eventType !=null and eventType != ''">
191
-                and t.target_type = #{eventType}
192
-            </if>
193
-            <if test="activityName !=null and activityName != ''">
194
-                and (
195
-                (b.name like concat('%',#{activityName},'%') and t.target_type = 'h5_share')or (d.name like concat('%',#{activityName},'%') and t.target_type = 'building_share') or (tn.news_name like concat('%',#{activityName},'%') and t.target_type = 'news_share')
196
-                or (tha.title like concat( '%', #{activityName}, '%' ) and t.target_type = 'help_share')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.target_type = 'group_share') or (tbd.title like concat('%',#{activityName},'%') and t.target_type = 'dynamic_share')
197
-                )
198
-            </if>
199
-            <if test="shareName !=null and shareName != ''">
200
-                and c.nickname like concat('%',#{shareName},'%')
201
-            </if>
202
-            <if test="shareTel !=null and shareTel != ''">
203
-                and c.phone = #{shareTel}
204
-            </if>
205
-            <if test="personType == 'Realty Consultant'">
206
-                and c.person_type = 'Realty Consultant'
207
-            </if>
208
-            <if test="personType == 'customer'">
209
-                and c.person_type != 'Realty Consultant'
210
-            </if>
211
-            <if test="buildingId !=null and buildingId != ''">
212
-                and d.building_id = #{buildingId}
213
-            </if>
214
-            <if test="personBuildingList != null and personBuildingList.size > 0">
215
-                AND d.building_id in
216
-                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
217
-                    #{personBuilding.buildingId}
218
-                </foreach>
219
-            </if>
220
-            order by t.create_date desc
221
-        ) t
222
-        group by t.person_id, t.target_id,t.event_type, t.share_person_id
223
-        order by t.visit_time desc
224
-    </select>
225
-
226
-    <select id="getConsultantShareInfoList" resultType="com.yunzhi.marketing.entity.TaConsultantInfo">
227
-        select * From (
228
-            select * from (
229
-                select
230
-                t.be_share as target_id,
231
-                a.url as activity_img,
232
-                a.building_name as activity_name,
233
-                a.building_name,
234
-                a.address,
235
-                a.price,
236
-                a.building_type_id,
237
-                t.tagert_type as eventType,
238
-				t.create_date as visit_time
239
-                from ta_share t
240
-                left join (select b.url, a.building_name,a.address,a.price,a.building_id,a.building_type_id from ta_building a left join ta_building_img b on a.building_id = b.building_id where b.img_type = 'list') a on t.be_share = a.building_id
241
-                where t.tagert_type = 'building'
242
-                and t.person_id = #{personId} order by t.create_date desc limit 9999
243
-            ) t
244
-            group by t.target_id
245
-
246
-        union all
247
-
248
-        select * from (
249
-        select
250
-        t.be_share as target_id,
251
-        b.list_img_url as activity_img,
252
-        b.title as activity_name,
253
-        '1' as price,
254
-        '2' as building_name,
255
-        '3' as address,
256
-        1 as building_type_id,
257
-        t.tagert_type as eventType,
258
-		t.create_date as visit_time
259
-        from ta_share t
260
-        left join ta_building_dynamic b on t.be_share = b.dynamic_id
261
-        where t.tagert_type = 'activity'
262
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
263
-        ) t
264
-        group by t.target_id
265
-
266
-        union all
267
-
268
-        select * from (
269
-        select
270
-        t.be_share as target_id,
271
-        c.list_img as activity_img,
272
-        c.title as activity_name,
273
-        '1' as price,
274
-        '2' as building_name,
275
-        '3' as address,
276
-        1 as building_type_id,
277
-        t.tagert_type as eventType,
278
-		t.create_date as visit_time
279
-        from ta_share t
280
-        left join ta_help_activity c on t.be_share = c.help_activity_id
281
-        where t.tagert_type = 'help'
282
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
283
-        ) t
284
-        group by t.target_id
285
-
286
-        union all
287
-
288
-        select * from (
289
-        select
290
-        t.be_share as target_id,
291
-        d.list_img as activity_img,
292
-        d.activity_name as activity_name,
293
-        '1' as price,
294
-        '2' as building_name,
295
-        '3' as address,
296
-        1 as building_type_id,
297
-        t.tagert_type as eventType,
298
-		t.create_date as visit_time
299
-        from ta_share t
300
-        left join ta_share_activity d on t.be_share = d.group_activity_id
301
-        where t.tagert_type = 'group'
302
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
303
-        ) t
304
-		group by t.target_id
305
-
306
-        union all
307
-
308
-        select * from (
309
-        select
310
-        t.be_share as target_id,
311
-        e.news_img as activity_img,
312
-        e.news_name as activity_name,
313
-        '1' as price,
314
-        '2' as building_name,
315
-        '3' as address,
316
-        1 as building_type_id,
317
-        t.tagert_type as eventType,
318
-		t.create_date as visit_time
319
-        from ta_share t
320
-        left join ta_news e on t.be_share = e.news_id
321
-        where t.tagert_type = 'news'
322
-        and t.person_id = #{personId} order by t.create_date desc limit 9999
323
-        ) t
324
-        group by t.target_id
325
-
326
-        union all
327
-
328
-        select * from (
329
-            select
330
-            t.be_share as target_id,
331
-            f.share_img as activity_img,
332
-            f.`name` as activity_name,
333
-            '1' as price,
334
-            '2' as building_name,
335
-            '3' as address,
336
-            1 as building_type_id,
337
-			t.tagert_type as eventType,
338
-			t.create_date as visit_time
339
-            from ta_share t
340
-            left join ta_drainage f on t.be_share = f.drainage_id
341
-            where t.tagert_type = 'h5'
342
-            and t.person_id = #{personId} order by t.create_date desc limit 9999
343
-            ) t
344
-            group by t.target_id
345
-         union all
346
-
347
-        select * from (
348
-            select
349
-            t.be_share as target_id,
350
-            g.aerial_view_img as activity_img,
351
-            g.sales_batch_name as activity_name,
352
-            '1' as price,
353
-            '2' as building_name,
354
-            '3' as address,
355
-            1 as building_type_id,
356
-			left(t.tagert_type,5) as eventType,
357
-			t.create_date as visit_time
358
-            from ta_share t
359
-            left join ta_sales_batch g on t.be_share = g.sales_batch_id
360
-            where t.tagert_type like CONCAT('house' , '%')
361
-            and t.person_id = #{personId} order by t.create_date desc limit 9999
362
-            ) t
363
-            group by t.target_id
364
-
365
-			union all
366
-				select * from (
367
-					SELECT
368
-						t.be_share AS target_id,
369
-						g.list_img AS activity_img,
370
-						g.live_activity_title AS activity_name,
371
-						'1' AS price,
372
-						'2' AS building_name,
373
-						'3' AS address,
374
-						1 AS building_type_id,
375
-						LEFT ( t.tagert_type, 4 ) AS eventType,
376
-						t.create_date AS visit_time
377
-					FROM
378
-						ta_share t
379
-						LEFT JOIN ta_live_activity g ON t.be_share = g.live_activity_id
380
-					WHERE
381
-						t.tagert_type LIKE CONCAT( 'live', '%' )
382
-							AND t.person_id = #{personId}
383
-						ORDER BY
384
-							t.create_date DESC
385
-							LIMIT 9999
386
-					) t
387
-				group by t.target_id
388
-        ) t
389
-        order by t.visit_time desc
390
-    </select>
391
-
392
-    <select id="countShareNumByEventType" resultType="java.lang.Integer">
393
-        select count(DISTINCT t.person_id)  from ta_share_person_from t
394
-        left join ta_person a on t.person_id = a.person_id
395
-        where
396
-        (t.share_person = #{personId}
397
-        <if test="userId != null and userId != ''">
398
-            or t.share_person = #{userId}
399
-        </if>
400
-        )
401
-        and t.org_id = #{orgId}
402
-        and t.target_type = #{eventType}
403
-        and t.target_id = #{targetId}
404
-        and t.status = 1
405
-        and t.person_id != #{personId}
406
-        group by t.target_type
407
-    </select>
408
-
409
-    <select id="selectData" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
410
-		select t.share_person_id, t.target_id,
411
-		if(t.target_type = 'help' and t.event_type = 'activity', 'help', if(t.target_type = 'group' and t.event_type = 'activity' , 'group', t.event_type)) as target_type,
412
-		a.nickname, a.avatarurl FROM
413
-        ta_person_visit_record t
414
-        LEFT JOIN ta_person a ON t.share_person_id = a.person_id
415
-        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
416
-        WHERE
417
-        (
418
-            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
419
-            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
420
-        )
421
-        AND t.person_id != t.share_person_id
422
-        AND t.`event` = 'detail'
423
-        AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
424
-        GROUP BY
425
-        t.target_id, t.event_type;
426
-    </select>
427
-
428
-    <select id="selectTapersonFromShare" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
429
-        select t.share_person_id, if (t.consultant_id != '' and t.consultant_id is not null, 'Realty Consultant', 'customer') as person_type, t.person_id, b.target_type, t.target_id,t.org_id, t.building_id  From ta_person_visit_record t
430
-        left join ta_person a on t.share_person_id = a.person_id
431
-        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
432
-        where
433
-        (
434
-            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
435
-            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
436
-            )
437
-            AND t.person_id != t.share_person_id
438
-            AND t.`event` = 'detail'
439
-            AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
440
-        GROUP BY
441
-            t.target_id, t.event_type;
442
-    </select>
443
-
444
-    <select id="selectTodayVisitCount" resultType="java.lang.Integer">
445
-        SELECT
446
-        COUNT(1) as visit_count
447
-        FROM
448
-        ta_person_visit_record tp
449
-        where tp.org_id = #{orgId} AND
450
-        tp.event  = 'start'
451
-        AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
452
-    </select>
453
-
454
-
455
-</mapper>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.yunzhi.marketing.mapper.TaPersonVisitRecordMapper">
4
+
5
+    <sql id="columnSql">
6
+        <trim suffixOverrides=",">
7
+            t.record_id,
8
+            t.person_id,
9
+            c.person_type,
10
+            t.visit_time,
11
+            t.leave_time,
12
+            t.visit_duration,
13
+            t.event,
14
+            t.data,
15
+            t.activity,
16
+            t.org_id,
17
+            t.building_id,
18
+            t.event_type,
19
+            t.target_id,
20
+            t.consultant_id,
21
+            t.share_person_id,
22
+        </trim>
23
+    </sql>
24
+
25
+    <select id="visitRecordByPersonId" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
26
+        select
27
+            t.* ,
28
+            b.parent_type_id from ta_person_visit_record t
29
+        left join td_biz_event_type b on t.event_type = b.type_id
30
+        where t.person_id = #{personId}
31
+        <if test="personBuildingList != null and personBuildingList.size > 0">
32
+            AND (b.parent_type_id = 'public' or t.building_id in
33
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
34
+                #{personBuilding.buildingId}
35
+            </foreach>
36
+            )
37
+        </if>
38
+        <if test="buildingId != null and buildingId != ''">
39
+            AND (b.parent_type_id = 'public' or t.building_id = #{buildingId} )
40
+        </if>
41
+        order by t.visit_time desc
42
+    </select>
43
+
44
+    <select id="visitRecordByPersonIdNew" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
45
+        SELECT
46
+        t.*,
47
+        b.building_name
48
+        FROM
49
+        ta_person_visit_record t
50
+        LEFT JOIN ta_building b ON t.building_id = b.building_id
51
+        WHERE
52
+        t.person_id = #{personId}
53
+        ORDER BY
54
+        t.visit_time DESC
55
+    </select>
56
+
57
+    <select id="selectAll" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
58
+        SELECT
59
+            tpvr.record_id as recordId,
60
+            tpvr.person_id as personId,
61
+            tpvr.person_type as personType,
62
+            tpvr.building_id as buildingId,
63
+            tpvr.activity as activity,
64
+            tpvr.event as event,
65
+            tpvr.event_type as eventType,
66
+            tpvr.visit_duration as visitDuration,
67
+            (SELECT MIN(t.visit_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as visitTime,
68
+            (SELECT MAX(t.leave_time) FROM ta_person_visit_record t WHERE t.person_id = tpvr.person_id and t.event = tpvr.event and t.org_id = #{orgId} ) as leaveTime,
69
+            ifnull(tp.name, tp.nickname) as userName,
70
+            tbe.event_name as eventName,
71
+            COUNT(1) as accessCount
72
+        FROM
73
+            ta_person_visit_record tpvr
74
+            LEFT JOIN ta_person tp ON tpvr.person_id = tp.person_id
75
+            LEFT JOIN td_biz_event tbe on tpvr.event = tbe.event_code
76
+            <trim prefix="where" prefixOverrides="and | or">
77
+                tpvr.org_id = #{orgId}
78
+                and tp.org_id = #{orgId}
79
+                <if test="startDate != null and endDate != null">
80
+                    and tpvr.visit_time between #{startDate} and #{endDate}
81
+                </if>
82
+                <if test="buildingId != null and buildingId != ''">
83
+                    and tpvr.building_id = #{buildingId}
84
+                </if>
85
+                <if test="eventType != null and eventType != ''">
86
+                    and tpvr.event_type = #{eventType}
87
+                </if>
88
+                <if test="event != null and event != ''">
89
+                    and tpvr.event = #{event}
90
+                </if>
91
+                <if test="activity != null and activity != ''">
92
+                    and tpvr.activity = #{activity}
93
+                </if>
94
+            </trim>
95
+
96
+        GROUP BY tpvr.person_id, tpvr.event
97
+        ORDER BY 	accessCount DESC,tpvr.visit_time DESC
98
+    </select>
99
+    <select id="getPersonVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
100
+        SELECT
101
+            t.*,
102
+            b.building_name
103
+        FROM
104
+            ta_person_visit_record t
105
+            LEFT JOIN ta_building b ON t.building_id = b.building_id
106
+        WHERE
107
+            t.person_id = #{personId}
108
+        ORDER BY
109
+            t.visit_time DESC
110
+    </select>
111
+
112
+    <select id="getDurationByPersonId" resultType="java.lang.Integer">
113
+        select SUM(visit_duration) from ta_person_visit_record where person_id = #{personId}
114
+    </select>
115
+
116
+    <select id="getFirstVisitTimeByPersonId" resultType="java.time.LocalDateTime">
117
+        select visit_time from ta_person_visit_record where person_id = #{personId} order by visit_time asc limit 1
118
+    </select>
119
+    <select id="getWxVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
120
+        SELECT
121
+            t.* ,
122
+	        p.`name` as user_name,
123
+	        p.`nickname` as nickname,
124
+	        p.avatarurl,
125
+	        d.name as activity_name,
126
+	        d.create_date
127
+        FROM
128
+            ( SELECT * FROM ta_person_visit_record WHERE org_id = #{orgId} and event_type = #{eventType} AND consultant_id = #{userId} and person_id != #{personId} ORDER BY visit_time DESC LIMIT 999) t
129
+            left JOIN ta_person p on t.person_id = p.person_id
130
+            LEFT join ta_drainage d on t.target_id = d.drainage_id
131
+        GROUP BY
132
+            t.person_id
133
+        ORDER BY
134
+	        t.visit_time DESC
135
+    </select>
136
+
137
+    <select id="getWxActivityVisitRecordList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
138
+        SELECT
139
+            t.share_from_id, t.share_person as consultant_id, t.share_person_type, t.person_id, t.target_type, t.target_id, t.create_date as visit_time, t.org_id ,t.building_id, t.status, t.is_first_time,
140
+	        p.`name` as user_name,
141
+	        p.`nickname` as nickname,
142
+	        p.avatarurl
143
+        FROM
144
+            ( SELECT * FROM ta_share_person_from WHERE org_id = #{orgId} and target_id = #{targetId} AND (share_person = #{userId} or share_person = #{personId}) and target_type = #{eventType} ORDER BY create_date DESC LIMIT 999) t
145
+            left JOIN ta_person p on t.person_id = p.person_id
146
+            where t.person_id != #{personId}
147
+        GROUP BY
148
+            t.person_id
149
+        ORDER BY
150
+	        t.create_date DESC
151
+    </select>
152
+
153
+
154
+    <select id="getWxVisitRecordActivityList" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
155
+            SELECT
156
+                t.*,
157
+                d.NAME AS activity_name,
158
+                d.create_date
159
+            FROM
160
+                ( SELECT * FROM ta_person_visit_record WHERE event_type = #{eventType} AND consultant_id = #{userId} AND person_id = #{personId} ORDER BY visit_time DESC ) t
161
+                LEFT JOIN ta_drainage d ON t.target_id = d.drainage_id
162
+            GROUP BY
163
+                t.target_id
164
+            ORDER BY
165
+	            t.visit_time DESC
166
+    </select>
167
+
168
+    <select id="getDrainageVisitRecord" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
169
+        select * from (
170
+            select
171
+            t.share_person as share_person_id,
172
+            t.person_id,
173
+            c.person_type,
174
+            t.create_date as visit_time,
175
+            t.target_type as event_type,
176
+            t.target_id as target_id,
177
+            b.name as drainageName,
178
+            d.building_name as buildingName,
179
+            tn.news_name as newsName,
180
+            tha.title as helpActivityName,
181
+            tsa.activity_name as groupActivityName,
182
+            tbd.title as activityName,
183
+            b.drainage_id
184
+            from ta_share_person_from t
185
+            left join ta_drainage b on t.target_id = b.drainage_id
186
+            left join ta_building d on t.target_id = d.building_id
187
+            left join ta_news tn on t.target_id = tn.news_id
188
+            left join ta_help_activity tha on t.target_id = tha.help_activity_id
189
+            left join ta_share_activity tsa on t.target_id = tsa.group_activity_id
190
+            left join ta_building_dynamic tbd on t.target_id = tbd.dynamic_id
191
+            left join ta_person c on t.org_id = c.org_id and (t.share_person = c.person_id or t.share_person = c.user_id)
192
+            where t.org_id = #{orgId}
193
+            and t.target_type in ('h5_share','group_share','help_share','news_share','dynamic_share','building_share')
194
+            <if test="eventType !=null and eventType != ''">
195
+                and t.target_type = #{eventType}
196
+            </if>
197
+            <if test="activityName !=null and activityName != ''">
198
+                and (
199
+                (b.name like concat('%',#{activityName},'%') and t.target_type = 'h5_share')or (d.name like concat('%',#{activityName},'%') and t.target_type = 'building_share') or (tn.news_name like concat('%',#{activityName},'%') and t.target_type = 'news_share')
200
+                or (tha.title like concat( '%', #{activityName}, '%' ) and t.target_type = 'help_share')  or (tsa.activity_name like concat('%',#{activityName},'%') and t.target_type = 'group_share') or (tbd.title like concat('%',#{activityName},'%') and t.target_type = 'dynamic_share')
201
+                )
202
+            </if>
203
+            <if test="shareName !=null and shareName != ''">
204
+                and c.nickname like concat('%',#{shareName},'%')
205
+            </if>
206
+            <if test="shareTel !=null and shareTel != ''">
207
+                and c.phone = #{shareTel}
208
+            </if>
209
+            <if test="personType == 'Realty Consultant'">
210
+                and c.person_type = 'Realty Consultant'
211
+            </if>
212
+            <if test="personType == 'customer'">
213
+                and c.person_type != 'Realty Consultant'
214
+            </if>
215
+            <if test="buildingId !=null and buildingId != ''">
216
+                and d.building_id = #{buildingId}
217
+            </if>
218
+            <if test="personBuildingList != null and personBuildingList.size > 0">
219
+                AND d.building_id in
220
+                <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
221
+                    #{personBuilding.buildingId}
222
+                </foreach>
223
+            </if>
224
+            order by t.create_date desc
225
+        ) t
226
+        group by t.person_id, t.target_id,t.event_type, t.share_person_id
227
+        order by t.visit_time desc
228
+    </select>
229
+
230
+    <select id="getConsultantShareInfoList" resultType="com.yunzhi.marketing.entity.TaConsultantInfo">
231
+        select * From (
232
+            select * from (
233
+                select
234
+                t.be_share as target_id,
235
+                a.url as activity_img,
236
+                a.building_name as activity_name,
237
+                a.building_name,
238
+                a.address,
239
+                a.price,
240
+                a.building_type_id,
241
+                t.tagert_type as eventType,
242
+				t.create_date as visit_time
243
+                from ta_share t
244
+                left join (select b.url, a.building_name,a.address,a.price,a.building_id,a.building_type_id from ta_building a left join ta_building_img b on a.building_id = b.building_id where b.img_type = 'list') a on t.be_share = a.building_id
245
+                where t.tagert_type = 'building'
246
+                and t.person_id = #{personId} order by t.create_date desc limit 9999
247
+            ) t
248
+            group by t.target_id
249
+
250
+        union all
251
+
252
+        select * from (
253
+        select
254
+        t.be_share as target_id,
255
+        b.list_img_url as activity_img,
256
+        b.title as activity_name,
257
+        '1' as price,
258
+        '2' as building_name,
259
+        '3' as address,
260
+        1 as building_type_id,
261
+        t.tagert_type as eventType,
262
+		t.create_date as visit_time
263
+        from ta_share t
264
+        left join ta_building_dynamic b on t.be_share = b.dynamic_id
265
+        where t.tagert_type = 'activity'
266
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
267
+        ) t
268
+        group by t.target_id
269
+
270
+        union all
271
+
272
+        select * from (
273
+        select
274
+        t.be_share as target_id,
275
+        c.list_img as activity_img,
276
+        c.title as activity_name,
277
+        '1' as price,
278
+        '2' as building_name,
279
+        '3' as address,
280
+        1 as building_type_id,
281
+        t.tagert_type as eventType,
282
+		t.create_date as visit_time
283
+        from ta_share t
284
+        left join ta_help_activity c on t.be_share = c.help_activity_id
285
+        where t.tagert_type = 'help'
286
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
287
+        ) t
288
+        group by t.target_id
289
+
290
+        union all
291
+
292
+        select * from (
293
+        select
294
+        t.be_share as target_id,
295
+        d.list_img as activity_img,
296
+        d.activity_name as activity_name,
297
+        '1' as price,
298
+        '2' as building_name,
299
+        '3' as address,
300
+        1 as building_type_id,
301
+        t.tagert_type as eventType,
302
+		t.create_date as visit_time
303
+        from ta_share t
304
+        left join ta_share_activity d on t.be_share = d.group_activity_id
305
+        where t.tagert_type = 'group'
306
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
307
+        ) t
308
+		group by t.target_id
309
+
310
+        union all
311
+
312
+        select * from (
313
+        select
314
+        t.be_share as target_id,
315
+        e.news_img as activity_img,
316
+        e.news_name as activity_name,
317
+        '1' as price,
318
+        '2' as building_name,
319
+        '3' as address,
320
+        1 as building_type_id,
321
+        t.tagert_type as eventType,
322
+		t.create_date as visit_time
323
+        from ta_share t
324
+        left join ta_news e on t.be_share = e.news_id
325
+        where t.tagert_type = 'news'
326
+        and t.person_id = #{personId} order by t.create_date desc limit 9999
327
+        ) t
328
+        group by t.target_id
329
+
330
+        union all
331
+
332
+        select * from (
333
+            select
334
+            t.be_share as target_id,
335
+            f.share_img as activity_img,
336
+            f.`name` as activity_name,
337
+            '1' as price,
338
+            '2' as building_name,
339
+            '3' as address,
340
+            1 as building_type_id,
341
+			t.tagert_type as eventType,
342
+			t.create_date as visit_time
343
+            from ta_share t
344
+            left join ta_drainage f on t.be_share = f.drainage_id
345
+            where t.tagert_type = 'h5'
346
+            and t.person_id = #{personId} order by t.create_date desc limit 9999
347
+            ) t
348
+            group by t.target_id
349
+         union all
350
+
351
+        select * from (
352
+            select
353
+            t.be_share as target_id,
354
+            g.aerial_view_img as activity_img,
355
+            g.sales_batch_name as activity_name,
356
+            '1' as price,
357
+            '2' as building_name,
358
+            '3' as address,
359
+            1 as building_type_id,
360
+			left(t.tagert_type,5) as eventType,
361
+			t.create_date as visit_time
362
+            from ta_share t
363
+            left join ta_sales_batch g on t.be_share = g.sales_batch_id
364
+            where t.tagert_type like CONCAT('house' , '%')
365
+            and t.person_id = #{personId} order by t.create_date desc limit 9999
366
+            ) t
367
+            group by t.target_id
368
+
369
+			union all
370
+				select * from (
371
+					SELECT
372
+						t.be_share AS target_id,
373
+						g.list_img AS activity_img,
374
+						g.live_activity_title AS activity_name,
375
+						'1' AS price,
376
+						'2' AS building_name,
377
+						'3' AS address,
378
+						1 AS building_type_id,
379
+						LEFT ( t.tagert_type, 4 ) AS eventType,
380
+						t.create_date AS visit_time
381
+					FROM
382
+						ta_share t
383
+						LEFT JOIN ta_live_activity g ON t.be_share = g.live_activity_id
384
+					WHERE
385
+						t.tagert_type LIKE CONCAT( 'live', '%' )
386
+							AND t.person_id = #{personId}
387
+						ORDER BY
388
+							t.create_date DESC
389
+							LIMIT 9999
390
+					) t
391
+				group by t.target_id
392
+        ) t
393
+        order by t.visit_time desc
394
+    </select>
395
+
396
+    <select id="countShareNumByEventType" resultType="java.lang.Integer">
397
+        select count(DISTINCT t.person_id)  from ta_share_person_from t
398
+        left join ta_person a on t.person_id = a.person_id
399
+        where
400
+        (t.share_person = #{personId}
401
+        <if test="userId != null and userId != ''">
402
+            or t.share_person = #{userId}
403
+        </if>
404
+        )
405
+        and t.org_id = #{orgId}
406
+        and t.target_type = #{eventType}
407
+        and t.target_id = #{targetId}
408
+        and t.status = 1
409
+        and t.person_id != #{personId}
410
+        group by t.target_type
411
+    </select>
412
+
413
+    <select id="selectData" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
414
+		select t.share_person_id, t.target_id,
415
+		if(t.target_type = 'help' and t.event_type = 'activity', 'help', if(t.target_type = 'group' and t.event_type = 'activity' , 'group', t.event_type)) as target_type,
416
+		a.nickname, a.avatarurl FROM
417
+        ta_person_visit_record t
418
+        LEFT JOIN ta_person a ON t.share_person_id = a.person_id
419
+        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
420
+        WHERE
421
+        (
422
+            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
423
+            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
424
+        )
425
+        AND t.person_id != t.share_person_id
426
+        AND t.`event` = 'detail'
427
+        AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
428
+        GROUP BY
429
+        t.target_id, t.event_type;
430
+    </select>
431
+
432
+    <select id="selectTapersonFromShare" resultType="com.yunzhi.marketing.entity.TaPersonVisitRecord">
433
+        select t.share_person_id, if (t.consultant_id != '' and t.consultant_id is not null, 'Realty Consultant', 'customer') as person_type, t.person_id, b.target_type, t.target_id,t.org_id, t.building_id  From ta_person_visit_record t
434
+        left join ta_person a on t.share_person_id = a.person_id
435
+        LEFT JOIN ta_share_person_from b ON t.target_id = b.target_id  and t.event_type = b.target_type + '_share'
436
+        where
437
+        (
438
+            ( t.consultant_id IS NOT NULL AND t.consultant_id != '' )
439
+            OR ( t.share_person_id IS NOT NULL AND t.share_person_id != '' )
440
+            )
441
+            AND t.person_id != t.share_person_id
442
+            AND t.`event` = 'detail'
443
+            AND ( t.share_person_id != b.share_person OR t.consultant_id != b.share_person )
444
+        GROUP BY
445
+            t.target_id, t.event_type;
446
+    </select>
447
+
448
+    <select id="selectTodayVisitCount" resultType="java.lang.Integer">
449
+        SELECT
450
+        COUNT(1) as visit_count
451
+        FROM
452
+        ta_person_visit_record tp
453
+        where tp.org_id = #{orgId} AND
454
+        tp.event  = 'start'
455
+        AND DATE_FORMAT(tp.visit_time,'%Y-%m-%d') = DATE_FORMAT(#{nowDate},'%Y-%m-%d')
456
+    </select>
457
+
458
+
459
+</mapper>

+ 27
- 18
src/main/resources/mapper/TaRecommendCustomerMapper.xml 查看文件

@@ -88,14 +88,20 @@ FROM
88 88
         ta_person a
89 89
         left join ta_channel_person tcp on a.person_id = tcp.person_id
90 90
         left join ta_channel tc on tc.channel_id = tcp.channel_id
91
-        <where>
92
-            a.person_type in ('channel agent')
91
+        <where> 1=1
92
+            <if test="personId != null and personId !=''">
93
+                and a.person_id = #{personId}
94
+            </if>
95
+            <if test="channelId != null and channelId !=''">
96
+                and tc.channel_id = #{channelId}
97
+            </if>
98
+            and a.person_type in ('channel agent', 'estate agent')
93 99
             and a.status >0
94 100
             <if test="name != null and name !=''">
95
-                and a.nickname = #{name}
101
+                and a.nickname like concat('%', #{name} ,'%')
96 102
             </if>
97 103
             <if test="tel != null and tel!=''">
98
-                and a.phone = #{tel}
104
+                and a.phone like concat('%', #{tel} ,'%')
99 105
             </if>
100 106
             <if test="orgId != null">
101 107
                 and a.org_id = #{orgId}
@@ -808,39 +814,42 @@ FROM
808 814
 
809 815
     <select id="getMyCustFollowOrClinch" resultType="com.yunzhi.marketing.entity.TaRecommendCustomer">
810 816
         SELECT
811
-        *
817
+        IFNULL( p.nickname, t.NAME ) AS NAME,
818
+        IFNULL( p.avatarurl, t.picture ) AS picture,
819
+        t.*
812 820
         FROM
813
-        ta_recommend_customer
821
+        ta_recommend_customer t
822
+        LEFT JOIN ta_person p ON t.person_id = p.person_id
814 823
         WHERE
815
-        org_id = #{orgId}
816
-        AND ( realty_consultant = #{personId} OR realty_consultant = #{userId} )
824
+        t.org_id = #{orgId}
825
+        AND ( t.realty_consultant = #{personId} OR t.realty_consultant = #{userId} )
817 826
         <if test="type == 'follow'">
818
-            AND STATUS != 4
819
-            AND verify_status = 1
827
+            AND t.STATUS != 4
828
+            AND t.verify_status = 1
820 829
             <if test="name != null and name !=''">
821
-                and (`name` like CONCAT('%',#{name}, '%') or phone like CONCAT('%',#{name}, '%'))
830
+                and (p.nickname like CONCAT('%',#{name}, '%') or t.`name` like CONCAT('%',#{name}, '%') or t.phone like CONCAT('%',#{name}, '%'))
822 831
             </if>
823 832
             <if test="phone != null and phone !=''">
824
-                and phone like CONCAT('%',#{phone}, '%')
833
+                and t.phone like CONCAT('%',#{phone}, '%')
825 834
             </if>
826 835
             <if test="status != null and status !=''">
827
-                and status = #{status}
836
+                and t.status = #{status}
828 837
             </if>
829 838
             <if test="startReportDate != null and startReportDate !=''">
830
-                and date_format( report_date, '%Y-%m-%d' ) >= #{startReportDate}
839
+                and date_format( t.report_date, '%Y-%m-%d' ) >= #{startReportDate}
831 840
             </if>
832 841
             <if test="endReportDate != null and endReportDate !=''">
833
-                and date_format( report_date, '%Y-%m-%d' ) &lt;= #{endReportDate}
842
+                and date_format( t.report_date, '%Y-%m-%d' ) &lt;= #{endReportDate}
834 843
             </if>
835 844
             <if test="startArrivalDate != null and startArrivalDate !=''">
836
-                and date_format( arrival_date, '%Y-%m-%d' ) >= #{startArrivalDate}
845
+                and date_format( t.arrival_date, '%Y-%m-%d' ) >= #{startArrivalDate}
837 846
             </if>
838 847
             <if test="endArrivalDate != null and endArrivalDate !=''">
839
-                and date_format( arrival_date, '%Y-%m-%d' ) &lt;= #{endArrivalDate}
848
+                and date_format( t.arrival_date, '%Y-%m-%d' ) &lt;= #{endArrivalDate}
840 849
             </if>
841 850
         </if>
842 851
         <if test="type == 'clinch'">
843
-            AND STATUS = 4
852
+            AND t.STATUS in (4,5)
844 853
         </if>
845 854
     </select>
846 855
 

+ 17
- 21
src/main/resources/mapper/TsConsultantKpiMapper.xml 查看文件

@@ -6,8 +6,8 @@
6 6
     <select id="stsKPIDaily" resultType="com.yunzhi.marketing.entity.TsConsultantKpi">
7 7
         SELECT * FROM (
8 8
             SELECT
9
-                1 AS serial_no,
10
-                '2020' AS statis_date,
9
+                t.serial_no,
10
+                SUBSTR(t.statis_date,1,4),
11 11
                 t.org_id,
12 12
                 t.building_id,
13 13
                 t.building_name,
@@ -27,15 +27,13 @@
27 27
                  where s.org_id = t.org_id and (s.realty_consultant = t.user_id or s.realty_consultant = m.person_id)
28 28
                  and (s.building_id = t.building_id or IFNULL(t.building_id, '') = '')
29 29
                  and s.status > 0
30
-<!--                 AND s.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d' )-->
31
-<!--                 AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')-->
32 30
                 ) as total_persons
33 31
             FROM
34 32
                 ts_consultant_kpi t
35 33
             LEFT JOIN ta_person m on m.org_id = #{orgId} and m.user_id = t.user_id
36 34
             WHERE
37 35
                 t.org_id = #{orgId}
38
-                AND t.statis_date BETWEEN #{startDate} AND #{endDate}
36
+                AND t.statis_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
39 37
             <if test="buildingIds != null">
40 38
                 AND t.building_id in
41 39
                 <foreach item="buildingId" index="index" collection="buildingIds"
@@ -59,8 +57,8 @@
59 57
     <!-- 按照小程序分组统计, 注意查询与分组条件, 必须与之前的汇总,导出一致 -->
60 58
     <select id="stsKPITotalByOrg" resultType="com.yunzhi.marketing.entity.TsConsultantKpi">
61 59
         SELECT
62
-            1 AS serial_no,
63
-            '2020' AS statis_date,
60
+            t.serial_no,
61
+            SUBSTR(t.statis_date,1,4),
64 62
             t.org_id,
65 63
             '' as building_id,
66 64
             '-' as building_name,
@@ -82,7 +80,7 @@
82 80
             ts_consultant_kpi t
83 81
         WHERE
84 82
             t.org_id = #{orgId}
85
-            AND t.statis_date BETWEEN #{startDate} AND #{endDate}
83
+            AND t.statis_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
86 84
         <if test="buildingIds != null">
87 85
             AND t.building_id in
88 86
             <foreach item="buildingId" index="index" collection="buildingIds"
@@ -95,8 +93,8 @@
95 93
     <!-- 导出 -->
96 94
     <select id="stsKPIDailyExport" resultType="com.yunzhi.marketing.excel.ConsultantKPIExport">
97 95
         SELECT
98
-            1 AS serial_no,
99
-            '2020' AS statis_date,
96
+            t.serial_no,
97
+            SUBSTR(t.statis_date,1,4),
100 98
             t.org_id,
101 99
             t.building_id,
102 100
             t.building_name,
@@ -119,7 +117,7 @@
119 117
         LEFT JOIN ta_person m on m.org_id = #{orgId} and m.user_id = t.user_id
120 118
         WHERE
121 119
             t.org_id = #{orgId}
122
-        AND t.statis_date BETWEEN #{startDate} AND #{endDate}
120
+        AND t.statis_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
123 121
     <if test="buildingIds != null">
124 122
         AND t.building_id in
125 123
         <foreach item="buildingId" index="index" collection="buildingIds"
@@ -146,8 +144,6 @@
146 144
         WHERE
147 145
             p.org_id = #{orgId}
148 146
             AND p.`status` > 0
149
-<!--            AND p.create_date BETWEEN STR_TO_DATE( #{startDate}, '%Y%m%d')-->
150
-<!--            AND  STR_TO_DATE(concat(#{endDate}, '235959'), '%Y%m%d%H%i%s')-->
151 147
         <if test="buildingIds != null">
152 148
             AND t.building_id in
153 149
             <foreach item="buildingId" index="index" collection="buildingIds"
@@ -169,7 +165,7 @@
169 165
             AND e.building_id = #{buildingId}
170 166
         </if>
171 167
         AND e.target_type is not null
172
-        AND e.create_date BETWEEN #{startDate} and #{endDate}
168
+        AND e.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
173 169
         AND e.is_project_first = 1
174 170
         AND s.user_id = #{userId}
175 171
 
@@ -197,7 +193,7 @@
197 193
             AND f.building_id = #{buildingId}
198 194
         </if>
199 195
             AND f.event_type = 'card'
200
-            AND f.visit_time BETWEEN #{startDate} and #{endDate}
196
+            AND f.visit_time BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
201 197
             AND s.user_id = #{userId}
202 198
 
203 199
 <!--        为了与存储过程一致 -->
@@ -222,7 +218,7 @@
222 218
             AND f.building_id = #{buildingId}
223 219
         </if>
224 220
             AND f.event_type = 'card'
225
-            AND f.visit_time BETWEEN #{startDate} and #{endDate}
221
+            AND f.visit_time BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
226 222
             AND s.user_id = #{userId}
227 223
 
228 224
 <!--        为了与存储过程一致 -->
@@ -245,7 +241,7 @@
245 241
 
246 242
 <!--        为了与存储过程一致 -->
247 243
 <!--            AND t.`status` = 1-->
248
-            AND h.create_date BETWEEN #{startDate} and #{endDate}
244
+            AND h.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
249 245
             AND s.user_id = #{userId}
250 246
 
251 247
 <!--        为了与存储过程一致 -->
@@ -269,7 +265,7 @@
269 265
 <!--        为了与存储过程一致 -->
270 266
 <!--            AND t.`status` = 1-->
271 267
             AND i.tagert_type = 'consultant'
272
-            AND i.create_date BETWEEN #{startDate} and #{endDate}
268
+            AND i.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
273 269
             AND s.user_id = #{userId}
274 270
 
275 271
 <!--        为了与存储过程一致 -->
@@ -306,7 +302,7 @@
306 302
             AND t.tagert_type like concat(#{targetType}, '%')
307 303
         </if>
308 304
 
309
-            AND t.create_date BETWEEN #{startDate} and #{endDate}
305
+            AND t.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
310 306
         <if test="targetName != null and targetName !=''">
311 307
             AND t.target_name LIKE concat('%', #{targetName}, '%')
312 308
         </if>
@@ -326,7 +322,7 @@
326 322
         INNER JOIN ta_person t ON t.person_id = e.person_id
327 323
         WHERE e.org_id = #{orgId}
328 324
             AND e.share_person = #{userId}
329
-            AND e.create_date BETWEEN #{startDate} and #{endDate}
325
+            AND e.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
330 326
             AND (
331 327
                 e.target_type IN ( 'card_share', 'building_share', 'dynamic_share', 'group_share', 'h5_share', 'help_share', 'house_share', 'live_share', 'news_share', 'poster' )
332 328
                 OR ( e.target_type = 'share' AND e.target_id = 'index' )
@@ -371,7 +367,7 @@
371 367
             AND e.target_name like concat('%', #{targetName} ,'%')
372 368
         </if>
373 369
 
374
-            AND e.create_date BETWEEN #{startDate} and #{endDate}
370
+            AND e.create_date BETWEEN DATE_FORMAT(#{startDate}, '%Y%m%d' )  AND DATE_FORMAT(#{endDate}, '%Y%m%d' )
375 371
 
376 372
         <if test="buildingId != null and buildingId !=''">
377 373
             AND e.building_id = #{buildingId}

+ 2470
- 2492
src/main/resources/mapper/statistic/TaActivityStaticMapper.xml
文件差異過大導致無法顯示
查看文件


+ 24
- 16
src/main/resources/mapper/statistic/TsCustomerGenderStatisticMapper.xml 查看文件

@@ -4,18 +4,23 @@
4 4
 
5 5
     <select id="getNewCustomerSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
6 6
         SELECT
7
-            org_id,realty_consultant,
8
-            sum(if(sex = 1,1,0)) as man_sum,
9
-            sum(if(sex = 1,1,0))/count(*) as man_pct,
10
-            sum(if(sex = 2,1,0)) as woman_sum,
11
-            sum(if(sex = 2,1,0))/count(*) as woman_pct,
12
-            sum(if(sex != 1 and sex != 2,1,0)) as unknown_sum,
13
-            sum(if(sex != 1 and sex != 2,1,0))/count(*) as unknown_pct
7
+            t.org_id,
8
+            s.person_id AS realty_consultant,
9
+            sum( IF ( t.sex = 1, 1, 0 ) ) AS man_sum,
10
+            sum( IF ( t.sex = 1, 1, 0 ) ) / count( * ) AS man_pct,
11
+            sum( IF ( t.sex = 2, 1, 0 ) ) AS woman_sum,
12
+            sum( IF ( t.sex = 2, 1, 0 ) ) / count( * ) AS woman_pct,
13
+            sum( IF ( t.sex != 1 AND t.sex != 2, 1, 0 ) ) AS unknown_sum,
14
+            sum( IF ( t.sex != 1 AND t.sex != 2, 1, 0 ) ) / count( * ) AS unknown_pct
14 15
         FROM
15
-            ta_recommend_customer
16
+            ta_recommend_customer t
17
+                LEFT JOIN ta_person s ON s.person_id = t.realty_consultant
18
+                    OR s.user_id = t.realty_consultant
16 19
         WHERE
17
-            verify_status = 1
18
-            GROUP BY org_id,realty_consultant
20
+            t.verify_status = 1
21
+        GROUP BY
22
+            t.org_id,
23
+            s.person_id
19 24
     </select>
20 25
     <select id="getFollowUpSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
21 26
         SELECT
@@ -35,7 +40,7 @@
35 40
     <select id="getVisiteSexCount" resultType="com.yunzhi.marketing.statistic.entity.GenderStatistic">
36 41
         SELECT
37 42
             d.org_id,
38
-            d.realty_consultant,
43
+            d.realty_consultant_person as realty_consultant,
39 44
             sum( IF ( d.sex = 1, 1, 0 ) ) AS manSum,
40 45
             sum( IF ( d.sex = 1, 1, 0 ) ) / count( * ) AS manPct,
41 46
             sum( IF ( d.sex = 2, 1, 0 ) ) AS womanSum,
@@ -46,19 +51,22 @@
46 51
             (
47 52
                 SELECT
48 53
                     t.enlist_id,
49
-                    c.*
54
+                    c.*,
55
+                    s.person_id as realty_consultant_person
50 56
                 FROM
51 57
                     ta_activity_dynamic_enlist t
52 58
                     LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
53
-                    AND t.building_id = c.building_id
54
-                    AND t.org_id = c.org_id
55
-                    AND c.verify_status = 1
59
+                        AND t.building_id = c.building_id
60
+                        AND t.org_id = c.org_id
61
+                        AND c.verify_status = 1
62
+                    LEFT JOIN ta_person s ON s.person_id = c.realty_consultant
63
+                        OR s.user_id = c.realty_consultant
56 64
                 WHERE
57 65
                     t.is_checkin = 1
58 66
                 GROUP BY
59 67
                     c.customer_id
60 68
             ) d
61 69
         GROUP BY
62
-            d.org_id,d.realty_consultant
70
+            d.org_id,d.realty_consultant_person
63 71
     </select>
64 72
 </mapper>

+ 17
- 12
src/main/resources/mapper/statistic/TsCustomerStatisticDailyMapper.xml 查看文件

@@ -23,33 +23,38 @@
23 23
 
24 24
     <select id="getNewCustomerData" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
25 25
         SELECT
26
-            org_id,
27
-            count( customer_id ) as customer_num,
28
-			realty_consultant
26
+            t.org_id,
27
+            count( DISTINCT ( t.customer_id ) ) AS customer_num,
28
+            s.person_id AS realty_consultant
29 29
         FROM
30
-            ta_recommend_customer
30
+            ta_recommend_customer t
31
+                LEFT JOIN ta_person s ON s.person_id = t.realty_consultant
32
+                OR s.user_id = t.realty_consultant
31 33
         WHERE
32
-             date_format( create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
33
-             AND verify_status = 1
34
+                date_format( t.create_date, '%Y-%m-%d' ) = date_format(#{nowDate}, '%Y-%m-%d' )
35
+          AND t.verify_status = 1
34 36
         GROUP BY
35
-            org_id,realty_consultant
37
+            t.org_id,
38
+            s.person_id
36 39
     </select>
37 40
     <select id="getVisiteCustomerData" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
38 41
         SELECT
39 42
             count( DISTINCT ( c.customer_id ) ) as customer_num,
40 43
             c.org_id,
41
-			c.realty_consultant
44
+            s.person_id as realty_consultant
42 45
         FROM
43 46
             ta_activity_dynamic_enlist t
44 47
             LEFT JOIN ta_recommend_customer c ON t.person_id = c.person_id
45
-            AND t.building_id = c.building_id
46
-            AND t.org_id = c.org_id
47
-            AND c.verify_status = 1
48
+                AND t.building_id = c.building_id
49
+                AND t.org_id = c.org_id
50
+                AND c.verify_status = 1
51
+            LEFT JOIN ta_person s ON s.person_id = c.realty_consultant
52
+                OR s.user_id = c.realty_consultant
48 53
         WHERE
49 54
             t.is_checkin = #{checkin}
50 55
             AND date_format( t.create_date, '%Y-%m-%d' ) = date_format( #{nowDate}, '%Y-%m-%d' )
51 56
         GROUP BY
52
-            c.org_id,c.realty_consultant
57
+            c.org_id, s.person_id
53 58
     </select>
54 59
     <select id="getDailyList" resultType="com.yunzhi.marketing.statistic.entity.TsCustomerStatisticDaily">
55 60
         SELECT

+ 20
- 3
src/main/resources/mapper/statistic/TsPersonFromStatisticMapper.xml 查看文件

@@ -3,10 +3,10 @@
3 3
 <mapper namespace="com.yunzhi.marketing.statistic.mapper.TsPersonFromStatisticMapper">
4 4
 
5 5
     <insert id="insertStatisticList">
6
-        INSERT INTO ts_person_from_statistic(scene_type,event_type,from_num,org_id,create_date,registered_num)
6
+        INSERT INTO ts_person_from_statistic(scene_type,event_type,from_num,org_id,create_date,registered_num,institution_id)
7 7
         VALUES
8 8
         <foreach collection="list" item="item" separator=",">
9
-            (#{item.sceneType},#{item.eventType},#{item.fromNum},#{item.orgId},#{item.createDate},#{item.registeredNum})
9
+            (#{item.sceneType},#{item.eventType},#{item.fromNum},#{item.orgId},#{item.createDate},#{item.registeredNum},#{item.institutionId})
10 10
         </foreach>
11 11
     </insert>
12 12
     <delete id="deleteByData">
@@ -24,7 +24,12 @@
24 24
         <if test="startDate == null or endDate == null">
25 25
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
26 26
         </if>
27
-
27
+        <if test="institutionIds != null and institutionIds.size > 0">
28
+            AND tp.institution_id in
29
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
30
+                #{item}
31
+            </foreach>
32
+        </if>
28 33
     </select>
29 34
     <select id="selectPersonFromGroupByDay"
30 35
             resultType="com.yunzhi.marketing.statistic.entity.TsPersonFromStatistic">
@@ -63,6 +68,12 @@
63 68
         <if test="startDate == null or endDate == null">
64 69
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
65 70
         </if>
71
+        <if test="institutionIds != null and institutionIds.size > 0">
72
+            AND tp.institution_id in
73
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
74
+                #{item}
75
+            </foreach>
76
+        </if>
66 77
         GROUP BY DATE_FORMAT( tp.create_date, '%Y-%m-%d' ), tp.scene_type ORDER BY tp.create_date
67 78
         ) as tp on date.date = tp.create_time
68 79
 
@@ -93,6 +104,12 @@
93 104
         <if test="startDate == null or endDate == null">
94 105
             AND DATE_FORMAT( tp.create_date, '%Y-%m-%d' ) BETWEEN DATE_SUB(now(),INTERVAL 7 DAY) and now()
95 106
         </if>
107
+        <if test="institutionIds != null and institutionIds.size > 0">
108
+            AND tp.institution_id in
109
+            <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
110
+                #{item}
111
+            </foreach>
112
+        </if>
96 113
         GROUP BY
97 114
         DATE_FORMAT( tp.create_date, '%Y-%m-%d' )
98 115
         ORDER BY tp.create_date

+ 32
- 21
src/main/resources/mapper/statistic/TsUserBehaviorStatisticMapper.xml 查看文件

@@ -7,15 +7,16 @@
7 7
 
8 8
     <select id="seleUserBehaviorList"
9 9
             resultType="com.yunzhi.marketing.statistic.entity.TsUserBehaviorStatistic">
10
-                SELECT
10
+        SELECT
11 11
             temp_date.date AS create_date,
12 12
             temp_date.type_name AS event_name,
13 13
             temp_date.type_id AS event_type,
14 14
             temp.activityCount AS behavior_num,
15 15
             temp.building_id,
16
-            temp.org_id
16
+            temp.org_id,
17
+            temp.institution_id
17 18
         FROM
18
-            (
19
+        (
19 20
         SELECT
20 21
             DATE_FORMAT( DATE_SUB( now( ), INTERVAL a.rownum DAY ), '%Y-%m-%d' ) AS date,
21 22
             b.type_id,
@@ -24,26 +25,30 @@
24 25
         FROM
25 26
             sequence a,
26 27
             td_biz_event_type b
27
-            ) AS temp_date
28
-            LEFT JOIN (
29
-        SELECT
30
-            COUNT( 1 ) AS activityCount,
31
-            tpvr.event_type,
32
-            DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ) AS date,
33
-            tpvr.building_id,
34
-            tp.org_id
35
-        FROM
36
-            ta_person tp
28
+        ) AS temp_date
29
+        LEFT JOIN (
30
+            SELECT
31
+                COUNT( 1 ) AS activityCount,
32
+                tpvr.event_type,
33
+                DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ) AS date,
34
+                tpvr.building_id,
35
+                tp.org_id,
36
+                tb.institution_id
37
+            FROM
38
+                ta_person tp
37 39
             INNER JOIN ta_person_visit_record tpvr ON tp.person_id = tpvr.person_id
40
+            LEFT JOIN ta_building tb on tpvr.building_id = tb.building_id
41
+            WHERE
42
+                tp.person_type IN ( 'customer', 'drift', 'estate agent' )
43
+            GROUP BY
44
+                tpvr.event_type,
45
+                DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ),
46
+                tp.org_id,
47
+                tpvr.building_id
48
+        ) AS temp ON temp_date.date = temp.date
49
+        AND temp_date.type_id = temp.event_type
38 50
         WHERE
39
-            tp.person_type IN ( 'customer', 'drift', 'estate agent' )
40
-        GROUP BY
41
-            tpvr.event_type,
42
-            DATE_FORMAT( tpvr.visit_time, '%Y-%m-%d' ),
43
-            tp.org_id,
44
-            tpvr.building_id
45
-            ) AS temp ON temp_date.date = temp.date
46
-            AND temp_date.type_id = temp.event_type where temp_date.date = DATE_FORMAT( now( ), '%Y-%m-%d' )
51
+        temp_date.date = DATE_FORMAT( now( ), '%Y-%m-%d' )
47 52
     </select>
48 53
     <select id="seleBehaviorListByDate"
49 54
             resultType="com.yunzhi.marketing.po.PersonPO">
@@ -84,6 +89,12 @@
84 89
             <if test="buildingId != null and buildingId != ''">
85 90
                 and tp.building_id = #{buildingId}
86 91
             </if>
92
+            <if test="institutionIds != null and institutionIds.size > 0">
93
+                AND tp.institution_id in
94
+                <foreach collection="institutionIds" item="item" open="(" close=")" separator=",">
95
+                    #{item}
96
+                </foreach>
97
+            </if>
87 98
             GROUP BY
88 99
             DATE_FORMAT( tp.create_date, '%Y-%m-%d' ),
89 100
             tp.event_type

+ 2
- 1
src/main/resources/mapper/xlk/BuildingChannelMapper.xml 查看文件

@@ -8,8 +8,9 @@
8 8
         FROM
9 9
             xlk_building_channel t
10 10
             INNER JOIN ta_channel_person c ON t.channel_id = c.channel_id
11
-            LEFT JOIN ta_building b ON t.building_id = b.building_id
11
+            INNER JOIN ta_building b ON t.building_id = b.building_id
12 12
         WHERE
13 13
             c.person_id = #{personId}
14
+            AND b.status = 1
14 15
     </select>
15 16
 </mapper>

+ 0
- 0
src/main/resources/mapper/xlk/ChannelCustomerMapper.xml 查看文件


部分文件因文件數量過多而無法顯示