|
@@ -4,18 +4,30 @@ import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.persagy.dmp.common.constant.ValidEnum;
|
|
import com.persagy.dmp.common.constant.ValidEnum;
|
|
import com.persagy.dmp.common.model.entity.BaseEntity;
|
|
import com.persagy.dmp.common.model.entity.BaseEntity;
|
|
|
|
+import com.persagy.dmp.define.entity.GraphDefine;
|
|
|
|
+import com.persagy.dmp.define.entity.ObjectTypeDefine;
|
|
|
|
+import com.persagy.dmp.define.entity.RelationDefine;
|
|
|
|
+import com.persagy.dmp.delivery.dto.RelationDefineCollectDTO;
|
|
import com.persagy.dmp.delivery.entity.RelationDefineCollect;
|
|
import com.persagy.dmp.delivery.entity.RelationDefineCollect;
|
|
|
|
+import com.persagy.dmp.rwd.define.service.IGraphDefineService;
|
|
|
|
+import com.persagy.dmp.rwd.define.service.IRelationDefineService;
|
|
import com.persagy.dmp.rwd.delivery.dao.RelationDefineCollectMapper;
|
|
import com.persagy.dmp.rwd.delivery.dao.RelationDefineCollectMapper;
|
|
import com.persagy.dmp.rwd.delivery.service.IRelationDefineCollectService;
|
|
import com.persagy.dmp.rwd.delivery.service.IRelationDefineCollectService;
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 项目,现场交付范围管理-关系
|
|
* 项目,现场交付范围管理-关系
|
|
@@ -28,6 +40,12 @@ public class RelationDefineCollectServiceImpl extends ServiceImpl<RelationDefine
|
|
@Autowired
|
|
@Autowired
|
|
private RelationDefineCollectMapper relationDefineCollectMapper;
|
|
private RelationDefineCollectMapper relationDefineCollectMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IRelationDefineService relationDefineService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IGraphDefineService graphDefineService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 数量统计
|
|
* 数量统计
|
|
* @param queryWrapper 查询条件
|
|
* @param queryWrapper 查询条件
|
|
@@ -56,7 +74,64 @@ public class RelationDefineCollectServiceImpl extends ServiceImpl<RelationDefine
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Page queryByCondition(Page page, Wrapper<RelationDefineCollect> queryWrapper) {
|
|
public Page queryByCondition(Page page, Wrapper<RelationDefineCollect> queryWrapper) {
|
|
- return relationDefineCollectMapper.selectPage(page, queryWrapper);
|
|
|
|
|
|
+ Page selectPage = relationDefineCollectMapper.selectPage(page, queryWrapper);
|
|
|
|
+ List<RelationDefineCollect> records = (List<RelationDefineCollect>)selectPage.getRecords();
|
|
|
|
+ if(CollUtil.isEmpty(records)){
|
|
|
|
+ return selectPage;
|
|
|
|
+ }
|
|
|
|
+ List<RelationDefineCollectDTO> content = new ArrayList<>();
|
|
|
|
+ //获取图类型定义
|
|
|
|
+ Map<String, GraphDefine> graphDefineMap = queryAllGraphDefine();
|
|
|
|
+ //获取边类型定义
|
|
|
|
+ Map<String, RelationDefine> relationDefineMap = queryAllRelDefine();
|
|
|
|
+ records.forEach(item->{
|
|
|
|
+ RelationDefineCollectDTO collectDTO = new RelationDefineCollectDTO();
|
|
|
|
+ //设置图类型名称
|
|
|
|
+ String graphCode = item.getGraphCode();
|
|
|
|
+ if(StringUtils.isNotEmpty(graphCode)) {
|
|
|
|
+ GraphDefine graphDefine = graphDefineMap.get(graphCode);
|
|
|
|
+ if (graphDefine != null) {
|
|
|
|
+ collectDTO.setGraphName(graphDefine.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //设置边类型定义
|
|
|
|
+ String relCode = item.getRelCode();
|
|
|
|
+ if(StringUtils.isNotEmpty(relCode)){
|
|
|
|
+ RelationDefine relationDefine = relationDefineMap.get(relCode);
|
|
|
|
+ if(relationDefine != null){
|
|
|
|
+ BeanUtils.copyProperties(relationDefine,collectDTO);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ BeanUtils.copyProperties(item,collectDTO);
|
|
|
|
+ content.add(collectDTO);
|
|
|
|
+ });
|
|
|
|
+ selectPage.setRecords(content);
|
|
|
|
+ return selectPage;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取图类型定义
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Map<String, GraphDefine> queryAllGraphDefine(){
|
|
|
|
+ List<GraphDefine> graphDefines = graphDefineService.queryByCondition(new QueryWrapper<>());
|
|
|
|
+ if(CollUtil.isEmpty(graphDefines)){
|
|
|
|
+ return new HashMap<>();
|
|
|
|
+ }
|
|
|
|
+ return graphDefines.stream().collect(Collectors.toMap(GraphDefine::getCode, item->item, (k1, k2) -> k1));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取边类型编码
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Map<String, RelationDefine> queryAllRelDefine(){
|
|
|
|
+ List<RelationDefine> relationDefines = relationDefineService.queryByCondition(new QueryWrapper<>());
|
|
|
|
+ if(CollUtil.isEmpty(relationDefines)){
|
|
|
|
+ return new HashMap<>();
|
|
|
|
+ }
|
|
|
|
+ return relationDefines.stream().collect(Collectors.toMap(RelationDefine::getCode,item->item,(k1,k2) -> k1));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|