ソースを参照

Merge remote-tracking branch 'origin/dev' into dev

顾绍勇 5 年 前
コミット
1e76d056f8

+ 3
- 3
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgOrderServiceImpl.java ファイルの表示

466
         taOrgAccountDetailedListMapper.insert(taOrgAccountDetailedList);
466
         taOrgAccountDetailedListMapper.insert(taOrgAccountDetailedList);
467
 
467
 
468
         //更新账户退款申请
468
         //更新账户退款申请
469
-        TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REJECT, refundApplication);
469
+        TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REFUND, refundApplication);
470
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
470
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
471
-        taOrgRefundApplicationQueryWrapper.eq("org_id", refundApplication.getOrgId());
471
+        taOrgRefundApplicationQueryWrapper.eq("order_id", id);
472
         taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
472
         taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
473
 
473
 
474
         //更新账户冻结记录
474
         //更新账户冻结记录
508
         //更新退款申请记录
508
         //更新退款申请记录
509
         TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REJECT, refundApplication);
509
         TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REJECT, refundApplication);
510
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
510
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
511
-        taOrgRefundApplicationQueryWrapper.eq("org_id", refundApplication.getOrgId());
511
+        taOrgRefundApplicationQueryWrapper.eq("order_id", id);
512
         int taOrgRefundApplicationUpdateResult = taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
512
         int taOrgRefundApplicationUpdateResult = taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
513
 
513
 
514
         //更新订单状态
514
         //更新订单状态

+ 8
- 8
src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java ファイルの表示

177
                                     @RequestParam (required = false) String consultant,
177
                                     @RequestParam (required = false) String consultant,
178
                                     HttpServletRequest request) {
178
                                     HttpServletRequest request) {
179
         //获取H5项目相关信息
179
         //获取H5项目相关信息
180
-        String xAppid = request.getHeader("x-appid");
181
-        QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
182
-
183
-        taThirdPartyMiniappConfigQueryWrapper.eq("appid", xAppid);
184
-        TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
185
-        if (null == taThirdPartyMiniappConfig){
186
-            return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
187
-        }
180
+//        String xAppid = request.getHeader("x-appid");
181
+//        QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
182
+//
183
+//        taThirdPartyMiniappConfigQueryWrapper.eq("appid", xAppid);
184
+//        TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
185
+//        if (null == taThirdPartyMiniappConfig){
186
+//            return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
187
+//        }
188
         String appid = request.getHeader("appid");
188
         String appid = request.getHeader("appid");
189
 
189
 
190
         ResponseBean res = miniAppService.getQrCode(paramsStr, appid);
190
         ResponseBean res = miniAppService.getQrCode(paramsStr, appid);

+ 12
- 54
src/main/java/com/huiju/estateagents/third/controller/WxRedpackController.java ファイルの表示

4
 import com.huiju.estateagents.base.ResponseBean;
4
 import com.huiju.estateagents.base.ResponseBean;
5
 import com.huiju.estateagents.common.CommConstant;
5
 import com.huiju.estateagents.common.CommConstant;
6
 import com.huiju.estateagents.third.entity.TaMpInfo;
6
 import com.huiju.estateagents.third.entity.TaMpInfo;
7
-import com.huiju.estateagents.third.entity.TaThirdPartyMiniappConfig;
8
 import com.huiju.estateagents.third.service.ITaMpInfoService;
7
 import com.huiju.estateagents.third.service.ITaMpInfoService;
9
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
8
 import com.huiju.estateagents.third.service.ITaThirdPartyMiniappConfigService;
10
 import lombok.AllArgsConstructor;
9
 import lombok.AllArgsConstructor;
44
      * @return
43
      * @return
45
      */
44
      */
46
     @GetMapping("/third/redirect/{mpAppid}/greet")
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
         WxMpService wxService = getWxMpService();
47
         WxMpService wxService = getWxMpService();
49
         if (!wxService.switchover(mpAppid)) {
48
         if (!wxService.switchover(mpAppid)) {
50
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
49
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
53
         try {
52
         try {
54
             //换取openid
53
             //换取openid
55
             WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
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
         } catch (WxErrorException e) {
57
         } catch (WxErrorException e) {
67
 //            e.printStackTrace();
58
 //            e.printStackTrace();
68
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
59
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
97
      * @return
88
      * @return
98
      */
89
      */
99
     @GetMapping("/third/activity/{mpAppid}/personInfo")
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
         WxMpService wxService = getWxMpService();
92
         WxMpService wxService = getWxMpService();
102
         if (!wxService.switchover(mpAppid)) {
93
         if (!wxService.switchover(mpAppid)) {
103
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
94
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
104
         }
95
         }
105
         Map<String,Object> map = new HashMap<>();
96
         Map<String,Object> map = new HashMap<>();
106
         try {
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
         } catch (Exception e) {
100
         } catch (Exception e) {
118
-//            e.printStackTrace();
101
+            e.printStackTrace();
119
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
102
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
120
         }
103
         }
121
         return ResponseBean.success(map);
104
         return ResponseBean.success(map);
129
      * @return
112
      * @return
130
      */
113
      */
131
     @PostMapping("/third/activity/{mpAppid}/participate")
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
         WxMpService wxService = getWxMpService();
116
         WxMpService wxService = getWxMpService();
134
         if (!wxService.switchover(mpAppid)) {
117
         if (!wxService.switchover(mpAppid)) {
135
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
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
         try {
120
         try {
146
-            ResponseBean res = iTaThirdPartyMiniappConfigService.participateActivity(mpAppid,personId,taThirdPartyMiniappConfig.getTargetId(),taThirdPartyMiniappConfig.getOrgId());
121
+            ResponseBean res = iTaThirdPartyMiniappConfigService.participateActivity(mpAppid,personId,drainageId);
147
             return res;
122
             return res;
148
         }catch (Exception e){
123
         }catch (Exception e){
149
             e.printStackTrace();
124
             e.printStackTrace();
159
      * @return
134
      * @return
160
      */
135
      */
161
     @PostMapping("/third/activity/{mpAppid}/help")
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
         WxMpService wxService = getWxMpService();
138
         WxMpService wxService = getWxMpService();
164
         if (!wxService.switchover(mpAppid)) {
139
         if (!wxService.switchover(mpAppid)) {
165
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
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
         if (personId.equals(sponsorPersonId)){
142
         if (personId.equals(sponsorPersonId)){
177
             return ResponseBean.error("自己不能助力自己",ResponseBean.ERROR_UNAVAILABLE);
143
             return ResponseBean.error("自己不能助力自己",ResponseBean.ERROR_UNAVAILABLE);
178
         }
144
         }
179
 
145
 
180
         try {
146
         try {
181
-            ResponseBean res = iTaThirdPartyMiniappConfigService.helpActivity(mpAppid, personId, sponsorPersonId, taThirdPartyMiniappConfig.getTargetId(),taThirdPartyMiniappConfig.getOrgId());
147
+            ResponseBean res = iTaThirdPartyMiniappConfigService.helpActivity(mpAppid, personId, sponsorPersonId, drainageId);
182
             return res;
148
             return res;
183
         }catch (Exception e){
149
         }catch (Exception e){
184
             e.printStackTrace();
150
             e.printStackTrace();
188
 
154
 
189
     /**
155
     /**
190
      * 获取此活动的排行榜
156
      * 获取此活动的排行榜
191
-     * @param appid
157
+     * @param drainageId
192
      * @param request
158
      * @param request
193
      * @return
159
      * @return
194
      */
160
      */
195
     @GetMapping("/third/activity/ranking")
161
     @GetMapping("/third/activity/ranking")
196
-    public ResponseBean getRanking(@RequestParam String appid, HttpServletRequest request) {
162
+    public ResponseBean getRanking(@RequestParam String drainageId, HttpServletRequest request) {
197
         try {
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
         } catch (Exception e) {
166
         } catch (Exception e) {
209
 //            e.printStackTrace();
167
 //            e.printStackTrace();
210
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);
168
             return ResponseBean.error(e.getMessage(),ResponseBean.ERROR_UNAVAILABLE);

+ 6
- 9
src/main/java/com/huiju/estateagents/third/service/ITaThirdPartyMiniappConfigService.java ファイルの表示

39
 	 * 参加活动生成参与记录等
39
 	 * 参加活动生成参与记录等
40
 	 * @param mpAppid
40
 	 * @param mpAppid
41
 	 * @param personId
41
 	 * @param personId
42
-	 * @param targetId
43
-	 * @param orgId
42
+	 * @param drainageId
44
 	 */
43
 	 */
45
-	ResponseBean participateActivity(String mpAppid, String personId, String targetId, Integer orgId);
44
+	ResponseBean participateActivity(String mpAppid, String personId, String drainageId);
46
 
45
 
47
 	/**
46
 	/**
48
 	 * 助力活动接口
47
 	 * 助力活动接口
49
 	 * @param mpAppid
48
 	 * @param mpAppid
50
 	 * @param mpPersonId
49
 	 * @param mpPersonId
51
 	 * @param sponsorPersonId
50
 	 * @param sponsorPersonId
52
-	 * @param targetId
53
-	 * @param orgId
51
+	 * @param drainageId
54
 	 * @return
52
 	 * @return
55
 	 */
53
 	 */
56
-	ResponseBean helpActivity(String mpAppid, String mpPersonId, String sponsorPersonId, String targetId, Integer orgId);
54
+	ResponseBean helpActivity(String mpAppid, String mpPersonId, String sponsorPersonId, String drainageId);
57
 
55
 
58
 	/**
56
 	/**
59
 	 * 获取活动排行榜
57
 	 * 获取活动排行榜
60
-	 * @param targetId
61
-	 * @param orgId
58
+	 * @param drainageId
62
 	 * @return
59
 	 * @return
63
 	 */
60
 	 */
64
-    ResponseBean getRanking(String targetId, Integer orgId);
61
+    ResponseBean getRanking(String drainageId);
65
 
62
 
66
 	/**
63
 	/**
67
 	 * 根据personiD获取相关信息
64
 	 * 根据personiD获取相关信息

+ 34
- 21
src/main/java/com/huiju/estateagents/third/service/impl/TaThirdPartyMiniappConfigServiceImpl.java ファイルの表示

219
 	 * @param mpAppid 公众号appid
219
 	 * @param mpAppid 公众号appid
220
 	 * @param personId 小程序人员id
220
 	 * @param personId 小程序人员id
221
 	 * @param drainageId H5活动id
221
 	 * @param drainageId H5活动id
222
-	 * @param orgId 小程序id
223
 	 */
222
 	 */
224
 	@Override
223
 	@Override
225
-	public ResponseBean participateActivity(String mpAppid, String personId, String drainageId, Integer orgId) {
224
+	public ResponseBean participateActivity(String mpAppid, String personId, String drainageId) {
226
 		//第一步根据drainggeid查询出红包表对应的记录
225
 		//第一步根据drainggeid查询出红包表对应的记录
227
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
226
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
228
 		//第二步查询出这个H5对应的活动
227
 		//第二步查询出这个H5对应的活动
236
 		}
235
 		}
237
 
236
 
238
 		//参与活动
237
 		//参与活动
239
-		TaRedPacketPerson taRedPacketPerson = saveRedPacketPerson(personId,taRedPacket,orgId);
238
+		TaRedPacketPerson taRedPacketPerson = saveRedPacketPerson(personId,taRedPacket,taDrainage.getOrgId());
240
 
239
 
241
 		return ResponseBean.success(taRedPacketPerson);
240
 		return ResponseBean.success(taRedPacketPerson);
242
 	}
241
 	}
281
 	 * @param personId 小程序personId
280
 	 * @param personId 小程序personId
282
 	 * @param sponsorPersonId 公众号发起人id
281
 	 * @param sponsorPersonId 公众号发起人id
283
 	 * @param drainageId H5活动id
282
 	 * @param drainageId H5活动id
284
-	 * @param orgId 小程序id
285
 	 * @return
283
 	 * @return
286
 	 */
284
 	 */
287
 	@Override
285
 	@Override
288
-	public ResponseBean helpActivity(String mpAppid, String personId, String sponsorPersonId, String drainageId, Integer orgId) {
286
+	public ResponseBean helpActivity(String mpAppid, String personId, String sponsorPersonId, String drainageId) {
289
 		//第一步根据drainggeid查询出红包表对应的记录
287
 		//第一步根据drainggeid查询出红包表对应的记录
290
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
288
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
291
 		//第二步查询出这个H5对应的活动
289
 		//第二步查询出这个H5对应的活动
308
 		TaRedPacketHelp taRedPacketHelp = taRedPacketHelpMapper.selectById(taDrainage.getActivityId());
306
 		TaRedPacketHelp taRedPacketHelp = taRedPacketHelpMapper.selectById(taDrainage.getActivityId());
309
 		
307
 		
310
 		//助力
308
 		//助力
311
-		String result = saveRedPacketHistory(taMpMiniapp, parentMpMiniapp, taRedPacketHelp, orgId,mpAppid);
312
-		if (!result.equals("success")){
309
+		String result = saveRedPacketHistory(taMpMiniapp, parentMpMiniapp, taRedPacketHelp, taDrainage.getOrgId(),mpAppid);
310
+		if (!"success".equals(result)){
313
 			return ResponseBean.error(result,ResponseBean.ERROR_ILLEGAL_PARAMS);
311
 			return ResponseBean.error(result,ResponseBean.ERROR_ILLEGAL_PARAMS);
314
 		}
312
 		}
315
 
313
 
320
 	 * 获取活动排行榜
318
 	 * 获取活动排行榜
321
 	 *
319
 	 *
322
 	 * @param drainageId
320
 	 * @param drainageId
323
-	 * @param orgId
324
 	 * @return
321
 	 * @return
325
 	 */
322
 	 */
326
 	@Override
323
 	@Override
327
-	public ResponseBean getRanking(String drainageId, Integer orgId) {
324
+	public ResponseBean getRanking(String drainageId) {
328
 		//第一步根据drainggeid查询出红包表对应的记录
325
 		//第一步根据drainggeid查询出红包表对应的记录
329
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
326
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
330
 		//第二步查询出这个H5对应的活动
327
 		//第二步查询出这个H5对应的活动
331
-		List<TaRedPacketHistory> taRedPacketHistoryList = taRedPacketHistoryMapper.getRanking(taDrainage.getActivityId(),orgId);
328
+		List<TaRedPacketHistory> taRedPacketHistoryList = taRedPacketHistoryMapper.getRanking(taDrainage.getActivityId(),taDrainage.getOrgId());
332
 		return ResponseBean.success(taRedPacketHistoryList);
329
 		return ResponseBean.success(taRedPacketHistoryList);
333
 	}
330
 	}
334
 
331
 
412
 		parentRedPacketHistory.eq("target_miniapp_person",parentMpMiniapp.getMiniappPersonId());
409
 		parentRedPacketHistory.eq("target_miniapp_person",parentMpMiniapp.getMiniappPersonId());
413
 		List<TaRedPacketHistory> parentRedPacketHistories = taRedPacketHistoryMapper.selectList(parentRedPacketHistory);
410
 		List<TaRedPacketHistory> parentRedPacketHistories = taRedPacketHistoryMapper.selectList(parentRedPacketHistory);
414
 
411
 
415
-		//查看是否助力成功
416
-		if (parentRedPacketHistories.size() + 1 > taRedPacketHelp.getHelpSuccesPersons()){
417
-			return "助力已完成,无需助力。";
418
-		}
419
-
420
 		//助力
412
 		//助力
421
 		TaRedPacketHistory taRedPacketHistory = new TaRedPacketHistory();
413
 		TaRedPacketHistory taRedPacketHistory = new TaRedPacketHistory();
422
 		taRedPacketHistory.setActivityId(taRedPacketHelp.getActivityId());
414
 		taRedPacketHistory.setActivityId(taRedPacketHelp.getActivityId());
427
 		taRedPacketHistory.setTargetMiniappPerson(parentMpMiniapp.getMiniappPersonId());
419
 		taRedPacketHistory.setTargetMiniappPerson(parentMpMiniapp.getMiniappPersonId());
428
 		taRedPacketHistory.setTargetMpPerson(parentMpMiniapp.getMpPersonId());
420
 		taRedPacketHistory.setTargetMpPerson(parentMpMiniapp.getMpPersonId());
429
 		taRedPacketHistoryMapper.insert(taRedPacketHistory);
421
 		taRedPacketHistoryMapper.insert(taRedPacketHistory);
430
-		//发送红包
431
-		sendRedPackage(taMpMiniapp, parentMpMiniapp, taRedPacketHelp, orgId,mpAppid);
422
+
423
+		//更新此人获得的票数
424
+		QueryWrapper<TaRedPacketPerson> taRedPacketPersonQueryWrapper = new QueryWrapper<>();
425
+		taRedPacketPersonQueryWrapper.eq("activity_id",taRedPacketHelp.getActivityId());
426
+		taRedPacketPersonQueryWrapper.eq("org_id",orgId);
427
+		taRedPacketPersonQueryWrapper.eq("mp_person_id",parentMpMiniapp.getMpPersonId());
428
+		taRedPacketPersonQueryWrapper.eq("miniapp_person_id",parentMpMiniapp.getMiniappPersonId());
429
+		TaRedPacketPerson redPacketPerson = taRedPacketPersonMapper.selectOne(taRedPacketPersonQueryWrapper);
430
+		if (null != redPacketPerson){
431
+			redPacketPerson.setVotes(redPacketPerson.getVotes() +1);
432
+			taRedPacketPersonMapper.updateById(redPacketPerson);
433
+		}
434
+
435
+		//查看是否助力成功发送红包
436
+		if (parentRedPacketHistories.size() + 1 == taRedPacketHelp.getHelpSuccesPersons()){
437
+			//发送红包
438
+			sendRedPackage(taMpMiniapp, parentMpMiniapp, taRedPacketHelp, orgId,mpAppid,redPacketPerson);
439
+		}
440
+
432
 		return "success";
441
 		return "success";
433
 	}
442
 	}
434
 
443
 
440
 	 * @param orgId
449
 	 * @param orgId
441
 	 * @param mpAppid
450
 	 * @param mpAppid
442
 	 */
451
 	 */
443
-	private synchronized void sendRedPackage(TaMpMiniapp taMpMiniapp, TaMpMiniapp parentMpMiniapp, TaRedPacketHelp taRedPacketHelp, Integer orgId, String mpAppid) {
452
+	private synchronized void sendRedPackage(TaMpMiniapp taMpMiniapp, TaMpMiniapp parentMpMiniapp, TaRedPacketHelp taRedPacketHelp, Integer orgId, String mpAppid,TaRedPacketPerson redPacketPerson) {
444
 		//红包金额设置相关信息
453
 		//红包金额设置相关信息
445
 		TaRedPacketMoney taRedPacketMoney = taRedPacketmonetMapper.selectById(taRedPacketHelp.getActivityId());
454
 		TaRedPacketMoney taRedPacketMoney = taRedPacketmonetMapper.selectById(taRedPacketHelp.getActivityId());
446
 		//总账户金额
455
 		//总账户金额
477
 				.remark(taRedPacketClient.getRemark())//备注
486
 				.remark(taRedPacketClient.getRemark())//备注
478
 				.reOpenid(parentMpPerson.getMpOpenid())//接受红包的用户openid
487
 				.reOpenid(parentMpPerson.getMpOpenid())//接受红包的用户openid
479
 
488
 
480
-				.sceneId("PRODUCT_2")//场景id
489
+				.sceneId("PRODUCT_1")//场景id
481
 				.sendName(taRedPacketClient.getMchName())//红包发送者名称
490
 				.sendName(taRedPacketClient.getMchName())//红包发送者名称
482
 				.totalAmount(redPackageMoney)//付款金额,单位分
491
 				.totalAmount(redPackageMoney)//付款金额,单位分
483
 				.totalNum(1)//红包发放总人数
492
 				.totalNum(1)//红包发放总人数
489
 			String resultCode = wxPaySendRedpackResult.getResultCode();
498
 			String resultCode = wxPaySendRedpackResult.getResultCode();
490
 			if (resultCode.equals("SUCCESS")){
499
 			if (resultCode.equals("SUCCESS")){
491
 				//插入订单表并扣钱反更新
500
 				//插入订单表并扣钱反更新
492
-				saveRedpacketOrder(tradeNo,wxPaySendRedpackResult,parentMpMiniapp,taRedPacketHelp,orgId,mpAppid);
501
+				saveRedpacketOrder(tradeNo,wxPaySendRedpackResult,parentMpMiniapp,taRedPacketHelp,orgId,mpAppid,redPacketPerson);
493
 			}else {
502
 			}else {
494
 				return;
503
 				return;
495
 			}
504
 			}
498
 		}
507
 		}
499
 	}
508
 	}
500
 
509
 
501
-	private synchronized void saveRedpacketOrder(String tradeNo, WxPaySendRedpackResult wxPaySendRedpackResult, TaMpMiniapp parentMpMiniapp, TaRedPacketHelp taRedPacketHelp, Integer orgId, String mpAppid) {
510
+	private synchronized void saveRedpacketOrder(String tradeNo, WxPaySendRedpackResult wxPaySendRedpackResult, TaMpMiniapp parentMpMiniapp, TaRedPacketHelp taRedPacketHelp, Integer orgId, String mpAppid,TaRedPacketPerson redPacketPerson) {
511
+		redPacketPerson.setPacketAmount(wxPaySendRedpackResult.getTotalAmount());
512
+		redPacketPerson.setPacketStatus(1);
513
+		redPacketPerson.setIsSuccess(true);
514
+		taRedPacketPersonMapper.updateById(redPacketPerson);
502
 		//先扣钱
515
 		//先扣钱
503
 		TaOrgAccount taOrgAccount = taOrgAccountMapper.selectOne(new QueryWrapper<TaOrgAccount>().eq("org_id", orgId).eq("status", CommConstant.STATUS_NORMAL));
516
 		TaOrgAccount taOrgAccount = taOrgAccountMapper.selectOne(new QueryWrapper<TaOrgAccount>().eq("org_id", orgId).eq("status", CommConstant.STATUS_NORMAL));
504
 		taOrgAccount.setRealBalance(taOrgAccount.getRealBalance() - wxPaySendRedpackResult.getTotalAmount());
517
 		taOrgAccount.setRealBalance(taOrgAccount.getRealBalance() - wxPaySendRedpackResult.getTotalAmount());

+ 5
- 6
src/main/resources/mapper/redpack/TaOrgOrderMapper.xml ファイルの表示

12
         b.name as miniAppName,
12
         b.name as miniAppName,
13
         t.is_offline,
13
         t.is_offline,
14
         t.create_date,
14
         t.create_date,
15
-        t.trading_status,
16
-        <if test="orderType == 'recharge' || orderType == 'refund'">
15
+        <if test="orderType == 'refund'">
17
             d.audit_status,
16
             d.audit_status,
18
             d.audit_result,
17
             d.audit_result,
19
         </if>
18
         </if>
20
-        GROUP_CONCAT(c.url) as certificateUrl
19
+        t.trading_status
21
         From ta_org_order t
20
         From ta_org_order t
22
         left join ta_org_order_detail a on t.order_id = a.order_id
21
         left join ta_org_order_detail a on t.order_id = a.order_id
23
         left join ta_miniapp b on t.org_id = b.org_id
22
         left join ta_miniapp b on t.org_id = b.org_id
24
         left join ta_org_account_certificate c on t.order_id = c.order_id
23
         left join ta_org_account_certificate c on t.order_id = c.order_id
25
         left join ta_org_account e on t.org_id = e.org_id
24
         left join ta_org_account e on t.org_id = e.org_id
26
-        <if test="orderType == 'recharge' || orderType == 'refund'">
27
-            left join ta_org_refund_application d on d.org_id = t.org_id
25
+        <if test="orderType == 'refund'">
26
+            left join ta_org_refund_application d on d.org_id = t.org_id and t.order_id = d.order_id
28
         </if>
27
         </if>
29
         where
28
         where
30
         a.item_type = #{orderType}
29
         a.item_type = #{orderType}
49
         <if test="miniAppName != null and miniAppName != ''">
48
         <if test="miniAppName != null and miniAppName != ''">
50
             and b.name like concat('%', #{miniAppName}, '%')
49
             and b.name like concat('%', #{miniAppName}, '%')
51
         </if>
50
         </if>
52
-        GROUP BY t.order_id
51
+        group by t.order_id
53
     </select>
52
     </select>
54
 
53
 
55
     <select id="orderListByConsume" resultType="com.huiju.estateagents.redpack.entity.TaOrgOrder">
54
     <select id="orderListByConsume" resultType="com.huiju.estateagents.redpack.entity.TaOrgOrder">