|
@@ -1,5 +1,6 @@
|
|
package com.fdkankan.ucenter.service.impl;
|
|
package com.fdkankan.ucenter.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.captcha.generator.RandomGenerator;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.util.RandomUtil;
|
|
import com.fdkankan.common.util.RandomUtil;
|
|
@@ -13,7 +14,10 @@ import com.fdkankan.ucenter.service.ICameraTypeService;
|
|
import com.fdkankan.ucenter.service.IScene3dNumService;
|
|
import com.fdkankan.ucenter.service.IScene3dNumService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
@@ -31,16 +35,20 @@ import java.util.stream.Collectors;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
|
|
+@RefreshScope
|
|
public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3dNum> implements IScene3dNumService {
|
|
public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3dNum> implements IScene3dNumService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
RedisUtil redisUtil;
|
|
RedisUtil redisUtil;
|
|
@Autowired
|
|
@Autowired
|
|
ICameraTypeService cameraTypeService;
|
|
ICameraTypeService cameraTypeService;
|
|
|
|
+ @Value("${scene.evn:t-")
|
|
|
|
+ private String sceneEvn;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String generateSceneNum(Integer cameraType) {
|
|
public String generateSceneNum(Integer cameraType) {
|
|
- String sceneNum = redisUtil.lLeftPop(RedisKeyUtil.SCENE_UNUSED_NUMS);
|
|
|
|
|
|
+ //String sceneNum = redisUtil.lLeftPop(RedisKeyUtil.SCENE_UNUSED_NUMS);
|
|
|
|
+ String sceneNum = RandomStringUtils.random(11,true,true);
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
throw new BusinessException(ResultCode.FAILURE_CODE_400001,ResultCode.FAILURE_MSG_400001);
|
|
throw new BusinessException(ResultCode.FAILURE_CODE_400001,ResultCode.FAILURE_MSG_400001);
|
|
}
|
|
}
|
|
@@ -50,7 +58,7 @@ public class Scene3dNumServiceImpl extends ServiceImpl<IScene3dNumMapper, Scene3
|
|
log.info("generateSceneNum-error:cameraType{}",cameraType);
|
|
log.info("generateSceneNum-error:cameraType{}",cameraType);
|
|
throw new BusinessException(-1,"相机类型不存在");
|
|
throw new BusinessException(-1,"相机类型不存在");
|
|
}
|
|
}
|
|
- return cameraTypeEntity.getScenePrefix() + sceneNum;
|
|
|
|
|
|
+ return cameraTypeEntity.getScenePrefix() +sceneEvn+ sceneNum;
|
|
}
|
|
}
|
|
return sceneNum;
|
|
return sceneNum;
|
|
|
|
|