|
@@ -1,13 +1,17 @@
|
|
package com.kgraph.graph.suport.service.impl;
|
|
package com.kgraph.graph.suport.service.impl;
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
-import com.kgraph.common.utils.DateUtils;;
|
|
|
|
-import com.kgraph.graph.suport.domain.TBuildFlow;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-import com.kgraph.graph.suport.mapper.TCheckPiontMapper;
|
|
|
|
|
|
+import com.kgraph.common.utils.DateUtils;
|
|
|
|
+import com.kgraph.graph.neo4j.domain.Entity;
|
|
|
|
+import com.kgraph.graph.neo4j.service.INeo4jEntityService;
|
|
import com.kgraph.graph.suport.domain.TCheckPiont;
|
|
import com.kgraph.graph.suport.domain.TCheckPiont;
|
|
|
|
+import com.kgraph.graph.suport.mapper.TCheckPiontMapper;
|
|
import com.kgraph.graph.suport.service.ITCheckPiontService;
|
|
import com.kgraph.graph.suport.service.ITCheckPiontService;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 检查点管理Service业务层处理
|
|
* 检查点管理Service业务层处理
|
|
@@ -21,6 +25,9 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
|
|
@Autowired
|
|
@Autowired
|
|
private TCheckPiontMapper tCheckPiontMapper;
|
|
private TCheckPiontMapper tCheckPiontMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private INeo4jEntityService neo4jEntityService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询检查点管理
|
|
* 查询检查点管理
|
|
*
|
|
*
|
|
@@ -48,27 +55,46 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
|
|
/**
|
|
/**
|
|
* 新增检查点管理
|
|
* 新增检查点管理
|
|
*
|
|
*
|
|
- * @param tCheckPiont 检查点管理
|
|
|
|
|
|
+ * @param checkPoint 检查点管理
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public int insertTCheckPiont(TCheckPiont tCheckPiont)
|
|
|
|
|
|
+ public int insertTCheckPiont(TCheckPiont checkPoint)
|
|
{
|
|
{
|
|
- tCheckPiont.setCreateTime(DateUtils.getNowDate());
|
|
|
|
- return tCheckPiontMapper.insertTCheckPiont(tCheckPiont);
|
|
|
|
|
|
+ checkPoint.setCreateTime(DateUtils.getNowDate());
|
|
|
|
+ int i = tCheckPiontMapper.insertTCheckPiont(checkPoint);
|
|
|
|
+// saveEntity(checkPoint);
|
|
|
|
+ return i;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 修改检查点管理
|
|
* 修改检查点管理
|
|
*
|
|
*
|
|
- * @param tCheckPiont 检查点管理
|
|
|
|
|
|
+ * @param checkPoint 检查点管理
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public int updateTCheckPiont(TCheckPiont tCheckPiont)
|
|
|
|
|
|
+ public int updateTCheckPiont(TCheckPiont checkPoint)
|
|
{
|
|
{
|
|
- tCheckPiont.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
- return tCheckPiontMapper.updateTCheckPiont(tCheckPiont);
|
|
|
|
|
|
+ checkPoint.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
+ int i = tCheckPiontMapper.updateTCheckPiont(checkPoint);
|
|
|
|
+// saveEntity(checkPoint);
|
|
|
|
+ return i;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void saveEntity(TCheckPiont checkPoint) {
|
|
|
|
+ Entity entity = neo4jEntityService.getByForeignId(checkPoint.getForeignId());
|
|
|
|
+ if (entity == null) {
|
|
|
|
+ entity = new Entity();
|
|
|
|
+ entity.setForeignId(checkPoint.getForeignId());
|
|
|
|
+ }
|
|
|
|
+ List<String> labels = entity.getLabels();
|
|
|
|
+ if(!labels.contains(TCheckPiont.ENTITY_LABEL)){
|
|
|
|
+ entity.getLabels().add(TCheckPiont.ENTITY_LABEL);
|
|
|
|
+ }
|
|
|
|
+ entity.setCode(checkPoint.getCode());
|
|
|
|
+ entity.setName(checkPoint.getCheckPiont());
|
|
|
|
+ neo4jEntityService.save(entity);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -80,7 +106,14 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
|
|
@Override
|
|
@Override
|
|
public int deleteTCheckPiontByIds(Long[] ids)
|
|
public int deleteTCheckPiontByIds(Long[] ids)
|
|
{
|
|
{
|
|
- return tCheckPiontMapper.deleteTCheckPiontByIds(ids);
|
|
|
|
|
|
+ int i = tCheckPiontMapper.deleteTCheckPiontByIds(ids);
|
|
|
|
+// List<Long> entityIdList = new ArrayList<>(ids.length);
|
|
|
|
+// for(Long id : ids) {
|
|
|
|
+// Entity entity = neo4jEntityService.getByForeignId(TCheckPiont.getForeignIdById(id));
|
|
|
|
+// entityIdList.add(entity.getId());
|
|
|
|
+// }
|
|
|
|
+// neo4jEntityService.delete(entityIdList.toArray(new Long[]{}));
|
|
|
|
+ return i;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -92,7 +125,11 @@ public class TCheckPiontServiceImpl implements ITCheckPiontService
|
|
@Override
|
|
@Override
|
|
public int deleteTCheckPiontById(Long id)
|
|
public int deleteTCheckPiontById(Long id)
|
|
{
|
|
{
|
|
- return tCheckPiontMapper.deleteTCheckPiontById(id);
|
|
|
|
|
|
+ int i = tCheckPiontMapper.deleteTCheckPiontById(id);
|
|
|
|
+// Entity entity = neo4jEntityService.getByForeignId(TCheckPiont.getForeignIdById(id));
|
|
|
|
+// Long entityId = entity.getId();
|
|
|
|
+// neo4jEntityService.delete(new Long[]{entityId});
|
|
|
|
+ return i;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|