国产精品,日韩av,hdsexvideos中国少妇,xxxxx性bbbbb欧美熟妇,波多野结衣乳巨码无在线,国产成人亚洲精品乱码

APL函數(shù)代碼開放場(chǎng)景-數(shù)據(jù)集成Groovy代碼示例

2025-01-15 11:16:32 451 本站

數(shù)據(jù)集成連接器對(duì)象api-根據(jù)時(shí)間獲取erp對(duì)象數(shù)據(jù) 批量查詢

/**
 * 連接器對(duì)象api-根據(jù)時(shí)間獲取erp對(duì)象數(shù)據(jù) 批量查詢
 * todo的為需要用戶自己修改添加的,
 * 需要先在右上角設(shè)置參數(shù) Map類型syncArg
 **/
String errorCodeKey = "code" // 錯(cuò)誤返回碼字段名稱-需要和連接器配置的 error code字段 對(duì)應(yīng)
String successCode = "0" // 成功時(shí)的錯(cuò)誤返回碼-需要和連接器配置的 成功的code 對(duì)應(yīng)
String errorMessageKey = "message" // 錯(cuò)誤提示語字段名稱-需要和連接器配置的 error msg字段 對(duì)應(yīng)
String dataKey = "data" // 數(shù)據(jù)字段名稱-需要和連接器配置的 數(shù)據(jù)字段 對(duì)應(yīng)
String totalKey = "totalNum" // 數(shù)據(jù)總條數(shù)字段名稱
String dataListKey = "dataList" // 數(shù)據(jù)詳情列表字段名稱

Map objectData = syncArg["objectData"] as Map
def apiName = objectData["objAPIName"] // ERP對(duì)象apiName 例如:BD_MATERIAL
def startTime = objectData["startTime"] // 數(shù)據(jù)變更的開始時(shí)間(unix時(shí)間戳,單位毫秒)
def endTime = objectData["endTime"] // 數(shù)據(jù)變更的結(jié)束時(shí)間(unix時(shí)間戳,單位毫秒)
def includeDetail = objectData["includeDetail"] // 是否包含明細(xì)
def offset = objectData["offset"] // 獲取記錄的偏移
def limit = objectData["limit"] // 當(dāng)前請(qǐng)求記錄條數(shù)

// todo 獲取數(shù)據(jù)
Map<String, String> headers = ["token": "xxxxxx"]
def url = "http://xxx/xxx//queryMasterBatch?objAPIName=" + apiName + "&startTime=" + startTime + "&endTime=" + endTime + "&includeDetail=" + includeDetail + "&offset=" + offset + "&limit=" + limit
def (Boolean error, HttpResult httpResult, String msg) = http.get(url, headers)
if (error) {
    log.info("根據(jù)時(shí)間獲取erp對(duì)象數(shù)據(jù)錯(cuò)誤:" + msg)
    // 返回錯(cuò)誤數(shù)據(jù)
    Map<String, Object> result = [:]
    result[errorCodeKey] = "500"
    result[errorMessageKey] = msg
    return result
}
log.info("根據(jù)時(shí)間獲取erp對(duì)象數(shù)據(jù),url:" + url + " 返回值:" + httpResult)
Map<String, Object> queryDataByTimeResult = httpResult.content as Map
int totalNum = queryDataByTimeResult["data"]["totalNum"] as Integer
List<Map<String, Object>> dataList = queryDataByTimeResult["data"]["dataList"] as List

// 構(gòu)建對(duì)象數(shù)據(jù)
Map<String, Object> data = [:]
data[totalKey] = totalNum
data[dataListKey] = dataList

// 返回?cái)?shù)據(jù)
Map<String, Object> result = [:]
result[errorCodeKey] = successCode
result[errorMessageKey] = ""
result[dataKey] = data
return result



部分內(nèi)容來源于互聯(lián)網(wǎng),如有侵權(quán),請(qǐng)聯(lián)系客服刪除處理。
在線咨詢 撥打電話