|
|
@@ -11,7 +11,9 @@ import com.ruoyi.common.exception.ServiceException;
|
|
11
|
11
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
12
|
12
|
import com.ruoyi.wisdomarbitrate.domain.*;
|
|
13
|
13
|
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
|
|
14
|
+import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
|
|
14
|
15
|
import com.ruoyi.wisdomarbitrate.mapper.*;
|
|
|
16
|
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
|
15
|
17
|
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
|
16
|
18
|
import com.ruoyi.common.utils.SmsUtils;
|
|
17
|
19
|
import com.ruoyi.dto.PayRequest;
|
|
|
@@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
22
|
24
|
import org.springframework.stereotype.Service;
|
|
23
|
25
|
import org.springframework.transaction.annotation.Transactional;
|
|
24
|
26
|
|
|
|
27
|
+import java.math.BigDecimal;
|
|
|
28
|
+import java.util.ArrayList;
|
|
25
|
29
|
import java.util.Date;
|
|
26
|
30
|
import java.util.List;
|
|
27
|
31
|
|
|
|
@@ -42,12 +46,15 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
42
|
46
|
public CasePaymentServiceImpl(ElegentPay elegentPay
|
|
43
|
47
|
, CaseApplicationMapper caseApplicationMapper
|
|
44
|
48
|
, CasePaymentRecordMapper casePaymentRecordMapper
|
|
45
|
|
- , CaseAffiliateMapper caseAffiliateMapper) {
|
|
|
49
|
+ , CaseAffiliateMapper caseAffiliateMapper
|
|
|
50
|
+ ) {
|
|
46
|
51
|
this.elegentPay = elegentPay;
|
|
47
|
52
|
this.caseApplicationMapper = caseApplicationMapper;
|
|
48
|
53
|
this.casePaymentRecordMapper = casePaymentRecordMapper;
|
|
49
|
54
|
this.caseAffiliateMapper = caseAffiliateMapper;
|
|
50
|
55
|
}
|
|
|
56
|
+ @Autowired
|
|
|
57
|
+ private ICaseApplicationService caseApplicationService;
|
|
51
|
58
|
|
|
52
|
59
|
@Override
|
|
53
|
60
|
@Transactional
|
|
|
@@ -60,16 +67,22 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
60
|
67
|
if (response.getCode_url() == null) {
|
|
61
|
68
|
return AjaxResult.error();
|
|
62
|
69
|
}
|
|
63
|
|
- //缴费记录表里新增数据
|
|
64
|
|
- CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
|
65
|
|
- casePaymentRecord.setCaseId(casePayDTO.getCaseId());
|
|
66
|
|
- casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
|
67
|
|
- casePaymentRecord.setPaymentStatus(0);
|
|
68
|
|
- casePaymentRecord.setCreateTime(new Date());
|
|
69
|
|
- int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
|
70
|
|
- if (count < 1) {
|
|
|
70
|
+ List<Long> caseIds = casePayDTO.getCaseIds();
|
|
|
71
|
+ if (CollectionUtil.isEmpty(caseIds)) {
|
|
71
|
72
|
return AjaxResult.error("请检查参数是否有误");
|
|
72
|
73
|
}
|
|
|
74
|
+ for (Long caseId : caseIds) {
|
|
|
75
|
+ //缴费记录表里新增数据
|
|
|
76
|
+ CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
|
|
77
|
+ casePaymentRecord.setCaseId(caseId);
|
|
|
78
|
+ casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
|
|
79
|
+ casePaymentRecord.setPaymentStatus(0);
|
|
|
80
|
+ casePaymentRecord.setCreateTime(new Date());
|
|
|
81
|
+ int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
|
|
82
|
+ if (count < 1) {
|
|
|
83
|
+ return AjaxResult.error("请检查参数是否有误");
|
|
|
84
|
+ }
|
|
|
85
|
+ }
|
|
73
|
86
|
return AjaxResult.success(response);
|
|
74
|
87
|
}
|
|
75
|
88
|
|
|
|
@@ -151,9 +164,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
151
|
164
|
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
|
152
|
165
|
smsSendRecord.setSendContent(content);
|
|
153
|
166
|
smsSendRecord.setCreateBy(getUsername());
|
|
154
|
|
- if (aBoolean){
|
|
|
167
|
+ if (aBoolean) {
|
|
155
|
168
|
smsSendRecord.setSendStatus(1);
|
|
156
|
|
- }else {
|
|
|
169
|
+ } else {
|
|
157
|
170
|
smsSendRecord.setSendStatus(0);
|
|
158
|
171
|
}
|
|
159
|
172
|
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
|
|
@@ -211,5 +224,42 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
|
211
|
224
|
return AjaxResult.success("确认缴费失败");
|
|
212
|
225
|
}
|
|
213
|
226
|
|
|
|
227
|
+ @Override
|
|
|
228
|
+ public AjaxResult casePayList(CasePayDTO casePayDTO) {
|
|
|
229
|
+ //参数校验
|
|
|
230
|
+ List<Long> caseIds = casePayDTO.getCaseIds();
|
|
|
231
|
+ if (caseIds == null || caseIds.size() == 0) {
|
|
|
232
|
+ return null;
|
|
|
233
|
+ }
|
|
|
234
|
+ BigDecimal totalCost = new BigDecimal(0);
|
|
|
235
|
+ BigDecimal sum =totalCost;
|
|
|
236
|
+ CasePayListVO listVO = new CasePayListVO();
|
|
|
237
|
+ listVO.setCaseTotal(caseIds.size());
|
|
|
238
|
+ List<CaseApplicationPay> caseApplicationList =new ArrayList<>();
|
|
|
239
|
+ for (Long caseId : caseIds) {
|
|
|
240
|
+ CaseApplication caseApplication = new CaseApplication();
|
|
|
241
|
+ CaseApplicationPay caseApplicationPay = new CaseApplicationPay();
|
|
|
242
|
+ caseApplication.setId(caseId);
|
|
|
243
|
+ CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
|
|
|
244
|
+ BigDecimal feePayable = caseApplication1.getFeePayable();
|
|
|
245
|
+ feePayable = feePayable.multiply(new BigDecimal(100));
|
|
|
246
|
+ sum = sum.add(feePayable);
|
|
|
247
|
+ listVO.setTotalFee(sum.intValue());
|
|
|
248
|
+ caseApplicationPay.setCaseAppName(caseApplication1.getApplicantName());
|
|
|
249
|
+ caseApplicationPay.setCaseResName(caseApplication1.getRespondentName());
|
|
|
250
|
+ caseApplicationPay.setCaseNum(caseApplication1.getCaseNum());
|
|
|
251
|
+ caseApplicationPay.setCaseStatus(caseApplication1.getCaseStatus());
|
|
|
252
|
+ caseApplicationPay.setCaseSubjectAmount(caseApplication1.getCaseSubjectAmount());
|
|
|
253
|
+ caseApplicationPay.setFeePayable(caseApplication1.getFeePayable());
|
|
|
254
|
+ caseApplicationList.add(caseApplicationPay);
|
|
|
255
|
+ listVO.setCaseApplicationList(caseApplicationList);
|
|
|
256
|
+ }
|
|
|
257
|
+
|
|
|
258
|
+ if (sum.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
259
|
+ return AjaxResult.error("没有可支付的费用");
|
|
|
260
|
+ }
|
|
|
261
|
+ return AjaxResult.success(listVO);
|
|
|
262
|
+ }
|
|
|
263
|
+
|
|
214
|
264
|
|
|
215
|
265
|
}
|