Browse Source

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

顾绍勇 5 years ago
parent
commit
1e76d056f8

+ 3
- 3
src/main/java/com/huiju/estateagents/redpack/service/impl/TaOrgOrderServiceImpl.java View File

@@ -466,9 +466,9 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
466 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 470
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
471
-        taOrgRefundApplicationQueryWrapper.eq("org_id", refundApplication.getOrgId());
471
+        taOrgRefundApplicationQueryWrapper.eq("order_id", id);
472 472
         taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
473 473
 
474 474
         //更新账户冻结记录
@@ -508,7 +508,7 @@ public class TaOrgOrderServiceImpl extends ServiceImpl<TaOrgOrderMapper, TaOrgOr
508 508
         //更新退款申请记录
509 509
         TaOrgRefundApplication updateRefundApplication = assembleRefundApplication(userId, CommConstant.ITEM_TYPE_REJECT, refundApplication);
510 510
         QueryWrapper<TaOrgRefundApplication> taOrgRefundApplicationQueryWrapper = new QueryWrapper<>();
511
-        taOrgRefundApplicationQueryWrapper.eq("org_id", refundApplication.getOrgId());
511
+        taOrgRefundApplicationQueryWrapper.eq("order_id", id);
512 512
         int taOrgRefundApplicationUpdateResult = taOrgRefundApplicationMapper.update(updateRefundApplication, taOrgRefundApplicationQueryWrapper);
513 513
 
514 514
         //更新订单状态

+ 8
- 8
src/main/java/com/huiju/estateagents/third/controller/TaThirdPartyMiniappConfigController.java View File

@@ -177,14 +177,14 @@ public class TaThirdPartyMiniappConfigController extends BaseController {
177 177
                                     @RequestParam (required = false) String consultant,
178 178
                                     HttpServletRequest request) {
179 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 188
         String appid = request.getHeader("appid");
189 189
 
190 190
         ResponseBean res = miniAppService.getQrCode(paramsStr, appid);

+ 12
- 54
src/main/java/com/huiju/estateagents/third/controller/WxRedpackController.java View File

@@ -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);

+ 6
- 9
src/main/java/com/huiju/estateagents/third/service/ITaThirdPartyMiniappConfigService.java View File

@@ -39,29 +39,26 @@ public interface ITaThirdPartyMiniappConfigService extends IService<TaThirdParty
39 39
 	 * 参加活动生成参与记录等
40 40
 	 * @param mpAppid
41 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 48
 	 * @param mpAppid
50 49
 	 * @param mpPersonId
51 50
 	 * @param sponsorPersonId
52
-	 * @param targetId
53
-	 * @param orgId
51
+	 * @param drainageId
54 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 59
 	 * @return
63 60
 	 */
64
-    ResponseBean getRanking(String targetId, Integer orgId);
61
+    ResponseBean getRanking(String drainageId);
65 62
 
66 63
 	/**
67 64
 	 * 根据personiD获取相关信息

+ 34
- 21
src/main/java/com/huiju/estateagents/third/service/impl/TaThirdPartyMiniappConfigServiceImpl.java View File

@@ -219,10 +219,9 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
219 219
 	 * @param mpAppid 公众号appid
220 220
 	 * @param personId 小程序人员id
221 221
 	 * @param drainageId H5活动id
222
-	 * @param orgId 小程序id
223 222
 	 */
224 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 225
 		//第一步根据drainggeid查询出红包表对应的记录
227 226
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
228 227
 		//第二步查询出这个H5对应的活动
@@ -236,7 +235,7 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
236 235
 		}
237 236
 
238 237
 		//参与活动
239
-		TaRedPacketPerson taRedPacketPerson = saveRedPacketPerson(personId,taRedPacket,orgId);
238
+		TaRedPacketPerson taRedPacketPerson = saveRedPacketPerson(personId,taRedPacket,taDrainage.getOrgId());
240 239
 
241 240
 		return ResponseBean.success(taRedPacketPerson);
242 241
 	}
@@ -281,11 +280,10 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
281 280
 	 * @param personId 小程序personId
282 281
 	 * @param sponsorPersonId 公众号发起人id
283 282
 	 * @param drainageId H5活动id
284
-	 * @param orgId 小程序id
285 283
 	 * @return
286 284
 	 */
287 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 287
 		//第一步根据drainggeid查询出红包表对应的记录
290 288
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
291 289
 		//第二步查询出这个H5对应的活动
@@ -308,8 +306,8 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
308 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 311
 			return ResponseBean.error(result,ResponseBean.ERROR_ILLEGAL_PARAMS);
314 312
 		}
315 313
 
@@ -320,15 +318,14 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
320 318
 	 * 获取活动排行榜
321 319
 	 *
322 320
 	 * @param drainageId
323
-	 * @param orgId
324 321
 	 * @return
325 322
 	 */
326 323
 	@Override
327
-	public ResponseBean getRanking(String drainageId, Integer orgId) {
324
+	public ResponseBean getRanking(String drainageId) {
328 325
 		//第一步根据drainggeid查询出红包表对应的记录
329 326
 		TaDrainage taDrainage = taDrainageMapper.selectById(drainageId);
330 327
 		//第二步查询出这个H5对应的活动
331
-		List<TaRedPacketHistory> taRedPacketHistoryList = taRedPacketHistoryMapper.getRanking(taDrainage.getActivityId(),orgId);
328
+		List<TaRedPacketHistory> taRedPacketHistoryList = taRedPacketHistoryMapper.getRanking(taDrainage.getActivityId(),taDrainage.getOrgId());
332 329
 		return ResponseBean.success(taRedPacketHistoryList);
333 330
 	}
334 331
 
@@ -412,11 +409,6 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
412 409
 		parentRedPacketHistory.eq("target_miniapp_person",parentMpMiniapp.getMiniappPersonId());
413 410
 		List<TaRedPacketHistory> parentRedPacketHistories = taRedPacketHistoryMapper.selectList(parentRedPacketHistory);
414 411
 
415
-		//查看是否助力成功
416
-		if (parentRedPacketHistories.size() + 1 > taRedPacketHelp.getHelpSuccesPersons()){
417
-			return "助力已完成,无需助力。";
418
-		}
419
-
420 412
 		//助力
421 413
 		TaRedPacketHistory taRedPacketHistory = new TaRedPacketHistory();
422 414
 		taRedPacketHistory.setActivityId(taRedPacketHelp.getActivityId());
@@ -427,8 +419,25 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
427 419
 		taRedPacketHistory.setTargetMiniappPerson(parentMpMiniapp.getMiniappPersonId());
428 420
 		taRedPacketHistory.setTargetMpPerson(parentMpMiniapp.getMpPersonId());
429 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 441
 		return "success";
433 442
 	}
434 443
 
@@ -440,7 +449,7 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
440 449
 	 * @param orgId
441 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 454
 		TaRedPacketMoney taRedPacketMoney = taRedPacketmonetMapper.selectById(taRedPacketHelp.getActivityId());
446 455
 		//总账户金额
@@ -477,7 +486,7 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
477 486
 				.remark(taRedPacketClient.getRemark())//备注
478 487
 				.reOpenid(parentMpPerson.getMpOpenid())//接受红包的用户openid
479 488
 
480
-				.sceneId("PRODUCT_2")//场景id
489
+				.sceneId("PRODUCT_1")//场景id
481 490
 				.sendName(taRedPacketClient.getMchName())//红包发送者名称
482 491
 				.totalAmount(redPackageMoney)//付款金额,单位分
483 492
 				.totalNum(1)//红包发放总人数
@@ -489,7 +498,7 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
489 498
 			String resultCode = wxPaySendRedpackResult.getResultCode();
490 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 502
 			}else {
494 503
 				return;
495 504
 			}
@@ -498,7 +507,11 @@ public class TaThirdPartyMiniappConfigServiceImpl extends ServiceImpl<TaThirdPar
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 516
 		TaOrgAccount taOrgAccount = taOrgAccountMapper.selectOne(new QueryWrapper<TaOrgAccount>().eq("org_id", orgId).eq("status", CommConstant.STATUS_NORMAL));
504 517
 		taOrgAccount.setRealBalance(taOrgAccount.getRealBalance() - wxPaySendRedpackResult.getTotalAmount());

+ 5
- 6
src/main/resources/mapper/redpack/TaOrgOrderMapper.xml View File

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