|
@@ -2,16 +2,14 @@ package com.fdkankan.scene.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
-import cn.hutool.http.HttpStatus;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fdkankan.common.constant.*;
|
|
import com.fdkankan.common.constant.*;
|
|
-import com.fdkankan.common.response.PageInfo;
|
|
|
|
import com.fdkankan.common.util.*;
|
|
import com.fdkankan.common.util.*;
|
|
import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
import com.fdkankan.platform.api.feign.PlatformGoodsClient;
|
|
import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
import com.fdkankan.platform.api.feign.PlatformUserClient;
|
|
@@ -21,23 +19,19 @@ import com.fdkankan.platform.api.vo.User;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisKey;
|
|
import com.fdkankan.redis.constant.RedisLockKey;
|
|
import com.fdkankan.redis.constant.RedisLockKey;
|
|
import com.fdkankan.redis.util.RedisLockUtil;
|
|
import com.fdkankan.redis.util.RedisLockUtil;
|
|
-import com.fdkankan.scene.entity.SceneCooperation;
|
|
|
|
-import com.fdkankan.scene.entity.ScenePro;
|
|
|
|
-import com.fdkankan.scene.entity.SceneProEdit;
|
|
|
|
-import com.fdkankan.scene.entity.SceneProEditExt;
|
|
|
|
|
|
+import com.fdkankan.scene.entity.*;
|
|
import com.fdkankan.scene.mapper.ISceneProMapper;
|
|
import com.fdkankan.scene.mapper.ISceneProMapper;
|
|
import com.fdkankan.scene.service.*;
|
|
import com.fdkankan.scene.service.*;
|
|
-import com.fdkankan.scene.vo.SceneEditVO;
|
|
|
|
|
|
+import com.fdkankan.scene.vo.*;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.constant.ErrorCode;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.exception.BusinessException;
|
|
import com.fdkankan.common.response.ResultData;
|
|
import com.fdkankan.common.response.ResultData;
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
import com.fdkankan.fyun.oss.UploadToOssUtil;
|
|
-import com.fdkankan.scene.vo.SceneVO;
|
|
|
|
-import com.fdkankan.scene.vo.UserParamVO;
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.joda.time.DateTime;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -98,7 +92,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
private ISceneCooperationService sceneCooperationService;
|
|
private ISceneCooperationService sceneCooperationService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveInitialPage(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveInitialPage(SceneEditParamVO base) throws Exception {
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getInitialPoint())){
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getInitialPoint())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -163,7 +157,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveFloorLogo(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveFloorLogo(SceneEditParamVO base) throws Exception {
|
|
if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getSize()) ||
|
|
if(StrUtil.isEmpty(base.getSceneNum()) || StrUtil.isEmpty(base.getSize()) ||
|
|
StrUtil.isEmpty(base.getLogoType())){
|
|
StrUtil.isEmpty(base.getLogoType())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
@@ -209,7 +203,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
- public ResultData saveHot(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveHot(SceneEditParamVO base) throws Exception {
|
|
if(StrUtil.isEmpty(base.getType())){
|
|
if(StrUtil.isEmpty(base.getType())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -265,7 +259,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveBackgroundMusic(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveBackgroundMusic(SceneEditParamVO base) throws Exception {
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getMusicName())){
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getMusicName())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -298,7 +292,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveSceneInfo(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveSceneInfo(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getSceneName()) ||
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getSceneName()) ||
|
|
StringUtils.isEmpty(base.getSceneType()) || StringUtils.isEmpty(base.getSceneDec())){
|
|
StringUtils.isEmpty(base.getSceneType()) || StringUtils.isEmpty(base.getSceneDec())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
@@ -357,7 +351,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveSceneKey(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveSceneKey(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getSceneKey())){
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getSceneKey())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -393,7 +387,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveTourList(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveTourList(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getTourList())){
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getTourList())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -588,7 +582,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveScreencapFile(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveScreencapFile(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getIndex()) ||
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getIndex()) ||
|
|
StringUtils.isEmpty(base.getCamerasData())){
|
|
StringUtils.isEmpty(base.getCamerasData())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
@@ -646,7 +640,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveHotVisible(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveHotVisible(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getData())){
|
|
if(StringUtils.isEmpty(base.getData())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -701,7 +695,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveLinkPano(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData saveLinkPano(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getData()) || StringUtils.isEmpty(base.getSceneNum())){
|
|
if(StringUtils.isEmpty(base.getData()) || StringUtils.isEmpty(base.getSceneNum())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -785,7 +779,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData getRecordAudioFromWeixin(SceneEditVO base) throws Exception{
|
|
|
|
|
|
+ public ResultData getRecordAudioFromWeixin(SceneEditParamVO base) throws Exception{
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getId())){
|
|
if(StringUtils.isEmpty(base.getSceneNum()) || StringUtils.isEmpty(base.getId())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -866,7 +860,10 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData getRecordAudioFromWeixinV3(String sceneNum, String id, String type, String fileName, String length, String replace, String times, String index) throws Exception {
|
|
|
|
|
|
+ public ResultData getRecordAudioFromWeixinV3(FileParamVO param) throws Exception {
|
|
|
|
+ String sceneNum = param.getSceneNum();
|
|
|
|
+ String id = param.getId();
|
|
|
|
+ String fileName = param.getFileName();
|
|
if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(id)){
|
|
if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(id)){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -911,9 +908,9 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
if(!partFile.exists()){
|
|
if(!partFile.exists()){
|
|
partFile.mkdirs();
|
|
partFile.mkdirs();
|
|
}
|
|
}
|
|
- if(!"1".equals(replace)){
|
|
|
|
|
|
+ if(!"1".equals(param.getReplace())){
|
|
return ResultData.ok(this.replaceForWeixinV3(sceneProEdit, scenejson,
|
|
return ResultData.ok(this.replaceForWeixinV3(sceneProEdit, scenejson,
|
|
- path, partPath, fileName, originalFileName, sceneNum, times));
|
|
|
|
|
|
+ path, partPath, fileName, originalFileName, sceneNum, param.getTimes()));
|
|
}
|
|
}
|
|
|
|
|
|
FileUtils.delAllFile(path + File.separator + "part");
|
|
FileUtils.delAllFile(path + File.separator + "part");
|
|
@@ -950,7 +947,10 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData getRecordAudioFromAppV3(String sceneNum, String soundFile, String type, String fileName, String length, String replace, String times, String index) throws Exception {
|
|
|
|
|
|
+ public ResultData getRecordAudioFromAppV3(FileParamVO param) throws Exception {
|
|
|
|
+ String sceneNum = param.getSceneNum();
|
|
|
|
+ String soundFile = param.getSoundFile();
|
|
|
|
+ String fileName = param.getFileName();
|
|
if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(soundFile)){
|
|
if(StringUtils.isEmpty(sceneNum) || StringUtils.isEmpty(soundFile)){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -980,9 +980,9 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
partFile.mkdirs();
|
|
partFile.mkdirs();
|
|
}
|
|
}
|
|
|
|
|
|
- if(!"1".equals(replace)){
|
|
|
|
|
|
+ if(!"1".equals(param.getReplace())){
|
|
return ResultData.ok(this.replaceForAppV3(sceneProEdit, scenejson,
|
|
return ResultData.ok(this.replaceForAppV3(sceneProEdit, scenejson,
|
|
- path, partPath, fileName, originalFileName, sceneNum, times, soundFile));
|
|
|
|
|
|
+ path, partPath, fileName, originalFileName, sceneNum, param.getTimes(), soundFile));
|
|
}
|
|
}
|
|
|
|
|
|
FileUtils.delAllFile(path + File.separator + "part");
|
|
FileUtils.delAllFile(path + File.separator + "part");
|
|
@@ -1021,8 +1021,11 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData deleteRecordAudioPart(String sceneNum, String fileName, String times, String index, String type) throws Exception {
|
|
|
|
|
|
+ public ResultData deleteRecordAudioPart(FileParamVO param) throws Exception {
|
|
|
|
|
|
|
|
+ String sceneNum = param.getSceneNum();
|
|
|
|
+ String index = param.getIndex();
|
|
|
|
+ String times = param.getTimes();
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
if(StringUtils.isEmpty(sceneNum)){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -1137,7 +1140,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData uploadFloorJsonAndRebuild(SceneEditVO sceneEdit) throws Exception {
|
|
|
|
|
|
+ public ResultData uploadFloorJsonAndRebuild(SceneEditParamVO sceneEdit) throws Exception {
|
|
|
|
|
|
String lockKey = String.format(RedisLockKey.LOCK_UPLOAD_FLOORJSON_REBUILD, sceneEdit.getSceneNum());
|
|
String lockKey = String.format(RedisLockKey.LOCK_UPLOAD_FLOORJSON_REBUILD, sceneEdit.getSceneNum());
|
|
Boolean lock = redisLockUtil.lock(lockKey, RedisKey.EXPIRE_TIME_2_HOUR);
|
|
Boolean lock = redisLockUtil.lock(lockKey, RedisKey.EXPIRE_TIME_2_HOUR);
|
|
@@ -1217,7 +1220,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public ResultData saveScreencapData(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveScreencapData(SceneEditParamVO base) throws Exception {
|
|
if(StringUtils.isEmpty(base.getSceneNum())){
|
|
if(StringUtils.isEmpty(base.getSceneNum())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -1301,7 +1304,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public ResultData saveAllVisi(SceneEditVO base) throws Exception {
|
|
|
|
|
|
+ public ResultData saveAllVisi(SceneEditParamVO base) throws Exception {
|
|
if(StrUtil.isEmpty(base.getSceneNum())){
|
|
if(StrUtil.isEmpty(base.getSceneNum())){
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
}
|
|
}
|
|
@@ -1524,7 +1527,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
return ResultData.ok();
|
|
return ResultData.ok();
|
|
}
|
|
}
|
|
|
|
|
|
- private void updateVisiData(SceneEditVO base, SceneProEdit sceneProEdit, JSONObject scenejson){
|
|
|
|
|
|
+ private void updateVisiData(SceneEditParamVO base, SceneProEdit sceneProEdit, JSONObject scenejson){
|
|
SceneProEditExt sceneProEditExt = sceneProEditExtService.getOne(
|
|
SceneProEditExt sceneProEditExt = sceneProEditExtService.getOne(
|
|
new QueryWrapper<SceneProEditExt>().eq("pro_edit_id", sceneProEdit.getId()));
|
|
new QueryWrapper<SceneProEditExt>().eq("pro_edit_id", sceneProEdit.getId()));
|
|
if(!StringUtils.isEmpty(base.getMapVisi())){
|
|
if(!StringUtils.isEmpty(base.getMapVisi())){
|
|
@@ -1762,9 +1765,9 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- private Object[] getUploadFileMapAndSceneJson(SceneEditVO base, JSONArray jsonhots, JSONObject jsonhot, String sid,
|
|
|
|
- StringBuffer imagesBuf, StringBuffer imagesBuffer,
|
|
|
|
- StringBuffer dataBuf, StringBuffer dataBuffer) throws Exception {
|
|
|
|
|
|
+ private Object[] getUploadFileMapAndSceneJson(SceneEditParamVO base, JSONArray jsonhots, JSONObject jsonhot, String sid,
|
|
|
|
+ StringBuffer imagesBuf, StringBuffer imagesBuffer,
|
|
|
|
+ StringBuffer dataBuf, StringBuffer dataBuffer) throws Exception {
|
|
Object[] result = new Object[2];
|
|
Object[] result = new Object[2];
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
if(jsonhot.containsKey("media")) {
|
|
if(jsonhot.containsKey("media")) {
|
|
@@ -1846,7 +1849,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- private String deleteCustomStyleHots(SceneEditVO base, JSONArray jsonhots, JSONObject jsonhot, String sid){
|
|
|
|
|
|
+ private String deleteCustomStyleHots(SceneEditParamVO base, JSONArray jsonhots, JSONObject jsonhot, String sid){
|
|
String hotsids = "";
|
|
String hotsids = "";
|
|
String[] styles = null;
|
|
String[] styles = null;
|
|
if(StrUtil.isNotEmpty(base.getStyleName())){
|
|
if(StrUtil.isNotEmpty(base.getStyleName())){
|
|
@@ -1898,7 +1901,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
return hotsids;
|
|
return hotsids;
|
|
}
|
|
}
|
|
|
|
|
|
- private JSONArray getJsonhots(SceneEditVO base, StringBuffer dataBuffer, JSONObject jsonhot) throws Exception {
|
|
|
|
|
|
+ private JSONArray getJsonhots(SceneEditParamVO base, StringBuffer dataBuffer, JSONObject jsonhot) throws Exception {
|
|
String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
|
|
String str = FileUtils.readFile(dataBuffer.toString() + "hot.json");
|
|
JSONArray jsonhots = null;
|
|
JSONArray jsonhots = null;
|
|
if (StrUtil.isNotEmpty(str)) {
|
|
if (StrUtil.isNotEmpty(str)) {
|
|
@@ -1920,7 +1923,7 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
return jsonhots;
|
|
return jsonhots;
|
|
}
|
|
}
|
|
|
|
|
|
- private String getSidFromParams(SceneEditVO base, JSONObject jsonhot){
|
|
|
|
|
|
+ private String getSidFromParams(SceneEditParamVO base, JSONObject jsonhot){
|
|
String sid = base.getSid();
|
|
String sid = base.getSid();
|
|
//添加或者修改
|
|
//添加或者修改
|
|
if(SceneEditType.ADD.code().equals(base.getType())){
|
|
if(SceneEditType.ADD.code().equals(base.getType())){
|
|
@@ -2083,6 +2086,435 @@ public class SceneProAppServiceImpl extends ServiceImpl<ISceneProMapper, ScenePr
|
|
return sceneList;
|
|
return sceneList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Long getSceneCount(@RequestBody UserParamVO user) {
|
|
|
|
+
|
|
|
|
+ if(StrUtil.isEmpty(user.getAppUserName()) || StrUtil.isEmpty(user.getAppPassword())){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+ ResultData<Camera> CameraResult = platformGoodsClient.getByChildNameAndChildPassword(user.getAppUserName(), user.getAppPassword());
|
|
|
|
+ Camera camera = CameraResult.getData();
|
|
|
|
+ if(camera == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return sceneProService.getSceneCount(camera.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Integer getSceneStatus(@RequestBody UserParamVO user) {
|
|
|
|
+
|
|
|
|
+ if(StrUtil.isEmpty(user.getAppUserName()) || StrUtil.isEmpty(user.getAppPassword())
|
|
|
|
+ || StrUtil.isEmpty(user.getSceneNum())){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+ ResultData<Camera> CameraResult = platformGoodsClient.getByChildNameAndChildPassword(user.getAppUserName(), user.getAppPassword());
|
|
|
|
+ Camera camera = CameraResult.getData();
|
|
|
|
+ if(camera == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ScenePro scene = sceneProService.findBySceneNum(user.getSceneNum());
|
|
|
|
+ if(scene == null){
|
|
|
|
+ scene = sceneProService.findDeleteSceneBySceneNum(user.getSceneNum());
|
|
|
|
+ if(scene == null){
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
|
+ }
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5006, SceneConstant.FAILURE_MSG_5006);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return scene.getSceneStatus();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> getSceneStatusByUnicode(@RequestBody UserParamVO user){
|
|
|
|
+ if(StrUtil.isEmpty(user.getAppUserName()) || StrUtil.isEmpty(user.getAppPassword())
|
|
|
|
+ || StrUtil.isEmpty(user.getUnicode())){
|
|
|
|
+ log.info("appUserName:" + user.getAppUserName() + ",appPassword:" + user.getAppPassword() +
|
|
|
|
+ ",unicode:" + user.getUnicode());
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+ ResultData<Camera> CameraResult = platformGoodsClient.getByChildNameAndChildPassword(user.getAppUserName(), user.getAppPassword());
|
|
|
|
+ Camera camera = CameraResult.getData();
|
|
|
|
+ if(camera == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3014);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SceneProPO sceneProPO = sceneProService.getSceneStatusByUnicode(user.getUnicode(), "A");
|
|
|
|
+ if(sceneProPO == null){
|
|
|
|
+ sceneProPO = sceneProService.getSceneStatusByUnicode(user.getUnicode(), "I");
|
|
|
|
+ if(sceneProPO == null){
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
|
+ }
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5009, SceneConstant.FAILURE_MSG_5009);
|
|
|
|
+ }
|
|
|
|
+ if(sceneProPO.getPayStatus() == -2){
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5006, SceneConstant.FAILURE_MSG_5006);
|
|
|
|
+ }
|
|
|
|
+ // 当计算时,返回给前端的状态为计算中
|
|
|
|
+ if (sceneProPO.getSceneStatus() == -1) {
|
|
|
|
+ sceneProPO.setSceneStatus(0);
|
|
|
|
+ } else if (sceneProPO.getSceneStatus() == 500) {
|
|
|
|
+ sceneProPO.setSceneStatus(-1);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ //临时将-2改成1,app还没完全更新
|
|
|
|
+ map.put("status", sceneProPO.getSceneStatus() == -2? 1 : sceneProPO.getSceneStatus());
|
|
|
|
+ map.put("webSite", sceneProPO.getWebSite());
|
|
|
|
+ map.put("sceneNum", sceneProPO.getSceneCode());
|
|
|
|
+ map.put("thumb", sceneProPO.getThumb());
|
|
|
|
+ map.put("dataSource", sceneProPO.getDataSource());
|
|
|
|
+ map.put("payStatus", sceneProPO.getPayStatus());
|
|
|
|
+ map.put("recStatus", sceneProPO.getRecStatus());
|
|
|
|
+
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneService sceneService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ISceneProExtService sceneProExtService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IFolderSceneService folderSceneService;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData deleteForCameraName(@RequestBody UserParamVO user) throws Exception {
|
|
|
|
+ if (user.getCameraId() == null || StrUtil.isEmpty(user.getSceneNum())) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+ ResultData<CameraDetail> detailResult = platformGoodsClient.getCameraDetailByCameraId(user.getCameraId());
|
|
|
|
+ CameraDetail detail = detailResult.getData();
|
|
|
|
+ if (detail == null) {
|
|
|
|
+ throw new BusinessException(CameraConstant.FAILURE_6003);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(user.getSceneNum());
|
|
|
|
+ if(scenePro == null){
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(scenePro.getCameraId().longValue() != user.getCameraId().longValue()){
|
|
|
|
+ throw new BusinessException(SceneConstant.FAILURE_CODE_5010, SceneConstant.FAILURE_MSG_5010);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String[] nums = user.getSceneNum().split(",");
|
|
|
|
+ for (String num : nums) {
|
|
|
|
+ SceneVO sceneVO = this.getSceneDetail(num);
|
|
|
|
+ if (sceneVO == null){
|
|
|
|
+ return ResultData.error(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+ }
|
|
|
|
+ ResultData resultData = this.deleteScene(num);
|
|
|
|
+ if (sceneVO.getSceneScheme() >= 3 && sceneVO.getSpace() != null){
|
|
|
|
+
|
|
|
|
+ ResultData<CameraDetail> cameraDetailResultData = platformGoodsClient.updateCameraDetailByCameraIdAndSpace(sceneVO.getCameraId(), -sceneVO.getSpace());
|
|
|
|
+ CameraDetail detail2 = cameraDetailResultData.getData();
|
|
|
|
+ if(detail2 != null){
|
|
|
|
+ //计算该相机所有扣费成功的场景容量总和
|
|
|
|
+ List<SceneVO> scenes = this.findScenesByUserIdAndSceneScheme(sceneVO.getCameraId(), "create_time", 1);
|
|
|
|
+ Long accumulateSpace = new Long("0");
|
|
|
|
+ for(SceneVO vo : scenes){
|
|
|
|
+ accumulateSpace = accumulateSpace + vo.getSpace();
|
|
|
|
+ }
|
|
|
|
+ //相机总容量 - 所有扣费成功的容量 = 可恢复场景的容量
|
|
|
|
+ if (detail2.getTotalSpace().compareTo(accumulateSpace) != -1){
|
|
|
|
+ this.unlockBeyondSpaceScenes(detail2.getTotalSpace() - accumulateSpace, sceneVO.getCameraId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //删除文件夹里面的场景关联
|
|
|
|
+ folderSceneService.deleteBySceneId(sceneVO.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void unlockBeyondSpaceScenes(Long newSpace, Long cameraId) throws Exception{
|
|
|
|
+ List<SceneVO> scenes = this.findScenesByUserIdAndSceneScheme(cameraId, "create_time", PayStatus.NO_CAPACITY.code());
|
|
|
|
+ Long accumulateSpace = new Long("0");
|
|
|
|
+ List<Long> unlockedIds = new ArrayList<>();
|
|
|
|
+ if (scenes != null && scenes.size() > 0){
|
|
|
|
+ for (SceneVO responseScene : scenes){
|
|
|
|
+ if (responseScene.getPayStatus() == -1 || responseScene.getPayStatus() == -2){
|
|
|
|
+ //newSpace为空的时候,表示无限容量
|
|
|
|
+ if(newSpace == null){
|
|
|
|
+ unlockedIds.add(responseScene.getId());
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ accumulateSpace = accumulateSpace + responseScene.getSpace();
|
|
|
|
+ if (accumulateSpace.compareTo(newSpace) != 1){
|
|
|
|
+ unlockedIds.add(responseScene.getId());
|
|
|
|
+ }else {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ unlockScenes(unlockedIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void unlockScenes(List<Long> lockedIds) {
|
|
|
|
+ if (lockedIds == null || lockedIds.size() == 0){
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ for (Long id : lockedIds){
|
|
|
|
+ ScenePro scenePro = sceneProService.getById(id);
|
|
|
|
+ scenePro.setPayStatus(1);
|
|
|
|
+ sceneProService.updateById(scenePro);
|
|
|
|
+
|
|
|
|
+ try{
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("payStatus", 1);
|
|
|
|
+ FileUtils.writeJsonFile(ConstantFilePath.SCENE_PATH + "data/data" + scenePro.getSceneCode() + "/scene.json", map);
|
|
|
|
+ com.alibaba.fastjson.JSONObject statusJson = new com.alibaba.fastjson.JSONObject();
|
|
|
|
+
|
|
|
|
+ //临时将-2改成1,app还没完全更新
|
|
|
|
+ statusJson.put("status", scenePro.getSceneStatus() == -2? 1 : scenePro.getSceneStatus());
|
|
|
|
+ statusJson.put("webSite", scenePro.getWebSite());
|
|
|
|
+ statusJson.put("sceneNum", scenePro.getSceneCode());
|
|
|
|
+ statusJson.put("thumb", scenePro.getThumb());
|
|
|
|
+ statusJson.put("payStatus", scenePro.getPayStatus());
|
|
|
|
+ FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+scenePro.getSceneCode()+ File.separator+"status.json", statusJson.toString());
|
|
|
|
+ uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+scenePro.getSceneCode()+File.separator+"status.json",
|
|
|
|
+ "data/data"+scenePro.getSceneCode()+File.separator+"status.json");
|
|
|
|
+
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public SceneVO getSceneDetail(String sceneNum) throws Exception{
|
|
|
|
+ SceneVO vo = null;
|
|
|
|
+ ScenePO scene = sceneService.findBySceneNum(sceneNum);
|
|
|
|
+ if(scene != null){
|
|
|
|
+ vo = getResponseScene(vo, scene);
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(sceneNum);
|
|
|
|
+ SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
|
+ SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
|
|
+ SceneProEditExt sceneProEditExt = sceneProEditExtService.getByProEditId(sceneProEdit.getId());
|
|
|
|
+ vo = getResponseProScene(vo, scenePro, sceneProExt, sceneProEdit, sceneProEditExt);
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private SceneVO getResponseScene(SceneVO vo, ScenePO scene) {
|
|
|
|
+ if (Objects.isNull(scene))
|
|
|
|
+ return vo;
|
|
|
|
+ vo = new SceneVO();
|
|
|
|
+ BeanUtils.copyProperties(scene, vo);
|
|
|
|
+ vo.setThumbImg(scene.getThumbStatus());
|
|
|
|
+ vo.setCreateTime(new DateTime(scene.getCreateTime()).toString("yyyy-MM-dd HH:mm"));
|
|
|
|
+ vo.setSceneIndex(scene.getStyle());
|
|
|
|
+ vo.setHasBGM(scene.getBgMusic());
|
|
|
|
+ vo.setCameraType(scene.getSceneScheme());
|
|
|
|
+ vo.setIsPublic(StringUtils.isEmpty(scene.getSceneKey()) ? 0 : 1);
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private SceneVO getResponseProScene(SceneVO vo, ScenePro scenePro, SceneProExt sceneProExt,
|
|
|
|
+ SceneProEdit sceneProEdit, SceneProEditExt sceneProEditExt) {
|
|
|
|
+ if (Objects.isNull(scenePro))
|
|
|
|
+ return vo;
|
|
|
|
+ vo = new SceneVO();
|
|
|
|
+ BeanUtils.copyProperties(sceneProEditExt, vo);
|
|
|
|
+ BeanUtils.copyProperties(sceneProEdit, vo);
|
|
|
|
+ BeanUtils.copyProperties(sceneProExt, vo);
|
|
|
|
+ BeanUtils.copyProperties(scenePro, vo);
|
|
|
|
+ vo.setCreateTime(new DateTime(scenePro.getCreateTime()).toString("yyyy-MM-dd HH:mm"));
|
|
|
|
+ vo.setCameraType(scenePro.getSceneScheme());
|
|
|
|
+
|
|
|
|
+ vo.setThumbImg(sceneProEdit.getThumbStatus());
|
|
|
|
+ vo.setHasBGM(sceneProEdit.getBgMusic());
|
|
|
|
+ vo.setIsPublic(StringUtils.isEmpty(sceneProEdit.getSceneKey()) ? 0 : 1);
|
|
|
|
+ return vo;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData deleteScene(String sceneNum) throws Exception {
|
|
|
|
+ ScenePO scenePo = sceneService.findBySceneNum(sceneNum);
|
|
|
|
+ SceneVO vo = null;
|
|
|
|
+ if(scenePo != null){
|
|
|
|
+ sceneService.update(new LambdaUpdateWrapper<Scene>()
|
|
|
|
+ .eq(Scene::getId, scenePo.getId())
|
|
|
|
+ .set(Scene::getRecStatus, RecStatus.DISABLE.code())
|
|
|
|
+ .set(Scene::getUpdateTime, Calendar.getInstance().getTime()));
|
|
|
|
+
|
|
|
|
+ vo = getResponseScene(vo, scenePo);
|
|
|
|
+ return ResultData.ok(vo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(sceneNum);
|
|
|
|
+ SceneProExt sceneProExt = sceneProExtService.findBySceneProId(scenePro.getId());
|
|
|
|
+ scenePro.setRecStatus("I");
|
|
|
|
+ scenePro.setUpdateTime(new Date());
|
|
|
|
+ sceneProService.updateById(scenePro);
|
|
|
|
+
|
|
|
|
+ JSONObject statusJson = new JSONObject();
|
|
|
|
+ //临时将-2改成1,app还没完全更新
|
|
|
|
+ statusJson.put("status", scenePro.getSceneStatus() == -2? 1 : scenePro.getSceneStatus());
|
|
|
|
+ statusJson.put("webSite", scenePro.getWebSite());
|
|
|
|
+ statusJson.put("sceneNum", scenePro.getSceneCode());
|
|
|
|
+ statusJson.put("thumb", scenePro.getThumb());
|
|
|
|
+ statusJson.put("payStatus", scenePro.getPayStatus());
|
|
|
|
+ statusJson.put("recStatus", scenePro.getRecStatus());
|
|
|
|
+ FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+sceneNum+File.separator+"status.json", statusJson.toString());
|
|
|
|
+ uploadToOssUtil.upload(ConstantFilePath.SCENE_PATH+"data/data"+sceneNum+File.separator+"status.json",
|
|
|
|
+ "data/data"+sceneNum+File.separator+"status.json");
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<SceneVO> findScenesByUserIdAndSceneScheme(Long cameraId, String orderBy, Integer payStatus) {
|
|
|
|
+ List<ScenePro> sceneProList = sceneProService.list(new LambdaQueryWrapper<ScenePro>()
|
|
|
|
+ .eq(ScenePro::getRecStatus, RecStatus.VALID.code())
|
|
|
|
+ .in(ScenePro::getSceneStatus, SceneStatus.SUCCESS.code(), SceneStatus.NO_DISPLAY.code())
|
|
|
|
+ .eq(ScenePro::getCameraId, cameraId)
|
|
|
|
+ .eq(ScenePro::getPayStatus, payStatus).last(orderBy));
|
|
|
|
+
|
|
|
|
+ List<Long> idList = sceneProList.stream().map(pro -> {
|
|
|
|
+ return pro.getId();
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<SceneProExt> sceneProExtList = sceneProExtService.list(new LambdaQueryWrapper<SceneProExt>().in(SceneProExt::getSceneProId, idList));
|
|
|
|
+ Map<Long, SceneProExt> extMap = new HashMap<>();
|
|
|
|
+ sceneProExtList.forEach(ext -> {
|
|
|
|
+ extMap.put(ext.getSceneProId(), ext);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ List<SceneVO> voList = sceneProList.parallelStream().map(pro -> {
|
|
|
|
+ SceneVO vo = new SceneVO();
|
|
|
|
+ SceneProExt sceneProExt = extMap.get(pro.getId());
|
|
|
|
+ BeanUtils.copyProperties(sceneProExt, vo);
|
|
|
|
+ BeanUtils.copyProperties(pro, vo);
|
|
|
|
+ return vo;
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ return voList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData getScreencapVoice(@RequestBody SceneParamVO scene) throws Exception {
|
|
|
|
+ if (StrUtil.isEmpty(scene.getScreencapMusic()) || StrUtil.isEmpty(scene.getOriginalFileName())
|
|
|
|
+ || StrUtil.isEmpty(scene.getSceneNum())) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ScenePro scenePro = sceneProService.findBySceneNum(scene.getSceneNum());
|
|
|
|
+ if(scenePro == null){
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_5005);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ SceneProEdit sceneProEdit = sceneProEditService.findByProId(scenePro.getId());
|
|
|
|
+
|
|
|
|
+ //八目存放新的录音位置
|
|
|
|
+ long time = System.currentTimeMillis();
|
|
|
|
+ Map<String, Object> map = new HashMap();
|
|
|
|
+ map.put("screencapVoiceSoundsyncFileName", scene.getScreencapMusic() + ".mp3");
|
|
|
|
+ map.put("screencapVoiceSoundsync", scene.getOriginalFileName() + "?t=" + time);
|
|
|
|
+ log.info("微信上传的音频路径:" + scene.getOriginalFileName() + "?t=" + time);
|
|
|
|
+ map.put("screencapVoiceType", "soundsync");
|
|
|
|
+ map.put("version", sceneProEdit.getVersion() + 1);
|
|
|
|
+
|
|
|
|
+ StringBuffer dataBuffer = new StringBuffer(ConstantFilePath.SCENE_PATH)
|
|
|
|
+ .append("data").append(File.separator)
|
|
|
|
+ .append("data").append(scene.getSceneNum());
|
|
|
|
+ FileUtils.writeJsonFile(dataBuffer.append(File.separator).append("scene.json").toString(), map);
|
|
|
|
+
|
|
|
|
+ sceneProEdit.setScreencapVoiceSoundsync(scene.getOriginalFileName() + "?t=" + time);
|
|
|
|
+ sceneProEdit.setScreencapVoiceType("soundsync");
|
|
|
|
+ sceneProEdit.setVersion(sceneProEdit.getVersion() + 1);
|
|
|
|
+
|
|
|
|
+ FileUtils.downLoadFromUrl(scene.getOriginalFileName() + "?t=" + time, scene.getScreencapMusic() + ".mp3",
|
|
|
|
+ ConstantFilePath.SCENE_PATH+ "voice" + File.separator + "voice" + scene.getSceneNum());
|
|
|
|
+
|
|
|
|
+ sceneProEditService.updateById(sceneProEdit);
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<SceneVO> getAllSceneByUserName(UserParamVO user) throws Exception {
|
|
|
|
+ if (StrUtil.isEmpty(user.getPhoneNum())) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ResultData<User> userResult = platformUserClient.getUserByName(user.getPhoneNum());
|
|
|
|
+ User ssoUser = userResult.getData();
|
|
|
|
+
|
|
|
|
+ if (ssoUser == null) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(user.getCameraType() == null){
|
|
|
|
+ user.setCameraType(4);
|
|
|
|
+ }
|
|
|
|
+ List<SceneProPO> list = sceneProService.findByUserIdAndCameraType(ssoUser.getId(), user.getCameraType());
|
|
|
|
+
|
|
|
|
+ List<SceneVO> sceneList = sceneProService.convert2(list);
|
|
|
|
+ for(SceneVO vo : sceneList){
|
|
|
|
+ ResultData<Camera> cameraResult = platformGoodsClient.getCameraById(vo.getCameraId());
|
|
|
|
+ Camera camera = cameraResult.getData();
|
|
|
|
+ if(camera != null){
|
|
|
|
+ vo.setChildName(camera.getChildName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return sceneList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultData cooperationSceneList(@RequestBody UserParamVO user){
|
|
|
|
+ if (StrUtil.isEmpty(user.getPhoneNum())) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3001);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ResultData<User> userResult = platformUserClient.getUserByName(user.getPhoneNum());
|
|
|
|
+ User ssoUser = userResult.getData();
|
|
|
|
+
|
|
|
|
+ if (ssoUser == null) {
|
|
|
|
+ throw new BusinessException(ErrorCode.FAILURE_CODE_3015);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(user.getCameraType() == null){
|
|
|
|
+ user.setCameraType(4);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SceneCooperation> list = sceneCooperationService.list(
|
|
|
|
+ new LambdaQueryWrapper<SceneCooperation>()
|
|
|
|
+ .eq(SceneCooperation::getRecStatus, RecStatus.VALID.code())
|
|
|
|
+ .eq(SceneCooperation::getUserId, ssoUser.getId())
|
|
|
|
+ .orderByDesc(SceneCooperation::getId));
|
|
|
|
+
|
|
|
|
+ if(list == null || list.size() <= 0){
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> sceneCodeList = list.parallelStream().map(sc -> {
|
|
|
|
+ return sc.getSceneCode();
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ List<SceneProPO> sceneProPOList = sceneProService.findBySceneNums(sceneCodeList, user.getCameraType());
|
|
|
|
+
|
|
|
|
+ List<SceneVO> sceneVOList = sceneProService.convert2(sceneProPOList);
|
|
|
|
+ for(SceneVO responseScene : sceneVOList){
|
|
|
|
+ ResultData<Camera> cameraResult = platformGoodsClient.getCameraById(responseScene.getCameraId());
|
|
|
|
+ Camera camera = cameraResult.getData();
|
|
|
|
+ if(camera != null){
|
|
|
|
+ responseScene.setChildName(camera.getChildName());
|
|
|
|
+ responseScene.setSnCode(camera.getSnCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return ResultData.ok(sceneVOList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|