顾绍勇 il y a 5 ans
Parent
révision
c85bfa3e64

+ 15
- 6
src/main/java/com/huiju/estateagents/controller/TaLiveActivityController.java Voir le fichier

@@ -52,18 +52,23 @@ public class TaLiveActivityController extends BaseController {
52 52
      * @param buildingId        所属楼盘
53 53
      * @param liveDetailType    详情类型 0是模板,1是自定义
54 54
      * @param status            状态
55
+     * @param source            查询来源,1:直播等活动,2:开屏广告
55 56
      * @param request
56 57
      * @return
57 58
      */
58 59
     @RequestMapping(value = "/admin/taLiveActivity", method = RequestMethod.GET)
59 60
     public ResponseBean taLiveActivityList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
60 61
                                            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
61
-                                           String liveActivityTitle, String cityId, String buildingId, Integer status,
62
+                                           String liveActivityTitle,
63
+                                           String cityId,
64
+                                           String buildingId,
65
+                                           Integer status,
66
+                                           @RequestParam(value = "source", defaultValue = "1") Integer source,
62 67
                                            HttpServletRequest request) {
63 68
         ResponseBean responseBean = new ResponseBean();
64 69
         try {
65 70
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, getOrgId(request),
66
-                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request));
71
+                    liveActivityTitle, cityId, buildingId, status, getTaPersonBuildingListByUserId(request), getUserId(request), source);
67 72
             responseBean.addSuccess(result);
68 73
 
69 74
         } catch (Exception e) {
@@ -161,8 +166,8 @@ public class TaLiveActivityController extends BaseController {
161 166
                 iExtendContentService.updateBatchById(list);
162 167
             }
163 168
 
164
-            if(!StringUtils.isEmpty(taLiveActivity.getLiveRoomParam())){
165
-                taLiveActivity.setLiveAppPath(taLiveActivity.getLiveRoomParam().replace(".html",""));
169
+            if (!StringUtils.isEmpty(taLiveActivity.getLiveRoomParam())) {
170
+                taLiveActivity.setLiveAppPath(taLiveActivity.getLiveRoomParam().replace(".html", ""));
166 171
             }
167 172
 
168 173
             if (iTaLiveActivityService.updateById(taLiveActivity)) {
@@ -254,14 +259,18 @@ public class TaLiveActivityController extends BaseController {
254 259
     @RequestMapping(value = "/wx/taLiveActivity", method = RequestMethod.GET)
255 260
     public ResponseBean taLiveActivityListForMiniApp(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
256 261
                                                      @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
257
-                                                     String liveActivityTitle, String cityId, String buildingId, Integer status,
262
+                                                     String liveActivityTitle,
263
+                                                     String cityId,
264
+                                                     String buildingId,
265
+                                                     Integer status,
266
+                                                     @RequestParam(value = "source", defaultValue = "1") Integer source,
258 267
                                                      HttpServletRequest request) {
259 268
         ResponseBean responseBean = new ResponseBean();
260 269
         try {
261 270
             status = status == null ? 1 : status;
262 271
             Integer orgId = getOrgId(request);
263 272
             IPage<TaLiveActivity> result = iTaLiveActivityService.listLiveActivityByCondition(pageNum, pageSize, orgId,
264
-                    liveActivityTitle, cityId, buildingId, status, null, null);
273
+                    liveActivityTitle, cityId, buildingId, status, null, null, source);
265 274
             responseBean.addSuccess(result);
266 275
 
267 276
         } catch (Exception e) {

+ 108
- 89
src/main/java/com/huiju/estateagents/drainage/controller/TaDrainageController.java Voir le fichier

@@ -34,8 +34,8 @@ import java.util.stream.Collectors;
34 34
 
35 35
 /**
36 36
  * <p>
37
-    * 引流项目  前端控制器
38
-    * </p>
37
+ * 引流项目  前端控制器
38
+ * </p>
39 39
  *
40 40
  * @author jobob
41 41
  * @since 2019-10-18
@@ -48,7 +48,7 @@ public class TaDrainageController extends BaseController {
48 48
 
49 49
     @Autowired
50 50
     public ITaDrainageService iTaDrainageService;
51
-    
51
+
52 52
     @Autowired
53 53
     public ITaThirdPartyMiniappConfigService iTaThirdPartyMiniappConfigService;
54 54
 
@@ -66,56 +66,68 @@ public class TaDrainageController extends BaseController {
66 66
 
67 67
     /**
68 68
      * 分页查询列表
69
+     *
69 70
      * @param pageNum
70 71
      * @param pageSize
72
+     * @param drainageId
73
+     * @param name
74
+     * @param isMiniapp
75
+     * @param status
76
+     * @param buildingId
77
+     * @param source     查询来源,1:H5等活动,2:开屏广告
78
+     * @param request
71 79
      * @return
72 80
      */
73
-    @RequestMapping(value="/admin/taDrainage",method= RequestMethod.GET)
74
-    public ResponseBean taDrainageList(@RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
75
-                                       @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
76
-                                       @RequestParam(value ="drainageId",required = false) Integer drainageId,
77
-                                       @RequestParam(value ="name",required = false) String name,
78
-                                       @RequestParam(value ="isMiniapp",required = false) Integer isMiniapp,
79
-                                       @RequestParam(value ="status",required = false) Integer status,
80
-                                       @RequestParam(value ="buildingId",required = false) String buildingId,
81
-                                       HttpServletRequest request){
81
+    @RequestMapping(value = "/admin/taDrainage", method = RequestMethod.GET)
82
+    public ResponseBean taDrainageList(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
83
+                                       @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
84
+                                       @RequestParam(value = "drainageId", required = false) Integer drainageId,
85
+                                       @RequestParam(value = "name", required = false) String name,
86
+                                       @RequestParam(value = "isMiniapp", required = false) Integer isMiniapp,
87
+                                       @RequestParam(value = "status", required = false) Integer status,
88
+                                       @RequestParam(value = "buildingId", required = false) String buildingId,
89
+                                       @RequestParam(value = "source", defaultValue = "1") Integer source,
90
+                                       HttpServletRequest request) {
82 91
         ResponseBean responseBean = new ResponseBean();
83 92
         try {
84 93
             List<TaPersonBuilding> taPersonBuildingList = getTaPersonBuildingListByUserId(request);
85 94
             //使用分页插件
86
-		    IPage<TaDrainage> pg = new Page<>(pageNum, pageSize);
95
+            IPage<TaDrainage> pg = new Page<>(pageNum, pageSize);
87 96
             QueryWrapper<TaDrainage> queryWrapper = new QueryWrapper<>();
88
-            queryWrapper.eq("org_id",getOrgId(request));
89
-            queryWrapper.eq(null != isMiniapp,"is_miniapp",isMiniapp);
90
-            if (null == status){
91
-                queryWrapper.gt("status",-1);
97
+            queryWrapper.eq("org_id", getOrgId(request));
98
+            queryWrapper.eq(null != isMiniapp, "is_miniapp", isMiniapp);
99
+            if (null == status) {
100
+                queryWrapper.gt("status", -1);
101
+            }
102
+            queryWrapper.eq(null != status, "status", status);
103
+            if(2 == source){
104
+                queryWrapper.isNull(StringUtils.isEmpty(buildingId), "building_id");
105
+            }else{
106
+                queryWrapper.eq(!StringUtils.isEmpty(buildingId), "building_id", buildingId);
92 107
             }
93
-            queryWrapper.eq(null != status,"status",status);
94
-            queryWrapper.eq(!StringUtils.isEmpty(buildingId),"building_id",buildingId);
95
-            queryWrapper.isNull(StringUtils.isEmpty(buildingId),"building_id");
96
-            queryWrapper.eq(null != drainageId,"drainage_id",drainageId);
97
-            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id",taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user",getUserId(request)));
98
-            queryWrapper.like(!StringUtils.isEmpty(name),"name",name);
108
+            queryWrapper.eq(null != drainageId, "drainage_id", drainageId);
109
+            queryWrapper.and(taPersonBuildingList.size() > 0, wapper -> wapper.in("building_id", taPersonBuildingList.stream().map(TaPersonBuilding::getBuildingId).collect(Collectors.toList())).or().eq("create_user", getUserId(request)));
110
+            queryWrapper.like(!StringUtils.isEmpty(name), "name", name);
99 111
             queryWrapper.orderByDesc("create_date");
100 112
 
101 113
             IPage<TaDrainage> result = iTaDrainageService.page(pg, queryWrapper);
102 114
             List<TaDrainage> records = result.getRecords();
103 115
             records.forEach(e -> {
104 116
                 QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
105
-                taThirdPartyMiniappConfigQueryWrapper.eq("target_type",CommConstant.TARGET_TYPE_H5);
106
-                taThirdPartyMiniappConfigQueryWrapper.eq("target_id",e.getDrainageId());
107
-                taThirdPartyMiniappConfigQueryWrapper.eq("org_id",getOrgId(request));
117
+                taThirdPartyMiniappConfigQueryWrapper.eq("target_type", CommConstant.TARGET_TYPE_H5);
118
+                taThirdPartyMiniappConfigQueryWrapper.eq("target_id", e.getDrainageId());
119
+                taThirdPartyMiniappConfigQueryWrapper.eq("org_id", getOrgId(request));
108 120
                 TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
109
-                if (null != taThirdPartyMiniappConfig){
121
+                if (null != taThirdPartyMiniappConfig) {
110 122
                     e.setAppid(taThirdPartyMiniappConfig.getAppid());
111 123
                     e.setAppSecret(taThirdPartyMiniappConfig.getAppSecret());
112 124
                 }
113 125
             });
114 126
             result.setRecords(records);
115 127
             responseBean.addSuccess(result);
116
-        }catch (Exception e){
128
+        } catch (Exception e) {
117 129
             e.printStackTrace();
118
-            logger.error("taDrainageList -=- {}",e.toString());
130
+            logger.error("taDrainageList -=- {}", e.toString());
119 131
             responseBean.addError(e.getMessage());
120 132
         }
121 133
         return responseBean;
@@ -123,27 +135,28 @@ public class TaDrainageController extends BaseController {
123 135
 
124 136
     /**
125 137
      * 保存对象
138
+     *
126 139
      * @param taDrainage 实体对象
127 140
      * @return
128 141
      */
129
-    @RequestMapping(value="/admin/taDrainage/add",method= RequestMethod.POST)
130
-    public ResponseBean taDrainageAdd(@RequestBody TaDrainage taDrainage,HttpServletRequest request){
142
+    @RequestMapping(value = "/admin/taDrainage/add", method = RequestMethod.POST)
143
+    public ResponseBean taDrainageAdd(@RequestBody TaDrainage taDrainage, HttpServletRequest request) {
131 144
         ResponseBean responseBean = new ResponseBean();
132 145
         try {
133 146
             taDrainage.setOrgId(getOrgId(request));
134 147
             taDrainage.setCreateDate(LocalDateTime.now());
135 148
             taDrainage.setStatus(CommConstant.STATUS_UNACCALIMED);
136
-            if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isAfter(LocalDateTime.now())){
149
+            if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isAfter(LocalDateTime.now())) {
137 150
                 taDrainage.setStatus(CommConstant.STATUS_NORMAL);
138 151
             }
139 152
             taDrainage.setCreateUser(getUserId(request));
140
-            if (iTaDrainageService.save(taDrainage)){
153
+            if (iTaDrainageService.save(taDrainage)) {
141 154
                 // 根据ORGID查询当前小程序表的miniapp_id
142
-                QueryWrapper<TaMiniapp> taMiniappQuery= new QueryWrapper<>();
143
-                taMiniappQuery.eq("org_id",getOrgId(request));
155
+                QueryWrapper<TaMiniapp> taMiniappQuery = new QueryWrapper<>();
156
+                taMiniappQuery.eq("org_id", getOrgId(request));
144 157
                 TaMiniapp taMiniapp = taMiniappMapper.selectOne(taMiniappQuery);
145 158
                 // 生成二维码
146
-                ResponseBean taMiniappQrcode = miniAppService.getQrCode(CommConstant.DRAINAGE_QRCODE.replace("#0",taDrainage.getDrainageId().toString()).replace("#1","h5"),taMiniapp.getMiniappId());
159
+                ResponseBean taMiniappQrcode = miniAppService.getQrCode(CommConstant.DRAINAGE_QRCODE.replace("#0", taDrainage.getDrainageId().toString()).replace("#1", "h5"), taMiniapp.getMiniappId());
147 160
                 taDrainage.setQrCode(String.valueOf(taMiniappQrcode.getData()));
148 161
                 iTaDrainageService.updateById(taDrainage);
149 162
 
@@ -157,33 +170,35 @@ public class TaDrainageController extends BaseController {
157 170
                 taThirdPartyMiniappConfig.setTargetId(taDrainage.getDrainageId().toString());
158 171
                 iTaThirdPartyMiniappConfigService.save(taThirdPartyMiniappConfig);
159 172
                 responseBean.addSuccess(taDrainage);
160
-            }else {
173
+            } else {
161 174
                 responseBean.addError("fail");
162 175
             }
163
-        }catch (Exception e){
176
+        } catch (Exception e) {
164 177
             e.printStackTrace();
165
-            logger.error("taDrainageAdd -=- {}",e.toString());
178
+            logger.error("taDrainageAdd -=- {}", e.toString());
166 179
             responseBean.addError(e.getMessage());
167 180
         }
168 181
         return responseBean;
169 182
     }
170
-    
183
+
171 184
     /**
172 185
      * 获取uuid
186
+     *
173 187
      * @return
174 188
      */
175 189
     private String getUUIDS() {
176
-        String uuid= UUID.randomUUID().toString().replace("-", "");
190
+        String uuid = UUID.randomUUID().toString().replace("-", "");
177 191
         return uuid;
178 192
     }
179
-    
193
+
180 194
     /**
181 195
      * 根据id删除对象
182
-     * @param id  实体ID
196
+     *
197
+     * @param id 实体ID
183 198
      */
184 199
     @ResponseBody
185
-    @RequestMapping(value="/admin/taDrainage/{id}", method= RequestMethod.DELETE)
186
-    public ResponseBean taDrainageDelete(@PathVariable Integer id, HttpServletRequest request){
200
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.DELETE)
201
+    public ResponseBean taDrainageDelete(@PathVariable Integer id, HttpServletRequest request) {
187 202
         ResponseBean responseBean = new ResponseBean();
188 203
         try {
189 204
 
@@ -195,24 +210,24 @@ public class TaDrainageController extends BaseController {
195 210
             }
196 211
 
197 212
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
198
-            queryWrapper.eq("org_id",drainage.getOrgId());
199
-            queryWrapper.eq("content_type",CommConstant.EVENT_H5);
200
-            queryWrapper.eq("target_id",drainage.getDrainageId());
213
+            queryWrapper.eq("org_id", drainage.getOrgId());
214
+            queryWrapper.eq("content_type", CommConstant.EVENT_H5);
215
+            queryWrapper.eq("target_id", drainage.getDrainageId());
201 216
             List<ExtendContent> list = iExtendContentService.list(queryWrapper);
202
-            if (null != drainage.getStatus() && drainage.getStatus().equals(CommConstant.STATUS_NORMAL) && list.size() > 0){
217
+            if (null != drainage.getStatus() && drainage.getStatus().equals(CommConstant.STATUS_NORMAL) && list.size() > 0) {
203 218
                 responseBean.addError("删除项目会删除全部数据,不建议删除数据。可以点击下架按钮终止活动。");
204 219
                 return responseBean;
205 220
             }
206 221
 
207 222
             drainage.setStatus(-1);
208
-            if(iTaDrainageService.updateById(drainage)){
223
+            if (iTaDrainageService.updateById(drainage)) {
209 224
                 responseBean.addSuccess("success");
210
-            }else {
225
+            } else {
211 226
                 responseBean.addError("fail");
212 227
             }
213
-        }catch (Exception e){
228
+        } catch (Exception e) {
214 229
             e.printStackTrace();
215
-            logger.error("taDrainageDelete -=- {}",e.toString());
230
+            logger.error("taDrainageDelete -=- {}", e.toString());
216 231
             responseBean.addError(e.getMessage());
217 232
         }
218 233
         return responseBean;
@@ -220,30 +235,31 @@ public class TaDrainageController extends BaseController {
220 235
 
221 236
     /**
222 237
      * 修改对象
223
-     * @param id  实体ID
238
+     *
239
+     * @param id         实体ID
224 240
      * @param taDrainage 实体对象
225 241
      * @return
226 242
      */
227
-    @RequestMapping(value="/admin/taDrainage/{id}",method= RequestMethod.PUT)
243
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.PUT)
228 244
     public ResponseBean taDrainageUpdate(@PathVariable Integer id,
229
-                                        @RequestBody TaDrainage taDrainage){
245
+                                         @RequestBody TaDrainage taDrainage) {
230 246
         ResponseBean responseBean = new ResponseBean();
231 247
         try {
232 248
             taDrainage.setDrainageId(id);
233
-            if (!taDrainage.getIsMiniapp()){
249
+            if (!taDrainage.getIsMiniapp()) {
234 250
                 taDrainage.setShareImg("");
235 251
                 taDrainage.setH5Address("");
236 252
                 taDrainage.setShareTitle("");
237 253
                 taDrainage.setMiddleImg("");
238 254
             }
239
-            if (iTaDrainageService.updateById(taDrainage)){
255
+            if (iTaDrainageService.updateById(taDrainage)) {
240 256
                 responseBean.addSuccess(taDrainage);
241
-            }else {
257
+            } else {
242 258
                 responseBean.addError("fail");
243 259
             }
244
-        }catch (Exception e){
260
+        } catch (Exception e) {
245 261
             e.printStackTrace();
246
-            logger.error("taDrainageUpdate -=- {}",e.toString());
262
+            logger.error("taDrainageUpdate -=- {}", e.toString());
247 263
             responseBean.addError(e.getMessage());
248 264
         }
249 265
         return responseBean;
@@ -251,26 +267,27 @@ public class TaDrainageController extends BaseController {
251 267
 
252 268
     /**
253 269
      * 根据id查询对象
254
-     * @param id  实体ID
270
+     *
271
+     * @param id 实体ID
255 272
      */
256
-    @RequestMapping(value="/admin/taDrainage/{id}",method= RequestMethod.GET)
257
-    public ResponseBean taDrainageGet(@PathVariable Integer id,HttpServletRequest request){
273
+    @RequestMapping(value = "/admin/taDrainage/{id}", method = RequestMethod.GET)
274
+    public ResponseBean taDrainageGet(@PathVariable Integer id, HttpServletRequest request) {
258 275
         ResponseBean responseBean = new ResponseBean();
259 276
         try {
260 277
             TaDrainage taDrainage = iTaDrainageService.getById(id);
261 278
             QueryWrapper<TaThirdPartyMiniappConfig> queryWrapper = new QueryWrapper<>();
262
-            queryWrapper.eq("target_type",CommConstant.TARGET_TYPE_H5);
263
-            queryWrapper.eq("target_id",taDrainage.getDrainageId());
264
-            queryWrapper.eq("org_id",getOrgId(request));
279
+            queryWrapper.eq("target_type", CommConstant.TARGET_TYPE_H5);
280
+            queryWrapper.eq("target_id", taDrainage.getDrainageId());
281
+            queryWrapper.eq("org_id", getOrgId(request));
265 282
             TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(queryWrapper);
266
-            if (null != taThirdPartyMiniappConfig){
283
+            if (null != taThirdPartyMiniappConfig) {
267 284
                 taDrainage.setAppid(taThirdPartyMiniappConfig.getAppid());
268 285
                 taDrainage.setAppSecret(taThirdPartyMiniappConfig.getAppSecret());
269 286
             }
270 287
             responseBean.addSuccess(taDrainage);
271
-        }catch (Exception e){
288
+        } catch (Exception e) {
272 289
             e.printStackTrace();
273
-            logger.error("taDrainageDelete -=- {}",e.toString());
290
+            logger.error("taDrainageDelete -=- {}", e.toString());
274 291
             responseBean.addError(e.getMessage());
275 292
         }
276 293
         return responseBean;
@@ -278,32 +295,33 @@ public class TaDrainageController extends BaseController {
278 295
 
279 296
     /**
280 297
      * 更改上架下架状态
281
-     * @param id  实体ID
298
+     *
299
+     * @param id         实体ID
282 300
      * @param taDrainage 实体对象
283 301
      * @return
284 302
      */
285
-    @RequestMapping(value="/admin/taDrainage/exchange/{id}",method= RequestMethod.PUT)
303
+    @RequestMapping(value = "/admin/taDrainage/exchange/{id}", method = RequestMethod.PUT)
286 304
     public ResponseBean exchangeDrainage(@PathVariable Integer id,
287
-                                         @RequestBody TaDrainage taDrainage){
305
+                                         @RequestBody TaDrainage taDrainage) {
288 306
         ResponseBean responseBean = new ResponseBean();
289 307
         try {
290 308
             taDrainage.setDrainageId(id);
291 309
             QueryWrapper<ExtendContent> queryWrapper = new QueryWrapper<>();
292
-            queryWrapper.eq("org_id",taDrainage.getOrgId());
293
-            queryWrapper.eq("content_type",CommConstant.EVENT_H5);
294
-            queryWrapper.eq("target_id",taDrainage.getDrainageId());
310
+            queryWrapper.eq("org_id", taDrainage.getOrgId());
311
+            queryWrapper.eq("content_type", CommConstant.EVENT_H5);
312
+            queryWrapper.eq("target_id", taDrainage.getDrainageId());
295 313
 
296 314
             queryWrapper.gt("status", CommConstant.STATUS_DELETE); // fix bug #6816
297 315
 
298 316
             List<ExtendContent> list = iExtendContentService.list(queryWrapper);
299
-            if (null != taDrainage.getStatus() && taDrainage.getStatus().equals(CommConstant.STATUS_NORMAL)){
317
+            if (null != taDrainage.getStatus() && taDrainage.getStatus().equals(CommConstant.STATUS_NORMAL)) {
300 318
                 taDrainage.setStatus(CommConstant.STATUS_UNACCALIMED);
301 319
                 //如果H5有被轮播图或开屏广告选中则轮播图和开屏广告都要下架
302 320
                 list.forEach(e -> {
303 321
                     e.setStatus(CommConstant.STATUS_UNACCALIMED);
304 322
                 });
305
-            }else{
306
-                if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isBefore(LocalDateTime.now())){
323
+            } else {
324
+                if (DateUtils.dayToLocalDateime(taDrainage.getEndDate()).isBefore(LocalDateTime.now())) {
307 325
                     responseBean.addError("已过下架时间,无法上架");
308 326
                     return responseBean;
309 327
                 }
@@ -313,17 +331,17 @@ public class TaDrainageController extends BaseController {
313 331
                     e.setStatus(CommConstant.STATUS_NORMAL);
314 332
                 });
315 333
             }
316
-            if (list.size() > 0){
334
+            if (list.size() > 0) {
317 335
                 iExtendContentService.updateBatchById(list);
318 336
             }
319
-            if (iTaDrainageService.updateById(taDrainage)){
337
+            if (iTaDrainageService.updateById(taDrainage)) {
320 338
                 responseBean.addSuccess(taDrainage);
321
-            }else {
339
+            } else {
322 340
                 responseBean.addError("fail");
323 341
             }
324
-        }catch (Exception e){
342
+        } catch (Exception e) {
325 343
             e.printStackTrace();
326
-            logger.error("taDrainageUpdate -=- {}",e.toString());
344
+            logger.error("taDrainageUpdate -=- {}", e.toString());
327 345
             responseBean.addError(e.getMessage());
328 346
         }
329 347
         return responseBean;
@@ -331,21 +349,22 @@ public class TaDrainageController extends BaseController {
331 349
 
332 350
     /**
333 351
      * 微信端获取数据
334
-     * @param id  实体ID
352
+     *
353
+     * @param id 实体ID
335 354
      */
336
-    @RequestMapping(value="/wx/taDrainage/{id}",method= RequestMethod.GET)
355
+    @RequestMapping(value = "/wx/taDrainage/{id}", method = RequestMethod.GET)
337 356
     @ReportCustomer(type = "h5")
338 357
     public ResponseBean wxDrainageGet(@PathVariable Integer id,
339 358
                                       @RequestParam(value = "qrCodeId", required = false) String qrCodeId,
340 359
                                       @RequestParam(value = "channelId", required = false) String channelId,
341 360
                                       @RequestParam(value = "sceneId", required = false) String sceneId,
342
-                                      HttpServletRequest request){
361
+                                      HttpServletRequest request) {
343 362
         ResponseBean responseBean = new ResponseBean();
344 363
         try {
345 364
             responseBean.addSuccess(iTaDrainageService.getById(id));
346
-        }catch (Exception e){
365
+        } catch (Exception e) {
347 366
             e.printStackTrace();
348
-            logger.error("taDrainageDelete -=- {}",e.toString());
367
+            logger.error("taDrainageDelete -=- {}", e.toString());
349 368
             responseBean.addError(e.getMessage());
350 369
         }
351 370
         return responseBean;

+ 9
- 1
src/main/java/com/huiju/estateagents/mapper/TaLiveActivityMapper.java Voir le fichier

@@ -30,7 +30,15 @@ public interface TaLiveActivityMapper extends BaseMapper<TaLiveActivity> {
30 30
      */
31 31
     Boolean addVisitNum(@Param("id") String id);
32 32
 
33
-    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg, @Param("liveActivityTitle") String liveActivityTitle, @Param("cityId") String cityId, @Param("buildingId") String buildingId, @Param("status") Integer status, @Param("orgId") Integer orgId,@Param("personBuildingList") List<TaPersonBuilding> personBuildingList, @Param("userId") Integer userId);
33
+    IPage<TaLiveActivity> selectLiveListByCondition(IPage<TaLiveActivity> pg,
34
+                                                    @Param("liveActivityTitle") String liveActivityTitle,
35
+                                                    @Param("cityId") String cityId,
36
+                                                    @Param("buildingId") String buildingId,
37
+                                                    @Param("status") Integer status,
38
+                                                    @Param("orgId") Integer orgId,
39
+                                                    @Param("personBuildingList") List<TaPersonBuilding> personBuildingList,
40
+                                                    @Param("userId") Integer userId,
41
+                                                    @Param("source") Integer source);
34 42
     /**
35 43
      * 批量更新直播活动状态
36 44
      *

+ 22
- 13
src/main/java/com/huiju/estateagents/reportCustomerAop/ReportCustomerAspect.java Voir le fichier

@@ -6,6 +6,7 @@ import java.util.Map;
6 6
 
7 7
 import javax.servlet.http.HttpServletRequest;
8 8
 
9
+import com.alibaba.fastjson.JSONObject;
9 10
 import org.aspectj.lang.JoinPoint;
10 11
 import org.aspectj.lang.annotation.After;
11 12
 import org.aspectj.lang.annotation.Aspect;
@@ -47,7 +48,9 @@ public class ReportCustomerAspect extends BaseController {
47 48
     ReportCustomerImpl reportCustomerImpl;
48 49
 
49 50
 
50
-    /** 以自定义 @ReportCustomer 注解为切点 */
51
+    /**
52
+     * 以自定义 @ReportCustomer 注解为切点
53
+     */
51 54
     @Pointcut("@annotation(com.huiju.estateagents.reportCustomerAop.ReportCustomer)")
52 55
     public void reportCustomer() {
53 56
 
@@ -55,9 +58,10 @@ public class ReportCustomerAspect extends BaseController {
55 58
 
56 59
     @After("reportCustomer()")
57 60
     public ResponseBean doAround(JoinPoint proceedingJoinPoint) throws Throwable {
61
+        logger.info("ReportCustomerAspect 开始");
58 62
         ResponseBean responseBean = new ResponseBean();
59
-        try{
60
-            ReportCustomer reportCustomer = ((MethodSignature)proceedingJoinPoint.getSignature()).getMethod().getAnnotation(ReportCustomer.class);
63
+        try {
64
+            ReportCustomer reportCustomer = ((MethodSignature) proceedingJoinPoint.getSignature()).getMethod().getAnnotation(ReportCustomer.class);
61 65
             //获取请求参数
62 66
             Object[] args = proceedingJoinPoint.getArgs();
63 67
             String targetType = reportCustomer.type();
@@ -65,10 +69,12 @@ public class ReportCustomerAspect extends BaseController {
65 69
             String qrCodeId = String.valueOf(args[1]);
66 70
             String channelId = String.valueOf(args[2]);
67 71
             String sceneId = String.valueOf(args[3]);
68
-            HttpServletRequest request = (HttpServletRequest)args[4];
72
+            HttpServletRequest request = (HttpServletRequest) args[4];
73
+
74
+            logger.info("ReportCustomerAspect 接收参数,args:{}", JSONObject.toJSONString(args));
69 75
 
70 76
             Map<String, Object> stringObjectMap = getBuildingByIdAndType(targetId, targetType);
71
-            if (request == null){
77
+            if (request == null) {
72 78
                 responseBean.addError("未授权,不进行操作");
73 79
                 return responseBean;
74 80
             }
@@ -76,11 +82,13 @@ public class ReportCustomerAspect extends BaseController {
76 82
             String consultantPersonId = request.getHeader("x-consultant");
77 83
             String recommend = request.getHeader("x-recommender");
78 84
 
85
+            logger.info("ReportCustomerAspect 获取header信息,consultantPersonId:{},recommend:{}", consultantPersonId, recommend);
86
+
79 87
             List<TaPerson> persons = getPersonsByOpenId(getOpenId(request));
80 88
             TaPerson taPerson = persons.get(0);
81 89
             Integer orgId = getOrgId(request);
82 90
 
83
-            TaCustomerFrom  taCustomerFrom = assembleVO(taPerson, targetType, targetId, stringObjectMap.get("targetName").toString(), orgId, sceneId, channelId, qrCodeId);
91
+            TaCustomerFrom taCustomerFrom = assembleVO(taPerson, targetType, targetId, stringObjectMap.get("targetName").toString(), orgId, sceneId, channelId, qrCodeId);
84 92
             // 推广人
85 93
             TaPerson recPerson = StringUtils.isEmpty(recommend) ? null : taPersonMapper.getById(recommend);
86 94
             // 是否置业顾问
@@ -97,14 +105,15 @@ public class ReportCustomerAspect extends BaseController {
97 105
             iTaRecommendCustomerService.newCustomer(orgId, taPerson, recPerson, consultantInfo, building, taCustomerFrom);
98 106
             responseBean.addSuccess("绑定成功");
99 107
 
100
-        }catch (Exception e){
108
+        } catch (Exception e) {
101 109
             logger.error("绑定失败");
102 110
             responseBean.addError("失败");
103 111
         }
112
+        logger.info("ReportCustomerAspect 结束");
104 113
         return responseBean;
105 114
     }
106 115
 
107
-    public TaCustomerFrom assembleVO(TaPerson person, String targetType, String targetId, String targetName, Integer orgId, String sceneId, String channelId, String qrCodeId){
116
+    public TaCustomerFrom assembleVO(TaPerson person, String targetType, String targetId, String targetName, Integer orgId, String sceneId, String channelId, String qrCodeId) {
108 117
         // 客户来源
109 118
         TaCustomerFrom customerFrom = new TaCustomerFrom();
110 119
         customerFrom.setPersonId(person.getPersonId());
@@ -114,10 +123,10 @@ public class ReportCustomerAspect extends BaseController {
114 123
         customerFrom.setTargetName(targetName);
115 124
         customerFrom.setOrgId(orgId);
116 125
         customerFrom.setSceneId(sceneId);
117
-        if (!StringUtils.isEmpty(channelId)){
126
+        if (!StringUtils.isEmpty(channelId)) {
118 127
             customerFrom.setChannelId(Integer.valueOf(channelId));
119 128
         }
120
-        if(!StringUtils.isEmpty(qrCodeId)){
129
+        if (!StringUtils.isEmpty(qrCodeId)) {
121 130
             customerFrom.setQrCodeId(Integer.valueOf(qrCodeId));
122 131
         }
123 132
         customerFrom.setCreateDate(LocalDateTime.now());
@@ -125,14 +134,14 @@ public class ReportCustomerAspect extends BaseController {
125 134
         return customerFrom;
126 135
     }
127 136
 
128
-    public List<TaPerson> getPersonsByOpenId(String openId){
137
+    public List<TaPerson> getPersonsByOpenId(String openId) {
129 138
         return taPersonMapper.getPersonByOpenId(openId);
130 139
     }
131 140
 
132
-    public Map<String, Object> getBuildingByIdAndType(String targetId, String targetType){
141
+    public Map<String, Object> getBuildingByIdAndType(String targetId, String targetType) {
133 142
         Map<String, Object> buildingAndNameInfo = null;
134 143
 
135
-        switch (targetType){
144
+        switch (targetType) {
136 145
             case CommConstant.FAVOR_ACTIVITY:
137 146
                 buildingAndNameInfo = reportCustomerImpl.selectActivityBuildingInfo(targetId);
138 147
                 break;

+ 2
- 1
src/main/java/com/huiju/estateagents/service/ITaLiveActivityService.java Voir le fichier

@@ -41,7 +41,8 @@ public interface ITaLiveActivityService extends IService<TaLiveActivity> {
41 41
      * @return
42 42
      */
43 43
     IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
44
-                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId);
44
+                                                      String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId,
45
+                                                      Integer userId,Integer source);
45 46
 
46 47
     /**
47 48
      * 访问量自增

+ 5
- 5
src/main/java/com/huiju/estateagents/service/impl/TaLiveActivityServiceImpl.java Voir le fichier

@@ -104,13 +104,13 @@ public class TaLiveActivityServiceImpl extends ServiceImpl<TaLiveActivityMapper,
104 104
 
105 105
     @Override
106 106
     public IPage<TaLiveActivity> listLiveActivityByCondition(Integer pageNum, Integer pageSize, Integer orgId, String liveActivityTitle,
107
-                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId, Integer userId) {
108
-        logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{}," +
109
-                    "liveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{}", pageNum, pageSize,
110
-                liveActivityTitle, cityId, buildingId, status);
107
+                                                             String cityId, String buildingId, Integer status, List<TaPersonBuilding> taPersonBuildingListByUserId,
108
+                                                             Integer userId, Integer source) {
109
+        logger.info("TaLiveActivityServiceImpl.listLiveActivityByCondition 接收参数:pageNum:{},pageSize:{},orgId:{},iveActivityTitle:{},cityId:{},buildingId:{},liveDetailType:{},status:{},source:{}",
110
+                pageNum, pageSize, liveActivityTitle, cityId, buildingId, status, source);
111 111
 
112 112
         IPage<TaLiveActivity> pg = new Page<>(pageNum, pageSize);
113
-        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId,taPersonBuildingListByUserId, userId);
113
+        return taLiveActivityMapper.selectLiveListByCondition(pg, liveActivityTitle, cityId, buildingId, status, orgId, taPersonBuildingListByUserId, userId, source);
114 114
     }
115 115
 
116 116
     @Override

+ 7
- 0
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Voir le fichier

@@ -175,6 +175,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
175 175
 
176 176
     @Override
177 177
     public List<TaRecommendCustomer> newCustomer(Integer orgId, TaPerson person, TaPerson recommender, TaPerson consultant, TaBuilding building, TaCustomerFrom from) throws Exception {
178
+        logger.info("newCustomer 接收参数:orgId:{},person:{},recommender:{},consultant:{},building:{},from:{}",
179
+                orgId, JSONObject.toJSONString(person), JSONObject.toJSONString(recommender), JSONObject.toJSONString(consultant), JSONObject.toJSONString(building), JSONObject.toJSONString(from));
180
+
178 181
         // 如果置业推荐了非自己绑定楼盘, 会生成 2 条客户记录
179 182
         List<TaRecommendCustomer> result = new ArrayList<>();
180 183
         List<TaBuilding> consultBuildings = null;
@@ -206,6 +209,9 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
206 209
         // 置业与内容楼盘是否有关联关系
207 210
         boolean builingAssociated = false;
208 211
 
212
+        logger.info("newCustomer checkCustomer查询结果:hasOrgCust:{},hasConsultBuildingCust:{},hasConsultCust:{},hasBuildingCust:{}",
213
+                hasOrgCust, hasConsultBuildingCust, hasConsultCust, hasBuildingCust);
214
+
209 215
         // 职业顾问不插入客户表
210 216
         boolean personIsConsultant = CommConstant.PERSON_REALTY_CONSULTANT.equals(person.getPersonType()) ? true : false;
211 217
         if (personIsConsultant) {
@@ -1314,4 +1320,5 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
1314 1320
         taCustomerFollowUpRecord.setCustomerSex(taRecommendCustomer.getSex());
1315 1321
         customerFollowUpRecordMapper.insert(taCustomerFollowUpRecord);
1316 1322
     }
1323
+
1317 1324
 }

+ 41
- 27
src/main/resources/mapper/TaLiveActivityMapper.xml Voir le fichier

@@ -22,34 +22,48 @@
22 22
     </update>
23 23
 
24 24
     <select id="selectLiveListByCondition" resultType="com.huiju.estateagents.entity.TaLiveActivity">
25
-     select a.building_name,b.name as city_name,c.user_name as createName,d.user_name as updateName, t.* From ta_live_activity t
26
-     left join ta_building a on t.building_id = a.building_id
27
-     LEFT JOIN td_city b on t.city_id = b.id
28
-     left join ta_user c on t.create_user = c.user_id
29
-     left join ta_user d on t.update_user = d.user_id
25
+     select
26
+        a.building_name,
27
+        b.name as city_name,
28
+        c.user_name as createName,
29
+        d.user_name as updateName,
30
+        t.*
31
+     From
32
+        ta_live_activity t
33
+         left join ta_building a on t.building_id = a.building_id
34
+         LEFT JOIN td_city b on t.city_id = b.id
35
+         left join ta_user c on t.create_user = c.user_id
36
+         left join ta_user d on t.update_user = d.user_id
30 37
      where t.org_id = #{orgId} and t.status != -1
31
-     <if test="status != null">
32
-         and t.status = #{status}
33
-     </if>
34
-     <if test="liveActivityTitle != null and liveActivityTitle != ''">
35
-         and t.live_Activity_Title like CONCAT('%', #{liveActivityTitle}, '%')
36
-     </if>
37
-     <if test="cityId != null and cityId != ''">
38
-         and t.city_id = #{cityId}
39
-     </if><if test="buildingId != null and buildingId != ''">
40
-         and t.building_id = #{buildingId}
41
-    </if>
42
-    <if test="buildingId == null or buildingId == ''">
43
-        and t.building_id is null
44
-    </if>
45
-    <if test="personBuildingList != null and personBuildingList.size > 0">
46
-        AND (t.building_id in
47
-        <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
48
-            #{personBuilding.buildingId}
49
-        </foreach>
50
-        or t.create_user = #{userId})
51
-    </if>
52
-        order by t.weight desc
38
+         <if test="status != null">
39
+             and t.status = #{status}
40
+         </if>
41
+         <if test="liveActivityTitle != null and liveActivityTitle != ''">
42
+             and t.live_Activity_Title like CONCAT('%', #{liveActivityTitle}, '%')
43
+         </if>
44
+         <if test="cityId != null and cityId != ''">
45
+             and t.city_id = #{cityId}
46
+         </if>
47
+         <choose>
48
+             <when test = 'source == 2'>
49
+                 <if test="buildingId == null or buildingId == ''">
50
+                     and t.building_id is null
51
+                 </if>
52
+             </when>
53
+             <otherwise>
54
+                 <if test="buildingId != null and buildingId != ''">
55
+                     and t.building_id = #{buildingId}
56
+                 </if>
57
+             </otherwise>
58
+         </choose>
59
+        <if test="personBuildingList != null and personBuildingList.size > 0">
60
+            AND (t.building_id in
61
+            <foreach collection="personBuildingList" item="personBuilding" open="(" close=")" separator=",">
62
+                #{personBuilding.buildingId}
63
+            </foreach>
64
+            or t.create_user = #{userId})
65
+        </if>
66
+            order by t.weight desc
53 67
     </select>
54 68
     <select id="getDetailById" resultType="com.huiju.estateagents.entity.TaLiveActivity">
55 69
         select t.*,a.live_plat_name as liveAppName From ta_live_activity t