|
|
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.model.bo.DatabaseConfig;
|
|
|
import com.model.bo.GroupUpdateId;
|
|
|
+import com.model.po.BaseConfig;
|
|
|
import com.model.po.DataConnector;
|
|
|
import com.model.po.DataConnectorList;
|
|
|
import com.model.pojo.RepCode;
|
|
|
@@ -18,6 +19,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -98,7 +100,27 @@ public class DataConnectorService {
|
|
|
// }
|
|
|
|
|
|
List<DataConnectorList> listConnector = dataConnectorMapper.getDataConnectorList();
|
|
|
- return new RepEntity(RepCode.success, listConnector);
|
|
|
+ List<DataConnectorList> listConnectors = new ArrayList<>();
|
|
|
+ Iterator isList = listConnector.iterator();
|
|
|
+ while (isList.hasNext()){
|
|
|
+ DataConnectorList dataConnectorList = (DataConnectorList) isList.next();
|
|
|
+ BaseConfig baseConfig = new BaseConfig();
|
|
|
+ String dbConfig = dataConnectorList.getDbConfig();
|
|
|
+ try {
|
|
|
+ baseConfig = objectmapper.readValue(dbConfig, BaseConfig.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ baseConfig.setPassWord("");
|
|
|
+ try{
|
|
|
+ dbConfig = objectmapper.writeValueAsString(baseConfig);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ dataConnectorList.setDbConfig(dbConfig);
|
|
|
+ listConnectors.add(dataConnectorList);
|
|
|
+ }
|
|
|
+ return new RepEntity(RepCode.success, listConnectors);
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
@@ -106,6 +128,20 @@ public class DataConnectorService {
|
|
|
*/
|
|
|
public RepEntity getConnector(int id){
|
|
|
DataConnector dataConnector = dataConnectorMapper.getOneData(id);
|
|
|
+ BaseConfig baseConfig = new BaseConfig();
|
|
|
+ String dbConfig = dataConnector.getDbConfig();
|
|
|
+ try {
|
|
|
+ baseConfig = objectmapper.readValue(dbConfig, BaseConfig.class);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ baseConfig.setPassWord("");
|
|
|
+ try{
|
|
|
+ dbConfig = objectmapper.writeValueAsString(baseConfig);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ dataConnector.setDbConfig(dbConfig);
|
|
|
System.out.println(dataConnector);
|
|
|
return new RepEntity(RepCode.success, dataConnector);
|
|
|
}
|
|
|
@@ -187,7 +223,7 @@ public class DataConnectorService {
|
|
|
while (isList.hasNext()){
|
|
|
int id = (int) isList.next();
|
|
|
List<String> chartName = dataConnectorMapper.getChartsName(id);
|
|
|
- if (chartName != null && !("".equals(chartName))){
|
|
|
+ if (chartName.size() != 0){
|
|
|
return new RepEntity(RepCode.hasChartsUsing, chartName);
|
|
|
}
|
|
|
}
|
|
|
@@ -233,6 +269,19 @@ public class DataConnectorService {
|
|
|
删除数据源分组
|
|
|
*/
|
|
|
public RepEntity delDataConnectorGroup(List<Integer> idList){
|
|
|
+ List<Integer> integerList = idList;
|
|
|
+ Iterator isList = integerList.iterator();
|
|
|
+ while (isList.hasNext()){
|
|
|
+ int id = (int) isList.next();
|
|
|
+ List<String> groupName = dataConnectorMapper.getFatherId(id);
|
|
|
+ if (groupName.size() != 0){
|
|
|
+ return new RepEntity(RepCode.hasGroupUsing);
|
|
|
+ }
|
|
|
+ List<String> chartName = dataConnectorMapper.getConName(id);
|
|
|
+ if (chartName.size() != 0){
|
|
|
+ return new RepEntity(RepCode.hasConUsing);
|
|
|
+ }
|
|
|
+ }
|
|
|
dataConnectorMapper.delConnectorGroup(idList);
|
|
|
return new RepEntity(RepCode.success);
|
|
|
}
|