From eee1ae46ab44d00c78c520d3acf2b9b9f8e821ee Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Mon, 27 May 2024 16:28:59 +0800 Subject: [PATCH] '123' --- ABAP_AS_WITH_POOL.jcoDestination | 4 +- .../controller/common/SapRfcController.java | 21 + .../customer/CustomerController.java | 62 ++- .../web/utils/SapFunction/SapRfcUtils.java | 35 +- ruoyi-admin/src/main/resources/common.yml | 1 + .../com/ruoyi/customer/domain/Customer.java | 18 +- .../domain/qcc/ECIIndustryVerify.java | 22 + .../qcc/QccECIIndustryVerifyJsonResult.java | 22 + .../ruoyi/customer/domain/qcc/ResultData.java | 76 +++ .../mapper/customer/CustomerMapper.xml | 47 +- ruoyi-ui/src/api/common/sapRfc.js | 8 + ruoyi-ui/src/api/customer/customer.js | 7 + ruoyi-ui/src/store/modules/user.js | 4 + .../components/Tools/CustomerSelect/index.vue | 4 +- .../src/views/customer/customer/index.vue | 478 ++++++++++-------- 15 files changed, 583 insertions(+), 226 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ECIIndustryVerify.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/QccECIIndustryVerifyJsonResult.java create mode 100644 ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ResultData.java diff --git a/ABAP_AS_WITH_POOL.jcoDestination b/ABAP_AS_WITH_POOL.jcoDestination index bc32de4..e024929 100644 --- a/ABAP_AS_WITH_POOL.jcoDestination +++ b/ABAP_AS_WITH_POOL.jcoDestination @@ -1,5 +1,5 @@ #for tests only ! -#Fri May 24 13:35:10 CST 2024 +#Mon May 27 16:27:32 CST 2024 jco.destination.pool_capacity=10 jco.client.lang=ZH jco.client.ashost=172.19.0.120 @@ -7,5 +7,5 @@ jco.client.saprouter= jco.client.user=RFC jco.client.sysnr=00 jco.destination.peak_limit=10 -jco.client.passwd=u?K-{MKso0NR;1AE/+Y9s/7g^0`/0Uo7Mk{RY=Aw!O|5bcY$ +jco.client.passwd=654321 jco.client.client=300 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java index a500493..cef9ae7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/SapRfcController.java @@ -284,6 +284,27 @@ public class SapRfcController return ajax; } + /** + * 获取账户分配组 + * @param customer + * @return + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/getAccountAllocationGroup") + public AjaxResult getAccountAllocationGroup(Customer customer) + { + AjaxResult ajax = AjaxResult.success(); + + List resCache = redisCache.getCacheObject(getSapCacheKey("accountAllocationGroup")); + if(CollectionUtils.isEmpty(resCache)){ + resCache = SapRfcUtils.getAccountAllocationGroup(null); + redisCache.setCacheObject(getSapCacheKey("accountAllocationGroup"),resCache); + } + log.info("获取账户分配组数据条数 - {}", resCache.size()); + ajax.put("accountAllocationGroupDicts", resCache); + return ajax; + } + /** * 获取redis SAP公共数据 * @param type diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/customer/CustomerController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/customer/CustomerController.java index 129371d..4e9f1b3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/customer/CustomerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/customer/CustomerController.java @@ -11,7 +11,9 @@ import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.customer.domain.RfcResult; +import com.ruoyi.customer.domain.qcc.ECIIndustryVerify; import com.ruoyi.customer.domain.qcc.FuzzySearch; +import com.ruoyi.customer.domain.qcc.QccECIIndustryVerifyJsonResult; import com.ruoyi.customer.domain.qcc.QccFuzzySearchJsonResult; import com.ruoyi.quot.domain.Quot; import com.ruoyi.system.domain.SysNotice; @@ -63,6 +65,10 @@ public class CustomerController extends BaseController @Value("${qichacha.serviceName}") private String Qcc_serviceName; + // 接口请求地址 + @Value("${qichacha.serviceNameGetInfo}") + private String Qcc_serviceName_GetInfo; + @Autowired private ICustomerService customerService; @@ -174,10 +180,14 @@ public class CustomerController extends BaseController @PostMapping("/returnCustomer") public AjaxResult returnCustomer(@RequestBody Customer customer) { - customer.setUpdateBy(getUsername()); - customer.setCusApprovalStatus("3");//客户提交 状态设置为 已驳回 - customerService.updateCustomer(customer); - return success(); + if(!StringUtils.isEmpty(customer.getCusApprovalStatus())){ + customer.setUpdateBy(getUsername()); + customer.setCusApprovalStatus("3");//客户提交 状态设置为 已驳回 + customerService.updateCustomer(customer); + return success(); + }else{ + return error("单据ID为空,无法操作"); + } } /** @@ -188,10 +198,17 @@ public class CustomerController extends BaseController @PostMapping("/commitSAPCustomer") public AjaxResult commitSAPCustomer(@RequestBody Customer customer) { - customer.setUpdateBy(getUsername()); - customer.setCusApprovalStatus("2");//客户提交 状态设置为 已审核 - //TODO 提交校验 调用SAP rfc接口 更新客户凭证号 + if("1".equals(customer.getCusApprovalStatus())){// 数据组 提交业务员创建的客户数据提交SAP + customer.setUpdateBy(getUsername()); + customer.setCusApprovalStatus("2");//客户提交 状态设置为 已审核 + }else if(StringUtils.isEmpty(customer.getCusApprovalStatus())){// 数据组创建的客户数据提交SAP + customer.setCusId(UUID.fastUUID().toString()); + customer.setCusCode(IdUtils.createNo("KH_",2)); + customer.setCreateBy(getUsername()); + customer.setCusApprovalStatus("2");//客户提交 状态设置为 已审核 + customerService.insertCustomer(customer); + } RfcResult result = SapRfcUtils.sendSAP(customer); String type = result.getType(); if("S".equals(type)){ @@ -265,4 +282,35 @@ public class CustomerController extends BaseController } return getDataTable(result); } + + // 获取企查查客户行业代码 + @PreAuthorize("@ss.hasPermi('customer:customer:qcclist')") + @GetMapping("/getIndustryCodeQcc/{cusName}") + public AjaxResult getIndustryCodeQcc(@PathVariable String cusName) + { + AjaxResult result = new AjaxResult(); + String cusIndustryCodeQcc = ""; + String customerName = cusName; + String reqInterNme = Qcc_serviceName_GetInfo; + try { + if(!StringUtils.isEmpty(customerName)){ + HttpHead reqHeader = new HttpHead(); + String[] autherHeader = QiChaChaUtil.RandomAuthentHeader(Qcc_Key, Qcc_SecretKey); + reqHeader.setHeader("Token", autherHeader[0]); + reqHeader.setHeader("Timespan", autherHeader[1]); + String reqUri = reqInterNme.concat("?key=").concat(Qcc_Key).concat("&").concat("searchKey=").concat(customerName); + String tokenJson = HttpHelper.httpGet(reqUri, reqHeader.getAllHeaders()); + System.out.println(String.format("==========================>this is response:{%s}", tokenJson)); + QccECIIndustryVerifyJsonResult obj = JSON.parseObject(tokenJson, QccECIIndustryVerifyJsonResult.class); + ECIIndustryVerify eCIIndustryVerify = obj.getResult(); + if("1".equals(eCIIndustryVerify.getVerifyResult())){ + cusIndustryCodeQcc = eCIIndustryVerify.getData().getIndustry(); + } + } + result.put("cusIndustryCodeQcc",cusIndustryCodeQcc); + } catch (Exception e1) { + e1.printStackTrace(); + } + return result; + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java index 0738126..0a6abc2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/SapFunction/SapRfcUtils.java @@ -363,6 +363,38 @@ public class SapRfcUtils { return countrys; } + /** + * 获取账户分配组 + * @param param + * @return + */ + public static List getAccountAllocationGroup(Object param) { + JCoFunction function = null; + RfcResult rfcResult = null; + List countrys = new ArrayList<>(); + + JCoDestination destination = ConnectToSAP.connect(); + try { + function = destination.getRepository().getFunctionTemplate("ZRFC_BASIC_DATA").getFunction(); + if (function == null) + throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP."); + JCoParameterList input = function.getImportParameterList(); + input.setValue("FLAG39", StringUtils.isNotNull(param)?param:"X");//输入参数 + function.execute(destination); + JCoTable table = function.getTableParameterList().getTable("T_TVKTT"); + for(int i = 0; i getBankList() { return bankList; @@ -335,6 +346,7 @@ public class Customer extends BaseEntity private String cusCurrency; private String cusTax; private String cusReconciliationAccount; + private String cusAccountAllocationGroup; public String getCusSalesOrganization() { return cusSalesOrganization; } @@ -363,4 +375,8 @@ public class Customer extends BaseEntity public String getCusReconciliationAccount() { return cusReconciliationAccount; } public void setCusReconciliationAccount(String cusReconciliationAccount) { this.cusReconciliationAccount = cusReconciliationAccount; } + + public String getCusAccountAllocationGroup() { return cusAccountAllocationGroup; } + + public void setCusAccountAllocationGroup(String cusAccountAllocationGroup) { this.cusAccountAllocationGroup = cusAccountAllocationGroup; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ECIIndustryVerify.java b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ECIIndustryVerify.java new file mode 100644 index 0000000..8dc4d5e --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ECIIndustryVerify.java @@ -0,0 +1,22 @@ +package com.ruoyi.customer.domain.qcc; + +public class ECIIndustryVerify { + private String VerifyResult; + private ResultData Data; + + public String getVerifyResult() { + return VerifyResult; + } + + public void setVerifyResult(String verifyResult) { + VerifyResult = verifyResult; + } + + public ResultData getData() { + return Data; + } + + public void setData(ResultData data) { + Data = data; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/QccECIIndustryVerifyJsonResult.java b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/QccECIIndustryVerifyJsonResult.java new file mode 100644 index 0000000..1887590 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/QccECIIndustryVerifyJsonResult.java @@ -0,0 +1,22 @@ +package com.ruoyi.customer.domain.qcc; + +public class QccECIIndustryVerifyJsonResult { + private String Status; + private ECIIndustryVerify Result; + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public ECIIndustryVerify getResult() { + return Result; + } + + public void setResult(ECIIndustryVerify result) { + Result = result; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ResultData.java b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ResultData.java new file mode 100644 index 0000000..f139fc4 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/qcc/ResultData.java @@ -0,0 +1,76 @@ +package com.ruoyi.customer.domain.qcc; + +public class ResultData { + private String IndustryCode; + private String Industry; + private String SubIndustryCode; + private String SubIndustry; + private String MiddleCategoryCode; + private String MiddleCategory; + private String SmallCategoryCode; + private String SmallCategory; + + public String getIndustryCode() { + return IndustryCode; + } + + public void setIndustryCode(String industryCode) { + IndustryCode = industryCode; + } + + public String getIndustry() { + return Industry; + } + + public void setIndustry(String industry) { + Industry = industry; + } + + public String getSubIndustryCode() { + return SubIndustryCode; + } + + public void setSubIndustryCode(String subIndustryCode) { + SubIndustryCode = subIndustryCode; + } + + public String getSubIndustry() { + return SubIndustry; + } + + public void setSubIndustry(String subIndustry) { + SubIndustry = subIndustry; + } + + public String getMiddleCategoryCode() { + return MiddleCategoryCode; + } + + public void setMiddleCategoryCode(String middleCategoryCode) { + MiddleCategoryCode = middleCategoryCode; + } + + public String getMiddleCategory() { + return MiddleCategory; + } + + public void setMiddleCategory(String middleCategory) { + MiddleCategory = middleCategory; + } + + public String getSmallCategoryCode() { + return SmallCategoryCode; + } + + public void setSmallCategoryCode(String smallCategoryCode) { + SmallCategoryCode = smallCategoryCode; + } + + public String getSmallCategory() { + return SmallCategory; + } + + public void setSmallCategory(String smallCategory) { + SmallCategory = smallCategory; + } +} diff --git a/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml b/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml index 7ce0123..aaf2426 100644 --- a/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml @@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -28,6 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -41,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -63,12 +66,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select a.cus_id, a.cus_code, a.cus_name, a.cus_sap_code, a.cus_street, a.cus_qcc_street,a.cus_payment_terms, a.cus_phone_number, - a.cus_industry_code, a.cus_group, a.cus_vat_no, a.cus_type, a.cus_country, a.cus_language, a.cus_label, + a.cus_industry_code, a.cus_industry_code_qcc, a.cus_group, a.cus_vat_no, a.cus_type, a.cus_country, a.cus_language, a.cus_label, a.cus_classification, a.cus_receiving_email, a.cus_recipient, a.cus_recipient_phone, a.cus_remark,a.cus_return_remark, - a.cus_state, a.cus_approval_status,a.create_time,u.nick_name create_name, + a.cus_state, a.cus_approval_status,a.cus_salesman,a.create_time,u.nick_name create_name, a.cus_sales_organization,a.cus_distribution_channel,a.cus_sales_territory,a.cus_sale_office, - a.cus_currency,a.cus_tax,a.cus_reconciliation_account + a.cus_currency,a.cus_tax,a.cus_reconciliation_account,a.cus_account_allocation_group from customer a @@ -84,14 +87,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} + order by a.update_time desc