Przeglądaj źródła

完成推送金蝶测试对接

fyz 2 tygodni temu
rodzic
commit
f140caa636

+ 11 - 2
mjava-jiuyousimu/pom.xml

@@ -10,7 +10,7 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>mjava-jiuyousimu</artifactId>
-    <description>上海航食</description>
+    <description>久有私募</description>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
@@ -30,7 +30,16 @@
             <artifactId>sqlite-jdbc</artifactId>
             <version>3.41.2.1</version>
         </dependency>
-
+        <dependency>
+            <groupId>com.example</groupId>
+            <artifactId>k3cloud</artifactId>
+            <version>8.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.example</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.0</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 4 - 2
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/controller/DLController.java

@@ -74,8 +74,10 @@ public class DLController {
         return McR.success();
     }
     @PostMapping(value = "testGet")
-    McR testGet(@RequestBody Map data) {
-        personService.personCreate(UtilMap.getList(data,"list"));
+    McR testGet(@RequestParam("id") String processInstanceId) {
+        String token = ddClient.getAccessToken(APP_EKY, APP_SECRET);
+        Map processData = ddClient_workflow.getProcessInstanceId(token, processInstanceId);
+        documentService.savePayment(processData);
         return McR.success();
     }
     @PostMapping(value = "testQuery")

+ 0 - 1
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/entity/reimbursement/CostMain.java

@@ -3,7 +3,6 @@ package com.malk.jiuyousimu.entity.reimbursement;
 import com.malk.jiuyousimu.entity.basic.BillTypeID;
 import com.malk.jiuyousimu.entity.basic.FNumber;
 import com.malk.jiuyousimu.entity.basic.FSTAFFNUMBER;
-import com.malk.jiuyousimu.entity.payment.PaymentDetail;
 import lombok.Data;
 
 import java.time.LocalDate;

+ 15 - 0
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/service/DocumentService.java

@@ -10,9 +10,24 @@ import java.util.Map;
  */
 public interface DocumentService {
 
+    /**
+     * 差旅费报销
+     * @param processData
+     * @return
+     */
     McR saveTrip(Map processData);
 
+    /**
+     * 费用报销
+     * @param processData
+     * @return
+     */
     McR saveCost(Map processData);
 
+    /**
+     * 支付申请
+     * @param processData
+     * @return
+     */
     McR savePayment(Map processData);
 }

+ 3 - 3
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/service/Impl/DeptServiceImpl.java

@@ -1,10 +1,10 @@
 package com.malk.jiuyousimu.service.Impl;
-import com.malk.jiuyousimu.entity.basic.FNumber;
-
-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.FNumber;
+
+import com.alibaba.fastjson.JSONObject;
 import com.malk.jiuyousimu.entity.*;
 import com.malk.jiuyousimu.entity.basic.Audit;
 import com.malk.jiuyousimu.entity.basic.Delete;

+ 60 - 57
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/service/Impl/DocumentServiceImpl.java

@@ -1,12 +1,12 @@
 package com.malk.jiuyousimu.service.Impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.malk.jiuyousimu.entity.basic.*;
-
-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.*;
+
+import com.alibaba.fastjson.JSONObject;
 import com.malk.jiuyousimu.entity.payment.PaymentDetail;
 import com.malk.jiuyousimu.entity.payment.PaymentMain;
 import com.malk.jiuyousimu.entity.reimbursement.CostDetail;
@@ -482,11 +482,14 @@ public class DocumentServiceImpl implements DocumentService {
                                         paymentDetail.setFEntryTaxRate(UtilMap.getDouble(jsonObject, "value"));
                                         break;
                                     case "税额":
-                                        paymentDetail.setFNoTaxAmountFor_D(UtilMap.getDouble(jsonObject, "value"));
+                                        paymentDetail.setFTAXAMOUNTFOR_D(UtilMap.getDouble(jsonObject, "value"));
                                         break;
-                                    case "金额(非税)":
+                                    case "小计":
                                         paymentDetail.setFALLAMOUNTFOR_D(UtilMap.getDouble(jsonObject, "value"));
                                         break;
+                                    case "金额(非税)":
+                                        paymentDetail.setFNoTaxAmountFor_D(UtilMap.getDouble(jsonObject, "value"));
+                                        break;
                                 }
                             }
                             paymentDetails.add(paymentDetail);
@@ -514,7 +517,7 @@ public class DocumentServiceImpl implements DocumentService {
                         JSONObject field = rowValues.getJSONObject(i);
                         String label = field.getString("label");
                         if ("供应商编号".equals(label)) {
-                           paymentMain.setFSUPPLIERID(new FNumber(field.getString("value")));
+                            paymentMain.setFSUPPLIERID(new FNumber(field.getString("value")));
                         }
                     }
                 }
@@ -522,59 +525,59 @@ public class DocumentServiceImpl implements DocumentService {
                     mainData.put(name, e.get("value"));
                 }
             }
-            });
-            Save save = new Save();
-
-            paymentMain.setFBUSINESSTYPE("FY");
-            paymentMain.setFBillTypeID(new BillTypeID("YFD02_SYS"));
-            paymentMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"业务日期").substring(0,10)));
-            paymentMain.setFENDDATE_H(LocalDate.parse(UtilMap.getString(mainData,"付款到期日").substring(0,10)));
-            paymentMain.setFDOCUMENTSTATUS("A");//单据状态为创建
-            paymentMain.setFCURRENCYID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
-            paymentMain.setFPAYORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
-            paymentMain.setFSETTLEORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
-            paymentMain.setFPURCHASEDEPTID(new FNumber(userDeptId));
-            paymentMain.setFAP_Remark(UtilMap.getString(mainData,"备注"));
+        });
+        Save save = new Save();
+
+        paymentMain.setFBUSINESSTYPE("FY");
+        paymentMain.setFBillTypeID(new BillTypeID("YFD02_SYS"));
+        paymentMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"业务日期").substring(0,10)));
+        paymentMain.setFENDDATE_H(LocalDate.parse(UtilMap.getString(mainData,"付款到期日").substring(0,10)));
+        paymentMain.setFDOCUMENTSTATUS("A");//单据状态为创建
+        paymentMain.setFCURRENCYID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
+        paymentMain.setFPAYORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"选择支付主体"))));
+        paymentMain.setFSETTLEORGID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"选择支付主体"))));
+        paymentMain.setFPURCHASEDEPTID(new FNumber(userDeptId));
+        paymentMain.setFAP_Remark(UtilMap.getString(mainData,"备注"));
 //        paymentMain.setFPURCHASERID(new FNumber());
-            paymentMain.setFEntityDetail(paymentDetails);
-
-            save.setModel(paymentMain);
-            System.out.println(save);
-
-            try{
-                K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
-                //业务对象标识
-                String formId = "AP_Payable";
-                //调用接口
-                String resultJson = client.save(formId,JSONObject.toJSONString(save));
-                //用于记录结果
-                Gson gson = new Gson();
-                //对返回结果进行解析和校验
-                RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
-
-                if (kingDeeService.isTrue(repoRet)){
-                    String id = repoRet.getResult().getId();
-
-                    Submit submit = new Submit();
-                    submit.setIds(id);
-                    //提交
-                    String resultJson2 = client.submit(formId, JSONObject.toJSONString(submit));
-                    RepoRet repoRet2 = gson.fromJson(resultJson2, RepoRet.class);
-                    kingDeeService.isTrue(repoRet2);
-
-                    if (kingDeeService.isTrue(repoRet2)){
-                        Audit audit = new Audit();
-                        audit.setIds(id);
-                        //审核
-                        String resultJson3 = client.audit(formId,JSONObject.toJSONString(audit));
-                        RepoRet repoRet3 = gson.fromJson(resultJson3, RepoRet.class);
-                        kingDeeService.isTrue(repoRet3);
-                    }
+        paymentMain.setFEntityDetail(paymentDetails);
+
+        save.setModel(paymentMain);
+        System.out.println(save);
+
+        try{
+            K3CloudApi client = new K3CloudApi(kingDeeService.initIden());
+            //业务对象标识
+            String formId = "AP_Payable";
+            //调用接口
+            String resultJson = client.save(formId,JSONObject.toJSONString(save));
+            //用于记录结果
+            Gson gson = new Gson();
+            //对返回结果进行解析和校验
+            RepoRet repoRet = gson.fromJson(resultJson, RepoRet.class);
+
+            if (kingDeeService.isTrue(repoRet)){
+                String id = repoRet.getResult().getId();
+
+                Submit submit = new Submit();
+                submit.setIds(id);
+                //提交
+                String resultJson2 = client.submit(formId, JSONObject.toJSONString(submit));
+                RepoRet repoRet2 = gson.fromJson(resultJson2, RepoRet.class);
+                kingDeeService.isTrue(repoRet2);
+
+                if (kingDeeService.isTrue(repoRet2)){
+                    Audit audit = new Audit();
+                    audit.setIds(id);
+                    //审核
+                    String resultJson3 = client.audit(formId,JSONObject.toJSONString(audit));
+                    RepoRet repoRet3 = gson.fromJson(resultJson3, RepoRet.class);
+                    kingDeeService.isTrue(repoRet3);
                 }
-            } catch (Exception e) {
-                McR.errorUnknown(e.getMessage());
             }
-
-            return McR.success();
+        } catch (Exception e) {
+            McR.errorUnknown(e.getMessage());
         }
+
+        return McR.success();
     }
+}

+ 10 - 1
pom.xml

@@ -158,7 +158,16 @@
                 <artifactId>easyexcel</artifactId>
                 <version>${easyexcel.version}</version>
             </dependency>
-
+            <dependency>
+                <groupId>com.example</groupId>
+                <artifactId>k3cloud</artifactId>
+                <version>8.0.6</version>
+            </dependency>
+            <dependency>
+                <groupId>com.example</groupId>
+                <artifactId>gson</artifactId>
+                <version>2.8.0</version>
+            </dependency>
             <!-- mySql 驱动 -->
             <dependency>
                 <groupId>mysql</groupId>