Skip to content

Commit

Permalink
Fix dataset (#9)
Browse files Browse the repository at this point in the history
* fix dataset

* fix dataset

* fix dataset
  • Loading branch information
likehabits authored Sep 28, 2023
1 parent b251992 commit 80581ae
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.primihub.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONValidator;
import com.primihub.entity.DataSet;
import com.primihub.entity.base.BaseResultEntity;
import com.primihub.entity.base.BaseResultEnum;
Expand All @@ -18,7 +16,6 @@
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.Set;

@RequestMapping("fusionResource")
Expand Down Expand Up @@ -80,6 +77,11 @@ public BaseResultEntity getTestDataSet(String id){
return resourceService.getTestDataSet(id);
}

@RequestMapping("getDataSets")
public BaseResultEntity getDataSets(@RequestBody Set<String> ids){
return resourceService.getDataSets(ids);
}

@PostMapping("batchSaveTestDataSet")
public BaseResultEntity batchSaveTestDataSet(@RequestBody List<DataSet> dataSets){
if (dataSets == null || dataSets.size()==0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static CopyResourceDto FusionResourceConvertCopyResourceDto(FusionResourc
copyResourceDto.setResourceHashCode(po.getResourceHashCode());
copyResourceDto.setResourceState(po.getResourceState());
copyResourceDto.setUserName(po.getUserName());
// dataSet.setAccessInfo(null);
dataSet.setAccessInfo("");
copyResourceDto.setDataSet(dataSet);
return copyResourceDto;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public BaseResultEntity batchSaveResource(String globalId,List<CopyResourceDto>
log.info(JSONObject.toJSONString(dataSet));
if (dataSet!=null && !StringUtils.isEmpty(dataSet.getId())){
dataSet.setHolder(1);
dataSet.setAccessInfo("");
DataSet d = dataSetRepository.getDataSetById(dataSet.getId());
if (d==null){
dataSetRepository.insertDataSet(dataSet);
Expand Down Expand Up @@ -184,6 +185,7 @@ public BaseResultEntity batchSaveTestDataSet(List<DataSet> dataSets){
try {
for (DataSet dataSet : dataSets) {
dataSet.setHolder(1);
dataSet.setAccessInfo("");
DataSet d = dataSetRepository.getDataSetById(dataSet.getId());
if (d==null){
dataSetRepository.insertDataSet(dataSet);
Expand All @@ -198,4 +200,8 @@ public BaseResultEntity batchSaveTestDataSet(List<DataSet> dataSets){
}

}

public BaseResultEntity getDataSets(Set<String> ids) {
return BaseResultEntity.success(dataSetRepository.getDataSetByIds(ids));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class AsyncService {

@Async
public void syncOne(DataSet dataSet){
dataSet.setAccessInfo(null);
dataSet.setAccessInfo("");
for (String collaborate : collaborates) {
syncGatewayApiData(dataSet,collaborate+ SysConstant.ONE_URL);
}
Expand All @@ -42,7 +42,7 @@ public void syncOne(DataSet dataSet){
@Async
public void syncMany(List<DataSet> dataSets){
for (DataSet dataSet : dataSets) {
dataSet.setAccessInfo(null);
dataSet.setAccessInfo("");
}
for (String collaborate : collaborates) {
syncGatewayApiData(dataSets,collaborate+ SysConstant.MANY_URL);
Expand All @@ -51,7 +51,7 @@ public void syncMany(List<DataSet> dataSets){

@Async
public void syncDelete(DataSet dataSet){
dataSet.setAccessInfo(null);
dataSet.setAccessInfo("");
for (String collaborate : collaborates) {
syncGatewayApiData(dataSet,collaborate+ SysConstant.DELETE_URL);
}
Expand Down

0 comments on commit 80581ae

Please sign in to comment.