Commit 765ee98a authored by R10's avatar R10

智写-问数-下载

parent ab9772d0
package cn.com.poc.law.convert;
import cn.com.poc.law.model.BizAiLawyerWritingTemplateDownloadModel;
import cn.com.poc.law.entity.BizAiLawyerWritingTemplateDownloadEntity;
import cn.com.poc.law.dto.BizAiLawyerWritingTemplateDownloadDto;
public class BizAiLawyerWritingTemplateDownloadConvert {
public static BizAiLawyerWritingTemplateDownloadEntity modelToEntity(BizAiLawyerWritingTemplateDownloadModel model){
BizAiLawyerWritingTemplateDownloadEntity entity = new BizAiLawyerWritingTemplateDownloadEntity();
entity.setId(model.getId());
entity.setTemplateCode(model.getTemplateCode());
entity.setType(model.getType());
entity.setName(model.getName());
entity.setOption(model.getOption());
entity.setEntityClass(model.getEntityClass());
return entity;
}
public static BizAiLawyerWritingTemplateDownloadModel entityToModel(BizAiLawyerWritingTemplateDownloadEntity entity){
BizAiLawyerWritingTemplateDownloadModel model = new BizAiLawyerWritingTemplateDownloadModel();
model.setId(entity.getId());
model.setTemplateCode(entity.getTemplateCode());
model.setType(entity.getType());
model.setName(entity.getName());
model.setOption(entity.getOption());
model.setEntityClass(entity.getEntityClass());
return model;
}
public static BizAiLawyerWritingTemplateDownloadDto entityToDto(BizAiLawyerWritingTemplateDownloadEntity entity){
BizAiLawyerWritingTemplateDownloadDto dto = new BizAiLawyerWritingTemplateDownloadDto();
dto.setId(entity.getId());
dto.setTemplateCode(entity.getTemplateCode());
dto.setType(entity.getType());
dto.setName(entity.getName());
dto.setOption(entity.getOption());
dto.setEntityClass(entity.getEntityClass());
return dto;
}
public static BizAiLawyerWritingTemplateDownloadEntity dtoToEntity(BizAiLawyerWritingTemplateDownloadDto dto){
BizAiLawyerWritingTemplateDownloadEntity entity = new BizAiLawyerWritingTemplateDownloadEntity();
entity.setId(dto.getId());
entity.setTemplateCode(dto.getTemplateCode());
entity.setType(dto.getType());
entity.setName(dto.getName());
entity.setOption(dto.getOption());
entity.setEntityClass(dto.getEntityClass());
return entity;
}
}
\ No newline at end of file
package cn.com.poc.law.dto;
public class BizAiLawyerWritingTemplateDownloadDto {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
}
/** template_code
*
*/
private java.lang.String templateCode;
public java.lang.String getTemplateCode(){
return this.templateCode;
}
public void setTemplateCode(java.lang.String templateCode){
this.templateCode = templateCode;
}
/** type
*
*/
private java.lang.String type;
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
}
/** name
*
*/
private java.lang.String name;
public java.lang.String getName(){
return this.name;
}
public void setName(java.lang.String name){
this.name = name;
}
/** option
*
*/
private java.lang.String option;
public java.lang.String getOption(){
return this.option;
}
public void setOption(java.lang.String option){
this.option = option;
}
/** entity_class
*
*/
private java.lang.String entityClass;
public java.lang.String getEntityClass(){
return this.entityClass;
}
public void setEntityClass(java.lang.String entityClass){
this.entityClass = entityClass;
}
}
\ No newline at end of file
package cn.com.poc.law.entity;
public class BizAiLawyerWritingTemplateDownloadEntity {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
}
/** template_code
*
*/
private java.lang.String templateCode;
public java.lang.String getTemplateCode(){
return this.templateCode;
}
public void setTemplateCode(java.lang.String templateCode){
this.templateCode = templateCode;
}
/** type
*
*/
private java.lang.String type;
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
}
/** name
*
*/
private java.lang.String name;
public java.lang.String getName(){
return this.name;
}
public void setName(java.lang.String name){
this.name = name;
}
/** option
/** name
*
*/
private java.lang.String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
/** option
*
*/
private java.lang.String option;
public java.lang.String getOption(){
return this.option;
}
public void setOption(java.lang.String option){
this.option = option;
}
/** entity_class
*
*/
private java.lang.String entityClass;
public java.lang.String getEntityClass(){
return this.entityClass;
}
public void setEntityClass(java.lang.String entityClass){
this.entityClass = entityClass;
}
}
\ No newline at end of file
...@@ -7,11 +7,11 @@ package cn.com.poc.law.entity.legislativeDocument; ...@@ -7,11 +7,11 @@ package cn.com.poc.law.entity.legislativeDocument;
*/ */
public class LegislativeDocumentResult { public class LegislativeDocumentResult {
CaseInfo caseInfo; CaseInfo caseInfo = new CaseInfo();
ConflictInfo conflictInfo; ConflictInfo conflictInfo = new ConflictInfo();
SupplementaryInfo supplementaryInfo; SupplementaryInfo supplementaryInfo = new SupplementaryInfo();
CaseContactInfo caseContactInfo; CaseContactInfo caseContactInfo = new CaseContactInfo();
ClientInfo clientInfo; ClientInfo clientInfo = new ClientInfo();
String reply; String reply;
public CaseInfo getCaseInfo() { public CaseInfo getCaseInfo() {
......
package cn.com.poc.law.extractEntityStrategy; package cn.com.poc.law.extractEntityStrategy;
import cn.com.poc.law.extractEntityStrategy.extractEntityType.MotorVehicleDrivingComplaint; import cn.com.poc.law.extractEntityStrategy.extractEntityType.MotorVehicleDrivingComplaintType;
import cn.com.yict.framemax.core.exception.BusinessException; import cn.com.yict.framemax.core.exception.BusinessException;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
...@@ -15,7 +15,7 @@ public class LawyerTemplateExtractServiceBuilder implements ApplicationContextAw ...@@ -15,7 +15,7 @@ public class LawyerTemplateExtractServiceBuilder implements ApplicationContextAw
public ExtractEntityStrategy getService(LawyerExtractTypeConstants.LawyerExtractTypeEnum type) throws Exception { public ExtractEntityStrategy getService(LawyerExtractTypeConstants.LawyerExtractTypeEnum type) throws Exception {
if (LawyerExtractTypeConstants.LawyerExtractTypeEnum.motorVehicleDrivingComplaint.name().equals(type.name())) { if (LawyerExtractTypeConstants.LawyerExtractTypeEnum.motorVehicleDrivingComplaint.name().equals(type.name())) {
return applicationContext.getBean(MotorVehicleDrivingComplaint.class); return applicationContext.getBean(MotorVehicleDrivingComplaintType.class);
} }
throw new BusinessException("选择模板异常!"); throw new BusinessException("选择模板异常!");
} }
......
package cn.com.poc.law.extractEntityStrategy;
/**
* @Author:Roger Wu
* @name:TestEntity
* @Date:2025-08-15 23:38
*/
public class TestEntity {
private String type;
private String name;
private String value;
private String optionValue;
private String entityClass;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getOptionValue() {
return optionValue;
}
public void setOptionValue(String optionValue) {
this.optionValue = optionValue;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getEntityClass() {
return entityClass;
}
public void setEntityClass(String entityClass) {
this.entityClass = entityClass;
}
}
package cn.com.poc.law.extractEntityStrategy.extractEntityType; package cn.com.poc.law.extractEntityStrategy.extractEntityType;
import cn.com.poc.thirdparty.resource.demand.ai.entity.legal.Item;
import com.google.common.collect.Lists;
import cn.com.poc.law.entity.BizAiLawyerWritingTemplateDownloadEntity;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.PlaintiffOrg;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.FactsAndReasons;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.Preservation;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.ThirdPartyOrg;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.ThirdParty;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.Plaintiff;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.Claim;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.DefendantOrg;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.Defendant;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.UnderstandsMediationBenefit;
import cn.com.poc.law.entity.motorVehicleDrivingComplaint.Agent;
import cn.com.poc.law.extractEntityStrategy.TestEntity;
import cn.com.poc.law.extractEntityStrategy.download.MotorVehicleDrivingComplaintItem; import cn.com.poc.law.extractEntityStrategy.download.MotorVehicleDrivingComplaintItem;
import cn.com.poc.agent_application.entity.BizAgentApplicationGcConfigEntity; import cn.com.poc.agent_application.entity.BizAgentApplicationGcConfigEntity;
...@@ -9,22 +25,29 @@ import cn.com.poc.law.entity.motorVehicleDrivingComplaint.*; ...@@ -9,22 +25,29 @@ import cn.com.poc.law.entity.motorVehicleDrivingComplaint.*;
import cn.com.poc.law.extractEntityStrategy.ExtractEntityStrategy; import cn.com.poc.law.extractEntityStrategy.ExtractEntityStrategy;
import cn.com.poc.law.dto.LegalTemplateDto; import cn.com.poc.law.dto.LegalTemplateDto;
import cn.com.poc.law.extractEntityStrategy.download.MotorVehicleDrivingComplaintDownload; import cn.com.poc.law.extractEntityStrategy.download.MotorVehicleDrivingComplaintDownload;
import cn.com.poc.law.service.BizAiLawyerWritingTemplateDownloadService;
import cn.com.poc.thirdparty.resource.demand.ai.aggregate.LegalService;
import cn.com.poc.thirdparty.resource.demand.ai.constants.LLMRoleEnum; import cn.com.poc.thirdparty.resource.demand.ai.constants.LLMRoleEnum;
import cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message; import cn.com.poc.thirdparty.resource.demand.ai.entity.dialogue.Message;
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult; import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult;
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse; import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse;
import cn.com.poc.thirdparty.resource.demand.ai.entity.legal.LegalFileResponse;
import cn.com.poc.thirdparty.resource.demand.ai.entity.legal.LegalFileResult;
import cn.com.poc.thirdparty.service.LLMService; import cn.com.poc.thirdparty.service.LLMService;
import cn.com.yict.framemax.core.exception.BusinessException; import cn.com.yict.framemax.core.exception.BusinessException;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.tencent.core.utils.JsonUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.lang.reflect.Field;
import java.util.HashMap; import java.lang.reflect.Method;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.concurrent.*; import java.util.concurrent.*;
/** /**
...@@ -33,7 +56,7 @@ import java.util.concurrent.*; ...@@ -33,7 +56,7 @@ import java.util.concurrent.*;
* @Date:2025-08-08 10:56 * @Date:2025-08-08 10:56
*/ */
@Service @Service
public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { public class MotorVehicleDrivingComplaintType implements ExtractEntityStrategy {
final private ThreadPoolExecutor executor = new ThreadPoolExecutor(16, 64, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<>(100)); final private ThreadPoolExecutor executor = new ThreadPoolExecutor(16, 64, 10, TimeUnit.SECONDS, new LinkedBlockingDeque<>(100));
...@@ -43,6 +66,12 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -43,6 +66,12 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
@Resource @Resource
LLMService llmService; LLMService llmService;
@Resource
BizAiLawyerWritingTemplateDownloadService bizAiLawyerWritingTemplateDownloadService;
@Resource
LegalService legalService;
/** /**
* 提取实体 * 提取实体
...@@ -52,51 +81,43 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -52,51 +81,43 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
@Override @Override
public LegalTemplateDto extractEntity(String input) throws Exception { public LegalTemplateDto extractEntity(String input) throws Exception {
CompletableFuture<Plaintiff> extractPlaintiffFuture = CompletableFuture CompletableFuture<Plaintiff> extractPlaintiffFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractPlaintiff(input); return extractPlaintiff(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new Plaintiff(); return new Plaintiff();
}); });
// //
CompletableFuture<PlaintiffOrg> extractPlaintiffOrgFuture = CompletableFuture CompletableFuture<PlaintiffOrg> extractPlaintiffOrgFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractPlaintiffOrg(input); return extractPlaintiffOrg(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new PlaintiffOrg(); return new PlaintiffOrg();
}); });
// //
CompletableFuture<Agent> extractAgentFuture = CompletableFuture CompletableFuture<Agent> extractAgentFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractAgent(input); return extractAgent(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new Agent(); return new Agent();
}); });
CompletableFuture<Defendant> extractDefendantFuture = CompletableFuture CompletableFuture<Defendant> extractDefendantFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractDefendant(input); return extractDefendant(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new Defendant(); return new Defendant();
}); });
...@@ -108,87 +129,73 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -108,87 +129,73 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new DefendantOrg(); return new DefendantOrg();
}); });
CompletableFuture<ThirdParty> extractThirdPartyFuture = CompletableFuture CompletableFuture<ThirdParty> extractThirdPartyFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractThirdParty(input); return extractThirdParty(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new ThirdParty(); return new ThirdParty();
}); });
CompletableFuture<ThirdPartyOrg> extractThirdPartyOrgFuture = CompletableFuture CompletableFuture<ThirdPartyOrg> extractThirdPartyOrgFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractThirdPartyOrg(input); return extractThirdPartyOrg(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new ThirdPartyOrg(); return new ThirdPartyOrg();
}); });
CompletableFuture<Claim> extractClaimFuture = CompletableFuture CompletableFuture<Claim> extractClaimFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractClaim(input); return extractClaim(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new Claim(); return new Claim();
}); });
CompletableFuture<Preservation> extractPreservationFuture = CompletableFuture CompletableFuture<Preservation> extractPreservationFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractPreservation(input); return extractPreservation(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new Preservation(); return new Preservation();
}); });
CompletableFuture<FactsAndReasons> extractFactsAndReasonsFuture = CompletableFuture CompletableFuture<FactsAndReasons> extractFactsAndReasonsFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractFactsAndReasons(input); return extractFactsAndReasons(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new FactsAndReasons(); return new FactsAndReasons();
}); });
CompletableFuture<UnderstandsMediationBenefit> extractUnderstandsMediationBenefitFuture = CompletableFuture CompletableFuture<UnderstandsMediationBenefit> extractUnderstandsMediationBenefitFuture = CompletableFuture.supplyAsync(() -> {
.supplyAsync(() -> {
try { try {
return extractUnderstandsMediationBenefit(input); return extractUnderstandsMediationBenefit(input);
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}, executor) }, executor).exceptionally(ex -> {
.exceptionally(ex -> {
return new UnderstandsMediationBenefit(); return new UnderstandsMediationBenefit();
}); });
// 等待所有任务完成并获取结果 // 等待所有任务完成并获取结果
CompletableFuture.allOf(extractPlaintiffFuture, extractPlaintiffOrgFuture, extractAgentFuture, extractDefendantFuture, extractDefendantOrgFuture, CompletableFuture.allOf(extractPlaintiffFuture, extractPlaintiffOrgFuture, extractAgentFuture, extractDefendantFuture, extractDefendantOrgFuture, extractThirdPartyFuture, extractThirdPartyOrgFuture, extractClaimFuture, extractPreservationFuture, extractFactsAndReasonsFuture, extractUnderstandsMediationBenefitFuture).join();
extractThirdPartyFuture, extractThirdPartyOrgFuture, extractClaimFuture, extractPreservationFuture, extractFactsAndReasonsFuture, extractUnderstandsMediationBenefitFuture).join();
// //
Plaintiff extractPlaintiffResults = extractPlaintiffFuture.get(); Plaintiff extractPlaintiffResults = extractPlaintiffFuture.get();
PlaintiffOrg extractPlaintiffOrgResults = extractPlaintiffOrgFuture.get(); PlaintiffOrg extractPlaintiffOrgResults = extractPlaintiffOrgFuture.get();
...@@ -228,35 +235,134 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -228,35 +235,134 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
@Override @Override
public String downloadFile(LegalTemplateDto dto) throws Exception { public String downloadFile(LegalTemplateDto dto) throws Exception {
MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity = (MotorVehicleDrivingComplaintEntity) dto; String templateFileUrl = "https://gsst-poe-sit.gz.bcebos.com/v1/%E6%B0%91%E9%97%B4%E5%80%9F%E8%B4%B7%E7%BA%A0%E7%BA%B7%E6%B0%91%E4%BA%8B%E8%B5%B7%E8%AF%89%E7%8A%B6.docx";
// String templateFileUrl = "https://gsst-poe-sit.gz.bcebos.com/v1/%E6%B0%91%E9%97%B4%E5%80%9F%E8%B4%B7%E7%BA%A0%E7%BA%B7%E6%B0%91%E4%BA%8B%E8%B5%B7%E8%AF%89%E7%8A%B6.docx"; BizAiLawyerWritingTemplateDownloadEntity example = new BizAiLawyerWritingTemplateDownloadEntity();
// // example.setTemplateCode("MotorVehicleDrivingComplaintType");
// List<BizAiLawyerWritingTemplateDownloadEntity> bizAiLawyerWritingTemplateDownloadEntityList = bizAiLawyerWritingTemplateDownloadService.findByExample(example, null);
// MotorVehicleDrivingComplaintDownload motorVehicleDrivingComplaintDownload = new MotorVehicleDrivingComplaintDownload();
// motorVehicleDrivingComplaintDownload.setItem(new MotorVehicleDrivingComplaintItem[0]); if (CollectionUtils.isEmpty(bizAiLawyerWritingTemplateDownloadEntityList)) {
// new BusinessException("未找到模板参数");
// }
// MotorVehicleDrivingComplaintItem motorVehicleDrivingComplaintItem = new MotorVehicleDrivingComplaintItem();
// motorVehicleDrivingComplaintItem.setKey("check"); ArrayList<Item> items = new ArrayList<>();
// motorVehicleDrivingComplaintItem.setValue(new String[]{motorVehicleDrivingComplaintEntity.getAgent().getAgentAuthority()});
// motorVehicleDrivingComplaintItem.setType("checkbox");
// motorVehicleDrivingComplaintItem.setOptions(new String[]{"国有控股","国有参股","民营"}); bizAiLawyerWritingTemplateDownloadEntityList = getValue((MotorVehicleDrivingComplaintEntity)dto, bizAiLawyerWritingTemplateDownloadEntityList);
//
//
// Map<String,String> plaintiffMap = new HashMap<>();
// plaintiffMap.put("男","☑");
// plaintiffMap.put("女","□");
for (BizAiLawyerWritingTemplateDownloadEntity bizAiLawyerWritingTemplateDownloadEntity : bizAiLawyerWritingTemplateDownloadEntityList) {
Item item = new Item();
item.setKey(bizAiLawyerWritingTemplateDownloadEntity.getName());
item.setValue(Arrays.asList(bizAiLawyerWritingTemplateDownloadEntity.getValue()));
item.setType(bizAiLawyerWritingTemplateDownloadEntity.getType());
if(StringUtils.isNotBlank(bizAiLawyerWritingTemplateDownloadEntity.getOption())){
String[] split = bizAiLawyerWritingTemplateDownloadEntity.getOption().split(",");
item.setOptions(Arrays.asList(split));
}
}
// MotorVehicleDrivingComplaintItem plaintiffNameMotorVehicleDrivingComplaintItem = builderText("plaintiffName", new String[]{plaintiff.getPlaintiffName()}); LegalFileResponse response= new LegalFileResponse();
// MotorVehicleDrivingComplaintItem plaintiffGenderMotorVehicleDrivingComplaintItem = builderText("plaintiffGender", new String[]{plaintiff.getPlaintiffGender()}); response.setItems(Lists.newArrayList());
// MotorVehicleDrivingComplaintItem plaintiffDobMotorVehicleDrivingComplaintItem = builderText("plaintiffDob", new String[]{plaintiff.getPlaintiffDob()}); response.setFilePath(templateFileUrl);
// MotorVehicleDrivingComplaintItem plaintiffEthnicityMotorVehicleDrivingComplaintItem = builderText("plaintiffEthnicity", new String[]{plaintiff.getPlaintiffEthnicity()}); LegalFileResult legalFileResult = legalService.legalFile(response);
// motorVehicleDrivingComplaintDownload.setFilePath("");
return "https://gsst-poe-sit.gz.bcebos.com/v1/%E6%B0%91%E9%97%B4%E5%80%9F%E8%B4%B7%E7%BA%A0%E7%BA%B7%E6%B0%91%E4%BA%8B%E8%B5%B7%E8%AF%89%E7%8A%B6.docx"; return legalFileResult.getFilePath();
} }
public static void main(String[] args) throws Exception {
String ss = "{\"agent\": {\"agentName\": null, \"agentUnit\": null, \"hasAgentN\": null, \"hasAgentY\": null, \"agentPhone\": null, \"agentTitle\": null, \"agentAuthority\": null}, \"claim\": {\"otherFees\": \"1300\", \"nursingFee\": \"9150\", \"nursingDays\": \"15\", \"downtimeLoss\": \"\", \"hospitalName\": \"石城县某某医院\", \"nutritionFee\": \"450\", \"mealAllowance\": \"900\", \"vehicleDamage\": \"300\", \"funeralExpenses\": \"\", \"hasNursingProof\": \"有\", \"lostWagesAmount\": \"13345\", \"lostWagesPeriod\": [\"1681228800000\", \"1691596800000\"], \"medicalExpenses\": \"14693.85\", \"treatmentPeriod\": [\"1681228800000\", \"1682524800000\"], \"disabilityAidFee\": \"\", \"nursingLostWages\": \"\", \"totalClaimAmount\": \"136487\", \"deathCompensation\": \"\", \"hasNutritionProof\": \"有\", \"transportationFee\": \"540\", \"hasMedicalReceipts\": \"有\", \"otherPropertyDamage\": \"\", \"shortTermNursingFee\": \"\", \"hasMealAllowanceProof\": \"有\", \"disabilityCompensation\": \"91108\", \"dependentLivingExpenses\": \"\", \"hasTransportationReceipts\": \"有\", \"mentalAnguishCompensation\": \"5000\"}, \"defendant\": {\"defendantDob\": \"389462400000\", \"defendantName\": \"汤某\", \"defendantPhone\": \"\", \"defendantTitle\": \"\", \"defendantGender\": \"男\", \"defendantIdType\": \"\", \"defendantDomicile\": \"湖南省桃江县\", \"defendantIdNumber\": \"\", \"defendantWorkUnit\": \"\", \"defendantEthnicity\": \"汉族\", \"defendantHabitualResidence\": \"\"}, \"plaintiff\": {\"plaintiffDob\": \"-70531200000\", \"plaintiffName\": \"何某梅\", \"plaintiffPhone\": \"\", \"plaintiffTitle\": \"\", \"plaintiffGender\": \"女\", \"plaintiffIdType\": \"身份证\", \"plaintiffDomicile\": \"江西省赣州市石城县屏山镇万盛村坳头组28号\", \"plaintiffIdNumber\": \"36213719********\", \"plaintiffWorkUnit\": \"\", \"plaintiffEthnicity\": \"汉族\", \"plaintiffHabitualResidence\": \"\"}, \"thirdParty\": {\"thirdPartyDob\": null, \"thirdPartyName\": null, \"thirdPartyPhone\": null, \"thirdPartyTitle\": null, \"thirdPartyGender\": null, \"thirdPartyIdType\": null, \"thirdPartyDomicile\": null, \"thirdPartyIdNumber\": null, \"thirdPartyWorkUnit\": null, \"thirdPartyEthnicity\": null, \"thirdPartyHabitualResidence\": null}, \"defendantOrg\": {\"defendantOrgName\": null, \"defendantOrgType\": null, \"defendantOrgPhone\": null, \"defendantOrgAddress\": null, \"defendantOrgLegalRep\": null, \"defendantOrgRepTitle\": null, \"defendantOrgOwnership\": null, \"defendantOrgCreditCode\": null, \"defendantOrgOwnershipCheck\": null, \"defendantOrgRegisteredAddress\": null}, \"plaintiffOrg\": {\"plaintiffOrgName\": \"\", \"plaintiffOrgType\": \"\", \"plaintiffOrgPhone\": \"\", \"plaintiffOrgAddress\": \"\", \"plaintiffOrgLegalRep\": \"\", \"plaintiffOrgRepTitle\": \"\", \"plaintiffOrgOwnership\": \"\", \"plaintiffOrgCreditCode\": \"\", \"plaintiffOrgOwnershipCheck\": null, \"plaintiffOrgRegisteredAddress\": \"\"}, \"preservation\": {\"appraisalItems\": \"伤残等级、交通事故参与度\", \"preservationTime\": null, \"preservationCourt\": null, \"isPreservationDoneN\": null, \"isPreservationDoneY\": null, \"isAppraisalRequestedN\": null, \"isAppraisalRequestedY\": null, \"preservationCaseNumber\": null}, \"thirdPartyOrg\": {\"thirdPartyOrgType\": null, \"thirdPartyDomicile\": null, \"thirdPartyOrgPhone\": null, \"thirdPartyOrgAddress\": null, \"thirdPartyOrgLegalRep\": null, \"thirdPartyOrgRepTitle\": null, \"thirdPartyOrgOwnership\": null, \"thirdPartyOrgCreditCode\": null, \"thirdPartyOrgOwnershipCheck\": null, \"thirdPartyOrgRegisteredAddress\": null}, \"factsAndReasons\": {\"claimBasis\": \"\", \"evidenceList\": \"身份证、交通事故认定书、机动车行驶证复印件、交强险保单、商业险保单、出院记录、用药清单、住院费用发票、门诊费用发票、赣莲乡中心[2023]临鉴字第180号《司法鉴定意见书》\", \"accidentDetails\": \"2023年4月12日5时56分许,被告汤某驾驶赣BU****牌小型客车途经石城县**镇**路电信局门口路段时,与驾驶电动自行车的原告发生碰撞,造成原告受伤及电动自行车受损的交通事故\", \"insuranceStatus\": \"被告汤某驾驶的赣BU****小客车所有人为被告龚某仁。该车在被告某某公司处投保了交强险和200万第三者责任险,事故发生在保险责任期限内\", \"liabilityDetermination\": \"被告汤某负事故全部责任,原告无责\"}, \"understandsMediationBenefit\": {\"considersMediation\": \"\", \"understandsMediation\": \"\", \"understandsMediationBenefit1\": \"\", \"understandsMediationBenefit2\": \"\", \"understandsMediationBenefit3\": \"\", \"understandsMediationBenefit4\": \"\", \"understandsMediationBenefit5\": \"\"}}";
MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity = JsonUtils.deSerialize(ss, MotorVehicleDrivingComplaintEntity.class);
// MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity = new MotorVehicleDrivingComplaintEntity();
Plaintiff plaintiff = new Plaintiff();
plaintiff.setPlaintiffName("张三");
plaintiff.setPlaintiffGender("男");
motorVehicleDrivingComplaintEntity.setPlaintiff(plaintiff);
motorVehicleDrivingComplaintEntity.setPlaintiffOrg(new PlaintiffOrg());
motorVehicleDrivingComplaintEntity.setDefendant(new Defendant());
motorVehicleDrivingComplaintEntity.setDefendantOrg(new DefendantOrg());
motorVehicleDrivingComplaintEntity.setAgent(new Agent());
motorVehicleDrivingComplaintEntity.setThirdParty(new ThirdParty());
motorVehicleDrivingComplaintEntity.setThirdPartyOrg(new ThirdPartyOrg());
motorVehicleDrivingComplaintEntity.setClaim(new Claim());
motorVehicleDrivingComplaintEntity.setFactsAndReasons(new FactsAndReasons());
motorVehicleDrivingComplaintEntity.setPreservation(new Preservation());
motorVehicleDrivingComplaintEntity.setUnderstandsMediationBenefit(new UnderstandsMediationBenefit());
System.out.println(JsonUtils.serialize(motorVehicleDrivingComplaintEntity));;
}
public static void main1(String[] args) {
String ss="{\"plaintiff\":{\"plaintiffName\":\"张三\",\"plaintiffGender\":\"男\",\"plaintiffDob\":null,\"plaintiffEthnicity\":null,\"plaintiffWorkUnit\":null,\"plaintiffTitle\":null,\"plaintiffPhone\":null,\"plaintiffDomicile\":null,\"plaintiffHabitualResidence\":null,\"plaintiffIdType\":null,\"plaintiffIdNumber\":null},\"plaintiffOrg\":{\"plaintiffOrgName\":null,\"plaintiffOrgAddress\":null,\"plaintiffOrgRegisteredAddress\":null,\"plaintiffOrgLegalRep\":null,\"plaintiffOrgRepTitle\":null,\"plaintiffOrgPhone\":null,\"plaintiffOrgCreditCode\":null,\"plaintiffOrgType\":null,\"plaintiffOrgOwnershipCheck\":null,\"plaintiffOrgOwnership\":null},\"defendant\":{\"defendantName\":null,\"defendantGender\":null,\"defendantDob\":null,\"defendantEthnicity\":null,\"defendantWorkUnit\":null,\"defendantTitle\":null,\"defendantPhone\":null,\"defendantDomicile\":null,\"defendantHabitualResidence\":null,\"defendantIdType\":null,\"defendantIdNumber\":null},\"defendantOrg\":{\"defendantOrgName\":null,\"defendantOrgAddress\":null,\"defendantOrgRegisteredAddress\":null,\"defendantOrgLegalRep\":null,\"defendantOrgRepTitle\":null,\"defendantOrgPhone\":null,\"defendantOrgCreditCode\":null,\"defendantOrgType\":null,\"defendantOrgOwnershipCheck\":null,\"defendantOrgOwnership\":null},\"agent\":{\"hasAgentY\":null,\"agentName\":null,\"agentUnit\":null,\"agentTitle\":null,\"agentPhone\":null,\"agentAuthority\":null,\"hasAgentN\":null},\"thirdParty\":{\"thirdPartyName\":null,\"thirdPartyGender\":null,\"thirdPartyDob\":null,\"thirdPartyEthnicity\":null,\"thirdPartyWorkUnit\":null,\"thirdPartyTitle\":null,\"thirdPartyPhone\":null,\"thirdPartyDomicile\":null,\"thirdPartyHabitualResidence\":null,\"thirdPartyIdType\":null,\"thirdPartyIdNumber\":null},\"thirdPartyOrg\":{\"thirdPartyOrgAddress\":null,\"thirdPartyOrgRegisteredAddress\":null,\"thirdPartyOrgLegalRep\":null,\"thirdPartyOrgRepTitle\":null,\"thirdPartyOrgPhone\":null,\"thirdPartyOrgCreditCode\":null,\"thirdPartyOrgType\":null,\"thirdPartyDomicile\":null,\"thirdPartyOrgOwnershipCheck\":null,\"thirdPartyOrgOwnership\":null},\"claim\":{\"treatmentPeriod\":null,\"hospitalName\":null,\"medicalExpenses\":null,\"hasMedicalReceipts\":null,\"nursingDays\":null,\"nursingFee\":null,\"nursingLostWages\":null,\"shortTermNursingFee\":null,\"hasNursingProof\":null,\"nutritionFee\":null,\"hasNutritionProof\":null,\"mealAllowance\":null,\"hasMealAllowanceProof\":null,\"lostWagesPeriod\":null,\"lostWagesAmount\":null,\"transportationFee\":null,\"hasTransportationReceipts\":null,\"disabilityCompensation\":null,\"dependentLivingExpenses\":null,\"disabilityAidFee\":null,\"deathCompensation\":null,\"funeralExpenses\":null,\"mentalAnguishCompensation\":null,\"vehicleDamage\":null,\"downtimeLoss\":null,\"otherPropertyDamage\":null,\"otherFees\":null,\"totalClaimAmount\":null},\"factsAndReasons\":{\"accidentDetails\":null,\"liabilityDetermination\":null,\"insuranceStatus\":null,\"claimBasis\":null,\"evidenceList\":null},\"preservation\":{\"isPreservationDoneY\":null,\"preservationCourt\":null,\"preservationTime\":null,\"preservationCaseNumber\":null,\"isPreservationDoneN\":null,\"isAppraisalRequestedY\":null,\"appraisalItems\":null,\"isAppraisalRequestedN\":null},\"understandsMediationBenefit\":{\"understandsMediation\":null,\"understandsMediationBenefit1\":null,\"understandsMediationBenefit2\":null,\"understandsMediationBenefit3\":null,\"understandsMediationBenefit4\":null,\"understandsMediationBenefit5\":null,\"considersMediation\":null}}";
MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity = JsonUtils.deSerialize(ss, MotorVehicleDrivingComplaintEntity.class);
}
public static List<BizAiLawyerWritingTemplateDownloadEntity> getValue( MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity, List<BizAiLawyerWritingTemplateDownloadEntity> bizAiLawyerWritingTemplateDownloadEntityList) throws Exception {
// MotorVehicleDrivingComplaintEntity motorVehicleDrivingComplaintEntity = (MotorVehicleDrivingComplaintEntity) dto;
// 获取MotorVehicleDrivingComplaintEntity类的所有属性
Field[] fields = MotorVehicleDrivingComplaintEntity.class.getDeclaredFields();
Map<String, Object> entityMap = new HashMap<>();
// 将所有实体属性放入map中,方便后续查找
for (Field field : fields) {
field.setAccessible(true); // 设置可访问私有属性
String fieldName = field.getName();
Object fieldValue = field.get(motorVehicleDrivingComplaintEntity);
entityMap.put(fieldName, fieldValue);
}
for (BizAiLawyerWritingTemplateDownloadEntity testEntity : bizAiLawyerWritingTemplateDownloadEntityList) {
try {
// 获取TestEntity中指定的类名
String targetEntityClass = testEntity.getEntityClass();
// 根据entityClass找到对应的实体对象
Object sourceEntity = findEntityObject(targetEntityClass, entityMap);
if (sourceEntity != null) {
// 获取属性值
Class<?> sourceClass = sourceEntity.getClass();
String fieldName = testEntity.getName();
// 构造getter方法名
String getterName = "get" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
// 调用getter方法获取值
Method getterMethod = sourceClass.getMethod(getterName);
Object fieldValue = getterMethod.invoke(sourceEntity);
System.out.println("属性 " + fieldName + " 的值为: " + fieldValue);
testEntity.setValue((String)fieldValue);
// return fieldValue.toString();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return bizAiLawyerWritingTemplateDownloadEntityList;
}
// 根据类名在entityMap中查找对应的实体对象
private static Object findEntityObject(String entityClassName, Map<String, Object> entityMap) {
// 从类名中提取简单类名,例如从"cn.com.poc.law.entity.motorVehicleDrivingComplaint.Plaintiff"
// 提取"Plaintiff"并转换为属性名"plaintiff"
String simpleClassName = entityClassName.substring(entityClassName.lastIndexOf('.') + 1);
String propertyName = Character.toLowerCase(simpleClassName.charAt(0)) + simpleClassName.substring(1);
return entityMap.get(propertyName);
}
private MotorVehicleDrivingComplaintItem builderText(String boxName, String[] boxValue) { private MotorVehicleDrivingComplaintItem builderText(String boxName, String[] boxValue) {
MotorVehicleDrivingComplaintItem motorVehicleDrivingComplaintItem = new MotorVehicleDrivingComplaintItem(); MotorVehicleDrivingComplaintItem motorVehicleDrivingComplaintItem = new MotorVehicleDrivingComplaintItem();
motorVehicleDrivingComplaintItem.setKey(boxName); motorVehicleDrivingComplaintItem.setKey(boxName);
...@@ -289,7 +395,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -289,7 +395,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
plaintiff = JsonUtils.deSerialize(message, Plaintiff.class); plaintiff = JsonUtils.deSerialize(message, Plaintiff.class);
if (ObjectUtil.isEmpty(plaintiff)) { if (ObjectUtil.isEmpty(plaintiff)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -319,7 +425,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -319,7 +425,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
plaintiffOrg = JsonUtils.deSerialize(message, PlaintiffOrg.class); plaintiffOrg = JsonUtils.deSerialize(message, PlaintiffOrg.class);
if (ObjectUtil.isEmpty(plaintiffOrg)) { if (ObjectUtil.isEmpty(plaintiffOrg)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -348,7 +454,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -348,7 +454,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
agent = JsonUtils.deSerialize(message, Agent.class); agent = JsonUtils.deSerialize(message, Agent.class);
if (ObjectUtil.isEmpty(agent)) { if (ObjectUtil.isEmpty(agent)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -378,7 +484,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -378,7 +484,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
defendant = JsonUtils.deSerialize(message, Defendant.class); defendant = JsonUtils.deSerialize(message, Defendant.class);
if (ObjectUtil.isEmpty(defendant)) { if (ObjectUtil.isEmpty(defendant)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -408,7 +514,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -408,7 +514,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
defendantOrg = JsonUtils.deSerialize(message, DefendantOrg.class); defendantOrg = JsonUtils.deSerialize(message, DefendantOrg.class);
if (ObjectUtil.isEmpty(defendantOrg)) { if (ObjectUtil.isEmpty(defendantOrg)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -437,7 +543,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -437,7 +543,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
thirdParty = JsonUtils.deSerialize(message, ThirdParty.class); thirdParty = JsonUtils.deSerialize(message, ThirdParty.class);
if (ObjectUtil.isEmpty(thirdParty)) { if (ObjectUtil.isEmpty(thirdParty)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -466,7 +572,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -466,7 +572,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
thirdPartyOrg = JsonUtils.deSerialize(message, ThirdPartyOrg.class); thirdPartyOrg = JsonUtils.deSerialize(message, ThirdPartyOrg.class);
if (ObjectUtil.isEmpty(thirdPartyOrg)) { if (ObjectUtil.isEmpty(thirdPartyOrg)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -495,7 +601,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -495,7 +601,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
claim = JsonUtils.deSerialize(message, Claim.class); claim = JsonUtils.deSerialize(message, Claim.class);
if (ObjectUtil.isEmpty(claim)) { if (ObjectUtil.isEmpty(claim)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -524,7 +630,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -524,7 +630,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
preservation = JsonUtils.deSerialize(message, Preservation.class); preservation = JsonUtils.deSerialize(message, Preservation.class);
if (ObjectUtil.isEmpty(preservation)) { if (ObjectUtil.isEmpty(preservation)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -553,7 +659,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -553,7 +659,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
factsAndReasons = JsonUtils.deSerialize(message, FactsAndReasons.class); factsAndReasons = JsonUtils.deSerialize(message, FactsAndReasons.class);
if (ObjectUtil.isEmpty(factsAndReasons)) { if (ObjectUtil.isEmpty(factsAndReasons)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
...@@ -582,7 +688,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy { ...@@ -582,7 +688,7 @@ public class MotorVehicleDrivingComplaint implements ExtractEntityStrategy {
if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) { if (ObjectUtil.isEmpty(chat) || !chat.getCode().equals("0")) {
throw new BusinessException("获取失败"); throw new BusinessException("获取失败");
} }
String message = chat.getMessage().replaceAll("```json",StringUtils.EMPTY).replaceAll("```",StringUtils.EMPTY); String message = chat.getMessage().replaceAll("```json", StringUtils.EMPTY).replaceAll("```", StringUtils.EMPTY);
understandsMediationBenefit = JsonUtils.deSerialize(message, UnderstandsMediationBenefit.class); understandsMediationBenefit = JsonUtils.deSerialize(message, UnderstandsMediationBenefit.class);
if (ObjectUtil.isEmpty(understandsMediationBenefit)) { if (ObjectUtil.isEmpty(understandsMediationBenefit)) {
throw new BusinessException("提取失败"); throw new BusinessException("提取失败");
......
...@@ -22,6 +22,9 @@ public class JacksonDateArrayDeSerializer extends JsonDeserializer<String> { ...@@ -22,6 +22,9 @@ public class JacksonDateArrayDeSerializer extends JsonDeserializer<String> {
public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { public String deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
//[] //[]
String date = p.getText(); String date = p.getText();
if (!date.contains("-")) {
return date;
}
try { try {
// 解析为 Date 对象 // 解析为 Date 对象
return String.valueOf(dateFormat.parse(date).getTime()); return String.valueOf(dateFormat.parse(date).getTime());
......
package cn.com.poc.law.model;
import java.io.Serializable;
import cn.com.yict.framemax.data.model.BaseModelClass;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Id;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
/**
* Model class for biz_ai_lawyer_writing_template_download
* 法律文书模板导出
*/
@Entity
@Table(name = "biz_ai_lawyer_writing_template_download")
@DynamicInsert
@DynamicUpdate
public class BizAiLawyerWritingTemplateDownloadModel extends BaseModelClass implements Serializable {
private static final long serialVersionUID = 1L;
/** id
*
*/
private java.lang.Long id;
@Column(name = "id",length = 19)
@Id @GeneratedValue(strategy = GenerationType.AUTO)
public java.lang.Long getId(){
return this.id;
}
public void setId(java.lang.Long id){
this.id = id;
super.addValidField("id");
}
/** template_code
*
*/
private java.lang.String templateCode;
@Column(name = "template_code",length = 100)
public java.lang.String getTemplateCode(){
return this.templateCode;
}
public void setTemplateCode(java.lang.String templateCode){
this.templateCode = templateCode;
super.addValidField("templateCode");
}
/** type
*
*/
private java.lang.String type;
@Column(name = "type",length = 255)
public java.lang.String getType(){
return this.type;
}
public void setType(java.lang.String type){
this.type = type;
super.addValidField("type");
}
/** name
*
*/
private java.lang.String name;
@Column(name = "name",length = 100)
public java.lang.String getName(){
return this.name;
}
public void setName(java.lang.String name){
this.name = name;
super.addValidField("name");
}
/** option
*
*/
private java.lang.String option;
@Column(name = "option",length = 100)
public java.lang.String getOption(){
return this.option;
}
public void setOption(java.lang.String option){
this.option = option;
super.addValidField("option");
}
/** entity_class
*
*/
private java.lang.String entityClass;
@Column(name = "entity_class",length = 255)
public java.lang.String getEntityClass(){
return this.entityClass;
}
public void setEntityClass(java.lang.String entityClass){
this.entityClass = entityClass;
super.addValidField("entityClass");
}
}
\ No newline at end of file
package cn.com.poc.law.repository;
import cn.com.yict.framemax.data.repository.Repository;
import cn.com.poc.law.model.BizAiLawyerWritingTemplateDownloadModel;
public interface BizAiLawyerWritingTemplateDownloadRepository extends Repository<BizAiLawyerWritingTemplateDownloadModel,java.lang.Long> {
}
\ No newline at end of file
package cn.com.poc.law.rest;
import cn.com.yict.framemax.core.rest.BaseRest;
import cn.com.poc.law.dto.BizAiLawyerWritingTemplateDownloadDto;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
import cn.com.yict.framemax.web.permission.Access;
import cn.com.yict.framemax.web.permission.Permission;
import org.springframework.web.bind.annotation.RequestBody;
public interface BizAiLawyerWritingTemplateDownloadRest extends BaseRest {
BizAiLawyerWritingTemplateDownloadDto getById(java.lang.Long id) throws Exception;
List<BizAiLawyerWritingTemplateDownloadDto> getList(BizAiLawyerWritingTemplateDownloadDto example,PagingInfo pagingInfo) throws Exception;
BizAiLawyerWritingTemplateDownloadDto save(BizAiLawyerWritingTemplateDownloadDto dto) throws Exception;
BizAiLawyerWritingTemplateDownloadDto update(BizAiLawyerWritingTemplateDownloadDto dto) throws Exception;
void deletedById(java.lang.Long id) throws Exception;
}
\ No newline at end of file
package cn.com.poc.law.rest.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cn.com.poc.law.rest.BizAiLawyerWritingTemplateDownloadRest;
import cn.com.poc.law.service.BizAiLawyerWritingTemplateDownloadService;
import cn.com.poc.law.dto.BizAiLawyerWritingTemplateDownloadDto;
import cn.com.poc.law.entity.BizAiLawyerWritingTemplateDownloadEntity;
import cn.com.yict.framemax.data.model.PagingInfo;
import cn.com.poc.law.convert.BizAiLawyerWritingTemplateDownloadConvert;
import java.util.stream.Collectors;
import org.springframework.util.Assert;
@Component
public class BizAiLawyerWritingTemplateDownloadRestImpl implements BizAiLawyerWritingTemplateDownloadRest {
@Resource
private BizAiLawyerWritingTemplateDownloadService service;
public BizAiLawyerWritingTemplateDownloadDto getById(java.lang.Long id) throws Exception{
Assert.notNull(id);
return BizAiLawyerWritingTemplateDownloadConvert.entityToDto(service.get(id));
}
public List<BizAiLawyerWritingTemplateDownloadDto> getList(BizAiLawyerWritingTemplateDownloadDto dto,PagingInfo pagingInfo) throws Exception{
return service
.findByExample(BizAiLawyerWritingTemplateDownloadConvert.dtoToEntity(dto),pagingInfo)
.stream()
.map(BizAiLawyerWritingTemplateDownloadConvert::entityToDto)
.collect(Collectors.toList());
}
public BizAiLawyerWritingTemplateDownloadDto save(BizAiLawyerWritingTemplateDownloadDto dto) throws Exception{
Assert.notNull(dto);
BizAiLawyerWritingTemplateDownloadEntity entity = BizAiLawyerWritingTemplateDownloadConvert.dtoToEntity(dto);
return BizAiLawyerWritingTemplateDownloadConvert.entityToDto(service.save(entity));
}
public BizAiLawyerWritingTemplateDownloadDto update(BizAiLawyerWritingTemplateDownloadDto dto) throws Exception{
Assert.notNull(dto);
BizAiLawyerWritingTemplateDownloadEntity entity = BizAiLawyerWritingTemplateDownloadConvert.dtoToEntity(dto);
return BizAiLawyerWritingTemplateDownloadConvert.entityToDto(service.update(entity));
}
public void deletedById(java.lang.Long id) throws Exception{
Assert.notNull(id);
service.deletedById(id);
}
}
\ No newline at end of file
package cn.com.poc.law.service;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.poc.law.entity.BizAiLawyerWritingTemplateDownloadEntity;
import cn.com.yict.framemax.data.model.PagingInfo;
import java.util.Collection;
import java.util.List;
public interface BizAiLawyerWritingTemplateDownloadService extends BaseService {
BizAiLawyerWritingTemplateDownloadEntity get(java.lang.Long id) throws Exception;
List<BizAiLawyerWritingTemplateDownloadEntity> findByExample(BizAiLawyerWritingTemplateDownloadEntity example,PagingInfo pagingInfo) throws Exception;
BizAiLawyerWritingTemplateDownloadEntity save(BizAiLawyerWritingTemplateDownloadEntity entity) throws Exception;
BizAiLawyerWritingTemplateDownloadEntity update(BizAiLawyerWritingTemplateDownloadEntity entity) throws Exception;
void deletedById(java.lang.Long id) throws Exception;
}
\ No newline at end of file
...@@ -154,9 +154,12 @@ public class BizAiLawyerWritingTemplateDataServiceImpl extends BaseServiceImpl ...@@ -154,9 +154,12 @@ public class BizAiLawyerWritingTemplateDataServiceImpl extends BaseServiceImpl
} }
ExtractEntityStrategy extractEntityStrategy = LawyerTemplateExtractServiceBuilder.getService(LawyerExtractTypeConstants.LawyerExtractTypeEnum.get(models.get(0).getBizAiLawyerWritingTemplateCode())); ExtractEntityStrategy extractEntityStrategy = LawyerTemplateExtractServiceBuilder.getService(LawyerExtractTypeConstants.LawyerExtractTypeEnum.get(models.get(0).getBizAiLawyerWritingTemplateCode()));
JsonUtils.deSerialize(models.get(0).getBizAiLawyerWritingTemplateData(), LegalTemplateDto.class);
// return extractEntityStrategy.downloadFile();
return extractEntityStrategy.downloadFile(JsonUtils.deSerialize(models.get(0).getBizAiLawyerWritingTemplateData(), LegalTemplateDto.class)); return extractEntityStrategy.downloadFile(JsonUtils.deSerialize(models.get(0).getBizAiLawyerWritingTemplateData(), LegalTemplateDto.class));
}
}
@Override @Override
public TemplateDataDetailDto getTemplateDataDetail(String dialoguesId, Long userId, boolean ifException) throws Exception { public TemplateDataDetailDto getTemplateDataDetail(String dialoguesId, Long userId, boolean ifException) throws Exception {
BizAiDialoguesEntity bizAiDialoguesEntity = new BizAiDialoguesEntity(); BizAiDialoguesEntity bizAiDialoguesEntity = new BizAiDialoguesEntity();
......
package cn.com.poc.law.service.impl;
import cn.com.yict.framemax.core.service.impl.BaseServiceImpl;
import cn.com.poc.law.service.BizAiLawyerWritingTemplateDownloadService;
import cn.com.poc.law.model.BizAiLawyerWritingTemplateDownloadModel;
import cn.com.poc.law.entity.BizAiLawyerWritingTemplateDownloadEntity;
import cn.com.poc.law.convert.BizAiLawyerWritingTemplateDownloadConvert;
import cn.com.poc.law.repository.BizAiLawyerWritingTemplateDownloadRepository;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.springframework.stereotype.Service;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.stream.Collectors;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.util.Assert;
@Service
public class BizAiLawyerWritingTemplateDownloadServiceImpl extends BaseServiceImpl
implements BizAiLawyerWritingTemplateDownloadService {
@Resource
private BizAiLawyerWritingTemplateDownloadRepository repository;
public BizAiLawyerWritingTemplateDownloadEntity get(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiLawyerWritingTemplateDownloadModel model = this.repository.get(id);
if (model == null){
return null;
}
return BizAiLawyerWritingTemplateDownloadConvert.modelToEntity(model);
}
public List<BizAiLawyerWritingTemplateDownloadEntity> findByExample(BizAiLawyerWritingTemplateDownloadEntity example,PagingInfo pagingInfo) throws Exception{
List<BizAiLawyerWritingTemplateDownloadEntity> result = new ArrayList<BizAiLawyerWritingTemplateDownloadEntity>();
BizAiLawyerWritingTemplateDownloadModel model = new BizAiLawyerWritingTemplateDownloadModel();
if (example != null){
model = BizAiLawyerWritingTemplateDownloadConvert.entityToModel(example);
}
List<BizAiLawyerWritingTemplateDownloadModel> models = this.repository.findByExample(model,pagingInfo);
if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizAiLawyerWritingTemplateDownloadConvert::modelToEntity).collect(Collectors.toList());
}
return result;
}
public BizAiLawyerWritingTemplateDownloadEntity save(BizAiLawyerWritingTemplateDownloadEntity entity) throws Exception{
Assert.notNull(entity);
entity.setId(null);
BizAiLawyerWritingTemplateDownloadModel model = BizAiLawyerWritingTemplateDownloadConvert.entityToModel(entity);
BizAiLawyerWritingTemplateDownloadModel saveModel = this.repository.save(model);
return BizAiLawyerWritingTemplateDownloadConvert.modelToEntity(saveModel);
}
public BizAiLawyerWritingTemplateDownloadEntity update(BizAiLawyerWritingTemplateDownloadEntity entity) throws Exception{
Assert.notNull(entity);
Assert.notNull(entity.getId(),"update pk can not be null");
BizAiLawyerWritingTemplateDownloadModel model = this.repository.get(entity.getId());
if (entity.getTemplateCode() != null){
model.setTemplateCode(entity.getTemplateCode());
}
if (entity.getType() != null){
model.setType(entity.getType());
}
if (entity.getName() != null){
model.setName(entity.getName());
}
if (entity.getOption() != null){
model.setOption(entity.getOption());
}
if (entity.getEntityClass() != null){
model.setEntityClass(entity.getEntityClass());
}
BizAiLawyerWritingTemplateDownloadModel saveModel = this.repository.save(model);
return BizAiLawyerWritingTemplateDownloadConvert.modelToEntity(saveModel);
}
public void deletedById(java.lang.Long id) throws Exception{
Assert.notNull(id);
BizAiLawyerWritingTemplateDownloadModel model = this.repository.get(id);
if (model != null){
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment