Prechádzať zdrojové kódy

feat: 可靠性预计

NickOooo 1 mesiac pred
rodič
commit
63fbc208bd

+ 4 - 0
nationrel-module-rp-api/src/main/java/com/nationrel/modules/rp/enums/CategpryEnums.java

@@ -13,6 +13,10 @@ public enum CategpryEnums {
 
     OPTIONS("6", "子表格"),
 
+    CHILDREN_LABEL("8", "子表单"),
+
+    CHILDREN_FORM("9", "子表单卡片标题"),
+
 
     INPUT("1", "输入"),
     OUTPUT("2", "输出"),

+ 2 - 0
nationrel-module-rp-api/src/main/java/com/nationrel/modules/rp/model/PredictionCategoryModel.java

@@ -20,4 +20,6 @@ public class PredictionCategoryModel extends PredictionCategory {
     private List<PredictionCategoryChildrenModel> children;
 
     private String categoryValue;
+
+    private List<PredictionCategoryModel> childrenForm;
 }

+ 54 - 30
nationrel-module-rp-biz/src/main/java/com/nationrel/modules/rp/service/impl/PredictionCategoryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.nationrel.modules.rp.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.j2objc.annotations.AutoreleasePool;
 import com.nationrel.modules.rp.aop.UpdatePrediction;
@@ -101,36 +102,24 @@ public class PredictionCategoryServiceImpl extends ServiceImpl<PredictionCategor
                 item.getIoType().equals(CategpryEnums.INPUT.getValue())).map(item -> {
             PredictionCategoryModel predictionCategoryModel = new PredictionCategoryModel();
             BeanUtils.copyProperties(item, predictionCategoryModel);
-            List<PredictionCategory> selectList = predictionCategoryMapper.selectList(new LambdaQueryWrapper<PredictionCategory>()
-                    .eq(PredictionCategory::getParentCode, item.getCode())
-                    .eq(PredictionCategory::getIoType, CategpryEnums.INPUT.getValue()));
-            selectList.forEach(child -> {
-                if (child.getCategoryType().equals(CategpryEnums.SELECT.getValue()) || child.getCategoryType().equals(CategpryEnums.FIELD.getValue())) {
-                    List<PredictionCategoryChildrenModel> childrenModelList = selectList.stream().map(select -> {
-                        PredictionCategoryChildrenModel categoryChildrenModel = new PredictionCategoryChildrenModel();
-                        categoryChildrenModel.setCode(select.getCode());
-                        categoryChildrenModel.setName(select.getValue());
-                        categoryChildrenModel.setSelectPlaceholder(select.getSelectPlaceholder());
-                        categoryChildrenModel.setParentCode(select.getParentCode());
-                        categoryChildrenModel.setRelationItem(select.getRelationItem());
-                        return categoryChildrenModel;
-                    }).toList();
-                    predictionCategoryModel.setChildren(childrenModelList);
-                } else if (child.getCategoryType().equals(CategpryEnums.OPTIONS.getValue())) {
-                    List<PredictionCategoryOptions> predictionCategoryOptions = predictionCategoryOptionsMapper.selectList(new LambdaQueryWrapper<PredictionCategoryOptions>()
-                            .eq(PredictionCategoryOptions::getParentCode, child.getValue()));
-                    List<PredictionCategoryChildrenModel> childrenModelList = predictionCategoryOptions.stream().map(options -> {
-                        PredictionCategoryChildrenModel categoryChildrenModel = new PredictionCategoryChildrenModel();
-                        categoryChildrenModel.setCode(options.getCode());
-                        categoryChildrenModel.setName(options.getName());
-                        categoryChildrenModel.setReference(options.getReference());
-                        categoryChildrenModel.setParentCode(options.getParentCode());
-                        categoryChildrenModel.setSelectPlaceholder(options.getPlaceholder());
-                        return categoryChildrenModel;
-                    }).toList();
-                    predictionCategoryModel.setChildren(childrenModelList);
-                }
-            });
+
+            if (item.getCategoryType().equals(CategpryEnums.CHILDREN_FORM.getValue())) {
+                List<PredictionCategory> childList = predictionCategoryMapper.selectList(new LambdaQueryWrapper<PredictionCategory>()
+                        .eq(PredictionCategory::getParentCode, item.getCode())
+                        .eq(PredictionCategory::getIoType, CategpryEnums.INPUT.getValue()));
+                List<PredictionCategoryModel> childrenModelList = childList.stream().map(select -> {
+                    PredictionCategoryModel childPredictionCategoryModel = new PredictionCategoryModel();
+                    BeanUtils.copyProperties(select, childPredictionCategoryModel);
+                    this.getChildForm(select.getCode(), childPredictionCategoryModel);
+//                    childPredictionCategoryModel.setChildren(Lists.newArrayList());
+                    return childPredictionCategoryModel;
+                }).toList();
+                predictionCategoryModel.setChildrenForm(childrenModelList);
+                predictionCategoryModel.setChildren(Lists.newArrayList());
+            } else {
+                this.getChildForm(item.getCode(), predictionCategoryModel);
+            }
+
             if (StringUtils.isNotEmpty(relationMap.get(item.getId()))) {
                 predictionCategoryModel.setCategoryValue(relationMap.get(item.getId()));
             }
@@ -140,6 +129,41 @@ public class PredictionCategoryServiceImpl extends ServiceImpl<PredictionCategor
         return predictionCategoryFormResp;
     }
 
+    private PredictionCategoryModel getChildForm(String code, PredictionCategoryModel predictionCategoryModel) {
+        List<PredictionCategory> selectList = predictionCategoryMapper.selectList(new LambdaQueryWrapper<PredictionCategory>()
+                .eq(PredictionCategory::getParentCode, code)
+                .eq(PredictionCategory::getIoType, CategpryEnums.INPUT.getValue()));
+        selectList.forEach(child -> {
+            if (child.getCategoryType().equals(CategpryEnums.SELECT.getValue()) ||
+                    child.getCategoryType().equals(CategpryEnums.FIELD.getValue())) {
+                List<PredictionCategoryChildrenModel> childrenModelList = selectList.stream().map(select -> {
+                    PredictionCategoryChildrenModel categoryChildrenModel = new PredictionCategoryChildrenModel();
+                    categoryChildrenModel.setCode(select.getCode());
+                    categoryChildrenModel.setName(select.getValue());
+                    categoryChildrenModel.setSelectPlaceholder(select.getSelectPlaceholder());
+                    categoryChildrenModel.setParentCode(select.getParentCode());
+                    categoryChildrenModel.setRelationItem(select.getRelationItem());
+                    return categoryChildrenModel;
+                }).toList();
+                predictionCategoryModel.setChildren(childrenModelList);
+            } else if (child.getCategoryType().equals(CategpryEnums.OPTIONS.getValue())) {
+                List<PredictionCategoryOptions> predictionCategoryOptions = predictionCategoryOptionsMapper.selectList(new LambdaQueryWrapper<PredictionCategoryOptions>()
+                        .eq(PredictionCategoryOptions::getParentCode, child.getValue()));
+                List<PredictionCategoryChildrenModel> childrenModelList = predictionCategoryOptions.stream().map(options -> {
+                    PredictionCategoryChildrenModel categoryChildrenModel = new PredictionCategoryChildrenModel();
+                    categoryChildrenModel.setCode(options.getCode());
+                    categoryChildrenModel.setName(options.getName());
+                    categoryChildrenModel.setReference(options.getReference());
+                    categoryChildrenModel.setParentCode(options.getParentCode());
+                    categoryChildrenModel.setSelectPlaceholder(options.getPlaceholder());
+                    return categoryChildrenModel;
+                }).toList();
+                predictionCategoryModel.setChildren(childrenModelList);
+            }
+        });
+        return predictionCategoryModel;
+    }
+
     /**
      * @Description 保存/更新类别表单关系表
      * @param predictionTableCategoryRelation