|
@@ -1,6 +1,7 @@
|
|
package com.nationrel.modules.rp.service.impl;
|
|
package com.nationrel.modules.rp.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
+import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.j2objc.annotations.AutoreleasePool;
|
|
import com.google.j2objc.annotations.AutoreleasePool;
|
|
import com.nationrel.modules.rp.aop.UpdatePrediction;
|
|
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 -> {
|
|
item.getIoType().equals(CategpryEnums.INPUT.getValue())).map(item -> {
|
|
PredictionCategoryModel predictionCategoryModel = new PredictionCategoryModel();
|
|
PredictionCategoryModel predictionCategoryModel = new PredictionCategoryModel();
|
|
BeanUtils.copyProperties(item, 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()))) {
|
|
if (StringUtils.isNotEmpty(relationMap.get(item.getId()))) {
|
|
predictionCategoryModel.setCategoryValue(relationMap.get(item.getId()));
|
|
predictionCategoryModel.setCategoryValue(relationMap.get(item.getId()));
|
|
}
|
|
}
|
|
@@ -140,6 +129,41 @@ public class PredictionCategoryServiceImpl extends ServiceImpl<PredictionCategor
|
|
return predictionCategoryFormResp;
|
|
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 保存/更新类别表单关系表
|
|
* @Description 保存/更新类别表单关系表
|
|
* @param predictionTableCategoryRelation
|
|
* @param predictionTableCategoryRelation
|