|
@@ -1,28 +1,51 @@
|
|
package com.idea.invoice.util;
|
|
package com.idea.invoice.util;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.IdUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.http.HttpUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.idea.invoice.model.InvoiceManage;
|
|
import com.idea.invoice.model.InvoiceManage;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import nccloud.open.api.auto.token.cur.utils.APICurUtils;
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
public class InvoiceUtil {
|
|
public class InvoiceUtil {
|
|
|
|
|
|
- public static final String prefix = "http://10.1.2.17:8999/";
|
|
|
|
|
|
|
|
- public static void sendInvoice(InvoiceManage record){
|
|
|
|
|
|
+ public static final String ip = "10.1.2.51";
|
|
|
|
|
|
- String url = "nccloud/api/wxyy/arap/gatheringbill/saveandcommit";
|
|
|
|
- HashMap<String, Object> paramMap = new HashMap<>();
|
|
|
|
- log.info("请求参数——:{}", JSONUtil.toJsonStr(paramMap));
|
|
|
|
- String result = HttpUtil.post(prefix + url, JSONUtil.toJsonStr(paramMap));
|
|
|
|
- log.info("发送消息接口返回——:{}",result);
|
|
|
|
|
|
+ public static final String port = "9999";
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ public static final String biz_center = "CJJT";
|
|
|
|
+
|
|
|
|
+ public static final String client_id = "ajbzf";
|
|
|
|
+
|
|
|
|
+ public static final String client_secret = "c7ac88aa8be64197be9b";
|
|
|
|
+
|
|
|
|
+ public static final String pubKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApX9UZNt0EbdHBRGnR3SpgiP+1BEZf+1DpbYoJ0kJJuba7ZBhH+WDjSlRpEPA0FOFRyE0OvIMK5yIaodLRfeEgDyz+Jv5dnOBdS2gJqeVV/ugm5nk7TGAM/65PeFQxua3QgFeTJjZU/lGCHHl5oKRFgmB9/kumuryydKpOOkeT2fYjzoG8feuIhDoOGfR4y5sjTUFH4nN8VCE/zXylVEbj2hMeJSDzdESAy3+Ui64smCv6ZsLVgsWXhhLFsLWzkbh7/pElnoK3qhr6MVeAIokd7bS+Hp+6S5s10jwjPkd+POX/qQSHP1MmVngLlD7P0caxjQaH3+w8KsLQoydeUARVQIDAQAB";
|
|
|
|
|
|
|
|
+ public static final String username = "ajbzf";
|
|
|
|
|
|
|
|
+ public static final String password = "1234qwer!";
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) throws Exception {
|
|
|
|
+ APICurUtils util = new APICurUtils();
|
|
|
|
+ util.init(ip, port, biz_center, client_id, client_secret, pubKey, username, password);
|
|
|
|
+ String token = util.getToken();
|
|
|
|
+ System.out.println(" 获取token=========" + token);
|
|
|
|
+ util.setApiUrl("nccloud/api/wxyy/uapbd/defdoc/add");
|
|
|
|
+ JSONObject json = new JSONObject();
|
|
|
|
+ json.put("srcsystemid", IdUtil.simpleUUID());
|
|
|
|
+ json.put("code","100");
|
|
|
|
+ json.put("name","演示项目二-分期一-1号楼-一单元-901");
|
|
|
|
+ json.put("pk_org","0102");
|
|
|
|
+ json.put("pk_defdoclist","CJ21");
|
|
|
|
+ String result = util.getAPIRetrun(token, json.toJSONString());
|
|
|
|
+ System.out.println(" 接口结果=========" + result);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|