소스 검색

20250910-韶音导出报告

lrj 3 주 전
부모
커밋
39e075ef7d

+ 100 - 0
src/main/java/cn/cslg/pas/common/model/report/ExportInvalidReportVO.java

@@ -0,0 +1,100 @@
+package cn.cslg.pas.common.model.report;
+
+import cn.cslg.pas.common.model.cronModel.SystemFile;
+import cn.cslg.pas.common.vo.business.SimplePersonVO;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class ExportInvalidReportVO {
+    /**
+     * 案件编号
+     */
+    @Schema(description = "案件编号")
+    private String caseNumber;
+    /**
+     * 标的专利号
+     */
+    @Schema(description = "标的专利号")
+    private String signPatentNo;
+    @Schema(description = "产品/技术")
+    private String productOrTech;
+    @Schema(description = "核心结论")
+    private List<String> cronNames;
+    @Schema(description = "证据风险及措施")
+    private String evidenceRiskResponse;
+    @Schema(description = "案件阶段")
+    private String casePhase;
+    @Schema(description = "案件子阶段")
+    private String caseChildPhase;
+    @Schema(description = "实际处理人")
+    private String actualPerson;
+    @Schema(description = "无效代理所")
+    private String invalidAgency;
+    /**
+     * 发明创造名称
+     */
+    @Schema(description = "发明创造名称")
+    private String inventionName;
+    @Schema(description = "涉诉对象")
+    private String litigationParty;
+    /**
+     * 无效宣告请求人
+     */
+    @Schema(description = "无效宣告请求人")
+    private String invalidApplication;
+    @Schema(description = "请求人代理所")
+    private String applicantAgency;
+    /**
+     * 专利权人
+     */
+    @Schema(description = "专利权人")
+    private String rightHolderStr;
+    @Schema(description = "国知局受理年")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy")
+    private Date acceptYear;
+    @Schema(description = "受通发文日")
+    private Date notificationDate;
+    @Schema(description = "第一次转文发文日")
+    private Date Zhuanwen1Date;
+    @Schema(description = "第二次转文发文日")
+    private Date Zhuanwen2Date;
+    @Schema(description = "第三次转文发文日")
+    private Date Zhuanwen3Date;
+    @Schema(description = "官限日期")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date officialDeadline;
+    @Schema(description = "决定日")
+    private Date invalidDecisionDate;
+    @Schema(description = "口审合议庭成员")
+    private String oralPanelMembers;
+    @Schema(description = "无效理由")
+    private String invalidReason;
+    @Schema(description = "行诉一审案号")
+    private String Litigation1CaseNumber;
+    @Schema(description = "一审原告")
+    private String Litigation1plaintiff;
+    @Schema(description = "一审立案时间")
+    /**
+     * 立案时间
+     */
+    private Date Litigation1caseFieldTime;
+    @Schema(description = "一审进展")
+
+    private String Litigation1Conclusion;
+    @Schema(description = "行诉二审案号")
+    private String Litigation2CaseNumber;
+    @Schema(description = "二审原告")
+    private String Litigation2plaintiff;
+    @Schema(description = "二审立案时间")
+    private Date Litigation2caseFieldTime;
+    @Schema(description = "二审进展")
+    private String Litigation2Conclusion;
+
+}

+ 3 - 0
src/main/java/cn/cslg/pas/common/model/request/QueryRequest.java

@@ -28,4 +28,7 @@ public class QueryRequest {
     //专利详情中商品化专用ids
     private List<Integer> productIds;
     private String semanteme;
+    private Integer startNumber;
+
+    private Integer endNumber;
 }

+ 86 - 0
src/main/java/cn/cslg/pas/common/utils/FileUtils.java

@@ -7,7 +7,10 @@ import com.alibaba.fastjson.JSON;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.springframework.boot.system.ApplicationHome;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
 import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -404,4 +407,87 @@ public class FileUtils {
         }
         return fileItem;
     }
+
+    public static ResponseEntity<InputStreamResource> fileToResponse(File file) throws Exception{
+           byte[] bytes= readBytesFromFile(file);
+        String s = file.getName().substring(file.getName().lastIndexOf("."));
+        String contentType = "application/octet-stream"; // 默认二进制流
+        switch (s) {
+            case ".xlsx":
+                contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+                break;
+            case ".xls":
+            case ".xlt":
+            case ".xla":
+                contentType = "application/vnd.ms-excel";
+                break;
+            case ".pdf":
+                contentType = "application/pdf";
+                break;
+            case ".doc":
+            case ".dot":
+                contentType = "application/msword";
+                break;
+            case ".docx":
+                contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
+                break;
+            case ".dotx":
+                contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.template";
+                break;
+            case ".docm":
+                contentType = "application/vnd.ms-word.document.macroEnabled.12";
+                break;
+            case ".dotm":
+                contentType = "application/vnd.ms-word.template.macroEnabled.12";
+                break;
+            case ".ppt":
+            case ".pot":
+            case ".pps":
+            case ".ppa":
+                contentType = "application/vnd.ms-powerpoint";
+                break;
+            case ".gif":
+                contentType = "image/gif";
+                break;
+            case ".jpg":
+            case ".jpeg":
+            case ".jpe":
+            case ".jfif":
+                contentType = "image/jpeg";
+                break;
+            case ".tiff":
+            case ".tif":
+                contentType = "image/tiff";
+                break;
+            case ".png":
+                contentType = "image/png";
+                break;
+            // 添加其他文件类型的case
+            // ...
+            default:
+                // 如果不是已知的文件类型,则作为二进制流返回
+                break;
+        }
+
+        String encodedFileName=file.getName();
+        return ResponseEntity.ok()
+                .contentLength(bytes.length)
+                .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + encodedFileName + "\"")
+                .contentType(MediaType.parseMediaType(contentType))
+                .body(new InputStreamResource(new ByteArrayInputStream(bytes)));
+    }
+
+    private static byte[] readBytesFromFile(File file) throws IOException {
+
+        byte[] bytesArray = new byte[(int) file.length()];
+
+        try (FileInputStream fis = new FileInputStream(file)) {
+            fis.read(bytesArray); // 将文件内容读入 byte 数组
+        }
+
+        return bytesArray;
+    }
+    public static String getConfigFilePath(String url) {
+        return getStaticPath(COMMON_FILE) + url;
+    }
 }

+ 63 - 0
src/main/java/cn/cslg/pas/common/utils/excelUtils/ExcelUtil.java

@@ -0,0 +1,63 @@
+package cn.cslg.pas.common.utils.excelUtils;
+
+import cn.cslg.pas.common.utils.DateUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+@Component
+public class ExcelUtil {
+    public static File  fullExcelTemple(String readPath, List<Map<String, Object>> mapList) throws Exception {
+        FileInputStream inputStream = new FileInputStream(new File(readPath));
+
+        //1.创建工作簿,使用excel能操作的这边都看看操作
+        Workbook workbook = new XSSFWorkbook(inputStream);
+        //2.得到表
+        Sheet sheet = workbook.getSheetAt(0);
+        for (int i = 0; i < mapList.size(); i++) {
+
+            Row row = sheet.createRow(i + 1);
+            Map<String, Object> map = mapList.get(i);
+            int t = 0;
+            for (String key : map.keySet()) {
+                Object value = map.get(key);
+                if(value instanceof List){
+                 List<String> valueList=(List<String>) value;
+                  value= StringUtils.join(valueList,"\n");
+                }
+                else if(value!=null&&value instanceof Date){
+                    if(key.contains("Year")){
+                        value= DateUtils.formatDate((Date) value,"YYYY");
+                    }
+                    else {
+                        value= DateUtils.formatDate((Date) value,"YYYY-MM-dd");
+                    }
+                }
+                Cell cell = row.createCell(t);
+                CellStyle cellStyle = workbook.createCellStyle();
+                cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+                cellStyle.setWrapText(true);
+                cell.setCellStyle(cellStyle);
+
+                if(value!=null) {
+                    cell.setCellValue(value.toString());
+                }
+                t++;
+            }
+        }
+        String outPath="tem.xlsx";
+        File file =new File(outPath);
+        FileOutputStream fileOutputStream = new FileOutputStream(file);
+        workbook.write(fileOutputStream);
+        return file;
+    }
+}

+ 11 - 1
src/main/java/cn/cslg/pas/controller/ReportExportController.java

@@ -1,13 +1,17 @@
 package cn.cslg.pas.controller;
 
 import cn.cslg.pas.common.core.base.Constants;
+import cn.cslg.pas.common.model.request.QueryRequest;
 import cn.cslg.pas.common.model.request.StringRequest;
 import cn.cslg.pas.common.utils.Response;
 import cn.cslg.pas.service.ReportExportService;
 import cn.cslg.pas.service.business.CommonService;
+import cn.cslg.pas.service.report.ExportReportListService;
 import io.swagger.v3.oas.annotations.Operation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -20,7 +24,7 @@ public class ReportExportController {
     @Autowired
     private ReportExportService reportExportService;
     @Autowired
-    private CommonService commonService;
+    private ExportReportListService  exportReportListService;
     @Operation(summary = "导出报告")
     @PostMapping("/export")
     public Response queryPatentProject(@RequestBody StringRequest stringRequest) throws Exception {
@@ -28,4 +32,10 @@ public class ReportExportController {
         return Response.success("records");
     }
 
+    @Operation(summary = "导出无效报告列表")
+    @PostMapping("/exportReportList")
+    public ResponseEntity<InputStreamResource> exportReportList(@RequestBody StringRequest stringRequest) throws Exception {
+        ResponseEntity<InputStreamResource> resourceResponseEntity= exportReportListService.exportInvalidReportList(stringRequest);
+        return resourceResponseEntity;
+    }
 }

+ 1 - 1
src/main/java/cn/cslg/pas/controller/novelty/LitigationController.java

@@ -48,7 +48,7 @@ public class LitigationController {
     @Operation(summary = "查询行政诉讼")
     @PostMapping("/query")
     public Response query(@RequestBody LitigationDTO litigationDTO) {
-        LitigationReVO litigationReVO = litigationService.queryLitigation(litigationDTO);
+        LitigationReVO litigationReVO = litigationService.queryLitigation(litigationDTO,true);
         return Response.success(litigationReVO);
     }
 

+ 13 - 0
src/main/java/cn/cslg/pas/service/FinalInvalidStatueService.java

@@ -468,6 +468,7 @@ public class FinalInvalidStatueService extends ServiceImpl<FinalInvalidStatueMap
 
     /**
      * 查询无效理由里的无效发条
+     *
      * @param vo
      * @return
      */
@@ -476,6 +477,18 @@ public class FinalInvalidStatueService extends ServiceImpl<FinalInvalidStatueMap
                 .eq(FinalInvalidStatue::getProjectId, vo.getProjectId()));
         return list.stream().map(FinalInvalidStatue::getStatuteId).distinct().collect(Collectors.toList());
     }
+
+
+    public List<FinalInvalidStatue> getFinalInvalidStatues(List<Integer> projectIds) {
+        //根据projectId查询最终无效理由和证据
+        LambdaQueryWrapper<FinalInvalidStatue> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(FinalInvalidStatue::getProjectId, projectIds)
+                .orderByAsc(FinalInvalidStatue::getStatuteId)
+                .orderByAsc(FinalInvalidStatue::getClaimOrder);
+
+        List<FinalInvalidStatue> statueList = this.list(queryWrapper);
+        return statueList;
+    }
 }
 
 

+ 7 - 0
src/main/java/cn/cslg/pas/service/ReportAffairCasePhaseService.java

@@ -39,4 +39,11 @@ public class ReportAffairCasePhaseService extends ServiceImpl<ReportAffairCasePh
         ReportAffairCasePhase reportAffairCasePhase =this.getOne(queryWrapper,false);
         return  reportAffairCasePhase;
     }
+
+    public List<ReportAffairCasePhase> queryAssoCasePhases() {
+        LambdaQueryWrapper<ReportAffairCasePhase> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(ReportAffairCasePhase::getIfShow,true);
+        List<ReportAffairCasePhase> reportAffairCasePhases =this.list(queryWrapper);
+        return  reportAffairCasePhases;
+    }
 }

+ 56 - 12
src/main/java/cn/cslg/pas/service/business/ReportAffairService.java

@@ -462,7 +462,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
             assoReportAffairFileService.saveBatch(assoReportAffairFiles);
         }
         if (addStateOpinionDTO.getIfSendEmail()) {
-            sendReportMailService.finalSendEmail(projectId, fileGuids, addStateOpinionDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, addStateOpinionDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -501,9 +501,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         List<String> fileGuids = updateStateOpinionDTO.getFileGuids();
         assoReportAffairFileService.updateAffairFile(reportAffairId, fileGuids);
         if (updateStateOpinionDTO.getIfSendEmail()) {
-            ReportAffairDTO reportAffairDTO =new ReportAffairDTO();
+            ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
             reportAffairDTO.setAssoCasePhaseId(reportAffair.getAssoCasePhaseId());
-            sendReportMailService.finalSendEmail(projectId, fileGuids, updateStateOpinionDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, updateStateOpinionDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -587,7 +587,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
             assoReportAffairFileService.saveBatch(assoReportAffairFiles);
         }
         if (addClaimHistoryDTO.getIfSendEmail()) {
-            sendReportMailService.finalSendEmail(projectId, fileGuids, addClaimHistoryDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, addClaimHistoryDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -626,9 +626,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         List<String> fileGuids = updateClaimHistoryDTO.getFileGuids();
         assoReportAffairFileService.updateAffairFile(reportAffairId, fileGuids);
         if (updateClaimHistoryDTO.getIfSendEmail()) {
-            ReportAffairDTO reportAffairDTO=new ReportAffairDTO();
+            ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
             reportAffairDTO.setAssoCasePhaseId(reportAffair.getAssoCasePhaseId());
-            sendReportMailService.finalSendEmail(projectId, fileGuids, updateClaimHistoryDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, updateClaimHistoryDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -676,7 +676,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
             assoReportAffairFileService.saveBatch(assoReportAffairFiles);
         }
         if (addSupplyEvidenceDTO.getIfSendEmail()) {
-            sendReportMailService.finalSendEmail(projectId, fileGuids, addSupplyEvidenceDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, addSupplyEvidenceDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -715,9 +715,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         List<String> fileGuids = updateSupplyEvidenceDTO.getFileGuids();
         assoReportAffairFileService.updateAffairFile(reportAffairId, fileGuids);
         if (updateSupplyEvidenceDTO.getIfSendEmail()) {
-            ReportAffairDTO reportAffairDTO =new ReportAffairDTO();
+            ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
             reportAffairDTO.setAssoCasePhaseId(reportAffair.getAssoCasePhaseId());
-            sendReportMailService.finalSendEmail(projectId, fileGuids, updateSupplyEvidenceDTO.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, updateSupplyEvidenceDTO.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -821,7 +821,7 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
             assoReportAffairFileService.saveBatch(assoReportAffairFiles);
         }
         if (vo.getIfSendEmail()) {
-            sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -869,9 +869,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         List<String> fileGuids = vo.getFileGuids();
         assoReportAffairFileService.updateAffairFile(reportAffairId, fileGuids);
         if (vo.getIfSendEmail()) {
-            ReportAffairDTO reportAffairDTO =new ReportAffairDTO();
+            ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
             reportAffairDTO.setAssoCasePhaseId(reportAffair.getAssoCasePhaseId());
-            sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS(),reportAffairDTO);
+            sendReportMailService.finalSendEmail(projectId, fileGuids, vo.getExtraEmailDTOS(), reportAffairDTO);
         }
         return reportAffairId;
     }
@@ -898,4 +898,48 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         courtSubpoenaVO.setBePosition(reportAffairVO.getBePosition());
         reportAffairVO.setCourtSubpoenaVO(courtSubpoenaVO);
     }
+
+    public List<ReportAffairVO> queryReportAffairs(List<Integer> projectIds) {
+        List<ReportAffairVO> reportAffairVOS = new ArrayList<>();
+        //判空
+        if (projectIds == null || projectIds.size() == 0) {
+            return reportAffairVOS;
+        }
+        //根据报告id查询事务
+        LambdaQueryWrapper<ReportAffair> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(ReportAffair::getProjectId, projectIds)
+                .orderByDesc(ReportAffair::getOccurredTime);
+        List<ReportAffair> reportAffairs = this.list(queryWrapper);
+        if (reportAffairs.isEmpty()) {
+            return reportAffairVOS;
+        }
+
+        List<Integer> collect = reportAffairs.stream().map(ReportAffair::getAssoCasePhaseId).collect(Collectors.toList());
+        List<ReportAffairCasePhase> phaseList = new ArrayList<>();
+        if (!CollectionUtils.isEmpty(collect)) {
+            List<ReportAffairCasePhase> phases = reportAffairCasePhaseMapper.selectList(new LambdaQueryWrapper<ReportAffairCasePhase>()
+                    .in(BaseEntity::getId, collect));
+            phaseList.addAll(phases);
+        }
+        reportAffairs.forEach(item -> {
+            ReportAffairVO reportAffairVO = new ReportAffairVO();
+            BeanUtils.copyProperties(item, reportAffairVO);
+            ReportAffairCasePhase casePhase = phaseList.stream().filter(i -> i.getId().equals(item.getAssoCasePhaseId())).findFirst().orElse(null);
+            if (ObjectUtils.isNotEmpty(casePhase)) {
+                Integer type = casePhase.getFlowType();
+                reportAffairVO.setFlowName(casePhase.getFlowName());
+                reportAffairVO.setFlowType(type);
+
+                reportAffairVO.setCasePhase(casePhase.getCasePhase());
+                if (reportAffairVO.getCaseChildPhase() == null) {
+                    reportAffairVO.setCaseChildPhase(casePhase.getCaseChildPhase());
+                }
+
+                reportAffairVO.setDocumentType(casePhase.getDocumentType());
+            }
+            reportAffairVOS.add(reportAffairVO);
+        });
+
+        return reportAffairVOS;
+    }
 }

+ 15 - 1
src/main/java/cn/cslg/pas/service/business/ReportProjectService.java

@@ -1028,7 +1028,7 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper, Repor
 
     //装载查询语句
     private List<String> loadSearchSql(List<String> sqls) {
-        PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+        PersonnelVO personnelVO = cacheUtils.getLoginUser(1);
         String id = personnelVO.getId();
         Integer tenantId = personnelVO.getTenantId();
         Integer roleType = personnelVO.getRoleType();
@@ -1086,4 +1086,18 @@ public class ReportProjectService extends ServiceImpl<ReportProjectMapper, Repor
         }
         return reportProject.getId();
     }
+
+    public List<ReportProjectVO> queryReportVOs(QueryRequest queryRequest) throws Exception{
+        String tableName = "reportProject";
+        Boolean ifInvalidReport = queryRequest.getIfInvalidReport();
+        if (ifInvalidReport != null && ifInvalidReport) {
+            tableName = "invalidReportProject";
+        }
+        List<String> sqls = formatQueryService.reSqls(queryRequest, tableName);
+        sqls = this.loadSearchSql(sqls);
+        //根据sql查询事件信息
+        List<ReportProjectVO> reportProject = reportProjectMapper.getReportProject(this.getSelectMessage(), sqls.get(0), sqls.get(1), sqls.get(2));
+        this.loadReportProjectVO(reportProject, ifInvalidReport);
+        return reportProject;
+    }
 }

+ 4 - 3
src/main/java/cn/cslg/pas/service/dify/GenerateInstructionService.java

@@ -165,7 +165,7 @@ public class GenerateInstructionService {
             mainClaimStr = StringUtils.join(reMainPatentClaims, "\n");
         }
         String mainClaim = mainClaimStr;
-
+        String claimStrs= StringUtils.join(reMainPatentClaims,"\n");
         return Flux.create(emitter -> {
             new Thread(() -> {
                 try {
@@ -175,7 +175,7 @@ public class GenerateInstructionService {
                     emitter.next(startMess);
 
                     //生成标题和技术领域
-                    GenerateInstructAnswerVO generateInstructAnswerVO = this.genrateTechcialAndTitle(userId, emitter, mainClaim, background, filePath);
+                    GenerateInstructAnswerVO generateInstructAnswerVO = this.genrateTechcialAndTitle(userId, emitter, mainClaim, background, filePath,claimStrs);
                     String conversionId = generateInstructAnswerVO.getConversionId();
                     String title = generateInstructAnswerVO.getTitle();
                     String technical = generateInstructAnswerVO.getTechnical();
@@ -254,7 +254,7 @@ public class GenerateInstructionService {
      * @return
      * @throws Exception
      */
-    public GenerateInstructAnswerVO genrateTechcialAndTitle(Integer userId, FluxSink fluxSink, String mainClaim, String background, String filePath) throws Exception {
+    public GenerateInstructAnswerVO genrateTechcialAndTitle(Integer userId, FluxSink fluxSink, String mainClaim, String background, String filePath,String claimStrs) throws Exception {
         GenerateInstructAnswerVO generateInstructAnswerVO = null;
         GenerateTechnicalVO generateTechnicalVO = null;
         String startMessage = getFluxMessage(FIELD_TITLE, START, "");
@@ -267,6 +267,7 @@ public class GenerateInstructionService {
             getInstructAnswerDTO.setFilePath(filePath);
             getInstructAnswerDTO.setType("g&technical");
             getInstructAnswerDTO.setUserId(userId);
+            getInstructAnswerDTO.setClaims(claimStrs);
             generateInstructAnswerVO = this.getAnswerFromAI(getInstructAnswerDTO);
             String answer = generateInstructAnswerVO.getAnswer();
             generateTechnicalVO = JSONObject.parseObject(answer, GenerateTechnicalVO.class);

+ 27 - 10
src/main/java/cn/cslg/pas/service/novelty/LitigationService.java

@@ -5,8 +5,10 @@ import cn.cslg.pas.common.model.novelty.LitigationReVO;
 import cn.cslg.pas.common.model.novelty.LitigationVO;
 import cn.cslg.pas.domain.business.CourtOrder;
 import cn.cslg.pas.domain.business.ReportAffair;
+import cn.cslg.pas.domain.business.ReportAffairCasePhase;
 import cn.cslg.pas.exception.ExceptionEnum;
 import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.service.ReportAffairCasePhaseService;
 import cn.cslg.pas.service.business.CourtOrderService;
 import cn.cslg.pas.service.business.ReportAffairService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -33,7 +35,7 @@ import java.util.stream.Collectors;
 public class LitigationService extends ServiceImpl<LitigationMapper, Litigation> {
     private final ReportAffairService reportAffairService;
     private final CourtOrderService courtOrderService;
-
+    private final ReportAffairCasePhaseService affairCasePhaseService;
     public Litigation addLitigation(LitigationDTO litigationDTO) {
         Litigation litigation = new Litigation();
         BeanUtils.copyProperties(litigationDTO, litigation);
@@ -69,7 +71,7 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
         }
     }
 
-    public LitigationReVO queryLitigation(LitigationDTO litigationDTO) {
+    public LitigationReVO queryLitigation(LitigationDTO litigationDTO,Boolean ifLoadResult) {
         LitigationReVO litigationReVO = new LitigationReVO();
         Integer projectId = litigationDTO.getProjectId();
         LambdaQueryWrapper<Litigation> queryWrapper = new LambdaQueryWrapper<>();
@@ -81,11 +83,11 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
 
         this.formatLitigations(list, 1);
         this.formatLitigations(list, 2);
-        litigationReVO = this.loadLitigation(list, projectId);
+        litigationReVO = this.loadLitigation(list, projectId,ifLoadResult);
         return litigationReVO;
     }
 
-    public LitigationReVO loadLitigation(List<Litigation> list, Integer projectId) {
+    public LitigationReVO loadLitigation(List<Litigation> list, Integer projectId,Boolean ifLoadResult) {
         LitigationReVO litigationReVO = new LitigationReVO();
         if (list.size() == 0) {
             return litigationReVO;
@@ -96,8 +98,9 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
             BeanUtils.copyProperties(item, litigationVO);
             litigationVOS.add(litigationVO);
         });
-
-        this.loadResultByAffair(projectId, litigationVOS);
+          if(ifLoadResult!=null&&ifLoadResult) {
+              this.loadResultByAffair(projectId, litigationVOS);
+          }
         litigationVOS.forEach(item -> {
             if (item.getType().equals(1)) {
                 litigationReVO.setLitigationVO1(item);
@@ -112,11 +115,22 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
         if (list.size() == 0) {
             return list;
         }
-        Integer litigationType1 = 16;
-        Integer litigationType2 = 26;
-        LambdaQueryWrapper<ReportAffair> queryWrapper = new LambdaQueryWrapper<>();
+        Integer flowType1=16;
+        Integer flowType2=26;
+
+        LambdaQueryWrapper<ReportAffairCasePhase> queryWrapperCasePhase =new LambdaQueryWrapper<>();
+        queryWrapperCasePhase.eq(ReportAffairCasePhase::getIfShow,true)
+                    .in(ReportAffairCasePhase::getFlowType,Arrays.asList(flowType1, flowType2));
+        List<ReportAffairCasePhase> reportAffairCasePhases=affairCasePhaseService.list(queryWrapperCasePhase);
+         if(reportAffairCasePhases==null||reportAffairCasePhases.size()==0){
+             return list;
+         }
+         List<Integer> litigationTypeIds=reportAffairCasePhases.stream().map(ReportAffairCasePhase::getId).collect(Collectors.toList());
+        Integer litigationType1 =reportAffairCasePhases.stream().filter(item->item.getFlowType().equals(flowType1)).map(ReportAffairCasePhase::getId).findFirst().orElse(null);
+        Integer litigationType2 = reportAffairCasePhases.stream().filter(item->item.getFlowType().equals(flowType2)).map(ReportAffairCasePhase::getId).findFirst().orElse(null);
+         LambdaQueryWrapper<ReportAffair> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(ReportAffair::getProjectId, projectId)
-                .in(ReportAffair::getAssoCasePhaseId, Arrays.asList(litigationType1, litigationType2));
+                .in(ReportAffair::getAssoCasePhaseId,litigationTypeIds);
         List<ReportAffair> reportAffairs = reportAffairService.list(queryWrapper);
         if (reportAffairs == null || reportAffairs.size() == 0) {
             return list;
@@ -140,6 +154,7 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
                 affairType = litigationType2;
             }
             Integer finalType = affairType;
+
             ReportAffair reportAffair = reportAffairs.stream().filter(tem -> finalType.equals(tem.getAssoCasePhaseId())).findFirst().orElse(null);
             if (reportAffair != null) {
                 Integer temAffairId = reportAffair.getId();
@@ -162,6 +177,8 @@ public class LitigationService extends ServiceImpl<LitigationMapper, Litigation>
         }
         return list;
     }
+
+
 }
 
 

+ 5 - 1
src/main/java/cn/cslg/pas/service/query/FormatQueryService.java

@@ -240,7 +240,7 @@ public class FormatQueryService {
 
         if (queryRequest instanceof MapRequest) {
 
-        } else {
+        } else if(queryRequest instanceof StringRequest) {
             stringRequest = (StringRequest) queryRequest;
         }
 
@@ -293,6 +293,10 @@ public class FormatQueryService {
             String page = " limit " + ((current - 1) * size) + "," + size;
             sql3 = page;
         }
+        else if(queryRequest.getStartNumber() != null && queryRequest.getEndNumber() != null){
+            String page = " limit " + (queryRequest.getStartNumber() - 1)  + "," + (queryRequest.getEndNumber()-queryRequest.getStartNumber());
+            sql3 = page;
+        }
 
         //格式化分组信息
         sqls.add(sql1);

+ 164 - 0
src/main/java/cn/cslg/pas/service/report/ExportReportListService.java

@@ -0,0 +1,164 @@
+package cn.cslg.pas.service.report;
+
+import cn.cslg.pas.common.model.novelty.LitigationDTO;
+import cn.cslg.pas.common.model.novelty.LitigationReVO;
+import cn.cslg.pas.common.model.report.ExportInvalidReportVO;
+import cn.cslg.pas.common.model.request.QueryRequest;
+import cn.cslg.pas.common.utils.FileUtils;
+import cn.cslg.pas.common.utils.StringUtils;
+import cn.cslg.pas.common.utils.excelUtils.ExcelUtil;
+import cn.cslg.pas.common.vo.business.ReportProjectVO;
+import cn.cslg.pas.common.vo.invalidVO.ReportAffairVO;
+import cn.cslg.pas.domain.FinalInvalidStatue;
+import cn.cslg.pas.domain.business.ReportAffairCasePhase;
+import cn.cslg.pas.domain.business.SystemDict;
+import cn.cslg.pas.service.FinalInvalidStatueService;
+import cn.cslg.pas.service.ReportAffairCasePhaseService;
+import cn.cslg.pas.service.business.ReportAffairService;
+import cn.cslg.pas.service.business.ReportProjectService;
+import cn.cslg.pas.service.business.SystemDictService;
+import cn.cslg.pas.service.novelty.LitigationService;
+import cn.hutool.core.bean.BeanUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.InputStreamResource;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class ExportReportListService {
+    @Autowired
+    private ReportProjectService reportProjectService;
+    @Autowired
+    private ReportAffairService reportAffairService;
+    @Autowired
+    private FinalInvalidStatueService finalInvalidStatueService;
+    @Autowired
+    private SystemDictService systemDictService;
+    @Autowired
+    private LitigationService litigationService;
+    @Autowired
+    private ReportAffairCasePhaseService reportAffairCasePhaseService;
+
+    public ResponseEntity<InputStreamResource> exportInvalidReportList(QueryRequest queryRequest) throws Exception {
+        queryRequest.setIfInvalidReport(true);
+        List<ReportProjectVO> reportProjectVOS = reportProjectService.queryReportVOs(queryRequest);
+
+        ResponseEntity<InputStreamResource> resourceResponseEntity = this.loadExportInvalidReportVos(reportProjectVOS);
+        return resourceResponseEntity;
+    }
+
+    public ResponseEntity<InputStreamResource> loadExportInvalidReportVos(List<ReportProjectVO> reportProjectVOS) throws Exception {
+        List<Map<String, Object>> exportInvalidReportVOS = new ArrayList<>();
+        List<Integer> projectIds = reportProjectVOS.stream().map(ReportProjectVO::getId).collect(Collectors.toList());
+        List<ReportAffairVO> reportAffairVOS = reportAffairService.queryReportAffairs(projectIds);
+        List<FinalInvalidStatue> finalInvalidStatues = finalInvalidStatueService.getFinalInvalidStatues(projectIds);
+        List<SystemDict> systemDictList = systemDictService.getSystemDictListByType(Arrays.asList("STATUTE"));
+        for (ReportProjectVO reportProjectVO : reportProjectVOS) {
+            ExportInvalidReportVO exportInvalidReportVO = new ExportInvalidReportVO();
+            BeanUtils.copyProperties(reportProjectVO, exportInvalidReportVO);
+            this.loadInvalidAgency(exportInvalidReportVO, reportProjectVO);
+            this.loadAffair(exportInvalidReportVO, reportProjectVO, reportAffairVOS);
+            this.loadInvalidStatus(exportInvalidReportVO, reportProjectVO, systemDictList, finalInvalidStatues);
+            this.loadLitigation(exportInvalidReportVO, reportProjectVO,reportAffairVOS);
+            Map<String, Object> map = BeanUtil.beanToMap(exportInvalidReportVO);
+            exportInvalidReportVOS.add(map);
+
+        }
+        String readPath = "/invalidReportExport.xlsx";
+        readPath = FileUtils.getConfigFilePath(readPath);
+        File file = ExcelUtil.fullExcelTemple(readPath, exportInvalidReportVOS);
+        ResponseEntity<InputStreamResource> resourceResponseEntity = FileUtils.fileToResponse(file);
+        file.delete();
+        return resourceResponseEntity;
+    }
+
+    //装载无效代理所
+    public void loadInvalidAgency(ExportInvalidReportVO exportInvalidReportVO, ReportProjectVO reportProjectVO) {
+        if (reportProjectVO.getActType() != null && reportProjectVO.getActType() == 1) {
+            exportInvalidReportVO.setInvalidAgency(reportProjectVO.getApplicantAgency());
+        } else {
+            exportInvalidReportVO.setInvalidAgency(reportProjectVO.getRightHolderAgency());
+        }
+    }
+
+    //装载事务信息
+    public void loadAffair(ExportInvalidReportVO exportInvalidReportVO, ReportProjectVO reportProjectVO, List<ReportAffairVO> reportAffairVOS) {
+        List<ReportAffairVO> reportAffairVOList = reportAffairVOS.stream().filter(item -> item.getProjectId().equals(reportProjectVO.getId())).collect(Collectors.toList());
+        ReportAffairVO reportAffairNotification = reportAffairVOList.stream().filter(item -> item.getFlowType() != null && item.getFlowType().equals(29)).findFirst().orElse(null);
+        List<ReportAffairVO> reportAffairZhuanWen = reportAffairVOList.stream().filter(item -> item.getFlowType() != null && item.getFlowType().equals(30)).sorted(Comparator.comparing(ReportAffairVO::getOccurredTime)).collect(Collectors.toList());
+        ReportAffairVO invalidDecision = reportAffairVOList.stream().filter(item -> item.getFlowType() != null && item.getFlowType().equals(7)).findFirst().orElse(null);
+        for (ReportAffairVO reportAffairVO : reportAffairZhuanWen) {
+            if (exportInvalidReportVO.getZhuanwen1Date() == null) {
+                exportInvalidReportVO.setZhuanwen1Date(reportAffairVO.getOccurredTime());
+            } else if (exportInvalidReportVO.getZhuanwen2Date() == null) {
+                exportInvalidReportVO.setZhuanwen2Date(reportAffairVO.getOccurredTime());
+            } else if (exportInvalidReportVO.getZhuanwen3Date() == null) {
+                exportInvalidReportVO.setZhuanwen3Date(reportAffairVO.getOccurredTime());
+            }
+        }
+        if (reportAffairNotification != null) {
+            exportInvalidReportVO.setNotificationDate(reportAffairNotification.getOccurredTime());
+        }
+        if (invalidDecision != null) {
+            exportInvalidReportVO.setInvalidDecisionDate(invalidDecision.getOccurredTime());
+        }
+    }
+
+    //装载无效法条信息
+    public void loadInvalidStatus(ExportInvalidReportVO exportInvalidReportVO, ReportProjectVO reportProjectVO, List<SystemDict> systemDictList, List<FinalInvalidStatue> finalInvalidStatues) {
+        List<FinalInvalidStatue> finalInvalidStatueList = finalInvalidStatues.stream().filter(item -> item.getProjectId().equals(reportProjectVO.getId())).collect(Collectors.toList());
+        List<String> statuesNames = new ArrayList<>();
+        finalInvalidStatueList.forEach(item -> {
+            SystemDict systemDict = systemDictList.stream().filter(tem -> tem.getValue().equals(item.getStatuteId().toString())).findFirst().orElse(null);
+            if (systemDict != null) {
+                statuesNames.add(systemDict.getLabel());
+            }
+        });
+        if (statuesNames.size() > 0) {
+            exportInvalidReportVO.setInvalidReason(StringUtils.join(statuesNames, "\n"));
+        }
+    }
+
+    //装载诉讼结果
+    public void loadLitigation(ExportInvalidReportVO exportInvalidReportVO, ReportProjectVO reportProjectVO,List<ReportAffairVO> reportAffairVOS) {
+        Integer projectId = reportProjectVO.getId();
+        LitigationDTO litigationDTO = new LitigationDTO();
+        litigationDTO.setProjectId(projectId);
+        LitigationReVO litigationReVO = litigationService.queryLitigation(litigationDTO, false);
+        if (litigationReVO != null) {
+            if (litigationReVO.getLitigationVO1() != null) {
+                exportInvalidReportVO.setLitigation1Conclusion(litigationReVO.getLitigationVO1().getConclusion());
+                exportInvalidReportVO.setLitigation1CaseNumber(litigationReVO.getLitigationVO1().getCaseNumber());
+                exportInvalidReportVO.setLitigation1plaintiff(litigationReVO.getLitigationVO1().getPlaintiff());
+                exportInvalidReportVO.setLitigation1caseFieldTime(litigationReVO.getLitigationVO1().getCaseFieldTime());
+              String conclusion=  this.loadLitigationConclusion(reportAffairVOS,projectId,"行政一审");
+                exportInvalidReportVO.setLitigation1Conclusion(conclusion);
+
+            }
+            if (litigationReVO.getLitigationVO2() != null) {
+                exportInvalidReportVO.setLitigation2Conclusion(litigationReVO.getLitigationVO2().getConclusion());
+                exportInvalidReportVO.setLitigation2CaseNumber(litigationReVO.getLitigationVO2().getCaseNumber());
+                exportInvalidReportVO.setLitigation2plaintiff(litigationReVO.getLitigationVO2().getPlaintiff());
+                exportInvalidReportVO.setLitigation2caseFieldTime(litigationReVO.getLitigationVO2().getCaseFieldTime());
+                String conclusion=  this.loadLitigationConclusion(reportAffairVOS,projectId,"行政二审");
+                exportInvalidReportVO.setLitigation2Conclusion(conclusion);
+            }
+        }
+    }
+  public  String loadLitigationConclusion(List<ReportAffairVO> reportAffairVOS,Integer projectId,String type){
+      String conclusion="";
+      List<ReportAffairVO> temReportAffairVOs=reportAffairVOS.stream().filter(item->item.getCasePhase()!=null&&item.getCasePhase().equals(type)&&item.getProjectId().equals(projectId)&&item.getOccurredTime()!=null).sorted(Comparator.comparing(ReportAffairVO::getOccurredTime,Comparator.reverseOrder())).collect(Collectors.toList());
+      if(temReportAffairVOs.size()>0){
+          ReportAffairVO reportAffairVO =temReportAffairVOs.get(0);
+          if(reportAffairVO.getCaseChildPhase()!=null){
+              conclusion=reportAffairVO.getCaseChildPhase();
+          }
+      }
+      return conclusion;
+  }
+}

+ 8 - 3
src/main/resources/application-prodNetOut.yml

@@ -1,4 +1,9 @@
 spring:
+  rabbitmq:
+    host: 192.168.0.71
+    port: 5672
+    username: admin
+    password: 123456
   data:
     redis:
       host: 139.224.34.118
@@ -34,7 +39,7 @@ RMSUrl: http://localhost:8872
 FMSUrl: http://47.116.194.135:8803
 WDUrl: http://1.116.113.26:81
 PythonUrl: http://localhost:8001
-FileDownloadUrl: http://192.168.2.24:8803/fileManager/downloadFile?fileId=
+FileDownloadUrl: https://xsip.cn/api/fileManager/downloadFile?fileId=159766751baa4565a137bc3959f3b4a0
 FileSource: 3
 ES:
   patent: patent
@@ -43,10 +48,10 @@ WDSYS:
   account: caiyangl
   password: Lqftiu807005
 DIFY:
-  apiKey: app-DDGJt4QUmzlc2aFQ5voOAXIj
+  apiKey: app-YfoUDlED4oJNO9hVk6hfdKSw
   #  cliamKey: app-fxpiWOYqtJM1BOaJnG54NlCZ
   OAApiKey: app-NvKwdHvEK2UmJdmjTGDR0xu6
   checkApiKey: aa
   cliamKey: app-jF3akhYKgljPLdpeIpTNbs6f
-  gInstructionKey: app-7ImBmlr7kvBTSvBj1mTvgKyp
+  gInstructionKey: app-YfoUDlED4oJNO9hVk6hfdKSw
   url: http://192.168.2.24/v1/

BIN
src/main/resources/file/reportTemple/invalidReportExport.xlsx


+ 1 - 1
src/test/java/cn/cslg/pas/novelty/LitigationServiceTest.java

@@ -69,7 +69,7 @@ public class LitigationServiceTest {
        List<Integer> ids = this.addReportAffair();
         LitigationDTO litigationDTO = new LitigationDTO();
         litigationDTO.setProjectId(2);
-        LitigationReVO litigationReVO = litigationService.queryLitigation(litigationDTO);
+        LitigationReVO litigationReVO = litigationService.queryLitigation(litigationDTO,true);
         System.out.println(litigationReVO);
         this.removeAffairById(ids);
     }