This commit is contained in:
18792927508
2023-12-20 09:15:28 +08:00
parent 547394f8d6
commit 20c95700ab
25 changed files with 1277 additions and 800 deletions
@@ -0,0 +1,22 @@
package com.ruoyi.wisdomarbitrate;
import lombok.Data;
import java.util.List;
@Data
public class StringIdsReq {
private List<String> ids;
/**
* 签署人账号(即仲裁员手机号)
*/
private String psnAccount;
/**
* 签署人id
*/
private String psnId ;
/**
* 机构账户
*/
private String orgId ;
}
@@ -408,4 +408,10 @@ public class CaseApplication extends BaseEntity {
* 自定义字段
*/
private List<ColumnValue> columnValues;
/**
* 待办状态,0待办,1已办
*/
private Integer pendingStatus;
/** e签宝流程id */
private String signFlowId;;
}
@@ -1,7 +1,13 @@
package com.ruoyi.wisdomarbitrate.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class SealSignRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
@@ -25,15 +31,6 @@ public class SealSignRecord extends BaseEntity {
private String orgnizeNamepsnName;
String fileDownloadUrl;
public String getFileDownloadUrl() {
return fileDownloadUrl;
}
public void setFileDownloadUrl(String fileDownloadUrl) {
this.fileDownloadUrl = fileDownloadUrl;
}
/** 流程状态 */
private Integer signFlowStatus;
/** 签名状态 */
@@ -44,171 +41,11 @@ public class SealSignRecord extends BaseEntity {
/** 签名链接 */
private String signUrl;
public String getSignUrl() {
return signUrl;
}
public void setSignUrl(String signUrl) {
this.signUrl = signUrl;
}
public String getSealUrl() {
return sealUrl;
}
public void setSealUrl(String sealUrl) {
this.sealUrl = sealUrl;
}
/** 用印链接 */
private String sealUrl;
private Long caseAppliId;
public Long getCaseAppliId() {
return caseAppliId;
}
public void setCaseAppliId(Long caseAppliId) {
this.caseAppliId = caseAppliId;
}
public Integer getPsnsignStatus() {
return psnsignStatus;
}
public void setPsnsignStatus(Integer psnsignStatus) {
this.psnsignStatus = psnsignStatus;
}
public Integer getOrgsignStatus() {
return orgsignStatus;
}
public void setOrgsignStatus(Integer orgsignStatus) {
this.orgsignStatus = orgsignStatus;
}
public Integer getSignFlowStatus() {
return signFlowStatus;
}
public void setSignFlowStatus(Integer signFlowStatus) {
this.signFlowStatus = signFlowStatus;
}
public String getFileid() {
return fileid;
}
public void setFileid(String fileid) {
this.fileid = fileid;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getSignFlowid() {
return signFlowid;
}
public void setSignFlowid(String signFlowid) {
this.signFlowid = signFlowid;
}
public String getPensonAccount() {
return pensonAccount;
}
public void setPensonAccount(String pensonAccount) {
this.pensonAccount = pensonAccount;
}
public String getPensonName() {
return pensonName;
}
public void setPensonName(String pensonName) {
this.pensonName = pensonName;
}
public String getOrgnizeName() {
return orgnizeName;
}
public void setOrgnizeName(String orgnizeName) {
this.orgnizeName = orgnizeName;
}
public String getOrgnizeNamePsnAccount() {
return orgnizeNamePsnAccount;
}
public void setOrgnizeNamePsnAccount(String orgnizeNamePsnAccount) {
this.orgnizeNamePsnAccount = orgnizeNamePsnAccount;
}
public String getOrgnizeNamepsnName() {
return orgnizeNamepsnName;
}
public void setOrgnizeNamepsnName(String orgnizeNamepsnName) {
this.orgnizeNamepsnName = orgnizeNamepsnName;
}
public String getPositionPagepsn() {
return positionPagepsn;
}
public void setPositionPagepsn(String positionPagepsn) {
this.positionPagepsn = positionPagepsn;
}
public double getPositionXpsn() {
return positionXpsn;
}
public void setPositionXpsn(double positionXpsn) {
this.positionXpsn = positionXpsn;
}
public double getPositionYpsn() {
return positionYpsn;
}
public void setPositionYpsn(double positionYpsn) {
this.positionYpsn = positionYpsn;
}
public String getPositionPageorg() {
return positionPageorg;
}
public void setPositionPageorg(String positionPageorg) {
this.positionPageorg = positionPageorg;
}
public double getPositionXorg() {
return positionXorg;
}
public void setPositionXorg(double positionXorg) {
this.positionXorg = positionXorg;
}
public double getPositionYorg() {
return positionYorg;
}
public void setPositionYorg(double positionYorg) {
this.positionYorg = positionYorg;
}
/** 签名位置页数 */
private String positionPagepsn;
/** 签名位置x坐标 */
@@ -223,13 +60,5 @@ public class SealSignRecord extends BaseEntity {
private double positionYorg;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
@@ -38,7 +38,7 @@ public interface CaseApplicationLogMapper {
Integer selectMaxVersionBySecret(@Param("caseAppliId")Long id);
/**
* 根据案件id删除案件记录表和案件关联人日志表
* 删除日志
* @param ids
*/
void batchDeleteLog(@Param("ids") List<Long> ids);
@@ -46,4 +46,11 @@ public interface CaseApplicationLogMapper {
CaseApplication selectBeforeCase(@Param("caseId") Long caseId, @Param("version")Integer version);
Integer batchSave(@Param("list")List<CaseApplication> caseApplications);
/**
* 根据案件id查询所有的日志id
* @param ids
* @return
*/
List<Long> selectLogsByCaseIds(@Param("ids")List<Long> ids);
}
@@ -2,15 +2,29 @@ package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SealSignRecordMapper {
List<SealSignRecord> selectSealSignRecord(SealSignRecord sealSignRecord);
/**
* 查询已签署和签署中的文件
* @param sealSignRecord
* @return
*/
List<SealSignRecord> selectSealSignRecordbyStat(SealSignRecord sealSignRecord);
/**
* 差询等待签署,签署中的案件
* @param penSonAccount 签署人员
* @return
*/
List<CaseApplication> selectSealSigning(@Param("penSonAccount") String penSonAccount, @Param("caseStatus") Integer caseStatus);
int updataSealSignRecord(SealSignRecord sealSignRecord);
@@ -1,8 +1,10 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.BatchCaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
import java.util.List;
@@ -39,4 +41,20 @@ public interface IAdjudicationService {
* @return
*/
AjaxResult batchDocument(List<Long> ids);
/**
* 根据签署流程id查询批量签名链接
* @param idsReq
* @return
*/
SealSignRecord selectBatchSignUrl( StringIdsReq idsReq);
/**
* 根据仲裁员手机号分页查询等待签署,签署中的裁决书
* @param personAccount
* @return
*/
List<CaseApplication> selectSealSigning(String personAccount,Integer caseStatus);
SealSignRecord selectBatchSealUrl(StringIdsReq idsReq);
}
@@ -135,4 +135,5 @@ public interface ICaseApplicationService {
AjaxResult editCaseApplicationDefineval(CaseApplication caseApplication);
CaseAttach downloadCaseZipFile(CaseApplication caseApplication);
}
@@ -6,13 +6,15 @@ import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.dto.CaseConfirmPayDTO;
import com.ruoyi.wisdomarbitrate.domain.dto.CasePayDTO;
import java.util.List;
public interface ICasePaymentService {
/**
* 案件缴费
*/
AjaxResult casePay(CasePayDTO casePayDTO);
AjaxResult confirmPayment(CaseApplication caseApplication);
AjaxResult confirmPayment( List<Long> ids);
/**
* 确认缴费
@@ -5,15 +5,21 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.deepoove.poi.data.PictureRenderData;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.ruoyi.common.constant.CaseApplicationConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.EsignDemoException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.thread.MultipleThreadListParam;
import com.ruoyi.common.utils.thread.MultipleThreadWorkUtil;
import com.ruoyi.system.mapper.SysDictDataMapper;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO;
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
import com.ruoyi.wisdomarbitrate.mapper.*;
@@ -24,6 +30,7 @@ import com.ruoyi.wisdomarbitrate.domain.vo.LogisticsInfoVO;
import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.service.ICaseLogRecordService;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@@ -57,6 +64,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static com.ruoyi.common.utils.PageUtils.startPage;
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
@Service
@@ -92,9 +100,14 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
private FatchRuleMapper fatchRuleMapper;
@Autowired
private SysDictDataMapper dictDataMapper;
@Autowired
private SealManageMapper sealManageMapper;
@Autowired
private SealSignRecordMapper sealSignRecordMapper;
// 仲裁反请求模板内容
private final String counterclaim= "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
private final String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
"《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
"仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。";
// 财产保全内容
@@ -104,36 +117,37 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" +
",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。";
// 线上开庭时+线上仲裁
String onLineDate="{{onLineDate}}";
String onLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+onLineDate+"通过仲裁委智慧仲裁平台开庭审理了本案。";
String onLineDate = "{{onLineDate}}";
String onLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于" + onLineDate + "通过仲裁委智慧仲裁平台开庭审理了本案。";
// 开庭+线下仲裁
String offLineDate="{{offLineDate}}";
String offLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于 "+offLineDate+"在仲裁委所在地开庭审理了本案。";
String offLineDate = "{{offLineDate}}";
String offLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于 " + offLineDate + "在仲裁委所在地开庭审理了本案。";
//书面仲裁时
String writtenDate="{{writtenDate}}";
String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+writtenDate+"在仲裁委所在地开庭审理了本案。仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,根据《2022年版仲裁规则》第五十八条的规定对本案进行了书面审理。 ";
String writtenDate = "{{writtenDate}}";
String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于" + writtenDate + "在仲裁委所在地开庭审理了本案。仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,根据《2022年版仲裁规则》第五十八条的规定对本案进行了书面审理。 ";
//开庭+缺席审理
String absent = "申请人的特别授权委托代理人{{agentName}}"+"出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
String absent = "申请人的特别授权委托代理人{{agentName}}" + "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
"《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明,\" +\n" +
" \"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"+"综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
" \"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。" + "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" +
"第四十条第(二)项、第五十一条的规定,缺席裁决如下:";
// 开庭+出席
String attend="申请人的特别授权委托代理人{{agentName}}和被申请人本人出席了庭审。 ";
String attend = "申请人的特别授权委托代理人{{agentName}}和被申请人本人出席了庭审。 ";
// 开庭+出席+被申提供证据
String onLineAttendFile="庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;双方当事人均出示了证据材料并对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 ";
String onLineAttendFile = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;双方当事人均出示了证据材料并对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 ";
// 开庭+出席+被申未提供证据
String onLineAttend="庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;申请人出示了证据材料,被申请人对对方的证据材料进行了质证; 双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 ";
String onLineAttend = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;申请人出示了证据材料,被申请人对对方的证据材料进行了质证; 双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 ";
// 被申请人出席答辩意见
String resAttendOpinion="\n(二)被申请人的答辩意见 \n(三)当事人提供的证据材料及对方的质证意见\n" +
String resAttendOpinion = "\n(二)被申请人的答辩意见 \n(三)当事人提供的证据材料及对方的质证意见\n" +
"申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}\n被申请人对上述材料的质证意见为:{{respondentOpinion}}\n";
// 被申请人出席+被申请人提供了资料
String resFile="被申请人向仲裁庭提交了如下证据材料:\n{{resFile}}" +
String resFile = "被申请人向仲裁庭提交了如下证据材料:\n{{resFile}}" +
"申请人对上述材料的质证意见为:{{applicantOpinion}}";
// 被申请人缺席
String resAbsent="(二)当事人提供的证据材料\n" +
String resAbsent = "(二)当事人提供的证据材料\n" +
"申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}";
// 日期格式化年月日
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
@Override
@Transactional
public AjaxResult createDocument(CaseApplication caseApplicationReq) {
@@ -161,13 +175,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.error("请先指定裁决书模板");
}
templatePath = templateManages.get(0).getTemOrigPath();
if(StrUtil.isEmpty(templatePath)){
if (StrUtil.isEmpty(templatePath)) {
return AjaxResult.error("未找到该模板");
}
// todo 部署放开
if(templatePath!=null){
templatePath="/home/ruoyi/" +templatePath;
if (templatePath != null) {
templatePath = "/home/ruoyi/" + templatePath;
}
try {
File file = new File(templatePath);
@@ -198,15 +212,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
}
// 自定义字段,从columnValue值取
if (fatchRuleMap.size()>0&&fatchRuleMap.containsKey(1)) {
if (fatchRuleMap.size() > 0 && fatchRuleMap.containsKey(1)) {
// 根据案件id查询key-value表
List<ColumnValue> columnValueList = columnValueMapper.listByCaseId(caseApplicationReq.getId());
if (CollectionUtil.isNotEmpty(columnValueList)) {
columnValueList.forEach(columnValue -> valueMap.put(columnValue.getName(), columnValue.getValue()));
}
}
// 组装内置字段,在主表中查出内容
buildDefaultColumnValue(dictDataList,caseAffiliates,valueMap,caseApplicationById);
// 组装内置字段,在主表中查出内容
buildDefaultColumnValue(dictDataList, caseAffiliates, valueMap, caseApplicationById);
// 获取模板中的占位符key
List<String> bookmarkList = getBookmarkByDocx(templatePath);
@@ -214,9 +228,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.success("请检查模板是否配置正确,未获取到占位符");
}
// 遍历书签,给书签赋值
replaceBookmark(bookmarkList,datas,valueMap);
replaceBookmark(bookmarkList, datas, valueMap);
// 根据条件替换书签
conditionReplaceBookmark(caseApplicationById,datas,agentName,resName,arbitrateRecordSelect);
conditionReplaceBookmark(caseApplicationById, datas, agentName, resName, arbitrateRecordSelect);
// 裁决书生成时间
LocalDate now = LocalDate.now();
String year = Integer.toString(now.getYear());
@@ -226,7 +240,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
// 裁决书编号
datas.put("裁决书编号", equipmentNo);
// 仲裁费
datas.put("仲裁费", caseApplicationById.getFeePayable().toString());
datas.put("仲裁费", caseApplicationById.getFeePayable() != null ? caseApplicationById.getFeePayable().toString() : "");
// 案件创建时间
Date createTime = caseApplicationById.getCreateTime();
// 将日期格式化为字符串
@@ -248,7 +262,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String saveName = "/profile/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// String saveName = "D:/home/ruoyi/uploadPath/upload/" + year + "/" + month + "/" + day + "/" + fileName;
// 将word中的标签替换掉,生成新的word
String docFilePath = wordChangeText(templatePath,datas,saveFolderPath,fileName);
String docFilePath = wordChangeText(templatePath, datas, saveFolderPath, fileName);
String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8);
// 保存裁决书附件
@@ -262,14 +276,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 将word中的标签替换掉,生成新的word
* @param modalFilePath 裁决书模板路径
* @param datas 替换标签的内容
*
* @param modalFilePath 裁决书模板路径
* @param datas 替换标签的内容
* @param saveFolderPath 保存路径
* @param fileName 保存文件名
* @param fileName 保存文件名
* @return
* @throws IOException
*/
private String wordChangeText(String modalFilePath, Map<String, Object> datas, String saveFolderPath,String fileName) throws IOException {
private String wordChangeText(String modalFilePath, Map<String, Object> datas, String saveFolderPath, String fileName) throws IOException {
String resultFilePath = saveFolderPath + "/" + fileName;
// 创建日期目录
File saveFolder = new File(saveFolderPath);
@@ -291,13 +306,14 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 根据条件判断裁决书中是否需要该内容
* @param caseApplicationById 案件信息
* @param datas 替换标签值
* @param agentName 代理人名称
* @param resName 被申请人名称
* @param arbitrateRecordSelect 仲裁记录
*
* @param caseApplicationById 案件信息
* @param datas 替换标签值
* @param agentName 代理人名称
* @param resName 被申请人名称
* @param arbitrateRecordSelect 仲裁记录
*/
private void conditionReplaceBookmark(CaseApplication caseApplicationById, Map<String, Object> datas,String agentName,String resName, ArbitrateRecord arbitrateRecordSelect ) {
private void conditionReplaceBookmark(CaseApplication caseApplicationById, Map<String, Object> datas, String agentName, String resName, ArbitrateRecord arbitrateRecordSelect) {
// 如果有仲裁反请求,该字段设置值
Integer adjudicaCounter = caseApplicationById.getAdjudicaCounter();
if (adjudicaCounter != null && adjudicaCounter == 1) {
@@ -344,7 +360,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
// todo 线上仲裁/线下仲裁方式未选择
//线上开庭时+线上仲裁
if (arbitratMethod!=null&&arbitratMethod == 1) {
if (arbitratMethod != null && arbitratMethod == 1) {
String replace = onLine.replace(onLineDate, Optional.of(hearDateStr).orElse(""));
datas.put("线上开庭并线上仲裁", replace);
// 所有附件
@@ -418,9 +434,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 给模板中的占位符赋值
*
* @param bookmarkList 书签
* @param datas 书签赋值
* @param valueMap 案件内容
* @param datas 书签赋值
* @param valueMap 案件内容
*/
private void replaceBookmark(List<String> bookmarkList, Map<String, Object> datas, Map<String, String> valueMap) {
for (String bookmark : bookmarkList) {
@@ -454,9 +471,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 组装案件内置字段值,即主表和相关人员表信息
* @param dictDataList 内置字段
*
* @param dictDataList 内置字段
* @param caseAffiliates 关联人员
* @param valueMap 组装的值
* @param valueMap 组装的值
*/
private void buildDefaultColumnValue(List<SysDictData> dictDataList, List<CaseAffiliate> caseAffiliates, Map<String, String> valueMap, CaseApplication caseApplication) {
if (CollectionUtil.isNotEmpty(dictDataList)) {
@@ -479,6 +497,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
case "被申请人住所":
valueMap.put(dictData.getDictLabel(), affiliate.getResidenAffili());
break;
case "被申请人联系地址":
valueMap.put(dictData.getDictLabel(), affiliate.getContactAddress());
break;
case "被申请人联系电话":
valueMap.put(dictData.getDictLabel(), affiliate.getContactTelphone());
break;
@@ -486,13 +507,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
valueMap.put(dictData.getDictLabel(), affiliate.getEmail());
break;
case "被申请人性别":
if (dictData.getDictLabel().equals("被申请人性别")) {
String responSex = affiliate.getResponSex();
if (responSex.equals("0")) {
valueMap.put(dictData.getDictLabel(), "男");
} else {
valueMap.put(dictData.getDictLabel(), "女");
}
String responSex = affiliate.getResponSex();
if (responSex.equals("0")) {
valueMap.put(dictData.getDictLabel(), "男");
} else {
valueMap.put(dictData.getDictLabel(), "女");
}
break;
case "被申请人出生年月日":
@@ -545,10 +564,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
default:
break;
}
}else {
} else {
valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(caseApplication, dictData.getDictValue()));
}
}else {
} else {
valueMap.put(dictData.getDictLabel(), ObjectFieldUtils.getValue(caseApplication, dictData.getDictValue()));
}
@@ -558,10 +577,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 保存裁决书附件
* @param id 案件id
* @param saveName 保存的文件名
* @param savePath 保存路径
* @param caseApplicationById 案件基本信息
*
* @param id 案件id
* @param saveName 保存的文件名
* @param savePath 保存路径
* @param caseApplicationById 案件基本信息
* @param arbitrateRecordSelect 出裁决书生成记录
*/
private void saveArbitorFile(Long id, String saveName, String savePath, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect) {
@@ -770,10 +790,11 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String prefix = "/profile/upload/";
int startIndex = prefix.length();
String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
File file = new File(path);
if(!file.exists()){
return AjaxResult.error("未生成裁决书");
}
File file = new File(path);
// todo 部署放开
if (!file.exists()) {
return AjaxResult.error("未生成裁决书");
}
}
}
@@ -798,78 +819,105 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
}
}
//发送邮件
boolean b = sendCaseEmail(caseApplication1, appEmail, resEmail,caseAttachList);
//申请人发送邮件
boolean appEmailFlag = sendCaseEmail(caseApplication1, appEmail, caseAttachList);
SendMailRecord sendMailRecord = new SendMailRecord();
sendMailRecord.setCaseId(id);
sendMailRecord.setMailAddress(appEmail);
sendMailRecord.setMailContent("您好,审核后的裁决书在附件中请查阅");
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord.setMailName("签署后的裁决书");
sendMailRecord.setSendTime(new Date());
sendMailRecord.setCreateBy(getUsername());
if (b) {
if (appEmailFlag) {
sendMailRecord.setSendStatus(1);
} else {
sendMailRecord.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord);
// 被申请人发送邮件
boolean resEmailFlag = sendCaseEmail(caseApplication1, resEmail, caseAttachList);
SendMailRecord sendMailRecord1 = new SendMailRecord();
sendMailRecord1.setCaseId(id);
sendMailRecord1.setMailAddress(resEmail);
// sendMailRecord.setMailContent("您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅");
sendMailRecord1.setMailContent("您好,审核后的裁决书在附件中请查阅");
sendMailRecord1.setMailName("签署后的裁决书");
sendMailRecord1.setSendTime(new Date());
sendMailRecord1.setCreateBy(getUsername());
if (b) {
if (resEmailFlag) {
sendMailRecord1.setSendStatus(1);
// 发送短信
if(CollectionUtil.isNotEmpty(caseAffiliates)) {
}else {
sendMailRecord1.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
if(!appEmailFlag&&!resEmailFlag){
throw new ServiceException("裁决书发送失败");
}
if(!appEmailFlag){
throw new ServiceException("申请人裁决书发送失败");
}
if(!resEmailFlag){
throw new ServiceException("被申请人裁决书发送失败");
}
// 发送短信
if (appEmailFlag||resEmailFlag) {
if (CollectionUtil.isNotEmpty(caseAffiliates)) {
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1990362");
for (CaseAffiliate affiliate : caseAffiliates) {
String telphone=null;
if(appEmailFlag&&affiliate.getIdentityType()==1){
telphone = affiliate.getContactTelphone();
}else if(resEmailFlag&&affiliate.getIdentityType()==2){
telphone = affiliate.getContactTelphone();
}
if(StrUtil.isEmpty(telphone)){
continue;
}
request.setPhone(affiliate.getContactTelphone());
request.setPhone(telphone);
// if(affiliate.getIdentityType() == 1) {
// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), appEmail});
// }else {
// request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum(), resEmail});
// }
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplication1.getCaseNum()});
request.setTemplateParamSet(new String[]{affiliate.getName(), caseApplication1.getCaseNum()});
Boolean aBoolean = SmsUtils.sendSms(request);
// 保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
// 保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseAffiliate.getCaseAppliId());
smsSendRecord.setCaseNum(caseApplication1.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
smsSendRecord.setCaseNum(caseApplication1.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
// // 尊敬的{1}用户,您的{2}仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。
// if(affiliate.getIdentityType() == 1) {
// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +appEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
// }else {
// smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达至" +resEmail+"邮箱,请知晓,如非本人操作,请忽略本短信。");
// }
smsSendRecord.setSendContent("尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。");
smsSendRecord.setSendContent("尊敬的" + affiliate.getName() + "用户,您的" + caseApplication1.getCaseNum() + "仲裁案件,裁决书已送达,请知晓,如非本人操作,请忽略本短信。");
smsSendRecord.setCreateBy(getUsername());
if (aBoolean) {
smsSendRecord.setSendStatus(1);
} else {
smsSendRecord.setSendStatus(0);
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
if (aBoolean) {
smsSendRecord.setSendStatus(1);
} else {
smsSendRecord.setSendStatus(0);
}
smsRecordMapper.saveSmsSendRecord(smsSendRecord);
}
}
} else {
sendMailRecord1.setSendStatus(0);
}
sendMailRecordMapper.saveSendMailRecord(sendMailRecord1);
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_FILING, "");
@@ -881,10 +929,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
* 通过邮件发送裁决书文件
*
* @param caseApplication1
* @param appEmail
* @param resEmail
*/
private boolean sendCaseEmail(CaseApplication caseApplication1, String appEmail, String resEmail, List<CaseAttach> caseAttachList) {
private boolean sendCaseEmail(CaseApplication caseApplication1, String email, List<CaseAttach> caseAttachList) {
List<File> fileList = new ArrayList<>();
File file = null;
if (caseAttachList != null && caseAttachList.size() > 0) {
@@ -894,7 +940,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String prefix = "/profile/upload/";
int startIndex = prefix.length();
String path = caseAttach.getAnnexPath() + annexName.substring(startIndex);
// todo 部署放开
file = new File(path);
// file = new File("D:\\home\\ruoyi\\uploadPath\\upload\\2023\\09\\b10b20d66cfa44df8995c3999e3b6266.pdf");
fileList.add(file);
System.out.println("文件长度==================:" + file.length());
}
@@ -903,9 +951,19 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
if (file != null && file.exists()) {
try {
Boolean aBoolean = emailOutUtil.sendEmil(appEmail, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null);
Boolean aBoolean1 = emailOutUtil.sendEmil(resEmail, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null);
if (aBoolean && aBoolean1) {
Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,审核后的裁决书在附件中请查阅", "签署后的裁决书", fileList, null);
// String appUid = UUID.randomUUID().toString();
// Boolean aBoolean = emailOutUtil.sendEmil(email, "您好,您的{"+caseApplication1.getCaseNum()+"}案件,审核后的裁决书在附件中请查阅", appUid +"裁决书", fileList, null);
// // Thread.sleep(20);
// 收到退信的所有id,即发送失败的uuid
// emailOutUtil.receiverMail();
// Thread.sleep(3);
// List<String> messageIds = emailOutUtil.receiverMail();
// if (aBoolean&&(CollectionUtil.isEmpty(messageIds)||!messageIds.contains(appUid))) {
// return Boolean.TRUE;
// }
if (aBoolean) {
return Boolean.TRUE;
}
} catch (Exception e) {
@@ -1255,14 +1313,16 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
return AjaxResult.success(bookSendVO);
}
private void setExecList(List<MultipleThreadListParam> execList, List<ColumnValue> columnValueList){
if(CollectionUtil.isNotEmpty(columnValueList)){
Function<List<ColumnValue>,Integer> function= columnValueMapper::batchSave;
execList.add(new MultipleThreadListParam(function,columnValueList));
private void setExecList(List<MultipleThreadListParam> execList, List<ColumnValue> columnValueList) {
if (CollectionUtil.isNotEmpty(columnValueList)) {
Function<List<ColumnValue>, Integer> function = columnValueMapper::batchSave;
execList.add(new MultipleThreadListParam(function, columnValueList));
}
}
@Transactional
@Transactional
@Override
public AjaxResult batchDocument(List<Long> ids) {
// todo 多线程生成裁决书
@@ -1283,6 +1343,104 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
return AjaxResult.success();
}
/**
* 根据签署流程id查询批量签名链接
*
* @param idsReq
* @return
*/
@Override
public SealSignRecord selectBatchSignUrl(StringIdsReq idsReq) {
SealSignRecord signRecord = new SealSignRecord();
try {
EsignHttpResponse identityInfo = SignAward.identityInfo(idsReq);
Gson gson = new Gson();
if (StrUtil.isNotEmpty(identityInfo.getBody())) {
JsonObject identityInfoJsonObject = gson.fromJson(identityInfo.getBody(), JsonObject.class);
if (identityInfoJsonObject != null && !identityInfoJsonObject.get("data").isJsonNull()) {
JsonObject identityInfoData = identityInfoJsonObject.getAsJsonObject("data");
if (identityInfoData != null && !identityInfoData.get("psnId").isJsonNull()) {
idsReq.setPsnId(identityInfoData.get("psnId").getAsString());
}
}
}
if (StrUtil.isEmpty(idsReq.getPsnId())) {
throw new ServiceException("该用户未认证");
}
EsignHttpResponse batchSignUrl = SignAward.batchSignUrl(idsReq);
if (StrUtil.isNotEmpty(batchSignUrl.getBody())) {
JsonObject signUrlJsonObject = gson.fromJson(batchSignUrl.getBody(), JsonObject.class);
if (signUrlJsonObject != null && !signUrlJsonObject.get("data").isJsonNull()) {
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
if (signUrlData != null && !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) {
// 免登录批量签链接(链接有效期2小时)
String url = signUrlData.get("batchSignUrlWithoutLogin").getAsString();
// batchSignUrl 需登录批量签链接(链接有效期2小时),batchSignShortUrl需登录批量签短链接(链接有效期2小时),batchSignShortUrlWithoutLogin免登录批量签短链接(链接有效期2小时)
signRecord.setSignUrl(url);
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
}
return signRecord;
}
@Override
public SealSignRecord selectBatchSealUrl(StringIdsReq idsReq) {
SealSignRecord signRecord = new SealSignRecord();
try {
EsignHttpResponse identityInfo = SignAward.identityInfo(idsReq);
Gson gson = new Gson();
if (StrUtil.isNotEmpty(identityInfo.getBody())) {
JsonObject identityInfoJsonObject = gson.fromJson(identityInfo.getBody(), JsonObject.class);
if(identityInfoJsonObject!=null&&!identityInfoJsonObject.get("data").isJsonNull()) {
JsonObject identityInfoData = identityInfoJsonObject.getAsJsonObject("data");
if (identityInfoData != null && !identityInfoData.get("psnId") .isJsonNull()) {
idsReq.setPsnId(identityInfoData.get("psnId").getAsString());
}
}
}
if (StrUtil.isEmpty(idsReq.getPsnId())) {
throw new ServiceException("该用户未认证");
}
EsignHttpResponse batchSignUrl = SignAward.batchSignUrl(idsReq);
if (StrUtil.isNotEmpty(batchSignUrl.getBody())) {
JsonObject signUrlJsonObject = gson.fromJson(batchSignUrl.getBody(), JsonObject.class);
if (signUrlJsonObject != null && !signUrlJsonObject.get("data").isJsonNull()) {
JsonObject signUrlData = signUrlJsonObject.getAsJsonObject("data");
if (signUrlData != null&& !signUrlData.get("batchSignUrlWithoutLogin").isJsonNull()) {
// 免登录批量签链接(链接有效期2小时)
String url = signUrlData.get("batchSignUrlWithoutLogin").getAsString();
// batchSignUrl 需登录批量签链接(链接有效期2小时),batchSignShortUrl需登录批量签短链接(链接有效期2小时),batchSignShortUrlWithoutLogin免登录批量签短链接(链接有效期2小时)
signRecord.setSignUrl(url);
}
}
}
} catch (EsignDemoException e) {
e.printStackTrace();
}
return signRecord;
}
/**
* 根据仲裁员手机号分页查询等待签署,签署中的裁决书
*
* @param personAccount 仲裁员手机号
* @return
*/
@Override
public List<CaseApplication> selectSealSigning(String personAccount, Integer caseStatus) {
return sealSignRecordMapper.selectSealSigning(personAccount, caseStatus);
}
public String getNewEquipmentNo() {
Object awardNum = redisCache.getCacheObject("awardNum");
if (awardNum == null) {
@@ -1311,33 +1469,34 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
/**
* 根据裁决书模板获取所有的占位符,占位符必须是{{name}}格式
*
* @param path
* @return
*/
public List<String> getBookmarkByDocx(String path){
public List<String> getBookmarkByDocx(String path) {
XWPFDocument xwpfDocument = null;
try {
log.error("path===="+path);
log.error("path====" + path);
FileInputStream fileInputStream = new FileInputStream(path);
log.error("fileInputStream====");
xwpfDocument = new XWPFDocument(fileInputStream);
log.error("xwpfDocument===="+xwpfDocument);
log.error("xwpfDocument====" + xwpfDocument);
} catch (IOException e) {
e.printStackTrace();
}
if(xwpfDocument==null){
if (xwpfDocument == null) {
return new ArrayList<>();
}
List<XWPFParagraph> paragraphs = xwpfDocument.getParagraphs();
if(CollectionUtil.isEmpty( xwpfDocument.getParagraphs())){
if (CollectionUtil.isEmpty(xwpfDocument.getParagraphs())) {
return new ArrayList<>();
}
String regex = "\\{\\{.*?\\}\\}"; // 定义占位符的正则表达式
Pattern pattern = Pattern.compile(regex);
List<String> bookmarkList=new ArrayList<>();
List<String> bookmarkList = new ArrayList<>();
for (XWPFParagraph paragraph : paragraphs) {
String text = paragraph.getText();
if(StrUtil.isNotEmpty(text)) {
if (StrUtil.isNotEmpty(text)) {
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
@@ -1351,6 +1510,4 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
}
@@ -160,11 +160,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 查询登录人身份证号
SysUser sysUser = sysUserMapper.selectUserById(userId);
startPage();
// 已办案件
if (caseApplication.getSelectCaseStatus().equals("1")) {
caseApplication.setLoginUserName(sysUser.getUserName());
return caseApplicationMapper.selectHandledCase(caseApplication);
} else { // 待办案件
caseApplication.setLoginUserName(sysUser.getUserName());
List<SysRole> roles = sysUser.getRoles();
// 没有角色不能查看案件列表
if (CollectionUtil.isEmpty(roles)) {
@@ -228,7 +224,6 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
// return caseApplicationMapper.selectCaseApplicationList(caseApplication);
return caseApplicationMapper.selectCaseApplicationList1(caseApplication);
}
}
@@ -1083,7 +1078,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setFeePayable(feePayable);
caseApplication.setUpdateBy(getUsername());
Integer applicantIsWrittenHear = caseApplication.getApplicantIsWrittenHear();
if(applicantIsWrittenHear.intValue()==1){
if(applicantIsWrittenHear!=null&&applicantIsWrittenHear.intValue()==1){
//书面审理
caseApplication.setArbitratMethod(2);
}else {
@@ -1396,9 +1391,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
@Transactional
public int deletecaseApplicationByIds(List<Long> ids) {
// 查出所有的日志id
List<Long> logIds= caseApplicationLogMapper.selectLogsByCaseIds(ids);
int rows = caseApplicationMapper.batchDeletecaseApplication(ids);
caseAffiliateMapper.batchDeletecaseAffiliate(ids);
// caseApplicationLogMapper.batchDeleteLog(ids);
// 删除日志
if(CollectionUtil.isNotEmpty(logIds)) {
caseApplicationLogMapper.batchDeleteLog(logIds);
}
return rows;
}
@@ -1674,7 +1673,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
ArbitrateRecord arbitrateRecord = caseApplication.getArbitrateRecord();
arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord);
Integer agreeOrNotCheck = caseApplication.getAgreeOrNotCheck();
if (agreeOrNotCheck.intValue() == 1) {//同意审核
if (agreeOrNotCheck!=null&&agreeOrNotCheck.intValue() == 1) {//同意审核
try {
//获取当前案件的裁决书
CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication);
@@ -2917,8 +2916,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Transactional
@Override
public AjaxResult uploadCaseZipFile(MultipartFile file, Long templateId) {
AjaxResult ajaxResult = caseZipImportImpl.zipImport( file, templateId);
return ajaxResult;
return caseZipImportImpl.zipImport( file, templateId);
}
@@ -79,22 +79,42 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
//根据案件id查询案件证据材料
List<CaseAttach> evidenceMaterialList = caseAttachMapper.queryAnnexPathByCaseId(id);
if (evidenceMaterialList != null && evidenceMaterialList.size() > 0) {
for (CaseAttach caseAttach : evidenceMaterialList) {
//根据附件类型决定返回的路径
Integer annexType = caseAttach.getAnnexType();
if (annexType != 1){
String path = caseAttach.getAnnexName();
// for (CaseAttach caseAttach : evidenceMaterialList) {
// //根据附件类型决定返回的路径
// Integer annexType = caseAttach.getAnnexType();
// if (annexType != 1){
// String path = caseAttach.getAnnexName();
// String prefix = "/profile";
// int startIndex = path.indexOf(prefix);
// startIndex += prefix.length();
// String extractedPath = "/uploadPath" + path.substring(startIndex);
// caseAttach.setAnnexPath(extractedPath);
// }else {
// String annexPath = caseAttach.getAnnexPath();
// String result = annexPath.replace("/home/ruoyi", "");
// caseAttach.setAnnexPath(result);
// }
// }
for (CaseAttach caseAttach : evidenceMaterialList) {
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = path.indexOf(prefix);
startIndex += prefix.length();
String extractedPath = "/uploadPath" + path.substring(startIndex);
caseAttach.setAnnexPath(extractedPath);
}else {
String annexPath = caseAttach.getAnnexPath();
String result = annexPath.replace("/home/ruoyi", "");
caseAttach.setAnnexPath(result);
int startIndex = annexName.indexOf(prefix);
if(startIndex!=-1) {
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
caseAttach.setAnnexPath(annexPath);
}
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
caseAttach.setAnnexName(annexNamenew);
}
}
}
}
caseDetailVO.setEvidenceMaterialList(evidenceMaterialList);
}
@@ -106,10 +106,12 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
@Override
@Transactional
public AjaxResult confirmPayment(CaseApplication caseApplication) {
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
int i = caseApplicationMapper.submitCaseApplication(caseApplication);
if (i > 0) {
public AjaxResult confirmPayment( List<Long> ids) {
for (Long id : ids) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_CROSSEXAMI);
caseApplicationMapper.submitCaseApplication(caseApplication);
//发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -185,7 +187,8 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
return AjaxResult.success();
}
}
return AjaxResult.error("暂无需要确认的缴费清单");
return AjaxResult.success();
}
@Transactional
@@ -248,7 +251,6 @@ public class CasePaymentServiceImpl implements ICasePaymentService {
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());
@@ -25,6 +25,7 @@ import com.ruoyi.system.mapper.*;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue;
import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.task.CaseZipImportTask;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.wisdomarbitrate.utils.OCRUtils;
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
@@ -37,6 +38,8 @@ import java.io.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -70,8 +73,6 @@ public class CaseZipImportImpl {
@Autowired
private SysUserRoleMapper userRoleMapper;
@Autowired
private CaseApplicationLogMapper caseApplicationLogMapper;
@Autowired
private CaseAffiliateLogMapper caseAffiliateLogMapper;
@Autowired
private CaseAttachLogMapper caseAttachLogMapper;
@@ -85,11 +86,14 @@ public class CaseZipImportImpl {
private ColumnValueLogMapper columnValueLogMapper;
@Autowired
private CaseAffiliateMapper caseAffiliateMapper;
@Autowired
private CaseApplicationLogMapper caseApplicationLogMapper;
// 申请人角色id
private long roleId;
private Integer maxCaseNum;
private Integer maxBatchNumber;
public AjaxResult zipImport(MultipartFile file, Long templateId) {
UUID uuid = UUID.randomUUID();
// todo
@@ -113,51 +117,14 @@ public class CaseZipImportImpl {
boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath);
if (!unzipSuccess) {
// 解压失败
return AjaxResult.error("解压失败");
throw new ServiceException("解压失败");
}
// 查询抓取规则
// todo 批次需要再上传压缩包时用户填写
List<FatchRule> fatchRuleList = fatchRuleMapper.listByTemplateId(templateId);
if (CollectionUtil.isEmpty(fatchRuleList)) {
return error("未设置抓取规则");
throw new ServiceException("未设置抓取规则");
}
File directory = new File(targetPath);
// fileMap<caseId, List<File>>
Map<Long, List<File>> fileMap = findAndConvertPDF(directory);
if (fileMap == null || fileMap.size() <= 0) {
// 解压失败
return AjaxResult.error("未获取到文件");
}
Map<String, String> fatchMap = new HashMap<>();
if (CollectionUtil.isNotEmpty(fatchRuleList)) {
Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
// 根据抓取规则循环抓取
fileMap.forEach((key, fileList) -> {
if (CollectionUtil.isNotEmpty(fileList)) {
for (File caseFile : fileList) {
if (fatchRuleMap.containsKey(caseFile.getName())) {
// 抓取内容
List<FatchRule> fatchRules = fatchRuleMap.get(caseFile.getName());
getFatchContentList(caseFile, fatchMap, fatchRules, key);
}
}
}
});
}
if (fatchMap.size() <= 0) {
return error("从压缩包中未抓取到内容,请检查抓取字段配置");
}
// 尊敬的{1},您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
// 新增的案件
List<CaseApplication> caseApplications = new ArrayList<>();
// 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
// 抓取规则,0-内置字段,1-自定义字段
Map<Integer, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
// 在系统表中查询案件内置字段
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("case_built_type");
@@ -170,25 +137,8 @@ public class CaseZipImportImpl {
deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
}
// 角色用户
List<SysUserRole> userRoleList = new ArrayList<>();
// 查询申请人角色id
roleId = roleMapper.selectRoleIdByName("申请人");
// 案件基本信息
caseApplications = new ArrayList<>();
// 自定义字段,组装columnValue表
List<ColumnValue> columnValueList = new ArrayList<>();
// 案件人员
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
// 组装机构
List<SysDept> sysDepts = new ArrayList<>();
// 案件附件
List<CaseAttach> caseAttachs = new ArrayList<>();
//发送短信列表
List<SmsSendRecord> smsSendRecordList = new ArrayList<>();
// 短信记录
List<SmsUtils.SendSmsRequest> smsRequestList = new ArrayList<>();
/**
* 用户表已存在的用户
*/
@@ -201,186 +151,299 @@ public class CaseZipImportImpl {
String currentDay = DateUtils.dateTime();
String caseNum = "zc" + currentDay;
maxCaseNum = caseApplicationMapper.selectCaseNumLike(caseNum, caseNum.length());
// 需要新增的用户
List<SysUser> addUsers = new ArrayList<>();
for (Long caseId : fileMap.keySet()) {
if (CollectionUtil.isEmpty(fileMap.get(caseId))) {
continue;
// 抓取内容
Map<String, String> fatchMap = new HashMap<>();
// 从抓取规则表取字段和字典表取基本字段,字典表的字段名塞到基本表,is_default=1自定义字段塞到columnValue
// 抓取规则,0-内置字段,1-自定义字段
Map<String, List<FatchRule>> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName));
File directory = new File(targetPath);
if (!directory.exists()) {
throw new ServiceException("文件不存在");
}
// 找出案件文件夹
if (!directory.isDirectory() || directory.listFiles() == null) {
throw new ServiceException("未找到文件夹");
}
File[] files = directory.listFiles();
CaseZipImportTask caseZipImportTask = new CaseZipImportTask(this, templateId, fatchRuleList, fatchMap, fatchRuleMap, userMap, dictDataList, files , deptMap,SecurityUtils.getLoginUser());
Future<List<CaseApplication>> future = ThreadPoolUtil.submit(caseZipImportTask);
try {
if(future.get()!=null){
return success("导入成功");
}
CaseApplication caseApplication = new CaseApplication();
caseApplications.add(caseApplication);
caseApplication.setId(caseId);
caseApplication.setTemplateId(templateId);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
return error("无可导入的案件");
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
caseApplication.setCaseLogId(IdWorkerUtil.getId());
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
caseApplication.setCaseAppliId(caseApplication.getId());
// 设置批号
if (StrUtil.isEmpty(caseApplication.getBatchNumber())) {
maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
if (maxBatchNumber == null) {
maxBatchNumber = 1;
caseApplication.setBatchNumber(maxBatchNumber.toString());
} else {
maxBatchNumber = maxBatchNumber + 1;
caseApplication.setBatchNumber(maxBatchNumber.toString());
}
}
public CaseApplication buildCaseInfo(File file, Long templateId, List<FatchRule> fatchRuleList, Map<String, List<FatchRule>> fatchRuleMap, Map<String, String> fatchMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, Map<String, Long> deptMap,LoginUser loginUser) {
// fileMap<caseId, List<File>>
Map<String, String> fileMap = findFile(file, fatchRuleList);
if (fileMap != null && fileMap.size()> 0) {
// 根据抓取规则循环抓取
for (Map.Entry<String, List<FatchRule>> entry : fatchRuleMap.entrySet()) {
getFatchContent(fileMap, entry.getKey(), fatchMap, entry.getValue());
}
// 设置编号
String maxCaseNumStr = generateCaseNum();
caseApplication.setCaseNum(maxCaseNumStr);
caseApplication.setCreateBy(getUsername());
caseApplication.setVersion(1);
// 组装案件内置字段主表内容
if (fatchRuleMap.size() > 0 && fatchRuleMap.containsKey(1)) {
List<FatchRule> columnRules = fatchRuleMap.get(1);
columnRules.forEach(columnRule -> {
ColumnValue columnValue = new ColumnValue();
columnValue.setColumn(columnRule.getColumn());
columnValue.setName(columnRule.getColumnName());
columnValue.setName(columnRule.getColumnName());
columnValue.setValue(fatchMap.get(columnRule.getColumnName() + Constants.PDFSTR + caseId));
columnValue.setIsDefault(1);
columnValue.setCaseId(caseId);
columnValue.setCaseAppliLogId(caseApplication.getCaseLogId());
columnValueList.add(columnValue);
});
}
caseApplication.setColumnValues(columnValueList);
// 组装内置字段
buildDefaultColumn(caseApplication, dictDataList, fatchMap, caseAffiliates, deptMap, sysDepts, userMap, addUsers, userRoleList, smsSendRecordList, smsRequestList);
for (File caseFile : fileMap.get(caseId)) {
String fileUrl = caseFile.getAbsolutePath();
if (StrUtil.isEmpty(fileUrl)) {
continue;
if (fatchMap.size() > 0) {
// 尊敬的{1},您的代理的案件已接入仲裁系统,复制访问https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 进入小程序进行认证注册。如非本人操作,请忽略本短信
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
// 新增的案件
// 组装案件内置字段主表内容
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(IdWorkerUtil.getId());
caseApplication.setTemplateId(templateId);
Map<Integer, List<FatchRule>> defaultRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getIsDefault));
// 自定义字段,组装columnValue表
List<ColumnValue> columnValueList = new ArrayList<>();
if (defaultRuleMap.size() > 0 && defaultRuleMap.containsKey(1)) {
List<FatchRule> columnRules = defaultRuleMap.get(1);
columnRules.forEach(columnRule -> {
ColumnValue columnValue = new ColumnValue();
columnValue.setColumn(columnRule.getColumn());
columnValue.setName(columnRule.getColumnName());
columnValue.setValue(fatchMap.get(columnRule.getColumnName()));
columnValue.setIsDefault(1);
columnValue.setCaseId(caseApplication.getId());
columnValueList.add(columnValue);
});
caseApplication.setColumnValues(columnValueList);
}
// 上传
String filePath = RuoYiConfig.getUploadPath();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setCaseAppliLogId(caseApplication.getCaseLogId());
caseAttach.setAnnexPath(filePath);
if (StrUtil.isNotEmpty(fileUrl)) {
String fileName = fileUrl.replace(filePath, "/profile/upload");
caseAttach.setAnnexName(fileName);
}
// 申请人提供的证据材料
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
if (fileUrl.contains("仲裁申请书")) {
CaseAttach applyFile = new CaseAttach();
BeanUtil.copyProperties(caseAttach, applyFile);
applyFile.setAnnexType(1);
caseAttachs.add(applyFile);
}
}
// 案件压缩包导入
caseApplication.setImportFlag(2);
// 组装短信
// 角色用户
List<SysUserRole> userRoleList = new ArrayList<>();
}
// 多线程执行
List<MultipleThreadListParam> execList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(addUsers)) {
Function<List<SysUser>, Integer> function = userMapper::batchSave;
execList.add(new MultipleThreadListParam(function, addUsers));
}
if (CollectionUtil.isNotEmpty(userRoleList)) {
Function<List<SysUserRole>, Integer> function = userRoleMapper::batchUserRole;
execList.add(new MultipleThreadListParam(function, userRoleList));
// 组装机构
List<SysDept> sysDepts = new ArrayList<>();
// 案件附件
List<CaseAttach> caseAttachs = new ArrayList<>();
//发送短信列表
List<SmsSendRecord> smsSendRecordList = new ArrayList<>();
// 短信记录
List<SmsUtils.SendSmsRequest> smsRequestList = new ArrayList<>();
}
if (CollectionUtil.isNotEmpty(sysDepts)) {
Function<List<SysDept>, Integer> function = sysDeptMapper::batchSave;
execList.add(new MultipleThreadListParam(function, sysDepts));
// 需要新增的用户
List<SysUser> addUsers = new ArrayList<>();
caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
caseApplication.setCaseLogId(IdWorkerUtil.getId());
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
caseApplication.setCaseAppliId(caseApplication.getId());
}
if (CollectionUtil.isNotEmpty(caseApplications)) {
Function<List<CaseApplication>, Integer> function = caseApplicationMapper::batchSave;
execList.add(new MultipleThreadListParam(function, caseApplications));
Function<List<CaseApplication>, Integer> functionLog = caseApplicationLogMapper::batchSave;
execList.add(new MultipleThreadListParam(functionLog, caseApplications));
}
if (CollectionUtil.isNotEmpty(caseAffiliates)) {
Function<List<CaseAffiliate>, Integer> function = caseAffiliateMapper::batchCaseAffiliate;
execList.add(new MultipleThreadListParam(function, caseAffiliates));
Function<List<CaseAffiliate>, Integer> functionLog = caseAffiliateLogMapper::batchCaseAffiliate;
execList.add(new MultipleThreadListParam(functionLog, caseAffiliates));
}
if (CollectionUtil.isNotEmpty(caseAttachs)) {
Function<List<CaseAttach>, Integer> function = caseAttachMapper::batchSave;
execList.add(new MultipleThreadListParam(function, caseAttachs));
Function<List<CaseAttach>, Integer> functionLog = caseAttachLogMapper::batchSave;
execList.add(new MultipleThreadListParam(functionLog, caseAttachs));
}
if (CollectionUtil.isNotEmpty(columnValueList)) {
Function<List<ColumnValue>, Integer> function = columnValueMapper::batchSave;
execList.add(new MultipleThreadListParam(function, columnValueList));
Function<List<ColumnValue>, Integer> functionLog = columnValueLogMapper::batchSave;
execList.add(new MultipleThreadListParam(functionLog, columnValueList));
}
if (CollectionUtil.isNotEmpty(execList)) {
MultipleThreadWorkUtil.execListFun(execList.toArray(new MultipleThreadListParam[execList.size()]));
}
if (CollectionUtil.isNotEmpty(caseApplications)) {
LoginUser loginUser = SecurityUtils.getLoginUser();
List<CaseLogRecord> logRecords = new ArrayList<>();
caseApplications.forEach(caseApplication -> {
CaseLogRecord operLog = new CaseLogRecord();
// 获取当前的用户
if (loginUser != null) {
SysUser user = loginUser.getUser();
operLog.setCreateBy(user.getUserName());
operLog.setCreateNickName(user.getNickName());
operLog.setUpdateBy(user.getUserName());
} else {
operLog.setCreateBy("admin");
operLog.setCreateNickName("管理员");
operLog.setUpdateBy("admin");
}
operLog.setCaseAppliId(caseApplication.getId());
operLog.setCaseNode(CaseApplicationConstants.CASE_APPLICATION);
logRecords.add(operLog);
// 设置批号
if (StrUtil.isEmpty(caseApplication.getBatchNumber())) {
maxBatchNumber = caseApplicationMapper.selectBatchNumberLike();
if (maxBatchNumber == null) {
maxBatchNumber = 1;
caseApplication.setBatchNumber(maxBatchNumber.toString());
} else {
maxBatchNumber = maxBatchNumber + 1;
caseApplication.setBatchNumber(maxBatchNumber.toString());
}
);
// todo 发送短信
ThreadPoolUtil.execute(() -> {
CaseLogUtils.batchInsertCaseLog(logRecords);
// 发送短信
if (CollectionUtil.isNotEmpty(smsRequestList)) {
Map<Long, SmsSendRecord> sendRecordMap = null;
if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
Boolean aBoolean = SmsUtils.sendSms(request);
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
if (aBoolean) {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
} else {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
}
}
// 设置编号
String maxCaseNumStr = generateCaseNum();
caseApplication.setCaseNum(maxCaseNumStr);
caseApplication.setCreateBy(loginUser!=null?loginUser.getUsername():"admin");
caseApplication.setVersion(1);
// 组装案件内置字段主表内容
// 组装内置字段
buildDefaultColumn(caseApplication, dictDataList, fatchMap, deptMap, sysDepts, userMap, addUsers, userRoleList, smsSendRecordList, smsRequestList);
// 组装附件
for (Map.Entry<String, String> entry : fileMap.entrySet()) {
String fileUrl = entry.getValue();
if (StrUtil.isEmpty(fileUrl)) {
continue;
}
// 上传
String filePath = RuoYiConfig.getUploadPath();
CaseAttach caseAttach = new CaseAttach();
caseAttach.setCaseAppliId(caseApplication.getId());
caseAttach.setAnnexPath(filePath);
if (StrUtil.isNotEmpty(fileUrl)) {
String fileName = fileUrl.replace(filePath, "/profile/upload");
caseAttach.setAnnexName(fileName);
}
// 申请人提供的证据材料
caseAttach.setAnnexType(2);
caseAttachs.add(caseAttach);
if (fileUrl.contains("仲裁申请书")) {
CaseAttach applyFile = new CaseAttach();
BeanUtil.copyProperties(caseAttach, applyFile);
applyFile.setAnnexType(1);
caseAttachs.add(applyFile);
}
}
caseApplication.setCaseAttachList(caseAttachs);
// 案件压缩包导入
caseApplication.setImportFlag(2);
caseApplicationMapper.insertCaseApplication(caseApplication);
// 多线程执行
ThreadPoolUtil.execute(() -> {
caseApplicationLogMapper.insert(caseApplication);
// 多线程执行
if (CollectionUtil.isNotEmpty(addUsers)) {
userMapper.batchSave(addUsers);
}
if (CollectionUtil.isNotEmpty(userRoleList)) {
userRoleMapper.batchUserRole(userRoleList);
}
if (CollectionUtil.isNotEmpty(sysDepts)) {
sysDeptMapper.batchSave(sysDepts);
}
if (CollectionUtil.isNotEmpty(caseApplication.getCaseAffiliates())) {
caseAffiliateMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
caseAffiliateLogMapper.batchCaseAffiliate(caseApplication.getCaseAffiliates());
}
if (CollectionUtil.isNotEmpty(caseAttachs)) {
caseAttachMapper.batchSave(caseAttachs);
caseAttachLogMapper.batchSave(caseAttachs);
}
if (CollectionUtil.isNotEmpty(columnValueList)) {
columnValueMapper.batchSave(columnValueList);
columnValueLogMapper.batchSave(columnValueList);
}
// 新增日志
CaseLogUtils.insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "",loginUser);
// 发送短信
if (CollectionUtil.isNotEmpty(smsRequestList)) {
Map<Long, SmsSendRecord> sendRecordMap = null;
if (CollectionUtil.isNotEmpty(smsSendRecordList)) {
sendRecordMap = smsSendRecordList.stream().collect(Collectors.toMap(SmsSendRecord::getCaseId, Function.identity()));
for (SmsUtils.SendSmsRequest sendSmsRequest : smsRequestList) {
Boolean aBoolean = SmsUtils.sendSms(request);
if (sendRecordMap != null && sendRecordMap.containsKey(sendSmsRequest.getCaseId())) {
if (aBoolean) {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(1);
} else {
sendRecordMap.get(sendSmsRequest.getCaseId()).setSendStatus(0);
}
}
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
}
smsRecordMapper.batchSaveSmsSendRecord(smsSendRecordList);
}
}
);
});
return caseApplication;
}
}
// 案件日志
return success("导入成功");
return null;
}
/**
* 获取抓取内容
*
* @param andConvertPDF 文件路径map
* @param mapKey 文件名
* @param map 抓取内容map
* @param fatchRules 抓取规则
*/
private void getFatchContent(Map<String, String> andConvertPDF, String mapKey, Map<String, String> map, List<FatchRule> fatchRules) {
String fileURL = andConvertPDF.get(mapKey);
if (StrUtil.isEmpty(fileURL)) {
return;
}
if (fileURL.endsWith("txt")) {
String readerFile = ReadFileUtils.readerTxtFile(fileURL);
OCRUtils.fatchRuleGetContent(readerFile, fatchRules, map);
} else if (fileURL.endsWith("doc") || fileURL.endsWith("docx")) {
// doc,docx,text识别内容
String readerFile = null;
try {
readerFile = ReadFileUtils.readWord(fileURL);
} catch (Exception e) {
e.printStackTrace();
}
OCRUtils.fatchRuleGetContent(readerFile, fatchRules, map);
} else if (fileURL.endsWith("pdf")) {
//获取文件的页数
int fileNumPage = getFileNumPage(fileURL);
//文件转成base64
String base64 = OCRUtils.pdfConvertBase64(fileURL);
if (base64 == null) {
throw new ServiceException("pdf转base64失败");
// return false;
}
StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象
for (int i = 1; i <= fileNumPage; i++) {
//对接腾讯云接口.识别里面的数据
String text = OCRUtils.pdfIdentifyText(base64, i, fatchRules);
ocrText.append(text); // 拼接当前的字符串
}
// 根据抓取规则截取内容
OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules, map);
}
}
/**
* 查找文件
*
* @param directory
* @param fatchRuleList
* @return
*/
private Map<String, String> findFile(File directory, List<FatchRule> fatchRuleList) {
Map<String, String> filePathMap = new HashMap<>();
if (directory.isFile()) {
String path = "";
// 如果传入的参数是一个文件
path = directory.getAbsolutePath();
filePathMap.put(directory.getName(), path);
} else if (directory.isDirectory()) {
searchAndConvertPDF(directory, filePathMap);
} else {
return null;
}
return filePathMap;
}
/**
* 递归查找文件夹
*
* @param directory
* @param filePathMap
*/
public static void searchAndConvertPDF(File directory, Map<String, String> filePathMap) {
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
if (file.getName().contains("zip") || file.getName().contains("rar")) {
continue;
}
if (file.isFile()) {
filePathMap.put(file.getName(), file.getAbsolutePath());
} else if (file.isDirectory()) {
// 如果是目录,递归查找
searchAndConvertPDF(file, filePathMap);
}
}
}
}
/**
@@ -584,13 +647,14 @@ public class CaseZipImportImpl {
* @param fatchMap 抓取字段内容
*/
private void buildDefaultColumn(CaseApplication caseApplication, List<SysDictData> dictDataList, Map<String, String> fatchMap,
List<CaseAffiliate> caseAffiliates, Map<String, Long> deptMap, List<SysDept> sysDepts,
Map<String, Long> deptMap, List<SysDept> sysDepts,
Map<String, SysUser> userMap, List<SysUser> addUsers, List<SysUserRole> userRoleList,
List<SmsSendRecord> smsSendRecords, List<SmsUtils.SendSmsRequest> smsRequestList) {
// 组装内置字段
if (CollectionUtil.isEmpty(dictDataList)) {
return;
}
List<CaseAffiliate> caseAffiliates = new ArrayList<>();
// 被申请人
CaseAffiliate debtorAffiliate = new CaseAffiliate();
debtorAffiliate.setCaseAppliId(caseApplication.getId());
@@ -610,27 +674,35 @@ public class CaseZipImportImpl {
buildAffilcateColumn(dictData, fatchMap, affiliate, deptMap, sysDepts, userMap, addUsers, userRoleList, caseApplication, smsSendRecords, smsRequestList);
} else if (dictData.getDictLabel().contains("合同编号")) {
// 合同编号
String contractNumber = fatchMap.get("合同编号" + Constants.PDFSTR + caseApplication.getId());
String contractNumber = fatchMap.get("合同编号" );
if (StrUtil.isNotEmpty(contractNumber)) {
// 提取字母和数字
String regx = "[^a-zA-Z0-9]";
String replaceAll = contractNumber.replaceAll(regx, "");
caseApplication.setContractNumber(replaceAll.toUpperCase());
}
}else if(dictData.getDictLabel().contains("案件标的")){
// todo 案件标的名字要改,字典配置中也要改
if(null!=caseApplication.getCaseSubjectAmount()) {
//todo 暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
} else if (dictData.getDictLabel().contains("案件标的")) {
String caseSubjectAmount = fatchMap.get(dictData.getDictLabel());
if(StrUtil.isNotEmpty(caseSubjectAmount)) {
try {
BigDecimal bigDecimal = new BigDecimal(caseSubjectAmount);
caseApplication.setCaseSubjectAmount(bigDecimal);
// todo 案件标的名字要改,字典配置中也要改
//todo 暂时设置计费比率为0.01
BigDecimal feeRate = new BigDecimal(0.01);
BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
caseApplication.setFeePayable(feePayable);
} catch (Exception e) {
}
}
} else {
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() ));
}
} else {
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() ));
}
@@ -641,7 +713,7 @@ public class CaseZipImportImpl {
if (ObjectUtil.isNotEmpty(debtorAffiliate)) {
caseAffiliates.add(debtorAffiliate);
}
caseApplication.setCaseAffiliates(caseAffiliates);
}
@@ -662,7 +734,7 @@ public class CaseZipImportImpl {
// 申请人
switch (dictData.getDictLabel()) {
case "申请人姓名":
affiliate.setName((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
affiliate.setName((fatchMap.get(dictData.getDictLabel())));
if (StrUtil.isNotEmpty(affiliate.getName())) {
// 组装申请机构
// 将组织机构id设为申请人名称
@@ -690,25 +762,25 @@ public class CaseZipImportImpl {
}
break;
case "统一社会信用代码":
affiliate.setIdentityNum((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
affiliate.setIdentityNum((fatchMap.get(dictData.getDictLabel())));
break;
case "法定代表人":
affiliate.setCompLegalPerson(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
affiliate.setCompLegalPerson(fatchMap.get(dictData.getDictLabel()));
break;
case "法定代表人职位":
affiliate.setCompLegalperPost((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
affiliate.setCompLegalperPost((fatchMap.get(dictData.getDictLabel())));
break;
case "申请人住所":
affiliate.setResidenAffili((fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())));
affiliate.setResidenAffili((fatchMap.get(dictData.getDictLabel())));
break;
case "申请人联系地址":
affiliate.setContactAddress(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
affiliate.setContactAddress(fatchMap.get(dictData.getDictLabel()));
break;
case "委托代理人姓名":
affiliate.setNameAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
affiliate.setNameAgent(fatchMap.get(dictData.getDictLabel()));
break;
case "委托代理人联系电话":
affiliate.setContactTelphoneAgent(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()));
affiliate.setContactTelphoneAgent(fatchMap.get(dictData.getDictLabel()));
if (StrUtil.isNotEmpty(affiliate.getContactTelphoneAgent())) {
SysUser agentUser = null;
// 用户已存在
@@ -754,11 +826,11 @@ public class CaseZipImportImpl {
}
if (addUsers != null) {
SysUser finalAgentUser = agentUser;
if(CollectionUtil.isNotEmpty(smsRequestList)&& smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))){
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
request.setPhone(agentUser.getPhonenumber());
request.setTemplateParamSet(new String[]{agentUser.getNickName()});
if (CollectionUtil.isNotEmpty(smsRequestList) && smsRequestList.stream().noneMatch(smsSendRecord -> smsSendRecord.getPhone().equals(finalAgentUser.getPhonenumber()))) {
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1956159");
request.setPhone(agentUser.getPhonenumber());
request.setTemplateParamSet(new String[]{agentUser.getNickName()});
smsRequestList.add(request);
SmsSendRecord smsSendRecord = new SmsSendRecord();
smsSendRecord.setCaseId(caseApplication.getId());
@@ -777,10 +849,10 @@ public class CaseZipImportImpl {
}
break;
case "委托代理人电子邮件":
affiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId())) ? fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseApplication.getId()).replace("\n", "").replaceAll("\\s", "") : null);
affiliate.setAgentEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel())) ? fatchMap.get(dictData.getDictLabel()).replace("\n", "").replaceAll("\\s", "") : null);
break;
default:
ObjectFieldUtils.setValue(caseApplication, dictData.getDictValue(), fatchMap.get(dictData.getDictLabel() ));
break;
}
}
@@ -813,11 +885,11 @@ public class CaseZipImportImpl {
// 被申请人
switch (dictData.getDictLabel()) {
case "被申请人姓名":
debtorAffiliate.setName(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
debtorAffiliate.setName(fatchMap.get(dictData.getDictLabel() ));
break;
case "被申请人身份证号":
String identityNum = fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId);
debtorAffiliate.setIdentityNum(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
String identityNum = fatchMap.get(dictData.getDictLabel() );
debtorAffiliate.setIdentityNum(fatchMap.get(dictData.getDictLabel() ));
// 出生年月日,从身份证抓取
if (StrUtil.isNotEmpty(identityNum)) {
identityNum = identityNum.replace("\n", "");
@@ -839,13 +911,13 @@ public class CaseZipImportImpl {
break;
case "被申请人住所":
debtorAffiliate.setResidenAffili(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
debtorAffiliate.setResidenAffili(fatchMap.get(dictData.getDictLabel() ));
break;
case "被申请人联系电话":
debtorAffiliate.setContactTelphone(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId));
debtorAffiliate.setContactTelphone(fatchMap.get(dictData.getDictLabel() ));
break;
case "被申请人电子邮件":
debtorAffiliate.setEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId)) ? fatchMap.get(dictData.getDictLabel() + Constants.PDFSTR + caseId).replace("\n", "").replaceAll("\\s", "") : null);
debtorAffiliate.setEmail(StrUtil.isNotEmpty(fatchMap.get(dictData.getDictLabel() )) ? fatchMap.get(dictData.getDictLabel() ).replace("\n", "").replaceAll("\\s", "") : null);
break;
default:
@@ -0,0 +1,66 @@
package com.ruoyi.wisdomarbitrate.task;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.FatchRule;
import com.ruoyi.wisdomarbitrate.service.impl.CaseZipImportImpl;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
/**
* @description rbd调用xfta计算任务类
* @Author mingYang
* @Date 2021/11/12 15:35
* @Version V1.0
**/
public class CaseZipImportTask implements Callable<List<CaseApplication>> {
private CaseZipImportImpl caseZipImportImpl;
private Long templateId;
private List<FatchRule> fatchRuleList;
private Map<String, String> fatchMap;
private Map<String, List<FatchRule>> fatchRuleMap;
private Map<String, SysUser> userMap;
private List<SysDictData> dictDataList;
private File[] files;
private Map<String, Long> deptMap;
private LoginUser loginUser;
public CaseZipImportTask(CaseZipImportImpl caseZipImportImpl, Long templateId, List<FatchRule> fatchRuleList, Map<String, String> fatchMap, Map<String, List<FatchRule>> fatchRuleMap, Map<String, SysUser> userMap, List<SysDictData> dictDataList, File[] files, Map<String, Long> deptMap, LoginUser loginUser) {
this.caseZipImportImpl = caseZipImportImpl;
this.templateId = templateId;
this.fatchRuleList = fatchRuleList;
this.fatchMap = fatchMap;
this.fatchRuleMap = fatchRuleMap;
this.userMap = userMap;
this.dictDataList = dictDataList;
this.files = files;
this.deptMap = deptMap;
this.loginUser = loginUser;
}
@Override
public List<CaseApplication> call() {
List<CaseApplication> caseApplications = new ArrayList<>();
for (File file1 : files) {
if (file1.isDirectory() && file1.listFiles() != null) {
for (File file2 : file1.listFiles()) {
CaseApplication caseApplication = caseZipImportImpl.buildCaseInfo(file2, templateId, fatchRuleList, fatchRuleMap, fatchMap, userMap, dictDataList, deptMap, loginUser);
if (caseApplication != null) {
caseApplications.add(caseApplication);
}
}
}
}
return caseApplications;
}
}
@@ -47,6 +47,30 @@ public class CaseLogUtils
operLog.setNotes(notes);
caseLogRecordMapper.insertCaseLogRecord(operLog);
}
/**
* 新增案件日志
* @param caseAppliId 案件id,不能为空
* @param caseNode 案件节点,不能为空
* @param notes 备注
*/
public static void insertCaseLog(@NotNull Long caseAppliId, @NotEmpty Integer caseNode, String notes ,LoginUser loginUser ){
CaseLogRecord operLog = new CaseLogRecord();
// 获取当前的用户
if(loginUser!=null) {
SysUser sysUser = userMapper.selectUserById(loginUser.getUserId());
operLog.setCreateBy(sysUser.getUserName());
operLog.setCreateNickName(sysUser.getNickName());
operLog.setUpdateBy(sysUser.getUserName());
}else {
operLog.setCreateBy("admin");
operLog.setCreateNickName("管理员");
operLog.setUpdateBy("admin");
}
operLog.setCaseAppliId(caseAppliId);
operLog.setCaseNode(caseNode);
operLog.setNotes(notes);
caseLogRecordMapper.insertCaseLogRecord(operLog);
}
/**
* 批量新增案件日志
* @param list
@@ -167,14 +167,14 @@ public class OCRUtils {
String endContent = fatchRule.getEndContent();
// 开始为空结束为空
if (StrUtil.isEmpty(startContent) && StrUtil.isEmpty(endContent)) {
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(text));
fatchMap.put(fatchRule.getColumnName(), trimStr(text));
} else if (StrUtil.isNotEmpty(startContent) && StrUtil.isEmpty(endContent)) {
// 开始不为空结束为空
int startContIndex = StrUtil.ordinalIndexOf(text, startContent, fatchRule.getStartContentRepeatOrder());
if (startContIndex != -1 && text.length() >= (startContIndex + startContent.length())) {
String substring = text.substring(startContIndex + startContent.length());
// 去除\n
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(substring));
fatchMap.put(fatchRule.getColumnName(), trimStr(substring));
}
} else if (StrUtil.isEmpty(startContent) && StrUtil.isNotEmpty(endContent)) {
@@ -182,7 +182,7 @@ public class OCRUtils {
int endContIndex = StrUtil.ordinalIndexOf(text, endContent, fatchRule.getEndContentRepeatOrder());
if (endContIndex != -1) {
String substring = text.substring(0, endContIndex);
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(substring));
fatchMap.put(fatchRule.getColumnName(), trimStr(substring));
}
} else if (StrUtil.isNotEmpty(startContent) && StrUtil.isNotEmpty(endContent)) {
// 开始结束不为空
@@ -191,7 +191,7 @@ public class OCRUtils {
if (startIndexOf != -1 && endIndexOf != -1 && endIndexOf >= (startIndexOf + startContent.length()) && text.length() >= endIndexOf) {
String substring = text.substring(startIndexOf + startContent.length(), endIndexOf);
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(substring));
fatchMap.put(fatchRule.getColumnName(), trimStr(substring));
}
}
@@ -221,7 +221,7 @@ public class OCRUtils {
}
// 开始和结束截取都为空
if (StrUtil.isEmpty(reverseStartContent) && StrUtil.isEmpty(reverseEndContent)) {
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(text));
fatchMap.put(fatchRule.getColumnName(), trimStr(text));
} else if (StrUtil.isEmpty(reverseStartContent) && StrUtil.isNotEmpty(reverseEndContent)) {
// 开始为空,结束不为空
// 根据截取的序号查找出位置
@@ -229,7 +229,7 @@ public class OCRUtils {
if (indexOf != -1) {
String substring = reverseText.substring(0, indexOf);
if (StrUtil.isNotEmpty(substring)) {
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(StrUtil.reverse(substring)));
fatchMap.put(fatchRule.getColumnName(), trimStr(StrUtil.reverse(substring)));
}
}
} else if (StrUtil.isNotEmpty(reverseStartContent) && StrUtil.isEmpty(reverseEndContent)) {
@@ -238,7 +238,7 @@ public class OCRUtils {
if (indexOf != -1 && (indexOf + reverseStartContent.length() <= text.length())) {
String substring = reverseText.substring(indexOf + reverseStartContent.length());
if (StrUtil.isNotEmpty(substring)) {
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(StrUtil.reverse(substring)));
fatchMap.put(fatchRule.getColumnName(), trimStr(StrUtil.reverse(substring)));
}
}
@@ -249,7 +249,7 @@ public class OCRUtils {
if (startIndexOf != -1 && endIndexOf != -1 && endIndexOf >= (startIndexOf + reverseStartContent.length()) && text.length() >= endIndexOf) {
String substring = reverseText.substring(startIndexOf + reverseStartContent.length(), endIndexOf);
if (StrUtil.isNotEmpty(substring)) {
fatchMap.put(fatchRule.getColumnName()+Constants.PDFSTR+caseId, trimStr(StrUtil.reverse(substring)));
fatchMap.put(fatchRule.getColumnName(), trimStr(StrUtil.reverse(substring)));
}
}
}
@@ -1,5 +1,7 @@
package com.ruoyi.wisdomarbitrate.utils;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
@@ -11,6 +13,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.EsignApplicaConfig;
import com.ruoyi.common.utils.EsignHttpHelper;
import com.ruoyi.common.utils.SealUtil;
import com.ruoyi.wisdomarbitrate.StringIdsReq;
import com.ruoyi.wisdomarbitrate.domain.DeptIdentify;
import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
@@ -252,7 +255,7 @@ public class SignAward {
/* " \"availableSealIds\": [\n" +
" \"" + availableSealId + "\"\n" +
" ],\n" +*/
" \"availableSealIds\": " + new Gson().toJson(sealIdList) + ",\n" +
// " \"availableSealIds\": " + new Gson().toJson(sealIdList) + ",\n" +
" \"signFieldPosition\": {\n" +
" \"positionPage\": \"" + positionPageorg + "\",\n" +
@@ -305,6 +308,50 @@ public class SignAward {
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
}
/**
* 获取批量签页面链接
*
* @return
* @throws EsignDemoException
*/
public static EsignHttpResponse batchSignUrl(StringIdsReq idsReq) throws EsignDemoException {
List<String> signFlowIds = idsReq.getIds();
String psnAccount = idsReq.getPsnAccount();
String apiaddr = "/v3/sign-flow/batch-sign-url";
JSONObject paramObj = new JSONObject();
paramObj.put("operatorId",idsReq.getPsnId());
paramObj.put("signFlowIds",signFlowIds);
paramObj.put("clientType","PC");
String jsonParm = JSON.toJSONString(paramObj);
//请求方法
EsignRequestType requestType = EsignRequestType.POST;
//生成请求签名鉴权方式的Header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
}
/**
* 根据手机号获取账户id
*
* @return
* @throws EsignDemoException
*/
public static EsignHttpResponse identityInfo(StringIdsReq idsReq) throws EsignDemoException {
List<String> signFlowIds = idsReq.getIds();
String psnAccount = idsReq.getPsnAccount();
String apiaddr = "/v3/persons/identity-info?psnAccount=" +psnAccount;
String jsonParm = "{}";
//请求方法
EsignRequestType requestType = EsignRequestType.GET;
//生成请求签名鉴权方式的Header
Map<String, String> header = EsignHttpHelper.signAndBuildSignAndJsonHeader(eSignAppId, eSignAppSecret, jsonParm, requestType.name(), apiaddr, false);
//发起接口请求
return EsignHttpHelper.doCommHttp(eSignHost, apiaddr, requestType, jsonParm, header, false);
}
/**
* 获取合同文件用印链接