客户信息提交OA开发

This commit is contained in:
xd 2024-05-07 17:24:13 +08:00
parent 15cf265262
commit 30dfb3b829
9 changed files with 192 additions and 26 deletions

View File

@ -1,11 +1,11 @@
#for tests only !
#Mon May 06 17:03:41 CST 2024
#Tue May 07 17:18:59 CST 2024
jco.destination.pool_capacity=10
jco.client.lang=ZH
jco.client.ashost=172.19.0.125
jco.client.ashost=172.19.0.120
jco.client.saprouter=
jco.client.user=RFC
jco.client.sysnr=00
jco.destination.peak_limit=10
jco.client.passwd=654321
jco.client.client=800
jco.client.client=300

View File

@ -9,11 +9,13 @@ import com.ruoyi.common.constant.WebsocketConst;
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.FuzzySearch;
import com.ruoyi.customer.domain.qcc.QccFuzzySearchJsonResult;
import com.ruoyi.system.domain.SysNotice;
import com.ruoyi.system.service.ISysNoticeService;
import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.SapFunction.SapRfcUtils;
import com.ruoyi.web.utils.SendNotice.NoticeUtil;
import com.ruoyi.web.utils.qcc.HttpHelper;
import com.ruoyi.web.utils.qcc.QiChaChaUtil;
@ -137,8 +139,6 @@ public class CustomerController extends BaseController
customer.setUpdateBy(getUsername());
customer.setCusApprovalStatus("1");//客户提交 状态设置为 审核中
//TODO 提交校验
if(StringUtils.isEmpty(cus_id)){
customer.setCusId(UUID.fastUUID().toString());
customer.setCusCode(IdUtils.createNo("KH_",2));
@ -153,6 +153,20 @@ public class CustomerController extends BaseController
}
}
/**
* 数据组驳回
*/
@PreAuthorize("@ss.hasPermi('customer:customer:return')")
@Log(title = "客户信息驳回", businessType = BusinessType.OTHER)
@PostMapping("/returnCustomer")
public AjaxResult returnCustomer(@RequestBody Customer customer)
{
customer.setUpdateBy(getUsername());
customer.setCusApprovalStatus("3");//客户提交 状态设置为 已驳回
customerService.updateCustomer(customer);
return success();
}
/**
* 提交客户信息-SAP
*/
@ -163,11 +177,23 @@ public class CustomerController extends BaseController
{
customer.setUpdateBy(getUsername());
customer.setCusApprovalStatus("2");//客户提交 状态设置为 已审核
customerService.updateCustomer(customer);
//TODO 提交校验 调用SAP rfc接口 更新客户凭证号
return success();
RfcResult result = SapRfcUtils.sendSAP(customer);
String type = result.getType();
if("S".equals(type)){
customer.setCusSapCode(result.getPartner());
customerService.updateCustomer(customer);
}else{
return error(result.getMessage());
}
return success(result.getMessage());
}
/**
* 发送信息-数据组审核
* @param customer
*/
private void sendNotice(Customer customer){
//推送消息
LoginUser loginUser = getLoginUser();//当前登陆者

View File

@ -19,11 +19,11 @@ public class ConnectToSAP {
private static void initProperties() {
Properties connectProperties = new Properties();
// SAP服务器
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "172.19.0.125");
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "172.19.0.120");//172.19.0.125
// SAP系统编号
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
// SAP集团
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "800");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "300");//800
// SAP用户名
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "RFC");
// SAP密码

View File

@ -1,11 +1,10 @@
package com.ruoyi.web.utils.SapFunction;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.customer.domain.Bank;
import com.ruoyi.customer.domain.BankCode;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoFunction;
import com.sap.conn.jco.JCoParameterList;
import com.sap.conn.jco.JCoTable;
import com.ruoyi.customer.domain.Customer;
import com.sap.conn.jco.*;
import java.util.ArrayList;
import java.util.List;
@ -365,5 +364,79 @@ public class SapRfcUtils {
return countrys;
}
/*=======================================客户新建推送SAP=================================================*/
/**
* 客户新建推送SAP
* @param customer
* @return
*/
public static com.ruoyi.customer.domain.RfcResult sendSAP(Customer customer) {
JCoFunction function = null;
com.ruoyi.customer.domain.RfcResult res = new com.ruoyi.customer.domain.RfcResult();
JCoDestination destination = ConnectToSAP.connect();
try {
function = destination.getRepository().getFunctionTemplate("ZOA02_CUSTOMER_CREATE").getFunction();
if (function == null)
throw new RuntimeException("RFC_SYSTEM_INFO not found in SAP.");
JCoParameterList input = function.getImportParameterList();
JCoStructure jCoStructure = input.getStructure("IS_CUSTOMER");
jCoStructure.setValue("KTOKK",customer.getCusGroup());//客户账户组
jCoStructure.setValue("TITLE_MEDI","0003");//称谓文本
jCoStructure.setValue("NAME1",customer.getCusName());//客户名称
jCoStructure.setValue("SORT1",customer.getCusName());//搜索项1
jCoStructure.setValue("LANGU",customer.getCusLanguage());//SAP 语言代码
jCoStructure.setValue("COUNTRY",customer.getCusCountry());//国家/地区代码
jCoStructure.setValue("POST_CODE1","000000");//邮箱邮政编码
jCoStructure.setValue("STREET",customer.getCusStreet());//街道/门牌号
jCoStructure.setValue("STR_SUPPL1",customer.getCusQccStreet());//街道2
jCoStructure.setValue("STR_SUPPL3",customer.getCusQccStreet());//街道3
jCoStructure.setValue("STR_SUPPL4",customer.getCusQccStreet());//街道4
jCoStructure.setValue("BAHNS",customer.getCusVatNo());//增值税号
jCoStructure.setValue("TEL_NUMBER",customer.getCusPhoneNumber());//电话号码
jCoStructure.setValue("BRAN1",customer.getCusIndustryCode());//行业代码
jCoStructure.setValue("FLAG","审核通过");//审批通过
JCoStructure jCoStructure2 = input.getStructure("IS_SALES");
jCoStructure2.setValue("VKORG",customer.getCusSalesOrganization());//销售组织
jCoStructure2.setValue("VTWEG",customer.getCusDistributionChannel());//分销渠道
jCoStructure2.setValue("SPART","00");//产品组
jCoStructure2.setValue("BZIRK",customer.getCusSalesTerritory());//销售地区
jCoStructure2.setValue("VKBUR",customer.getCusSaleOffice());//销售部门
jCoStructure2.setValue("WAERS",customer.getCusCurrency());//币种
jCoStructure2.setValue("KALKS","1");//客户定价过程
jCoStructure2.setValue("VSBED","01");//装运条件
jCoStructure2.setValue("ZTERM",customer.getCusPaymentTerms());//付款条件
jCoStructure2.setValue("KTGRD","01");//账户分配组
jCoStructure2.setValue("TAXKD",customer.getCusTax());//客户税分类
JCoStructure jCoStructure3 = input.getStructure("IS_COMPANY");
jCoStructure3.setValue("BUKRS","1100");//公司代码
jCoStructure3.setValue("AKONT",customer.getCusReconciliationAccount());//统驭科目
jCoStructure3.setValue("ZTERM",customer.getCusPaymentTerms());//付款条件
jCoStructure3.setValue("TOGRU","1100");//容差组
JCoParameterList inputTable = function.getTableParameterList();
JCoTable tableInfo4 = inputTable.getTable("IT_BANK");
List<Bank> banks = customer.getBankList();
for(Bank bank:banks){
tableInfo4.appendRow();
tableInfo4.setValue("BANKS",bank.getBankCountry());//国家
tableInfo4.setValue("BANKL",bank.getBankCode());//银行代码
tableInfo4.setValue("KOINH",bank.getBankAccount());//银行账户
}
function.execute(destination);
JCoParameterList exportParam = function.getExportParameterList();
res.setType(exportParam.getString("E_TYPE"));
res.setMessage(exportParam.getString("E_MESSAGE"));
res.setPartner(exportParam.getString("E_PARTNER"));
}catch (Exception e) {
e.printStackTrace();
}
return res;
}
}

View File

@ -95,6 +95,9 @@ public class Customer extends BaseEntity
@Excel(name = "备注")
private String cusRemark;
/** 驳回备注 */
private String cusReturnRemark;
/** 客户禁用状态 */
@Excel(name = "客户禁用状态",dictType = "common_state")
private String cusState;
@ -284,6 +287,9 @@ public class Customer extends BaseEntity
{
return cusRemark;
}
public String getCusReturnRemark() { return cusReturnRemark; }
public void setCusReturnRemark(String cusReturnRemark) { this.cusReturnRemark = cusReturnRemark; }
public void setCusState(String cusState)
{
this.cusState = cusState;

View File

@ -0,0 +1,31 @@
package com.ruoyi.customer.domain;
public class RfcResult {
private String type;
private String message;
private String partner;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getPartner() {
return partner;
}
public void setPartner(String partner) {
this.partner = partner;
}
}

View File

@ -25,6 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="cusRecipient" column="cus_recipient" />
<result property="cusRecipientPhone" column="cus_recipient_phone" />
<result property="cusRemark" column="cus_remark" />
<result property="cusReturnRemark" column="cus_return_remark" />
<result property="cusState" column="cus_state" />
<result property="cusApprovalStatus" column="cus_approval_status" />
<result property="createBy" column="create_by" />
@ -63,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectCustomerVo">
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_classification, a.cus_receiving_email, a.cus_recipient, a.cus_recipient_phone, a.cus_remark,
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_sales_organization,a.cus_distribution_channel,a.cus_sales_territory,a.cus_sale_office,
@ -88,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCustomerByCusId" parameterType="java.lang.String" resultMap="CustomerBankResult">
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_classification, a.cus_receiving_email,
a.cus_recipient, a.cus_recipient_phone, a.cus_remark, a.cus_state, a.cus_approval_status,
a.cus_recipient, a.cus_recipient_phone, a.cus_remark,a.cus_return_remark, a.cus_state, a.cus_approval_status,
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,
b.bank_id as sub_bank_id, b.bank_name as sub_bank_name, b.bank_account as sub_bank_account, b.cus_id as sub_cus_id,
@ -121,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cusRecipient != null">cus_recipient,</if>
<if test="cusRecipientPhone != null">cus_recipient_phone,</if>
<if test="cusRemark != null">cus_remark,</if>
<if test="cusReturnRemark != null">cus_return_remark,</if>
<if test="cusState != null">cus_state,</if>
<if test="cusApprovalStatus != null">cus_approval_status,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
@ -154,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cusRecipient != null">#{cusRecipient},</if>
<if test="cusRecipientPhone != null">#{cusRecipientPhone},</if>
<if test="cusRemark != null">#{cusRemark},</if>
<if test="cusReturnRemark != null">#{cusReturnRemark},</if>
<if test="cusState != null">#{cusState},</if>
<if test="cusApprovalStatus != null">#{cusApprovalStatus},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
@ -190,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="cusRecipient != null">cus_recipient = #{cusRecipient},</if>
<if test="cusRecipientPhone != null">cus_recipient_phone = #{cusRecipientPhone},</if>
<if test="cusRemark != null">cus_remark = #{cusRemark},</if>
<if test="cusReturnRemark != null">cus_return_remark = #{cusReturnRemark},</if>
<if test="cusState != null">cus_state = #{cusState},</if>
<if test="cusApprovalStatus != null">cus_approval_status = #{cusApprovalStatus},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>

View File

@ -44,6 +44,15 @@ export function commitCustomer(data) {
})
}
//驳回
export function returnCustomer(data) {
return request({
url: '/customer/customer/returnCustomer',
method: 'post',
data: data
})
}
//提交客户信息-SAP
export function commitSAPCustomer(data) {
return request({

View File

@ -101,30 +101,30 @@
<el-table v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="客户ID" align="center" prop="cusId" v-if="false"/>
<el-table-column fixed label="审批状态" align="center" prop="cusApprovalStatus">
<el-table-column fixed label="审批状态" align="center" prop="cusApprovalStatus" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.cus_approval_status" :value="scope.row.cusApprovalStatus"/>
</template>
</el-table-column>
<el-table-column fixed label="客户名称" align="center" prop="cusName" width="230px">
<el-table-column fixed label="客户名称" align="center" prop="cusName" width="300px">
<template slot-scope="scope">
<el-link :underline="false" type="primary" @click="handleUpdate(scope.row)">{{scope.row.cusName}}</el-link>
</template>
</el-table-column>
<el-table-column label="客户编码" align="center" prop="cusCode" width="230px"></el-table-column>
<el-table-column label="客户编码" align="center" prop="cusCode" width="300px"></el-table-column>
<el-table-column label="SAP客户编码" align="center" prop="cusSapCode" width="150px"/>
<el-table-column label="客户类型" align="center" prop="cusType" width="100px">
<el-table-column label="客户类型" align="center" prop="cusType">
<template slot-scope="scope">
<dict-tag :options="dict.type.cus_type" :value="scope.row.cusType"/>
</template>
</el-table-column>
<el-table-column label="客户组" align="center" prop="cusGroup" width="100px">
<el-table-column label="客户组" align="center" prop="cusGroup">
<template slot-scope="scope">
<dict-tag :options="dict.type.cus_group" :value="scope.row.cusGroup"/>
</template>
</el-table-column>
<el-table-column label="创建人" align="center" prop="createName" width="100px"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<el-table-column label="创建人" align="center" prop="createName"/>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
@ -178,7 +178,7 @@
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="街道" prop="cusQccStreet">
<el-input v-model="form.cusQccStreet" placeholder="企查查带出" :disabled="isDisSalesman"/>
<el-input v-model="form.cusQccStreet" placeholder="企查查带出" :disabled="true"/>
</el-form-item>
</el-col>
<el-col :span="12">
@ -282,6 +282,13 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="8">
<el-col :span="24">
<el-form-item label="驳回备注" prop="cusReturnRemark">
<el-input type="textarea" autosize v-model="form.cusReturnRemark" placeholder="数据组填写"/>
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane label="开票银行" name="bankInfo">
<el-row class="mb8" :gutter="8">
@ -298,7 +305,6 @@
</el-row>
<el-table :data="bankList" @selection-change="handleBankSelectionChange" ref="bank">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="国家" prop="bankCountry" v-if="checkRole(['ITZX_SJZ'])">
<template slot-scope="scope">
<el-input v-model="scope.row.bankCountry" placeholder="选择银行代码自动带出" :disabled="true"/>
@ -447,6 +453,9 @@
<span style="margin-left: 10px" v-hasPermi="['customer:customer:commit']">
<el-button type="primary" plain @click="commitForm" v-if="buttonShowSalesman"> </el-button>
</span>
<span style="margin-left: 10px" v-hasPermi="['customer:customer:return']">
<el-button type="danger" plain @click="returnForm" v-if="buttonShowSjz"> </el-button>
</span>
<span style="margin-left: 10px" v-hasPermi="['customer:customer:commitSAP']">
<el-button type="primary" plain @click="commitSAPForm" v-if="buttonShowSjz"> 交OA</el-button>
</span>
@ -535,7 +544,7 @@
}
</style>
<script>
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, commitCustomer,commitSAPCustomer, qccListCustomer } from "@/api/customer/customer";
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, commitCustomer,returnCustomer, commitSAPCustomer, qccListCustomer } from "@/api/customer/customer";
import { checkPermi, checkRole } from "@/utils/permission"; //
import { bankCodeList,getCountrys,getIndustryCode,getLanguage,getPaymentTerms,getSalesOrganization,getDistributionChannel,getSalesTerritory,getSaleOffice,getTax,getReconciliationAccount } from "@/api/common/sapRfc";// sap-rfc
@ -846,7 +855,7 @@ export default {
this.buttonShowSalesman = this.form.cusApprovalStatus == '0'?true:false;
this.isDisSalesman = this.form.cusApprovalStatus == '0'?false:true;
this.buttonShowSjz = this.form.cusApprovalStatus != '0'?true:false;
this.buttonShowSjz = this.form.cusApprovalStatus != '2'?true:false;
this.isDisSjz = this.form.cusApprovalStatus == '1'?false:true;
this.bankList = response.data.bankList;
@ -888,6 +897,14 @@ export default {
}
});
},
/** 驳回 */
returnForm() {
returnCustomer(this.form).then(response => {
this.$modal.msgSuccess("驳回成功");
this.open = false;
this.getList();
});
},
/** 提交SAP按钮 */
commitSAPForm() {
this.$refs["form"].validate(valid => {