魏超 5 anos atrás
pai
commit
1da9e03eb3

+ 9
- 2
src/main/java/com/huiju/estateagents/controller/HelpActivityController.java Ver arquivo

@@ -553,8 +553,15 @@ public class HelpActivityController extends BaseController {
553 553
     public ResponseBean wxhelpActivityAndGroup(HttpServletRequest request,
554 554
                                                @RequestParam(value = "buildingId",required = false) String buildingId,
555 555
                                                @RequestParam(value = "cityId",required = false) String cityId) {
556
-            ResponseBean lsit = taHelpActivityService.wxhelpActivityAndGroup(getOrgId(request),buildingId,cityId);
557
-                return lsit;
556
+            String openid = getOpenId(request);
557
+            ResponseBean  responseBean = new ResponseBean();
558
+            List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
559
+            if (null == taPersons || taPersons.size() != 1) {
560
+                return responseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
561
+            }
562
+            TaPerson person = taPersons.get(0);
563
+            ResponseBean lsit = taHelpActivityService.wxhelpActivityAndGroup(getOrgId(request),buildingId,cityId, person);
564
+            return lsit;
558 565
         }
559 566
 
560 567
 }

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

@@ -3,6 +3,7 @@ package com.huiju.estateagents.service;
3 3
 import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.huiju.estateagents.base.ResponseBean;
5 5
 import com.huiju.estateagents.entity.HelpActivity;
6
+import com.huiju.estateagents.entity.TaPerson;
6 7
 import com.huiju.estateagents.entity.TaPersonBuilding;
7 8
 import com.huiju.estateagents.excel.HelpInitiateRecordSucceed;
8 9
 import com.huiju.estateagents.excel.HelpProceedAndFinish;
@@ -136,7 +137,7 @@ public interface IHelpActivityService extends IService<HelpActivity> {
136 137
      * @param orgId
137 138
      * @return
138 139
      */
139
-    ResponseBean wxhelpActivityAndGroup(Integer orgId,String buildingId,String cityID);
140
+    ResponseBean wxhelpActivityAndGroup(Integer orgId, String buildingId, String cityID, TaPerson person);
140 141
 
141 142
     /**
142 143
      * 列表  已开始 和 未开始

+ 71
- 30
src/main/java/com/huiju/estateagents/service/impl/HelpActivityServiceImpl.java Ver arquivo

@@ -5,16 +5,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 7
 import com.huiju.estateagents.base.ResponseBean;
8
+import com.huiju.estateagents.common.CommConstant;
8 9
 import com.huiju.estateagents.common.StringUtils;
9 10
 import com.huiju.estateagents.entity.*;
10 11
 import com.huiju.estateagents.event.EventBus;
11 12
 import com.huiju.estateagents.excel.HelpInitiateRecordSucceed;
12 13
 import com.huiju.estateagents.excel.HelpProceedAndFinish;
13 14
 import com.huiju.estateagents.excel.HelpRecordExport;
14
-import com.huiju.estateagents.mapper.HelpActivityMapper;
15
-import com.huiju.estateagents.mapper.HelpInitiateRecordMapper;
16
-import com.huiju.estateagents.mapper.HelpRecordMapper;
17
-import com.huiju.estateagents.mapper.TaShareActivityMapper;
15
+import com.huiju.estateagents.mapper.*;
18 16
 import com.huiju.estateagents.service.IHelpActivityService;
19 17
 import org.apache.commons.collections.CollectionUtils;
20 18
 import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +41,12 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
43 41
     @Autowired
44 42
     HelpInitiateRecordMapper helpInitiateRecordMapper;
45 43
 
44
+    @Autowired
45
+    private TaActivityDynamicEnlistMapper taActivityDynamicEnlistMapper;
46
+
47
+    @Autowired
48
+    private TaShareRecordMapper taShareRecordMapper;
49
+
46 50
     @Autowired
47 51
     HelpRecordMapper helpRecordMapper;
48 52
 
@@ -53,10 +57,10 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
53 57
     TaShareActivityMapper taShareActivityMapper;
54 58
 
55 59
     @Override
56
-    public ResponseBean helpActivityList(Integer pageNum, Integer pageSize, Integer cityId, String buildingId, String title, String startDate, String endDate, Integer activityStatus, Integer orgId,List<TaPersonBuilding> personBuildingList) {
60
+    public ResponseBean helpActivityList(Integer pageNum, Integer pageSize, Integer cityId, String buildingId, String title, String startDate, String endDate, Integer activityStatus, Integer orgId, List<TaPersonBuilding> personBuildingList) {
57 61
         ResponseBean responseBean = new ResponseBean<>();
58 62
         IPage<HelpActivity> pg = new Page<>(pageNum, pageSize);
59
-        IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListPage(pg, cityId, buildingId, title, startDate, endDate, activityStatus, orgId,personBuildingList);
63
+        IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListPage(pg, cityId, buildingId, title, startDate, endDate, activityStatus, orgId, personBuildingList);
60 64
         responseBean.addSuccess(result);
61 65
         return responseBean;
62 66
     }
@@ -65,7 +69,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
65 69
     public int helpActivityAdd(HelpActivity helpActivity, Integer orgId) {
66 70
         helpActivity.setOrgId(orgId)
67 71
                 .setCreateDate(LocalDateTime.now());
68
-                taHelpActivityMapper.insert(helpActivity);
72
+        taHelpActivityMapper.insert(helpActivity);
69 73
         return helpActivity.getHelpActivityId();
70 74
     }
71 75
 
@@ -75,7 +79,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
75 79
     }
76 80
 
77 81
     @Override
78
-    public ResponseBean helpRecord(Integer helpActivityId, String status,Integer pageNum,Integer pageSize,String tel) {
82
+    public ResponseBean helpRecord(Integer helpActivityId, String status, Integer pageNum, Integer pageSize, String tel) {
79 83
         ResponseBean responseBean = new ResponseBean<>();
80 84
         //  status: helpSucceed助力成功,helpUnderway进行中,helpUnfinished助力失败
81 85
 
@@ -84,9 +88,9 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
84 88
         // 得到活动限制助力的总数
85 89
         int persionNumCount = helpActivity.getPersonNum();
86 90
         IPage<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
87
-        IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPageList(pg,helpActivityId,status,tel);
91
+        IPage<HelpInitiateRecord> list = helpInitiateRecordMapper.selectPageList(pg, helpActivityId, status, tel);
88 92
 
89
-        List<HelpInitiateRecord>  helpInitiateRecordList= list.getRecords();
93
+        List<HelpInitiateRecord> helpInitiateRecordList = list.getRecords();
90 94
         for (HelpInitiateRecord helpInitiateRecord : helpInitiateRecordList) {
91 95
             helpInitiateRecord.setPersionNumCount(persionNumCount);
92 96
             // 统计助力成功的总数(发起人得到助力数满了即可)
@@ -127,7 +131,7 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
127 131
     public ResponseBean taHelpRecordDetails(Integer helpRecordInitiateId, Integer pageNum, Integer pageSize) {
128 132
         ResponseBean responseBean = new ResponseBean<>();
129 133
         IPage<HelpInitiateRecord> pg = new Page<>(pageNum, pageSize);
130
-        IPage<HelpRecord> helpRecordList= helpRecordMapper.taHelpRecordDetails(pg,helpRecordInitiateId);
134
+        IPage<HelpRecord> helpRecordList = helpRecordMapper.taHelpRecordDetails(pg, helpRecordInitiateId);
131 135
         responseBean.addSuccess(helpRecordList);
132 136
         return responseBean;
133 137
     }
@@ -136,26 +140,26 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
136 140
     public ResponseBean helpInitiateRecordVerify(Integer helpRecordInitiateId, String verifyCode) {
137 141
         ResponseBean responseBean = new ResponseBean<>();
138 142
         HelpInitiateRecord helpInitiateRecord = helpInitiateRecordMapper.selectById(helpRecordInitiateId);
139
-        if (null ==verifyCode || "".equals(verifyCode)){
143
+        if (null == verifyCode || "".equals(verifyCode)) {
140 144
             responseBean.addError("请输入核销码");
141 145
             return responseBean;
142 146
         }
143 147
 
144 148
         // 判断是否已核销
145
-        if ("1".equals(helpInitiateRecord.getVerificationStatus())){
149
+        if ("1".equals(helpInitiateRecord.getVerificationStatus())) {
146 150
             responseBean.addSuccess("已核销");
147 151
             return responseBean;
148 152
         }
149 153
 
150
-        if (verifyCode.equals(String.valueOf(helpInitiateRecord.getVerification()))){
154
+        if (verifyCode.equals(String.valueOf(helpInitiateRecord.getVerification()))) {
151 155
             helpInitiateRecord.setVerificationStatus(1);
152 156
             helpInitiateRecordMapper.updateById(helpInitiateRecord);
153 157
 
154 158
             // 活动核销加积分
155
-            applicationContext.publishEvent(new EventBus(helpInitiateRecord, EventBus.EventType.ActivityVerificationSign,helpInitiateRecord.getOrgId()));
159
+            applicationContext.publishEvent(new EventBus(helpInitiateRecord, EventBus.EventType.ActivityVerificationSign, helpInitiateRecord.getOrgId()));
156 160
 
157 161
             responseBean.addSuccess("成功");
158
-        }else {
162
+        } else {
159 163
             responseBean.addError("核销码错误,请重新输入");
160 164
         }
161 165
         return responseBean;
@@ -163,34 +167,34 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
163 167
 
164 168
     @Override
165 169
     public Integer getHelpInitiateRecordSucceed(String tel, Integer helpActivityId) {
166
-        QueryWrapper<HelpInitiateRecord> helpInitiateRecordQuery= new QueryWrapper<>();
167
-        helpInitiateRecordQuery.eq("help_activity_id",helpActivityId);
168
-        helpInitiateRecordQuery.eq(!StringUtils.isEmpty(tel), "phone",tel);
170
+        QueryWrapper<HelpInitiateRecord> helpInitiateRecordQuery = new QueryWrapper<>();
171
+        helpInitiateRecordQuery.eq("help_activity_id", helpActivityId);
172
+        helpInitiateRecordQuery.eq(!StringUtils.isEmpty(tel), "phone", tel);
169 173
         return helpInitiateRecordMapper.selectCount(helpInitiateRecordQuery);
170 174
     }
171 175
 
172 176
     @Override
173 177
     public List<HelpInitiateRecordSucceed> getHelpInitiateRecordSucceedExportList(int i, Integer pageSize, String tel, Integer helpActivityId) {
174
-         List<HelpInitiateRecordSucceed> lsit= helpInitiateRecordMapper.getHelpInitiateRecordSucceedExportList(i,pageSize,tel,helpActivityId);
178
+        List<HelpInitiateRecordSucceed> lsit = helpInitiateRecordMapper.getHelpInitiateRecordSucceedExportList(i, pageSize, tel, helpActivityId);
175 179
         return lsit;
176 180
     }
177 181
 
178 182
     @Override
179
-    public List<HelpProceedAndFinish> getHelpProceedAndFinishExportList(int i, Integer pageSize, String tel, Integer helpActivityId,String condition) {
180
-        List<HelpProceedAndFinish> lsit= helpInitiateRecordMapper.getHelpProceedAndFinishExportList(i,pageSize,tel,helpActivityId,condition);
183
+    public List<HelpProceedAndFinish> getHelpProceedAndFinishExportList(int i, Integer pageSize, String tel, Integer helpActivityId, String condition) {
184
+        List<HelpProceedAndFinish> lsit = helpInitiateRecordMapper.getHelpProceedAndFinishExportList(i, pageSize, tel, helpActivityId, condition);
181 185
         return lsit;
182 186
     }
183 187
 
184 188
     @Override
185 189
     public Integer getHelpRecord(Integer helpRecordInitiateId) {
186
-        QueryWrapper<HelpRecord> helpInitiateRecordQuery= new QueryWrapper<>();
187
-        helpInitiateRecordQuery.eq("help_record_initiate_id",helpRecordInitiateId);
190
+        QueryWrapper<HelpRecord> helpInitiateRecordQuery = new QueryWrapper<>();
191
+        helpInitiateRecordQuery.eq("help_record_initiate_id", helpRecordInitiateId);
188 192
         return helpRecordMapper.selectCount(helpInitiateRecordQuery);
189 193
     }
190 194
 
191 195
     @Override
192 196
     public List<HelpRecordExport> getHelpRecordExportList(int i, Integer pageSize, Integer helpRecordInitiateId) {
193
-        List<HelpRecordExport> lsit= helpRecordMapper.getHelpRecordExportList(i,pageSize,helpRecordInitiateId);
197
+        List<HelpRecordExport> lsit = helpRecordMapper.getHelpRecordExportList(i, pageSize, helpRecordInitiateId);
194 198
         return lsit;
195 199
     }
196 200
 
@@ -210,19 +214,56 @@ public class HelpActivityServiceImpl extends ServiceImpl<HelpActivityMapper, Hel
210 214
     }
211 215
 
212 216
     @Override
213
-    public ResponseBean wxhelpActivityAndGroup(Integer orgId,String buildingId,String cityID) {
217
+    public ResponseBean wxhelpActivityAndGroup(Integer orgId, String buildingId, String cityID, TaPerson person) {
214 218
         ResponseBean responseBean = new ResponseBean<>();
219
+        //查询是否报名了普通活动
220
+        QueryWrapper<TaActivityDynamicEnlist> queryWrapper = new QueryWrapper<>();
221
+        queryWrapper.eq("org_id", orgId);
222
+        queryWrapper.eq("person_id", person.getPersonId());
223
+        List<TaActivityDynamicEnlist> taActivityDynamicEnlists = taActivityDynamicEnlistMapper.selectList(queryWrapper);
224
+        //查询是否报名了拼团活动
225
+        QueryWrapper<TaShareRecord> taShareRecordQueryWrapper = new QueryWrapper<>();
226
+        taShareRecordQueryWrapper.eq("org_id", orgId);
227
+        taShareRecordQueryWrapper.eq("person_id", person.getPersonId());
228
+        List<TaShareRecord> taShareRecords = taShareRecordMapper.selectList(taShareRecordQueryWrapper);
229
+        //判断是否发起了助力活动
230
+        QueryWrapper<HelpInitiateRecord> helpInitiateRecordListQueryWrapper = new QueryWrapper<>();
231
+        helpInitiateRecordListQueryWrapper.eq("org_id", orgId);
232
+        helpInitiateRecordListQueryWrapper.eq("person_id", person.getPersonId());
233
+        List<HelpInitiateRecord> helpInitiateRecords = helpInitiateRecordMapper.selectList(helpInitiateRecordListQueryWrapper);
234
+
215 235
         // buildingId 楼盘ID为空时首页只查置顶的活动,楼盘ID不为空查所有拼团和助力
216
-        List<HelpActivity> HelpActivity = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId,buildingId,cityID);
217
-        responseBean.addSuccess(HelpActivity);
236
+        List<HelpActivity> helpActivities = taHelpActivityMapper.selectWxhelpActivityAndGroup(orgId, buildingId, cityID);
237
+        for (HelpActivity helpActivity : helpActivities) {
238
+            if ("activity".equals(helpActivity.getType())) {
239
+                taActivityDynamicEnlists.forEach(dynamic -> {
240
+                    if (helpActivity.getActivityId().equals(dynamic.getDynamicId())) {
241
+                        helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
242
+                    }
243
+                });
244
+            } else if ("group".equals(helpActivity.getType())) {
245
+                taShareRecords.forEach(share -> {
246
+                    if (helpActivity.getActivityId().equals(share.getGroupActivityId().toString())) {
247
+                        helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
248
+                    }
249
+                });
250
+            } else if ("help".equals(helpActivity.getType())) {
251
+                helpInitiateRecords.forEach(help -> {
252
+                    if (helpActivity.getActivityId().equals(help.getHelpActivityId().toString())) {
253
+                        helpActivity.setActivityStatus(CommConstant.ACTIVITY_STATUS_PARTNER);
254
+                    }
255
+                });
256
+            }
257
+        }
258
+        responseBean.addSuccess(helpActivities);
218 259
         return responseBean;
219 260
     }
220 261
 
221 262
     @Override
222
-    public ResponseBean helpActivityEffectiveList(Integer pageNum, Integer pageSize, Integer cityId, Integer orgId, String buildingId,Integer status,String name,List<TaPersonBuilding> personBuildingList) {
263
+    public ResponseBean helpActivityEffectiveList(Integer pageNum, Integer pageSize, Integer cityId, Integer orgId, String buildingId, Integer status, String name, List<TaPersonBuilding> personBuildingList) {
223 264
         ResponseBean responseBean = new ResponseBean<>();
224 265
         IPage<HelpActivity> pg = new Page<>(pageNum, pageSize);
225
-        IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListEffectivePage(pg, cityId, orgId, buildingId,status,name,personBuildingList);
266
+        IPage<HelpActivity> result = taHelpActivityMapper.helpActivityListEffectivePage(pg, cityId, orgId, buildingId, status, name, personBuildingList);
226 267
         responseBean.addSuccess(result);
227 268
         return responseBean;
228 269
     }

+ 57
- 3
src/main/java/com/huiju/estateagents/service/impl/TaBuildingServiceImpl.java Ver arquivo

@@ -67,13 +67,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
67 67
     TdCityMapper tdCityMapper;
68 68
 
69 69
     @Autowired
70
-    private TaBuildingProjectTypeMapper taBuildingProjectTypeMapper;
70
+    private TaGoodsMapper taGoodsMapper;
71 71
 
72 72
     @Autowired
73
-    private TaPosterService taPosterService;
73
+    private TaNewsMapper taNewsMapper;
74 74
 
75 75
     @Autowired
76
-    private TaShareContentService taShareContentService;
76
+    private TaBuildingDynamicMapper taBuildingDynamicMapper;
77 77
 
78 78
     @Autowired
79 79
     private HelpActivityMapper helpActivityMapper;
@@ -81,6 +81,18 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
81 81
     @Autowired
82 82
     private TaShareActivityMapper taShareActivityMapper;
83 83
 
84
+    @Autowired
85
+    private TaExtendContentMapper taExtendContentMapper;
86
+
87
+    @Autowired
88
+    private TaBuildingProjectTypeMapper taBuildingProjectTypeMapper;
89
+
90
+    @Autowired
91
+    private TaPosterService taPosterService;
92
+
93
+    @Autowired
94
+    private TaShareContentService taShareContentService;
95
+
84 96
     @Autowired
85 97
     private  TaOrgMapper  taOrgMapper;
86 98
 
@@ -355,6 +367,48 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
355 367
             TdCity city = tdCityMapper.selectById(building.getCityId());
356 368
             city.setStatus("1");
357 369
             tdCityMapper.updateById(city);
370
+
371
+            //更新商品城市
372
+            TaGoods taGoods = new TaGoods();
373
+            taGoods.setCityId(building.getCityId());
374
+            QueryWrapper<TaGoods> goodsQueryWrapper = new QueryWrapper<>();
375
+            goodsQueryWrapper.eq("building_id", building.getBuildingId());
376
+            taGoodsMapper.update(taGoods, goodsQueryWrapper);
377
+
378
+            //更新资讯城市
379
+            TaNews taNews = new TaNews();
380
+            taNews.setCityId(building.getCityId());
381
+            QueryWrapper<TaNews> newsQueryWrapper = new QueryWrapper<>();
382
+            newsQueryWrapper.eq("building_id", building.getBuildingId());
383
+            taNewsMapper.update(taNews, newsQueryWrapper);
384
+
385
+            //更新活动城市
386
+            TaBuildingDynamic taBuildingDynamic = new TaBuildingDynamic();
387
+            taBuildingDynamic.setCityId(building.getCityId());
388
+            QueryWrapper<TaBuildingDynamic> taBuildingDynamicQueryWrapper = new QueryWrapper<>();
389
+            taBuildingDynamicQueryWrapper.eq("building_id", building.getBuildingId());
390
+            taBuildingDynamicMapper.update(taBuildingDynamic, taBuildingDynamicQueryWrapper);
391
+
392
+            //更新助力城市
393
+            HelpActivity helpActivity = new HelpActivity();
394
+            helpActivity.setCityId(building.getCityId());
395
+            QueryWrapper<HelpActivity> helpActivityQueryWrapper = new QueryWrapper<>();
396
+            helpActivityQueryWrapper.eq("building_id", building.getBuildingId());
397
+            helpActivityMapper.update(helpActivity, helpActivityQueryWrapper);
398
+
399
+            //更新拼团城市
400
+            TaShareActivity taShareActivity = new TaShareActivity();
401
+            taShareActivity.setCityId(building.getCityId());
402
+            QueryWrapper<TaShareActivity> taShareActivityQueryWrapper = new QueryWrapper<>();
403
+            taShareActivityQueryWrapper.eq("building_id", building.getBuildingId());
404
+            taShareActivityMapper.update(taShareActivity, taShareActivityQueryWrapper);
405
+
406
+            //更新首页轮播、开屏广告、宣传位
407
+            TaExtendContent taExtendContent = new TaExtendContent();
408
+            taExtendContent.setCityId(building.getCityId());
409
+            QueryWrapper<TaExtendContent> taExtendContentQueryWrapper = new QueryWrapper<>();
410
+            taExtendContentQueryWrapper.eq("building_id", building.getBuildingId());
411
+            taExtendContentMapper.update(taExtendContent, taExtendContentQueryWrapper);
358 412
         }
359 413
 
360 414
         // 项目类型