立案申请组庭功能开发

This commit is contained in:
qitz
2023-09-14 18:40:44 +08:00
parent b43f38c9dd
commit 891c67f39f
19 changed files with 921 additions and 11 deletions
@@ -0,0 +1,111 @@
package com.ruoyi.wisdomarbitrate.domain;
import com.ruoyi.common.core.domain.BaseEntity;
public class Arbitrator extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 仲裁员姓名 */
private String arbitratorName;
/** 职称 */
private String title;
/** 职业 */
private String career;
/** 专业分类 */
private String professiClassifi;
/** 学历 */
private String education;
/** 所在地区 */
private String area;
/** 联系电话 */
private String telephone;
public String getArbitratorName() {
return arbitratorName;
}
public void setArbitratorName(String arbitratorName) {
this.arbitratorName = arbitratorName;
}
/** 当前案件数量 */
private int currentCaseNum;
/** 已结案数量 */
private int closedCaseNum;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCareer() {
return career;
}
public void setCareer(String career) {
this.career = career;
}
public String getProfessiClassifi() {
return professiClassifi;
}
public void setProfessiClassifi(String professiClassifi) {
this.professiClassifi = professiClassifi;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public int getCurrentCaseNum() {
return currentCaseNum;
}
public void setCurrentCaseNum(int currentCaseNum) {
this.currentCaseNum = currentCaseNum;
}
public int getClosedCaseNum() {
return closedCaseNum;
}
public void setClosedCaseNum(int closedCaseNum) {
this.closedCaseNum = closedCaseNum;
}
}
@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.Excels;
import com.ruoyi.common.core.domain.BaseEntity;
import java.math.BigDecimal;
import java.util.Date;
@@ -11,17 +12,15 @@ public class CaseApplication extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
@Excel(name = "ID", cellType = Excel.ColumnType.NUMERIC, prompt = "ID")
private Long id;
/** 案件编号 */
@Excel(name = "案件编号")
private String caseNum;
/** 合同编号 */
@Excel(name = "合同编号")
private String contractNumber;
/** 案件标的 */
@Excel(name = "案件标的")
private BigDecimal caseSubjectAmount;
/** 立案日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date registerDate;
@@ -36,10 +35,15 @@ public class CaseApplication extends BaseEntity {
private String arbitratClaims;
/** 借款开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "借款开始日期")
private Date loanStartDate;
/** 借款结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "借款结束日期")
private Date loanEndDate;
/** 合同编号 */
@Excel(name = "合同编号")
private String contractNumber;
/** 申请人主张欠本金 */
@Excel(name = "申请人主张欠本金")
private BigDecimal claimPrinciOwed;
@@ -59,9 +63,179 @@ public class CaseApplication extends BaseEntity {
/** 在线视频人员 */
private String onlineVideoPerson;
/** 仲裁员id */
private String arbitratorId;
/** 仲裁员名称 */
private String arbitratorName;
public String getArbitratorName() {
return arbitratorName;
}
public void setArbitratorName(String arbitratorName) {
this.arbitratorName = arbitratorName;
}
/** 是否指派仲裁员 */
private int pendingAppointArbotrar;
public int getPendingAppointArbotrar() {
return pendingAppointArbotrar;
}
public void setPendingAppointArbotrar(int pendingAppointArbotrar) {
this.pendingAppointArbotrar = pendingAppointArbotrar;
}
public String getArbitratorId() {
return arbitratorId;
}
public void setArbitratorId(String arbitratorId) {
this.arbitratorId = arbitratorId;
}
/** 案件关联人信息 */
private List<CaseAffiliate> caseAffiliates;
/** 案件仲裁员 */
private List<Arbitrator> arbitrators;
public List<Arbitrator> getArbitrators() {
return arbitrators;
}
public void setArbitrators(List<Arbitrator> arbitrators) {
this.arbitrators = arbitrators;
}
/** 身份类型 */
@Excel(name = "身份类型")
private int identityType;
/** 姓名 */
@Excel(name = "姓名")
private String name;
/** 身份证号 */
@Excel(name = "身份证号")
private String identityNum;
/** 单位电话 */
@Excel(name = "单位电话")
private String workTelphone;
/** 联系电话 */
@Excel(name = "联系电话")
private String contactTelphone;
/** 联系地址 */
@Excel(name = "联系地址")
private String contactAddress;
/** 单位地址 */
@Excel(name = "单位地址")
private String workAddress;
/** 代理人姓名 */
@Excel(name = "代理人姓名")
private String nameAgent;
/** 身份证号 */
@Excel(name = "代理人身份证号")
private String identityNumAgent;
/** 联系电话 */
@Excel(name = "代理人联系电话")
private String contactTelphoneAgent;
public int getIdentityType() {
return identityType;
}
public void setIdentityType(int identityType) {
this.identityType = identityType;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIdentityNum() {
return identityNum;
}
public void setIdentityNum(String identityNum) {
this.identityNum = identityNum;
}
public String getWorkTelphone() {
return workTelphone;
}
public void setWorkTelphone(String workTelphone) {
this.workTelphone = workTelphone;
}
public String getContactTelphone() {
return contactTelphone;
}
public void setContactTelphone(String contactTelphone) {
this.contactTelphone = contactTelphone;
}
public String getContactAddress() {
return contactAddress;
}
public void setContactAddress(String contactAddress) {
this.contactAddress = contactAddress;
}
public String getWorkAddress() {
return workAddress;
}
public void setWorkAddress(String workAddress) {
this.workAddress = workAddress;
}
public String getNameAgent() {
return nameAgent;
}
public void setNameAgent(String nameAgent) {
this.nameAgent = nameAgent;
}
public String getIdentityNumAgent() {
return identityNumAgent;
}
public void setIdentityNumAgent(String identityNumAgent) {
this.identityNumAgent = identityNumAgent;
}
public String getContactTelphoneAgent() {
return contactTelphoneAgent;
}
public void setContactTelphoneAgent(String contactTelphoneAgent) {
this.contactTelphoneAgent = contactTelphoneAgent;
}
public String getContactAddressAgent() {
return contactAddressAgent;
}
public void setContactAddressAgent(String contactAddressAgent) {
this.contactAddressAgent = contactAddressAgent;
}
/** 联系地址 */
@Excel(name = "代理人联系地址")
private String contactAddressAgent;
public Long getId() {
@@ -215,4 +389,11 @@ public class CaseApplication extends BaseEntity {
public void setCaseAffiliates(List<CaseAffiliate> caseAffiliates) {
this.caseAffiliates = caseAffiliates;
}
}
@@ -0,0 +1,63 @@
package com.ruoyi.wisdomarbitrate.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
public class IdentityAuthentication extends BaseEntity {
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
/** 姓名 */
private String name;
/** 身份证号 */
private String identityNo;
/** 认证时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date certificationTime;
/** 认证状态 */
private int certificationStatus;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIdentityNo() {
return identityNo;
}
public void setIdentityNo(String identityNo) {
this.identityNo = identityNo;
}
public Date getCertificationTime() {
return certificationTime;
}
public void setCertificationTime(Date certificationTime) {
this.certificationTime = certificationTime;
}
public int getCertificationStatus() {
return certificationStatus;
}
public void setCertificationStatus(int certificationStatus) {
this.certificationStatus = certificationStatus;
}
}
@@ -0,0 +1,10 @@
package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import java.util.List;
public interface ArbitratorMapper {
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
}
@@ -0,0 +1,4 @@
package com.ruoyi.wisdomarbitrate.mapper;
public interface IdentityAuthenticationMapper {
}
@@ -0,0 +1,12 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import java.util.List;
public interface IArbitratorService {
List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
}
@@ -19,4 +19,10 @@ public interface ICaseApplicationService {
int deletecaseApplicationByIds(CaseApplication caseApplication);
CaseApplication selectCaseApplication(CaseApplication caseApplication);
String importCaseApplication(List<CaseApplication> caseApplicationList, String operName);
int pendTral(CaseApplication caseApplication);
int pendingAppointArbotrar(CaseApplication caseApplication);
}
@@ -0,0 +1,9 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
public interface IdentityAuthenticationService {
IdentityAuthentication selectIdentityInformation();
}
@@ -0,0 +1,28 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import com.ruoyi.wisdomarbitrate.mapper.ArbitratorMapper;
import com.ruoyi.wisdomarbitrate.service.IArbitratorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ArbitratorServiceImpl implements IArbitratorService {
@Autowired
private ArbitratorMapper arbitratorMapper;
@Override
public List<Arbitrator> selectArbitratorList(Arbitrator arbitrator) {
return arbitratorMapper.selectArbitratorList(arbitrator);
}
}
@@ -1,6 +1,10 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.mapper.CaseAffiliateMapper;
@@ -11,9 +15,15 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
import static com.ruoyi.common.core.domain.AjaxResult.error;
import static java.util.stream.Collectors.collectingAndThen;
import static java.util.stream.Collectors.toCollection;
@Service
public class CaseApplicationServiceImpl implements ICaseApplicationService {
@@ -89,10 +99,162 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
caseApplicationselect.setCaseAffiliates(caseAffiliatListeselect);
if(caseApplicationselect!=null){
caseApplicationselect.setCaseAffiliates(caseAffiliatListeselect);
}
return caseApplicationselect;
}
@Override
@Transactional
public String importCaseApplication(List<CaseApplication> caseApplicationList, String operName) {
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
int successNum = 0;
int failureNum = 0;
if(caseApplicationList!=null&&caseApplicationList.size()>0){
List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
for (int i = 0; i < caseApplicationList.size(); i++){
CaseApplication caseApplication = caseApplicationList.get(i);
//赋值CaseApplication的案件关联人信息
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
int caseApplicationCount = selectCaseApplicationCount(caseApplication);
if(caseApplicationCount>0){
failureNum++;
failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
}else {
caseApplicationListinsert.add(caseApplication);
}
}
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
collectingAndThen(
toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
ArrayList::new));
//对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
List<CaseApplication> caseApplicationNewList = new ArrayList<>();
for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
List<CaseAffiliate> caseAffiliatesnew = new ArrayList<>();
CaseApplication caseApplicationNew = new CaseApplication();
copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
for (int j = 0; j < caseApplicationListinsert.size(); j++){
CaseApplication caseApplicationinsert = caseApplicationListinsert.get(j);
if(StringUtils.isNotEmpty(caseApplicationinsert.getCaseNum())&&
caseApplicationinsert.getCaseNum().equals(caseApplicationinsertDiffer.getCaseNum())){
caseAffiliatesnew.addAll(caseApplicationinsert.getCaseAffiliates());
}
}
caseApplicationNew.setCaseAffiliates(caseAffiliatesnew);
caseApplicationNewList.add(caseApplicationNew);
}
for (int k = 0; k < caseApplicationNewList.size(); k++){
CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
// 新增立案信息
caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
if(caseAffiliates!=null&&caseAffiliates.size()>0){
for (CaseAffiliate caseAffiliate : caseAffiliates){
caseAffiliate.setCaseAppliId(caseApplicationItera.getId());
}
caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
}
successNum++;
successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
}
}
}
}
}else {
throw new ServiceException("导入立案申请数据不能为空!");
}
return successMsg.toString();
}
@Override
@Transactional
public int pendTral(CaseApplication caseApplication) {
List<Arbitrator> arbitrators = caseApplication.getArbitrators();
int rows = 0;
if(arbitrators!=null&&arbitrators.size()>0){
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(","));
String arbitratorNamestr = arbitratorNames.stream().map(Object::toString).collect(Collectors.joining(","));
caseApplication.setArbitratorId(idstr);
caseApplication.setArbitratorName(arbitratorNamestr);
caseApplication.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}
return rows;
}
@Override
@Transactional
public int pendingAppointArbotrar(CaseApplication caseApplication) {
int pendingAppointArbotrar = caseApplication.getPendingAppointArbotrar();
List<Arbitrator> arbitrators = caseApplication.getArbitrators();
int rows = 0;
if(pendingAppointArbotrar==1){
if(arbitrators!=null&&arbitrators.size()>0){
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
String idstr = ids.stream().map(Object::toString).collect(Collectors.joining(","));
String arbitratorNamestr = arbitratorNames.stream().map(Object::toString).collect(Collectors.joining(","));
caseApplication.setArbitratorId(idstr);
caseApplication.setArbitratorName(arbitratorNamestr);
caseApplication.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
caseApplication.setPendingAppointArbotrar(1);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}
}else {
caseApplication.setCaseStatus(CaseApplicationConstants.PENDING_TRIAL);
caseApplication.setPendingAppointArbotrar(2);
rows = caseApplicationMapper.submitCaseApplication(caseApplication);
}
return rows;
}
private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
CaseAffiliate caseAffiliate = new CaseAffiliate();
// BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
caseAffiliatesnew.add(caseAffiliate);
caseApplication.setCaseAffiliates(caseAffiliatesnew);
}
private void copyCaseApplication(CaseApplication caseApplicationinsertDiffer, CaseApplication caseApplicationNew) {
caseApplicationNew.setArbitratClaims(caseApplicationinsertDiffer.getArbitratClaims());
caseApplicationNew.setCaseNum(caseApplicationinsertDiffer.getCaseNum());
caseApplicationNew.setCaseSubjectAmount(caseApplicationinsertDiffer.getCaseSubjectAmount());
caseApplicationNew.setLoanStartDate(caseApplicationinsertDiffer.getLoanStartDate());
caseApplicationNew.setLoanEndDate(caseApplicationinsertDiffer.getLoanEndDate());
caseApplicationNew.setContractNumber(caseApplicationinsertDiffer.getContractNumber());
caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
}
}
@@ -0,0 +1,98 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.service.IdentityAuthenticationService;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.ocr.v20181119.OcrClient;
import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRRequest;
import com.tencentcloudapi.ocr.v20181119.models.RecognizeTableAccurateOCRResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Base64;
@Service
public class IdentityAuthenticationServiceImpl implements IdentityAuthenticationService {
@Value("${identityAuthentication.credentialSecretId}")
private String credentialSecretId;
@Value("${identityAuthentication.credentialSecretKey}")
private String credentialSecretKey;
@Autowired
private IdentityAuthenticationMapper identityAuthenticationMapper;
private static final Logger log = LoggerFactory.getLogger(IdentityAuthenticationServiceImpl.class);
@Override
public IdentityAuthentication selectIdentityInformation() {
IdentityAuthentication identityAuthentication = new IdentityAuthentication();
try{
Credential credIdentityAuthentication = new Credential(credentialSecretId, credentialSecretKey);
HttpProfile httpProfileIdentityAuthentication = new HttpProfile();
httpProfileIdentityAuthentication.setEndpoint("ocr.tencentcloudapi.com");
String imagePathIdentityAuthentication = "本地png/jpg文件的绝对地址";
InputStream inputStreamIdentityAuthentication = null;
byte[] buffer = null;
//读取图片字节数组
try {
inputStreamIdentityAuthentication = new FileInputStream(imagePathIdentityAuthentication);
int count = 0;
while (count == 0) {
count = inputStreamIdentityAuthentication.available();
}
buffer = new byte[count];
inputStreamIdentityAuthentication.read(buffer);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (inputStreamIdentityAuthentication != null) {
try {
// 关闭inputStream流
inputStreamIdentityAuthentication.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String imageBase64IdentityAuthentication = Base64.getEncoder().encodeToString(buffer);
ClientProfile clientProfileIdentityAuthentication = new ClientProfile();
clientProfileIdentityAuthentication.setHttpProfile(httpProfileIdentityAuthentication);
OcrClient clientIdentityAuthentication = new OcrClient(credIdentityAuthentication, "ap-shanghai", clientProfileIdentityAuthentication);
RecognizeTableAccurateOCRRequest reqIdentityAuthentication = new RecognizeTableAccurateOCRRequest();
reqIdentityAuthentication.setImageBase64(imageBase64IdentityAuthentication);
RecognizeTableAccurateOCRResponse respIdentityAuthentication = clientIdentityAuthentication.RecognizeTableAccurateOCR(reqIdentityAuthentication);
String stringRes = RecognizeTableAccurateOCRResponse.toJsonString(respIdentityAuthentication);
JSONObject stringObjectRes = (JSONObject) JSON.parse(stringRes);
JSONObject stringres = (JSONObject) stringObjectRes.get("Response");
identityAuthentication.setName(stringres.get("name").toString());
identityAuthentication.setIdentityNo(stringres.get("IdNum").toString());
// System.out.println(RecognizeTableAccurateOCRResponse.toJsonString(respIdentityAuthentication);
} catch (TencentCloudSDKException e) {
log.error("身份认证失败", e);
}
return identityAuthentication;
}
}