zhangf
2024-09-11 d4020168658efdee89a633083cd9c14b06c4d863
src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasCategoryServiceImpl.java
@@ -3,6 +3,7 @@
import com.gkhy.fourierSpecialGasMonitor.commons.domain.Result;
import com.gkhy.fourierSpecialGasMonitor.commons.domain.SearchResult;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.ResultCode;
import com.gkhy.fourierSpecialGasMonitor.commons.enums.SystemCacheKeyEnum;
import com.gkhy.fourierSpecialGasMonitor.commons.exception.BusinessException;
import com.gkhy.fourierSpecialGasMonitor.commons.model.PageQuery;
import com.gkhy.fourierSpecialGasMonitor.domain.account.entity.User;
@@ -76,7 +77,7 @@
    }
    @Override
    public Result createGasCategory(CreateGasCategoryReqDTO reqDto) {
    public synchronized Result createGasCategory(CreateGasCategoryReqDTO reqDto) {
        if (reqDto == null)
            throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL.getCode(),"参数不能为空");
        if (StringUtils.isBlank(reqDto.getMolecularFormula()))
@@ -107,7 +108,7 @@
            gasCategoryMolecularFormulaRepeatlock.unlock();
        }
        //清除redis缓存
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info");
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
        if (bucket.isExists()) {
            bucket.delete();
        }
@@ -147,7 +148,7 @@
            gasCategoryMolecularFormulaRepeatlock.unlock();
        }
        //清除redis缓存
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info");
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
        if (bucket.isExists()) {
            bucket.delete();
        }
@@ -177,9 +178,14 @@
    }
    @Override
    public List<GasCategory> findGasCategoryForReport() {
        return gasCategoryRepository.findGasCategoryForReport();
    }
    @Override
    public Result gasCategoryList() {
        Result success = Result.success();
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info");
        RBucket<List<GasCategory>> bucket = redissonClient.getBucket(SystemCacheKeyEnum.KEY_GAS_CATEGORY.getKey());
        List<GasCategory> categories = bucket.get();
        if (CollectionUtils.isEmpty(categories)){
            categories = gasCategoryRepository.findAll();