|
@@ -27,7 +27,6 @@ import org.dromara.maxkey.synchronizer.AbstractSynchronizerService;
|
|
|
import org.dromara.maxkey.synchronizer.ISynchronizerService;
|
|
|
import org.dromara.maxkey.entity.SyncJobConfigField;
|
|
|
import org.dromara.maxkey.synchronizer.service.SyncJobConfigFieldService;
|
|
|
-import org.dromara.maxkey.synchronizer.utils.MyResultSet;
|
|
|
import org.dromara.maxkey.util.JdbcUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -128,47 +127,6 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
|
|
|
return org;
|
|
|
}
|
|
|
|
|
|
- public Organizations buildOrgByFieldMapTemp(MyResultSet rs) throws SQLException{
|
|
|
- Organizations org = new Organizations();
|
|
|
- //DbTableMetaData meta = JdbcUtils.getMetaData(rs);
|
|
|
- Map<String, String> fieldMap = getFieldMap(Long.parseLong(synchronizer.getId()));
|
|
|
- for (Map.Entry<String, String> entry : fieldMap.entrySet()) {
|
|
|
- String column = entry.getValue();
|
|
|
- String field = entry.getKey();
|
|
|
- Object value = rs.getObject(column);
|
|
|
-
|
|
|
- if (value != null) {
|
|
|
- try {
|
|
|
- setFieldValue(org,field,value);
|
|
|
- } catch (Exception e) {
|
|
|
- _logger.error("setProperty {}", e);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- org.setId(org.generateId());
|
|
|
- org.setInstId(synchronizer.getInstId());
|
|
|
- if (rs.getColumnNames().contains("status")) {
|
|
|
- org.setStatus(rs.getInt("status"));
|
|
|
- } else {
|
|
|
- org.setStatus(ConstsStatus.ACTIVE);
|
|
|
- }
|
|
|
- _logger.debug("Organization {}", org);
|
|
|
-
|
|
|
- /*HistorySynchronizer historySynchronizer = new HistorySynchronizer();
|
|
|
- historySynchronizer.setId(historySynchronizer.generateId());
|
|
|
- historySynchronizer.setSyncId(synchronizer.getId());
|
|
|
- historySynchronizer.setSyncName(synchronizer.getName());
|
|
|
- historySynchronizer.setObjectId(org.getId());
|
|
|
- historySynchronizer.setObjectName(org.getOrgName());
|
|
|
- historySynchronizer.setObjectType(Organizations.class.getSimpleName());
|
|
|
- historySynchronizer.setInstId(synchronizer.getInstId());
|
|
|
- historySynchronizer.setResult("success");
|
|
|
- historySynchronizerService.insert(historySynchronizer);*/
|
|
|
-
|
|
|
- return org;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
public Organizations buildOrganization(ResultSet rs) throws SQLException {
|
|
|
DbTableMetaData meta = JdbcUtils.getMetaData(rs);
|
|
|
Organizations org = new Organizations();
|
|
@@ -215,51 +173,6 @@ public class JdbcOrganizationService extends AbstractSynchronizerService impleme
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Organizations buildOrganizationTemp(MyResultSet rs) throws SQLException {
|
|
|
- //DbTableMetaData meta = JdbcUtils.getMetaData(rs);
|
|
|
- Organizations org = new Organizations();
|
|
|
-
|
|
|
- for (ColumnFieldMapper mapper : mapperList) {
|
|
|
- if (rs.getColumnNames().contains(mapper.getColumn())) {
|
|
|
- Object value = null;
|
|
|
- if (mapper.getType().equalsIgnoreCase("String")) {
|
|
|
- value = rs.getString(mapper.getColumn());
|
|
|
- } else {
|
|
|
- value = rs.getInt(mapper.getColumn());
|
|
|
- }
|
|
|
- if (value != null) {
|
|
|
- try {
|
|
|
- PropertyUtils.setSimpleProperty(org, mapper.getField(), value);
|
|
|
- } catch (Exception e) {
|
|
|
- _logger.error("setSimpleProperty {}", e);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- org.setId(org.generateId());
|
|
|
- org.setInstId(synchronizer.getInstId());
|
|
|
- if (rs.getColumnNames().contains("status")) {
|
|
|
- org.setStatus(rs.getInt("status"));
|
|
|
- } else {
|
|
|
- org.setStatus(ConstsStatus.ACTIVE);
|
|
|
- }
|
|
|
- _logger.debug("Organization {}", org);
|
|
|
-
|
|
|
- /*HistorySynchronizer historySynchronizer = new HistorySynchronizer();
|
|
|
- historySynchronizer.setId(historySynchronizer.generateId());
|
|
|
- historySynchronizer.setSyncId(synchronizer.getId());
|
|
|
- historySynchronizer.setSyncName(synchronizer.getName());
|
|
|
- historySynchronizer.setObjectId(org.getId());
|
|
|
- historySynchronizer.setObjectName(org.getOrgName());
|
|
|
- historySynchronizer.setObjectType(Organizations.class.getSimpleName());
|
|
|
- historySynchronizer.setInstId(synchronizer.getInstId());
|
|
|
- historySynchronizer.setResult("success");
|
|
|
- historySynchronizerService.insert(historySynchronizer);*/
|
|
|
-
|
|
|
- return org;
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
public Map<String,String> getFieldMap(Long jobId){
|
|
|
Map<String,String> filedMap = new HashMap<>();
|