提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.util; |
A |
2 |
|
|
3 |
import java.util.concurrent.Callable; |
|
4 |
|
|
5 |
import org.apache.commons.lang3.StringUtils; |
|
6 |
|
|
7 |
import com.google.gson.JsonObject; |
|
8 |
import com.google.gson.JsonParser; |
|
9 |
import com.mandi.common.JSONobj; |
|
10 |
import com.mandi.common.Wxhtmethod; |
|
11 |
import com.mandi.common.ParamFileter.Fileoperation; |
|
12 |
import com.mandi.dao.common.ObjectResult; |
|
13 |
|
|
14 |
public class PostNCTask implements Callable<ObjectResult<Boolean>>{ |
|
15 |
|
|
16 |
private String joStr; |
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
public PostNCTask(String joStr) { |
|
21 |
super(); |
|
22 |
this.joStr = joStr; |
|
23 |
} |
|
24 |
|
|
25 |
@Override |
|
26 |
public ObjectResult<Boolean> call() throws Exception { |
|
27 |
ObjectResult<Boolean> orr=new ObjectResult<Boolean>(); |
|
28 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 请求参数 ::" + joStr); |
|
29 |
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, joStr); |
|
30 |
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 返回值 ::" + joADDYWD); |
|
31 |
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) { |
|
32 |
orr.setCode(1); |
|
33 |
orr.setErrmsg(StringUtils.isEmpty(joADDYWD.get("msg").getAsString()) ? "分单回写NC系统出错!": joADDYWD.get("msg").getAsString()); |
|
34 |
return orr; |
|
35 |
} else { |
|
36 |
String restult = joADDYWD.get("result").getAsString(); |
|
37 |
JsonParser jp = new JsonParser(); |
|
38 |
JsonObject jr = jp.parse(restult).getAsJsonObject(); |
|
39 |
if (jr == null || JSONobj.getint(jr, "respcode") != 111) { |
|
40 |
orr.setCode(1); |
|
41 |
orr.setErrmsg(jr.get("respmsg").getAsString()); |
|
42 |
return orr; |
|
43 |
} |
|
44 |
} |
|
45 |
orr.setCode(0); |
|
46 |
orr.setItem(true); |
|
47 |
return orr; |
|
48 |
} |
|
49 |
|
|
50 |
} |