diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index e3923c5..30d0746 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -78,7 +78,7 @@ public class CaseApplicationController extends BaseController { { caseApplication.setCreateBy(getUsername()); - return toAjax(caseApplicationService.insertcaseApplication(caseApplication)); + return toAjax(caseApplicationService.insertcaseApplication(caseApplication,null)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java index d373731..dfa3323 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java @@ -25,6 +25,10 @@ public class CaseApplication extends BaseEntity { /** 案件标的 */ @Excel(name = "案件标的") private BigDecimal caseSubjectAmount; + /** + * 模板id + */ + private Long templateId; /** 立案日期 */ @@ -37,6 +41,14 @@ public class CaseApplication extends BaseEntity { */ private Integer importFlag; + public Long getTemplateId() { + return templateId; + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + public Integer getImportFlag() { return importFlag; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java index 7efd1f1..824dd99 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/FatchRule.java @@ -19,6 +19,9 @@ public class FatchRule extends BaseEntity { private String fileName; private String startContent; private String endContent; + private String column; + private String columnName; + private String column; private String columnName; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java new file mode 100644 index 0000000..19dc288 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ColumnValue.java @@ -0,0 +1,37 @@ +package com.ruoyi.wisdomarbitrate.domain.vo; + +import lombok.Data; + +/** + * 动态配置字段表 + */ +@Data +public class ColumnValue { + private static final long serialVersionUID = 1L; + + /** + * id + */ + private Long id; + + /** + * 字段,同一个批号,column不可重复 + */ + private String column; + + /** + * 字段名 + */ + private String name; + + /** + * 字段值 + */ + private String value; + + /** + * 案件id + */ + private Long caseId; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java new file mode 100644 index 0000000..11b380e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ColumnValueMapper.java @@ -0,0 +1,28 @@ +package com.ruoyi.wisdomarbitrate.mapper; + +import com.ruoyi.wisdomarbitrate.domain.FatchRule; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * 动态配置字段表 + */ +@Repository +public interface ColumnValueMapper { + + /** + * 批量新增 + */ + void batchSave(@Param("list") List list); + + /** + * 根据案件id查询字段及值 + * @param caseId + * @return + */ + List listByCaseId(@Param("caseId") Long caseId); + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java index 29a2082..bfba30b 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/FatchRuleMapper.java @@ -15,7 +15,7 @@ public interface FatchRuleMapper { /** * 根据批次查询 */ - List list(@Param("batchNumber")String batchNumber); + List listByTemplateId(@Param("templateId")String templateId); List selectFatchRuleList(FatchRule fatchRule); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java index 42a997d..2bf5b88 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java @@ -11,13 +11,14 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.util.List; +import java.util.Map; public interface ICaseApplicationService { List selectCaseApplicationList(CaseApplication caseApplication); List selectCaseApplicationListByRole(CaseApplication caseApplication); - int insertcaseApplication(CaseApplication caseApplication); + int insertcaseApplication(CaseApplication caseApplication, Map fatchMap); int selectCaseApplicationCount(CaseApplication caseApplication); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java index a500473..6b40443 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/AdjudicationServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SmsUtils; import com.ruoyi.wisdomarbitrate.domain.vo.BookSendVO; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; import com.ruoyi.wisdomarbitrate.mapper.*; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.EmailOutUtil; @@ -25,11 +26,16 @@ import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.XWPFParagraph; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBookmark; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mail.MailSendException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; import java.io.*; import java.math.BigDecimal; @@ -43,7 +49,9 @@ import java.text.NumberFormat; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; +import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; import static com.ruoyi.common.utils.SecurityUtils.getUsername; @@ -72,284 +80,230 @@ public class AdjudicationServiceImpl implements IAdjudicationService { private SendMailRecordMapper sendMailRecordMapper; @Autowired private SmsRecordMapper smsRecordMapper; - + @Autowired + private TemplateManageMapper templateManageMapper; + @Autowired + private ColumnValueMapper columnValueMapper; + // 仲裁反请求模板内容 + private final String counterclaim= "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + + "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + + "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; + // 财产保全内容 + String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + + "第二十八条之规定,将该申请提交至法院。"; + // 管辖权异议 + String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + + ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; + // 线上开庭时+线上仲裁 + String onLineDate="{{onLineDate}}"; + String onLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+onLineDate+"通过仲裁委智慧仲裁平台开庭审理了本案。"; + // 开庭+线下仲裁 + String offLineDate="{{offLineDate}}"; + String offLine = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于 "+offLineDate+"在仲裁委所在地开庭审理了本案。"; + //书面仲裁时 + String writtenDate="{{writtenDate}}"; + String written = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"+writtenDate+"在仲裁委所在地开庭审理了本案。"; + //开庭+缺席审理 + String absent = "申请人的特别授权委托代理人{{agentName}}"+"出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + + "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明,\" +\n" + + " \"发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"+"综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + + "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; + // 开庭+出席 + String attend="申请人的特别授权委托代理人{{agentName}}和被申请人本人出席了庭审。 "; + // 开庭+出席+被申提供证据 + String onLineAttendFile="庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;双方当事人均出示了证据材料并对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 "; + // 开庭+出席+被申未提供证据 + String onLineAttend="庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;申请人出示了证据材料,被申请人对对方的证据材料进行了质证; 双方当事人均回答了仲裁庭的提问,进行了辩论,并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。 "; + // 被申请人出席答辩意见 + String resAttendOpinion="\n(二)被申请人的答辩意见 \n(三)当事人提供的证据材料及对方的质证意见\n" + + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}\n被申请人对上述材料的质证意见为:{{respondentOpinion}}\n"; + // 被申请人出席+被申请人提供了资料 + String resFile="被申请人向仲裁庭提交了如下证据材料:\n{{resFile}}" + + "申请人对上述材料的质证意见为:{{applicantOpinion}}"; + // 被申请人缺席 + String resAbsent="(二)当事人提供的证据材料\n" + + "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:\n{{applicantFile}}"; @Override @Transactional - public AjaxResult createDocument(CaseApplication caseApplication) { + public AjaxResult createDocument(CaseApplication caseApplicationReq) { + String templatePath=""; + String templateName=""; + String agentName=""; + String resName=""; try { Map datas = new HashMap<>(); - Long id = caseApplication.getId(); + Long id = caseApplicationReq.getId(); if (id == null) { - return null; + return AjaxResult.error("案件id不能为空"); } + //获取案件详细信息 - CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication); - //生成编码 - String equipmentNo = getNewEquipmentNo(); - datas.put("num", equipmentNo); + CaseApplication caseApplicationById = caseApplicationService.selectCaseApplication(caseApplicationReq); + + if(caseApplicationById==null){ + return AjaxResult.error("案件不存在"); + } + // 根据模板id查找对应的模板 + if(caseApplicationById.getTemplateId()!=null) { + TemplateManage templateManage = new TemplateManage(); + templateManage.setId(caseApplicationById.getTemplateId()); + List templateManages = templateManageMapper.selectTemplateList(templateManage); + if(CollectionUtil.isEmpty(templateManages)){ + return AjaxResult.error("请先指定裁决书模板"); + } + templatePath=templateManages.get(0).getTemOrigPath(); + templateName=templateManages.get(0).getFileName(); + } //获取仲裁记录表里的相关信息 ArbitrateRecord arbitrateRecord = new ArbitrateRecord(); arbitrateRecord.setCaseAppliId(id); - ArbitrateRecord arbitrateRecord1 = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord); - //获取案件关联人信息 - CaseAffiliate caseAffiliate = new CaseAffiliate(); - caseAffiliate.setCaseAppliId(id); - List caseAffiliates = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate); - String applicantName=""; - String debtorName = ""; - List nameAgentList = new ArrayList<>(); - if (caseAffiliates != null && caseAffiliates.size() > 0) { - for (CaseAffiliate affiliate : caseAffiliates) { - //获取身份类型 - int identityType = affiliate.getIdentityType(); - if (identityType == 1) { //申请人 - applicantName=affiliate.getName(); - datas.put("appName", affiliate.getName()); - datas.put("appAddress", affiliate.getResidenAffili()); - datas.put("appContactAddress", affiliate.getContactAddress()); - datas.put("appLegalPerson", affiliate.getCompLegalPerson()); - datas.put("appLegalPersonTitle", affiliate.getCompLegalperPost()); - datas.put("appAgentName", affiliate.getNameAgent()); - datas.put("appAgentTitle", affiliate.getAppliAgentTitle()); - nameAgentList.add(affiliate.getNameAgent()); - } else if (identityType == 2) { //被申请人 - debtorName=affiliate.getName(); - datas.put("resName", affiliate.getName()); - datas.put("resAddress", affiliate.getResidenAffili()); - String responSex = affiliate.getResponSex(); - if (responSex.equals("0")) { - datas.put("resSex", "男"); - } else if (responSex.equals("1")){ - datas.put("resSex", "女"); - }else { - datas.put("resSex", "未知"); - } - Date responBirth = affiliate.getResponBirth(); - if (responBirth != null) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); - String responBirthStr = sdf.format(responBirth); - datas.put("resDateOfBirth", responBirthStr); - } - datas.put("resContactAddress", affiliate.getContactAddress()); - nameAgentList.add(affiliate.getNameAgent()); + ArbitrateRecord arbitrateRecordSelect = arbitrateRecordMapper.selectArbitrateRecord(arbitrateRecord); + + // todo 获取模板中的所有占位符,该占位符字段必须和抓取字段一致,暂时写死 + // todo 生成裁决书的内容从key-value表中取,不从案件基本信息表取,会有问题,如果修改的话会有问题,暂不考虑该情况 + + // 根据案件id查询key-value表 + List columnValueList = columnValueMapper.listByCaseId(caseApplicationReq.getId()); + // 获取模板中的占位符key + List bookmarkList = getBookmarkByDocx(templatePath); + if(CollectionUtil.isEmpty(bookmarkList)){ + // 直接保存模板为裁决书 + saveArbitorFile(id,templateName,templatePath,caseApplicationById,arbitrateRecordSelect); + return AjaxResult.success("生成裁决书成功"); + } + // 如果该表没值,在从主表填充裁决书模板 + if(CollectionUtil.isNotEmpty(columnValueList)){ + Map columnValueMap = columnValueList.stream().collect(Collectors.toMap(ColumnValue::getColumn, ColumnValue::getValue)); + agentName=columnValueMap.get("agentName"); + resName=columnValueMap.get("respondentName"); + // 懒得if,暂时这样 + // + for (String bookmark : bookmarkList) { + if(columnValueMap.containsKey(bookmark)){ + datas.put(bookmark,columnValueMap.get(bookmark)); } } + }else { + } - Date createTime = caseApplication1.getCreateTime(); + // 裁决书生成时间 + LocalDate now = LocalDate.now(); + String year = Integer.toString(now.getYear()); + datas.put("year", year); + //生成编码 + String equipmentNo = getNewEquipmentNo(); + // 裁决书编号 + datas.put("num", equipmentNo); + // 案件创建时间 + Date createTime = caseApplicationById.getCreateTime(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日"); // 将日期格式化为字符串 String createTimeStr = sdf.format(createTime); datas.put("submissionDate", createTimeStr); - Date registerDate = caseApplication1.getRegisterDate(); + // 立案日期 + Date registerDate = caseApplicationById.getRegisterDate(); String registerDateStr = sdf.format(registerDate); datas.put("acceptDate", registerDateStr); - //反请求 - Integer adjudicaCounter = caseApplication1.getAdjudicaCounter(); - String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" + - "《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" + - "仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。"; - if (adjudicaCounter == null) { - datas.put("counterclaim", null); - } else if (adjudicaCounter == 1) { + + // 如果有仲裁反请求,该字段设置值 + Integer adjudicaCounter = caseApplicationById.getAdjudicaCounter(); + if (adjudicaCounter!=null&&adjudicaCounter == 1) { datas.put("counterclaim", counterclaim); - } else { - datas.put("counterclaim", null); } //财产保全 - Integer properPreser = caseApplication1.getProperPreser(); - String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" + - "第二十八条之规定,将该申请提交至法院。"; - if (properPreser == null) { - datas.put("preservation", null); - } else if (properPreser == 1) { + Integer properPreser = caseApplicationById.getProperPreser(); + if (properPreser!=null&&properPreser == 1) { datas.put("preservation", preservation); - } else { - datas.put("preservation", null); } //管辖权异议 - Integer objectiJuris = caseApplication1.getObjectiJuris(); - String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《管辖异议申请书》,认为" + - ",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。"; - if (objectiJuris == null) { - datas.put("jurisdictionalObjection", null); - } else if (objectiJuris == 1) { + Integer objectiJuris = caseApplicationById.getObjectiJuris(); + if (objectiJuris!=null&&objectiJuris == 1) { datas.put("jurisdictionalObjection", jurisdictionalObjection); - } else { - datas.put("jurisdictionalObjection", null); } - String arbitratorName = caseApplication1.getArbitratorName(); - datas.put("arbitratorName", arbitratorName); - Integer arbitratMethod = caseApplication1.getArbitratMethod(); - Date hearDate = caseApplication1.getHearDate(); + // 仲裁员名称 + datas.put("arbitratorName", caseApplicationById.getArbitratorName()); + // 审理方式 + Integer arbitratMethod = caseApplicationById.getArbitratMethod(); + Date hearDate = caseApplicationById.getHearDate(); if (hearDate != null) { + // 审理日期 String hearDateStr = sdf.format(hearDate); - - + // todo 线上仲裁/线下仲裁方式未选择 //线上开庭时 if (arbitratMethod == 1) { - String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。"; - datas.put("onLine1", onLine1); - datas.put("hearDate", hearDateStr); - datas.put("onLine2", onLine2); + String replace = onLine.replace(onLineDate, hearDateStr); + datas.put("onLine", replace); } else { //书面仲裁时 - String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于"; - String written2 = "在仲裁委所在地开庭审理了本案。"; - datas.put("written1", written1); - datas.put("hearDate1", hearDateStr); - datas.put("written2", written2); + String replace = written.replace(writtenDate, hearDateStr); + datas.put("written", replace); + } } - - Integer isAbsence = caseApplication1.getIsAbsence(); - if (isAbsence == null) { - datas.put("absent1", null); - datas.put("absent2", null); - datas.put("absent3", null); - datas.put("absent4", null); - datas.put("absent5", null); - datas.put("attend1", null); - datas.put("attend2", null); - datas.put("attend3", null); - datas.put("attend4", null); - datas.put("attend5", null); - datas.put("attend6", null); - datas.put("attend7", null); - datas.put("appAgentName1", null); - datas.put("appAgentName2", null); - datas.put("resAgentName", null); - } else if (isAbsence == 1) { - //缺席审理 - String absent1 = "申请人的特别授权委托代理人"; - String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" + - "《2022年版仲裁规则》第四十条第(二)项的规定,对本案进行了缺席审理。"; - String absent3 = "庭审中,申请人陈述了仲裁请求事项及事实与理由,出示了证据材料并进行了说明," + - "发表了意见,回答了仲裁庭的提问,并作了最后陈述。因被申请人缺席庭审,故仲裁庭无法组织调解。"; - String absent4 = "(二/三)当事人提供的证据材料\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String absent5 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第四十条第(二)项、第五十一条的规定,缺席裁决如下:"; - datas.put("absent1", absent1); - datas.put("absent2", absent2); - datas.put("absent3", absent3); - datas.put("absent4", absent4); - datas.put("absent5", absent5); - datas.put("appAgentName1", nameAgentList.get(0)); - } else { - //出席审理 - String attend1 = "申请人的特别授权委托代理人"; - String attend2 = "和被申请人本人/的特别授权委托代理人"; - String attend3 = "出席了庭审。"; - String attend4 = "庭审中,申请人陈述了仲裁请求事项及所依据的事实与理由,被申请人进行了答辩;" + - "双方当事人均出示了证据材料并对对方的证据材料进行了质证;申请人出示了证据材料," + - "被申请人对对方的证据材料进行了质证;双方当事人均回答了仲裁庭的提问,进行了辩论," + - "并分别作了最后陈述。双方当事人在仲裁庭的主持下进行了调解,但未能达成调解协议。"; - String attend5 = "(二)被申请人的答辩意见"; - String attend6 = "(二/三)当事人提供的证据材料及对方的质证意见\n" + - "申请人为证明其主张的事实和理由,向仲裁庭提交了如下证据材料:"; - String attend7 = "被申请人对上述材料的质证意见为:"; - datas.put("attend1", attend1); - datas.put("attend2", attend2); - datas.put("attend3", attend3); - datas.put("attend4", attend4); - datas.put("attend5", attend5); - datas.put("attend6", attend6); - datas.put("attend7", attend7); - datas.put("responCrossOpin", arbitrateRecord1.getRespondentOpinion()); - datas.put("appAgentName2", nameAgentList.get(0)); - datas.put("resAgentName", nameAgentList.get(1)); - if (arbitratMethod == 1) { - //被申出席+开庭 - String attend8 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条的规定,裁决如下:"; - datas.put("attend8", attend8); - } else { - //被申出席+书面 - String attend9 = "综上,仲裁庭依据《上海仲裁委员会仲裁规则》(2022年7月1日起施行的版本)" + - "第五十一条、第五十八条的规定,裁决如下:"; - datas.put("attend9", attend9); - } + // 所有附件 + List caseAttachList = caseApplicationById.getCaseAttachList(); + Map> caseAttachMap=new HashMap<>(); + if(caseAttachList!=null&&caseAttachList.size()>0){ + caseAttachMap = caseAttachList.stream().collect(Collectors.groupingBy(CaseAttach::getAnnexType)); } - // 申请人的仲裁请求及事实和理由 申请人称 在事实与理由抓取 - datas.put("claims", caseApplication1.getFacts()); -// datas.put("request", caseApplication1.getRequestRule()); - CaseApplication caseApplication2 = caseApplicationService.selectCaseApplication(caseApplication); - // todo 合同编号 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日"); - // datas.put("partyA", caseApplication2.getContractNumber()); - // Date loanStartDate = caseApplication2.getLoanStartDate(); - // datas.put("lonStartDate",simpleDateFormat.format(loanStartDate)); - // datas.put("contractNumber",caseApplication2.getContractNumber()); - // 合同名称 - // datas.put("contractName",caseApplication2.getContractName()); - // todo 查询该批号的裁决内容模板 - String template="一、被申请人{1}应于{2}前向申请人{3}一次性支付剩余贷款{4}元。\n" + - "二、本案仲裁费人民币{5}元(已由申请人预缴),由申请人{6}承担\n"; - Date loanEndDate = caseApplication2.getLoanEndDate(); - - String outstandingMoney = caseApplication2.getOutstandingMoney(); - NumberFormat format = NumberFormat.getInstance(); - String outstandingMoneyFormat=""; - - if(StrUtil.isNotEmpty(outstandingMoney)) { - outstandingMoneyFormat = format.format(new BigDecimal(outstandingMoney)); - } - String rulingFollows = template.replace("{1}", debtorName).replace("{2}", simpleDateFormat.format(loanEndDate)) - .replace("{3}", applicantName).replace("{4}", outstandingMoneyFormat) - .replace("{5}", String.valueOf(caseApplication2.getFeePayable())) - .replace("{6}", applicantName); - // 请求仲裁庭裁决 - datas.put("request", caseApplication1.getArbitratClaims()); - List caseAttachList1 = caseApplication2.getCaseAttachList(); - if (caseAttachList1 != null && caseAttachList1.size() > 0) { - StringBuilder debtorFiles=new StringBuilder(); - StringBuilder applicantFiles=new StringBuilder(); - for (CaseAttach caseAttach : caseAttachList1) { - if (caseAttach.getAnnexType() == 6) { //被申请人证据材料 - debtorFiles.append(caseAttach.getAnnexName()).append("\r\n"); -// boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); -// if (isImageFile) { -// String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); -// System.out.println("路径是===========" + annexPath); -// PictureRenderData pictureRenderData = WordUtil -// .rebuildImageContent(100, 100, null, annexPath); -// datas.put("resEvidenceMaterial", pictureRenderData); -// } - - } else if (caseAttach.getAnnexType() == 2) { //申请人证据材料 -// String annexName = caseAttach.getAnnexName(); -// boolean isImageFile = Pattern.matches(".*\\.(jpg|png|gif|bmp)$", annexName); -// if (isImageFile) { -// String annexPath = "/home/ruoyi" + caseAttach.getAnnexPath(); -// System.out.println("路径是===========" + annexPath); -// PictureRenderData pictureRenderData = WordUtil -// .rebuildImageContent(100, 100, null, annexPath); -// //申请人证据材料 -// datas.put("appEvidenceMaterial", pictureRenderData); -// } - applicantFiles.append(caseAttach.getAnnexName()).append("\r\n"); - + // 被申请人是否缺席 + Integer isAbsence = caseApplicationById.getIsAbsence(); + // 线上开庭 + if (arbitratMethod == 1) { + if (isAbsence != null && isAbsence == 1) { + // 被申请人缺席 + String absentReplace = absent.replace("{{agentName}}", agentName); + datas.put("absent",absentReplace); + // 被申请人缺席 + String resAbsentReplace=resAbsent; + if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))){ + List caseAttaches = caseAttachMap.get(2); + StringBuilder stringBuilder = new StringBuilder(); + for (CaseAttach caseAttach : caseAttaches) { + stringBuilder.append(caseAttach.getAnnexName()).append("\n"); + } + resAbsentReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()); + } + datas.put("resAbsent",resAbsentReplace); + } else { + // 出席 + String attendReplace = attend.replace("{{agentName}}", agentName); + datas.put("attend",attend); + // 被申请人证据 + if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){ + // 开庭+出席+被申提供证据 + datas.put("onLineAttendFile",onLineAttendFile); + // 被申请人出席+被申请人提供了资料 + String resFileRplace=resFile; + if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(6))){ + List caseAttaches = caseAttachMap.get(6); + StringBuilder stringBuilder = new StringBuilder(); + for (CaseAttach caseAttach : caseAttaches) { + stringBuilder.append(caseAttach.getAnnexName()).append("\n"); + } + resFileRplace = resFile.replace("{{resFile}}", stringBuilder.toString()).replace("{{applicantOpinion}}", arbitrateRecordSelect.getApplicantOpinion()); + } + datas.put("resFile",resFileRplace); + }else { + // 开庭+出席+被申未提供证据 + datas.put("onLineAttend",onLineAttend); + } + // 被申请人出席答辩意见 + String resAttendOpinionReplace=resAttendOpinion; + if(caseAttachMap!=null && CollectionUtil.isNotEmpty(caseAttachMap.get(2))){ + List caseAttaches = caseAttachMap.get(2); + StringBuilder stringBuilder = new StringBuilder(); + for (CaseAttach caseAttach : caseAttaches) { + stringBuilder.append(caseAttach.getAnnexName()).append("\n"); + } + resAttendOpinionReplace = resAttendOpinion.replace("{{applicantFile}}", stringBuilder.toString()).replace("{{respondentOpinion}}", arbitrateRecordSelect.getRespondentOpinion()); } - } - // //被申请人证据材料 - datas.put("resEvidenceMaterial", debtorFiles.toString()); - //申请人证据材料 - datas.put("appEvidenceMaterial", applicantFiles.toString()); - } - // 申请人对上述材料的质证意见为 - datas.put("applicaCrossOpin", arbitrateRecord1.getApplicantOpinion()); - // 仲裁庭经审理,查明本案事实如下: - datas.put("factDetermi", arbitrateRecord1.getCaseFacts()); - // 关于本案争议焦点 - datas.put("arbitrateThink", arbitrateRecord1.getCaseFocus()); -// datas.put("rulingFollows", "被申请人依法偿还申请人欠款"); - // 最终裁决 - datas.put("rulingFollows", rulingFollows); - LocalDate now = LocalDate.now(); - String year = Integer.toString(now.getYear()); - datas.put("year", year); + datas.put("resAttendOpinion",resAttendOpinionReplace); + } + } + + String month = String.format("%02d", now.getMonthValue()); String day = String.format("%02d", now.getDayOfMonth()); String modalFilePath = "/data/arbitrate-document/template/新裁决书模板.docx"; @@ -376,38 +330,52 @@ public class AdjudicationServiceImpl implements IAdjudicationService { WordUtil.changeText(xwpfDocument); } String savePath = docFilePath.substring(0, docFilePath.indexOf("/upload/") + 8); - CaseAttach caseAttach = CaseAttach.builder() - .caseAppliId(id) - .annexName(saveName) - .annexPath(savePath) - .annexType(3) - .build(); - //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增 - List caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach); - if (caseAttachList != null && caseAttachList.size() > 0) { - //之前已经生成过了,更新 - int i = caseAttachMapper.updateCaseAttachBycaseid(caseAttach); - } else { - //之前没生成过,新增 - int i = caseAttachMapper.save(caseAttach); - if (i > 0) { - if (arbitrateRecord1 != null) { - Integer annexId = caseAttach.getAnnexId(); - //将附件id保存到仲裁记录表里面 - arbitrateRecord1.setAnnexId(annexId); - arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecord1); - } - } - } - //修改案件状态 - caseApplication1.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); - caseApplicationMapper.submitCaseApplication(caseApplication1); + // 保存裁决书附件 + saveArbitorFile(id,saveName,savePath,caseApplicationById,arbitrateRecordSelect); + return AjaxResult.success("裁决书已生成"); } catch (IOException e) { return AjaxResult.error(e + "请检查文件路径是否有误"); } } + /** + * 保存裁决书附件 + * @param id 案件id + * @param saveName 保存的文件名 + * @param savePath 保存路径 + * @param caseApplicationById 案件基本信息 + * @param arbitrateRecordSelect 出裁决书生成记录 + */ + private void saveArbitorFile(Long id, String saveName, String savePath, CaseApplication caseApplicationById, ArbitrateRecord arbitrateRecordSelect) { + CaseAttach caseAttach = CaseAttach.builder() + .caseAppliId(id) + .annexName(saveName) + .annexPath(savePath) + .annexType(3) + .build(); + //保存到附件表里,先判断之前有没有,有的话更新,没有的话新增 + List caseAttachList = caseAttachMapper.getCaseAttachByCaseIdAndType(caseAttach); + if (caseAttachList != null && caseAttachList.size() > 0) { + //之前已经生成过了,更新 + int i = caseAttachMapper.updateCaseAttachBycaseid(caseAttach); + } else { + //之前没生成过,新增 + int i = caseAttachMapper.save(caseAttach); + if (i > 0) { + if (arbitrateRecordSelect != null) { + Integer annexId = caseAttach.getAnnexId(); + //将附件id保存到仲裁记录表里面 + arbitrateRecordSelect.setAnnexId(annexId); + arbitrateRecordMapper.updataArbitrateRecord(arbitrateRecordSelect); + } + } + } + //修改案件状态 + caseApplicationById.setCaseStatus(CaseApplicationConstants.VERPRIF_ARBITRATION); + caseApplicationMapper.submitCaseApplication(caseApplicationById); + } + @Override @Transactional public AjaxResult sendDocumentByEmail(Long id, String appEmail, String resEmail, String apptrackingNum, String restrackingNum) { @@ -1097,5 +1065,37 @@ public class AdjudicationServiceImpl implements IAdjudicationService { } } + /** + * 根据裁决书模板获取所有的占位符,占位符必须是{{name}}格式 + * @param path + * @return + */ + public List getBookmarkByDocx(String path){ + XWPFDocument xwpfDocument = null; + try { + FileInputStream fileInputStream = new FileInputStream(path); + xwpfDocument = new XWPFDocument(fileInputStream); + } catch (IOException e) { + e.printStackTrace(); + } + List paragraphs = xwpfDocument.getParagraphs(); + String regex = "\\{\\{.*?\\}\\}"; // 定义占位符的正则表达式 + Pattern pattern = Pattern.compile(regex); + List bookmarkList=new ArrayList<>(); + for (XWPFParagraph paragraph : paragraphs) { + String text = paragraph.getText(); + Matcher matcher = pattern.matcher(text); + + while (matcher.find()) { + String placeholder = matcher.group(); + String keyword = placeholder.substring(2, placeholder.length() - 2); + bookmarkList.add(keyword); + } + } + return bookmarkList; + } + + + } \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 88d78e3..4a132a7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -34,6 +34,7 @@ import com.ruoyi.system.mapper.SysDeptMapper; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; +import com.ruoyi.wisdomarbitrate.domain.vo.ColumnValue; import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO; import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; @@ -136,6 +137,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { private CaseAffiliateLogMapper caseAffiliateLogMapper; @Autowired private CaseAttachLogMapper caseAttachLogMapper; + @Autowired + private FatchRuleMapper fatchRuleMapper; + @Autowired + private ColumnValueMapper columnValueMapper; // 手机号正则 private static final Pattern TELEPHONE_REGX = Pattern.compile("^1(3\\d|4[5-9]|5[0-35-9]|6[2567]|7[0-8]|8\\d|9[0-35-9])\\d{8}$"); @@ -412,6 +417,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String zipName = file.getOriginalFilename(); String subzipName = zipName.substring(0, zipName.indexOf(".zip")); // String zipPath = "F:\\testZip\\uploadPath\\upload\\upload1\\unzipFile\\"+subzipName; + // todo 服务器路径需要改 String zipPath = "/home/ruoyi/uploadPath/upload/unzipFile/" + subzipName; // String zipPath = "D:/" + subzipName; @@ -934,7 +940,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { */ @Override @Transactional - public int insertcaseApplication(CaseApplication caseApplication) { + public int insertcaseApplication(CaseApplication caseApplication,Map fatchMap) { caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION); //根据仲裁费用计费规则计算应缴费用 @@ -1033,6 +1039,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates); } + // 新增动态配置字段值表 + insertColumnValue(fatchMap,caseApplication.getCaseAppliId()); + }); return rows; @@ -2989,180 +2998,204 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { //解压缩上传的压缩包 boolean unzipSuccess = UnZipFileUtils.unZipFile(zipFile, targetPath); if (unzipSuccess) { + // 查询抓取规则 + // todo 批次需要再上传压缩包时用户填写 + List fatchRuleList = fatchRuleMapper.listByTemplateId("9"); File directory = new File(targetPath); - Map andConvertPDF = findAndConvertPDF(directory); + Map andConvertPDF = findAndConvertPDF(directory,fatchRuleList); if (andConvertPDF != null && andConvertPDF.size() > 0) { - Map> map = new HashMap<>(); - // oc识别pdf并组装数据 - // 抓取申请书 - if(!OCRAndBuildInfo(andConvertPDF, "仲裁申请书", map)){ - return AjaxResult.error("未找到该路径:"+andConvertPDF); + Map fatchMap = new HashMap<>(); + if(CollectionUtil.isNotEmpty(fatchRuleList)){ + Map> fatchRuleMap = fatchRuleList.stream().collect(Collectors.groupingBy(FatchRule::getFileName)); + // 根据抓取规则循环抓取 + for (Map.Entry> entry : fatchRuleMap.entrySet()) { + OCRAndBuildInfo(andConvertPDF,entry.getKey(),fatchMap,entry.getValue()); + } } - // 抓取调节协议书 - if(!OCRAndBuildInfo(andConvertPDF, "调解协议", map)){ - return AjaxResult.error("未找到该路径:"+andConvertPDF); - } - // 抓取合同 - if(!OCRAndBuildInfo(andConvertPDF, "贷款合同", map)){ - return AjaxResult.error("未找到该路径:"+andConvertPDF); - } - if(!OCRAndBuildInfo(andConvertPDF, "授权委托书", map)){ - return AjaxResult.error("未找到该路径:"+andConvertPDF); - } - if (map.size()>0){ + if (fatchMap.size()>0){ + // todo 从压缩包中识别各字段填充到数据库 //调用新增案件的接口 CaseApplication caseApplication = new CaseApplication(); //默认案件标的 todo 案件标的是什么 caseApplication.setCaseSubjectAmount(new BigDecimal(1)); - caseApplication.setApplicationOrganId(map.get("统一社会信用代码").get(0)); - caseApplication.setArbitratClaims(map.get("仲裁请求").get(0)); - caseApplication.setFacts(map.get("事实和理由").get(0)); - String contractNumber = map.get("合同编号").get(0); - // 提取字母和数字 - String regx="[^a-zA-Z0-9]"; - String replaceAll = contractNumber.replaceAll(regx, ""); + // todo 这些以后要去掉,不在案件基本信息表维护,现在往基本信息表设置字段是因为修改以及查询详情的时候页面中字段是固定的,以后也要动态维护字段 + // 仲裁请求 + caseApplication.setArbitratClaims(fatchMap.get("arbitrationClaims")); + // 事实和理由 + caseApplication.setFacts(fatchMap.get("factsAndReason")); + // 合同编号 + String contractNumber = fatchMap.get("contractNumber"); + if(StrUtil.isNotEmpty(contractNumber)) { + // 提取字母和数字 + String regx = "[^a-zA-Z0-9]"; + String replaceAll = contractNumber.replaceAll(regx, ""); - caseApplication.setContractNumber(replaceAll.toUpperCase()); - String lonStartDate = map.get("或委托代理人签字:").get(0); + caseApplication.setContractNumber(replaceAll.toUpperCase()); + } + // 借款开始日期 + String lonStartDate = fatchMap.get("lonStartDate:"); SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("yyyy年MM月dd日"); - try { - caseApplication.setLoanStartDate( sdf.parse(lonStartDate)); - } catch (ParseException e) { - e.printStackTrace(); - } - // todo 查询同一批号的模板 - // 金融消费纠纷基本情况 - String disputes = map.get("金融消费纠纷基本情况").get(0); - String disputesTemplate="本案当事人甲{1}(下称“甲方”)于{2}向本案当事人乙{3}(下称“乙方”)申请{3}贷款,贷款金额人民币{4}元,贷款期限{5}期。截至{6},甲方尚欠乙方金额总计人民币{7}元。因甲方诉求与乙方进行协商还款。乙方为妥善解决纠纷,故申请调解中心进行调解。"; - List disputeList = getReplaceList(disputesTemplate, disputes); - if(CollectionUtil.isNotEmpty(disputeList)){ - if(disputeList.size()>3){ - caseApplication.setLoanType(disputeList.get(3)); - } - if(disputeList.size()>4) { - String claimPrinciOwed = disputeList.get(4); - // 金额格式化 - try { - Double.parseDouble(claimPrinciOwed); - - caseApplication.setClaimPrinciOwed(new BigDecimal(claimPrinciOwed)); - } catch (NumberFormatException e) { - - String regEx = "[^0-9]"; - Pattern p = Pattern.compile(regEx); - Matcher m = p.matcher(claimPrinciOwed); - String result = m.replaceAll("").trim(); - BigDecimal bigDecimal = null; - if (claimPrinciOwed.contains("百")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100")); - } else if (claimPrinciOwed.contains("千")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000")); - } else if (claimPrinciOwed.contains("万")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000")); - } else if (claimPrinciOwed.contains("百万")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000000")); - } else if (claimPrinciOwed.contains("千万")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000000")); - } else if (claimPrinciOwed.contains("亿")) { - bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100000000")); - } - // todo 生产裁决书时金额格式增加千分位 - // NumberFormat format = NumberFormat.getInstance(); - // String format1 = format.format(bigDecimal); - - caseApplication.setClaimPrinciOwed(bigDecimal); - } - } - - if(disputeList.size()>5){ - caseApplication.setLoanTerm(disputeList.get(5)); - } - } - // 调解协议 - String mediationAgreement = map.get("经调解,双方自愿达成如下协议").get(0); - caseApplication.setMediationAgreement(mediationAgreement); - String mediationAgreementTemplate="1、乙方从维系客户的角度出发,同意为甲方申请停催至{1},停催期间正常计息,且征信影响由甲方自行承担。2、甲方应于{2}停催到期前向乙方申请费息减免业务,并按人民币{3}元一次性结清剩余贷款。3、今后双方无涉,就此结案。"; - // 对比模板和pdf识别的内容,取出占位符对应的值 - List mediationAgreementList = getReplaceList(mediationAgreementTemplate, mediationAgreement); - if(CollectionUtil.isNotEmpty(mediationAgreementList)){ - // 截止日期 - String lonEndDate = mediationAgreementList.get(0); + if(StrUtil.isNotEmpty(lonStartDate)) { try { - caseApplication.setLoanEndDate( sdf.parse(lonEndDate)); + caseApplication.setLoanStartDate(sdf.parse(lonStartDate)); } catch (ParseException e) { e.printStackTrace(); } - if(mediationAgreementList.size()>2){ - // 待还金额 - caseApplication.setOutstandingMoney(mediationAgreementList.get(2)); - } } - // 合同甲方 - caseApplication.setPartyA(map.get("甲方(贷款人)").get(0)); + // todo 查询同一批号的模板 + // 金融消费纠纷基本情况 + String disputes = fatchMap.get("disputes"); + caseApplication.setDisputes(disputes); +// String disputesTemplate="本案当事人甲{1}(下称“甲方”)于{2}向本案当事人乙{3}(下称“乙方”)申请{3}贷款,贷款金额人民币{4}元,贷款期限{5}期。截至{6},甲方尚欠乙方金额总计人民币{7}元。因甲方诉求与乙方进行协商还款。乙方为妥善解决纠纷,故申请调解中心进行调解。"; +// List disputeList = getReplaceList(disputesTemplate, disputes); +// if(CollectionUtil.isNotEmpty(disputeList)){ +// if(disputeList.size()>3){ +// caseApplication.setLoanType(disputeList.get(3)); +// } +// if(disputeList.size()>4) { +// String claimPrinciOwed = disputeList.get(4); +// // 金额格式化 +// try { +// Double.parseDouble(claimPrinciOwed); +// +// caseApplication.setClaimPrinciOwed(new BigDecimal(claimPrinciOwed)); +// } catch (NumberFormatException e) { +// +// String regEx = "[^0-9]"; +// Pattern p = Pattern.compile(regEx); +// Matcher m = p.matcher(claimPrinciOwed); +// String result = m.replaceAll("").trim(); +// BigDecimal bigDecimal = null; +// if (claimPrinciOwed.contains("百")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100")); +// } else if (claimPrinciOwed.contains("千")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000")); +// } else if (claimPrinciOwed.contains("万")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000")); +// } else if (claimPrinciOwed.contains("百万")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("1000000")); +// } else if (claimPrinciOwed.contains("千万")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("10000000")); +// } else if (claimPrinciOwed.contains("亿")) { +// bigDecimal = new BigDecimal(result).multiply(new BigDecimal("100000000")); +// } +// // todo 生产裁决书时金额格式增加千分位 +// // NumberFormat format = NumberFormat.getInstance(); +// // String format1 = format.format(bigDecimal); +// +// caseApplication.setClaimPrinciOwed(bigDecimal); +// } +// } +// +// if(disputeList.size()>5){ +// caseApplication.setLoanTerm(disputeList.get(5)); +// } +// } + // 调解协议内容 + String mediationAgreement = fatchMap.get("mediationAgreement"); + caseApplication.setMediationAgreement(mediationAgreement); +// String mediationAgreementTemplate="1、乙方从维系客户的角度出发,同意为甲方申请停催至{1},停催期间正常计息,且征信影响由甲方自行承担。2、甲方应于{2}停催到期前向乙方申请费息减免业务,并按人民币{3}元一次性结清剩余贷款。3、今后双方无涉,就此结案。"; +// // 对比模板和pdf识别的内容,取出占位符对应的值 +// List mediationAgreementList = getReplaceList(mediationAgreementTemplate, mediationAgreement); +// if(CollectionUtil.isNotEmpty(mediationAgreementList)){ +// // 截止日期 +// String lonEndDate = mediationAgreementList.get(0); +// try { +// caseApplication.setLoanEndDate( sdf.parse(lonEndDate)); +// } catch (ParseException e) { +// e.printStackTrace(); +// } +// if(mediationAgreementList.size()>2){ +// // 待还金额 +// caseApplication.setOutstandingMoney(mediationAgreementList.get(2)); +// } +// } + // 合同甲方(贷款人) + caseApplication.setPartyA(fatchMap.get("partyA")); List caseAffiliates = new ArrayList<>(); CaseAffiliate caseAffiliate = new CaseAffiliate(); caseAffiliate.setIdentityType(1); - caseAffiliate.setName(map.get("申请人").get(0)); - caseAffiliate.setIdentityNum(map.get("统一社会信用代码").get(0)); - caseAffiliate.setCompLegalPerson(map.get("负责人").get(0)); - if(map.get("职务").size()>0) { - // 法定代表人职务 - caseAffiliate.setCompLegalperPost(map.get("职务").get(0)); - if(map.get("职务").size()>1) { - // 代理人职务 - caseAffiliate.setAppliAgentTitle(map.get("职务").get(1)); - } - } - caseAffiliate.setNameAgent(map.get("委托代理人").get(0)); - caseAffiliate.setContactTelphoneAgent(map.get("联系电话").get(0)); - caseAffiliate.setResidenAffili(map.get("住所").get(0)); - caseAffiliate.setContactAddress(map.get("联系地址").get(0)); - caseAffiliate.setAgentEmail(map.get("电子邮件").get(0).replaceAll("\\s", "")); + // 申请人 + caseAffiliate.setName(fatchMap.get("applicantName")); + // 统一社会信用代码 + caseAffiliate.setIdentityNum(fatchMap.get("creditCode")); + // 法定代表人 + caseAffiliate.setCompLegalPerson(fatchMap.get("legalRepresentative")); + // 申请人联系电话 + caseAffiliate.setContactTelphone(fatchMap.get("applicantPhone")); + // 申请人住所 + caseAffiliate.setResidenAffili(fatchMap.get("applicantHome")); + // 申请人联系地址 + caseAffiliate.setContactAddress(fatchMap.get("applicantAddress")); +// if(map.get("职务").size()>0) { +// // 法定代表人职务 +// caseAffiliate.setCompLegalperPost(map.get("职务").get(0)); +// if(map.get("职务").size()>1) { +// // 代理人职务 +// caseAffiliate.setAppliAgentTitle(map.get("职务").get(1)); +// } +// } + // 委托代理人 + caseAffiliate.setNameAgent(fatchMap.get("agentName")); + // 委托代理人联系电话 + caseAffiliate.setContactTelphoneAgent(fatchMap.get("agentPhone")); + + // 代理人电子邮件 + caseAffiliate.setAgentEmail(fatchMap.get("agentEmail").replaceAll("\\s", "")); //设置默认代理人的身份证号码,暂时写死 要不然新增方法报错 // caseAffiliate.setIdentityNumAgent("610423199603171716"); caseAffiliates.add(caseAffiliate); - CaseAffiliate caseAffiliate1 = new CaseAffiliate(); - caseAffiliate1.setIdentityType(2); - caseAffiliate1.setName(map.get("被申请人").get(0)); + // 被申请人信息 + CaseAffiliate respondentAffiliate = new CaseAffiliate(); + respondentAffiliate.setIdentityType(2); + // 被申请人名称 + respondentAffiliate.setName(fatchMap.get("respondentName")); // 被申请人身份证 - String identityNum = map.get("居民身份证号码").get(0); - caseAffiliate1.setIdentityNum(identityNum); - // 被申请人电子邮件 - if(map.get("乙方确认有效的电子信箱地址为").size()>1) { - if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) { - caseAffiliate1.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", "")); - }else { - caseAffiliate1.setEmail(map.get("乙方确认有效的电子信箱地址为").get(0).replaceAll("\\s", "")); - } - } - // 出生年月日,从身份证抓取 - if(StrUtil.isNotEmpty(identityNum)) { - Map identityNumMap = getBirAgeSex(identityNum); - String birthday = identityNumMap.get("birthday"); - if(StrUtil.isNotEmpty(birthday)) { - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date birthdayDate = null; - try { - birthdayDate = simpleDateFormat.parse(birthday); - } catch (Exception e) { - e.printStackTrace(); - } - caseAffiliate1.setResponBirth(birthdayDate); + String identityNum = fatchMap.get("respondentCard"); + // 出生年月日,从身份证抓取 + if(StrUtil.isNotEmpty(identityNum)) { + Map identityNumMap = getBirAgeSex(identityNum); + String birthday = identityNumMap.get("birthday"); + if(StrUtil.isNotEmpty(birthday)) { + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + Date birthdayDate = null; + try { + birthdayDate = simpleDateFormat.parse(birthday); + } catch (Exception e) { + e.printStackTrace(); } - //从身份证抓取性别 - caseAffiliate1.setResponSex(identityNumMap.get("sexCode")); + fatchMap.put("resDateOfBirth", sdf.format(birthdayDate)); + respondentAffiliate.setResponBirth(birthdayDate); } - caseAffiliate1.setContactTelphone(map.get("联系电话").get(1)); - caseAffiliate1.setResidenAffili(map.get("住所").get(1)); + //从身份证抓取性别 + fatchMap.put("resSex",identityNumMap.get("sexCode")); + respondentAffiliate.setResponSex(identityNumMap.get("sexCode")); + } + respondentAffiliate.setIdentityNum(identityNum); + // 被申请人电子邮件 +// if(map.get("乙方确认有效的电子信箱地址为").size()>1) { +// if(map.get("乙方确认有效的电子信箱地址为").get(0).contains("/")) { +// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(1).replaceAll("\\s", "")); +// }else { +// respondentAffiliate.setEmail(map.get("乙方确认有效的电子信箱地址为").get(0).replaceAll("\\s", "")); +// } +// } + // 被申请人电子邮件 + respondentAffiliate.setEmail(fatchMap.get("respondentEmail").replaceAll("\\s", "")); + // 被申请人联系电话 + respondentAffiliate.setContactTelphone(fatchMap.get("respondentPhone")); + // 被申请人住所 + respondentAffiliate.setResidenAffili(fatchMap.get("respondentHome")); - caseAffiliates.add(caseAffiliate1); + caseAffiliates.add(respondentAffiliate); caseApplication.setCaseAffiliates(caseAffiliates); - this.insertcaseApplication(caseApplication); + // 新增案件基本信息表 + this.insertcaseApplication(caseApplication,fatchMap); if (null != caseApplication.getId()) { List caseAttachs=new ArrayList<>(); for (Map.Entry entry : andConvertPDF.entrySet()) { @@ -3199,49 +3232,54 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { return null; } - private boolean OCRAndBuildInfo( Map andConvertPDF, String mapKey, Map> map) { + /** + * 新增动态配置字段值表 + * @param fatchMap + * @param caseApplicId + */ + private void insertColumnValue(Map fatchMap, Long caseApplicId) { + if(fatchMap==null){ + return; + } + // 新增到动态配置字段表 + List columnValueList=new ArrayList<>(); + // todo 新增完案件信息表后这样改 + + fatchMap.forEach((key,value)->{ + ColumnValue columnValue = new ColumnValue(); + columnValue.setCaseId(caseApplicId); + columnValue.setColumn(key); + columnValue.setValue(value); + // todo 组装的map中的key需要column+@+columnName拼接 + columnValue.setName(""); + columnValueList.add(columnValue); + }); + if(CollectionUtil.isNotEmpty(columnValueList)){ + // 批量新增 + columnValueMapper.batchSave(columnValueList); + } + } + + private boolean OCRAndBuildInfo( Map andConvertPDF,String mapKey, Map map, List fatchRules) { String pdfUrl = andConvertPDF.get(mapKey); - if(StrUtil.isEmpty(pdfUrl)){ - throw new ServiceException("pdfUrl:"+pdfUrl+"===mapKey:"+mapKey); - // return false; - } - //获取文件的页数 - int fileNumPage = getFileNumPage(pdfUrl); - //文件转成base64 - String base64 = OCRUtils.pdfConvertBase64(pdfUrl); - if (base64 == null){ - throw new ServiceException("文件转成base64 pdfUrl:"+pdfUrl+"===mapKey:"+mapKey); - // return false; - } - StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象 - for (int i = 0; i < fileNumPage; i++) { - //对接腾讯云接口.识别里面的数据 - String text = OCRUtils.pdfIdentifyText(base64, i + 1,mapKey); - if (stringBuilder.length() > 0) { - stringBuilder.append(Constants.BR); // 在已有内容的情况下添加逗号分隔符 + if(StrUtil.isNotEmpty(pdfUrl)) { + //获取文件的页数 + int fileNumPage = getFileNumPage(pdfUrl); + //文件转成base64 + String base64 = OCRUtils.pdfConvertBase64(pdfUrl); + if (base64 == null) { + throw new ServiceException("文件转成base64,转码失败"); + // return false; } - stringBuilder.append(text); // 拼接当前的字符串 - } - // 将字符串按逗号分隔符切割 - String[] fields = stringBuilder.toString().split(Constants.BR); - for (String field : fields) { - // 对于每个字段,再按冒号分隔符拆分出键和值 - String[] keyValue = field.split(Constants.PDFSTR); - if (keyValue.length >= 2) { - String key = keyValue[0]; - String value = keyValue[1]; - // 判断Map中是否已存在该键 - if (map.containsKey(key)) { - // 如果已存在,获取该键对应的值,并将新的值添加到集合中 - List values = map.get(key); - values.add(value); - } else { - // 如果不存在,创建一个新的集合,并将值添加到集合中 - List values = new ArrayList<>(); - values.add(value); - map.put(key, values); - } + StringBuilder ocrText = new StringBuilder(); // 创建一个StringBuilder对象 + for (int i = 0; i < fileNumPage; i++) { + //对接腾讯云接口.识别里面的数据 + String text = OCRUtils.pdfIdentifyText(base64, i + 1, fatchRules); + ocrText.append(text); // 拼接当前的字符串 + } + if(StrUtil.isNotEmpty(ocrText)){ + OCRUtils.fatchRuleGetContent(ocrText.toString(), fatchRules,map); } } return true; @@ -3303,7 +3341,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { } - public static Map findAndConvertPDF(File directory) { + public static Map findAndConvertPDF(File directory, List fatchRuleList ) { Map pdfPathMap= new HashMap<>(); if (directory.isFile()) { String path = ""; @@ -3320,46 +3358,16 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { path = pdfPath; } } - if (path != null) { // 如果文件名包含"仲裁申请书"且是PDF格式,直接返回路径 // 如果是PDF格式,直接添加到列表中 - String name=""; - if (directory.getName().contains("仲裁申请书")) { - name="仲裁申请书"; - } - if (directory.getName().contains("调解协议")) { - name="调解协议"; - } - if (directory.getName().contains("情况说明")) { - name="情况说明"; - } - if (directory.getName().contains("贷款合同")) { - name="贷款合同"; - } - if (directory.getName().contains("营业执照")) { - name="营业执照"; - } - if (directory.getName().contains("负责人证明")) { - name="负责人证明"; - } - if (directory.getName().contains("负责人身份证")) { - name="负责人身份证"; - } - if (directory.getName().contains("授权委托书")) { - name="授权委托书"; - } - if (directory.getName().contains("经办人员的劳动合同")) { - name="经办人员的劳动合同"; - } - if (directory.getName().contains("经办人员身份证")) { - name="经办人员的身份证"; - } - if (directory.getName().contains("自然人身份证")) { - name="自然人身份证"; - } - - pdfPathMap.put(name,path); - } +// if(CollectionUtil.isNotEmpty(fatchRuleList)) { +// for (FatchRule fatchRule : fatchRuleList) { +// if(fatchRule.getFileName().contains(directory.getName())){ + pdfPathMap.put(directory.getName(), path); +// } +// } +// +// } // } } else if (directory.isDirectory()) { searchAndConvertPDF(directory, pdfPathMap); @@ -3391,51 +3399,18 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { continue; } if (file.isFile()) { - String name=""; - if (file.getName().contains("仲裁申请书")) { - name="仲裁申请书"; - } - if (file.getName().contains("调解协议")) { - name="调解协议"; - } - if (file.getName().contains("情况说明")) { - name="情况说明"; - } - if (file.getName().contains("贷款合同")) { - name="贷款合同"; - } - if (file.getName().contains("营业执照")) { - name="营业执照"; - } - if (file.getName().contains("负责人证明")) { - name="负责人证明"; - } - if (file.getName().contains("负责人身份证")) { - name="负责人身份证"; - } - if (file.getName().contains("授权委托书")) { - name="授权委托书"; - } - if (file.getName().contains("经办人员的劳动合同")) { - name="经办人员的劳动合同"; - } - if (file.getName().contains("经办人员的身份证")) { - name="经办人员身份证"; - } - if (file.getName().contains("自然人身份证")) { - name="自然人身份证"; - } + // 如果是文件且文件名包含"仲裁申请书" // if (file.getName().contains("仲裁申请书")) { if (isPDF(file)) { // 如果是PDF格式,直接添加到列表中 - pdfPathMap.put(name,file.getAbsolutePath()); + pdfPathMap.put(file.getName(),file.getAbsolutePath()); } else { // 如果不是PDF格式,进行转换成PDF并添加转换后的路径到列表中 String pdfPath = convertToPDF(file); if (pdfPath != null) { // 如果是PDF格式,直接添加到列表中 - pdfPathMap.put(name,pdfPath); + pdfPathMap.put(file.getName(),pdfPath); } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java index 7f605c9..3de5e14 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/utils/OCRUtils.java @@ -1,23 +1,25 @@ package com.ruoyi.wisdomarbitrate.utils; +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.util.StrUtil; import com.ruoyi.common.constant.Constants; +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.wisdomarbitrate.domain.FatchRule; import com.tencentcloudapi.bsca.v20210811.models.LicenseSummary; 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.SmartStructuralOCRV2Request; -import com.tencentcloudapi.ocr.v20181119.models.SmartStructuralOCRV2Response; +import com.tencentcloudapi.ocr.v20181119.models.*; import org.json.JSONArray; import org.json.JSONObject; import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.util.ArrayList; -import java.util.Base64; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; public class OCRUtils { //API的SecretId @@ -34,8 +36,88 @@ public class OCRUtils { private static final String[] accordName = {"金融消费纠纷基本情况","经调解,双方自愿达成如下协议"}; // 授权委托书识别字段 private static final String[] powerAttorneyName = {"职务"}; + /** + * pdf识别成文字 + * @param imageBase64 + * @param pageNumber + * @param fatchRules 抓取规则 + * @return + */ + public static String pdfIdentifyText(String imageBase64, Integer pageNumber, List fatchRules) { + StringBuilder respStr=new StringBuilder(); + try { + // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密 + // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305 + // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取 + Credential cred = new Credential(SECRET_ID, SECRET_KEY); + // 实例化一个http选项,可选的,没有特殊需求可以跳过 + HttpProfile httpProfile = new HttpProfile(); + httpProfile.setEndpoint("ocr.tencentcloudapi.com"); + // 实例化一个client选项,可选的,没有特殊需求可以跳过 + ClientProfile clientProfile = new ClientProfile(); + clientProfile.setHttpProfile(httpProfile); + // 实例化要请求产品的client对象,clientProfile是可选的 + OcrClient client = new OcrClient(cred, "ap-beijing", clientProfile); + // 实例化一个请求对象,每个接口都会对应一个request对象 + GeneralAccurateOCRRequest req = new GeneralAccurateOCRRequest(); + req.setImageBase64(imageBase64); + req.setIsPdf(true); + req.setPdfPageNumber(pageNumber.longValue()); + // 返回的resp是一个SmartStructuralOCRV2Response的实例,与请求对象对应 + GeneralAccurateOCRResponse resp = client.GeneralAccurateOCR(req); + // 输出json格式的字符串回包 + System.out.println(GeneralAccurateOCRResponse.toJsonString(resp)); + // 获取响应内容 + TextDetection[] textDetections = resp.getTextDetections(); + if (textDetections == null || textDetections.length == 0) { + return respStr.toString(); + } + for (TextDetection textDetection : textDetections) { + respStr.append(textDetection.getDetectedText()); + } + }catch (TencentCloudSDKException e){ + throw new ServiceException("ocr识别失败"); + } + if(respStr.toString().endsWith(String.valueOf(pageNumber))){ + int lastIndexOf = respStr.toString().lastIndexOf(String.valueOf(pageNumber)); + return respStr.toString().substring(0,lastIndexOf); + } + return respStr.toString(); + +// +// //解析数据 +// String s = GeneralAccurateOCRResponse.toJsonString(resp); +// // 解析JSON数据 +// JSONObject jsonObject = new JSONObject(s); +// JSONArray structuralList = jsonObject.getJSONArray("TextDetections"); +// // 遍历StructuralList中的Groups,获取Key对应的AutoName和Value对应的AutoConten +// StringBuilder stringBuilder = new StringBuilder(); // 创建一个StringBuilder对象 +// for (int i = 0; i < structuralList.length(); i++) { +// JSONArray groups = structuralList.getJSONObject(i).getJSONArray("Groups"); +// for (int j = 0; j < groups.length(); j++) { +// JSONArray lines = groups.getJSONObject(j).getJSONArray("Lines"); +// for (int k = 0; k < lines.length(); k++) { +// JSONObject line = lines.getJSONObject(k); +// JSONObject key = line.getJSONObject("Key"); +// JSONObject value = line.getJSONObject("Value"); +// String autoName = key.getString("AutoName"); +// String autoContent = value.getString("AutoContent"); +// String text = autoName + Constants.PDFSTR + autoContent; +// if (stringBuilder.length() > 0) { +// stringBuilder.append(Constants.BR); // 在已有内容的情况下添加逗号分隔符 +// } +// stringBuilder.append(text); // 拼接当前的字符串 +// } +// } +// } +// return stringBuilder.toString(); // 获取最终的拼接结果 +// } catch (TencentCloudSDKException e) { +// System.out.println(e.toString()); +// } + } + /** * pdf识别成文字 * @param imageBase64 @@ -43,7 +125,7 @@ public class OCRUtils { * @param type pdf类型 * @return */ - public static String pdfIdentifyText(String imageBase64, Integer pageNumber,String type) { + public static String pdfIdentifyText1(String imageBase64, Integer pageNumber,String type) { try { // 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密 // 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305 @@ -122,4 +204,36 @@ public class OCRUtils { return null; } + /** + * 根据抓取规则获取内容 + * @param ocrText ocr识别的text + * @param fatchRules 抓取规则 + * @return + */ + public static void fatchRuleGetContent(String ocrText, List fatchRules, Map fatchMap) { + + if (CollectionUtil.isNotEmpty(fatchRules)) { + + for (FatchRule fatchRule : fatchRules) { + if (StrUtil.isEmpty(fatchRule.getStartContent())) { + continue; + } + // 开始截取字符串 申请人:赵会 + // String[] startContentSplit = ocrText.split(fatchRule.getStartContent()); + int startFirstIndex = ocrText.indexOf(fatchRule.getStartContent()) + fatchRule.getStartContent().length(); + if (ocrText.length() >= startFirstIndex) { + ocrText = ocrText.substring(startFirstIndex); + } + + if (StrUtil.isNotEmpty(fatchRule.getEndContent())) { + int endFirstIndex = ocrText.indexOf(fatchRule.getEndContent()) + fatchRule.getEndContent().length(); + if (ocrText.length() >= (endFirstIndex-fatchRule.getEndContent().length())) { + fatchMap.put(fatchRule.getColumn(), ocrText.substring(0, endFirstIndex-fatchRule.getEndContent().length())); + ocrText = ocrText.substring(endFirstIndex-fatchRule.getEndContent().length()); + } + } + } + + } + } } diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml new file mode 100644 index 0000000..6f55b7a --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ColumnValueMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + INSERT INTO column_value ( `COLUMN`, `NAME`, `VALUE`, case_id ) + values + + + (#{item.column},#{item.name},#{item.value},#{item.caseId}) + + + + + + \ No newline at end of file diff --git a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml index 07cb04e..9c9316b 100644 --- a/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wisdomarbitrate/FatchRuleMapper.xml @@ -5,16 +5,16 @@ + - - - + - + select fr.* from fatch_rule fr join template_fatch_rule tfr on fr.id=tfr.fatch_rule_id + where template_id=#{templateId}