wangming 11 місяців тому
батько
коміт
ec3834dd2b

+ 54 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxProjectRectifyDao.java

@@ -15,6 +15,58 @@ import org.apache.ibatis.annotations.Delete;
  */
 public interface ZhcxProjectRectifyDao extends BaseMapper<ZhcxProjectRectifyDo> {
 
-    @Delete("delete from ZHCX_PROJECT_RECTIFY where PRJID = #{prjid}")
-    void deleteByProjectId(ZhcxProjectRectifyMachineDo machineDo);
+    @Delete("delete from ZHCX_PROJECT_RECTIFY where BATCHID = #{batchid}")
+    void deleteByBatchId(ZhcxProjectRectifyMachineDo machineDo);
+
+    @Insert("<script>" +
+            "   INSERT INTO ZHCX_PROJECT_RECTIFY (ID,\n" +
+                "DELETED,\n" +
+                "CREATEDATE,\n" +
+                "CREATEUSERID,\n" +
+                "MODIFYDATE,\n" +
+                "MODIFYUSERID,\n" +
+                "CREATEUSERNAME,\n" +
+                "MODIFYUSERNAME,\n" +
+                "PRJID,\n" +
+                "PRJCODE,\n" +
+                "PRJNAME,\n" +
+                "SEQSORT,\n" +
+                "SUPERVISORCODE,\n" +
+                "ARCPOSITION,\n" +
+                "ARCCONTENT,\n" +
+                "MAINSTATUS,\n" +
+                "REQDATE,\n" +
+                "REQUSER,\n" +
+                "RECTIFYDATE,\n" +
+                "REMARK1,\n" +
+                "REMARK2,\n" +
+                "MACHINENO)" +
+            "    VALUES\n" +
+            "    <foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\">\n" +
+            "        (#{item.id},\n" +
+                    "#{item.deleted},\n" +
+                    "#{item.createdate},\n" +
+                    "#{item.createuserid},\n" +
+                    "#{item.modifydate},\n" +
+                    "#{item.modifyuserid},\n" +
+                    "#{item.createusername},\n" +
+                    "#{item.modifyusername},\n" +
+                    "#{item.prjid},\n" +
+                    "#{item.prjcode},\n" +
+                    "#{item.prjname},\n" +
+                    "#{item.seqsort},\n" +
+                    "#{item.supervisorcode},\n" +
+                    "#{item.arcposition},\n" +
+                    "#{item.arccontent},\n" +
+                    "#{item.mainstatus},\n" +
+                    "#{item.reqdate},\n" +
+                    "#{item.requser},\n" +
+                    "#{item.rectifydate},\n" +
+                    "#{item.remark1},\n" +
+                    "#{item.remark2},\n" +
+                    "#{item.machineno})\n" +
+            "    </foreach>" +
+            "</script>")
+    void insertBatch(@Param("list") List<ZhcxProjectRectifyDo> rectifyList);
+
 }

+ 61 - 2
business-common/src/main/java/com/rongwei/bscommon/sys/dao/ZhcxProjectRectifyMachineDao.java

@@ -14,6 +14,65 @@ import org.apache.ibatis.annotations.Delete;
  */
 public interface ZhcxProjectRectifyMachineDao extends BaseMapper<ZhcxProjectRectifyMachineDo> {
 
-    @Delete("delete from ZHCX_PROJECT_RECTIFY_MACHINE where PRJID = #{prjid}")
-    void deleteByProjectId(ZhcxProjectRectifyMachineDo machineDo);
+    @Delete("delete from ZHCX_PROJECT_RECTIFY_MACHINE where BATCHID = #{batchid}")
+    void deleteByBatchId(ZhcxProjectRectifyMachineDo machineDo);
+
+    @Insert("<script>" +
+            "   INSERT INTO ZHCX_PROJECT_RECTIFY_MACHINE (ID ,\n" +
+                "DELETED,\n" +
+                "REMARK,\n" +
+                "CREATEDATE,\n" +
+                "CREATEUSERID,\n" +
+                "MODIFYDATE,\n" +
+                "MODIFYUSERID,\n" +
+                "CREATEUSERNAME,\n" +
+                "MODIFYUSERNAME,\n" +
+                "PRJID,\n" +
+                "RECTIFYID,\n" +
+                "DEPTID,\n" +
+                "DEPTNAME,\n" +
+                "DUTYDEPTID,\n" +
+                "DUTYDEPTNAME,\n" +
+                "FINISHDATE,\n" +
+                "REMARK1,\n" +
+                "REMARK2,\n" +
+                "FIRSTDEPTID,\n" +
+                "FIRSTDEPTNAME,\n" +
+                "STATUS,\n" +
+                "MACHINENO,\n" +
+                "MACHINEID,\n" +
+                "FIRSTDUTYDEPTID,\n" +
+                "FIRSTDUTYDEPTNAME,\n" +
+                "BATCHID)\n" +
+            "   VALUES\n" +
+            "    <foreach collection=\"list\" item=\"item\" index=\"index\" separator=\",\">\n" +
+            "        (#{item.id},\n" +
+                    "#{item.deleted},\n" +
+                    "#{item.remark},\n" +
+                    "#{item.createdate},\n" +
+                    "#{item.createuserid},\n" +
+                    "#{item.modifydate},\n" +
+                    "#{item.modifyuserid},\n" +
+                    "#{item.createusername},\n" +
+                    "#{item.modifyusername},\n" +
+                    "#{item.prjid},\n" +
+                    "#{item.rectifyid},\n" +
+                    "#{item.deptid},\n" +
+                    "#{item.deptname},\n" +
+                    "#{item.dutydeptid},\n" +
+                    "#{item.dutydeptname},\n" +
+                    "#{item.finishdate},\n" +
+                    "#{item.remark1},\n" +
+                    "#{item.remark2},\n" +
+                    "#{item.firstdeptid},\n" +
+                    "#{item.firstdeptname},\n" +
+                    "#{item.status},\n" +
+                    "#{item.machineno},\n" +
+                    "#{item.machineid},\n" +
+                    "#{item.firstdutydeptid},\n" +
+                    "#{item.firstdutydeptname},\n" +
+                    "#{item.batchid})\n" +
+            "    </foreach>" +
+            "</script>")
+    void insertBatch(@Param("list") List<ZhcxProjectRectifyMachineDo> list);
 }

+ 7 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectManageRectifyBatchService.java

@@ -20,4 +20,11 @@ public interface ZhcxProjectManageRectifyBatchService extends IService<ZhcxProje
      * @return
      */
     String genProjectSummaryFiles(String batchId);
+
+    /**
+     * 删除整改清单
+     *
+     * @param batchId
+     */
+    void delPrjRectifyBatch(String batchId);
 }

+ 8 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectRectifyMachineService.java

@@ -18,5 +18,12 @@ public interface ZhcxProjectRectifyMachineService extends IService<ZhcxProjectRe
      *
      * @param prjId
      */
-    void deleteByPrjId(String prjId);
+    void deleteByBatchId(String prjId);
+
+    /**
+     * 批量插入
+     *
+     * @param list
+     */
+    void insertBath(List<ZhcxProjectRectifyMachineDo> list);
 }

+ 8 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/ZhcxProjectRectifyService.java

@@ -18,5 +18,12 @@ public interface ZhcxProjectRectifyService extends IService<ZhcxProjectRectifyDo
      *
      * @param prjId
      */
-    void delByPrjId(String prjId);
+    void delByBatchId(String prjId);
+
+    /**
+     * 批量插入
+     *
+     * @param list
+     */
+    void insertBatch(List<ZhcxProjectRectifyDo> list);
 }

+ 18 - 0
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectManageRectifyBatchServiceImpl.java

@@ -3,6 +3,7 @@ package com.rongwei.bscommon.sys.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.rongwei.bscommon.sys.feign.LuckySheetService;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
+import com.rongwei.bscommon.sys.service.ZhcxProjectRectifyService;
 import com.rongwei.bsentity.domain.ZhcxProjectManageRectifyBatchDo;
 import com.rongwei.bscommon.sys.dao.ZhcxProjectManageRectifyBatchDao;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageRectifyBatchService;
@@ -30,6 +31,9 @@ public class ZhcxProjectManageRectifyBatchServiceImpl extends ServiceImpl<ZhcxPr
     @Autowired
     private ZhcxProjectManageService projectManageService;
 
+    @Autowired
+    private ZhcxProjectRectifyService zhcxProjectRectifyService;
+
     /**
      * 生成批次整改清单
      *
@@ -57,4 +61,18 @@ public class ZhcxProjectManageRectifyBatchServiceImpl extends ServiceImpl<ZhcxPr
 
         return listId;
     }
+
+    /**
+     * 删除整改清单
+     *
+     * @param batchId
+     */
+    @Override
+    public void delPrjRectifyBatch(String batchId) {
+
+        //删除报表暂存数据
+        zhcxProjectRectifyService.delByBatchId(batchId);
+
+        removeById(batchId);
+    }
 }

+ 3 - 1
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectManageServiceImpl.java

@@ -816,7 +816,7 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
     private void saveSummaryData2Db(JSONObject prjTitle, JSONArray celldatas, SaveSummaryDataBo summaryDataBo) {
 
         //1、删除已存在数据
-        projectRectifyService.delByPrjId(summaryDataBo.getProject().getId());
+        projectRectifyService.delByBatchId(summaryDataBo.getBatchId());
 
         //2、组装数据并保存
         //解析数据
@@ -852,6 +852,8 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
             main.setPrjcode(summaryDataBo.getProject().getProjectCode());
             main.setPrjname(summaryDataBo.getProject().getProjectEname());
 
+            main.setBatchid(summaryDataBo.getBatchId());
+
             main.setSeqsort(row.getString("总序号"));
             main.setSupervisorcode(row.getString("监理编号"));
             main.setArcposition(row.getString("部位"));

+ 4 - 4
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectRectifyMachineServiceImpl.java

@@ -24,12 +24,12 @@ public class ZhcxProjectRectifyMachineServiceImpl extends ServiceImpl<ZhcxProjec
     /**
      * 通过项目删除
      *
-     * @param prjId
+     * @param batchId
      */
     @Override
-    public void deleteByPrjId(String prjId) {
+    public void deleteByBatchId(String batchId) {
         ZhcxProjectRectifyMachineDo rectifyMachineDo = new ZhcxProjectRectifyMachineDo();
-        rectifyMachineDo.setPrjid(prjId);
-        dao.deleteByProjectId(rectifyMachineDo);
+        rectifyMachineDo.setBatchid(batchId);
+        dao.deleteByBatchId(rectifyMachineDo);
     }
 }

+ 5 - 7
business-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ZhcxProjectRectifyServiceImpl.java

@@ -1,7 +1,5 @@
 package com.rongwei.bscommon.sys.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.rongwei.bscommon.sys.service.ZhcxProjectRectifyMachineService;
 import com.rongwei.bsentity.domain.ZhcxProjectRectifyDo;
 import com.rongwei.bscommon.sys.dao.ZhcxProjectRectifyDao;
@@ -31,16 +29,16 @@ public class ZhcxProjectRectifyServiceImpl extends ServiceImpl<ZhcxProjectRectif
     /**
      * 通过项目id删除历史数据
      *
-     * @param prjId
+     * @param batchId
      */
     @Override
-    public void delByPrjId(String prjId) {
+    public void delByBatchId(String batchId) {
         //物理删除
         //删除明细
-        rectifyMachineService.deleteByPrjId(prjId);
+        rectifyMachineService.deleteByBatchId(batchId);
 
         ZhcxProjectRectifyMachineDo machineDo = new ZhcxProjectRectifyMachineDo();
-        machineDo.setPrjid(prjId);
-        dao.deleteByProjectId(machineDo);
+        machineDo.setBatchid(batchId);
+        dao.deleteByBatchId(machineDo);
     }
 }

+ 6 - 0
business-entity/src/main/java/com/rongwei/bsentity/domain/ZhcxProjectRectifyDo.java

@@ -111,5 +111,11 @@ public class ZhcxProjectRectifyDo extends BaseDo {
     @TableField("MACHINENO")
     private String machineno;
 
+    /**
+     * 项目批次id
+     */
+    @TableField("BATCHID")
+    private String batchid;
+
 
 }

+ 16 - 0
business-entity/src/main/java/com/rongwei/bsentity/dto/project/DelProjectSummaryDto.java

@@ -0,0 +1,16 @@
+package com.rongwei.bsentity.dto.project;
+
+import lombok.*;
+
+@Setter
+@Getter
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+public class DelProjectSummaryDto {
+
+    /**
+     * 批次id
+     */
+    private String batchId;
+}

+ 8 - 0
business-server/src/main/java/com/rongwei/bsserver/controller/ZhcxProjectManageController.java

@@ -6,6 +6,7 @@ import com.rongwei.bscommon.sys.service.ZhcxProjectManageRectifyBatchService;
 import com.rongwei.bscommon.sys.service.ZhcxProjectManageService;
 import com.rongwei.bsentity.domain.ZhcxProjectManageDo;
 import com.rongwei.bsentity.domain.ZhcxProjectManageRectifyBatchDo;
+import com.rongwei.bsentity.dto.project.DelProjectSummaryDto;
 import com.rongwei.bsentity.dto.project.ExportProjectSummaryDto;
 import com.rongwei.bsentity.dto.project.SavePorjectSummaryDto;
 import com.rongwei.bsentity.dto.project.UpdateDataVerificationRequest;
@@ -134,5 +135,12 @@ public class ZhcxProjectManageController {
     public void exportRectifyReportDataInSummary(@RequestBody ExportProjectSummaryDto dto, HttpServletResponse response) {
         service.exportRectifyReportDataInSummary(dto, response);
     }
+
+    @PostMapping("/delDataByBatchId")
+    @ApiOperation("删除整改")
+    public R delProjectBatch(@RequestBody DelProjectSummaryDto dto) {
+        projectManageRectifyBatchService.delPrjRectifyBatch(dto.getBatchId());
+        return R.ok();
+    }
 }