|
@@ -22,6 +22,7 @@ import com.dragonsoft.duceap.commons.util.UUIDUtils;
|
|
import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
import com.google.common.base.Joiner;
|
|
import com.google.common.base.Joiner;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -34,6 +35,7 @@ import java.util.stream.Collectors;
|
|
/**
|
|
/**
|
|
* Created by lidr on 2021/4/14
|
|
* Created by lidr on 2021/4/14
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(value = "/dcuc/app/dataResourceFacade")
|
|
@RequestMapping(value = "/dcuc/app/dataResourceFacade")
|
|
public class DataResourceFacade implements IDataResourceFacade {
|
|
public class DataResourceFacade implements IDataResourceFacade {
|
|
@@ -292,27 +294,63 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseStatus dataLevelSync() {
|
|
public ResponseStatus dataLevelSync() {
|
|
- CompletableFuture.supplyAsync(this::getDataLevelListFromRemote).thenAccept((list)->dataLevelService.sync(list));
|
|
|
|
|
|
+ CompletableFuture
|
|
|
|
+ .supplyAsync(this::getDataLevelListFromRemote)
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("getDataLevelListFromRemote error.",e);
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ })
|
|
|
|
+ .thenAccept((list)->dataLevelService.sync(list))
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("sync error.",e);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
return ResponseStatus.success();
|
|
return ResponseStatus.success();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseStatus dataSecSync() {
|
|
public ResponseStatus dataSecSync() {
|
|
- CompletableFuture.supplyAsync(this::getSecurityLevelListFromRemote).thenAccept((list)->dataSecService.sync(list));
|
|
|
|
|
|
+ CompletableFuture
|
|
|
|
+ .supplyAsync(this::getSecurityLevelListFromRemote)
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("getSecurityLevelListFromRemote error.",e);
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ })
|
|
|
|
+ .thenAccept((list)->dataSecService.sync(list))
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("sync error.",e);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
return ResponseStatus.success();
|
|
return ResponseStatus.success();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseStatus dataClaSync() {
|
|
public ResponseStatus dataClaSync() {
|
|
CompletableFuture.supplyAsync(this::getDataClassifyTreeFromRemote)
|
|
CompletableFuture.supplyAsync(this::getDataClassifyTreeFromRemote)
|
|
- .thenAccept((nodes)-> dataClaService.sync(nodes, null));
|
|
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("getDataClassifyTreeFromRemote error.",e);
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ })
|
|
|
|
+ .thenAccept((nodes)-> dataClaService.sync(nodes, null))
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("sync error.",e);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
return ResponseStatus.success();
|
|
return ResponseStatus.success();
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public ResponseStatus fieldClaSync() {
|
|
public ResponseStatus fieldClaSync() {
|
|
CompletableFuture.supplyAsync(this::getFieldClassifyTreeFromRemote)
|
|
CompletableFuture.supplyAsync(this::getFieldClassifyTreeFromRemote)
|
|
- .thenAccept((nodes)-> fieldClaService.sync(nodes, null));
|
|
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("getFieldClassifyTreeFromRemote error.",e);
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
+ })
|
|
|
|
+ .thenAccept((nodes)-> fieldClaService.sync(nodes, null))
|
|
|
|
+ .exceptionally(e->{
|
|
|
|
+ log.error("sync error.",e);
|
|
|
|
+ return null;
|
|
|
|
+ });
|
|
return ResponseStatus.success();
|
|
return ResponseStatus.success();
|
|
}
|
|
}
|
|
|
|
|