|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.map.MapUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.persagy.dmp.common.constant.ValidEnum;
|
|
@@ -11,6 +12,8 @@ import com.persagy.dmp.common.model.entity.BaseEntity;
|
|
|
import com.persagy.dmp.define.entity.ObjectInfoCollect;
|
|
|
import com.persagy.dmp.rwd.define.dao.ObjectInfoCollectMapper;
|
|
|
import com.persagy.dmp.rwd.define.service.IObjectInfoCollectService;
|
|
|
+import com.persagy.dmp.rwd.define.service.IObjectInfoService;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -28,6 +31,9 @@ public class ObjectInfoCollectServiceImpl extends ServiceImpl<ObjectInfoCollectM
|
|
|
@Autowired
|
|
|
private ObjectInfoCollectMapper objectInfoCollectMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IObjectInfoService objectInfoService;
|
|
|
+
|
|
|
/**
|
|
|
* 数量统计
|
|
|
* @param queryWrapper 查询条件
|
|
@@ -40,6 +46,16 @@ public class ObjectInfoCollectServiceImpl extends ServiceImpl<ObjectInfoCollectM
|
|
|
|
|
|
/**
|
|
|
* 查询采集的信息点
|
|
|
+ * @param queryWrapper 查询条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<ObjectInfoCollect> queryByCondition(Wrapper<ObjectInfoCollect> queryWrapper) {
|
|
|
+ return objectInfoCollectMapper.selectList(queryWrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页询采集的信息点
|
|
|
* @param page 分页条件
|
|
|
* @param queryWrapper 查询条件
|
|
|
* @return
|
|
@@ -56,6 +72,9 @@ public class ObjectInfoCollectServiceImpl extends ServiceImpl<ObjectInfoCollectM
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ObjectInfoCollect> insert(List<ObjectInfoCollect> voList) throws Exception{
|
|
|
+ //填充信息点采集ID
|
|
|
+ fillObjectInfoCollectId(voList);
|
|
|
+ //新增采集信息点
|
|
|
saveOrUpdateBatch(voList);
|
|
|
return voList;
|
|
|
}
|
|
@@ -67,6 +86,9 @@ public class ObjectInfoCollectServiceImpl extends ServiceImpl<ObjectInfoCollectM
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ObjectInfoCollect> update(List<ObjectInfoCollect> voList) throws Exception {
|
|
|
+ //填充信息点采集ID
|
|
|
+ fillObjectInfoCollectId(voList);
|
|
|
+ //修改采集信息点
|
|
|
saveOrUpdateBatch(voList);
|
|
|
return voList;
|
|
|
}
|
|
@@ -96,4 +118,32 @@ public class ObjectInfoCollectServiceImpl extends ServiceImpl<ObjectInfoCollectM
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 校验信息点是否已被采集,若已被采集,填充相应的采集ID
|
|
|
+ * @param voList
|
|
|
+ */
|
|
|
+ private void fillObjectInfoCollectId(List<ObjectInfoCollect> voList){
|
|
|
+ if(CollUtil.isEmpty(voList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (ObjectInfoCollect objectInfoCollect : voList) {
|
|
|
+ if(StringUtils.isNotEmpty(objectInfoCollect.getId()) || StringUtils.isEmpty(objectInfoCollect.getDefineInfoId())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //查询采集信息点
|
|
|
+ LambdaQueryWrapper<ObjectInfoCollect> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(ObjectInfoCollect::getGroupCode,objectInfoCollect.getGroupCode());
|
|
|
+ wrapper.eq(ObjectInfoCollect::getProjectId,objectInfoCollect.getProjectId());
|
|
|
+ wrapper.eq(ObjectInfoCollect::getDefineInfoId,objectInfoCollect.getDefineInfoId());
|
|
|
+ wrapper.eq(ObjectInfoCollect::getValid,true);
|
|
|
+ List<ObjectInfoCollect> objectInfoCollects = queryByCondition(wrapper);
|
|
|
+ if(CollUtil.isEmpty(objectInfoCollects)){
|
|
|
+ //信息点未被采集
|
|
|
+ continue;
|
|
|
+ }else{
|
|
|
+ //信息点已采集
|
|
|
+ objectInfoCollect.setId(objectInfoCollects.get(0).getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|