소스 검색

4/4 xiexiang

xiexiang 2 년 전
부모
커밋
da5e2363cc

+ 12 - 1
RMS/pom.xml

@@ -4,7 +4,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.6.4</version>
+        <version>2.5.9</version>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
@@ -144,6 +144,11 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-mail</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
 <!--        <dependency>-->
 <!--            <groupId>org.openjdk.nashorn</groupId>-->
 <!--            <artifactId>nashorn-core</artifactId>-->
@@ -164,6 +169,12 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-amqp</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+            <version>1.4.0</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 2 - 1
RMS/src/main/java/cn/cslg/report/Application.java

@@ -4,11 +4,12 @@ import cn.hutool.cron.CronUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
-@SpringBootApplication
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
 @Slf4j
 public class Application {
     public static void main(String[] args) {

+ 32 - 0
RMS/src/main/java/cn/cslg/report/common/model/PageHelperT.java

@@ -0,0 +1,32 @@
+package cn.cslg.report.common.model;
+
+import cn.cslg.report.common.model.vo.FollowUpVO;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 分页查询
+ *
+ * @Author xiexiang
+ * @Date 2023/4/2
+ */
+@Data
+public class PageHelperT {
+    /**
+     * 总条数
+     */
+    private Integer total;
+    /**
+     * 当前页
+     */
+    private Integer current;
+    /**
+     * 每页条数
+     */
+    private Integer size;
+    /**
+     * 分页查询结果
+     */
+    private List<FollowUpVO> list;
+}

+ 25 - 0
RMS/src/main/java/cn/cslg/report/common/model/QueryFUEntity.java

@@ -0,0 +1,25 @@
+package cn.cslg.report.common.model;
+
+import lombok.Data;
+
+/**
+ * 分页查询后续事项传入数据
+ *
+ * @Author xiexiang
+ * @Date 2023/4/2
+ */
+@Data
+public class QueryFUEntity {
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+    /**
+     * 当前页
+     */
+    private Integer current;
+    /**
+     * 每页条数
+     */
+    private Integer size;
+}

+ 67 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/FollowUpDTO.java

@@ -0,0 +1,67 @@
+package cn.cslg.report.common.model.dto;
+
+import cn.hutool.core.date.DateTime;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 新增后续事项的前端传输DTO数据对象
+ *
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+@Accessors(chain = true)
+@Data
+public class FollowUpDTO {
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+
+    /**
+     * 父id
+     */
+    private Integer parentId;
+
+    /**
+     * 后续事项名称
+     */
+    private String followUpName;
+
+    /**
+     * 描述
+     */
+    private String remark;
+
+    /**
+     * 期限
+     */
+    private Date timeLimit;
+
+    /**
+     * 处理人
+     */
+    private String agent;
+
+    /**
+     * 协办人
+     */
+    private String assistPerson;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 结论
+     */
+    private String conclusion;
+}

+ 62 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/FollowUpUpdateDTO.java

@@ -0,0 +1,62 @@
+package cn.cslg.report.common.model.dto;
+
+import cn.hutool.core.date.DateTime;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 修改后续事项传入数据对象
+ *
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+@Accessors(chain = true)
+@Data
+public class FollowUpUpdateDTO {
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+
+    /**
+     * 父id
+     */
+    private Integer parentId;
+
+    /**
+     * 后续事项名称
+     */
+    private String followUpName;
+
+    /**
+     * 描述
+     */
+    private String remark;
+
+    /**
+     * 期限
+     */
+    private Date timeLimit;
+
+    /**
+     * 处理人
+     */
+    private String agent;
+
+    /**
+     * 协办人
+     */
+    private String assistPerson;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+}

+ 36 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/RegisterDTO.java

@@ -0,0 +1,36 @@
+package cn.cslg.report.common.model.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 登记结果的前端传输DTO数据对象
+ *
+ * @Author xiexiang
+ * @Date 2023/4/3
+ */
+@Data
+public class RegisterDTO {
+
+    /**
+     * 后续事项id
+     *
+     * @param followUpId
+     */
+    private Integer followUpId;
+
+    /**
+     * 结论
+     *
+     * @param conclusion 结论
+     */
+    private String conclusion;
+
+    /**
+     * 批量新增后续事项
+     *
+     * @param followUpDTOList
+     */
+    private List<FollowUpDTO> followUps;
+}

+ 71 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/FilesVO.java

@@ -0,0 +1,71 @@
+package cn.cslg.report.common.model.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 文件信息
+ *
+ * @Author xiexiang
+ * @Date 2023/4/3
+ */
+@Accessors(chain = true)
+@Data
+public class FilesVO {
+    /**
+     * 附件id
+     */
+    private Integer fileId;
+
+    /**
+     * 附件名称
+     */
+    private String name;
+
+    /**
+     * 附件地址
+     */
+    private String url;
+
+    /**
+     * 专题库id
+     */
+    private Integer zId;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 上传时间
+     */
+    private Date updateTime;
+
+    /**
+     * 上传人
+     */
+    private Integer uId;
+
+    /**
+     * 类型
+     */
+    private String type;
+
+    /**
+     * 大小
+     */
+    private Integer size;
+
+    /**
+     * 后缀
+     */
+    private String suffix;
+
+    /**
+     * 文件名
+     */
+    private String fileName;
+}

+ 98 - 0
RMS/src/main/java/cn/cslg/report/common/model/vo/FollowUpVO.java

@@ -0,0 +1,98 @@
+package cn.cslg.report.common.model.vo;
+
+import cn.hutool.core.date.DateTime;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 根据报告id查询返回的后续事项数据
+ *
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+@Accessors(chain = true)
+@Data
+public class FollowUpVO {
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+
+    /**
+     * 父id
+     */
+    private Integer parentId;
+
+    /**
+     * 后续事项名称
+     */
+    private String followUpName;
+
+    /**
+     * 描述
+     */
+    private String remark;
+
+    /**
+     * 期限
+     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date timeLimit;
+
+    /**
+     * 处理人
+     */
+    private String agent;
+
+    /**
+     * 协办人
+     */
+    private String assistPerson;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 结论
+     */
+    private String conclusion;
+
+    /**
+     * 创建人id
+     */
+    private Integer createPersonId;
+
+    /**
+     * 创建人名称
+     */
+    private String createPersonName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 文件信息
+     */
+    private List<FilesVO> filesVOs;
+
+}

+ 97 - 0
RMS/src/main/java/cn/cslg/report/controller/FollowUpController.java

@@ -0,0 +1,97 @@
+package cn.cslg.report.controller;
+
+import cn.cslg.report.common.core.base.Constants;
+import cn.cslg.report.common.model.PageHelperT;
+import cn.cslg.report.common.model.QueryFUEntity;
+import cn.cslg.report.common.model.dto.FollowUpDTO;
+import cn.cslg.report.common.model.dto.FollowUpUpdateDTO;
+import cn.cslg.report.common.model.dto.RegisterDTO;
+import cn.cslg.report.common.model.vo.FollowUpVO;
+import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.entity.Report;
+import cn.cslg.report.mapper.FollowUpMapper;
+import cn.cslg.report.service.IFollowUpService;
+import com.alibaba.fastjson.JSONObject;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * 后续事项的Controller层
+ *
+ * @Author xiexiang
+ * @Date 2023/4/2
+ */
+@Tag(name = "后续事项模块")
+@Slf4j
+@RestController
+@RequiredArgsConstructor
+@RequestMapping(Constants.REPORT_API + "/followUps")
+public class FollowUpController {
+    private final IFollowUpService followUpService;
+    private final FollowUpMapper followUpMapper;
+
+
+    @Operation(summary = "新增后续事项")
+    @PostMapping("/add")
+    public String add(@RequestBody List<FollowUpDTO> followUps) {
+        if (followUps == null) {
+            return Response.error("请求参数为null");
+        } else {
+            log.info("开始处理【新增后续事项】的请求,请求参数为:{}", followUps);
+            followUpService.add(followUps);
+            return Response.success("新增后续事项完成");
+        }
+    }
+
+    @Operation(summary = "修改后续事项")
+    @PostMapping("/update")
+    public String update(@RequestBody List<FollowUpUpdateDTO> followUpUpdateDTOList) {
+        if (followUpUpdateDTOList == null) {
+            return Response.error("请求参数为null");
+        } else {
+            log.info("开始处理【修改后续事项】的请求,请求参数为:{}", followUpUpdateDTOList);
+            followUpService.update(followUpUpdateDTOList);
+            return Response.success("修改后续事项完成");
+        }
+    }
+    @Operation(summary = "根据报告id查询后续事项数据信息")
+    @PostMapping("/query")
+    public String query(@RequestBody QueryFUEntity queryFUEntity){
+        List<FollowUpVO> queryResult = followUpService.findAllByPage(queryFUEntity);
+        PageHelperT pageHelperT = new PageHelperT();
+        pageHelperT.setList(queryResult);
+        pageHelperT.setCurrent(queryFUEntity.getCurrent());
+        pageHelperT.setSize(queryFUEntity.getSize());
+        pageHelperT.setTotal(followUpMapper.countByReportId(queryFUEntity.getReportId()));
+        return Response.success(pageHelperT);
+    }
+
+    @Operation(summary = "根据ids删除后续事项数据信息")
+    @PostMapping("/delete")
+    public String delete(@RequestBody List<Integer> ids) {
+        log.info("开始处理【删除后续事项】的请求,请求参数为:{}", ids);
+        if (ids != null) {
+            followUpService.delete(ids);
+            return Response.success("删除后续事项完成");
+        }
+        return Response.error("请求参数为null");
+    }
+
+    @Operation(summary = "登记结果")
+    @PostMapping("/register")
+    public String register(String register, List<MultipartFile> files) throws ParseException {
+        if (register != null) {
+            RegisterDTO register1 = JSONObject.parseObject(register, RegisterDTO.class);
+            followUpService.register(register1, files);
+            return Response.success("登记结果成功");
+        }
+        return Response.error();
+    }
+}

+ 34 - 0
RMS/src/main/java/cn/cslg/report/entity/AssoFollowUpFile.java

@@ -0,0 +1,34 @@
+package cn.cslg.report.entity;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * 后续事项和文件关联表的实体类
+ *
+ * @Author TseSean
+ * @Data 2023/04/03
+ */
+@Accessors(chain = true)
+@Data
+public class AssoFollowUpFile implements Serializable {
+    /**
+     * 主键ID
+     */
+    private Integer id;
+    /**
+     * 后续事项ID
+     */
+    private Integer followUpId;
+    /**
+     * 文件ID
+     */
+    private Integer fileId;
+    /**
+     * 文件使用类型 0=什么类型, 1=什么类型, 2=什么类型
+     */
+    private Integer fileType;
+
+}

+ 86 - 0
RMS/src/main/java/cn/cslg/report/entity/FollowUp.java

@@ -0,0 +1,86 @@
+package cn.cslg.report.entity;
+
+import cn.hutool.core.date.DateTime;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/3/31
+ */
+@Accessors(chain = true)
+@Data
+public class FollowUp {
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 报告id
+     */
+    private Integer reportId;
+
+    /**
+     * 父id
+     */
+    private Integer parentId;
+
+    /**
+     * 后续事项名称
+     */
+    private String followUpName;
+
+    /**
+     * 描述
+     */
+    private String remark;
+
+    /**
+     * 期限
+     */
+    private Date timeLimit;
+
+    /**
+     * 处理人
+     */
+    private String agent;
+
+    /**
+     * 协办人
+     */
+    private String assistPerson;
+
+    /**
+     * 完成时间
+     */
+    private Date finishTime;
+
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 结论
+     */
+    private String conclusion;
+
+    /**
+     * 创建人id
+     */
+    private Integer createPersonId;
+
+    /**
+     * 创建人名称
+     */
+    private String createPersonName;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+}

+ 68 - 0
RMS/src/main/java/cn/cslg/report/mapper/FollowUpMapper.java

@@ -0,0 +1,68 @@
+package cn.cslg.report.mapper;
+
+import cn.cslg.report.common.model.vo.FollowUpVO;
+import cn.cslg.report.entity.AssoFollowUpFile;
+import cn.cslg.report.entity.FollowUp;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 后续事项的Mapper层接口
+ *
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+@Repository
+public interface FollowUpMapper {
+    /**
+     * 插入数据
+     *
+     * @param followUp 后续事项数据对象
+     * @return 返回受影响的行数
+     */
+    int add(FollowUp followUp);
+
+    /**
+     * 根据id修改数据
+     *
+     * @param followUp 后续事项数据对象
+     * @return 返回受影响的行数
+     */
+    int update(FollowUp followUp);
+
+
+
+    /**
+     * 根据报告id查询后续事项
+     *
+     * @param reportId 报告id
+     * @return 返回查询到的数据
+     */
+    List<FollowUpVO> query(Integer reportId);
+
+    /**
+     * 统计该报告id查询记录的数量
+     *
+     * @param reportId 报告id
+     * @return 返回统计到的总数量total
+     */
+    int countByReportId(Integer reportId);
+
+    /**
+     * 根据ids删除数据
+     *
+     * @param ids 后续事项ids
+     * @return 返回受影响的行数
+     */
+    int delete(List<Integer> ids);
+
+    /**
+     * 插入后续事项id和附件id关联表
+     *
+     * @param assoFollowUpFile
+     */
+    int addAssoIds(AssoFollowUpFile assoFollowUpFile);
+
+}

+ 76 - 0
RMS/src/main/java/cn/cslg/report/service/IFollowUpService.java

@@ -0,0 +1,76 @@
+package cn.cslg.report.service;
+
+import cn.cslg.report.common.model.QueryFUEntity;
+import cn.cslg.report.common.model.dto.FollowUpDTO;
+import cn.cslg.report.common.model.dto.FollowUpUpdateDTO;
+import cn.cslg.report.common.model.dto.RegisterDTO;
+import cn.cslg.report.common.model.vo.FollowUpVO;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.text.ParseException;
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+public interface IFollowUpService {
+    /**
+     * 新增后续事项
+     *
+     * @param followUps 新增后续事项的前端传输DTO数据对象
+     */
+    @Transactional
+    void add(List<FollowUpDTO> followUps);
+
+    /**
+     * 修改后续事项
+     *
+     * @param followUpUpdateDTOList 修改后续事项的前端传输DTO数据对象
+     */
+    @Transactional
+    void update(List<FollowUpUpdateDTO> followUpUpdateDTOList);
+
+    /**
+     * 根据报告id分页查询查询后续事项数据
+     *
+     * @param reportId 报告id
+     * @return 返回查询到的数据
+     */
+    List<FollowUpVO> query(Integer reportId);
+
+    /**
+     * 分页查询
+     */
+    List<FollowUpVO> findAllByPage(QueryFUEntity queryFUEntity);
+
+    /**
+     * 根据ids删除许可记录数据
+     *
+     * @param ids
+     */
+    @Transactional
+    void delete(List<Integer> ids);
+
+    /**
+     * 登记结果
+     *
+     * @param register
+     * @param files
+     */
+    @Transactional
+    void register(RegisterDTO register, List<MultipartFile> files) throws ParseException;
+
+    /**
+     * 上传关联后续事项id和附件ids
+     *
+     * @param followUpId
+     * @param fileIds
+     * @return
+     */
+    @Transactional
+    String addAsso(Integer followUpId, List<Integer> fileIds);
+
+}

+ 1 - 0
RMS/src/main/java/cn/cslg/report/service/impl/AssoProductFileServiceImpl.java

@@ -28,6 +28,7 @@ public class AssoProductFileServiceImpl implements IAssoProductFileService {
      * @param productId 产品id
      * @param fileIds   附件id集合
      */
+
     @Override
     public void addAsso(Integer productId, List<Integer> fileIds) {
         List<AssoProductFile> list = new ArrayList<>();

+ 197 - 0
RMS/src/main/java/cn/cslg/report/service/impl/FollowUpServiceImpl.java

@@ -0,0 +1,197 @@
+package cn.cslg.report.service.impl;
+
+import cn.cslg.report.common.model.QueryFUEntity;
+import cn.cslg.report.common.model.dto.FollowUpDTO;
+import cn.cslg.report.common.model.dto.FollowUpUpdateDTO;
+import cn.cslg.report.common.model.dto.RegisterDTO;
+import cn.cslg.report.common.model.vo.FilesVO;
+import cn.cslg.report.common.model.vo.FollowUpVO;
+import cn.cslg.report.common.model.vo.PersonnelVO;
+import cn.cslg.report.common.utils.CacheUtils;
+import cn.cslg.report.common.utils.Response;
+import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
+import cn.cslg.report.entity.AssoFollowUpFile;
+import cn.cslg.report.entity.FollowUp;
+import cn.cslg.report.exception.XiaoShiException;
+import cn.cslg.report.mapper.FollowUpMapper;
+import cn.cslg.report.service.IFollowUpService;
+import cn.cslg.report.service.business.ReportFileService;
+import com.github.pagehelper.PageHelper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 后续事项的Service层实现类
+ * @Author xiexiang
+ * @Date 2023/4/1
+ */
+@Slf4j
+@Service
+@RequiredArgsConstructor
+public class FollowUpServiceImpl implements IFollowUpService {
+    private final FollowUpMapper followUpMapper;
+    private final ReportFileService reportFileService;
+    private final CacheUtils cacheUtils;
+    private final LoginUtils loginUtils;
+
+    /**
+     * 新增后续事项
+     *
+     * @param followUps 新增后续事项的前端传输DTO数据对象
+     */
+    @Override
+    public void add(List<FollowUpDTO> followUps) {
+        log.info("开始处理【新增后续事项】的业务,参数为:{}", followUps);
+        FollowUp followUp = new FollowUp();
+        //判断传入列表不为空
+        if (followUps != null && followUps.size() > 0 ) {
+            //遍历传入列表
+            for (int i = 0; i < followUps.size(); i++) {
+                //DTO赋值给后续事项表实体类
+                FollowUpDTO followUpDTO = followUps.get(i);
+                followUpDTO.setStatus("进行中");
+                BeanUtils.copyProperties(followUpDTO, followUp);
+                //获取当前登陆人信息
+                PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+                //给实体类赋值登陆人id和姓名
+                followUp.setCreatePersonId(personnelVO.getId());
+                followUp.setCreatePersonName(personnelVO.getName());
+                //数据入表
+                log.info("数据入表");
+                int rows = followUpMapper.add(followUp);
+                if (rows != 1) {
+                    String message = "新增后续事项第" + i + "条失败";
+                    log.info("数据入后续事项表失败,{}", message);
+                    throw new XiaoShiException(message);
+                }
+            }log.info("新增后续事项完成");
+        }
+    }
+
+    /**
+     * 修改后续事项
+     *
+     * @param followUpUpdateDTOList 修改后续事项的前端传输DTO数据对象
+     */
+    @Override
+    public void update(List<FollowUpUpdateDTO> followUpUpdateDTOList){
+        log.info("开始处理【修改后续事项】的业务,参数为:{}", followUpUpdateDTOList);
+        //DTO赋值给后续事项表实体类
+        FollowUp followUp = new FollowUp();
+        if (followUpUpdateDTOList.size() > 0 && followUpUpdateDTOList != null) {
+            //遍历传入列表
+            for (int i = 0; i < followUpUpdateDTOList.size(); i++) {
+                FollowUpUpdateDTO followUpUpdateDTO = followUpUpdateDTOList.get(i);
+                BeanUtils.copyProperties(followUpUpdateDTO, followUp);
+                //根据id修改后续事项表数据
+                log.info("修改后续事项表数据");
+                int rows = followUpMapper.update(followUp);
+                if (rows != 1) {
+                    String message = "第" + i + "条失败";
+                    log.info("修改后续事项表数据失败,{}", message);
+                }
+            }log.info("修改后续事项完成");
+        }
+    }
+
+    @Override
+    public List<FollowUpVO> query(Integer reportId) {
+        return followUpMapper.query(reportId);
+    }
+
+    /**
+     * 根据报告id查询
+     *
+     * @param queryFUEntity
+     */
+    @Override
+    public List<FollowUpVO> findAllByPage(QueryFUEntity queryFUEntity){
+        PageHelper.startPage(queryFUEntity.getCurrent(), queryFUEntity.getSize());
+        List<FollowUpVO> followUpVOS = followUpMapper.query(queryFUEntity.getReportId());
+        return followUpVOS;
+    }
+
+    /**
+     * 根据ids删除许可记录数据
+     *
+     * @param ids
+     */
+    @Override
+    public void delete(List<Integer> ids) {
+        log.info("开始处理【删除许可记录】的业务,参数为:{}", ids);
+        if (ids != null) {
+            followUpMapper.delete(ids);
+            log.info("产品删除完成");
+        } else {
+            log.info("删除产品失败,产品不存在");
+        }
+    }
+
+    /**
+     * 登记结果
+     *
+     * @param register
+     * @param files
+     */
+    @Override
+    public void register(RegisterDTO register, List<MultipartFile> files) throws ParseException {
+        //获取当前时间
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
+        String date = dateFormat.format(new Date());//date为当前时间 是String类型的时间
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Date finishTime = simpleDateFormat.parse(date);//转换为Date类型
+        System.out.println("等级结果当前完成时间"+ finishTime);
+        FollowUp followUp = new FollowUp();
+        //从registerDTO中取出后续事项id进行对应的操作
+        followUp.setId(register.getFollowUpId());
+        followUp.setStatus("已完成");
+        followUp.setConclusion(register.getConclusion());
+        followUp.setFinishTime(finishTime);
+        //更新操作 将conclusion更新进入表
+        int rows = followUpMapper.update(followUp);
+        if (rows != 1) {
+            String message = "登记结果失败,服务器忙请稍后再试";
+            log.info("登记结果失败,{}", message);
+        }
+        log.info("登记结果完成");
+        //上传附件 进行关联绑定
+        if (files != null && files.size() != 0) {
+            //将文档上传并返回文件入库的Id
+            List<Integer> fileIds = reportFileService.uploadFiles(files);
+            this.addAsso(register.getFollowUpId(), fileIds);
+        }
+        //批量新增后续事项
+        this.add(register.getFollowUps());
+    }
+
+    /**
+     * @param followUpId 后续事项id
+     * @param fileIds  文件id
+     * @return
+     * @function 上传后续事项与文件关联表 对应实体AssoFollowUpFile 0代表上传文件为附件
+     */
+    public String addAsso(Integer followUpId, List<Integer> fileIds) {
+        for(int i = 0; i < fileIds.size(); i++){
+            Integer fileId = fileIds.get(i);
+            AssoFollowUpFile assoFollowUpFile = new AssoFollowUpFile();
+            assoFollowUpFile.setFollowUpId(followUpId);
+            assoFollowUpFile.setFileId(fileId);
+            assoFollowUpFile.setFileType(0);
+            int rows = followUpMapper.addAssoIds(assoFollowUpFile);
+            if(rows != 1){
+                String message = "第" + i + "条失败";
+                log.info("新增后续事项和附件id关联表数据失败,{}", message);
+            }
+        }log.info("新增后续事项和附件id关联表完成");
+        return Response.success();
+    }
+}

+ 136 - 0
RMS/src/main/resources/mapper/FollowUpMapper.xml

@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<mapper namespace="cn.cslg.report.mapper.FollowUpMapper">
+    <!--插入数据-->
+    <!--int add(FollowUp followUp);-->
+    <insert id="add" useGeneratedKeys="true" keyProperty="id">
+        insert into follow_up(report_id, parent_id, follow_up_name, remark, time_limit,
+                              agent, assist_person, finish_time, status, conclusion, create_person_id,
+                              create_person_name)
+        values
+               (#{reportId}, #{parentId}, #{followUpName}, #{remark},
+                #{timeLimit}, #{agent}, #{assistPerson}, #{finishTime}, #{status},
+                #{conclusion}, #{createPersonId}, #{createPersonName})
+    </insert>
+    <!--根据id修改数据-->
+    <!--int update(FollowUp followUp);-->
+    <update id="update">
+        update follow_up
+        <set>
+            <if test="followUpName != null">
+                follow_up_name = #{followUpName},
+            </if>
+            <if test="remark != null">
+                remark = #{remark},
+            </if>
+            <if test="timeLimit != null">
+                time_limit = #{timeLimit},
+            </if>
+            <if test="agent != null">
+                agent = #{agent},
+            </if>
+            <if test="assistPerson != null">
+                assist_person = #{assistPerson},
+            </if>
+            <if test="finishTime != null">
+                finish_time = #{finishTime},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="conclusion != null">
+                conclusion = #{conclusion},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--根据报告id查询后续事项-->
+    <!--List<FollowUpVO> query(Integer reportId);-->
+    <resultMap id="queryMap" type="cn.cslg.report.common.model.vo.FollowUpVO">
+        <id column="id" property="id"/>
+        <result column="report_id" property="reportId"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="follow_up_name" property="followUpName"/>
+        <result column="remark" property="remark"/>
+        <result column="time_limit" property="timeLimit"/>
+        <result column="agent" property="agent"/>
+        <result column="assist_person" property="assistPerson"/>
+        <result column="finish_time" property="finishTime"/>
+        <result column="status" property="status"/>
+        <result column="conclusion" property="conclusion"/>
+        <result column="create_person_id" property="createPersonId"/>
+        <result column="create_person_name" property="createPersonName"/>
+        <result column="create_time" property="createTime"/>
+        <collection property="filesVOs" resultMap="FilesVOsResultMap"/>
+    </resultMap>
+    <resultMap id="FilesVOsResultMap" type="cn.cslg.report.common.model.vo.FilesVO">
+        <result column="file_id" property="fileId"/>
+        <result column="name" property="name"/>
+        <result column="address" property="url"/>
+        <result column="ZID" property="zId"/>
+        <result column="FILEREMARK" property="remark"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="UID" property="uId"/>
+        <result column="type" property="type"/>
+        <result column="suffix" property="suffix"/>
+        <result column="file_name" property="fileName"/>
+    </resultMap>
+
+<!--    <select id="query" resultMap="queryMap">-->
+<!--        select id,-->
+<!--               report_id,-->
+<!--               parent_id,-->
+<!--               follow_up_name,-->
+<!--               remark,-->
+<!--               time_limit,-->
+<!--               agent,-->
+<!--               assist_person,-->
+<!--               finish_time,-->
+<!--               status,-->
+<!--               conclusion,-->
+<!--               create_person_id,-->
+<!--               create_person_name,-->
+<!--               create_time-->
+<!--        from follow_up-->
+<!--        where report_id = #{reportId}-->
+<!--    </select>-->
+
+    <select id="query" resultMap="queryMap">
+        select a.id, a.report_id, a.parent_id, a.follow_up_name,a.remark,a.time_limit,a.agent,a.assist_person,a.finish_time,a.status, a.conclusion,
+               a.create_person_id, a.create_person_name, a.create_time, d.FILE_ID, d.NAME, d.ADDRESS, d.ZID,d.FILEREMARK, d.UPDATE_TIME, d.UID,d.TYPE, d.SIZE, d.SUFFIX, d.FILE_NAME
+        from follow_up a left JOIN (SELECT b.follow_up_id, b.FILE_ID, c.ID, c.NAME, c.ADDRESS, c.ZID, c.REMARK AS FILEREMARK, c.UPDATE_TIME, c.UID, c.TYPE, c.SIZE, c.SUFFIX, c.FILE_NAME
+                                    FROM asso_follow_up_file b LEFT JOIN report_file c ON b.FILE_ID = c.ID) d
+                                   ON a.ID = d.FOLLOW_UP_ID
+        WHERE a.report_id = #{reportId}
+    </select>
+
+    <!--根据报告id统计后续事项数量-->
+    <!--int countByReportId();-->
+    <select id="countByReportId" resultType="int">
+        select count(*)
+        from follow_up
+        where report_id = #{reportId}
+    </select>
+
+    <!--根据ids删除数据-->
+    <!--int delete(List<Integer> ids);-->
+    <delete id="delete" parameterType="java.util.List">
+        delete
+        from follow_up
+        where id in
+        <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+
+    <!--插入数据-->
+    <!--int addAssoIds(List<AssoFollowUpFile> assoFollowUpFiles);-->
+    <insert id="addAssoIds" useGeneratedKeys="true" keyProperty="id">
+        insert into asso_follow_up_file(follow_up_id, file_id, file_type)
+        values
+            (#{followUpId}, #{fileId}, #{fileType})
+    </insert>
+
+</mapper>