Parcourir la source

锤子塑业控制层更新

fyz il y a 3 mois
Parent
commit
3409e6a59d

+ 18 - 3
mjava-chuizi/src/main/java/com/malk/chuizi/controller/ChuiziController.java

@@ -2,9 +2,12 @@ package com.malk.chuizi.controller;
 
 import com.malk.chuizi.service.ChuiZiService;
 import com.malk.server.common.McR;
+import com.malk.service.dingtalk.DDClient;
+import com.malk.service.dingtalk.DDClient_Workflow;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Map;
@@ -14,15 +17,27 @@ public class ChuiziController {
 
     @Autowired
     ChuiZiService chuiZiService;
+
+    @Autowired
+    private DDClient ddClient;
+
+    @Autowired
+    private DDClient_Workflow ddClient_workflow;
+
+    /// dingtalk
+    final String APP_EKY = "ding9seotugcsfjlgy8h";
+    final String APP_SECRET = "4k6hoCDUwwpUG5WXijfWcnzIm97j_zGquJqXJgrkBcyp2vo7ceV6dO-nSDUUDMhE";
     @GetMapping("/test")
     public McR test(){
         return McR.success();
     }
 
     //新增其他应付单
-    @PostMapping("/saveAccountsPayable")
-    public McR saveOtherMeet(Map processData) {
-        return chuiZiService.saveAccountsPayable(processData);
+    @PostMapping("/saveOtherMeet")
+    public McR saveOtherMeet(@RequestBody Map data) {
+        String token = ddClient.getAccessToken(APP_EKY, APP_SECRET);
+        Map processData = ddClient_workflow.getProcessInstanceId(token, data.get("id").toString());
+        return chuiZiService.saveOtherMeet(processData);
     }
 
 

+ 33 - 9
mjava-chuizi/src/main/java/com/malk/chuizi/service/impl/ChuiZiServiceImpl.java

@@ -210,7 +210,7 @@ public class ChuiZiServiceImpl implements ChuiZiService {
         List<Map<String,Object>> sonData = new ArrayList<>();
         formComponentValues.forEach(e->{
             String name = e.get("name").toString();
-            if ("金蝶科目".equals(name) || "报销科目".equals(name) || "归属部门".equals(name) || "发票类型".equals(name) || "申请人".equals(name) ) {
+            if ("金蝶科目".equals(name) || "报销科目".equals(name) || "归属部门".equals(name) || "发票类型".equals(name) || "申请人".equals(name) || "报销类型".equals(name) || "金额".equals(name)) {
                 mainData.put(name, e.get("value"));
             } else if ("TableField".equals(e.get("componentType"))) {
                 Object parse = JSON.parse(e.get("value").toString());
@@ -252,7 +252,20 @@ public class ChuiZiServiceImpl implements ChuiZiService {
             }
         });
         List<Object> objects  = new ArrayList<>();
-        if (ObjectUtil.isNotNull(sonData) && sonData.size()>0){
+        if ("管理费用报销".equals(mainData.get("报销类型"))){
+            OtherMeetEntity otherMeetEntity = new OtherMeetEntity();
+            otherMeetEntity.setFCOSTID(new FNumber(mainData.get("金蝶科目").toString()));
+            otherMeetEntity.setFINVOICETYPE(mainData.get("发票类型").toString());
+            otherMeetEntity.setFCOSTDEPARTMENTID(new FNumber(DEPARTMENT.get(mainData.get("归属部门").toString())));
+            otherMeetEntity.setFEntryTaxRate(0.0);
+            otherMeetEntity.setFNOTAXAMOUNTFOR(Double.parseDouble(mainData.get("金额").toString()));
+            otherMeetEntity.setFTAXAMOUNTFOR(0.0);
+            otherMeetEntity.setFTOTALAMOUNTFOR(Double.parseDouble(mainData.get("金额").toString()));
+            otherMeetEntity.setFPaySubEntity(null);
+
+            objects.add(otherMeetEntity);
+
+        }else if(ObjectUtil.isNotNull(sonData) && sonData.size()>0){
             sonData.forEach(e->{
                 OtherMeetEntity otherMeetEntity = new OtherMeetEntity();
                 otherMeetEntity.setFCOSTID(new FNumber(mainData.get("金蝶科目").toString()));
@@ -270,7 +283,7 @@ public class ChuiZiServiceImpl implements ChuiZiService {
         otherMeet.setFEntity(objects);
 
         save.setModel(otherMeet);
-        System.out.println(save);
+//        System.out.println(save);
 
         try{
             K3CloudApi client = new K3CloudApi(initIden());
@@ -322,8 +335,7 @@ public class ChuiZiServiceImpl implements ChuiZiService {
         Save save = new Save();
 
         Model model = new Model();
-        model.setFCONTACTUNITTYPE("BD_Supplier");
-        model.setFBillTypeID(new BillTypeID("FKDLX01_SYS"));
+
         model.setFDATE(LocalDateTimeUtil.format(LocalDate.now(),"yyyy-MM-dd"));
         model.setFCURRENCYID(new FNumber("PRE001"));//币别
         List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
@@ -336,10 +348,22 @@ public class ChuiZiServiceImpl implements ChuiZiService {
         });
         List<AccountsPayableEntity> objects  = new ArrayList<>();
         if (ObjectUtil.isNotNull(mainData)){
-            //主表
-            model.setFREMARK(mainData.get("付款事由").toString());
-            model.setFRECTUNIT(new FNumber(mainData.get("供应商编码").toString()));
-            model.setFCONTACTUNIT(new FNumber(mainData.get("供应商编码").toString()));
+            if ("采购业务付款单".equals(mainData.get("单据类型"))){
+                //主表
+                model.setFREMARK(mainData.get("付款事由").toString());
+                model.setFRECTUNIT(new FNumber(mainData.get("供应商编码").toString()));
+                model.setFCONTACTUNIT(new FNumber(mainData.get("供应商编码").toString()));
+                model.setFCONTACTUNITTYPE("BD_Supplier");
+                model.setFBillTypeID(new BillTypeID("FKDLX01_SYS"));
+            }else {
+                //主表
+                model.setFREMARK(mainData.get("付款事由").toString());
+                model.setFRECTUNITTYPE("BD_Empinfo");
+                model.setFRECTUNIT(new FNumber("003"));
+                model.setFCONTACTUNITTYPE("BD_Empinfo");
+                model.setFCONTACTUNIT(new FNumber("003"));
+                model.setFBillTypeID(new BillTypeID("FKDLX03_SYS"));
+            }
             //明细
             AccountsPayableEntity accountsPayableEntity = new AccountsPayableEntity();
             accountsPayableEntity.setFSETTLETYPEID(new FNumber(PAYMENT_METHOD.get(mainData.get("付款方式"))));//结算方式