危化品全生命周期管理后端
“djh”
2025-05-07 da2c594ade5d69621dd11a13bb758477e2dc079e
hazmat-system/src/main/java/com/gkhy/hazmat/system/service/impl/HzHazmatBasicServiceImpl.java
@@ -16,6 +16,7 @@
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;
@@ -50,7 +51,7 @@
    @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();
@@ -83,6 +84,7 @@
        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) {
@@ -99,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("更新危化品基础信息失败");
@@ -170,6 +176,7 @@
            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);
@@ -198,6 +205,11 @@
        return hazmatBasicList.size();
    }
    @Override
    public List<HzBasicVo> basicCount() {
        return baseMapper.basicCount();
    }
    public void validateData(HazmatBasicExcelData hazmatBasicExcelData){
        if(StringUtils.isBlank(hazmatBasicExcelData.getName())){