|
|
|
import com.dxhy.order.constant.ConfigureConstant;
|
|
|
|
import com.dxhy.order.constant.OrderManagementConstant;
|
|
|
|
import com.dxhy.order.utils.HttpUtils;
|
|
|
|
import com.dxhy.order.utils.JsonUtils;
|
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author ZSC-DXHY
|
|
|
|
* @date 创建时间: 2019/5/25 10:43
|
|
|
|
*/
|
|
|
|
public class mryt_online_rushred {
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
/**
|
|
|
|
* 格式:发票代码,发票号码,销方税号
|
|
|
|
*/
|
|
|
|
List<String> gbk = FileUtils.readLines(new File("d://test/rushRed.txt"), StandardCharsets.UTF_8);
|
|
|
|
List<String> errorfphm = new ArrayList<>();
|
|
|
|
List<String> successfphm = new ArrayList<>();
|
|
|
|
for (int i = 0; i < gbk.size(); i++) {
|
|
|
|
String[] split = gbk.get(i).split(",");
|
|
|
|
Map<String, String> headMap = new HashMap<>(2);
|
|
|
|
headMap.put("Content-Type", ConfigureConstant.STRING_APPLICATION_JSON);
|
|
|
|
headMap.put("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsaWNlbnNlIjoibWFkZSBieSBoZWF2ZW4iLCJ1c2VyX25hbWUiOiIxODUzODIzNjA0OCIsInNjb3BlIjpbInNlcnZlciJdLCJ1c2VyVHlwZSI6IjEiLCJleHAiOjE2MzQyMDE1ODEsInVzZXJJZCI6MTAwMDIwNzE0OCwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImp0aSI6IjEzZDBiNGIxLWVjZDAtNGY1YS1iMDFhLTgwZDlhZTdlYWM4YyIsImNsaWVudF9pZCI6ImZhdGMifQ.vEuabpGepSnBBNtT1RLRg7IyIehikl1S7DQSom9k3cI");
|
|
|
|
|
|
|
|
|
|
|
|
String url = "http://sims.ele-cloud.com/order-api/invoice/rushRed";
|
|
|
|
// String url = "http://10.1.31.217:8087/order-api/invoice/rushRed";
|
|
|
|
Map<String, String> headMap1 = new HashMap<>(4);
|
|
|
|
headMap1.put("fpdm", split[0]);
|
|
|
|
headMap1.put("fphm", split[1]);
|
|
|
|
headMap1.put("chyy", "开重");
|
|
|
|
headMap1.put("xhfNsrsbh", "[\"" + split[2] + "\"]");
|
|
|
|
String post = HttpUtils.doPostWithHeader(url, JsonUtils.getInstance().toJsonString(headMap1), headMap);
|
|
|
|
|
|
|
|
System.out.println(post);
|
|
|
|
System.out.println("处理了" + i);
|
|
|
|
Map map = JsonUtils.getInstance().parseObject(post, Map.class);
|
|
|
|
String code = map.get(OrderManagementConstant.CODE).toString();
|
|
|
|
String msg = map.get("msg").toString();
|
|
|
|
if ("0000".equals(code)) {
|
|
|
|
System.out.println("==>处理成功的号码:" + split[0]);
|
|
|
|
successfphm.add(split[0]);
|
|
|
|
} else {
|
|
|
|
System.out.println("处理失败的序号为:" + i);
|
|
|
|
System.out.println("处理失败的号码:" + split[0]);
|
|
|
|
errorfphm.add(split[0]);
|
|
|
|
}
|
|
|
|
Thread.sleep(1000);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
System.err.println(JsonUtils.getInstance().toJsonString(successfphm));
|
|
|
|
System.err.println(JsonUtils.getInstance().toJsonString(errorfphm));
|
|
|
|
}
|
|
|
|
}
|