This commit is contained in:
18792927508
2023-10-15 18:27:12 +08:00
20 changed files with 319 additions and 68 deletions
@@ -3,6 +3,7 @@ package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.dto.PayRequest;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
public interface ICasePaymentService {
@@ -12,4 +13,11 @@ public interface ICasePaymentService {
AjaxResult casePay(CasePayDTO casePayDTO);
AjaxResult confirmPayment(CaseApplication caseApplication);
/**
* 确认缴费
* @param payDTO
* @return
*/
AjaxResult confirmPay(CaseConfirmPayDTO payDTO);
}
@@ -14,10 +14,9 @@ import com.google.gson.JsonObject;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.*;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.WordUtil;
@@ -57,6 +56,7 @@ import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@@ -69,7 +69,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private CaseAffiliateMapper caseAffiliateMapper;
@Autowired
private ArbitratorMapper arbitratorMapper;
private CasePaymentRecordMapper casePaymentRecordMapper;
@Autowired
private ArbitrateRecordMapper arbitrateRecordMapper;
@Autowired
@@ -88,9 +88,45 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$");
/**
* 数据权限:1.每个人不同的角色,而每个角色可以操作不同的案件状态
* 2.申请人:金融机构下,可以看到改机构的所有的案件
* 3.被申请人:可以看到自己相关的案件(案件有被申请人相关的信息)
* 4.仲裁员:案件选定了某个仲裁员后,该仲裁员就可以查看该案件
* 5.仲裁委(部门长):可以查看所有的案件
* 6.法律顾问秘书:可以属于多个机构,可以查看相关机构的所有案件
* 7.超级管理员:可以查看所有的信息和数据
* @param caseApplication
* @return
*/
@Override
public List<CaseApplication> selectCaseApplicationList(CaseApplication caseApplication) {
// 获取登录用户
LoginUser loginUser = getLoginUser();
SysUser user = loginUser.getUser();
Long userId = user.getUserId();
Long deptId = user.getDeptId();
List<SysRole> roles = user.getRoles();
// 查询登录人身份证号
SysUser sysUser = sysUserMapper.selectUserById(userId);
caseApplication.setIdCard(sysUser.getIdCard());
caseApplication.setUserId(String.valueOf(userId));
for (SysRole role : roles) {
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
if(role.getRoleName().equals("超级管理员")
||role.getRoleName().equals("仲裁委")
||role.getRoleName().equals("部门长")){
return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
}
if(role.getRoleName().equals("法律顾问")){
// 查询角色有关的用户部门
List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
caseApplication.setDeptIds(deptIds);
}
}
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
return caseApplicationMapper.selectCaseApplicationList(caseApplication);
}
@@ -108,6 +144,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 获取自动编码
String caseNum = generateCaseNum();
caseApplication.setCaseNum(caseNum);
caseApplication.setCreateBy(getUsername());
int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
@@ -125,7 +162,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
// 将组织机构id设为申请人名称
if (deptMap.containsKey(caseAffiliate.getName())) {
caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName())));
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
} else {
// 如果不存在则新增
SysDept dept = new SysDept();
@@ -139,7 +177,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
deptMap.put(dept.getDeptName(), dept.getDeptId());
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
}
}
@@ -193,6 +232,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
caseApplication.setUpdateBy(getUsername());
int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
@@ -208,7 +248,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
// 将组织机构id设为申请人名称
if (deptMap.containsKey(caseAffiliate.getName())) {
caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName())));
} else {
// 如果不存在则新增
SysDept dept = new SysDept();
@@ -222,7 +263,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
deptMap.put(dept.getDeptName(), dept.getDeptId());
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
}
}
@@ -409,7 +452,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
// 新增立案信息
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
caseApplicationItera.setCreateBy(getUsername());
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
if(caseAffiliates!=null&&caseAffiliates.size()>0){
@@ -888,29 +931,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if(caseAffiliatListeselect!=null){
// 查询组织机构
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
Map<String,String> deptMap=new HashMap<>();
if(CollectionUtil.isNotEmpty(sysDepts)){
for (SysDept sysDept : sysDepts) {
deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName());
}
}
StringBuffer applicantName = new StringBuffer();
for (int i = 0; i < caseAffiliatListeselect.size(); i++){
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
int identityType = caseAffiliateselect.getIdentityType();
if(identityType==1){
if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
}
applicantName.append(caseAffiliateselect.getName()).append(",");;
caseApplicationselect.setApplicantName(caseAffiliateselect.getApplicationOrganName());
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
}
caseApplication.setAnnexType(8);
// 查询缴费凭证
List<CaseAttach> payOrderList = caseAttachMapper.queryCaseAttachList(caseApplication);
caseApplicationselect.setPayOrderList(payOrderList);
return caseApplicationselect;
}
@@ -1216,21 +1252,12 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if(caseAffiliatListeselect!=null) {
// 查询组织机构
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
Map<String,String> deptMap=new HashMap<>();
if(CollectionUtil.isNotEmpty(sysDepts)){
for (SysDept sysDept : sysDepts) {
deptMap.put(String.valueOf(sysDept.getDeptId()),sysDept.getDeptName());
}
}
for (int j = 0; j < caseAffiliatListeselect.size(); j++) {
CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(j);
int identityType = caseAffiliateselect.getIdentityType();
if(identityType==1){
if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
}
caseAffiliateselect.setName(caseAffiliateselect.getApplicationOrganName());
}
//给申请人、被申请人发送短信通知
@@ -1312,7 +1339,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 将组织机构id设为申请人名称
if(deptMap.containsKey(caseApplication.getName())){
caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseApplication.getName())));
caseAffiliate.setApplicationOrganName(caseApplication.getName());
}else {
// 如果不存在则新增
SysDept dept = new SysDept();
@@ -1326,7 +1354,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
dept.setUpdateBy(getUsername());
sysDeptMapper.insertDept(dept);
deptMap.put(dept.getDeptName(),dept.getDeptId());
caseAffiliate.setName(String.valueOf(dept.getDeptId()));
caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
caseAffiliate.setApplicationOrganName(caseApplication.getName());
}
@@ -1,9 +1,15 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.ruoyi.ElegentPay;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.dto.PayRequest;
@@ -29,6 +35,8 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
private final CaseApplicationMapper caseApplicationMapper;
private final CasePaymentRecordMapper casePaymentRecordMapper;
private final CaseAffiliateMapper caseAffiliateMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
@Autowired
public CasePaymentServiceImpl(ElegentPay elegentPay
@@ -78,13 +86,7 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
casePaymentRecord.setPaymentTime(new Date());
casePaymentRecord.setUpdateTime(new Date());
casePaymentRecordMapper.update(casePaymentRecord);
//根据案件id查询案件信息
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(caseId);
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
//修改案件状态
caseApplicationMapper.submitCaseApplication(caseApplication1);
return AjaxResult.success("支付成功");
}
@@ -135,4 +137,28 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
}
return AjaxResult.error("暂无需要确认的缴费清单");
}
@Transactional
@Override
public AjaxResult confirmPay(CaseConfirmPayDTO payDTO) {
if(payDTO.getCaseId()!=null&&payDTO.getPayType()!=null){
// 修改支付方式
caseApplicationMapper.updatePayType(payDTO);
}
if(CollectionUtil.isNotEmpty(payDTO.getPayOrderList())){
for (CaseAttach caseAttach : payDTO.getPayOrderList()) {
caseAttach.setCaseAppliId(payDTO.getCaseId());
caseAttachMapper.updateCaseAttach(caseAttach);
}
}
// 修改节点状态
//根据案件id查询案件信息
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(payDTO.getCaseId());
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
caseApplication1.setCaseStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
//修改案件状态
caseApplicationMapper.submitCaseApplication(caseApplication1);
return AjaxResult.success("确认缴费成功");
}
}