增加2.0账户功能更新与转码
This commit is contained in:
parent
6dfba8715d
commit
d4d607dc6a
|
|
@ -193,7 +193,7 @@ bool MetadataProcessor::processUf2Interfaces(const QString& basePath)
|
|||
QJsonObject custJson = readJson(custJsonPath);
|
||||
|
||||
Uf2Interface uf2;
|
||||
QMap<QString, InterfaceInfo> resultMap = uf2.scanDir(dirPath, ufAcct20ProjectDir, uftDbSett, filterDict);
|
||||
QMap<QString, InterfaceInfo> resultMap = uf2.scanDir(dirPath, ufAcct20ProjectDir, uftDbSett, filterDict, custJson);
|
||||
|
||||
QJsonObject resultJson;
|
||||
for (const QString& key : resultMap.keys()) {
|
||||
|
|
|
|||
|
|
@ -95,6 +95,11 @@ InterfaceInfo Uf2Interface::loadInterface(const QString& filePath)
|
|||
}
|
||||
else if (elementName == "code") {
|
||||
result.code = xml.readElementText();
|
||||
// readElementText() 内部消费了 </code> EndElement,
|
||||
// 但 elementStack 中 "code" 未被弹出,需要手动同步
|
||||
if (!elementStack.isEmpty() && elementStack.top() == "code") {
|
||||
elementStack.pop();
|
||||
}
|
||||
if (filePath.contains("不用编译")) {
|
||||
result.code.clear();
|
||||
}
|
||||
|
|
@ -158,7 +163,8 @@ bool Uf2Interface::shouldFilter(const QString& filePath,
|
|||
QMap<QString, InterfaceInfo> Uf2Interface::scanDir(const QString& dirPath,
|
||||
const QString& ufAcct20ProjectDir,
|
||||
const QString& uftDbSett,
|
||||
const QMap<QString, QStringList>& fileFilterDict)
|
||||
const QMap<QString, QStringList>& fileFilterDict,
|
||||
const QJsonObject& custJson)
|
||||
{
|
||||
QMap<QString, InterfaceInfo> resultMap;
|
||||
QStringList completeNameList = fileFilterDict.value("completeNameList");
|
||||
|
|
@ -167,6 +173,15 @@ QMap<QString, InterfaceInfo> Uf2Interface::scanDir(const QString& dirPath,
|
|||
QMap<QString, QString> moduleCodeMap;
|
||||
moduleCodeMap["转融通"] = "ref";
|
||||
|
||||
// 预提取cust.json中的模块英文名映射
|
||||
QMap<QString, QString> custMoudleENameMap;
|
||||
if (!custJson.isEmpty() && custJson.contains("moudleEName")) {
|
||||
QJsonObject moudleENameObj = custJson["moudleEName"].toObject();
|
||||
for (const QString& key : moudleENameObj.keys()) {
|
||||
custMoudleENameMap[key] = moudleENameObj[key].toString();
|
||||
}
|
||||
}
|
||||
|
||||
std::function<void(const QString&)> scanModuleXmlRecursive;
|
||||
scanModuleXmlRecursive = [&](const QString& path) {
|
||||
if (path.isEmpty()) return;
|
||||
|
|
@ -185,6 +200,14 @@ QMap<QString, InterfaceInfo> Uf2Interface::scanDir(const QString& dirPath,
|
|||
|
||||
QString modName = fileInfo.dir().dirName();
|
||||
QString modEName = getModuleEName(filePath);
|
||||
|
||||
// cust.json回退:当路径包含"外部接口(不用编译)"且英文名为空时
|
||||
if (filePath.contains("外部接口(不用编译)") && modEName.trimmed().isEmpty()) {
|
||||
if (custMoudleENameMap.contains(modName)) {
|
||||
modEName = custMoudleENameMap[modName];
|
||||
}
|
||||
}
|
||||
|
||||
moduleCodeMap[modName] = modEName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QJsonObject>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
struct FieldInfo {
|
||||
|
|
@ -50,7 +51,8 @@ public:
|
|||
QMap<QString, InterfaceInfo> scanDir(const QString& dirPath,
|
||||
const QString& ufAcct20ProjectDir,
|
||||
const QString& uftDbSett,
|
||||
const QMap<QString, QStringList>& fileFilterDict);
|
||||
const QMap<QString, QStringList>& fileFilterDict,
|
||||
const QJsonObject& custJson = QJsonObject());
|
||||
|
||||
private:
|
||||
QString getModuleEName(const QString& moduleXmlPath);
|
||||
|
|
|
|||
Loading…
Reference in New Issue