From c04f2d4a58bd72449b2212ed2f8b0c3ac9ec96be Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Tue, 12 Aug 2025 11:04:16 +0800
Subject: [PATCH] 修改
---
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java
index 9d4e01f..2c829f3 100644
--- a/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java
+++ b/hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.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.HzHazmatBasic;
+import com.gkhy.hazmat.system.domain.vo.HzBasicVo;
+import com.gkhy.hazmat.system.domain.vo.HzSecientificVo;
import com.gkhy.hazmat.system.mapper.HzHazmatBasicMapper;
+import com.gkhy.hazmat.system.mapper.HzSecientificMapper;
import com.gkhy.hazmat.system.service.HzHazmatBasicService;
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,14 @@
@Service
public class HzHazmatBasicServiceImpl extends ServiceImpl<HzHazmatBasicMapper, HzHazmatBasic> implements HzHazmatBasicService {
+
+ @Autowired
+ private HzSecientificMapper secientificMapper;
+
@Override
public CommonPage selectHazmatBasicList(HzHazmatBasic hazmatBasic) {
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())) {
hazmatBasic.setCompanyId(currentUser.getCompanyId());
}
PageUtils.startPage();
@@ -73,6 +81,11 @@
}
checkUserAllowed(null,currentUser);
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(hazmatBasic.getName());
+ hazmatBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null);
+ hazmatBasic.setPeculiarityNumber(hzSecientificVo!=null? hzSecientificVo.getPeculiarityNumber() : 0);
+ hazmatBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
+
int row = baseMapper.insert(hazmatBasic);
if (row < 1) {
throw new ApiException("新增危化品基础信息失败");
@@ -88,6 +101,10 @@
SysUser currentUser = SecurityUtils.getLoginUser().getUser();
checkUserAllowed(hazmatBasic,currentUser);
hazmatBasic.setUpdateBy(currentUser.getUsername());
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(hazmatBasic.getName());
+ hazmatBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : null);
+ hazmatBasic.setPeculiarityNumber(hzSecientificVo!=null? hzSecientificVo.getPeculiarityNumber() : 0);
+ hazmatBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
int row=baseMapper.updateById(hazmatBasic);
if(row<1){
throw new ApiException("更新危化品基础信息失败");
@@ -155,6 +172,12 @@
if(minPackage==null){
throw new ApiException("序号"+hazmatBasicExcelData.getIndex()+"最小包装类型填写不正确");
}
+
+ HzSecientificVo hzSecientificVo = secientificMapper.selectBySecientificName(hazmatBasic.getName());
+ hazmatBasic.setPeculiarityType(hzSecientificVo!=null? hzSecientificVo.getPeculiarityType() : "");
+ hazmatBasic.setPeculiarityNumber(hzSecientificVo!=null? hzSecientificVo.getPeculiarityNumber() : 0);
+ hazmatBasic.setSecientificId(hzSecientificVo!=null? hzSecientificVo.getId() : null);
+
hazmatBasic.setKind(kind);
hazmatBasic.setMinPackage(minPackage);
hazmatBasic.setCompanyId(currentUser.getCompanyId());
@@ -182,6 +205,11 @@
return hazmatBasicList.size();
}
+ @Override
+ public List<HzBasicVo> basicCount() {
+ return baseMapper.basicCount();
+ }
+
public void validateData(HazmatBasicExcelData hazmatBasicExcelData){
if(StringUtils.isBlank(hazmatBasicExcelData.getName())){
--
Gitblit v1.9.2