xiexiang 2 tahun lalu
induk
melakukan
7f8eb564e7

+ 4 - 0
RMS/src/main/java/cn/cslg/report/common/model/dto/invalidReReport/InvalidProcessDTO.java

@@ -11,6 +11,10 @@ import java.util.List;
 @Data
 public class InvalidProcessDTO {
     /**
+     * 自增唯一证据id
+     */
+    private Integer id;
+    /**
      * 报告id
      */
     private Integer reportId;

+ 13 - 5
RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/InvalidProcessController.java

@@ -32,15 +32,23 @@ public class InvalidProcessController {
     @Operation(summary = "添加无效事务")
     @PostMapping("/add")
     public String add(@RequestBody String invalidProcessStr, MultipartFile file) {
-        Integer flag = invalidProcessService.addInvalidProcess(invalidProcessStr,file);
-        return Response.success(flag);
+        if (invalidProcessStr != null && invalidProcessStr != "") {
+            invalidProcessService.addInvalidProcess(invalidProcessStr, file);
+            return Response.success("添加成功");
+        } else {
+            return Response.error("添加失败");
+        }
     }
 
     @Operation(summary = "删除无效事务")
     @PostMapping("/delete")
-    public String delete(int id) {
-        invalidProcessService.removeInvalidProcess(id);
-        return Response.success();
+    public String delete(Integer id) {
+        if(id != null && id > 0) {
+            invalidProcessService.removeInvalidProcess(id);
+            return Response.success("删除成功");
+        } else {
+            return Response.error("删除失败");
+        }
     }
 
     @Operation(summary = "修改无效事务")

+ 23 - 10
RMS/src/main/java/cn/cslg/report/controller/InvalidReReport/ProofDetailController.java

@@ -25,30 +25,43 @@ public class ProofDetailController {
     @Operation(summary = "添加证据详情")
     @PostMapping("/addProofDetail")
     public String addProofDetail(@RequestBody ProofDetailDTO proofDetailDTO) throws IOException {
-        proofDetailService.addProofDetail(proofDetailDTO);
-        return Response.success();
+        if(proofDetailDTO != null){
+            proofDetailService.addProofDetail(proofDetailDTO);
+            return Response.success("添加成功");
+        } else {
+            return Response.error("添加失败");
+        }
     }
 
     @Operation(summary = "删除证据详情")
     @PostMapping("/deleteProofDetail")
     public String deleteProofDetail(@RequestBody List<Integer> ids) throws IOException {
-        proofDetailService.deleteProofDetail(ids);
-        return Response.success();
+        if(ids != null && ids.size() != 0){
+            proofDetailService.deleteProofDetail(ids);
+            return Response.success("删除成功");
+        } else {
+            return Response.error("删除失败");
+        }
     }
 
     @Operation(summary = "修改证据详情")
     @PostMapping("/updateProofDetail")
     public String updateProofDetail(@RequestBody ProofDetailDTO proofDetailDTO) throws IOException {
-        proofDetailService.updateProofDetail(proofDetailDTO);
-        //根据Dto的id查询出对应的证据
-        //更新证据的信息
-        return Response.success();
+        if(proofDetailDTO != null){
+            proofDetailService.updateProofDetail(proofDetailDTO);
+            return Response.success("更新成功");
+        } else {
+            return Response.error("更新失败");
+        }
     }
 
     @Operation(summary = "查找证据详情")
     @GetMapping("/queryProofDetail")
     public String queryProofDetail(Integer proofId) throws IOException {
-        proofDetailService.queryProofDetail(proofId);
-        return Response.success();
+        if(proofId != null && proofId > 0) {
+            return Response.success(proofDetailService.queryProofDetail(proofId));
+        } else {
+            return Response.error("查找失败");
+        }
     }
 }

+ 6 - 7
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/InvalidProcessService.java

@@ -43,7 +43,7 @@ public class InvalidProcessService extends ServiceImpl<InvalidProcessMapper, Inv
      * @param file
      * @return
      */
-    public Integer addInvalidProcess(String invalidProcessStr, MultipartFile file) {
+    public void addInvalidProcess(String invalidProcessStr, MultipartFile file) {
         InvalidProcessDTO invalidProcessDTO = JSONObject.parseObject(invalidProcessStr, InvalidProcessDTO.class);
         //判断无效事务时间是否为空,无论是文件类型或者口审类型都要时间
         if(invalidProcessDTO.getOccuredTime() != null) {
@@ -85,7 +85,6 @@ public class InvalidProcessService extends ServiceImpl<InvalidProcessMapper, Inv
                     //口审记录id
                     invalidProcess.setOralExamId(oralExam.getId());
                     invalidProcess.insert();
-                    return 1;
                 } else {
                     throw new XiaoShiException("参与人,地点不能为空");
                 }
@@ -99,7 +98,6 @@ public class InvalidProcessService extends ServiceImpl<InvalidProcessMapper, Inv
                 invalidProcess.setFileId(fileId);
                 invalidProcess.setProcessType(invalidProcessDTO.getProcessType());
                 invalidProcess.insert();
-                return 1;
             } else {
                 throw new XiaoShiException("流程类型错误,不存在该类型!");
             }
@@ -142,8 +140,8 @@ public class InvalidProcessService extends ServiceImpl<InvalidProcessMapper, Inv
             //判断无效事务的类型
             //获取当前登陆人信息
             PersonnelVO pVO = cacheUtils.getLoginUser(loginUtils.getId());
-            //添加无效事务
-            InvalidProcess invalidProcess = new InvalidProcess();
+            //无效事务需要先查出来
+            InvalidProcess invalidProcess = this.getById(iPDTO.getId());
             invalidProcess.setReportId(iPDTO.getReportId());
             invalidProcess.setOccuredTime(iPDTO.getOccuredTime());
             invalidProcess.setCreateId(pVO.getId());
@@ -159,14 +157,15 @@ public class InvalidProcessService extends ServiceImpl<InvalidProcessMapper, Inv
                 //口审记录要判断 参与人,地点是否为空
                 if(iPDTO.getAddress() != null && iPDTO.getAddress() != "" && iPDTO.getParticipants() != null && iPDTO.getParticipants() != ""){
                     //若是口审记录则添加口审记录接着添加无效事务
-                    //添加口审记录
-                    OralExam oralExam = new OralExam();
+                    //口审记录也需要先查出来
+                    OralExam oralExam = oralExamService.getById(invalidProcess.getOralExamId());
                     //地点
                     oralExam.setAddress(iPDTO.getAddress());
                     //参与人
                     oralExam.setParticipants(iPDTO.getParticipants());
                     //创建人
                     oralExam.setCreateId(pVO.getId());
+//                    oralExam.setCreateId(1);
                     oralExam.updateById();
                     //流程类型
                     invalidProcess.setProcessType(iPDTO.getProcessType());

+ 63 - 25
RMS/src/main/java/cn/cslg/report/service/business/InvalidReReport/ProofDetailService.java

@@ -1,9 +1,13 @@
 package cn.cslg.report.service.business.InvalidReReport;
 
 import cn.cslg.report.common.model.dto.invalidReReport.ProofDetailDTO;
+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.Template;
 import cn.cslg.report.entity.invalidReReport.ProofDetail;
+import cn.cslg.report.exception.XiaoShiException;
 import cn.cslg.report.mapper.InvalidReReport.ProofDetailMapper;
 import cn.cslg.report.mapper.TemplateMapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -12,6 +16,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
@@ -22,38 +27,71 @@ import java.util.List;
 @Slf4j
 @RequiredArgsConstructor(onConstructor_ = {@Lazy})
 public class ProofDetailService extends ServiceImpl<ProofDetailMapper,ProofDetail> {
-   //添加证据详情
-    public String addProofDetail(ProofDetailDTO proofDetailDTO) {
+    private final CacheUtils cacheUtils;
+    private final LoginUtils loginUtils;
+
+    /**
+     * 添加证据详情
+     * @param proofDetailDTO
+     */
+    public void addProofDetail(ProofDetailDTO proofDetailDTO) {
         //检查证据id,权要id,特征id是否为null
-    //将DTO里的属性装载到ProofDetail里并插入
-    return "";
+        if(proofDetailDTO.getProofId() != null && proofDetailDTO.getRightId() != null && proofDetailDTO.getFeatureId() != null){
+            //将DTO里的属性装载到ProofDetail里并插入
+            ProofDetail proofDetail = new ProofDetail();
+            BeanUtils.copyProperties(proofDetailDTO, proofDetail);
+            //获取当前登录人信息
+            PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            proofDetail.setCreateId(personnelVO.getId());
+            proofDetail.insert();
+        } else {
+            throw new XiaoShiException("传入数据不可为空");
+        }
     }
 
-    //批量删除证据详情
-    public String deleteProofDetail(List<Integer> ids) {
-
-          //检测ids是否为null或size=0
-        //根据ids批量删除
-
-        return  "";
+    /**
+     * 批量删除证据详情
+     * @param ids
+     */
+    public void deleteProofDetail(List<Integer> ids) {
+        //检测ids是否为null或size=0
+        if(ids != null && ids.size() != 0){
+            this.removeByIds(ids);
+        } else {
+            throw new XiaoShiException("删除错误");
+        }
     }
 
-    //更新证据详情
-    public String updateProofDetail(ProofDetailDTO proofDetailDTO) {
+    /**
+     * 更新证据详情
+     * @param proofDetailDTO
+     */
+    public void updateProofDetail(ProofDetailDTO proofDetailDTO) {
         //检查证据id,权要id,特征id是否为null
-        //将DTO里的属性装载到ProofDetail里并插入
-
-        return Response.success();
-
+        if(proofDetailDTO.getProofId() != null && proofDetailDTO.getRightId() != null && proofDetailDTO.getFeatureId() != null){
+            //将DTO里的属性装载到ProofDetail里并插入
+            //查出该条数据
+            ProofDetail proofDetail = this.getById(proofDetailDTO.getId());
+            BeanUtils.copyProperties(proofDetailDTO, proofDetail);
+            //获取当前登录人信息
+            PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
+            proofDetail.setCreateId(personnelVO.getId());
+            proofDetail.updateById();
+        } else {
+            throw new XiaoShiException("传入数据值不可为空");
+        }
     }
 
-
-    //查询证据详情
-    public String queryProofDetail(int proofId) {
-        //若proofId 为null 或<=0,返回
-    //根据证据id查询证据详情
-
-        return Response.success();
-
+    /**
+     * 查询证据详情
+     * @param proofId
+     * @return
+     */
+    public List<ProofDetail> queryProofDetail(Integer proofId) {
+        //根据证据id查询证据详情
+        LambdaQueryWrapper<ProofDetail> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(ProofDetail::getProofId, proofId);
+        List<ProofDetail> proofDetails = this.list(queryWrapper);
+        return proofDetails;
     }
 }