|
@@ -1,5 +1,6 @@
|
|
package com.example.demo.controller;
|
|
package com.example.demo.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -15,13 +16,11 @@ import com.example.demo.vo.response.ResponseRenovationPartsDetailManager;
|
|
import com.example.demo.vo.response.ResponseRenovationPartsSize;
|
|
import com.example.demo.vo.response.ResponseRenovationPartsSize;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.Page;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
-import com.github.pagehelper.util.StringUtil;
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -42,7 +41,7 @@ import java.util.List;
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/manager")
|
|
@RequestMapping("/manager")
|
|
@Api(tags = "管理后台模块")
|
|
@Api(tags = "管理后台模块")
|
|
-public class ManagerController {
|
|
|
|
|
|
+public class ManagerController extends BaseController {
|
|
|
|
|
|
@Value("${server.file.location}")
|
|
@Value("${server.file.location}")
|
|
private String buildPath;
|
|
private String buildPath;
|
|
@@ -120,7 +119,7 @@ public class ManagerController {
|
|
String userId = request.getParameter("userId");
|
|
String userId = request.getParameter("userId");
|
|
String userType = request.getParameter("userType");
|
|
String userType = request.getParameter("userType");
|
|
|
|
|
|
- if (StringUtil.isEmpty(userId) || StringUtil.isEmpty(userType) || file.isEmpty()){
|
|
|
|
|
|
+ if (StrUtil.isEmpty(userId) || StrUtil.isEmpty(userType) || file.isEmpty()){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -220,7 +219,7 @@ public class ManagerController {
|
|
String jsonData = request.getParameter("jsonData");
|
|
String jsonData = request.getParameter("jsonData");
|
|
String compressionRatioHasChanged = request.getParameter("compressionRatioHasChanged");
|
|
String compressionRatioHasChanged = request.getParameter("compressionRatioHasChanged");
|
|
|
|
|
|
- if (StringUtil.isEmpty(modelId) || StringUtil.isEmpty(jsonData)){
|
|
|
|
|
|
+ if (StrUtil.isEmpty(modelId) || StrUtil.isEmpty(jsonData)){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -268,7 +267,7 @@ public class ManagerController {
|
|
buildPath + modelUploadEntity.getObjPath().replace(".obj", "-base.obj") , json.getString("matrix").replace("[", "").replace("]", ""));
|
|
buildPath + modelUploadEntity.getObjPath().replace(".obj", "-base.obj") , json.getString("matrix").replace("[", "").replace("]", ""));
|
|
|
|
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(compressionRatioHasChanged) &&
|
|
|
|
|
|
+ if(StrUtil.isNotEmpty(compressionRatioHasChanged) &&
|
|
Boolean.valueOf(compressionRatioHasChanged) &&
|
|
Boolean.valueOf(compressionRatioHasChanged) &&
|
|
json.containsKey("compressionRatio")){
|
|
json.containsKey("compressionRatio")){
|
|
int compressionRatio = json.getIntValue("compressionRatio");
|
|
int compressionRatio = json.getIntValue("compressionRatio");
|
|
@@ -304,7 +303,7 @@ public class ManagerController {
|
|
|
|
|
|
String objPath = "";
|
|
String objPath = "";
|
|
|
|
|
|
- if (StringUtil.isEmpty(modelId)){
|
|
|
|
|
|
+ if (StrUtil.isEmpty(modelId)){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -315,7 +314,7 @@ public class ManagerController {
|
|
}
|
|
}
|
|
|
|
|
|
modelUploadEntity.setStatus(0);
|
|
modelUploadEntity.setStatus(0);
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
|
|
|
|
String path = buildPath + "upload";
|
|
String path = buildPath + "upload";
|
|
File targetFile = new File(path);
|
|
File targetFile = new File(path);
|
|
@@ -345,14 +344,14 @@ public class ManagerController {
|
|
|
|
|
|
if(!new File(objPath).exists()){
|
|
if(!new File(objPath).exists()){
|
|
modelUploadEntity.setStatus(-1);
|
|
modelUploadEntity.setStatus(-1);
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
log.error("转换obj数据失败-{}", modelUploadEntity.getFileId());
|
|
log.error("转换obj数据失败-{}", modelUploadEntity.getFileId());
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4006, CodeConstant.FAILURE_MSG_4006);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_4006, CodeConstant.FAILURE_MSG_4006);
|
|
}
|
|
}
|
|
|
|
|
|
modelUploadEntity.setStatus(1);
|
|
modelUploadEntity.setStatus(1);
|
|
modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
|
|
modelUploadEntity.setObjPath(objPath.replace(buildPath, ""));
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
return Result.success(modelUploadEntity);
|
|
return Result.success(modelUploadEntity);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -377,7 +376,7 @@ public class ManagerController {
|
|
param.setUserId(null);
|
|
param.setUserId(null);
|
|
}
|
|
}
|
|
|
|
|
|
- if(StringUtil.isEmpty(param.getName())){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(param.getName())){
|
|
param.setName(null);
|
|
param.setName(null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -480,7 +479,7 @@ public class ManagerController {
|
|
if(param.getId() == null){
|
|
if(param.getId() == null){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
- if (StringUtils.isBlank(param.getZhName())) {
|
|
|
|
|
|
+ if (StrUtil.isBlank(param.getZhName())) {
|
|
return Result.failure(1, "模型名称不能为空");
|
|
return Result.failure(1, "模型名称不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -488,12 +487,12 @@ public class ManagerController {
|
|
BeanUtils.copyProperties(param, renovationPartsDetailEntity);
|
|
BeanUtils.copyProperties(param, renovationPartsDetailEntity);
|
|
renovationPartsDetailEntity.setExamine(null);
|
|
renovationPartsDetailEntity.setExamine(null);
|
|
|
|
|
|
- renovationPartsDetailService.update(renovationPartsDetailEntity);
|
|
|
|
|
|
+ renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
if("I".equals(renovationPartsDetailEntity.getRecStatus())){
|
|
if("I".equals(renovationPartsDetailEntity.getRecStatus())){
|
|
ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(renovationPartsDetailEntity.getId());
|
|
ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(renovationPartsDetailEntity.getId());
|
|
if(modelUploadEntity != null){
|
|
if(modelUploadEntity != null){
|
|
modelUploadEntity.setRecStatus("I");
|
|
modelUploadEntity.setRecStatus("I");
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -516,7 +515,7 @@ public class ManagerController {
|
|
renovationPartsAttachingEntity.setWallAttaching(false);
|
|
renovationPartsAttachingEntity.setWallAttaching(false);
|
|
renovationPartsAttachingEntity.setFloorAttaching(true);
|
|
renovationPartsAttachingEntity.setFloorAttaching(true);
|
|
}
|
|
}
|
|
- renovationPartsAttachingService.update(renovationPartsAttachingEntity);
|
|
|
|
|
|
+ renovationPartsAttachingService.updateById(renovationPartsAttachingEntity);
|
|
}
|
|
}
|
|
|
|
|
|
if(param.getX() != null && param.getY() != null && param.getZ() != null){
|
|
if(param.getX() != null && param.getY() != null && param.getZ() != null){
|
|
@@ -527,7 +526,7 @@ public class ManagerController {
|
|
renovationPartsSizeEntity.setZ(param.getZ());
|
|
renovationPartsSizeEntity.setZ(param.getZ());
|
|
if(responseRenovationPartsSize != null){
|
|
if(responseRenovationPartsSize != null){
|
|
renovationPartsSizeEntity.setId(responseRenovationPartsSize.getId());
|
|
renovationPartsSizeEntity.setId(responseRenovationPartsSize.getId());
|
|
- renovationPartsSizeService.update(renovationPartsSizeEntity);
|
|
|
|
|
|
+ renovationPartsSizeService.updateById(renovationPartsSizeEntity);
|
|
}else {
|
|
}else {
|
|
renovationPartsSizeEntity.setPartsDetailId(renovationPartsDetailEntity.getId());
|
|
renovationPartsSizeEntity.setPartsDetailId(renovationPartsDetailEntity.getId());
|
|
renovationPartsSizeService.save(renovationPartsSizeEntity);
|
|
renovationPartsSizeService.save(renovationPartsSizeEntity);
|
|
@@ -563,7 +562,7 @@ public class ManagerController {
|
|
log.info("obj转换成glb格式路径-{}", glbPath);
|
|
log.info("obj转换成glb格式路径-{}", glbPath);
|
|
CreateObjUtil.objToGlb(buildPath + modelUploadEntity.getObjPath(), glbPath);
|
|
CreateObjUtil.objToGlb(buildPath + modelUploadEntity.getObjPath(), glbPath);
|
|
modelUploadEntity.setObjSize((int) new File(buildPath + modelUploadEntity.getObjPath()).length());
|
|
modelUploadEntity.setObjSize((int) new File(buildPath + modelUploadEntity.getObjPath()).length());
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
|
|
|
|
//上传obj、mtl、jpg和glb
|
|
//上传obj、mtl、jpg和glb
|
|
String str = FileUtils.readFile(buildPath + "upload/" + modelUploadEntity.getFileId() + "/uploadList.txt");
|
|
String str = FileUtils.readFile(buildPath + "upload/" + modelUploadEntity.getFileId() + "/uploadList.txt");
|
|
@@ -614,12 +613,12 @@ public class ManagerController {
|
|
// 加锁,同一个模型只能请求一次3d渲染,防止同一账号在登录多个客户端下同时操作一个模型导致出问题
|
|
// 加锁,同一个模型只能请求一次3d渲染,防止同一账号在登录多个客户端下同时操作一个模型导致出问题
|
|
Result result;
|
|
Result result;
|
|
synchronized (param.getModelUploadId()) {
|
|
synchronized (param.getModelUploadId()) {
|
|
- result = synchronizedUpdateModel(param, modelUploadEntity, jsonObject, glbPath, renovationPartsDetailEntity);
|
|
|
|
|
|
+ result = synchronizedupdateByIdModel(param, modelUploadEntity, jsonObject, glbPath, renovationPartsDetailEntity);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- private Result synchronizedUpdateModel(RequestRenovationPartsDetailManager param,
|
|
|
|
|
|
+ private Result synchronizedupdateByIdModel(RequestRenovationPartsDetailManager param,
|
|
ModelUploadEntity modelUploadEntity,
|
|
ModelUploadEntity modelUploadEntity,
|
|
JSONObject jsonObject, String glbPath,
|
|
JSONObject jsonObject, String glbPath,
|
|
RenovationPartsDetailEntity renovationPartsDetailEntity) throws Exception {
|
|
RenovationPartsDetailEntity renovationPartsDetailEntity) throws Exception {
|
|
@@ -690,7 +689,7 @@ public class ManagerController {
|
|
|
|
|
|
//修改上传信息,关联模型id
|
|
//修改上传信息,关联模型id
|
|
modelUploadEntity.setPartsDetailId(renovationPartsDetailEntity.getId());
|
|
modelUploadEntity.setPartsDetailId(renovationPartsDetailEntity.getId());
|
|
- int row = modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ Boolean row = modelUploadService.updateById(modelUploadEntity);
|
|
log.info("执行行数-{}", row);
|
|
log.info("执行行数-{}", row);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
@@ -710,7 +709,7 @@ public class ManagerController {
|
|
@ApiOperation("获取所有企业信息")
|
|
@ApiOperation("获取所有企业信息")
|
|
@RequestMapping(value = "/findCompanyList", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/findCompanyList", method = RequestMethod.POST)
|
|
public Result findCompanyList(){
|
|
public Result findCompanyList(){
|
|
- return Result.success(companyService.findAll());
|
|
|
|
|
|
+ return Result.success(companyService.list());
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -746,7 +745,7 @@ public class ManagerController {
|
|
renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
|
|
renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
|
|
}
|
|
}
|
|
|
|
|
|
- renovationPartsDetailService.update(renovationPartsDetailEntity);
|
|
|
|
|
|
+ renovationPartsDetailService.updateById(renovationPartsDetailEntity);
|
|
|
|
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
@@ -812,7 +811,7 @@ public class ManagerController {
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "ids", value = "id的集合用逗号分割", dataType = "String")})
|
|
@ApiImplicitParam(name = "ids", value = "id的集合用逗号分割", dataType = "String")})
|
|
public Result deleteUploadModel(@RequestBody RequestRenovationParts param){
|
|
public Result deleteUploadModel(@RequestBody RequestRenovationParts param){
|
|
- if(StringUtil.isEmpty(param.getIds())){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(param.getIds())){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -822,7 +821,7 @@ public class ManagerController {
|
|
modelUploadEntity.setId(Long.valueOf(id));
|
|
modelUploadEntity.setId(Long.valueOf(id));
|
|
modelUploadEntity.setRecStatus("I");
|
|
modelUploadEntity.setRecStatus("I");
|
|
|
|
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
}
|
|
}
|
|
|
|
|
|
return Result.success();
|
|
return Result.success();
|
|
@@ -839,7 +838,7 @@ public class ManagerController {
|
|
@ApiImplicitParam(name = "modelId", value = "模型id", dataType = "String")})
|
|
@ApiImplicitParam(name = "modelId", value = "模型id", dataType = "String")})
|
|
public Result createImg(Long modelId, String jsonData) throws Exception {
|
|
public Result createImg(Long modelId, String jsonData) throws Exception {
|
|
|
|
|
|
- if(StringUtils.isEmpty(jsonData) || modelId == null){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(jsonData) || modelId == null){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -854,7 +853,7 @@ public class ManagerController {
|
|
modelUploadEntity.getFileId() + ":;" + modelUploadEntity.getUserId() + ":;" +
|
|
modelUploadEntity.getFileId() + ":;" + modelUploadEntity.getUserId() + ":;" +
|
|
modelUploadEntity.getId() + ":;" + jsonData + ":;modelPreview");
|
|
modelUploadEntity.getId() + ":;" + jsonData + ":;modelPreview");
|
|
|
|
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -899,7 +898,7 @@ public class ManagerController {
|
|
}
|
|
}
|
|
|
|
|
|
modelUploadEntity.setCacheData(cacheData);
|
|
modelUploadEntity.setCacheData(cacheData);
|
|
- modelUploadService.update(modelUploadEntity);
|
|
|
|
|
|
+ modelUploadService.updateById(modelUploadEntity);
|
|
|
|
|
|
return Result.success(modelUploadEntity);
|
|
return Result.success(modelUploadEntity);
|
|
}
|
|
}
|
|
@@ -913,7 +912,7 @@ public class ManagerController {
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
public Result uploadObj(@RequestBody RequestRenovationParts param){
|
|
public Result uploadObj(@RequestBody RequestRenovationParts param){
|
|
- if(StringUtil.isEmpty(param.getName())){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(param.getName())){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -934,7 +933,7 @@ public class ManagerController {
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
public Result updateGlb(@RequestBody RequestRenovationParts param) throws Exception{
|
|
public Result updateGlb(@RequestBody RequestRenovationParts param) throws Exception{
|
|
- if(StringUtil.isEmpty(param.getName())){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(param.getName())){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -972,7 +971,7 @@ public class ManagerController {
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
@ApiImplicitParam(name = "name", value = "多个以逗号分割", dataType = "String")})
|
|
public Result objToToolbag(@RequestBody RequestRenovationParts param) throws Exception{
|
|
public Result objToToolbag(@RequestBody RequestRenovationParts param) throws Exception{
|
|
- if(StringUtil.isEmpty(param.getName())){
|
|
|
|
|
|
+ if(StrUtil.isEmpty(param.getName())){
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
|
|
}
|
|
}
|
|
|
|
|