From b22f118eabab8f2f27dbd73e7c6cb1090cd82c82 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期四, 27 三月 2025 14:46:00 +0800
Subject: [PATCH] Merge branch 'master' of https://gitee.com/boymi/YiFeiNN

---
 medicalWaste-system/src/main/java/com/sinata/system/service/MwRegulatoryRecordService.java           |    1 +
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java       |    2 +-
 medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppRegulatoryRecordController.java |    2 +-
 medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwRegulatoryRecordServiceImpl.java  |   18 ++++++++++++++++++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppRegulatoryRecordController.java b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppRegulatoryRecordController.java
index dc90128..bcae069 100644
--- a/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppRegulatoryRecordController.java
+++ b/medicalWaste-admin/src/main/java/com/sinata/web/controller/applet/AppRegulatoryRecordController.java
@@ -64,7 +64,7 @@
     @ApiOperation("新增检查记录")
     @PostMapping("/add")
     public R<?> add(@Valid @RequestBody MwRegulatoryRecordDTO dto) {
-        mwRegulatoryRecordService.add(dto);
+        mwRegulatoryRecordService.add1(dto);
         return R.ok();
     }
 
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/MwRegulatoryRecordService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/MwRegulatoryRecordService.java
index c5f765b..0696a16 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/MwRegulatoryRecordService.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/MwRegulatoryRecordService.java
@@ -39,6 +39,7 @@
      * @return
      */
     void add(MwRegulatoryRecordDTO dto);
+    void add1(MwRegulatoryRecordDTO dto);
 
     /**
      * 编辑检查记录
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwRegulatoryRecordServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwRegulatoryRecordServiceImpl.java
index 94717c6..47a90ed 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwRegulatoryRecordServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/MwRegulatoryRecordServiceImpl.java
@@ -6,6 +6,7 @@
 import com.sinata.common.exception.ServiceException;
 import com.sinata.common.utils.BeanUtils;
 import com.sinata.common.utils.CollUtils;
+import com.sinata.common.utils.SecurityUtils;
 import com.sinata.system.domain.MwAttachment;
 import com.sinata.system.domain.MwRegulatoryRecord;
 import com.sinata.system.domain.SysDepartment;
@@ -96,6 +97,23 @@
         }
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void add1(MwRegulatoryRecordDTO dto) {
+        dto.setCheckBy(SecurityUtils.getLoginUser().getUser().getNickName());
+        MwRegulatoryRecord mwRegulatoryRecord = BeanUtils.copyBean(dto, MwRegulatoryRecord.class);
+        save(mwRegulatoryRecord);
+        //保存附件
+        if (CollUtils.isNotEmpty(dto.getAttachmentList())) {
+            List<MwAttachment> mwAttachments = BeanUtils.copyToList(dto.getAttachmentList(), MwAttachment.class);
+            mwAttachments.forEach(attachment -> {
+                attachment.setTargetId(mwRegulatoryRecord.getId());
+                attachment.setType(AttachmentTypeEnum.REGULATORY.getCode());
+            });
+            mwAttachmentService.saveBatch(mwAttachments);
+        }
+    }
+
     /**
      * 编辑检查记录
      *
diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
index cbe63bf..b15b780 100644
--- a/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
+++ b/medicalWaste-system/src/main/java/com/sinata/system/service/impl/SysDepartmentServiceImpl.java
@@ -228,7 +228,7 @@
             sysDepartmentVO1.setChildren(root1);
             sysDepartmentVO = sysDepartmentVO1;
         }
-        if (sysDepartmentVO.getTreeCode().length()==14){
+        if (sysDepartmentVO.getTreeCode().length()>=14){
             SysDepartment sysDepartment = this.baseMapper.selectById(sysDepartmentVO.getParentId());
             SysDepartmentVO sysDepartmentVO1 = new SysDepartmentVO();
             BeanUtils.copyProperties(sysDepartment,sysDepartmentVO1);

--
Gitblit v1.7.1