|
@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
@@ -50,12 +51,12 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
return sourceDataDTO;
|
|
|
}
|
|
|
|
|
|
- public List<CustomAnalysisItemSource> getItemSourceList(String uid, String dimension, Integer fieldId, Integer expandId) {
|
|
|
+ public List<CustomAnalysisItemSource> getItemSourceList(String uid, String dimension, String field, String expand) {
|
|
|
LambdaQueryWrapper<CustomAnalysisItemSource> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(CustomAnalysisItemSource::getUid, uid);
|
|
|
queryWrapper.eq(CustomAnalysisItemSource::getDimension, dimension);
|
|
|
- queryWrapper.eq(CustomAnalysisItemSource::getFieldId, fieldId);
|
|
|
- queryWrapper.eq(CustomAnalysisItemSource::getExpandId, expandId);
|
|
|
+ queryWrapper.eq(CustomAnalysisItemSource::getField, field);
|
|
|
+ queryWrapper.eq(CustomAnalysisItemSource::getExpand, expand);
|
|
|
return this.list(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -63,14 +64,17 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
list.forEach(item -> {
|
|
|
item.setUid(null);
|
|
|
item.setDimension(null);
|
|
|
- item.setFieldId(null);
|
|
|
- item.setExpandId(null);
|
|
|
+ item.setField(null);
|
|
|
+ item.setExpand(null);
|
|
|
item.setCreateTime(null);
|
|
|
item.setUpdateTime(null);
|
|
|
item.setStatus(null);
|
|
|
item.setId(null);
|
|
|
item.setCreateId(null);
|
|
|
item.setCreateName(null);
|
|
|
+ item.setName(null);
|
|
|
+ item.setNumber(null);
|
|
|
+ item.setTopN(null);
|
|
|
if (StringUtils.isNotEmpty(item.getMaxData())) {
|
|
|
item.setMax(JsonUtils.jsonToPojo(item.getMaxData(), SourceMinAndMaxDataDTO.class));
|
|
|
item.setMaxData(null);
|
|
@@ -88,22 +92,34 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
SourceDataVO x = new SourceDataVO();
|
|
|
SourceDataVO y = new SourceDataVO();
|
|
|
SourceDataDTO sourceDataDTO = vo.getSource();
|
|
|
- if (vo.getSchema().getX().getPtype().equals(3) || vo.getSchema().getX().getPtype().equals(4)
|
|
|
- || vo.getSchema().getX().getType().equals(6)) {
|
|
|
+ Integer xPType = vo.getSchema().getX().getPtype();
|
|
|
+ String xType = vo.getSchema().getX().getType();
|
|
|
+ if ((xPType != null && (xPType.equals(3) || xPType.equals(4))) || (StringUtils.isNotEmpty(xType) && xType.equalsIgnoreCase("tree"))) {
|
|
|
x.setUid(vo.getUid());
|
|
|
x.setDimension("x");
|
|
|
- x.setFieldId(vo.getSchema().getX().getField());
|
|
|
- x.setExpandId(vo.getSchema().getX().getExpand());
|
|
|
+ x.setField(vo.getSchema().getX().getField());
|
|
|
+ x.setExpand(vo.getSchema().getX().getExpand());
|
|
|
+ x.setName(vo.getSchema().getX().getName());
|
|
|
+ x.setNumber(vo.getSchema().getX().getNum());
|
|
|
x.setSource(sourceDataDTO.getX());
|
|
|
+ if (!CollectionUtils.isEmpty(sourceDataDTO.getX())) {
|
|
|
+ x.setSelected(true);
|
|
|
+ }
|
|
|
this.updateSource(x);
|
|
|
}
|
|
|
- if (vo.getSchema().getY().getPtype().equals(3) || vo.getSchema().getY().getPtype().equals(4)
|
|
|
- || vo.getSchema().getY().getType().equals(6)) {
|
|
|
+ Integer yPType = vo.getSchema().getY().getPtype();
|
|
|
+ String yType = vo.getSchema().getY().getType();
|
|
|
+ if ((yPType != null && (yPType.equals(3) || yPType.equals(4))) || (StringUtils.isNotEmpty(yType) && xType.equalsIgnoreCase("tree"))) {
|
|
|
y.setUid(vo.getUid());
|
|
|
y.setDimension("y");
|
|
|
- y.setFieldId(vo.getSchema().getY().getField());
|
|
|
- y.setExpandId(vo.getSchema().getY().getExpand());
|
|
|
+ y.setField(vo.getSchema().getY().getField());
|
|
|
+ y.setExpand(vo.getSchema().getY().getExpand());
|
|
|
+ y.setName(vo.getSchema().getY().getName());
|
|
|
+ y.setNumber(vo.getSchema().getY().getNum());
|
|
|
y.setSource(sourceDataDTO.getY());
|
|
|
+ if (!CollectionUtils.isEmpty(sourceDataDTO.getY())) {
|
|
|
+ y.setSelected(true);
|
|
|
+ }
|
|
|
this.updateSource(y);
|
|
|
}
|
|
|
}
|
|
@@ -128,12 +144,15 @@ public class CustomAnalysisItemSourceService extends ServiceImpl<CustomAnalysisI
|
|
|
if (StringUtils.isNotNull(source.getMin())) {
|
|
|
source.setMinData(JsonUtils.objectToJson(source.getMin()));
|
|
|
}
|
|
|
- source.setFieldId(sourceDataVO.getFieldId());
|
|
|
- source.setExpandId(sourceDataVO.getExpandId());
|
|
|
+ source.setField(sourceDataVO.getField());
|
|
|
+ source.setExpand(sourceDataVO.getExpand());
|
|
|
source.setCreateId(finalPersonnelVO.getId());
|
|
|
source.setCreateName(finalPersonnelVO.getName());
|
|
|
source.setDimension(sourceDataVO.getDimension());
|
|
|
source.setUid(sourceDataVO.getUid());
|
|
|
+ source.setName(sourceDataVO.getName());
|
|
|
+ source.setNumber(sourceDataVO.getNumber());
|
|
|
+ source.setSelected(sourceDataVO.getSelected());
|
|
|
list.add(source);
|
|
|
});
|
|
|
this.saveOrUpdateBatch(list);
|