批量缴费接口开发
This commit is contained in:
+61
-11
@@ -11,7 +11,9 @@ import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.wisdomarbitrate.domain.*;
|
||||
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.CasePayListVO;
|
||||
import com.ruoyi.wisdomarbitrate.mapper.*;
|
||||
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
|
||||
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
|
||||
import com.ruoyi.common.utils.SmsUtils;
|
||||
import com.ruoyi.dto.PayRequest;
|
||||
@@ -22,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -42,12 +46,15 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
public CasePaymentServiceImpl(ElegentPay elegentPay
|
||||
, CaseApplicationMapper caseApplicationMapper
|
||||
, CasePaymentRecordMapper casePaymentRecordMapper
|
||||
, CaseAffiliateMapper caseAffiliateMapper) {
|
||||
, CaseAffiliateMapper caseAffiliateMapper
|
||||
) {
|
||||
this.elegentPay = elegentPay;
|
||||
this.caseApplicationMapper = caseApplicationMapper;
|
||||
this.casePaymentRecordMapper = casePaymentRecordMapper;
|
||||
this.caseAffiliateMapper = caseAffiliateMapper;
|
||||
}
|
||||
@Autowired
|
||||
private ICaseApplicationService caseApplicationService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@@ -60,16 +67,22 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
if (response.getCode_url() == null) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
//缴费记录表里新增数据
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setCaseId(casePayDTO.getCaseId());
|
||||
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
||||
casePaymentRecord.setPaymentStatus(0);
|
||||
casePaymentRecord.setCreateTime(new Date());
|
||||
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
||||
if (count < 1) {
|
||||
List<Long> caseIds = casePayDTO.getCaseIds();
|
||||
if (CollectionUtil.isEmpty(caseIds)) {
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
for (Long caseId : caseIds) {
|
||||
//缴费记录表里新增数据
|
||||
CasePaymentRecord casePaymentRecord = new CasePaymentRecord();
|
||||
casePaymentRecord.setCaseId(caseId);
|
||||
casePaymentRecord.setOrderNumber(payRequest.getOrderSn());
|
||||
casePaymentRecord.setPaymentStatus(0);
|
||||
casePaymentRecord.setCreateTime(new Date());
|
||||
int count = casePaymentRecordMapper.saveRecord(casePaymentRecord);
|
||||
if (count < 1) {
|
||||
return AjaxResult.error("请检查参数是否有误");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(response);
|
||||
}
|
||||
|
||||
@@ -151,9 +164,9 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
String content = "尊敬的" + name + "用户,您的" + caseName + "案件" + caseNum + "已成功受理,请点击链接:https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 选择是否应诉。如非本人操作,请忽略本短信";
|
||||
smsSendRecord.setSendContent(content);
|
||||
smsSendRecord.setCreateBy(getUsername());
|
||||
if (aBoolean){
|
||||
if (aBoolean) {
|
||||
smsSendRecord.setSendStatus(1);
|
||||
}else {
|
||||
} else {
|
||||
smsSendRecord.setSendStatus(0);
|
||||
}
|
||||
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
|
||||
@@ -211,5 +224,42 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
|
||||
return AjaxResult.success("确认缴费失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult casePayList(CasePayDTO casePayDTO) {
|
||||
//参数校验
|
||||
List<Long> caseIds = casePayDTO.getCaseIds();
|
||||
if (caseIds == null || caseIds.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
BigDecimal totalCost = new BigDecimal(0);
|
||||
BigDecimal sum =totalCost;
|
||||
CasePayListVO listVO = new CasePayListVO();
|
||||
listVO.setCaseTotal(caseIds.size());
|
||||
List<CaseApplicationPay> caseApplicationList =new ArrayList<>();
|
||||
for (Long caseId : caseIds) {
|
||||
CaseApplication caseApplication = new CaseApplication();
|
||||
CaseApplicationPay caseApplicationPay = new CaseApplicationPay();
|
||||
caseApplication.setId(caseId);
|
||||
CaseApplication caseApplication1 = caseApplicationService.selectCaseApplication(caseApplication);
|
||||
BigDecimal feePayable = caseApplication1.getFeePayable();
|
||||
feePayable = feePayable.multiply(new BigDecimal(100));
|
||||
sum = sum.add(feePayable);
|
||||
listVO.setTotalFee(sum.intValue());
|
||||
caseApplicationPay.setCaseAppName(caseApplication1.getApplicantName());
|
||||
caseApplicationPay.setCaseResName(caseApplication1.getRespondentName());
|
||||
caseApplicationPay.setCaseNum(caseApplication1.getCaseNum());
|
||||
caseApplicationPay.setCaseStatus(caseApplication1.getCaseStatus());
|
||||
caseApplicationPay.setCaseSubjectAmount(caseApplication1.getCaseSubjectAmount());
|
||||
caseApplicationPay.setFeePayable(caseApplication1.getFeePayable());
|
||||
caseApplicationList.add(caseApplicationPay);
|
||||
listVO.setCaseApplicationList(caseApplicationList);
|
||||
}
|
||||
|
||||
if (sum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return AjaxResult.error("没有可支付的费用");
|
||||
}
|
||||
return AjaxResult.success(listVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -419,7 +419,7 @@ public class DeptIdentifyServiceImpl implements IDeptIdentifyService {
|
||||
String prefix = "/profile";
|
||||
int startIndex = fileName.indexOf(prefix);
|
||||
startIndex += prefix.length();
|
||||
String annexPath = "home/ruoyi/uploadPath" + fileName.substring(startIndex);
|
||||
String annexPath = "uploadPath" + fileName.substring(startIndex);
|
||||
templateManage.setTemOrigPath(annexPath);
|
||||
String format = getFileExtension(fileName);
|
||||
templateManage.setTemFormat(format);
|
||||
|
||||
Reference in New Issue
Block a user