Explorar el Código

修改审批接口

xiewenjie hace 3 años
padre
commit
c78092ee32

+ 3 - 3
sxz-core/src/main/java/com/fdkk/sxz/other/listener/SnycBuild.java

@@ -70,7 +70,7 @@ public class SnycBuild {
                     //普通
                     renovationPartsDetailEntity = renovationPartsDetailService.findById(id);
                     if (ObjectUtil.isNotNull(renovationPartsDetailEntity)) {
-                        renovationPartsDetailEntity.setExamine(1);
+                        renovationPartsDetailEntity.setExamine(2);
                         renovationPartsDetailEntity.setExamineTime(new Date());
                         renovationPartsDetailService.updateById(renovationPartsDetailEntity);
                     }
@@ -79,7 +79,7 @@ public class SnycBuild {
                     //定制
                     customProductEntity = customProductService.findById(id);
                     if (ObjectUtil.isNotNull(customProductEntity)) {
-                        customProductEntity.setExamine(1);
+                        customProductEntity.setExamine(2);
                         customProductEntity.setExamineTime(new Date());
                         customProductService.updateById(customProductEntity);
                     }
@@ -88,7 +88,7 @@ public class SnycBuild {
                     //组件
                     componentEntity = customComponentService.findById(id);
                     if (ObjectUtil.isNotNull(componentEntity)) {
-                        componentEntity.setExamine(1);
+                        componentEntity.setExamine(2);
                         componentEntity.setExamineTime(new Date());
                         customComponentService.updateById(componentEntity);
                     }

+ 5 - 5
sxz-core/src/main/java/com/fdkk/sxz/other/mq/TopicRabbitConfig.java

@@ -23,17 +23,17 @@ public class TopicRabbitConfig {
 //
 //    public final static String TOPICE = "topicExchangeCopy";
 
-    public final static String CHANGE = "topic.chang";
+    public final static String CHANGE = "topic.chang.dev";
     //灯光预览
-    public final static String LIGHT = "topic.light";
+    public final static String LIGHT = "topic.light.dev";
 
-    public final static String MODEL = "topic.model";
+    public final static String MODEL = "topic.model.dev";
 
     //"更新模型库,syncmodel
-    public final static String SYNCMODEL = "topic.syncmodel";
+    public final static String SYNCMODEL = "topic.syncmodel.dev";
 
     //处理
-    public final static String MVIEW = "delay.mview";
+    public final static String MVIEW = "delay.mview.dev";
 
     public final static String TOPICE = "topicExchange";
     /**

+ 18 - 0
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ImportDataController.java

@@ -188,7 +188,25 @@ public class ImportDataController extends BaseController {
             }
             ImportDataController.log.info("下载vision.modeldata完成,开始转换vision.txt");
             CreateObjUtil.convertVisionmodeldataToTxt(filePath + "vision.modeldata", filePath + "vision.txt");
+            JSONObject visionJson = JSON.parseObject(FileUtils.readFile(filePath + "/vision.txt"));
+
+            JSONArray sweepArray = visionJson.getJSONArray("sweepLocations");
+            JSONArray roamingPoint = new JSONArray();
+            for (int i = 0; i < sweepArray.size(); i++) {
+                JSONObject objectJson = sweepArray.getJSONObject(i);
+                JSONObject newJson = new JSONObject();
+                newJson.put("uuid", objectJson.getString("uuid"));
+                JSONObject puck = objectJson.getJSONObject("puck");
+                puck.put("y", puck.getDoubleValue("y") * -1);
+                puck.remove("z");
+                newJson.put("puck", puck);
+                roamingPoint.add(newJson);
+            }
+            FileUtils.writeFile(filePath + File.separator + "roamingPoint.json", roamingPoint.toJSONString());
 
+            //数据上传oss,让计算服务器下载资源
+            uploadToOssUtil.upload(filePath + File.separator + "roamingPoint.json",
+                    "data/data" + sceneNum + "/roamingPoint.json");
 
             //计算translationAverage,和puckAverage并重新赋予值
             Map<String, Double> averageMap = ConvertCadKjl.getAverageValue(filePath + "vision.txt");

+ 79 - 50
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/ManagerController.java

@@ -32,6 +32,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -501,6 +502,33 @@ public class ManagerController extends BaseController {
     }
 
     /**
+     * 删除模型详情
+     *
+     * @return
+     */
+    @ApiOperation("删除模型详情")
+    @RequestMapping(value = "/removeModelDetail", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "ids", value = "id集合", dataType = "List")})
+    @NoAuthentication
+    @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
+    public Result removeModelDetail(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getIds() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        param.getIds().forEach(a -> {
+            boolean removeById = renovationPartsDetailService.removeById(a);
+            ManagerController.log.info("删除renovationPartsDetailEntity-{}", removeById);
+            ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(a);
+            if (modelUploadEntity != null) {
+                modelUploadService.removeById(modelUploadEntity.getId());
+            }
+        });
+        return Result.success();
+    }
+
+
+    /**
      * 修改模型详情(编辑,是否显示,删除)
      *
      * @return
@@ -755,67 +783,68 @@ public class ManagerController extends BaseController {
     @RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
-            @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
+            @ApiImplicitParam(name = "examine", value = "0未审核  1审核中   2审核通过 -1审核失败  ", dataType = "String")})
     @NoAuthentication
     @AroundLog(name = "更新模型审核状态")
     @Transactional(rollbackFor = BusinessException.class)
     public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) throws IOException {
-        if (param.getId() == null || param.getExamine() == null) {
+        if (param.getIds() == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
         }
-
-        RenovationPartsDetailEntity renovationPartsDetailEntity = renovationPartsDetailService.findById(param.getId());
-        renovationPartsDetailEntity.setId(param.getId());
-
-        if (param.getExamine().intValue() == 1) {
-            ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(param.getId());
-            if (ObjectUtil.isNotNull(modelUploadEntity)) {
-                //入库前先提交模型到模型库,失败返回提示
-                String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
-                JSONObject jsonObject = new JSONObject();
-                JSONArray array = new JSONArray();
-                JSONObject object = new JSONObject();
-                object.put("Name", renovationPartsDetailEntity.getName());
-                object.put("UserID", modelUploadEntity.getUserId());
-                String postfix = "datasmith";
-                if (modelUploadEntity.getFileType() == 0) {
-                    postfix = "fbx";
-                }
-                object.put("Postfix", postfix);
-                object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
-                array.add(object);
-                jsonObject.put("version", version);
-
-
-                //  TODO 使用队列操作
-                ManagerController.log.info("更新模型库,syncmodel接口参数:" + jsonObject.toJSONString());
-                uploadToOssUtil.uploadTo4dTjw(array.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
-                        version + "/SyncData.json");
-                String message = param.getId() + ":;" + "1" + ":;" + jsonObject.toString();
-                rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
-
-                uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""),
-                        renovationPartsDetailEntity.getImg().replace("/temp/", "/models/").replace(prefix, ""));
-                uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""),
-                        renovationPartsDetailEntity.getPath().replace("/temp/", "/models/").replace(prefix, ""));
-                if (ObjectUtil.isNotNull(renovationPartsDetailEntity.getMviewPath())) {
-                    uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""),
-                            renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/").replace(prefix, ""));
-                    uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""));
-                    renovationPartsDetailEntity.setMviewPath(renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/"));
+        if (!CollectionUtils.isEmpty(param.getIds())) {
+            for (Long id : param.getIds()) {
+                RenovationPartsDetailEntity renovationPartsDetailEntity = renovationPartsDetailService.findById(id);
+                renovationPartsDetailEntity.setId(id);
+                renovationPartsDetailEntity.setExamine(1);
+                ModelUploadEntity modelUploadEntity = modelUploadService.findByPartsDetailId(id);
+                if (ObjectUtil.isNotNull(modelUploadEntity)) {
+                    //入库前先提交模型到模型库,失败返回提示
+                    String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
+                    JSONObject jsonObject = new JSONObject();
+                    JSONArray array = new JSONArray();
+                    JSONObject object = new JSONObject();
+                    object.put("Name", renovationPartsDetailEntity.getName());
+                    object.put("UserID", modelUploadEntity.getUserId());
+                    String postfix = "datasmith";
+                    if (modelUploadEntity.getFileType() == 0) {
+                        postfix = "fbx";
+                    }
+                    object.put("Postfix", postfix);
+                    object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
+                    array.add(object);
+                    jsonObject.put("version", version);
+
+
+                    //  TODO 使用队列操作
+                    ManagerController.log.info("更新模型库,syncmodel接口参数:" + jsonObject.toJSONString());
+                    uploadToOssUtil.uploadTo4dTjw(array.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
+                            version + "/SyncData.json");
+                    String message = param.getId() + ":;" + "1" + ":;" + jsonObject.toString();
+                    rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
+
+                    uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""),
+                            renovationPartsDetailEntity.getImg().replace("/temp/", "/models/").replace(prefix, ""));
+                    uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""),
+                            renovationPartsDetailEntity.getPath().replace("/temp/", "/models/").replace(prefix, ""));
+                    if (ObjectUtil.isNotNull(renovationPartsDetailEntity.getMviewPath())) {
+                        uploadToOssUtil.copyTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""),
+                                renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/").replace(prefix, ""));
+                        uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getMviewPath().replace(prefix, ""));
+                        renovationPartsDetailEntity.setMviewPath(renovationPartsDetailEntity.getMviewPath().replace("/temp/", "/models/"));
+                    }
+
+                    uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""));
+                    uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""));
+
+                    renovationPartsDetailEntity.setImg(renovationPartsDetailEntity.getImg().replace("/temp/", "/models/"));
+                    renovationPartsDetailEntity.setHighImg(renovationPartsDetailEntity.getHighImg().replace("/temp/", "/models/"));
+                    renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
                 }
 
-                uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getImg().replace(prefix, ""));
-                uploadToOssUtil.deleteTo4dTjw(renovationPartsDetailEntity.getPath().replace(prefix, ""));
-
-                renovationPartsDetailEntity.setImg(renovationPartsDetailEntity.getImg().replace("/temp/", "/models/"));
-                renovationPartsDetailEntity.setHighImg(renovationPartsDetailEntity.getHighImg().replace("/temp/", "/models/"));
-                renovationPartsDetailEntity.setPath(renovationPartsDetailEntity.getPath().replace("/temp/", "/models/"));
+                renovationPartsDetailService.updateById(renovationPartsDetailEntity);
             }
         }
 
-        renovationPartsDetailService.updateById(renovationPartsDetailEntity);
-
 
         return Result.success();
     }

+ 23 - 2
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/ComponetManagerController.java

@@ -139,12 +139,12 @@ public class ComponetManagerController extends BaseController {
     @RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
-            @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
+            @ApiImplicitParam(name = "examine", value = "0未审核  1审核中   2审核通过 -1审核失败  ", dataType = "String")})
     @NoAuthentication
     @AroundLog(name = "更新模型审核状态")
     @Transactional(rollbackFor = BusinessException.class)
     public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) throws IOException {
-        if (param.getId() == null || param.getExamine() == null) {
+        if (param.getId() == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
         }
         return customComponentService.updatePartsDetailExamine(param);
@@ -305,6 +305,27 @@ public class ComponetManagerController extends BaseController {
     }
 
     /**
+     * 删除模型详情
+     *
+     * @return
+     */
+    @ApiOperation("删除模型详情")
+    @RequestMapping(value = "/removeModelDetail", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "ids", value = "id集合", dataType = "List")})
+    @NoAuthentication
+    @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
+    public Result removeModelDetail(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getIds() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        param.getIds().forEach(a -> {
+            Boolean removeFlag = customComponentService.removeById(a);
+        });
+        return Result.success();
+    }
+
+    /**
      * 修改模型详情(编辑,是否显示,删除)
      *
      * @return

+ 35 - 2
sxz-core/src/main/java/com/fdkk/sxz/webApi/controller/custom/CustomManagerController.java

@@ -137,11 +137,11 @@ public class CustomManagerController extends BaseController {
     @RequestMapping(value = "/updatePartsDetailExamine", method = RequestMethod.POST)
     @ApiImplicitParams({
             @ApiImplicitParam(name = "id", value = "模型id", dataType = "String"),
-            @ApiImplicitParam(name = "examine", value = "审核,0审核中,1审核通过,-1审核失败", dataType = "String")})
+            @ApiImplicitParam(name = "examine", value = "0未审核  1审核中   2审核通过 -1审核失败  ", dataType = "String")})
     @NoAuthentication
     @AroundLog(name = "更新模型审核状态")
     public Result updatePartsDetailExamine(@RequestBody RequestRenovationPartsDetailManager param) throws IOException {
-        if (param.getId() == null || param.getExamine() == null) {
+        if (param.getIds() == null) {
             return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
         }
         return productService.updatePartsDetailExamine(param);
@@ -266,6 +266,39 @@ public class CustomManagerController extends BaseController {
     }
 
     /**
+     * 删除模型详情
+     *
+     * @return
+     */
+    @ApiOperation("删除模型详情")
+    @RequestMapping(value = "/removeModelDetail", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "ids", value = "id集合", dataType = "List")})
+    @NoAuthentication
+    @AroundLog(name = "修改模型详情(编辑,是否显示,删除)")
+    public Result removeModelDetail(@RequestBody RequestRenovationPartsDetailManager param) {
+        if (param.getIds() == null) {
+            return Result.failure(CodeConstant.FAILURE_CODE_3001, CodeConstant.FAILURE_MSG_3001);
+        }
+        param.getIds().forEach(a -> {
+            CustomProductEntity entity = productService.findById(a);
+            Boolean removeFlag = productService.removeById(entity);
+            if (removeFlag && ObjectUtil.isNotNull(entity.getComponentTypeIds())) {
+                JSONArray components = JSONArray.parseArray(entity.getComponentTypeIds());
+                //获取每个配件加入集合
+                components.forEach(c -> {
+                    Long id = Long.valueOf((String) c);
+                    CustomComponentEntity componentEntity = customComponentService.findById(id);
+                    if (ObjectUtil.isNotNull(componentEntity)) {
+                        customComponentService.removeById(id);
+                    }
+                });
+            }
+        });
+        return Result.success();
+    }
+
+    /**
      * 修改模型详情(编辑,是否显示,删除)
      *
      * @return

+ 2 - 2
sxz-core/src/main/java/com/fdkk/sxz/webApi/mapper/IRenovationPartsDetailMapper.java

@@ -21,7 +21,7 @@ public interface IRenovationPartsDetailMapper extends IBaseMapper<RenovationPart
     @Select("<script>" +
             "select id, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, parts_type_id as partsTypeId, has_toolbag as hasToolbag ,mview_path as " +
             "mviewPath , other_file_url as  otherFileUrl " +
-            "from tb_renovation_parts_detail where parts_type_id = #{partsTypeId} and rec_status = 'A' and is_show = 1 and examine = 1" +
+            "from tb_renovation_parts_detail where parts_type_id = #{partsTypeId} and rec_status = 'A' and is_show = 1 and examine = 2" +
             "<if test= 'colorId != null'> " +
             " and parts_color_id = #{colorId} " +
             "</if> " +
@@ -38,7 +38,7 @@ public interface IRenovationPartsDetailMapper extends IBaseMapper<RenovationPart
 
     @Select("select id,parts_type_id AS partsTypeId, key_word as keyWord, type, description, img, high_img as highImg, path, name, zh_name as zhName, has_toolbag as hasToolbag ,mview_path as " +
             "mviewPath ,other_file_url as  otherFileUrl from " +
-            "tb_renovation_parts_detail where key_word like CONCAT('%', #{keyWord}, '%') and rec_status = 'A' and is_show = 1 and examine = 1 ")
+            "tb_renovation_parts_detail where key_word like CONCAT('%', #{keyWord}, '%') and rec_status = 'A' and is_show = 1 and examine = 2 ")
     List<ResponseRenovationPartsDetail> findByKeyWord(String keyWord);
 
     @Select("<script> " +

+ 32 - 25
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomComponentServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
 import java.util.List;
@@ -119,7 +120,7 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
         if (ObjectUtil.isNotNull(param.getParentId())) {
             wrapper.eq(CustomComponentEntity::getComponentTypeId, param.getParentId());
         }
-        wrapper.eq(CustomComponentEntity::getExamine, 1);
+        wrapper.eq(CustomComponentEntity::getExamine, 2);
         wrapper.eq(CustomComponentEntity::getIsShow, 1);
         return list(wrapper).stream().map(a -> {
             ResponseCustomComponent customComponent = new ResponseCustomComponent();
@@ -136,31 +137,37 @@ public class CustomComponentServiceImpl extends BaseServiceImpl<ICustomComponent
     @Override
     @Transactional(rollbackFor = BusinessException.class)
     public Result updatePartsDetailExamine(RequestRenovationPartsDetailManager param) throws IOException {
-        CustomComponentEntity componentEntity = findById(param.getId());
-        if (ObjectUtil.isNotNull(componentEntity)) {
-            ComponentModelUploadEntity modelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
-            if (ObjectUtil.isNotNull(modelUploadEntity)) {
-                //入库前先提交模型到模型库,失败返回提示
-                JSONArray syncDataArray = new JSONArray();
-                JSONObject object = new JSONObject();
-                object.put("Name", modelUploadEntity.getFileId());
-                object.put("UserID", modelUploadEntity.getUserId());
-                object.put("Postfix", "datasmith");
-                object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
-                syncDataArray.add(object);
-
-                JSONObject jsonObject = new JSONObject();
-                String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
-                CustomComponentServiceImpl.log.info("更新模型库,syncmodel接口参数:");
-                uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
-                        version + "/SyncData.json");
-                CustomComponentServiceImpl.log.info("上传完成SyncData.jsn:" + version);
-                jsonObject.put("version", version);
-                String message = param.getId() + ":;" + "3" + ":;" + jsonObject.toString();
-                rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
-
+        if (!CollectionUtils.isEmpty(param.getIds())) {
+            for (Long id : param.getIds()) {
+                CustomComponentEntity componentEntity = findById(id);
+                if (ObjectUtil.isNotNull(componentEntity)) {
+                    componentEntity.setExamine(1);
+                    ComponentModelUploadEntity modelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
+                    if (ObjectUtil.isNotNull(modelUploadEntity)) {
+                        //入库前先提交模型到模型库,失败返回提示
+                        JSONArray syncDataArray = new JSONArray();
+                        JSONObject object = new JSONObject();
+                        object.put("Name", modelUploadEntity.getFileId());
+                        object.put("UserID", modelUploadEntity.getUserId());
+                        object.put("Postfix", "datasmith");
+                        object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + modelUploadEntity.getFileId());
+                        syncDataArray.add(object);
+
+                        JSONObject jsonObject = new JSONObject();
+                        String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
+                        CustomComponentServiceImpl.log.info("更新模型库,syncmodel接口参数:");
+                        uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
+                                version + "/SyncData.json");
+                        CustomComponentServiceImpl.log.info("上传完成SyncData.jsn:" + version);
+                        jsonObject.put("version", version);
+                        String message = id + ":;" + "3" + ":;" + jsonObject.toString();
+                        rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
+
+                    }
+                    updateById(componentEntity);
+                }
             }
-            return Result.success(updateById(componentEntity));
+
         }
         return Result.success();
     }

+ 42 - 38
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/custom/impl/CustomProductServiceImpl.java

@@ -40,6 +40,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -109,7 +110,7 @@ public class CustomProductServiceImpl extends BaseServiceImpl<ICustomProductMapp
             wrapper.eq(CustomProductEntity::getParentId, param.getParentId());
         }
         wrapper.eq(CustomProductEntity::getIsShow, 1);
-        wrapper.eq(CustomProductEntity::getExamine, 1);
+        wrapper.eq(CustomProductEntity::getExamine, 2);
         List<CustomProductEntity> list = this.list(wrapper);
         List<ResponseCustomProduct> bList = list.stream().map(a -> {
             //在此转把A转换为B
@@ -155,47 +156,50 @@ public class CustomProductServiceImpl extends BaseServiceImpl<ICustomProductMapp
     @Override
     @Transactional(rollbackFor = BusinessException.class)
     public Result updatePartsDetailExamine(RequestRenovationPartsDetailManager param) throws IOException {
-        CustomProductEntity customProductEntity = findById(param.getId());
-        customProductEntity.setExamine(param.getExamine());
-        customProductEntity.setExamineTime(new Date());
-        boolean updateFlag = updateById(customProductEntity);
-        JSONArray syncDataArray = new JSONArray();
-        if (updateFlag && ObjectUtil.isNotNull(customProductEntity.getComponentTypeIds())) {
-            JSONArray components = JSONArray.parseArray(customProductEntity.getComponentTypeIds());
-            //获取每个配件加入集合
-            components.forEach(c -> {
-                Long id = Long.valueOf((String) c);
-                CustomComponentEntity componentEntity = customComponentService.findById(id);
-                if (ObjectUtil.isNotNull(componentEntity)) {
-                    //入库前先提交模型到模型库,失败返回提示
-                    ComponentModelUploadEntity componentModelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
-                    if (ObjectUtil.isNotNull(componentModelUploadEntity)) {
-                        JSONObject object = new JSONObject();
-                        object.put("Name", componentModelUploadEntity.getFileId());
-                        object.put("UserID", componentModelUploadEntity.getUserId());
-                        object.put("Postfix", "datasmith");
-                        object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + componentModelUploadEntity.getFileId());
-                        syncDataArray.add(object);
-                    }
-                    componentEntity.setExamine(param.getExamine());
-                    componentEntity.setExamineTime(new Date());
-                    customComponentService.updateById(componentEntity);
+        if (!CollectionUtils.isEmpty(param.getIds())) {
+            for (Long id : param.getIds()) {
+                CustomProductEntity customProductEntity = findById(id);
+                customProductEntity.setExamine(1);
+                customProductEntity.setExamineTime(new Date());
+                boolean updateFlag = updateById(customProductEntity);
+                JSONArray syncDataArray = new JSONArray();
+                if (updateFlag && ObjectUtil.isNotNull(customProductEntity.getComponentTypeIds())) {
+                    JSONArray components = JSONArray.parseArray(customProductEntity.getComponentTypeIds());
+                    //获取每个配件加入集合
+                    components.forEach(c -> {
+                        Long componentEntityId = Long.valueOf((String) c);
+                        CustomComponentEntity componentEntity = customComponentService.findById(componentEntityId);
+                        if (ObjectUtil.isNotNull(componentEntity)) {
+                            //入库前先提交模型到模型库,失败返回提示
+                            ComponentModelUploadEntity componentModelUploadEntity = componentModelUploadService.findByPartsDetailId(componentEntity.getId());
+                            if (ObjectUtil.isNotNull(componentModelUploadEntity)) {
+                                JSONObject object = new JSONObject();
+                                object.put("Name", componentModelUploadEntity.getFileId());
+                                object.put("UserID", componentModelUploadEntity.getUserId());
+                                object.put("Postfix", "datasmith");
+                                object.put("ObjAliPath", "domain/eHome/furniture/simpleObj-Mtl/" + componentModelUploadEntity.getFileId());
+                                syncDataArray.add(object);
+                            }
+                            componentEntity.setExamine(1);
+                            componentEntity.setExamineTime(new Date());
+                            customComponentService.updateById(componentEntity);
+                        }
+                    });
                 }
-            });
+                JSONObject jsonObject = new JSONObject();
+                String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
+                CustomProductServiceImpl.log.info("更新模型库,syncmodel接口参数:" + syncDataArray.toJSONString());
+                uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
+                        version + "/SyncData.json");
+                CustomProductServiceImpl.log.info("上传完成SyncData.jsn:" + version);
+                jsonObject.put("version", version);
+
+                String message = id + ":;" + "2" + ":;" + jsonObject.toString();
+                rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
+            }
         }
 
-        if (param.getExamine().intValue() == 1) {
-            JSONObject jsonObject = new JSONObject();
-            String version = SnowFlakeUUidUtils.generaUUid(null, null, null);
-            CustomProductServiceImpl.log.info("更新模型库,syncmodel接口参数:" + syncDataArray.toJSONString());
-            uploadToOssUtil.uploadTo4dTjw(syncDataArray.toJSONString().getBytes(), "domain/eHome/furniture/syncdata/" +
-                    version + "/SyncData.json");
-            CustomProductServiceImpl.log.info("上传完成SyncData.jsn:" + version);
-            jsonObject.put("version", version);
 
-            String message = param.getId() + ":;" + "2" + ":;" + jsonObject.toString();
-            rabbitTemplate.convertAndSend(TopicRabbitConfig.TOPICE, TopicRabbitConfig.SYNCMODEL, message);
-        }
         return Result.success();
     }
 

+ 5 - 3
sxz-core/src/main/java/com/fdkk/sxz/webApi/service/impl/ModelUploadServiceImpl.java

@@ -160,7 +160,8 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
                     JSONArray ids = new JSONArray();
                     //处理配件
                     ModelUploadServiceImpl.log.info("保存配件");
-                    if (ObjectUtil.isNotNull(param.getComponentSlots())) {
+                    Boolean saveFlag = customProductService.save(entity);
+                    if (ObjectUtil.isNotNull(param.getComponentSlots()) && saveFlag) {
                         for (RequestModelCustomUpload.Component componentSlot : param.getComponentSlots()) {
                             ComponentModelUploadEntity componentModel = componentModelUploadService.findById(componentSlot.getId());
                             if (ObjectUtil.isNotNull(componentModel)) {
@@ -199,6 +200,7 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
                                 //obj转换成glb格式
                                 ModelUploadServiceImpl.log.info("上传obj到simpleObj-Mtl结束");
                                 customComponentEntity.setMviewStatus(1);
+                                customComponentEntity.setCustomProductId(entity.getId());
                                 Boolean componentSaveFlag = customComponentService.save(customComponentEntity);
                                 if (componentSaveFlag) {
                                     componentModel.setPartsDetailId(customComponentEntity.getId());
@@ -238,8 +240,8 @@ public class ModelUploadServiceImpl extends BaseServiceImpl<IModelUploadMapper,
                         }
                     }
                     entity.setComponentTypeIds(ids.toString());
-                    Boolean saveFlag = customProductService.save(entity);
-                    if (saveFlag) {
+                    Boolean updateById = customProductService.updateById(entity);
+                    if (updateById) {
                         modelUploadEntity.setPartsDetailId(entity.getId());
                         modelUploadService.updateById(modelUploadEntity);
                     }

+ 1 - 0
sxz-modules/src/main/java/com/fdkk/sxz/entity/RenovationPartsDetailEntity.java

@@ -64,6 +64,7 @@ public class RenovationPartsDetailEntity extends BaseEntity {
     @TableField("is_show")
     private Integer isShow;
 
+    //,0未审核 1审核中,2审核通过,-1审核失败
     @TableField("examine")
     private Integer examine;
 

+ 7 - 2
sxz-modules/src/main/java/com/fdkk/sxz/entity/custuom/CustomComponentEntity.java

@@ -129,14 +129,19 @@ public class CustomComponentEntity extends BaseEntity {
     private Integer isShow;
 
     @TableField("examine")
-    @ApiModelProperty(value = "审核,0审核中,1审核通过", name = "depth")
+    @ApiModelProperty(value = "0未审核  1审核中   2审核通过 -1审核失败  ", name = "depth")
     private Integer examine;
 
     @TableField("examine_time")
     @ApiModelProperty(value = "审核时间", name = "depth")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date examineTime;
-    
+
     @TableField("mview_status")
     private Integer mviewStatus;
+
+
+    @TableField("custom_product_id")
+    @ApiModelProperty(value = "tb_custom_product 表的id", name = "customProductId")
+    private Long customProductId;
 }

+ 6 - 1
sxz-modules/src/main/java/com/fdkk/sxz/vo/request/RequestRenovationPartsDetailManager.java

@@ -3,6 +3,8 @@ package com.fdkk.sxz.vo.request;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * Created by Hb_zzZ on 2020/12/16.
  */
@@ -63,7 +65,7 @@ public class RequestRenovationPartsDetailManager {
     @ApiModelProperty(value = "0不显示,1显示", name = "isShow")
     private Integer isShow;
 
-    @ApiModelProperty(value = "审核,0审核中,1审核通过,-1审核失败", name = "examine")
+    @ApiModelProperty(value = "0未审核  1审核中   2审核通过 -1审核失败 ", name = "examine")
     private Integer examine;
 
     @ApiModelProperty(value = "I删除", name = "recStatus")
@@ -80,4 +82,7 @@ public class RequestRenovationPartsDetailManager {
 
     @ApiModelProperty(value = "z", name = "z")
     private Integer z;
+
+    @ApiModelProperty(value = "z", name = "z")
+    private List<Long> ids;
 }