|
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
4
|
import com.huiju.estateagents.base.ResponseBean;
|
5
|
5
|
import com.huiju.estateagents.common.CommConstant;
|
6
|
6
|
import com.huiju.estateagents.third.entity.TaMpInfo;
|
7
|
|
-import com.huiju.estateagents.third.entity.TaThirdPartyMiniappConfig;
|
8
|
7
|
import com.huiju.estateagents.third.service.ITaMpInfoService;
|
9
|
8
|
import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
|
10
|
9
|
import lombok.AllArgsConstructor;
|
|
@@ -44,7 +43,7 @@ public class WxRedpackController {
|
44
|
43
|
* @return
|
45
|
44
|
*/
|
46
|
45
|
@GetMapping("/third/redirect/{mpAppid}/greet")
|
47
|
|
- public ResponseBean greetUser(@PathVariable String mpAppid, @RequestParam String code, @RequestParam String personId,@RequestParam(required = false) String sponsorPersonId,@RequestParam String appid, HttpServletRequest request) {
|
|
46
|
+ public ResponseBean greetUser(@PathVariable String mpAppid, @RequestParam String code, @RequestParam String personId,@RequestParam(required = false) String sponsorPersonId,@RequestParam String drainageId, HttpServletRequest request) {
|
48
|
47
|
WxMpService wxService = getWxMpService();
|
49
|
48
|
if (!wxService.switchover(mpAppid)) {
|
50
|
49
|
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
|
|
@@ -53,16 +52,8 @@ public class WxRedpackController {
|
53
|
52
|
try {
|
54
|
53
|
//换取openid
|
55
|
54
|
WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
|
56
|
|
- //获取H5项目相关信息
|
57
|
|
- QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
|
58
|
|
-
|
59
|
|
- taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
|
60
|
|
- TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
|
61
|
|
- if (null == taThirdPartyMiniappConfig){
|
62
|
|
- return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
|
63
|
|
- }
|
64
|
55
|
//插入公众号人员信息并插入表
|
65
|
|
- map = iTaThirdPartyMiniappConfigService.newMpPerson(accessToken, mpAppid, taThirdPartyMiniappConfig.getTargetId(), sponsorPersonId, personId);
|
|
56
|
+ map = iTaThirdPartyMiniappConfigService.newMpPerson(accessToken, mpAppid, drainageId, sponsorPersonId, personId);
|
66
|
57
|
} catch (WxErrorException e) {
|
67
|
58
|
// e.printStackTrace();
|
68
|
59
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -97,25 +88,17 @@ public class WxRedpackController {
|
97
|
88
|
* @return
|
98
|
89
|
*/
|
99
|
90
|
@GetMapping("/third/activity/{mpAppid}/personInfo")
|
100
|
|
- public ResponseBean getPersonInfo(@PathVariable String mpAppid, @RequestParam String personId,@RequestParam String appid, HttpServletRequest request) {
|
|
91
|
+ public ResponseBean getPersonInfo(@PathVariable String mpAppid, @RequestParam String personId,@RequestParam String drainageId, HttpServletRequest request) {
|
101
|
92
|
WxMpService wxService = getWxMpService();
|
102
|
93
|
if (!wxService.switchover(mpAppid)) {
|
103
|
94
|
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
|
104
|
95
|
}
|
105
|
96
|
Map<String,Object> map = new HashMap<>();
|
106
|
97
|
try {
|
107
|
|
- //获取H5项目相关信息
|
108
|
|
- QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
|
109
|
|
-
|
110
|
|
- taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
|
111
|
|
- TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
|
112
|
|
- if (null == taThirdPartyMiniappConfig){
|
113
|
|
- return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
|
114
|
|
- }
|
115
|
98
|
//插入公众号人员信息并插入表
|
116
|
|
- map = iTaThirdPartyMiniappConfigService.getPersonInfo(mpAppid, taThirdPartyMiniappConfig.getTargetId(), personId);
|
|
99
|
+ map = iTaThirdPartyMiniappConfigService.getPersonInfo(mpAppid, drainageId, personId);
|
117
|
100
|
} catch (Exception e) {
|
118
|
|
-// e.printStackTrace();
|
|
101
|
+ e.printStackTrace();
|
119
|
102
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|
120
|
103
|
}
|
121
|
104
|
return ResponseBean.success(map);
|
|
@@ -129,21 +112,13 @@ public class WxRedpackController {
|
129
|
112
|
* @return
|
130
|
113
|
*/
|
131
|
114
|
@PostMapping("/third/activity/{mpAppid}/participate")
|
132
|
|
- public ResponseBean participateActivity(@PathVariable String mpAppid, @RequestParam String personId,@RequestParam String appid, HttpServletRequest request) {
|
|
115
|
+ public ResponseBean participateActivity(@PathVariable String mpAppid, @RequestParam String personId,@RequestParam String drainageId, HttpServletRequest request) {
|
133
|
116
|
WxMpService wxService = getWxMpService();
|
134
|
117
|
if (!wxService.switchover(mpAppid)) {
|
135
|
118
|
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
|
136
|
119
|
}
|
137
|
|
- //获取H5项目相关信息
|
138
|
|
- QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
|
139
|
|
-
|
140
|
|
- taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
|
141
|
|
- TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
|
142
|
|
- if (null == taThirdPartyMiniappConfig){
|
143
|
|
- return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
|
144
|
|
- }
|
145
|
120
|
try {
|
146
|
|
- ResponseBean res = iTaThirdPartyMiniappConfigService.participateActivity(mpAppid,personId,taThirdPartyMiniappConfig.getTargetId(),taThirdPartyMiniappConfig.getOrgId());
|
|
121
|
+ ResponseBean res = iTaThirdPartyMiniappConfigService.participateActivity(mpAppid,personId,drainageId);
|
147
|
122
|
return res;
|
148
|
123
|
}catch (Exception e){
|
149
|
124
|
e.printStackTrace();
|
|
@@ -159,26 +134,17 @@ public class WxRedpackController {
|
159
|
134
|
* @return
|
160
|
135
|
*/
|
161
|
136
|
@PostMapping("/third/activity/{mpAppid}/help")
|
162
|
|
- public ResponseBean helpActivity(@PathVariable String mpAppid, @RequestParam String personId, @RequestParam String sponsorPersonId,@RequestParam String appid, HttpServletRequest request) {
|
|
137
|
+ public ResponseBean helpActivity(@PathVariable String mpAppid, @RequestParam String personId, @RequestParam String sponsorPersonId,@RequestParam String drainageId, HttpServletRequest request) {
|
163
|
138
|
WxMpService wxService = getWxMpService();
|
164
|
139
|
if (!wxService.switchover(mpAppid)) {
|
165
|
140
|
throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
|
166
|
141
|
}
|
167
|
|
- //获取H5项目相关信息
|
168
|
|
- QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
|
169
|
|
-
|
170
|
|
- taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
|
171
|
|
- TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
|
172
|
|
- if (null == taThirdPartyMiniappConfig){
|
173
|
|
- return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
|
174
|
|
- }
|
175
|
|
-
|
176
|
142
|
if (personId.equals(sponsorPersonId)){
|
177
|
143
|
return ResponseBean.error("自己不能助力自己",ResponseBean.ERROR_UNAVAILABLE);
|
178
|
144
|
}
|
179
|
145
|
|
180
|
146
|
try {
|
181
|
|
- ResponseBean res = iTaThirdPartyMiniappConfigService.helpActivity(mpAppid, personId, sponsorPersonId, taThirdPartyMiniappConfig.getTargetId(),taThirdPartyMiniappConfig.getOrgId());
|
|
147
|
+ ResponseBean res = iTaThirdPartyMiniappConfigService.helpActivity(mpAppid, personId, sponsorPersonId, drainageId);
|
182
|
148
|
return res;
|
183
|
149
|
}catch (Exception e){
|
184
|
150
|
e.printStackTrace();
|
|
@@ -188,23 +154,15 @@ public class WxRedpackController {
|
188
|
154
|
|
189
|
155
|
/**
|
190
|
156
|
* 获取此活动的排行榜
|
191
|
|
- * @param appid
|
|
157
|
+ * @param drainageId
|
192
|
158
|
* @param request
|
193
|
159
|
* @return
|
194
|
160
|
*/
|
195
|
161
|
@GetMapping("/third/activity/ranking")
|
196
|
|
- public ResponseBean getRanking(@RequestParam String appid, HttpServletRequest request) {
|
|
162
|
+ public ResponseBean getRanking(@RequestParam String drainageId, HttpServletRequest request) {
|
197
|
163
|
try {
|
198
|
|
- //获取H5项目相关信息
|
199
|
|
- QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
|
200
|
|
-
|
201
|
|
- taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
|
202
|
|
- TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
|
203
|
|
- if (null == taThirdPartyMiniappConfig){
|
204
|
|
- return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
|
205
|
|
- }
|
206
|
164
|
//获取活动的排行榜
|
207
|
|
- return iTaThirdPartyMiniappConfigService.getRanking(taThirdPartyMiniappConfig.getTargetId(),taThirdPartyMiniappConfig.getOrgId());
|
|
165
|
+ return iTaThirdPartyMiniappConfigService.getRanking(drainageId);
|
208
|
166
|
} catch (Exception e) {
|
209
|
167
|
// e.printStackTrace();
|
210
|
168
|
return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
|