wzy 1 tydzień temu
rodzic
commit
e974f3c72d

+ 107 - 17
mjava-siku/src/main/java/com/malk/siku/service/impl/SikuServiceImpl.java

@@ -58,6 +58,21 @@ public class SikuServiceImpl implements SikuService {
     //每刻云票 正式环境
     private static String mkyp_empId = "HZ769";//默认 周漂
 
+    private static final Map<String,String> ddLegalEntity = new HashMap<>();//企业滴滴公司主体
+    static{
+        ddLegalEntity.put("91110105MA04B5ND7J","1125994677035472");//思库共创(北京)营销策划有限公司
+        ddLegalEntity.put("91330110MA2AYPX2X1","1125994676962964");//杭州光映场景科技有限公司
+        ddLegalEntity.put("91310120MA1JJJL131","1125994676938831");//上海造酷文化科技有限公司
+        ddLegalEntity.put("913301060793092966","1125994676742442");//杭州思库营销策划有限公司
+        ddLegalEntity.put("91330105MA27WGAY7W","1125994677125313");//思门(杭州)品牌营销策划有限公司
+        ddLegalEntity.put("91330105MA2HYCM71D","1125994676919592");//思库文化传播集团有限公司
+        ddLegalEntity.put("913301065995586166","1125994677114352");//杭州思库文化创意有限公司
+        ddLegalEntity.put("91510100MADHQM1A62","1125994677036721");//思库(成都)文化传播有限公司
+        ddLegalEntity.put("91330105MA2KGRJQ3T","1125994676949976");//光格(杭州)文化传播有限公司
+        ddLegalEntity.put("91330109MA2B2A0E3N","1125994677041739");//杭州东东腔文化创意有限公司
+        ddLegalEntity.put("","1125994336723042");//思库(浙江)文化传播有限公司
+    }
+
     @Override
     public McR saveTradingPartner(Map map) {
         String formInstId = UtilMap.getString(map, "formInstId");
@@ -432,9 +447,14 @@ public class SikuServiceImpl implements SikuService {
                 String mktdr = UtilMap.getString(detail, "selectField_mo9z9dva");//每刻提单人
                 body.put("submittedUserEmployeeId",mktdr);//提单人工号
                 body.put("coverUserEmployeeId",mktdr);//承担人工号
-//                body.put("",ydfqr.equals(mktdr) ? ztcggh : mktdr);//todo 抄送人工号   若每刻提单人为宜搭发起人,抄送人则为中台采购 若每刻提单人为中台采购,抄送人则为宜搭发起人
-                //查询每刻提单人部门
-                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(mktdr)));
+
+                List<Map> travelPartnerInfo = new ArrayList<>();//参与人
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ydfqr);}});
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ztcggh);}});
+                body.put("travelPartnerInfo",travelPartnerInfo);
+
+                //查询宜搭发起人部门
+                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(ydfqr)));
                 String coverDepartmentBizCode = mkbx_deptId;
                 if (Objects.nonNull(employeeDetails)){
                     List<Map> departments = UtilMap.getList(employeeDetails, "departments");
@@ -518,9 +538,14 @@ public class SikuServiceImpl implements SikuService {
                 String mktdr = UtilMap.getString(detail, "selectField_mo9z9dvc");//每刻提单人
                 body.put("submittedUserEmployeeId",mktdr);//提单人工号
                 body.put("coverUserEmployeeId",mktdr);//承担人工号
-//                body.put("",ydfqr.equals(mktdr) ? ztcggh : mktdr);//todo 抄送人工号   若每刻提单人为宜搭发起人,抄送人则为中台采购 若每刻提单人为中台采购,抄送人则为宜搭发起人
-                //查询每刻提单人部门
-                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(mktdr)));
+
+                List<Map> travelPartnerInfo = new ArrayList<>();//参与人
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ydfqr);}});
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ztcggh);}});
+                body.put("travelPartnerInfo",travelPartnerInfo);
+
+                //查询宜搭发起人部门
+                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(ydfqr)));
                 String coverDepartmentBizCode = mkbx_deptId;
                 if (Objects.nonNull(employeeDetails)){
                     List<Map> departments = UtilMap.getList(employeeDetails, "departments");
@@ -852,6 +877,9 @@ public class SikuServiceImpl implements SikuService {
             for (Map expenseValue : expenseValueList) {
                 Map deductionList = UtilMap.getMap(expenseValue, "deductionList");//当前对公费用核销的数据(当前到票核销场景核销了哪些“预付未到票”记录)
 
+                Map expenseDeductionTaxAmount = UtilMap.getMap(expenseValue, "expenseDeductionTaxAmount");//费用级抵扣税额(消费币种)
+                Double sj = UtilMap.getDouble(expenseDeductionTaxAmount, "amount");//每刻实际税金
+
                 List<Map> deductionValueList = UtilMap.getList(deductionList, "value");
 
                 Map deductionValue = deductionValueList.get(0);
@@ -860,8 +888,8 @@ public class SikuServiceImpl implements SikuService {
                 String targetFormCode = UtilMap.getString(deductionValue, "targetFormCode");//核销报销单编号
 
                 if (targetFormCode.contains("需求") || targetFormCode.contains("采购")){
-                    //更新宜搭核销金额
-                    updateYdDeduction(targetFormCode,deductionAmount);
+                    //更新宜搭核销金额及税金
+                    updateYdDeduction(targetFormCode,deductionAmount,sj);
                 }
             }
 
@@ -1044,7 +1072,7 @@ public class SikuServiceImpl implements SikuService {
     }
 
     //更新宜搭采购已核销金额
-    private void updateYdDeduction(String formCode, Double deductionAmount) {
+    private void updateYdDeduction(String formCode, Double deductionAmount,Double sj) {
         String[] split = formCode.split("-");
         String bh = split[0];
         int index = Integer.parseInt(split[1]);
@@ -1072,8 +1100,21 @@ public class SikuServiceImpl implements SikuService {
                     Map detailMap = new HashMap();
                     if (index == UtilMap.getInt(detail, "numberField_mn36ykxx")){
                         Double yhxje = UtilMap.getDouble(detail, "numberField_mniatky8");//已核销金额
+                        Double ythje = UtilMap.getDouble(detail, "numberField_mn4g182f");//已退回金额
+                        Double mksjsj = UtilMap.getDouble(detail, "numberField_mob8gv4p");//每刻实际税金
+                        Double ydsj = UtilMap.getDouble(detail, "numberField_mmsvi56x");//税金
+                        Double ydcgje = UtilMap.getDouble(detail, "numberField_mkkmij5e");//采购金额
 
                         detailMap.put("numberField_mniatky8",yhxje + deductionAmount);
+                        detailMap.put("numberField_mob8gv4p",mksjsj + sj);//每刻实际税金
+
+                        //若采购金额等于已核销金额+本次核销金额+已退回金额
+                        if (ydcgje == yhxje + deductionAmount + ythje){
+                            Double totalSj = UtilMap.getDouble(ydFormData, "numberField_mkkmij6k");//总税金
+
+                            updateFormData.put("numberField_mkkmij6k",totalSj - ydsj + sj);//总税金
+                            updateFormData.put("numberField_mob8gv4v",-ydsj + sj);//最新税金插值
+                        }
                     }
                     updateDetailList.add(detailMap);
                 }
@@ -1085,8 +1126,21 @@ public class SikuServiceImpl implements SikuService {
                     Map detailMap = new HashMap();
                     if (index == UtilMap.getInt(detail, "numberField_mn36ykxz")){
                         Double yhxje = UtilMap.getDouble(detail, "numberField_mniatkya");//已核销金额
+                        Double ythje = UtilMap.getDouble(detail, "numberField_mn4g182g");//已退回金额
+                        Double mksjsj = UtilMap.getDouble(detail, "numberField_mob8gv4q");//每刻实际税金
+                        Double ydsj = UtilMap.getDouble(detail, "numberField_mn3zekbx");//税金
+                        Double ydcgje = UtilMap.getDouble(detail, "numberField_mkkmij6p");//采购金额
 
                         detailMap.put("numberField_mniatkya",yhxje + deductionAmount);
+                        detailMap.put("numberField_mob8gv4q",mksjsj + sj);//每刻实际税金
+
+                        //若采购金额等于已核销金额+本次核销金额+已退回金额
+                        if (ydcgje == yhxje + deductionAmount + ythje){
+                            Double totalSj = UtilMap.getDouble(ydFormData, "numberField_mkkmij6k");//总税金
+
+                            updateFormData.put("numberField_mkkmij6k",totalSj - ydsj + sj);//总税金
+                            updateFormData.put("numberField_mob8gv4v",-ydsj + sj);//最新税金插值
+                        }
                     }
                     updateDetailList.add(detailMap);
                 }
@@ -1118,8 +1172,21 @@ public class SikuServiceImpl implements SikuService {
                     Map detailMap = new HashMap();
                     if (index == UtilMap.getInt(detail, "numberField_mn36ykxx")){
                         Double yhxje = UtilMap.getDouble(detail, "numberField_mniatky8");//已核销金额
+                        Double ythje = UtilMap.getDouble(detail, "numberField_mn4g182f");//已退回金额
+                        Double mksjsj = UtilMap.getDouble(detail, "numberField_mob8gv4p");//每刻实际税金
+                        Double ydsj = UtilMap.getDouble(detail, "numberField_mmsvi56x");//税金
+                        Double ydcgje = UtilMap.getDouble(detail, "numberField_mkkmij5e");//采购金额
 
                         detailMap.put("numberField_mniatky8",yhxje + deductionAmount);
+                        detailMap.put("numberField_mob8gv4p",mksjsj + sj);//每刻实际税金
+
+                        //若采购金额等于已核销金额+本次核销金额+已退回金额
+                        if (ydcgje == yhxje + deductionAmount + ythje){
+                            Double totalSj = UtilMap.getDouble(ydFormData, "numberField_mkkmij6k");//总税金
+
+                            updateFormData.put("numberField_mkkmij6k",totalSj - ydsj + sj);//总税金
+                            updateFormData.put("numberField_mob8gv4v",-ydsj + sj);//最新税金插值
+                        }
                     }
                     updateDetailList.add(detailMap);
                 }
@@ -1131,8 +1198,21 @@ public class SikuServiceImpl implements SikuService {
                     Map detailMap = new HashMap();
                     if (index == UtilMap.getInt(detail, "numberField_mn36ykxz")){
                         Double yhxje = UtilMap.getDouble(detail, "numberField_mniatkya");//已核销金额
+                        Double ythje = UtilMap.getDouble(detail, "numberField_mn4g182g");//已退回金额
+                        Double mksjsj = UtilMap.getDouble(detail, "numberField_mob8gv4q");//每刻实际税金
+                        Double ydsj = UtilMap.getDouble(detail, "numberField_mn3zekbx");//税金
+                        Double ydcgje = UtilMap.getDouble(detail, "numberField_mkkmij6p");//采购金额
 
                         detailMap.put("numberField_mniatkya",yhxje + deductionAmount);
+                        detailMap.put("numberField_mob8gv4q",mksjsj + sj);//每刻实际税金
+
+                        //若采购金额等于已核销金额+本次核销金额+已退回金额
+                        if (ydcgje == yhxje + deductionAmount + ythje){
+                            Double totalSj = UtilMap.getDouble(ydFormData, "numberField_mkkmij6k");//总税金
+
+                            updateFormData.put("numberField_mkkmij6k",totalSj - ydsj + sj);//总税金
+                            updateFormData.put("numberField_mob8gv4v",-ydsj + sj);//最新税金插值
+                        }
                     }
                     updateDetailList.add(detailMap);
                 }
@@ -1188,9 +1268,14 @@ public class SikuServiceImpl implements SikuService {
                 String mktdr = UtilMap.getString(detail, "selectField_mo9z9dva");//每刻提单人
                 body.put("submittedUserEmployeeId",mktdr);//提单人工号
                 body.put("coverUserEmployeeId",mktdr);//承担人工号
-//                body.put("",ydfqr.equals(mktdr) ? ztcggh : mktdr);//todo 抄送人工号   若每刻提单人为宜搭发起人,抄送人则为中台采购 若每刻提单人为中台采购,抄送人则为宜搭发起人
-                //查询每刻提单人部门
-                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(mktdr)));
+
+                List<Map> travelPartnerInfo = new ArrayList<>();//参与人
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ydfqr);}});
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ztcggh);}});
+                body.put("travelPartnerInfo",travelPartnerInfo);
+
+                //查询宜搭发起人部门
+                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(ydfqr)));
                 String coverDepartmentBizCode = mkbx_deptId;
                 if (Objects.nonNull(employeeDetails)){
                     List<Map> departments = UtilMap.getList(employeeDetails, "departments");
@@ -1272,9 +1357,14 @@ public class SikuServiceImpl implements SikuService {
                 String mktdr = UtilMap.getString(detail, "selectField_mo9z9dvc");//每刻提单人
                 body.put("submittedUserEmployeeId",mktdr);//提单人工号
                 body.put("coverUserEmployeeId",mktdr);//承担人工号
-//                body.put("",ydfqr.equals(mktdr) ? ztcggh : mktdr);//todo 抄送人工号   若每刻提单人为宜搭发起人,抄送人则为中台采购 若每刻提单人为中台采购,抄送人则为宜搭发起人
-                //查询每刻提单人部门
-                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(mktdr)));
+
+                List<Map> travelPartnerInfo = new ArrayList<>();//参与人
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ydfqr);}});
+                travelPartnerInfo.add(new HashMap<String,String>(){{put("employeeId",ztcggh);}});
+                body.put("travelPartnerInfo",travelPartnerInfo);
+
+                //查询宜搭发起人部门
+                Map employeeDetails = MkBxUtil.employeeDetails(UtilMap.map("employeeIds", Arrays.asList(ydfqr)));
                 String coverDepartmentBizCode = mkbx_deptId;
                 if (Objects.nonNull(employeeDetails)){
                     List<Map> departments = UtilMap.getList(employeeDetails, "departments");
@@ -2242,7 +2332,7 @@ public class SikuServiceImpl implements SikuService {
             body.put("budget_cycle",0);
             body.put("total_quota",0);
             body.put("member_used",2);//0 :全员可见 1:项目成员可见 2:公司主体可见
-            body.put("legal_entity_id",htqygssh);//项目所属公司主体ID
+            body.put("legal_entity_id",ddLegalEntity.get(htqygssh));//项目所属公司主体ID
             body.put("start_date",startDate);
             body.put("expiry_date",endDate);
             body.put("leader_employee_id",JSONObject.toJSONString(leader_employee_id));
@@ -2256,7 +2346,7 @@ public class SikuServiceImpl implements SikuService {
             body.put("name",projectName);
             body.put("type",2);
             body.put("member_used",2);//0 :全员可见 1:项目成员可见 2:公司主体可见
-            body.put("legal_entity_id",htqygssh);//项目所属公司主体ID
+            body.put("legal_entity_id",ddLegalEntity.get(htqygssh));//项目所属公司主体ID
             body.put("leader_employee_id",JSONObject.toJSONString(leader_employee_id));
 
             Map result = QyddUtil.BudgetCenterEdit(body);

+ 1 - 0
mjava-siku/src/main/java/com/malk/siku/service/impl/SikuTaskServiceImpl.java

@@ -29,6 +29,7 @@ public class SikuTaskServiceImpl implements SikuTaskService {
     @Override
     public void syncLoanManage() {
         try {
+            log.info("开始同步借还款台账");
             //删除宜搭借款台账
             List<List<String>> formInstanceIdListList = new ArrayList<>();//实例id集合,每100条