Kaynağa Gözat

Merge branch 'master' of https://mc.cloudpure.cn/mjava/cont

wzy 3 ay önce
ebeveyn
işleme
fbe65cecbe

+ 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("付款方式"))));//结算方式

+ 6 - 0
mjava-pake/src/main/java/com/malk/pake/controller/PkProjectController.java

@@ -6,6 +6,7 @@ import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -46,6 +47,11 @@ public class PkProjectController {
         }
         return McR.success();
     }
+    @PostMapping("/testTrain")
+    public void testTrain(@RequestBody Map data){
+        pkProjectService.getTrainInternal(data.get("startDate").toString(),data.get("endDate").toString());
+    }
+
 
 
 }

+ 1 - 1
mjava-pake/src/main/resources/application-dev.yml

@@ -4,7 +4,7 @@ server:
     context-path: /pake
 spring:
   datasource:
-    url: jdbc:mysql://47.97.181.40:3306/dingtalk?serverTimezone=GMT%2B8
+    url: jdbc:mysql://47.110.74.198:3306/dingtalk?serverTimezone=GMT%2B8
     username: root
     password: cp-root@2022++
     driver-class-name: com.mysql.cj.jdbc.Driver

+ 1 - 1
mjava-pake/src/main/resources/application-prod.yml

@@ -4,7 +4,7 @@ server:
     context-path: /pake
 spring:
   datasource:
-    url: jdbc:mysql://47.97.181.40:3306/dingtalk?serverTimezone=GMT%2B8
+    url: jdbc:mysql://127.0.0.1:3306/dingtalk?serverTimezone=GMT%2B8
     username: root
     password: cp-root@2022++
     driver-class-name: com.mysql.cj.jdbc.Driver