wzy пре 1 месец
родитељ
комит
07f92bb453

+ 2 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/service/CpClient.java

@@ -16,6 +16,8 @@ public interface CpClient {
 
     List<Map> getCpUserInfo(String corpId, List<String> departmentIds, List<String> ids, String mobile, String name, int page, int size);
 
+    List<Map> getCpDepartmentInfo();
+
     Map getCpBoResultData(Map result);
 
     void isSuccess(Map result);

+ 15 - 0
mjava-jinlun/src/main/java/com/malk/jinlun/service/impl/CpClientImpl.java

@@ -202,6 +202,21 @@ public class CpClientImpl implements CpClient {
         return content;
     }
 
+    @Override
+    public List<Map> getCpDepartmentInfo() {
+        String s = UtilHttp.doPost(cloudpivotConfig.getRedirectUri() + "openapi/v3/organization/department/query", CloudpivotConfig.initTokenHeader(getCpAccessToken()), null, new HashMap());
+
+        Map result = (Map) JSONObject.parse(s);
+
+        isSuccess(result);
+
+        Map data = UtilMap.getMap(result, "data");
+
+        List<Map> content = UtilMap.getList(data, "content");
+
+        return content;
+    }
+
 
     //获取云枢表单详情返回结果中单据字段值
     @Override

+ 24 - 8
mjava-jinlun/src/main/java/com/malk/jinlun/service/impl/JinlunTaskServiceImpl.java

@@ -786,8 +786,8 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
         List<Map> filterString = new ArrayList<>();
 
         //审核日期为昨天至今天
-        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",1,"","","0"));//审核日期在今天之前N天以后
-//        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FBillNo","67","S305-251031001","","","0"));//单据编号等于XX
+        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",131,"","","0"));//审核日期在今天之前N天以后
+//        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FBillNo","67","S305-260505001","","","0"));//单据编号等于XX
 
         billQuery.setFilterString(filterString);
         billQuery.setLimit(limit);
@@ -915,6 +915,12 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
         //处理同一出库单多个明细
         List<Map<String, Object>> list = mergeListMap(dataList, "ShortText1775629055296", "Sheet1775629877034");
 
+        List<Map> cpDepartmentInfo = cpClient.getCpDepartmentInfo();
+        Map<String, String> cpDepartmentMap = new HashMap<>();
+        for (Map cpDepartment : cpDepartmentInfo) {
+            cpDepartmentMap.put(UtilMap.getString(cpDepartment,"id"),UtilMap.getString(cpDepartment,"name"));
+        }
+
         //处理特殊字段格式
         for (Map<String, Object> stringObjectMap : list) {
             //成员
@@ -922,6 +928,7 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
             if(cpUserMap.containsKey(salerName)){
                 Map cpUserInfo = cpUserMap.get(salerName);
                 stringObjectMap.put("StaffSingle1775629353797",cpUserInfo);//销售员
+                stringObjectMap.put("ShortText1775629254048",cpDepartmentMap.get(UtilMap.getString(cpUserInfo,"mainDepartmentId")));//销售部门
             }else {
                 List<Map> cpUserInfoList = cpClient.getCpUserInfo(null, null, null, null, salerName, 0, 1);
                 if (cpUserInfoList.size() == 1){
@@ -929,6 +936,8 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
                     cpUserInfo.put("type",3);
                     stringObjectMap.put("StaffSingle1775629353797",cpUserInfo);//销售员
                     cpUserMap.put(salerName,cpUserInfo);
+
+                    stringObjectMap.put("ShortText1775629254048",cpDepartmentMap.get(UtilMap.getString(cpUserInfo,"mainDepartmentId")));//销售部门
                 }else {
                     stringObjectMap.put("StaffSingle1775629353797",null);
                 }
@@ -944,7 +953,7 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
                     Map cpUserInfo = (Map) cpUserInfoList.get(0);
                     cpUserInfo.put("type",3);
                     stringObjectMap.put("StaffSelector1775629377100",cpUserInfo);//跟单员
-                    cpUserMap.put(salerName,cpUserInfo);
+                    cpUserMap.put(gendanName,cpUserInfo);
                 }else {
                     stringObjectMap.put("StaffSelector1775629377100",null);
                 }
@@ -1024,10 +1033,10 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
 
         BillQuery billQuery = new BillQuery();
         billQuery.setFormId("AR_MatchRecord");
-        billQuery.setFieldKeys("FBILLNO,FCURWRITTENOFFAMOUNTFOR,FCURWRITTENOFFAMOUNT,FCURRENCYID.FName,FSOURCETYPE.FName,FSRCBILLNO,FVERIFYDATE,FCONTACTUNITTYPE,FCONTACTUNIT.FNumber,FCONTACTUNIT.FName,FBILLNUMBER");
+        billQuery.setFieldKeys("FBILLNO,FPLANAMOUNTFOR,FPLANAMOUNT,FCURWRITTENOFFAMOUNTFOR,FCURWRITTENOFFAMOUNT,FCURRENCYID.FName,FSOURCETYPE.FName,FSRCBILLNO,FVERIFYDATE,FCONTACTUNITTYPE,FCONTACTUNIT.FNumber,FCONTACTUNIT.FName,FBILLNUMBER");
         List<Map> filterString = new ArrayList<>();
 
-        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FVERIFYDATE","265",1,"","","0"));//核销日期在今天之前N天以后
+        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FVERIFYDATE","265",12,"","","0"));//核销日期在今天之前N天以后
 //        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FVERIFYDATE","39","2026-01-01 00:00:00","","","0"));//核销日期>=XX
 //        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FVERIFYDATE","16","2026-03-31 00:00:00","","","0"));//核销日期<=XX
         filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FCURWRITTENOFFAMOUNTFOR","21",0,"","","0"));//本次核销金额>0
@@ -1055,6 +1064,9 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
         for (Map map : list) {
             Map body = new HashMap();
             body.put("ShortText1776845631494",UtilMap.getString(map, "FBILLNO"));//核销单号
+            Double fplanamountfor = UtilMap.getDouble(map, "FPLANAMOUNTFOR");
+            body.put("Number1778657486463", fplanamountfor);//应收金额
+            body.put("Number1778657494744",UtilMap.getDouble(map, "FPLANAMOUNT"));//应收金额本位币
             body.put("Number1776845666515",UtilMap.getDouble(map, "FCURWRITTENOFFAMOUNTFOR"));//本次核销金额
             body.put("Number1776845698524",UtilMap.getDouble(map, "FCURWRITTENOFFAMOUNT"));//本次核销金额本位币
             body.put("ShortText1776845718075",UtilMap.getString(map, "FCURRENCYID.FName"));//结算币别
@@ -1075,15 +1087,17 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
             body.put("ShortText1776845907662",UtilMap.getString(map, "FCONTACTUNIT.FNumber"));//往来单位编码
             body.put("Text1776845928307",UtilMap.getString(map, "FCONTACTUNIT.FName"));//往来单位名称
 
-            String saleOrderNumber = UtilMap.getString(map, "FBILLNUMBER");//销售订单号
+//            String saleOrderNumber = UtilMap.getString(map, "FBILLNUMBER");//销售订单号
+            String saleOrderNumber = "";//销售订单号    必须查询应收单获取到期日
 
             if (Strings.isBlank(saleOrderNumber)){
                 //查询应收单
                 BillQuery billQuery2 = new BillQuery();
                 billQuery2.setFormId("AR_receivable");
-                billQuery2.setFieldKeys("FBillNo,FSourceBillNo");
+                billQuery2.setFieldKeys("FBillNo,FSourceBillNo,FENDDATE");
                 List<Map> filterString2 = new ArrayList<>();
-                filterString2.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FBillNo","17",fsrcbillno,"","","0"));//单据编号包含XX
+                filterString2.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FBillNo","67",fsrcbillno,"","","0"));//单据编号等于XX
+                filterString2.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FPAYAMOUNTFOR","76",fplanamountfor,"","","0"));//收款计划-应收金额等于XX
                 billQuery2.setFilterString(filterString2);
                 billQuery2.setLimit(1);
                 billQuery2.setStartRow(0);
@@ -1093,6 +1107,8 @@ public class JinlunTaskServiceImpl implements JinlunTaskService {
                     if (!ysdList.isEmpty()){
                         Map ysd = ysdList.get(0);
                         String fSourceBillNo = UtilMap.getString(ysd, "FSourceBillNo");//销售出库单单号
+                        String fenddate = UtilMap.getString(ysd, "FENDDATE").split("\\.")[0].replace("T"," ");//到期日
+                        body.put("Date1778657519700",fenddate);
 
                         if (Strings.isNotBlank(fSourceBillNo)){
                             //查询销售出库单