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

APL函數(shù)代碼開放場景-數(shù)據(jù)集成Java接口說明

2025-01-16 17:05:08 464 本站

package fx.custom.apl.example.erpdss;

import com.fxiaoke.functions.FunctionContext;
import com.fxiaoke.functions.client.DebugHelper;
import com.fxiaoke.functions.http.HttpResult;
import com.fxiaoke.functions.model.APIResult;
import com.fxiaoke.functions.template.IErpdssAction;
import com.fxiaoke.functions.utils.Maps;

import java.io.IOException;
import java.util.List;
import java.util.Map;

import static com.fxiaoke.functions.Fx.http;
import static com.fxiaoke.functions.Fx.log;

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

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

        // todo 獲取數(shù)據(jù)
        Map<String, String> headers = Maps.of("token", "xxxxxx");
        String url = "http://xxx/xxx//queryMasterBatch?objAPIName=" + apiName + "&startTime=" + startTime + "&endTime=" + endTime + "&includeDetail=" + includeDetail + "&offset=" + offset + "&limit=" + limit;
        APIResult apiResult = http.get(url, headers);

        if (apiResult.isError()) {
            log.info("根據(jù)時間獲取erp對象數(shù)據(jù)錯誤:" + apiResult.getMessage());
            // 返回錯誤數(shù)據(jù)
            Map<String, Object> result = Maps.newHashMap();
            result.put("errorCodeKey", "500");
            result.put("errorMessageKey", apiResult.getMessage());
            return result;
        }
        log.info("根據(jù)時間獲取erp對象數(shù)據(jù),url:" + url + " 返回值:" + apiResult.getData());
        Map<String, Object> queryDataByTimeResult = (Map) ((HttpResult) apiResult.getData()).getContent();
        Map mdata = (Map) queryDataByTimeResult.get("data");
        int totalNum = (int) mdata.get("totalNum");
        List<Map<String, Object>> dataList = (List<Map<String, Object>>) mdata.get("dataList");

        // 構(gòu)建對象數(shù)據(jù)
        Map<String, Object> data = Maps.of("totalKey", totalNum, "dataListKey", dataList);

        // 返回數(shù)據(jù)
        Map<String, Object> result = Maps.of("errorCodeKey", successCode, "dataKey", data);
        return result;
    }

    public static void main(String[] args) throws IOException {
        //調(diào)試器
        DebugHelper helper = new DebugHelper();
        helper.init();
        //模擬調(diào)試的上下文,例如開發(fā)時想模擬一個客戶對象的上下文,以方便開發(fā)
        FunctionContext context = helper.context("object_zBB6O__c", "63fd7a30ffd89f00013c7be3");
        //依賴于param參數(shù)
        Map objectData = Maps.newHashMap();
        objectData.put("objAPIName", "BD_MATERIAL");
        objectData.put("startTime", 1602315440000L);
        objectData.put("endTime", 1602325440000L);
        objectData.put("includeDetail", false);
        objectData.put("offset", 0);
        objectData.put("limit", 100);
        Map<String, Object> param = Maps.of("syncArg",
                Maps.of("objectData", objectData));
        Map execute = new ErpdssExample().execute(context, param);
        log.info(execute);
    }
}



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