提交 087647a8 authored 作者: inroi's avatar inroi

完成代码

上级 345ccb86
......@@ -5,14 +5,18 @@ import com.system.constants.KingDeeCommonSyncConstants;
import com.system.dao.DatabaseTableMapper;
import com.system.transfer.configure.TableStructureCreateInVoRecords;
import com.system.transfer.configure.TableStructureListOutVoRecords;
import com.system.utils.DesHelperUtil;
import com.system.utils.JsonUtil;
import com.system.utils.KingDeeUtil;
import com.system.utils.StringUtil;
import com.system.utils.TableStructureUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
......@@ -28,18 +32,37 @@ public class KingDeeCommonSyncApi {
@Autowired
private DatabaseTableMapper databaseTableMapper;
@Autowired
private KingDeeCommonSyncApi kingDeeCommonSyncApi;
/**
* 获取金蝶云数据
*/
public List<Map<String, Object>> synchronization(Map<String, String> config, String queueId, List<Map<String, String>> fieldList, Map<String, String> where) {
Map<String, String> key = KingDeeCommonSyncConstants.encapsulationKingDeeField(fieldList);
String customSql = config.get("customSql");
Map<String, String> key = KingDeeCommonSyncConstants.encapsulationKingDeeField(fieldList);
String primaryKeyField = config.get("primaryKeyField");
key.put(primaryKeyField, primaryKeyField);
List<List<Object>> result = kingDeeApi.synchronization(config, queueId, key, where);
if(StringUtils.isBlank(customSql))
{
key.put(primaryKeyField, primaryKeyField);
List<List<Object>> result = kingDeeApi.synchronization(config, queueId, key, where);
this.databaseTableDataCreate(config.get("docType"), queueId, result, key, primaryKeyField);
return encapsulationIms(config.get("mesEntryName"), queueId, result, fieldList);
}
else
{
TableStructureListOutVoRecords records = databaseTableMapper.tableStructureOne(config.get("docType"));
String request = DesHelperUtil.encrypt(customSql, StandardCharsets.UTF_8, "MES&&DES");
String customSqlResult = kingDeeCommonSyncApi.kingDeeGetBySql(config, queueId, config.get("name") + "执行SQL", request);
Map<String, Object> temp = JsonUtil.toMap(customSqlResult, String.class, Object.class);
List<Map<String, Object>> tempList = (List<Map<String, Object>>)temp.get("data");
this.createData(queueId, records, tempList, primaryKeyField);
return new ArrayList();
}
this.databaseTableDataCreate(config.get("docType"), queueId, result, key, primaryKeyField);
return encapsulationIms(config.get("mesEntryName"), queueId, result, fieldList);
}
/**
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论