Skip to content

Commit 2026ac3

Browse files
fix 自动化服务类传参错误
1 parent 797d017 commit 2026ac3

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/common/iServer/GeoprocessingService.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class GeoprocessingService extends CommonServiceBase {
5252
parameter = parameter ? parameter : null;
5353
environment = environment ? environment : null;
5454
const executeParamter = { parameter, environment };
55-
return this._processAsync({ url: `${this.url}/${identifier}/execute`, executeParamter, callback });
55+
return this._processAsync({ url: `${this.url}/${identifier}/execute`, paramter:executeParamter, callback });
5656
}
5757
/**
5858
* @function GeoprocessingService.prototype.submitJob
@@ -67,7 +67,7 @@ export class GeoprocessingService extends CommonServiceBase {
6767
parameter = parameter ? parameter : null;
6868
environments = environments ? environments : null;
6969
const asyncParamter = JSON.stringify({ parameter: parameter, environments: environments });
70-
return this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, params: asyncParamter });
70+
return this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, data: asyncParamter });
7171
}
7272

7373
/**
@@ -152,11 +152,12 @@ export class GeoprocessingService extends CommonServiceBase {
152152
return this._processAsync({ url, callback });
153153
}
154154

155-
_processAsync({ url, method, callback, paramter }) {
155+
_processAsync({ url, method, callback, paramter, data }) {
156156
return this.request({
157157
url: url,
158158
method: method || 'GET',
159159
params: paramter,
160+
data,
160161
headers: { 'Content-type': 'application/json' },
161162
scope: this,
162163
success: callback,

test/common/iServer/GeoprocessingServiceSpec.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ describe('GeoprocessingService', () => {
104104
};
105105
const executeService = new GeoprocessingService(serverUrl);
106106
expect(executeService).not.toBeNull();
107-
spyOn(FetchRequest, 'get').and.callFake((url) => {
107+
spyOn(FetchRequest, 'get').and.callFake((url, params) => {
108+
expect(params).not.toBeNull();
109+
expect(params.parameter['readasfeaturerdd-dataConnInfo']).toBe('sdx --server=C:/Users/MEVHREVO/Desktop/mode/111.udbx --dbType=udbx --dataset=ccccc_result_R');
108110
const URL = serverUrl + '/sps.WorkflowProcessFactory.models:sps/execute';
109111
expect(url).toBe(URL);
110112
return Promise.resolve(new Response(`{"countrdd-resultCount":"12","succeed":true}`));
@@ -140,7 +142,10 @@ describe('GeoprocessingService', () => {
140142
};
141143
const submitJobService = new GeoprocessingService(serverUrl);
142144
expect(submitJobService).not.toBeNull();
143-
spyOn(FetchRequest, 'post').and.callFake((url) => {
145+
spyOn(FetchRequest, 'post').and.callFake((url, params) => {
146+
expect(params).not.toBeNull();
147+
var paramsObj = JSON.parse(params.replace(/'/g, '"'));
148+
expect(paramsObj.parameter['readasfeaturerdd-dataConnInfo']).toBe("sdx --server=C:/Users/MEVHREVO/Desktop/mode/111.udbx --dbType=udbx --dataset=ccccc_result_R");
144149
expect(url).toBe(`${serverUrl}/sps.WorkflowProcessFactory.models:sps/jobs`);
145150
return Promise.resolve(
146151
new Response(`{"jobID":"gp-20200916-104559-40E52","status":"started","succeed":true}`)

0 commit comments

Comments
 (0)