|
|
@@ -12,6 +12,7 @@ import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
|
|
12
|
12
|
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
|
|
13
|
13
|
import com.ruoyi.wisdomarbitrate.domain.CasePaymentRecord;
|
|
14
|
14
|
import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
|
|
|
15
|
+import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
|
|
15
|
16
|
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
|
|
16
|
17
|
import com.ruoyi.wisdomarbitrate.mapper.CasePaymentRecordMapper;
|
|
17
|
18
|
import com.ruoyi.wisdomarbitrate.service.ICasePaymentService;
|
|
|
@@ -27,21 +28,23 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
27
|
28
|
private final ElegentPay elegentPay;
|
|
28
|
29
|
private final CaseApplicationMapper caseApplicationMapper;
|
|
29
|
30
|
private final CasePaymentRecordMapper casePaymentRecordMapper;
|
|
30
|
|
-
|
|
|
31
|
+ private final CaseAffiliateMapper caseAffiliateMapper;
|
|
31
|
32
|
|
|
32
|
33
|
@Autowired
|
|
33
|
34
|
public CasePaymentServiceImpl(ElegentPay elegentPay
|
|
34
|
35
|
, CaseApplicationMapper caseApplicationMapper
|
|
35
|
|
- , CasePaymentRecordMapper casePaymentRecordMapper) {
|
|
|
36
|
+ , CasePaymentRecordMapper casePaymentRecordMapper
|
|
|
37
|
+ , CaseAffiliateMapper caseAffiliateMapper) {
|
|
36
|
38
|
this.elegentPay = elegentPay;
|
|
37
|
39
|
this.caseApplicationMapper = caseApplicationMapper;
|
|
38
|
40
|
this.casePaymentRecordMapper = casePaymentRecordMapper;
|
|
|
41
|
+ this.caseAffiliateMapper = caseAffiliateMapper;
|
|
39
|
42
|
}
|
|
40
|
43
|
|
|
41
|
44
|
@Override
|
|
42
|
45
|
public AjaxResult casePay(CasePayDTO casePayDTO) {
|
|
43
|
46
|
PayRequest payRequest = new PayRequest();
|
|
44
|
|
- payRequest.setBody(casePayDTO.getBody());
|
|
|
47
|
+ payRequest.setBody("案件缴费");
|
|
45
|
48
|
payRequest.setOrderSn(System.currentTimeMillis() + "");
|
|
46
|
49
|
payRequest.setTotalFee(casePayDTO.getTotalFee());
|
|
47
|
50
|
PayResponse response = elegentPay.requestPay(payRequest, casePayDTO.getTradeType(), casePayDTO.getPlatform());
|
|
|
@@ -53,6 +56,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
53
|
56
|
casePaymentRecord.setCaseId(casePayDTO.getCaseId());
|
|
54
|
57
|
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
|
55
|
58
|
casePaymentRecord.setPaymentStatus(0);
|
|
|
59
|
+ casePaymentRecord.setCreateTime(new Date());
|
|
56
|
60
|
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
|
57
|
61
|
if (count < 1) {
|
|
58
|
62
|
return AjaxResult.error("请检查参数是否有误");
|
|
|
@@ -61,9 +65,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
61
|
65
|
}
|
|
62
|
66
|
|
|
63
|
67
|
|
|
64
|
|
- public AjaxResult callback(String orderSn) {
|
|
|
68
|
+ public AjaxResult callback(String orderNumber) {
|
|
65
|
69
|
//查询记录
|
|
66
|
|
- CasePaymentRecord casePaymentRecord = casePaymentRecordMapper.queryRecord(orderSn);
|
|
|
70
|
+ CasePaymentRecord casePaymentRecord = casePaymentRecordMapper.queryRecord(orderNumber);
|
|
67
|
71
|
if (casePaymentRecord == null) {
|
|
68
|
72
|
return AjaxResult.error("未查询到相关记录");
|
|
69
|
73
|
}
|
|
|
@@ -71,6 +75,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
71
|
75
|
//更改记录表里的支付状态和支付时间
|
|
72
|
76
|
casePaymentRecord.setPaymentStatus(1);
|
|
73
|
77
|
casePaymentRecord.setPaymentTime(new Date());
|
|
|
78
|
+ casePaymentRecord.setUpdateTime(new Date());
|
|
74
|
79
|
casePaymentRecordMapper.update(casePaymentRecord);
|
|
75
|
80
|
//根据案件id查询案件信息
|
|
76
|
81
|
CaseApplication caseApplication = new CaseApplication();
|
|
|
@@ -78,26 +83,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
78
|
83
|
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
|
|
79
|
84
|
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
|
|
80
|
85
|
//修改案件状态
|
|
81
|
|
- caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
82
|
|
- //发送短信通知
|
|
83
|
|
- SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
84
|
|
- List<CaseAffiliate> caseAffiliates = caseApplication1.getCaseAffiliates();//获取案件关联人信息
|
|
85
|
|
- if (caseAffiliates!=null&&caseAffiliates.size()>0){
|
|
86
|
|
- for (CaseAffiliate caseAffiliate : caseAffiliates) {
|
|
87
|
|
- request.setPhone(caseAffiliate.getContactTelphone());
|
|
88
|
|
- //获取身份类型
|
|
89
|
|
- int identityType = caseAffiliate.getIdentityType();
|
|
90
|
|
- if (identityType==1){ //申请人
|
|
91
|
|
- request.setTemplateId("申请人模板id"); //传入申请人模板id
|
|
92
|
|
- // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
|
93
|
|
- request.setTemplateParamSet(new String[]{"模板中的参数值,如果没有则为空"});
|
|
94
|
|
- } else { //被申请人
|
|
95
|
|
- request.setTemplateId("被申请人模板id");
|
|
96
|
|
- request.setTemplateParamSet(new String[]{"模板中的参数值,如果没有则为空"});
|
|
97
|
|
- }
|
|
98
|
|
- }
|
|
99
|
|
- }
|
|
100
|
|
- SmsUtils.sendSms(request);
|
|
|
86
|
+ caseApplicationMapper.submitCaseApplication(caseApplication1);
|
|
101
|
87
|
return AjaxResult.success();
|
|
102
|
88
|
}
|
|
103
|
89
|
@Override
|
|
|
@@ -105,7 +91,28 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
105
|
91
|
caseApplication.setCaseStatus(CaseApplicationConstants.EVIDENCE_CONFREMED);
|
|
106
|
92
|
int i = caseApplicationMapper.submitCaseApplication(caseApplication);
|
|
107
|
93
|
if (i > 0) {
|
|
108
|
|
- return AjaxResult.success();
|
|
|
94
|
+ //发送短信通知
|
|
|
95
|
+ SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
|
|
|
96
|
+ CaseAffiliate caseAffiliate = new CaseAffiliate();
|
|
|
97
|
+ caseAffiliate.setCaseAppliId(caseApplication.getId());
|
|
|
98
|
+ List<CaseAffiliate> caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); //获取案件关联人信息
|
|
|
99
|
+ if (caseAffiliates != null && caseAffiliates.size() > 0) {
|
|
|
100
|
+ for (CaseAffiliate affiliate : caseAffiliates) {
|
|
|
101
|
+ request.setPhone(affiliate.getContactTelphone());
|
|
|
102
|
+ //获取身份类型
|
|
|
103
|
+ int identityType = affiliate.getIdentityType();
|
|
|
104
|
+ if (identityType == 1) { //申请人
|
|
|
105
|
+ request.setTemplateId("申请人模板id"); //传入申请人模板id
|
|
|
106
|
+ // 这个值,要看你的模板中是否预留了占位符,如果没有则不需要设置
|
|
|
107
|
+ request.setTemplateParamSet(new String[]{"模板中的参数值,如果没有则为空"});
|
|
|
108
|
+ } else { //被申请人
|
|
|
109
|
+ request.setTemplateId("被申请人模板id");
|
|
|
110
|
+ request.setTemplateParamSet(new String[]{"模板中的参数值,如果没有则为空"});
|
|
|
111
|
+ }
|
|
|
112
|
+ }
|
|
|
113
|
+ //SmsUtils.sendSms(request);
|
|
|
114
|
+ return AjaxResult.success();
|
|
|
115
|
+ }
|
|
109
|
116
|
}
|
|
110
|
117
|
return AjaxResult.error("暂无需要确认的缴费清单");
|
|
111
|
118
|
}
|