package com.mandi.fendan.util;
|
|
import java.util.concurrent.Callable;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import com.google.gson.JsonObject;
|
import com.google.gson.JsonParser;
|
import com.mandi.common.JSONobj;
|
import com.mandi.common.Wxhtmethod;
|
import com.mandi.common.ParamFileter.Fileoperation;
|
import com.mandi.dao.common.ObjectResult;
|
|
public class PostNCTask implements Callable<ObjectResult<Boolean>>{
|
|
private String joStr;
|
|
|
|
public PostNCTask(String joStr) {
|
super();
|
this.joStr = joStr;
|
}
|
|
@Override
|
public ObjectResult<Boolean> call() throws Exception {
|
ObjectResult<Boolean> orr=new ObjectResult<Boolean>();
|
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 请求参数 ::" + joStr);
|
JsonObject joADDYWD = Wxhtmethod.postJsonStr(Contants.NCfdhx_url, joStr);
|
Fileoperation.AppendContentToFile(Fileoperation.gettestFileName(), "取消配车业务单 返回值 ::" + joADDYWD);
|
if (joADDYWD == null || JSONobj.getint(joADDYWD, "code") != 0) {
|
orr.setCode(1);
|
orr.setErrmsg(StringUtils.isEmpty(joADDYWD.get("msg").getAsString()) ? "分单回写NC系统出错!": joADDYWD.get("msg").getAsString());
|
return orr;
|
} else {
|
String restult = joADDYWD.get("result").getAsString();
|
JsonParser jp = new JsonParser();
|
JsonObject jr = jp.parse(restult).getAsJsonObject();
|
if (jr == null || JSONobj.getint(jr, "respcode") != 111) {
|
orr.setCode(1);
|
orr.setErrmsg(jr.get("respmsg").getAsString());
|
return orr;
|
}
|
}
|
orr.setCode(0);
|
orr.setItem(true);
|
return orr;
|
}
|
|
}
|