wzy 1 hónapja%!(EXTRA string=óta)
szülő
commit
5cd7c57ce9

+ 44 - 12
mjava-siku/src/main/java/com/malk/siku/service/impl/SikuServiceImpl.java

@@ -436,10 +436,10 @@ public class SikuServiceImpl implements SikuService {
         if ("常规需求".equals(type)){
             List<Map> detailList = UtilMap.getList(formData, "tableField_mkkmij56");//常规-采购明细
 
-            int index = 0;
             for (Map detail : detailList) {
-                index++;
                 String uuid = UtilMap.getString(detail, "textField_mmvhqm0q");//子表uuid
+                int index = UtilMap.getInt(detail, "numberField_mn36ykxx");//子表index
+
                 Map body = new HashMap();
                 body.put("formCode",xqbh + "-" + index);//有值时会使用该值作为单据号
                 body.put("formSubTypeBizCode",formSubTypeBizCode);//表单类型的业务编号
@@ -489,7 +489,7 @@ public class SikuServiceImpl implements SikuService {
                 expenseListItem.put("consumeAmount",consumeAmount);
                 expenseListItem.put("corpExpense",true);//是否对公费用,需要填写true
                 String gysej = UtilMap.getString(detail, "selectField_mkkkw28y");//供应商二级
-                expenseListItem.put("expenseTypeBizCode",MkBxUtil.expenseTypeSearch(UtilMap.map("keyword",gysej)));//费用类型业务编码
+                expenseListItem.put("expenseTypeBizCode",UtilMap.getString(detail,"textField_mp0m3ks3"));//费用类型业务编码
                 expenseListItem.put("corpType","NO_RECEIPT");//业务场景:ALL_RECEIPTS(全部到票) NO_RECEIPT(预付未到票) RECEIPT_DEDUCTION(到票核销) RECEIPT_PAY_SOME(到票部分支付或不支付) PAY_BEFORE_RECEIPT(支付前期已到的发票)
                 expenseListItem.put("nonReceiptAmount",new HashMap<>(consumeAmount));//未到票金额(预付未到票场景必填)
                 expenseListItem.put("forecastReceiptDate",System.currentTimeMillis());//预计到票时间(预付未到票场景必填)
@@ -527,10 +527,10 @@ public class SikuServiceImpl implements SikuService {
         }else {
             List<Map> detailList = UtilMap.getList(formData, "tableField_mkkmij61");//free-采购明细
 
-            int index = 0;
             for (Map detail : detailList) {
-                index ++;
                 String uuid = UtilMap.getString(detail, "textField_mmvhqm0s");//子表uuid
+                int index = UtilMap.getInt(detail, "numberField_mn36ykxz");//子表index
+
                 Map body = new HashMap();
                 body.put("formCode",xqbh + "-" +index);//有值时会使用该值作为单据号
                 body.put("formSubTypeBizCode",formSubTypeBizCode);//表单类型的业务编号
@@ -578,7 +578,7 @@ public class SikuServiceImpl implements SikuService {
                 expenseListItem.put("consumeAmount",consumeAmount);
                 expenseListItem.put("corpExpense",true);//是否对公费用,需要填写true
                 String gysej = UtilMap.getString(detail, "selectField_mmwuzaql");//供应商二级
-                expenseListItem.put("expenseTypeBizCode",MkBxUtil.expenseTypeSearch(UtilMap.map("keyword",gysej)));//费用类型业务编码
+                expenseListItem.put("expenseTypeBizCode",UtilMap.getString(detail,"textField_mp0m3ks5"));//费用类型业务编码
                 expenseListItem.put("corpType","NO_RECEIPT");//业务场景:ALL_RECEIPTS(全部到票) NO_RECEIPT(预付未到票) RECEIPT_DEDUCTION(到票核销) RECEIPT_PAY_SOME(到票部分支付或不支付) PAY_BEFORE_RECEIPT(支付前期已到的发票)
                 expenseListItem.put("nonReceiptAmount",new HashMap<>(consumeAmount));//未到票金额(预付未到票场景必填)
                 expenseListItem.put("forecastReceiptDate",System.currentTimeMillis());//预计到票时间(预付未到票场景必填)
@@ -1256,10 +1256,9 @@ public class SikuServiceImpl implements SikuService {
         //针对多供应商分期付款拆分多条每刻项目支付单
         if ("常规采购".equals(type)){
             List<Map> detailList = UtilMap.getList(formData, "tableField_mkkmij56");//常规-采购明细
-            int index = 0;
             for (Map detail : detailList) {
-                index++;
                 String uuid = UtilMap.getString(detail, "textField_mmvhqm0q");//子表uuid
+                int index = UtilMap.getInt(detail, "numberField_mn36ykxx");//子表uuid
 
                 Map body = new HashMap();
                 body.put("formCode",xqbh + "-" + index);//有值时会使用该值作为单据号
@@ -1308,7 +1307,7 @@ public class SikuServiceImpl implements SikuService {
                 expenseListItem.put("consumeAmount",consumeAmount);
                 expenseListItem.put("corpExpense",true);//是否对公费用,需要填写true
                 String gysej = UtilMap.getString(detail, "selectField_mkkkw28y");//供应商二级
-                expenseListItem.put("expenseTypeBizCode",MkBxUtil.expenseTypeSearch(UtilMap.map("keyword",gysej)));//费用类型业务编码
+                expenseListItem.put("expenseTypeBizCode",UtilMap.getString(detail,"textField_mp0m3ks3"));//费用类型业务编码
                 expenseListItem.put("corpType","NO_RECEIPT");//业务场景:ALL_RECEIPTS(全部到票) NO_RECEIPT(预付未到票) RECEIPT_DEDUCTION(到票核销) RECEIPT_PAY_SOME(到票部分支付或不支付) PAY_BEFORE_RECEIPT(支付前期已到的发票)
                 expenseListItem.put("nonReceiptAmount",new HashMap<>(consumeAmount));//未到票金额(预付未到票场景必填)
                 expenseListItem.put("forecastReceiptDate",System.currentTimeMillis());//预计到票时间(预付未到票场景必填)
@@ -1346,10 +1345,10 @@ public class SikuServiceImpl implements SikuService {
         }else {
             List<Map> detailList = UtilMap.getList(formData, "tableField_mkkmij61");//free-采购明细
 
-            int index = 0;
             for (Map detail : detailList) {
-                index ++;
                 String uuid = UtilMap.getString(detail, "textField_mmvhqm0s");//子表uuid
+                int index = UtilMap.getInt(detail, "numberField_mn36ykxz");//子表uuid
+
                 Map body = new HashMap();
                 body.put("formCode",xqbh + "-" +index);//有值时会使用该值作为单据号
                 body.put("formSubTypeBizCode",formSubTypeBizCode);//表单类型的业务编号
@@ -1398,7 +1397,7 @@ public class SikuServiceImpl implements SikuService {
                 expenseListItem.put("consumeAmount",consumeAmount);
                 expenseListItem.put("corpExpense",true);//是否对公费用,需要填写true
                 String gysej = UtilMap.getString(detail, "selectField_mmwuzaql");//供应商二级
-                expenseListItem.put("expenseTypeBizCode",MkBxUtil.expenseTypeSearch(UtilMap.map("keyword",gysej)));//费用类型业务编码
+                expenseListItem.put("expenseTypeBizCode",UtilMap.getString(detail,"textField_mp0m3ks5"));//费用类型业务编码
                 expenseListItem.put("corpType","NO_RECEIPT");//业务场景:ALL_RECEIPTS(全部到票) NO_RECEIPT(预付未到票) RECEIPT_DEDUCTION(到票核销) RECEIPT_PAY_SOME(到票部分支付或不支付) PAY_BEFORE_RECEIPT(支付前期已到的发票)
                 expenseListItem.put("nonReceiptAmount",new HashMap<>(consumeAmount));//未到票金额(预付未到票场景必填)
                 expenseListItem.put("forecastReceiptDate",System.currentTimeMillis());//预计到票时间(预付未到票场景必填)
@@ -1955,6 +1954,7 @@ public class SikuServiceImpl implements SikuService {
                 List<Map> ydExpenseList = new ArrayList<>();
 
                 double totalAmt = 0d;
+                double totalTaxAmt = 0d;
 
                 for (Map expense : expenseList) {
                     String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
@@ -1962,17 +1962,26 @@ public class SikuServiceImpl implements SikuService {
                     String comments = getMkStrValue(expense, "comments");//用途
                     long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
 
+                    List<Map> invoiceTaxList = getMkListValue(expense, "invoiceTaxList");//税票信息
+                    double deductionTaxAmount = 0;
+                    for (Map invoiceTax : invoiceTaxList) {
+                        deductionTaxAmount += Double.parseDouble(getMkStrValue(invoiceTax, "deductionTaxAmount"));//抵扣税额
+                    }
+
                     Map expenseMap = new HashMap();
                     expenseMap.put("textField_mnwlpiwc",expenseType);
                     expenseMap.put("numberField_mnwlpiwd",acceptAmount);
                     expenseMap.put("textareaField_mnwlpiwh",comments);
                     expenseMap.put("dateField_mnwlpiwe",consumeTime);
+                    expenseMap.put("numberField_mol7a35x",deductionTaxAmount);
 
                     ydExpenseList.add(expenseMap);
 
                     totalAmt += acceptAmount;
+                    totalTaxAmt += deductionTaxAmount;
                 }
 
+                ydFormData.put("textField_mnyfvfxr",formCode);
                 ydFormData.put("textField_mnwtck7h","项目报销单(个人)");
                 ydFormData.put("textField_mnwtwu9z",projectCode);
                 ydFormData.put("textField_mnwlpivn",projectName);
@@ -1984,6 +1993,7 @@ public class SikuServiceImpl implements SikuService {
                 ydFormData.put("textField_mnwlpivq",cf31);
                 ydFormData.put("tableField_mnwlpiwb",ydExpenseList);
                 ydFormData.put("numberField_mo007gcg",totalAmt);
+                ydFormData.put("numberField_mowkibv8",totalTaxAmt);
 
                 break;
             case "FT212801282906280987"://打车(企业支付)
@@ -2014,6 +2024,7 @@ public class SikuServiceImpl implements SikuService {
                 List<Map> ydExpenseList2 = new ArrayList<>();
 
                 double totalAmt2 = 0d;
+                double totalTaxAmt2 = 0d;
 
                 for (Map expense : expenseList2) {
                     String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
@@ -2021,17 +2032,26 @@ public class SikuServiceImpl implements SikuService {
                     String comments = getMkStrValue(expense, "comments");//用途
                     long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
 
+                    List<Map> invoiceTaxList = getMkListValue(expense, "invoiceTaxList");//税票信息
+                    double deductionTaxAmount = 0;
+                    for (Map invoiceTax : invoiceTaxList) {
+                        deductionTaxAmount += Double.parseDouble(getMkStrValue(invoiceTax, "deductionTaxAmount"));//抵扣税额
+                    }
+
                     Map expenseMap = new HashMap();
                     expenseMap.put("textField_mnwlpiwc",expenseType);
                     expenseMap.put("numberField_mnwlpiwd",acceptAmount);
                     expenseMap.put("textareaField_mnwlpiwh",comments);
                     expenseMap.put("dateField_mnwlpiwe",consumeTime);
+                    expenseMap.put("numberField_mol7a35x",deductionTaxAmount);
 
                     ydExpenseList2.add(expenseMap);
 
                     totalAmt2 += acceptAmount;
+                    totalTaxAmt2 += deductionTaxAmount;
                 }
 
+                ydFormData.put("textField_mnyfvfxr",formCode);
                 ydFormData.put("textField_mnwtck7h","打车(企业支付)");
                 ydFormData.put("textField_mnwtwu9z",projectCode2);
                 ydFormData.put("textField_mnwlpivn",projectName2);
@@ -2043,6 +2063,7 @@ public class SikuServiceImpl implements SikuService {
                 ydFormData.put("textField_mnwlpivq",cf31_2);
                 ydFormData.put("tableField_mnwlpiwb",ydExpenseList2);
                 ydFormData.put("numberField_mo007gcg",totalAmt2);
+                ydFormData.put("numberField_mowkibv8",totalTaxAmt2);
 
                 break;
             case "FT204524106635297811"://项目差旅报销单
@@ -2069,6 +2090,7 @@ public class SikuServiceImpl implements SikuService {
                 List<Map> ydExpenseList3 = new ArrayList<>();
 
                 double totalAmt3 = 0d;
+                double totalTaxAmt3 = 0d;
 
                 for (Map expense : expenseList3) {
                     String expenseType = getMkStrValue(expense, "expenseTypeCode");//费用类型
@@ -2076,17 +2098,26 @@ public class SikuServiceImpl implements SikuService {
                     String comments = getMkStrValue(expense, "comments");//用途
                     long consumeTime = getMkDateValue(expense, "consumeTime");//消费日期
 
+                    List<Map> invoiceTaxList = getMkListValue(expense, "invoiceTaxList");//税票信息
+                    double deductionTaxAmount = 0;
+                    for (Map invoiceTax : invoiceTaxList) {
+                        deductionTaxAmount += Double.parseDouble(getMkStrValue(invoiceTax, "deductionTaxAmount"));//抵扣税额
+                    }
+
                     Map expenseMap = new HashMap();
                     expenseMap.put("textField_mnwlpiwc",expenseType);
                     expenseMap.put("numberField_mnwlpiwd",acceptAmount);
                     expenseMap.put("textareaField_mnwlpiwh",comments);
                     expenseMap.put("dateField_mnwlpiwe",consumeTime);
+                    expenseMap.put("numberField_mol7a35x",deductionTaxAmount);
 
                     ydExpenseList3.add(expenseMap);
 
                     totalAmt3 += acceptAmount;
+                    totalTaxAmt3 += deductionTaxAmount;
                 }
 
+                ydFormData.put("textField_mnyfvfxr",formCode);
                 ydFormData.put("textField_mnwtck7h","项目差旅报销单");
                 ydFormData.put("textField_mnwtwu9z",projectCode3);
                 ydFormData.put("textField_mnwlpivn",projectName3);
@@ -2098,6 +2129,7 @@ public class SikuServiceImpl implements SikuService {
                 ydFormData.put("textField_mnwlpivq",cf31_3);
                 ydFormData.put("tableField_mnwlpiwb",ydExpenseList3);
                 ydFormData.put("numberField_mo007gcg",totalAmt3);
+                ydFormData.put("numberField_mowkibv8",totalTaxAmt3);
 
                 break;
             default:

+ 4 - 4
mjava-siku/src/test/java/com.malk.siku/SkTest.java

@@ -26,12 +26,12 @@ public class SkTest {
     @Test
     public void getSecret(){
         //每刻报销-测试环境
-        String appCode="AP52Y01LHHTAP9";
-        String appSecret="N4WuERLteAUPaWebnsHy";
+        /*String appCode="AP52Y01LHHTAP9";
+        String appSecret="N4WuERLteAUPaWebnsHy";*/
 
         //每刻报销-生产环境
-        /*String appCode="AP52RG1SCG8S6L";
-        String appSecret="YFTbD2MviqUwztBTbMWd";*/
+        String appCode="AP52RG1SCG8S6L";
+        String appSecret="YFTbD2MviqUwztBTbMWd";
 
         //每刻云票-测试环境
         /*String appCode="AP53EP1SVDS1N9";