From c26e227abe288476c11b0a8b7875045e71efa14c Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Thu, 30 Apr 2026 17:30:00 +0800
Subject: [PATCH] 新增修改
---
multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java | 100 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 95 insertions(+), 5 deletions(-)
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java
index 06a8bb4..275c285 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/InternalAuditCarryServiceImpl.java
@@ -1,5 +1,8 @@
package com.gkhy.exam.system.service.impl;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.api.CommonPage;
@@ -13,19 +16,21 @@
import com.gkhy.exam.system.mapper.InternalAuditCheckCatalogueMapper;
import com.gkhy.exam.system.mapper.InternalAuditCheckContentMapper;
import com.gkhy.exam.system.mapper.SysClauseManagementMapper;
+import com.gkhy.exam.system.service.ExStudentService;
import com.gkhy.exam.system.service.InternalAuditCarryService;
import com.gkhy.exam.system.service.InternalAuditCheckService;
-import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
-import org.springframework.util.StringUtils;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
-import java.util.*;
-import java.util.function.Function;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
@Service
@@ -74,7 +79,7 @@
.eq(InternalAuditCarry::getYear, carry.getYear())
.eq(InternalAuditCarry::getDelFlag,1));
if (internalAuditCarries.size()>0){
- throw new ApiException("当前企业已有相关数据");
+ return CommonResult.failed("当前企业已有相关数据");
}
carry.setCreateBy(SecurityUtils.getUsername());
carry.setCreateTime(LocalDateTime.now());
@@ -296,4 +301,89 @@
carryMapper.updateById(internalAuditCarry);
return CommonResult.success();
}
+
+
+ @Override
+ @Transactional
+ public CommonResult copyInternalAuditCarry(Integer companyId, String sourceYear, String targetYear) {
+ if (companyId == null) {
+ companyId = SecurityUtils.getCompanyId().intValue();
+ }
+
+ if (sourceYear == null || sourceYear.trim().isEmpty()) {
+ return CommonResult.failed("源年份不能为空");
+ }
+
+ if (targetYear == null || targetYear.trim().isEmpty()) {
+ return CommonResult.failed("目标年份不能为空");
+ }
+
+ LambdaUpdateWrapper<InternalAuditCarry> deleteWrapper = new LambdaUpdateWrapper<>();
+ deleteWrapper.eq(InternalAuditCarry::getCompanyId, companyId)
+ .eq(InternalAuditCarry::getYear, targetYear)
+ .eq(InternalAuditCarry::getDelFlag, 1)
+ .set(InternalAuditCarry::getDelFlag, 2)
+ .set(InternalAuditCarry::getUpdateBy, SecurityUtils.getUsername())
+ .set(InternalAuditCarry::getUpdateTime, LocalDateTime.now());
+ carryMapper.update(new InternalAuditCarry(), deleteWrapper);
+
+ LambdaQueryWrapper<InternalAuditCarry> queryWrapperSource = new LambdaQueryWrapper<>();
+ queryWrapperSource.eq(InternalAuditCarry::getCompanyId, companyId)
+ .eq(InternalAuditCarry::getYear, sourceYear)
+ .eq(InternalAuditCarry::getDelFlag, 1);
+ List<InternalAuditCarry> sourceCarries = carryMapper.selectList(queryWrapperSource);
+
+ if (ObjectUtil.isEmpty(sourceCarries)) {
+ return CommonResult.success("源年份无相关数据");
+ }
+
+ for (InternalAuditCarry sourceCarry : sourceCarries) {
+ InternalAuditCarry newCarry = new InternalAuditCarry();
+ newCarry.setCompanyId(sourceCarry.getCompanyId());
+ newCarry.setYear(targetYear);
+ newCarry.setAuditPurpose(sourceCarry.getAuditPurpose());
+ newCarry.setReviewBasis(sourceCarry.getReviewBasis());
+ newCarry.setReviewScope(sourceCarry.getReviewScope());
+ newCarry.setReviewStart(sourceCarry.getReviewStart());
+ newCarry.setReviewEnd(sourceCarry.getReviewEnd());
+ newCarry.setReviewPerson(sourceCarry.getReviewPerson());
+ newCarry.setFirstStarttime(sourceCarry.getFirstStarttime());
+ newCarry.setFirstEndtime(sourceCarry.getFirstEndtime());
+ newCarry.setLastStarttime(sourceCarry.getLastStarttime());
+ newCarry.setLastEndtime(sourceCarry.getLastEndtime());
+ newCarry.setCompilationId(sourceCarry.getCompilationId());
+ newCarry.setProofreadId(sourceCarry.getProofreadId());
+ newCarry.setCheckId(sourceCarry.getCheckId());
+ newCarry.setRatifyId(sourceCarry.getRatifyId());
+ newCarry.setDelFlag(1);
+ newCarry.setCreateBy(SecurityUtils.getUsername());
+ newCarry.setCreateTime(LocalDateTime.now());
+ newCarry.setUpdateBy(SecurityUtils.getUsername());
+ newCarry.setUpdateTime(LocalDateTime.now());
+
+ int insert = carryMapper.insert(newCarry);
+ if (insert <= 0) {
+ throw new RuntimeException("复制内审计划实施主表数据失败");
+ }
+
+ List<InternalAuditCarryDept> sourceDeptList = carryMapper.selectCarryDeptList(sourceCarry.getId());
+ if (ObjectUtil.isNotEmpty(sourceDeptList)) {
+ List<InternalAuditCarryDept> newDeptList = new ArrayList<>();
+ for (InternalAuditCarryDept sourceDept : sourceDeptList) {
+ InternalAuditCarryDept newDept = new InternalAuditCarryDept();
+ newDept.setCarryId(newCarry.getId());
+ newDept.setDeptId(sourceDept.getDeptId());
+ newDept.setCheckId(sourceDept.getCheckId());
+ newDept.setDate(sourceDept.getDate());
+ newDept.setStartTime(sourceDept.getStartTime());
+ newDept.setEndTime(sourceDept.getEndTime());
+ newDeptList.add(newDept);
+ }
+ carryMapper.insertCarryDept(newDeptList);
+ }
+ }
+
+ return CommonResult.success("成功从年份[" + sourceYear + "]复制到年份[" + targetYear + "]");
+ }
+
}
--
Gitblit v1.9.2