|
@@ -3,19 +3,19 @@ package com.huiju.estateagents.controller;
|
3
|
3
|
|
4
|
4
|
import com.alibaba.fastjson.JSONObject;
|
5
|
5
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
6
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
6
|
7
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
7
|
8
|
import com.huiju.estateagents.base.BaseController;
|
8
|
9
|
import com.huiju.estateagents.base.ResponseBean;
|
|
10
|
+import com.huiju.estateagents.common.CommConstant;
|
9
|
11
|
import com.huiju.estateagents.common.JWTUtils;
|
10
|
12
|
import com.huiju.estateagents.common.StringUtils;
|
11
|
|
-import com.huiju.estateagents.entity.TaActivityDynamicEnlist;
|
12
|
|
-import com.huiju.estateagents.entity.TaBuilding;
|
13
|
|
-import com.huiju.estateagents.entity.TaBuildingDynamic;
|
14
|
|
-import com.huiju.estateagents.entity.TaPerson;
|
|
13
|
+import com.huiju.estateagents.entity.*;
|
15
|
14
|
import com.huiju.estateagents.mapper.TaActivityDynamicEnlistMapper;
|
16
|
15
|
import com.huiju.estateagents.mapper.TaBuildingMapper;
|
17
|
16
|
import com.huiju.estateagents.service.ITaBuildingDynamicService;
|
18
|
17
|
import com.huiju.estateagents.service.ITaPersonService;
|
|
18
|
+import com.huiju.estateagents.service.ITaSaveService;
|
19
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
20
|
20
|
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
21
|
21
|
import org.springframework.web.bind.ServletRequestDataBinder;
|
|
@@ -27,6 +27,7 @@ import javax.swing.*;
|
27
|
27
|
import java.text.DateFormat;
|
28
|
28
|
import java.text.SimpleDateFormat;
|
29
|
29
|
import java.time.LocalDateTime;
|
|
30
|
+import java.util.ArrayList;
|
30
|
31
|
import java.util.Date;
|
31
|
32
|
import java.util.HashMap;
|
32
|
33
|
import java.util.List;
|
|
@@ -52,6 +53,9 @@ public class TaBuildingDynamicController extends BaseController {
|
52
|
53
|
@Autowired
|
53
|
54
|
private ITaPersonService taPersonService;
|
54
|
55
|
|
|
56
|
+ @Autowired
|
|
57
|
+ private ITaSaveService taSaveService;
|
|
58
|
+
|
55
|
59
|
@InitBinder
|
56
|
60
|
protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
|
57
|
61
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
@@ -97,7 +101,7 @@ public class TaBuildingDynamicController extends BaseController {
|
97
|
101
|
return responseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
98
|
102
|
}
|
99
|
103
|
TaPerson person = taPersons.get(0);
|
100
|
|
- responseBean.addSuccess(taPersonService.getJoinedActivity(pageNum,pageSize,person.getPhone(),""));
|
|
104
|
+ responseBean.addSuccess(iBuildingDynamicService.getJoinedActivity(pageNum,pageSize,"",person));
|
101
|
105
|
}else {
|
102
|
106
|
responseBean = iBuildingDynamicService.getWxBuildingDynamiceList(pageNum,pageSize,buildingId,openid);
|
103
|
107
|
}
|
|
@@ -105,6 +109,50 @@ public class TaBuildingDynamicController extends BaseController {
|
105
|
109
|
return responseBean;
|
106
|
110
|
}
|
107
|
111
|
|
|
112
|
+ /**
|
|
113
|
+ * 活动列表
|
|
114
|
+ * @param pageNum
|
|
115
|
+ * @param pageSize
|
|
116
|
+ * @param request
|
|
117
|
+ * @return
|
|
118
|
+ */
|
|
119
|
+ @RequestMapping(value = "/wx/save/buildingDynamiceList", method = RequestMethod.GET)
|
|
120
|
+ public ResponseBean wxSaveBuildingDynamiceList(@RequestParam(value = "buildingId", required = false)String buildingId,
|
|
121
|
+ @RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum,
|
|
122
|
+ @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
|
|
123
|
+ HttpServletRequest request){
|
|
124
|
+ String openid = JWTUtils.getSubject(request);
|
|
125
|
+ ResponseBean responseBean = new ResponseBean();
|
|
126
|
+ List<TaPerson> taPersons = taPersonService.getPersonsByOpenId(openid);
|
|
127
|
+ if (null == taPersons || taPersons.size() != 1) {
|
|
128
|
+ return responseBean.error("验证人员信息失败", ResponseBean.ERROR_UNAVAILABLE);
|
|
129
|
+ }
|
|
130
|
+ TaPerson person = taPersons.get(0);
|
|
131
|
+ QueryWrapper<TaSave> saveQueryWrapper = new QueryWrapper<>();
|
|
132
|
+ saveQueryWrapper.eq("person_id",person.getPersonId());
|
|
133
|
+ saveQueryWrapper.eq("tagert_type", CommConstant.FAVOR_ACTIVITY);
|
|
134
|
+ List<TaSave> saveList = taSaveService.list(saveQueryWrapper);
|
|
135
|
+ if(saveList.size()>0){
|
|
136
|
+ List<String> ids = new ArrayList<>();
|
|
137
|
+ for(int i = 0; i<saveList.size();i++){
|
|
138
|
+ ids.add(saveList.get(i).getSavedTarget());
|
|
139
|
+ }
|
|
140
|
+ IPage<TaBuildingDynamic> page = new Page<>(pageNum, pageSize);
|
|
141
|
+ QueryWrapper<TaBuildingDynamic> buildingDynamicQueryWrapper = new QueryWrapper<>();
|
|
142
|
+ buildingDynamicQueryWrapper.in("dynamic_id",ids);
|
|
143
|
+ IPage<TaBuildingDynamic> buildingDynamicIPage = iBuildingDynamicService.page(page,buildingDynamicQueryWrapper);
|
|
144
|
+ for(int j=0;j<buildingDynamicIPage.getRecords().size();j++){
|
|
145
|
+ iBuildingDynamicService.setExtendInfo(buildingDynamicIPage.getRecords().get(j),person);
|
|
146
|
+ }
|
|
147
|
+ responseBean.addSuccess(buildingDynamicIPage);
|
|
148
|
+ }else {
|
|
149
|
+ responseBean.addSuccess("暂无收藏活动");
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+ return responseBean;
|
|
154
|
+ }
|
|
155
|
+
|
108
|
156
|
/**
|
109
|
157
|
* 活动详情
|
110
|
158
|
* @param dynamicId
|