| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | @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())) |
| | |
| | | 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(); |
| | | } |
| | |
| | | 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(); |
| | | } |
| | |
| | | } |
| | | |
| | | @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(); |