Bladeren bron

Merge remote-tracking branch 'origin/master'

“lqy 1 maand geleden
bovenliggende
commit
c0843eb794

+ 9 - 6
mjava-fenggefushi/src/main/java/com/malk/fenggefushi/service/Impl/HeiHuOrderServiceImpl.java

@@ -23,6 +23,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -1410,6 +1411,8 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                                     }
                                 }
                             });
+                            log.info("oldList:{}",oldList.toString());
+                            log.info("faxList:{}",faxList.toString());
                         }
 
                         // ========== 修改点8:分别处理高低毛利率的审批 ==========
@@ -1461,7 +1464,7 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                             //组装数据塞到采购明细表
                             formdataLow.put("tableField_ml6g7k5d", tabledataLow);
                             formdataLow.put("tableField_mmx6gata", oldList);
-                            formdataHigh.put("tableField_mnekj8oq", faxList);
+                            formdataLow.put("tableField_mnekj8oq", faxList);
 
                             //组装数据塞到采购审批单号明细
                             List<Map<String, String>> orderSummaryListLow = calculateOrderSummary(tabledataLow);
@@ -2027,11 +2030,11 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
     }
     private static final Map<String,String> TABLEFIELD_ENUM2 =new HashMap<>();//修改后:修改前
     static {
-        TABLEFIELD_ENUM2.put("textField_mnekj8ok","textField_ml7ch2pk");
-        TABLEFIELD_ENUM2.put("numberField_mnekj8ol","numberField_ml862225");
-        TABLEFIELD_ENUM2.put("numberField_mnekj8om","numberField_ml862226");
-        TABLEFIELD_ENUM2.put("numberField_mnekj8on","numberField_ml862228");
-        TABLEFIELD_ENUM2.put("numberField_mnekj8oo","numberField_ml86222d");
+        TABLEFIELD_ENUM2.put("textField_ml7ch2pk","textField_mnekj8ok");
+        TABLEFIELD_ENUM2.put("numberField_ml862225","numberField_mnekj8ol");
+        TABLEFIELD_ENUM2.put("numberField_ml862226","numberField_mnekj8om");
+        TABLEFIELD_ENUM2.put("numberField_ml862228","numberField_mnekj8on");
+        TABLEFIELD_ENUM2.put("numberField_ml86222d","numberField_mnekj8oo");
 
     }
     /**

+ 19 - 0
mjava-zhiwei/src/main/java/com/malk/zhiwei/controller/ZwErpController.java

@@ -6,6 +6,10 @@ import com.malk.server.aliwork.YDParam;
 import com.malk.server.common.McException;
 import com.malk.server.common.McR;
 import com.malk.service.aliwork.YDClient;
+import com.malk.utils.UtilMap;
+import com.malk.utils.UtilServlet;
+import com.malk.zhiwei.service.ZwService;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -13,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -28,6 +33,8 @@ public class ZwErpController {
 
     @Autowired
     private YDClient ydClient;
+    @Autowired
+    private ZwService zwService;
 
 
     @PostMapping("/deliver/save")
@@ -57,4 +64,16 @@ public class ZwErpController {
         }
 
     }
+
+    @SneakyThrows
+    @PostMapping("/customer/save")
+    McR savecustomer(HttpServletRequest request){
+        Map<String, ?> data = UtilServlet.getParamMap(request);
+        log.info("客户信息保存, {}", data);
+        McException.assertParamException_Null(data, "instanceId");
+        return McR.success(zwService.savecustomer(UtilMap.getString(data,"instanceId")));
+    }
+
+
+
 }

+ 34 - 1
mjava-zhiwei/src/main/java/com/malk/zhiwei/entity/CustomerModel.java

@@ -62,11 +62,44 @@ public class CustomerModel extends Model{
 
     private FNumber FCreateOrgId;//创建组织 (必填项)
 
+    private String F_UNW_Text_6mb;//业务员(必填项)
+
+    private FNumber F_UNW_Assistant_qov;//终端(必填项)
+
+    private FNumber F_UNW_Assistant_9zp;//事业部(必填项)
+
+    private FNumber F_UNW_Assistant_mo2;//行业(必填项)
+
+    private String FBIZLOCATION;// 地点名称
+
+    private String FBizAddress;//详细地址
+
+    private String FTContact;//联系人
+
+    private String FMOBILE;//移动电话
+
+
+
     public CustomerModel (){}
 
-    public CustomerModel(String name){
+    public CustomerModel(String name,FNumber sktj,FNumber hy,FNumber syb,FNumber zd,String ywy,String nsdjh,FNumber xsbm,
+        FNumber xsy){
         this.FName=name;
         this.FCreateOrgId = new FNumber("100");
         this.FTRADINGCURRID = new FNumber("PRE001");
+
+        this.F_UNW_Text_6mb = ywy;//业务员
+        this.F_UNW_Assistant_qov = zd;//终端
+        this.F_UNW_Assistant_9zp = syb;//事业部
+        this.F_UNW_Assistant_mo2 = hy;//行业
+        this.FRECCONDITIONID = sktj;//收款条件
+        this.FTAXREGISTERCODE = nsdjh;//纳税登记号
+        this.FSALDEPTID = xsbm;//销售部门
+        this.FSELLER = xsy;//销售员
+
+//        this.FBIZLOCATION = FBIZLOCATION;
+//        this.FBizAddress = FBizAddress;
+//        this.FTContact = FTContact;
+//        this.FMOBILE = FMOBILE;
     }
 }

+ 1 - 1
mjava-zhiwei/src/main/java/com/malk/zhiwei/entity/FBillHead.java

@@ -1,7 +1,7 @@
 package com.malk.zhiwei.entity;
 
 import com.malk.utils.UtilMap;
-import com.malk.xiding.entity.Model;
+import com.malk.zhiwei.entity.Model;
 import lombok.Data;
 
 import java.util.Map;

+ 1 - 1
mjava-zhiwei/src/main/java/com/malk/zhiwei/entity/SaleOrderModel.java

@@ -1,6 +1,6 @@
 package com.malk.zhiwei.entity;
 
-import com.malk.xiding.entity.SaleOrderEntry;
+import com.malk.zhiwei.entity.SaleOrderEntry;
 import lombok.Data;
 
 import java.util.List;

+ 5 - 0
mjava-zhiwei/src/main/java/com/malk/zhiwei/service/ZwService.java

@@ -1,6 +1,8 @@
 package com.malk.zhiwei.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.malk.server.common.McR;
 
 import java.util.Map;
 
@@ -14,4 +16,7 @@ public interface ZwService {
 
     void syncProduct(String id,String erpPilot);
 
+    //客户保存接口
+    McR savecustomer(String instanceId) throws JsonProcessingException;
+
 }

+ 92 - 2
mjava-zhiwei/src/main/java/com/malk/zhiwei/service/impl/ZwServiceImpl.java

@@ -3,24 +3,41 @@ package com.malk.zhiwei.service.impl;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+import com.kingdee.bos.webapi.entity.IdentifyInfo;
+import com.kingdee.bos.webapi.entity.RepoRet;
+import com.kingdee.bos.webapi.sdk.K3CloudApi;
 import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
+import com.malk.server.common.McR;
+import com.malk.server.dingtalk.DDConf;
 import com.malk.service.aliwork.YDClient;
-import com.malk.service.aliwork.YDService;
 import com.malk.utils.PublicUtil;
 import com.malk.utils.UtilMap;
+import com.malk.zhiwei.config.KDWebApiConf;
+import com.malk.zhiwei.entity.CustomerModel;
+import com.malk.zhiwei.entity.FNumber;
 import com.malk.zhiwei.service.ZwService;
+import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.rmi.CORBA.Util;
 import java.util.*;
 
 @Service
 @Slf4j
 public class ZwServiceImpl implements ZwService {
 
+    @Autowired
+    private KDWebApiConf kdWebApiConf;
+    @Autowired
+    private YDConf ydConf;
+    @Autowired
+    private DDConf ddConf;
+
     private static String ERP_URL="http://10.0.0.208:80";
     private static String ERP_NAME="064";
     private static String ERP_PASSWORD="";
@@ -190,4 +207,77 @@ public class ZwServiceImpl implements ZwService {
             }
         }
     }
+
+    @SneakyThrows
+    @Override
+    public McR savecustomer(String instanceId) throws JsonProcessingException {
+        log.info("客户宜搭实例id:{}",instanceId);
+        Map data = (Map) ydClient.queryData(YDParam.builder().formInstId(instanceId)
+                .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
+                .userId(ddConf.getOperator()).build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
+
+        FNumber zd = new FNumber(data.get("selectField_mnft99ue").toString());//终端
+        FNumber syb = new FNumber(data.get("selectField_mnft99ud").toString());//事业部
+        FNumber hy = new FNumber(data.get("textField_mnfujcak").toString());//行业
+        FNumber sktj = new FNumber(data.get("textField_mnfujcaf").toString());//收款条件
+        FNumber xsbm = new FNumber(data.get("textField_mnfujcac").toString());//销售部门
+        FNumber xsy = new FNumber(data.get("textField_mnfujcad").toString());//销售员
+        String kh = data.get("textField_lqanqe6j").toString();// 客户
+        Object empObj = data.get("employeeField_mnft99uj");
+        String ywy = "";//业务员
+        if (empObj instanceof JSONArray) {
+            JSONArray empArray = (JSONArray) empObj;
+            if (!empArray.isEmpty()) {
+                ywy = empArray.getString(0);
+            }
+        } else if (empObj != null) {
+            ywy = empObj.toString();
+        }
+        String nsdjhc = data.get("textField_llujklkq").toString();//纳税登记号
+        CustomerModel customerModel = new CustomerModel(kh,sktj,hy,syb,zd,ywy,nsdjhc,xsbm,xsy);
+        return saveToAudit("BD_Customer", customerModel);
+    }
+
+
+    private McR saveToAudit(String formid, Object object) throws Exception {
+        JSONObject resultObj = new JSONObject();
+        K3CloudApi client = new K3CloudApi(initIden());
+        String result=client.save(formid,JSONObject.toJSONString(UtilMap.map("Model",object)));
+        resultObj.put("save",result);
+        Gson gson = new Gson();
+        RepoRet sRet = gson.fromJson(result, RepoRet.class);
+        if (sRet.isSuccessfully()) {
+            JsonObject jsonData = new JsonObject();
+            jsonData.addProperty("Ids", sRet.getResult().getId());
+            String result2=client.submit(formid, jsonData.toString());
+            resultObj.put("save",result2);
+            RepoRet sRet2 = gson.fromJson(result, RepoRet.class);
+            if (sRet2.isSuccessfully()) {
+                JsonObject jsonData3 = new JsonObject();
+                jsonData3.addProperty("Ids", sRet2.getResult().getId());
+                String result3 = client.audit(formid, jsonData3.toString());
+                RepoRet repoRet3 = gson.fromJson(result3, RepoRet.class);
+                if (repoRet3.getResult().getResponseStatus().isIsSuccess()) {
+                    log.info("审批通过,新增完成");
+                    return McR.success(resultObj);
+                }
+            }
+        }
+        return McR.error("203",JSONObject.toJSONString(resultObj));
+    }
+
+
+    private IdentifyInfo initIden(){
+        //注意 1:此处不再使用参数形式传入用户名及密码等敏感信息,改为在登录配置文件中设置。
+        //注意 2:必须先配置第三方系统登录授权信息后,再进行业务操作,详情参考各语言版本SDK介绍中的登录配置文件说明。
+        //读取配置,初始化SDK
+        IdentifyInfo iden = new IdentifyInfo();
+        iden.setUserName(kdWebApiConf.getXKDApiUserName());
+        iden.setAppId(kdWebApiConf.getXKDApiAppID());
+        iden.setdCID(kdWebApiConf.getXKDApiAcctID());
+        iden.setAppSecret(kdWebApiConf.getXKDApiAppSec());
+        iden.setServerUrl(kdWebApiConf.getXKDApiServerUrl());
+
+        return iden;
+    }
 }

+ 46 - 0
mjava-zhiwei/src/main/resources/application-prod.yml

@@ -0,0 +1,46 @@
+server:
+  port: 9001
+  servlet:
+    context-path: /zhiwei
+
+enable:
+  scheduling: true
+logging:
+  config: classpath:logback-spring.xml
+  path: /home/server/zhiwei/log/
+  level:
+    com.malk.*: debug
+
+# dingtalk
+dingtalk:
+  agentId: 2691784047
+  appKey: dinghbynhnd2dbgypmsa
+  appSecret: Kl5Xw8x0TlEIlvcJuUkYZD18UTTShJmfdKrAIpY8oX-Q_tazyUKA28nQh7dG5-mq
+  corpId:
+  aesKey:
+  token:
+
+# aliwork
+aliwork:
+  appType: APP_G0JV4FGIR0EOSBD0K7XV
+  systemToken: F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1
+
+kingdee:
+  # 第三方系统登录授权的账套ID
+  X-KDApi-AcctID: 69264a17165c35
+  # 第三方系统登录授权的用户
+  X-KDApi-UserName: thirdpart
+  # 第三方系统登录授权的应用ID
+  X-KDApi-AppID: 337911_329JQ8FO3ID86X9sxYTLUz0K1NT8WCoJ
+  # 第三方系统登录授权的应用密钥
+  X-KDApi-AppSec: a68e6297abce4c9d8836dfce12512b39
+  # 服务Url地址(公有云统一走网关sdk底层已处理,无需传X-KDApi-ServerUrl,下面这行需要注释)
+  X-KDApi-ServerUrl: http://211.91.58.31:8081/k3cloud/
+  # 账套语系,默认2052
+  # X-KDApi-LCID: 2052
+  # 组织编码,启用多组织时配置对应的组织编码才有效
+  # X-KDApi-OrgNum: 100
+  # 允许的最大连接延时,单位为秒
+  # X-KDApi-ConnectTimeout: 120
+  # 允许的最大读取延时,单位为秒
+  # X-KDApi-RequestTimeout: 120

+ 1 - 1
mjava-zhiwei/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: dev
+    active: prod
   servlet:
     multipart:
       max-file-size: 100MB

+ 8 - 2
mjava-zhiwei/src/test/java/com/malk/zhiwei/JdTest.java

@@ -86,7 +86,13 @@ public class JdTest {
 
     @Test
     public void saveCust() throws Exception {
-        CustomerModel customerModel = new CustomerModel("测试客户");
+        FNumber zd = new FNumber("其他");//终端
+        FNumber syb = new FNumber("MPP");//事业部
+        FNumber hy = new FNumber("001");//行业
+        FNumber sktj = new FNumber("008");//收款条件
+        FNumber xsbm = new FNumber("BM000027");//销售部门
+        FNumber xsy = new FNumber("0016_GW000014_1");//销售员
+        CustomerModel customerModel = new CustomerModel("测试客户3",sktj,hy,syb,zd,"李英","1234",xsbm,xsy);
         System.out.println(saveToAudit("BD_Customer", customerModel));
     }
 
@@ -129,7 +135,7 @@ public class JdTest {
 //            billQuery.setFieldKeys("FBillNo,FBillTypeID.FName,FPAYUNITTYPE,FDate,FPAYUNIT.FName,FCURRENCYID.FName,FRECEIVEAMOUNTFOR_H,FREALRECAMOUNTFOR,FSALEERID.FName,FSETTLETYPEID,FSETTLETYPEID.FName,FPURPOSEID.FName,FACCOUNTID.FNumber,FACCOUNTID.FName,FRECTOTALAMOUNTFOR,FREALRECAMOUNTFOR_D,FCOMMENT");
             List<Map> filterString = new ArrayList<>();
             //审核日期为昨天至今天
-            filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",4,"","","0"));//审核日期在今天之前N天以后
+            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","FApproveDate","420","2025-10-20 00:00:00","","","0"));//审核日期年=XX
 //        filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FNumber","67","35","","","0"));//物料编码等于XX
             billQuery.setFilterString(filterString);