From 65ca50935315a89e219b7c974caf95dc28895ffc Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Thu, 16 Oct 2025 08:37:56 +0800
Subject: [PATCH] 修改
---
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java
index c5f0ce9..bfc6f6f 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzProductBasicServiceImpl.java
@@ -16,9 +16,13 @@
import com.gkhy.hazmat.common.utils.SecurityUtils;
import com.gkhy.hazmat.common.utils.StringUtils;
import com.gkhy.hazmat.system.domain.HzProductBasic;
+import com.gkhy.hazmat.system.domain.vo.HzSecientificVo;
+import com.gkhy.hazmat.system.mapper.HzPeculiarityMapper;
import com.gkhy.hazmat.system.mapper.HzProductBasicMapper;
+import com.gkhy.hazmat.system.mapper.HzSecientificMapper;
import com.gkhy.hazmat.system.service.HzProductBasicService;
import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -40,10 +44,13 @@
@Service
public class HzProductBasicServiceImpl extends ServiceImpl<HzProductBasicMapper, HzProductBasic> implements HzProductBasicService {
+ @Autowired
+ private HzSecientificMapper secientificMapper;
+
@Override
public CommonPage selectProductBasicList(HzProductBasic productBasic) {
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
- if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode())) {
+ if (!currentUser.getUserType().equals(UserTypeEnum.SYSTEM_USER.getCode()) && !currentUser.getUserType().equals(UserTypeEnum.CHECK_USER.getCode())) {
productBasic.setCompanyId(currentUser.getCompanyId());
}
PageUtils.startPage();
@@ -68,6 +75,12 @@
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
productBasic.setCreateBy(currentUser.getUsername());
productBasic.setCompanyId(currentUser.getCompanyId());
+
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(productBasic.getName());
+ productBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null);
+ productBasic.setPeculiarityNumber(hzSecientificVo!=null ? hzSecientificVo.getPeculiarityNumber() : 0);
+ productBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
+
if (!checkProductSnUnique(productBasic)) {
throw new ApiException("产品编号已存在");
}
@@ -87,6 +100,10 @@
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
checkUserAllowed(productBasic,currentUser);
productBasic.setUpdateBy(currentUser.getUsername());
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(productBasic.getName());
+ productBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null);
+ productBasic.setPeculiarityNumber(hzSecientificVo!=null ? hzSecientificVo.getPeculiarityNumber() : 0);
+ productBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
int row=baseMapper.updateById(productBasic);
if(row<1){
throw new ApiException("更新成品基础信息失败");
@@ -154,6 +171,10 @@
if(minPackage==null){
throw new ApiException("序号"+productBasicExcelData.getIndex()+"最小包装类型填写不正确");
}
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(productBasic.getName());
+ productBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null);
+ productBasic.setPeculiarityNumber(hzSecientificVo!=null ? hzSecientificVo.getPeculiarityNumber() : 0);
+ productBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
productBasic.setKind(kind);
productBasic.setMinPackage(minPackage);
productBasic.setCompanyId(currentUser.getCompanyId());
--
Gitblit v1.9.2