|
|
@@ -9,6 +9,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|
9
|
9
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
10
|
10
|
import com.ruoyi.common.exception.ServiceException;
|
|
11
|
11
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
12
|
+import com.ruoyi.common.utils.StringUtils;
|
|
12
|
13
|
import com.ruoyi.wisdomarbitrate.domain.*;
|
|
13
|
14
|
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
|
14
|
15
|
import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
|
|
|
@@ -92,17 +93,19 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
92
|
93
|
@Transactional
|
|
93
|
94
|
public AjaxResult callback(String orderNumber) {
|
|
94
|
95
|
//查询记录
|
|
95
|
|
- CasePaymentRecord casePaymentRecord = casePaymentRecordMapper.queryRecord(orderNumber);
|
|
96
|
|
- if (casePaymentRecord == null) {
|
|
|
96
|
+ List<CasePaymentRecord> casePaymentRecords = casePaymentRecordMapper.queryRecord(orderNumber);
|
|
|
97
|
+ if(casePaymentRecords!=null&&casePaymentRecords.size()>0){
|
|
|
98
|
+ for (CasePaymentRecord casePaymentRecord:casePaymentRecords){
|
|
|
99
|
+ Long caseId = casePaymentRecord.getCaseId();
|
|
|
100
|
+ //更改记录表里的支付状态和支付时间
|
|
|
101
|
+ casePaymentRecord.setPaymentStatus(1);
|
|
|
102
|
+ casePaymentRecord.setPaymentTime(new Date());
|
|
|
103
|
+ casePaymentRecord.setUpdateTime(new Date());
|
|
|
104
|
+ casePaymentRecordMapper.update(casePaymentRecord);
|
|
|
105
|
+ }
|
|
|
106
|
+ }else {
|
|
97
|
107
|
return AjaxResult.error("未查询到相关记录");
|
|
98
|
108
|
}
|
|
99
|
|
- Long caseId = casePaymentRecord.getCaseId();
|
|
100
|
|
- //更改记录表里的支付状态和支付时间
|
|
101
|
|
- casePaymentRecord.setPaymentStatus(1);
|
|
102
|
|
- casePaymentRecord.setPaymentTime(new Date());
|
|
103
|
|
- casePaymentRecord.setUpdateTime(new Date());
|
|
104
|
|
- casePaymentRecordMapper.update(casePaymentRecord);
|
|
105
|
|
-
|
|
106
|
109
|
return AjaxResult.success("支付成功");
|
|
107
|
110
|
}
|
|
108
|
111
|
|
|
|
@@ -344,5 +347,141 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
344
|
347
|
return AjaxResult.success(listVO);
|
|
345
|
348
|
}
|
|
346
|
349
|
|
|
|
350
|
+ @Override
|
|
|
351
|
+ @Transactional
|
|
|
352
|
+ public AjaxResult confirmPaymentBatch(String batchNumber) {
|
|
|
353
|
+ CaseApplication caseApplicationsel = new CaseApplication();
|
|
|
354
|
+ caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
|
|
355
|
+ caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
|
|
356
|
+ List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
|
|
357
|
+
|
|
|
358
|
+ if (caseApplications != null && caseApplications.size() > 0) {
|
|
|
359
|
+ List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
|
|
360
|
+ for (Long caseId : caseIds) {
|
|
|
361
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
362
|
+ caseApplication.setId(caseId);
|
|
|
363
|
+ caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
|
|
|
364
|
+ caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
|
365
|
+ //发送短信通知
|
|
|
366
|
+ SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
|
367
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
368
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
369
|
+ List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
|
|
370
|
+ if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
|
371
|
+ for (CaseAffiliate affiliate : caseAffiliates) {
|
|
|
372
|
+ //获取身份类型
|
|
|
373
|
+ int identityType = affiliate.getIdentityType();
|
|
|
374
|
+ //查询案件详细信息
|
|
|
375
|
+ CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
|
376
|
+ if (caseApplication1 == null) {
|
|
|
377
|
+ continue;
|
|
|
378
|
+ }
|
|
|
379
|
+ String caseName = "仲裁"; //这里案件名称表里未定义,暂时写死
|
|
|
380
|
+ String caseNum = caseApplication1.getCaseNum();
|
|
|
381
|
+ if (identityType == 1) { //申请人
|
|
|
382
|
+ request.setPhone(affiliate.getContactTelphone());
|
|
|
383
|
+ request.setTemplateId("1928003"); //传入申请人模板id
|
|
|
384
|
+ // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
|
|
385
|
+ // 模板id:1928003 普通短信 案件受理通知
|
|
|
386
|
+ String name = affiliate.getName();
|
|
|
387
|
+ request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
|
|
388
|
+ Boolean aBoolean = SmsUtils.sendSms(request);
|
|
|
389
|
+ //保存短信发送记录
|
|
|
390
|
+ SmsSendRecord smsSendRecord = new SmsSendRecord();
|
|
|
391
|
+ smsSendRecord.setCaseId(caseApplication.getId());
|
|
|
392
|
+ smsSendRecord.setCaseNum(caseNum);
|
|
|
393
|
+ smsSendRecord.setPhone(request.getPhone());
|
|
|
394
|
+ smsSendRecord.setSendTime(new Date());
|
|
|
395
|
+ String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理。";
|
|
|
396
|
+ smsSendRecord.setSendContent(content);
|
|
|
397
|
+ smsSendRecord.setCreateBy(getUsername());
|
|
|
398
|
+ if (aBoolean) {
|
|
|
399
|
+ smsSendRecord.setSendStatus(1);
|
|
|
400
|
+ } else {
|
|
|
401
|
+ smsSendRecord.setSendStatus(0);
|
|
|
402
|
+ }
|
|
|
403
|
+ smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
|
404
|
+ } else { //被申请人
|
|
|
405
|
+
|
|
|
406
|
+ request.setPhone(affiliate.getContactTelphone());
|
|
|
407
|
+ request.setTemplateId("1952840");
|
|
|
408
|
+ // 1952840 尊敬的{1}用户,您的{2}案件{3}已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信
|
|
|
409
|
+ String name = affiliate.getName();
|
|
|
410
|
+ request.setTemplateParamSet(new String[]{name, caseName, caseNum});
|
|
|
411
|
+ Boolean aBoolean = SmsUtils.sendSms(request);
|
|
|
412
|
+ //保存短信发送记录
|
|
|
413
|
+ SmsSendRecord smsSendRecord = new SmsSendRecord();
|
|
|
414
|
+ smsSendRecord.setCaseId(caseApplication.getId());
|
|
|
415
|
+ smsSendRecord.setCaseNum(caseNum);
|
|
|
416
|
+ smsSendRecord.setPhone(request.getPhone());
|
|
|
417
|
+ smsSendRecord.setSendTime(new Date());
|
|
|
418
|
+ String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
|
|
419
|
+ smsSendRecord.setSendContent(content);
|
|
|
420
|
+ smsSendRecord.setCreateBy(getUsername());
|
|
|
421
|
+ if (aBoolean) {
|
|
|
422
|
+ smsSendRecord.setSendStatus(1);
|
|
|
423
|
+ } else {
|
|
|
424
|
+ smsSendRecord.setSendStatus(0);
|
|
|
425
|
+ }
|
|
|
426
|
+ smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
|
427
|
+ }
|
|
|
428
|
+ }
|
|
|
429
|
+ //更改记录表里的支付状态和支付时间
|
|
|
430
|
+ CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
|
|
431
|
+ casePaymentRecord.setPaymentStatus(1);
|
|
|
432
|
+ casePaymentRecord.setCaseId(caseId);
|
|
|
433
|
+ casePaymentRecord.setPaymentTime(new Date());
|
|
|
434
|
+ casePaymentRecord.setUpdateTime(new Date());
|
|
|
435
|
+ casePaymentRecordMapper.update(casePaymentRecord);
|
|
|
436
|
+ // 新增日志
|
|
|
437
|
+ CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_CROSSEXAMI, "");
|
|
|
438
|
+
|
|
|
439
|
+
|
|
|
440
|
+ }
|
|
|
441
|
+
|
|
|
442
|
+ }
|
|
|
443
|
+ }
|
|
|
444
|
+ return AjaxResult.success();
|
|
|
445
|
+ }
|
|
|
446
|
+
|
|
|
447
|
+ @Override
|
|
|
448
|
+ @Transactional
|
|
|
449
|
+ public AjaxResult casePayBatch(CasePayDTO casePayDTO) {
|
|
|
450
|
+ PayRequest payRequest = new PayRequest();
|
|
|
451
|
+ payRequest.setBody("案件缴费");
|
|
|
452
|
+ payRequest.setOrderSn(System.currentTimeMillis() + "");
|
|
|
453
|
+ payRequest.setTotalFee(casePayDTO.getTotalFee());
|
|
|
454
|
+ PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
|
|
|
455
|
+ if (response.getCode_url() == null) {
|
|
|
456
|
+ return AjaxResult.error();
|
|
|
457
|
+ }
|
|
|
458
|
+ String batchNumber = casePayDTO.getBatchNumber();
|
|
|
459
|
+ if(StringUtils.isEmpty(batchNumber) ){
|
|
|
460
|
+ return AjaxResult.error("请检查参数是否有误");
|
|
|
461
|
+ }
|
|
|
462
|
+ CaseApplication caseApplicationsel = new CaseApplication();
|
|
|
463
|
+ caseApplicationsel.setBatchNumber(Integer.parseInt(batchNumber));
|
|
|
464
|
+ caseApplicationsel.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT);
|
|
|
465
|
+ List<CaseApplication> caseApplications = caseApplicationMapper.listCaseApplicationByBatchNumber(caseApplicationsel);
|
|
|
466
|
+ if(caseApplications!=null&&caseApplications.size()>0){
|
|
|
467
|
+ List<Long> caseIds = caseApplications.stream().map(CaseApplication::getId).collect(Collectors.toList());
|
|
|
468
|
+ for (Long caseId : caseIds) {
|
|
|
469
|
+ //缴费记录表里新增数据
|
|
|
470
|
+ CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
|
|
471
|
+ casePaymentRecord.setCaseId(caseId);
|
|
|
472
|
+ casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
|
|
473
|
+ casePaymentRecord.setPaymentStatus(0);
|
|
|
474
|
+ casePaymentRecord.setCreateTime(new Date());
|
|
|
475
|
+ int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
|
|
476
|
+ if (count < 1) {
|
|
|
477
|
+ return AjaxResult.error();
|
|
|
478
|
+ }
|
|
|
479
|
+ }
|
|
|
480
|
+
|
|
|
481
|
+ }
|
|
|
482
|
+
|
|
|
483
|
+ return AjaxResult.success(response);
|
|
|
484
|
+ }
|
|
|
485
|
+
|
|
347
|
486
|
|
|
348
|
487
|
}
|