|
@@ -1,20 +1,20 @@
|
|
|
package com.sxz.base.controller;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.sxz.base.constant.CodeConstant;
|
|
|
import com.sxz.base.entity.SceneLightEntity;
|
|
|
import com.sxz.base.entity.SceneStyleEntity;
|
|
|
import com.sxz.base.service.ISceneLightService;
|
|
|
import com.sxz.base.service.ISceneStyleService;
|
|
|
-import com.sxz.base.util.HttpRequestorUtil;
|
|
|
+import com.sxz.base.util.OkHttpUtils;
|
|
|
import com.sxz.base.util.Result;
|
|
|
import com.sxz.base.vo.request.RequestSceneLight;
|
|
|
import com.sxz.base.vo.request.RequestSceneStyle;
|
|
|
import com.sxz.base.vo.response.ResponseSceneLight;
|
|
|
-import com.github.pagehelper.PageHelper;
|
|
|
-import com.github.pagehelper.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
@@ -30,9 +30,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* Created by Hb_zzZ on 2020/7/14.
|
|
@@ -54,6 +52,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 保存风格场景
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -62,14 +61,14 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParam(name = "sceneNum", value = "四维看看场景码", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "styleName", value = "风格方案名称", dataType = "String")})
|
|
|
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
- public Result save(@RequestBody RequestSceneStyle style){
|
|
|
+ public Result save(@RequestBody RequestSceneStyle style) {
|
|
|
long num = 1;
|
|
|
|
|
|
- LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
wrapper.eq(SceneStyleEntity::getSceneNum, style.getSceneNum());
|
|
|
wrapper.orderByDesc(SceneStyleEntity::getNum);
|
|
|
List<SceneStyleEntity> list = sceneStyleService.list(wrapper);
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
num = list.get(0).getNum() + 1;
|
|
|
}
|
|
|
|
|
@@ -79,13 +78,14 @@ public class SceneStyleController extends BaseController {
|
|
|
sceneStyleEntity.setSceneNum(style.getSceneNum());
|
|
|
sceneStyleEntity.setStyleName(style.getStyleName());
|
|
|
sceneStyleEntity.setStyleNum("vr-" + style.getSceneNum() + "-" + String.format("%3d", num).replace(" ", "0"));
|
|
|
- Boolean saveFlag=sceneStyleService.save(sceneStyleEntity);
|
|
|
+ Boolean saveFlag = sceneStyleService.save(sceneStyleEntity);
|
|
|
return Result.success(saveFlag);
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 修改风格场景
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -94,8 +94,8 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParam(name = "id", value = "风格方案id", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "styleName", value = "风格方案名称", dataType = "String")})
|
|
|
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
|
|
- public Result update(@RequestBody RequestSceneStyle style){
|
|
|
- if(style.getId() == null){
|
|
|
+ public Result update(@RequestBody RequestSceneStyle style) {
|
|
|
+ if (style.getId() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
SceneStyleEntity sceneStyleEntity = sceneStyleService.findById(style.getId());
|
|
@@ -108,6 +108,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 删除风格场景
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -116,26 +117,35 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParam(name = "id", value = "风格方案id", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "styleName", value = "风格方案名称", dataType = "String")})
|
|
|
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
|
|
- public Result delete(@RequestBody RequestSceneStyle style, HttpServletRequest request){
|
|
|
- if(style.getId() == null){
|
|
|
+ public Result delete(@RequestBody RequestSceneStyle style, HttpServletRequest request) {
|
|
|
+ if (style.getId() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
|
SceneStyleEntity sceneStyleEntity = sceneStyleService.findById(style.getId());
|
|
|
+ if (ObjectUtil.isNull(sceneStyleEntity)) {
|
|
|
+ return Result.failure(CodeConstant.FAILURE_CODE_4003, CodeConstant.FAILURE_MSG_4003);
|
|
|
+ }
|
|
|
+
|
|
|
sceneStyleEntity.setRecStatus("I");
|
|
|
+ Boolean updateFlag = sceneStyleService.updateById(sceneStyleEntity);
|
|
|
|
|
|
- sceneStyleService.updateById(sceneStyleEntity);
|
|
|
+ log.info("修改状态:" + updateFlag);
|
|
|
|
|
|
JSONObject data = new JSONObject();
|
|
|
data.put("sceneNum", sceneStyleEntity.getStyleNum());
|
|
|
|
|
|
- HttpRequestorUtil.postJson(mainUrl + "api/user/scene/delete", data.toJSONString(), "POST", request.getHeader("token"));
|
|
|
-
|
|
|
+ Map<String, String> header = new HashMap<>();
|
|
|
+ header.put("token", request.getHeader("token"));
|
|
|
+ log.info("删除风格场景开始ID:" + sceneStyleEntity.getId());
|
|
|
+ OkHttpUtils.httpPostJson(mainUrl + "api/user/scene/delete", data.toJSONString(), header);
|
|
|
+ log.info("删除风格场景结束ID:" + sceneStyleEntity.getId());
|
|
|
return Result.success();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据场景码获取风格列表
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -146,18 +156,19 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParam(name = "pageNum", value = "页码", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "pageSize", value = "页数", dataType = "String")})
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.POST)
|
|
|
- public Result list(@RequestBody RequestSceneStyle style){
|
|
|
- LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ public Result list(@RequestBody RequestSceneStyle style) {
|
|
|
+ LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
wrapper.eq(SceneStyleEntity::getSceneNum, style.getSceneNum());
|
|
|
- if(!StringUtils.isEmpty(style.getStyleName())){
|
|
|
+ if (!StringUtils.isEmpty(style.getStyleName())) {
|
|
|
wrapper.like(SceneStyleEntity::getStyleName, style.getSceneNum());
|
|
|
}
|
|
|
- PageInfo<SceneStyleEntity> list = sceneStyleService.listByPage(style,wrapper);
|
|
|
+ PageInfo<SceneStyleEntity> list = sceneStyleService.listByPage(style, wrapper);
|
|
|
return Result.success(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据风格码查询数据
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -165,17 +176,17 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "styleNum", value = "风格码", dataType = "String")})
|
|
|
@RequestMapping(value = "/findOne", method = RequestMethod.POST)
|
|
|
- public Result findOne(@RequestBody RequestSceneStyle style){
|
|
|
- if(StringUtils.isEmpty(style.getStyleNum())){
|
|
|
+ public Result findOne(@RequestBody RequestSceneStyle style) {
|
|
|
+ if (StringUtils.isEmpty(style.getStyleNum())) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
- LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
wrapper.eq(SceneStyleEntity::getStyleNum, style.getStyleNum());
|
|
|
List<SceneStyleEntity> list = sceneStyleService.list(wrapper);
|
|
|
SceneStyleEntity sceneStyleEntity = null;
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
sceneStyleEntity = list.get(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4003, CodeConstant.FAILURE_MSG_4003);
|
|
|
}
|
|
|
return Result.success(sceneStyleEntity);
|
|
@@ -183,6 +194,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 根据风格码和状态查询灯光预览数据
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -191,28 +203,28 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParam(name = "recStatus", value = "I:删除(回收站),A:没删除", dataType = "String"),
|
|
|
@ApiImplicitParam(name = "styleNum", value = "风格码", dataType = "String")})
|
|
|
@RequestMapping(value = "/findLightByStyleNum", method = RequestMethod.POST)
|
|
|
- public Result findLightByStyleNum(@RequestBody RequestSceneLight style){
|
|
|
- if(StringUtils.isEmpty(style.getStyleNum()) || StringUtils.isEmpty(style.getRecStatus())){
|
|
|
+ public Result findLightByStyleNum(@RequestBody RequestSceneLight style) {
|
|
|
+ if (StringUtils.isEmpty(style.getStyleNum()) || StringUtils.isEmpty(style.getRecStatus())) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
- LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
wrapper.eq(SceneStyleEntity::getStyleNum, style.getStyleNum());
|
|
|
wrapper.orderByDesc(SceneStyleEntity::getCreateTime);
|
|
|
|
|
|
List<SceneStyleEntity> list = sceneStyleService.list(wrapper);
|
|
|
SceneStyleEntity sceneStyleEntity = null;
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
sceneStyleEntity = list.get(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4003, CodeConstant.FAILURE_MSG_4003);
|
|
|
}
|
|
|
|
|
|
List<ResponseSceneLight> result = new ArrayList<>();
|
|
|
ResponseSceneLight responseSceneLight = null;
|
|
|
|
|
|
- LambdaQueryWrapper<SceneLightEntity> wrapper1 = Wrappers.lambdaQuery();
|
|
|
- wrapper1.eq(SceneLightEntity::getSceneStyleId,sceneStyleEntity.getId())
|
|
|
- .eq(SceneLightEntity::getIsShow,1)
|
|
|
+ LambdaQueryWrapper<SceneLightEntity> wrapper1 = Wrappers.lambdaQuery();
|
|
|
+ wrapper1.eq(SceneLightEntity::getSceneStyleId, sceneStyleEntity.getId())
|
|
|
+ .eq(SceneLightEntity::getIsShow, 1)
|
|
|
.eq(SceneLightEntity::getRecStatus, style.getRecStatus())
|
|
|
.orderByDesc(SceneLightEntity::getCreateTime);
|
|
|
|
|
@@ -227,6 +239,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 删除灯光预览数据
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -234,8 +247,8 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "灯光预览的id", dataType = "String")})
|
|
|
@RequestMapping(value = "/deleteLightById", method = RequestMethod.POST)
|
|
|
- public Result deleteLightById(@RequestBody RequestSceneLight style){
|
|
|
- if(style.getId() == null){
|
|
|
+ public Result deleteLightById(@RequestBody RequestSceneLight style) {
|
|
|
+ if (style.getId() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
@@ -250,6 +263,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 执行中的灯光预览
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -257,27 +271,27 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "styleNum", value = "风格码", dataType = "String")})
|
|
|
@RequestMapping(value = "/findRunningLigth", method = RequestMethod.POST)
|
|
|
- public Result findRunningLigth(@RequestBody RequestSceneLight style){
|
|
|
- if(StringUtils.isEmpty(style.getStyleNum())){
|
|
|
+ public Result findRunningLigth(@RequestBody RequestSceneLight style) {
|
|
|
+ if (StringUtils.isEmpty(style.getStyleNum())) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
|
- LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
- wrapper.eq(SceneStyleEntity::getStyleNum,style.getStyleNum());
|
|
|
+ LambdaQueryWrapper<SceneStyleEntity> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(SceneStyleEntity::getStyleNum, style.getStyleNum());
|
|
|
|
|
|
List<SceneStyleEntity> list = sceneStyleService.list(wrapper);
|
|
|
SceneStyleEntity sceneStyleEntity = null;
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
sceneStyleEntity = list.get(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4003, CodeConstant.FAILURE_MSG_4003);
|
|
|
}
|
|
|
- LambdaQueryWrapper<SceneLightEntity> wrapper1 = Wrappers.lambdaQuery();
|
|
|
- wrapper1.eq(SceneLightEntity::getSceneStyleId,sceneStyleEntity.getId())
|
|
|
+ LambdaQueryWrapper<SceneLightEntity> wrapper1 = Wrappers.lambdaQuery();
|
|
|
+ wrapper1.eq(SceneLightEntity::getSceneStyleId, sceneStyleEntity.getId())
|
|
|
.orderByDesc(SceneLightEntity::getId);
|
|
|
List<SceneLightEntity> lightEntityList = sceneLightService.list(wrapper1);
|
|
|
SceneLightEntity sceneLightEntity = null;
|
|
|
- if(lightEntityList != null && lightEntityList.size() > 0){
|
|
|
+ if (lightEntityList != null && lightEntityList.size() > 0) {
|
|
|
sceneLightEntity = lightEntityList.get(0);
|
|
|
}
|
|
|
|
|
@@ -286,6 +300,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 根据id查询灯光预览数据
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -293,8 +308,8 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "灯光预览的id", dataType = "String")})
|
|
|
@RequestMapping(value = "/findLightById", method = RequestMethod.POST)
|
|
|
- public Result findLightById(@RequestBody RequestSceneLight style){
|
|
|
- if(style.getId() == null){
|
|
|
+ public Result findLightById(@RequestBody RequestSceneLight style) {
|
|
|
+ if (style.getId() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
@@ -303,6 +318,7 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
/**
|
|
|
* 从相册设置场景风格封面
|
|
|
+ *
|
|
|
* @param style
|
|
|
* @return
|
|
|
*/
|
|
@@ -310,18 +326,18 @@ public class SceneStyleController extends BaseController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "id", value = "灯光预览的id", dataType = "String")})
|
|
|
@RequestMapping(value = "/setSceneStyleCover", method = RequestMethod.POST)
|
|
|
- public Result setSceneStyleCover(@RequestBody RequestSceneLight style){
|
|
|
- if(style.getId() == null){
|
|
|
+ public Result setSceneStyleCover(@RequestBody RequestSceneLight style) {
|
|
|
+ if (style.getId() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
|
|
|
SceneLightEntity sceneLightEntity = sceneLightService.findById(style.getId());
|
|
|
- if(sceneLightEntity == null || sceneLightEntity.getIsShow().intValue() == 0){
|
|
|
+ if (sceneLightEntity == null || sceneLightEntity.getIsShow().intValue() == 0) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4010, CodeConstant.FAILURE_MSG_4010);
|
|
|
}
|
|
|
|
|
|
SceneStyleEntity sceneStyleEntity = sceneStyleService.findById(sceneLightEntity.getSceneStyleId());
|
|
|
- if(sceneStyleEntity == null){
|
|
|
+ if (sceneStyleEntity == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4003, CodeConstant.FAILURE_MSG_4003);
|
|
|
}
|
|
|
|
|
@@ -341,8 +357,8 @@ public class SceneStyleController extends BaseController {
|
|
|
|
|
|
@ApiOperation("全景图渲染版本叠加(给3D同事那边调用)")
|
|
|
@RequestMapping(value = "/addStyleVersion", method = RequestMethod.POST)
|
|
|
- public Result addStyleVersion(@RequestBody RequestSceneLight style){
|
|
|
- if(style.getStyleNum() == null){
|
|
|
+ public Result addStyleVersion(@RequestBody RequestSceneLight style) {
|
|
|
+ if (style.getStyleNum() == null) {
|
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
|
}
|
|
|
int row = sceneStyleService.addVersion(style);
|