xiexiang 1 yıl önce
ebeveyn
işleme
49f00a943b

+ 27 - 0
src/main/java/cn/cslg/pas/common/dto/invalidDTO/AddOtherDocumentsDTO.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.common.dto.invalidDTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2023/12/29
+ */
+@Data
+public class AddOtherDocumentsDTO {
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+
+    private Integer projectId;
+
+    private List<String> fileGuids;
+
+    private String description;
+}

+ 28 - 0
src/main/java/cn/cslg/pas/common/dto/invalidDTO/UpdateOtherDocumentsDTO.java

@@ -0,0 +1,28 @@
+package cn.cslg.pas.common.dto.invalidDTO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2023/12/29
+ */
+@Data
+public class UpdateOtherDocumentsDTO {
+    private Integer documentId;
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+
+    private Integer projectId;
+
+    private List<String> fileGuids;
+
+    private String description;
+}

+ 23 - 0
src/main/java/cn/cslg/pas/common/vo/invalidVO/OtherDocumentsVO.java

@@ -0,0 +1,23 @@
+package cn.cslg.pas.common.vo.invalidVO;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 其他文档VO
+ * @Author xiexiang
+ * @Date 2023/12/28
+ */
+@Data
+public class OtherDocumentsVO {
+    private Integer documentId;
+    private String documentName;
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date documentTime;
+    private Integer projectId;
+    private String description;
+}

+ 7 - 1
src/main/java/cn/cslg/pas/common/vo/invalidVO/ReportAffairVO.java

@@ -17,7 +17,8 @@ import java.util.List;
 public class ReportAffairVO {
     private Integer id;
     /**
-     * 事务类型(0为口审记录,1为无效请求书,2为陈述意见书,3为无效决定书,4为行政诉讼书)
+     * 事务类型(0为口审记录,1为无效请求书,2为陈述意见书,3为无效决定书,4为行政诉讼书,5为行政诉讼判决书
+     * 6为权要修改记录,7为补充证据及理由,8为其他文档)
      */
     private Integer affairType;
 
@@ -94,4 +95,9 @@ public class ReportAffairVO {
      * 补充证据及理由返回VO
      */
     private SupplyEvidenceVO supplyEvidenceVO;
+
+    /**
+     * 其他文档返回VO
+     */
+    private OtherDocumentsVO otherDocumentsVO;
 }

+ 20 - 0
src/main/java/cn/cslg/pas/controller/ReportAffairController.java

@@ -34,6 +34,8 @@ public class ReportAffairController {
     private InvalidDecisionFileService invalidDecisionFileService;
     @Autowired
     private AdminProceedService adminProceedService;
+    @Autowired
+    private OtherDocumentsService otherDocumentsService;
 
     @Operation(summary = "上传无效请求书")
     @PostMapping("/addInvalidRequestFile")
@@ -200,4 +202,22 @@ public class ReportAffairController {
         records.setData(id);
         return Response.success(records);
     }
+
+    @Operation(summary = "上传其他文档")
+    @PostMapping("/addOtherDocuments")
+    public Response addOtherDocuments(@RequestBody AddOtherDocumentsDTO addOtherDocumentsDTO) throws Exception {
+        Integer id = otherDocumentsService.add(addOtherDocumentsDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
+
+    @Operation(summary = "修改其他文档")
+    @PostMapping("/updateOtherDocuments")
+    public Response updateOtherDocuments(@RequestBody UpdateOtherDocumentsDTO updateOtherDocumentsDTO) throws Exception {
+        Integer id = otherDocumentsService.update(updateOtherDocumentsDTO);
+        Records records = new Records();
+        records.setData(id);
+        return Response.success(records);
+    }
 }

+ 27 - 0
src/main/java/cn/cslg/pas/domain/business/OtherDocuments.java

@@ -0,0 +1,27 @@
+package cn.cslg.pas.domain.business;
+
+import cn.cslg.pas.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Data
+@TableName("other_documents")
+public class OtherDocuments extends BaseEntity<OtherDocuments> {
+    /**
+     * 文档名称
+     */
+    @TableField(value = "document_name")
+    private String documentName;
+
+    /**
+     * 报告事务id
+     */
+    @TableField(value = "report_affair_id")
+    private Integer reportAffairId;
+}

+ 13 - 0
src/main/java/cn/cslg/pas/mapper/OtherDocumentsMapper.java

@@ -0,0 +1,13 @@
+package cn.cslg.pas.mapper;
+
+import cn.cslg.pas.domain.business.OtherDocuments;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Repository
+public interface OtherDocumentsMapper extends BaseMapper<OtherDocuments> {
+}

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

@@ -38,7 +38,7 @@ public class AdminProceedService extends ServiceImpl<AdminProceedMapper, AdminPr
     private AssoReportAffairFileService assoReportAffairFileService;
 
     /**
-     * 上传行政诉讼判决
+     * 上传行政诉讼书
      * @param addDto
      * @return
      */

+ 148 - 0
src/main/java/cn/cslg/pas/service/business/OtherDocumentsService.java

@@ -0,0 +1,148 @@
+package cn.cslg.pas.service.business;
+
+import cn.cslg.pas.common.dto.business.ReportAffairDTO;
+import cn.cslg.pas.common.dto.invalidDTO.*;
+import cn.cslg.pas.common.vo.invalidVO.InvalidDecisionFileVO;
+import cn.cslg.pas.common.vo.invalidVO.OralTrailVO;
+import cn.cslg.pas.common.vo.invalidVO.OtherDocumentsVO;
+import cn.cslg.pas.domain.business.*;
+import cn.cslg.pas.exception.XiaoShiException;
+import cn.cslg.pas.mapper.OtherDocumentsMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 其他文档
+ * @Author xiexiang
+ * @Date 2024/2/23
+ */
+@Slf4j
+@Service
+public class OtherDocumentsService extends ServiceImpl<OtherDocumentsMapper, OtherDocuments> {
+    @Autowired
+    private ReportAffairService reportAffairService;
+
+    @Autowired
+    private AssoReportAffairFileService assoReportAffairFileService;
+
+    /**
+     * 新增
+     * @param addOtherDocumentsDTO
+     * @return
+     */
+    public Integer add(AddOtherDocumentsDTO addOtherDocumentsDTO){
+        if (addOtherDocumentsDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer projectId = addOtherDocumentsDTO.getProjectId();
+        if (projectId == null) {
+            throw new XiaoShiException("报告id为空");
+        }
+        //1. 首先上传报告事务,拿到报告事务id
+        ReportAffairDTO reportAffairDTO = new ReportAffairDTO();
+        reportAffairDTO.setProjectId(projectId);
+        //其他文档 8
+        reportAffairDTO.setAffairType(8);
+        //发生时间是文档时间
+        reportAffairDTO.setOccurredTime(addOtherDocumentsDTO.getDocumentTime());
+        //备注
+        reportAffairDTO.setDescription(addOtherDocumentsDTO.getDescription());
+        Integer reportAffairId = reportAffairService.addReportAffair(reportAffairDTO);
+
+        if (reportAffairId == null) {
+            throw new XiaoShiException("上传报告事务失败");
+        }
+        //2. 上传其他文档
+        OtherDocuments otherDocuments = new OtherDocuments();
+        otherDocuments.setDocumentName(addOtherDocumentsDTO.getDocumentName());
+        otherDocuments.setReportAffairId(reportAffairId);
+        otherDocuments.insert();
+        //3. 添加报告事务与文件关联
+        List<String> fileGuids = addOtherDocumentsDTO.getFileGuids();
+        if (fileGuids != null && !fileGuids.isEmpty()) {
+            List<AssoReportAffairFile> assoReportAffairFiles = new ArrayList<>();
+            fileGuids.forEach(item -> {
+                AssoReportAffairFile assoReportAffairFile = new AssoReportAffairFile();
+                assoReportAffairFile.setReportAffairId(reportAffairId);
+                assoReportAffairFile.setFileGuid(item);
+                assoReportAffairFiles.add(assoReportAffairFile);
+            });
+            assoReportAffairFileService.saveBatch(assoReportAffairFiles);
+        }
+        return reportAffairId;
+    }
+
+    /**
+     * 修改其他文档
+     * @param updateOtherDocumentsDTO
+     * @return
+     */
+    public Integer update(UpdateOtherDocumentsDTO updateOtherDocumentsDTO){
+        if (updateOtherDocumentsDTO == null) {
+            throw new XiaoShiException("入参为空");
+        }
+        Integer projectId = updateOtherDocumentsDTO.getProjectId();
+        Integer id = updateOtherDocumentsDTO.getDocumentId();
+        if (id == null) {
+            throw new XiaoShiException("id为空");
+        }
+        if (projectId == null) {
+            throw new XiaoShiException("报告id为空");
+        }
+        //1. 根据id查出其他文档
+        OtherDocuments otherDocuments = this.getById(id);
+        if (otherDocuments == null) {
+            throw new XiaoShiException("其他文档查询错误");
+        }
+        BeanUtils.copyProperties(updateOtherDocumentsDTO, otherDocuments);
+        otherDocuments.updateById();
+        Integer reportAffairId = otherDocuments.getReportAffairId();
+        //2. 拿到报告事务id,获取报告事务
+        ReportAffair reportAffair = reportAffairService.getById(reportAffairId);
+        reportAffair.setProjectId(projectId);
+        //发生时间是文档时间
+        reportAffair.setOccurredTime(updateOtherDocumentsDTO.getDocumentTime());
+        //备注
+        reportAffair.setDescription(updateOtherDocumentsDTO.getDescription());
+        reportAffair.updateById();
+        //3. 更新报告事务与文件关联
+        LambdaQueryWrapper<AssoReportAffairFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoReportAffairFile::getReportAffairId, reportAffairId);
+        assoReportAffairFileService.remove(queryWrapper);
+        List<String> fileGuids = updateOtherDocumentsDTO.getFileGuids();
+        if (fileGuids != null && !fileGuids.isEmpty()) {
+            List<AssoReportAffairFile> assoReportAffairFiles = new ArrayList<>();
+            fileGuids.forEach(item -> {
+                AssoReportAffairFile assoReportAffairFile = new AssoReportAffairFile();
+                assoReportAffairFile.setReportAffairId(reportAffairId);
+                assoReportAffairFile.setFileGuid(item);
+                assoReportAffairFiles.add(assoReportAffairFile);
+            });
+            assoReportAffairFileService.saveBatch(assoReportAffairFiles);
+        }
+        return reportAffairId;
+    }
+
+    public OtherDocumentsVO getOtherDocuments(Integer reportAffairId) {
+        LambdaQueryWrapper<OtherDocuments> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(OtherDocuments::getReportAffairId, reportAffairId);
+        OtherDocuments otherDocuments = this.getOne(queryWrapper, false);
+        OtherDocumentsVO otherDocumentsVO = new OtherDocumentsVO();
+        if (otherDocuments != null) {
+            BeanUtils.copyProperties(otherDocuments, otherDocumentsVO);
+            otherDocumentsVO.setDocumentId(otherDocuments.getId());
+        }
+        ReportAffair reportAffair = reportAffairService.getById(reportAffairId);
+        otherDocumentsVO.setDocumentTime(reportAffair.getOccurredTime());
+        otherDocumentsVO.setDescription(reportAffair.getDescription());
+        otherDocumentsVO.setProjectId(reportAffair.getProjectId());
+        return otherDocumentsVO;
+    }
+}

+ 19 - 0
src/main/java/cn/cslg/pas/service/business/ReportAffairService.java

@@ -59,6 +59,9 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
     @Autowired
     @Lazy
     private AdminProceedService adminProceedService;
+    @Autowired
+    @Lazy
+    private OtherDocumentsService otherDocumentsService;
 
     /**
      * 创建报告事务
@@ -105,6 +108,10 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
                     LambdaQueryWrapper<InvalidDecisionFile> queryWrapper1 = new LambdaQueryWrapper<>();
                     queryWrapper1.eq(InvalidDecisionFile::getReportAffairId, id);
                     invalidDecisionFileService.remove(queryWrapper1);
+                } else if (reportAffair.getAffairType().equals(8)) {//其他文档
+                    LambdaQueryWrapper<OtherDocuments> queryWrapper1 = new LambdaQueryWrapper<>();
+                    queryWrapper1.eq(OtherDocuments::getReportAffairId, id);
+                    otherDocumentsService.remove(queryWrapper1);
                 }
                 this.removeById(id);
             }
@@ -159,6 +166,8 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
                 this.loadClaimHistory(reportAffairVO);
             } else if (type.equals(7)) {//7 补充证据及理由
                 this.loadSupplyEvidence(reportAffairVO);
+            } else if (type.equals(8)) {//8 其他文档
+                this.loadOtherDocuments(reportAffairVO);
             }
             reportAffairVOS.add(reportAffairVO);
         });
@@ -550,4 +559,14 @@ public class ReportAffairService extends ServiceImpl<ReportAffairMapper, ReportA
         reportAffairVO.setSupplyEvidenceVO(supplyEvidenceVO);
     }
 
+    /**
+     * 装载其他文档
+     * @param reportAffairVO
+     */
+    public void loadOtherDocuments(ReportAffairVO reportAffairVO) {
+        Integer reportAffairId = reportAffairVO.getId();
+        OtherDocumentsVO otherDocumentsVO = otherDocumentsService.getOtherDocuments(reportAffairId);
+        reportAffairVO.setOtherDocumentsVO(otherDocumentsVO);
+    }
+
 }