Преглед изворни кода

合并费用报销和差旅费报销

fyz пре 1 месец
родитељ
комит
3b5f02f75f

+ 25 - 1
mjava-jiuyousimu/src/main/java/com/malk/jiuyousimu/delegate/DDDelegate.java

@@ -1,11 +1,17 @@
 package com.malk.jiuyousimu.delegate;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.malk.delegate.DDEvent;
+import com.malk.jiuyousimu.entity.basic.FNumber;
+import com.malk.jiuyousimu.entity.reimbursement.CostDetail;
 import com.malk.jiuyousimu.service.DeptService;
 import com.malk.jiuyousimu.service.DingTalkService;
 import com.malk.jiuyousimu.service.DocumentService;
 import com.malk.service.dingtalk.DDClient;
 import com.malk.service.dingtalk.DDClient_Workflow;
+import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -13,6 +19,7 @@ import org.springframework.context.annotation.Primary;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -87,7 +94,24 @@ public class DDDelegate implements DDEvent {
             }else if (cost.equals(processCode)){
                 documentService.saveCost(processData);
             } else if (trip.equals(processCode)) {
-                documentService.saveTrip(processData);
+                List<Map> formComponentValues = (List<Map>) processData.get("formComponentValues");
+                String type = "";
+                for (int i = 0; i < formComponentValues.size(); i++) {
+                    Object componentType = formComponentValues.get(i).get("componentType");
+                    if (!"TextNote".equals(componentType) && !"TableField".equals(componentType)){
+                        String name = formComponentValues.get(i).get("name").toString();
+                        String value = formComponentValues.get(i).get("value").toString();
+                        if ("报销类型".equals(name)){
+                            type = value;
+                            break;
+                        }
+                    }
+                }
+                if ("差旅费报销".equals(type)){
+                    documentService.saveTrip(processData);
+                } else if ("费用报销".equals(type)) {
+                    documentService.saveCost(processData);
+                }
             }
         }
     }

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

@@ -400,7 +400,7 @@ public class DocumentServiceImpl implements DocumentService {
         costMain.setFBillTypeID(new BillTypeID("FYBXD001_SYS"));
         costMain.setFDATE(LocalDate.parse(UtilMap.getString(mainData,"申请日期").substring(0,10)));
         costMain.setFCurrencyID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"币别"))));
-        costMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
+        costMain.setFOrgID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"选择报销公司主体"))));
         costMain.setFCausa(UtilMap.getString(mainData,"报销事由"));
         costMain.setFProposerID(new FSTAFFNUMBER(userId));
         if (HISTORY_DEPTID.containsKey(userDeptName)){
@@ -413,12 +413,12 @@ public class DocumentServiceImpl implements DocumentService {
 //        costMain.setFProposerID(new FNumber("0062"));
 //        costMain.setFRequestDeptID(new FNumber("1069359193"));//测试
 //        costMain.setFExpenseDeptID(new FNumber("1069359193"));//测试
-        costMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
+        costMain.setFExpenseOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"选择报销公司主体"))));
         costMain.setFCONTACTUNITTYPE("BD_Empinfo");
         costMain.setFCONTACTUNIT(new FNumber(userId));
         costMain.setFLocCurrencyID(new FNumber("PRE001"));
         costMain.setFExchangeTypeID(new FNumber("HLTX01_SYS"));
-        costMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"所属公司主体"))));
+        costMain.setFPayOrgId(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"选择报销公司主体"))));
         costMain.setFPaySettlleTypeID(new FNumber(UtilMap.getString(ALL_ENUM,UtilMap.getString(mainData,"结算方式"))));
 //        costMain.setFRefundBankAccount(new FNumber(UtilMap.getString(mainData,"收款账号")));
         costMain.setFBankAccountT(UtilMap.getString(mainData,"收款账号"));