|
|
@@ -2,15 +2,19 @@ package com.malk.jiuyousimu.service.Impl;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.kingdee.bos.webapi.entity.RepoRet;
|
|
|
import com.kingdee.bos.webapi.sdk.K3CloudApi;
|
|
|
+import com.malk.jiuyousimu.entity.basic.Push;
|
|
|
import com.malk.jiuyousimu.entity.basic.Query;
|
|
|
import com.malk.jiuyousimu.entity.basic.View;
|
|
|
import com.malk.jiuyousimu.service.KingDeeService;
|
|
|
import com.malk.jiuyousimu.service.SupplierService;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Notice;
|
|
|
import com.malk.service.dingtalk.DDClient_Workflow;
|
|
|
import com.malk.utils.UtilFile;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
@@ -33,6 +37,8 @@ public class SupplierServiceImpl implements SupplierService {
|
|
|
private DDClient_Workflow ddClient_workflow;
|
|
|
@Autowired
|
|
|
private DDClient ddClient;
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Notice ddClient_notice;
|
|
|
@Override
|
|
|
public List<Map<String,Object>> getAllSupplierInfos() {
|
|
|
log.info("开始从金蝶获取供应商信息");
|
|
|
@@ -293,15 +299,69 @@ public class SupplierServiceImpl implements SupplierService {
|
|
|
public void testView(){
|
|
|
K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
|
|
|
View view = new View();
|
|
|
- view.setNumber("FYBX20220223000001");
|
|
|
- String formId = "ER_ExpReimbursement";
|
|
|
+// view.setNumber("AP00000505");
|
|
|
+// view.setId("100551.0");
|
|
|
+// String formId = "AP_Payable";
|
|
|
+
|
|
|
+
|
|
|
+ view.setNumber("FKD00000072");
|
|
|
+ String formId = "AP_PAYBILL";
|
|
|
try {
|
|
|
String resultJson = client.view(formId, JSON.toJSONString(view));
|
|
|
Gson gson = new Gson();
|
|
|
//对返回结果进行解析和校验
|
|
|
RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
|
|
if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(repoRet.getResult().getResult().toString());
|
|
|
+ JSONArray jsonArray = JSONArray.parseArray(jsonObject.get("PAYBILLENTRY").toString());
|
|
|
+ boolean isAllPay = true;
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject sonObject = JSONObject.parseObject(jsonArray.get(i).toString());
|
|
|
+ String fbankmsg = sonObject.get("FBANKMSG").toString();
|
|
|
+ if (!fbankmsg.contains("交易成功")){
|
|
|
+ isAllPay = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isAllPay){
|
|
|
+ String content = "你有一条单据已完成付款";
|
|
|
+ Map<String, Object> msg = UtilMap.map("msgtype, text", "text", UtilMap.map("content", content));
|
|
|
+ ddClient_notice.sendNotification(ddClient.getAccessToken(),Arrays.asList("603864663125953014"),null,false,msg);
|
|
|
+ }
|
|
|
System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
|
|
+ log.info("接口返回结果:{}",gson.toJson(repoRet.getResult()));
|
|
|
+ } else {
|
|
|
+ fail("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus()));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ fail(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void testPush(){
|
|
|
+ K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
|
|
|
+ Push push = new Push();
|
|
|
+ push.setIds("100551");
|
|
|
+// push.setTargetBillTypeId("FKDLX01_SYS");
|
|
|
+ push.setTargetFormId("AP_PAYBILL");
|
|
|
+ push.setIsEnableDefaultRule(true);
|
|
|
+ push.setIsDraftWhenSaveFail(true);
|
|
|
+
|
|
|
+// view.setNumber("AP00000505");
|
|
|
+// view.setId("100551.0");
|
|
|
+ String formId = "AP_Payable";
|
|
|
+
|
|
|
+// String formId = "AP_PAYBILL";
|
|
|
+ try {
|
|
|
+ String resultJson = client.push(formId, JSON.toJSONString(push));
|
|
|
+ Gson gson = new Gson();
|
|
|
+ //对返回结果进行解析和校验
|
|
|
+ RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
|
|
|
+ if (repoRet.getResult().getResponseStatus().isIsSuccess()) {
|
|
|
+ System.out.printf("接口返回结果: %s%n", gson.toJson(repoRet.getResult()));
|
|
|
+ log.info("接口返回结果:{}",gson.toJson(repoRet.getResult()));
|
|
|
+
|
|
|
} else {
|
|
|
fail("接口返回结果: " + gson.toJson(repoRet.getResult().getResponseStatus()));
|
|
|
}
|