From 2d9bf42ce507096c3b73a782da3ad16f29d2ccdc Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Thu, 07 May 2026 15:25:16 +0800
Subject: [PATCH] 新增年份查询
---
multi-system/src/main/java/com/gkhy/exam/system/service/impl/SupplierSureServiceImpl.java | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 166 insertions(+), 0 deletions(-)
diff --git a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SupplierSureServiceImpl.java b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SupplierSureServiceImpl.java
index 5b193d6..d11ca11 100644
--- a/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SupplierSureServiceImpl.java
+++ b/multi-system/src/main/java/com/gkhy/exam/system/service/impl/SupplierSureServiceImpl.java
@@ -1,5 +1,6 @@
package com.gkhy.exam.system.service.impl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.api.CommonResult;
@@ -7,13 +8,17 @@
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.common.utils.SecurityUtils;
import com.gkhy.exam.system.domain.SupplierSure;
+import com.gkhy.exam.system.domain.SupplierSureCertifity;
import com.gkhy.exam.system.domain.SupplierSurePerformance;
+import com.gkhy.exam.system.domain.SupplierSureQuality;
+import com.gkhy.exam.system.mapper.SupplierSureCertifityMapper;
import com.gkhy.exam.system.mapper.SupplierSureMapper;
import com.gkhy.exam.system.mapper.SupplierSurePerformanceMapper;
import com.gkhy.exam.system.mapper.SupplierSureQualityMapper;
import com.gkhy.exam.system.service.SupplierSureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.List;
@@ -27,6 +32,8 @@
private SupplierSurePerformanceMapper performanceMapper;
@Autowired
private SupplierSureQualityMapper qualityMapper;
+ @Autowired
+ private SupplierSureCertifityMapper certifityMapper;
@Override
public CommonPage selectSupplierList(SupplierSure sure) {
@@ -68,4 +75,163 @@
supplierSureMapper.updateById(supplierSure);
return CommonResult.success();
}
+
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public CommonResult copySupplierSure(Integer companyId, String sourceYear, String targetYear) {
+ if (companyId == null) {
+ companyId = Math.toIntExact(SecurityUtils.getCompanyId());
+ }
+
+ if (sourceYear == null || sourceYear.isEmpty()) {
+ return CommonResult.failed("源年份不能为空");
+ }
+
+ if (targetYear == null || targetYear.isEmpty()) {
+ return CommonResult.failed("目标年份不能为空");
+ }
+
+ String currentUsername = SecurityUtils.getUsername();
+ LocalDateTime now = LocalDateTime.now();
+
+ LambdaQueryWrapper<SupplierSure> targetQueryWrapper =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ targetQueryWrapper.eq(SupplierSure::getCompanyId, companyId)
+ .eq(SupplierSure::getYear, targetYear)
+ .eq(SupplierSure::getDelFlag, 1);
+ List<SupplierSure> targetSuppliers = supplierSureMapper.selectList(targetQueryWrapper);
+
+ if (targetSuppliers != null && !targetSuppliers.isEmpty()) {
+ for (SupplierSure targetSupplier : targetSuppliers) {
+ Integer targetSupplierId = targetSupplier.getId();
+
+ SupplierSure deleteSupplier = new SupplierSure();
+ deleteSupplier.setId(targetSupplierId);
+ deleteSupplier.setDelFlag(2);
+ deleteSupplier.setUpdateTime(now);
+ deleteSupplier.setUpdateBy(currentUsername);
+ supplierSureMapper.updateById(deleteSupplier);
+
+ }
+ }
+
+ LambdaQueryWrapper<SupplierSure> sourceQueryWrapper =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ sourceQueryWrapper.eq(SupplierSure::getCompanyId, companyId)
+ .eq(SupplierSure::getYear, sourceYear)
+ .eq(SupplierSure::getDelFlag, 1);
+ List<SupplierSure> sourceSuppliers = supplierSureMapper.selectList(sourceQueryWrapper);
+
+ if (sourceSuppliers == null || sourceSuppliers.isEmpty()) {
+ return CommonResult.failed("源年份没有可复制的数据");
+ }
+
+ for (SupplierSure sourceSupplier : sourceSuppliers) {
+ Integer oldSupplierId = sourceSupplier.getId();
+
+ SupplierSure newSupplier = new SupplierSure();
+ newSupplier.setCompanyId(sourceSupplier.getCompanyId());
+ newSupplier.setYear(targetYear);
+ newSupplier.setSupplierName(sourceSupplier.getSupplierName());
+ newSupplier.setSupplierAddr(sourceSupplier.getSupplierAddr());
+ newSupplier.setMerito(sourceSupplier.getMerito());
+ newSupplier.setUser(sourceSupplier.getUser());
+ newSupplier.setPhone(sourceSupplier.getPhone());
+ newSupplier.setRemark(sourceSupplier.getRemark());
+ newSupplier.setDelFlag(1);
+ newSupplier.setCreateBy(currentUsername);
+ newSupplier.setCreateTime(now);
+ newSupplier.setUpdateBy(currentUsername);
+ newSupplier.setUpdateTime(now);
+
+ supplierSureMapper.insert(newSupplier);
+ Integer newSupplierId = newSupplier.getId();
+
+ LambdaQueryWrapper<SupplierSureCertifity> certifityQueryWrapper =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ certifityQueryWrapper.eq(SupplierSureCertifity::getSupplierSureId, oldSupplierId)
+ .eq(SupplierSureCertifity::getDelFlag, 1);
+ List<SupplierSureCertifity> certifities = certifityMapper.selectList(certifityQueryWrapper);
+
+ if (certifities != null && !certifities.isEmpty()) {
+ for (SupplierSureCertifity certifity : certifities) {
+ SupplierSureCertifity newCertifity = new SupplierSureCertifity();
+ newCertifity.setSupplierSureId(newSupplierId);
+ newCertifity.setCertifityName(certifity.getCertifityName());
+ newCertifity.setFilePath(certifity.getFilePath());
+ newCertifity.setDelFlag(1);
+ certifityMapper.insert(newCertifity);
+ }
+ }
+
+ LambdaQueryWrapper<SupplierSureQuality> qualityQueryWrapper =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ qualityQueryWrapper.eq(SupplierSureQuality::getSupplierSureId, oldSupplierId);
+ List<SupplierSureQuality> qualities = qualityMapper.selectList(qualityQueryWrapper);
+
+ if (qualities != null && !qualities.isEmpty()) {
+ for (SupplierSureQuality quality : qualities) {
+ SupplierSureQuality newQuality = new SupplierSureQuality();
+ newQuality.setSupplierSureId(newSupplierId);
+ newQuality.setName(quality.getName());
+ newQuality.setAddress(quality.getAddress());
+ newQuality.setPerson(quality.getPerson());
+ newQuality.setEmil(quality.getEmil());
+ newQuality.setPhone(quality.getPhone());
+ newQuality.setTrait(quality.getTrait());
+ newQuality.setFacility(quality.getFacility());
+ newQuality.setCraft(quality.getCraft());
+ newQuality.setDevelop(quality.getDevelop());
+ newQuality.setTeamWork(quality.getTeamWork());
+ newQuality.setQualification(quality.getQualification());
+ newQuality.setOtherQualifi(quality.getOtherQualifi());
+ newQuality.setOtherDate(quality.getOtherDate());
+ newQuality.setProduct(quality.getProduct());
+ newQuality.setOtherProduct(quality.getOtherProduct());
+ newQuality.setCompanyMess(quality.getCompanyMess());
+ newQuality.setChargeName(quality.getChargeName());
+ newQuality.setChargeTime(now);
+ qualityMapper.insert(newQuality);
+ }
+ }
+
+ LambdaQueryWrapper<SupplierSurePerformance> performanceQueryWrapper =
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
+ performanceQueryWrapper.eq(SupplierSurePerformance::getSupplierSureId, oldSupplierId);
+ List<SupplierSurePerformance> performances = performanceMapper.selectList(performanceQueryWrapper);
+
+ if (performances != null && !performances.isEmpty()) {
+ for (SupplierSurePerformance performance : performances) {
+ SupplierSurePerformance newPerformance = new SupplierSurePerformance();
+ newPerformance.setSupplierSureId(newSupplierId);
+ newPerformance.setName(performance.getName());
+ newPerformance.setAddress(performance.getAddress());
+ newPerformance.setPeople(performance.getPeople());
+ newPerformance.setPhone(performance.getPhone());
+ newPerformance.setEmil(performance.getEmil());
+ newPerformance.setProduct(performance.getProduct());
+ newPerformance.setType(performance.getType());
+ newPerformance.setGist(performance.getGist());
+ newPerformance.setVerify(performance.getVerify());
+ newPerformance.setP1(performance.getP1());
+ newPerformance.setP2(performance.getP2());
+ newPerformance.setP3(performance.getP3());
+ newPerformance.setP4(performance.getP4());
+ newPerformance.setP5(performance.getP5());
+ newPerformance.setP6(performance.getP6());
+ newPerformance.setOpinion(performance.getOpinion());
+ newPerformance.setReviewUsers(performance.getReviewUsers());
+ newPerformance.setReviewTime(now);
+ newPerformance.setReviewMess(performance.getReviewMess());
+ newPerformance.setCheckId(performance.getCheckId());
+ newPerformance.setCheckTime(now);
+ performanceMapper.insert(newPerformance);
+ }
+ }
+ }
+
+ return CommonResult.success("复制成功");
+ }
+
}
--
Gitblit v1.9.2