'123'
This commit is contained in:
parent
a7ee87edf5
commit
26b071c447
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import com.ruoyi.customer.domain.qcc.FuzzySearch;
|
||||
import com.ruoyi.customer.domain.qcc.QccFuzzySearchJsonResult;
|
||||
import com.ruoyi.web.utils.IdUtils;
|
||||
|
@ -43,11 +44,14 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
@PropertySource("classpath:/common.yml")
|
||||
public class CustomerController extends BaseController
|
||||
{
|
||||
// 接口请求Key
|
||||
@Value("${qichacha.key}")
|
||||
private String Qcc_Key;
|
||||
// 接口请求Key
|
||||
@Value("${qichacha.secretKey}")
|
||||
private String Qcc_SecretKey;
|
||||
// 接口请求地址
|
||||
@Value("${qichacha.serviceName}")
|
||||
private String Qcc_serviceName;
|
||||
|
||||
@Autowired
|
||||
private ICustomerService customerService;
|
||||
|
@ -68,7 +72,7 @@ public class CustomerController extends BaseController
|
|||
* 导出客户管理列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:export')")
|
||||
@Log(title = "客户管理", businessType = BusinessType.EXPORT)
|
||||
@Log(title = "客户信息导出", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Customer customer)
|
||||
{
|
||||
|
@ -82,7 +86,7 @@ public class CustomerController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:query')")
|
||||
@GetMapping(value = "/{cusId}")
|
||||
public AjaxResult getInfo(@PathVariable("cusId") Long cusId)
|
||||
public AjaxResult getInfo(@PathVariable("cusId") String cusId)
|
||||
{
|
||||
return success(customerService.selectCustomerByCusId(cusId));
|
||||
}
|
||||
|
@ -90,11 +94,12 @@ public class CustomerController extends BaseController
|
|||
/**
|
||||
* 新增客户管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:add')")
|
||||
@Log(title = "客户管理", businessType = BusinessType.INSERT)
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:save')")
|
||||
@Log(title = "客户信息新增", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Customer customer)
|
||||
{
|
||||
customer.setCusId(UUID.fastUUID().toString());
|
||||
customer.setCusCode(IdUtils.createNo("KH_",2));
|
||||
customer.setCreateBy(getUsername());
|
||||
return toAjax(customerService.insertCustomer(customer));
|
||||
|
@ -103,8 +108,8 @@ public class CustomerController extends BaseController
|
|||
/**
|
||||
* 修改客户管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:edit')")
|
||||
@Log(title = "客户管理", businessType = BusinessType.UPDATE)
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:save')")
|
||||
@Log(title = "客户信息修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Customer customer)
|
||||
{
|
||||
|
@ -112,13 +117,38 @@ public class CustomerController extends BaseController
|
|||
return toAjax(customerService.updateCustomer(customer));
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交客户信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:commit')")
|
||||
@Log(title = "客户信息提交", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/commitCustomer")
|
||||
public AjaxResult commitCustomer(@RequestBody Customer customer)
|
||||
{
|
||||
String cus_id = customer.getCusId();
|
||||
if(StringUtils.isEmpty(cus_id)){
|
||||
customer.setCusCode(IdUtils.createNo("KH_",2));
|
||||
customer.setCreateBy(getUsername());
|
||||
customerService.insertCustomer(customer);
|
||||
//提交OA中间表 TODO
|
||||
//....
|
||||
return toAjax(customerService.insertCustomer(customer));
|
||||
}else{
|
||||
customer.setUpdateBy(getUsername());
|
||||
customerService.updateCustomer(customer);
|
||||
//提交OA中间表 TODO
|
||||
//....
|
||||
return toAjax(customerService.updateCustomer(customer));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除客户管理
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:remove')")
|
||||
@Log(title = "客户管理", businessType = BusinessType.DELETE)
|
||||
@Log(title = "客户信息删除", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{cusIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] cusIds)
|
||||
public AjaxResult remove(@PathVariable String[] cusIds)
|
||||
{
|
||||
return toAjax(customerService.deleteCustomerByCusIds(cusIds));
|
||||
}
|
||||
|
@ -128,11 +158,12 @@ public class CustomerController extends BaseController
|
|||
* 查询企查查客户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('customer:customer:qcclist')")
|
||||
@Log(title = "企查查客户信息查询", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/qccListCustomer")
|
||||
public TableDataInfo qccListCustomer(FuzzySearch qcc)
|
||||
{
|
||||
String customerName = qcc.getName();
|
||||
String reqInterNme = "https://api.qichacha.com/FuzzySearch/GetList";
|
||||
String reqInterNme = Qcc_serviceName;
|
||||
List<FuzzySearch> result = new ArrayList<FuzzySearch>();
|
||||
try {
|
||||
if(!StringUtils.isEmpty(customerName)){
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package com.ruoyi.web.utils;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
public class IdUtils {
|
||||
|
||||
/***********************************************生成永不重复的单号*********************************************/
|
||||
/**
|
||||
* 生成永不重复的订单号
|
||||
* 生成永不重复的单号
|
||||
* @param startLetter 订单号开头字符串
|
||||
* @param size 订单号中随机的大写字母个数
|
||||
* @return
|
||||
|
@ -52,6 +56,51 @@ public class IdUtils {
|
|||
}
|
||||
return keyArr;
|
||||
}
|
||||
/***********************************************生成永不重复的单号*********************************************/
|
||||
|
||||
|
||||
/***********************************************获取随机UUID*********************************************/
|
||||
|
||||
/**
|
||||
* 获取随机UUID
|
||||
*
|
||||
* @return 随机UUID
|
||||
*/
|
||||
public static String randomUUID()
|
||||
{
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 简化的UUID,去掉了横线
|
||||
*
|
||||
* @return 简化的UUID,去掉了横线
|
||||
*/
|
||||
public static String simpleUUID()
|
||||
{
|
||||
return UUID.randomUUID().toString(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
|
||||
*
|
||||
* @return 随机UUID
|
||||
*/
|
||||
public static String fastUUID()
|
||||
{
|
||||
return UUID.fastUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
|
||||
*
|
||||
* @return 简化的UUID,去掉了横线
|
||||
*/
|
||||
public static String fastSimpleUUID()
|
||||
{
|
||||
return UUID.fastUUID().toString(true);
|
||||
}
|
||||
/***********************************************获取随机UUID*********************************************/
|
||||
|
||||
/**
|
||||
* 测试
|
||||
|
|
|
@ -9,3 +9,4 @@ sapWebservice.psw: QAZ54321
|
|||
|
||||
qichacha.key: 824936f8e78c4f4788978da38b26d488
|
||||
qichacha.secretKey: 8B9EB102FD17E0CF2EDEC0FB507DEC1E
|
||||
qichacha.serviceName: https://api.qichacha.com/FuzzySearch/GetList
|
||||
|
|
|
@ -22,11 +22,6 @@ public enum BusinessType
|
|||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 新增修改
|
||||
*/
|
||||
INSERT_OR_UPDATE,
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ public class Bank extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 银行ID */
|
||||
private Long bankId;
|
||||
private String bankId;
|
||||
|
||||
/** 银行名称 */
|
||||
@Excel(name = "银行名称")
|
||||
|
@ -28,14 +28,14 @@ public class Bank extends BaseEntity
|
|||
|
||||
/** 客户ID */
|
||||
@Excel(name = "客户ID")
|
||||
private Long cusId;
|
||||
private String cusId;
|
||||
|
||||
public void setBankId(Long bankId)
|
||||
public void setBankId(String bankId)
|
||||
{
|
||||
this.bankId = bankId;
|
||||
}
|
||||
|
||||
public Long getBankId()
|
||||
public String getBankId()
|
||||
{
|
||||
return bankId;
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ public class Bank extends BaseEntity
|
|||
{
|
||||
return bankAccount;
|
||||
}
|
||||
public void setCusId(Long cusId)
|
||||
public void setCusId(String cusId)
|
||||
{
|
||||
this.cusId = cusId;
|
||||
}
|
||||
|
||||
public Long getCusId()
|
||||
public String getCusId()
|
||||
{
|
||||
return cusId;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Customer extends BaseEntity
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 客户ID */
|
||||
private Long cusId;
|
||||
private String cusId;
|
||||
|
||||
/** 客户编码 */
|
||||
@Excel(name = "客户编码")
|
||||
|
@ -106,12 +106,12 @@ public class Customer extends BaseEntity
|
|||
/** 银行信息 */
|
||||
private List<Bank> bankList;
|
||||
|
||||
public void setCusId(Long cusId)
|
||||
public void setCusId(String cusId)
|
||||
{
|
||||
this.cusId = cusId;
|
||||
}
|
||||
|
||||
public Long getCusId()
|
||||
public String getCusId()
|
||||
{
|
||||
return cusId;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface CustomerMapper
|
|||
* @param cusId 客户管理主键
|
||||
* @return 客户管理
|
||||
*/
|
||||
public Customer selectCustomerByCusId(Long cusId);
|
||||
public Customer selectCustomerByCusId(String cusId);
|
||||
|
||||
/**
|
||||
* 查询客户管理列表
|
||||
|
@ -50,7 +50,7 @@ public interface CustomerMapper
|
|||
* @param cusId 客户管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomerByCusId(Long cusId);
|
||||
public int deleteCustomerByCusId(String cusId);
|
||||
|
||||
/**
|
||||
* 批量删除客户管理
|
||||
|
@ -58,7 +58,7 @@ public interface CustomerMapper
|
|||
* @param cusIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomerByCusIds(Long[] cusIds);
|
||||
public int deleteCustomerByCusIds(String[] cusIds);
|
||||
|
||||
/**
|
||||
* 批量删除银行
|
||||
|
@ -66,7 +66,7 @@ public interface CustomerMapper
|
|||
* @param cusIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBankByCusIds(Long[] cusIds);
|
||||
public int deleteBankByCusIds(String[] cusIds);
|
||||
|
||||
/**
|
||||
* 批量新增银行
|
||||
|
@ -83,5 +83,5 @@ public interface CustomerMapper
|
|||
* @param cusId 客户管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBankByCusId(Long cusId);
|
||||
public int deleteBankByCusId(String cusId);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface ICustomerService
|
|||
* @param cusId 客户管理主键
|
||||
* @return 客户管理
|
||||
*/
|
||||
public Customer selectCustomerByCusId(Long cusId);
|
||||
public Customer selectCustomerByCusId(String cusId);
|
||||
|
||||
/**
|
||||
* 查询客户管理列表
|
||||
|
@ -49,7 +49,7 @@ public interface ICustomerService
|
|||
* @param cusIds 需要删除的客户管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomerByCusIds(Long[] cusIds);
|
||||
public int deleteCustomerByCusIds(String[] cusIds);
|
||||
|
||||
/**
|
||||
* 删除客户管理信息
|
||||
|
@ -57,5 +57,5 @@ public interface ICustomerService
|
|||
* @param cusId 客户管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteCustomerByCusId(Long cusId);
|
||||
public int deleteCustomerByCusId(String cusId);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.ruoyi.customer.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.annotation.DataScope;
|
||||
import com.ruoyi.common.utils.uuid.UUID;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
|
@ -32,7 +32,7 @@ public class CustomerServiceImpl implements ICustomerService
|
|||
* @return 客户管理
|
||||
*/
|
||||
@Override
|
||||
public Customer selectCustomerByCusId(Long cusId)
|
||||
public Customer selectCustomerByCusId(String cusId)
|
||||
{
|
||||
return customerMapper.selectCustomerByCusId(cusId);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class CustomerServiceImpl implements ICustomerService
|
|||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteCustomerByCusIds(Long[] cusIds)
|
||||
public int deleteCustomerByCusIds(String[] cusIds)
|
||||
{
|
||||
customerMapper.deleteBankByCusIds(cusIds);
|
||||
return customerMapper.deleteCustomerByCusIds(cusIds);
|
||||
|
@ -102,7 +102,7 @@ public class CustomerServiceImpl implements ICustomerService
|
|||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteCustomerByCusId(Long cusId)
|
||||
public int deleteCustomerByCusId(String cusId)
|
||||
{
|
||||
customerMapper.deleteBankByCusId(cusId);
|
||||
return customerMapper.deleteCustomerByCusId(cusId);
|
||||
|
@ -116,12 +116,13 @@ public class CustomerServiceImpl implements ICustomerService
|
|||
public void insertBank(Customer customer)
|
||||
{
|
||||
List<Bank> bankList = customer.getBankList();
|
||||
Long cusId = customer.getCusId();
|
||||
String cusId = customer.getCusId();
|
||||
if (StringUtils.isNotNull(bankList))
|
||||
{
|
||||
List<Bank> list = new ArrayList<Bank>();
|
||||
for (Bank bank : bankList)
|
||||
{
|
||||
bank.setBankId(UUID.fastUUID().toString());
|
||||
bank.setCusId(cusId);
|
||||
list.add(bank);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectCustomerByCusId" parameterType="Long" resultMap="CustomerBankResult">
|
||||
<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_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,
|
||||
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
|
||||
from customer a
|
||||
|
@ -78,9 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where a.cus_id = #{cusId}
|
||||
</select>
|
||||
|
||||
<insert id="insertCustomer" parameterType="Customer" useGeneratedKeys="true" keyProperty="cusId">
|
||||
<insert id="insertCustomer" parameterType="Customer">
|
||||
insert into customer
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="cusId != null">cus_id,</if>
|
||||
<if test="cusCode != null">cus_code,</if>
|
||||
<if test="cusName != null and cusName != ''">cus_name,</if>
|
||||
<if test="cusSapCode != null">cus_sap_code,</if>
|
||||
|
@ -105,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
create_time
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="cusId != null">#{cusId},</if>
|
||||
<if test="cusCode != null">#{cusCode},</if>
|
||||
<if test="cusName != null and cusName != ''">#{cusName},</if>
|
||||
<if test="cusSapCode != null">#{cusSapCode},</if>
|
||||
|
@ -159,7 +161,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where cus_id = #{cusId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteCustomerByCusId" parameterType="Long">
|
||||
<delete id="deleteCustomerByCusId" parameterType="java.lang.String">
|
||||
delete from customer where cus_id = #{cusId}
|
||||
</delete>
|
||||
|
||||
|
@ -177,14 +179,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBankByCusId" parameterType="Long">
|
||||
<delete id="deleteBankByCusId" parameterType="java.lang.String">
|
||||
delete from bank where cus_id = #{cusId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchBank">
|
||||
insert into bank(bank_name, bank_account, cus_id) values
|
||||
insert into bank(bank_id, bank_name, bank_account, cus_id) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.bankName}, #{item.bankAccount}, #{item.cusId})
|
||||
( #{item.bankId}, #{item.bankName}, #{item.bankAccount}, #{item.cusId})
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
|
@ -35,6 +35,15 @@ export function updateCustomer(data) {
|
|||
})
|
||||
}
|
||||
|
||||
//提交客户信息
|
||||
export function commitCustomer(data) {
|
||||
return request({
|
||||
url: '/customer/customer/commitCustomer',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除客户管理
|
||||
export function delCustomer(cusId) {
|
||||
return request({
|
||||
|
|
|
@ -310,8 +310,8 @@
|
|||
</el-table>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer" v-if="buttonShow">
|
||||
<el-button @click="saveForm">保 存</el-button>
|
||||
<el-button type="primary" plain @click="commitForm">提 交</el-button>
|
||||
<el-button @click="saveForm" v-hasPermi="['customer:customer:save']">保 存</el-button>
|
||||
<el-button type="primary" plain @click="commitForm" v-hasPermi="['customer:customer:commit']">提 交</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
@ -358,11 +358,11 @@
|
|||
font-size: 14px;
|
||||
word-break: break-all;
|
||||
overflow-y: auto; /* 自动显示垂直滚动条 */
|
||||
max-height: 580px; /* 设置最大高度,根据需要调整 */
|
||||
max-height: 560px; /* 设置最大高度,根据需要调整 */
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, qccListCustomer } from "@/api/customer/customer";
|
||||
import { listCustomer, getCustomer, delCustomer, addCustomer, updateCustomer, commitCustomer, qccListCustomer } from "@/api/customer/customer";
|
||||
|
||||
export default {
|
||||
name: "Customer",
|
||||
|
@ -531,7 +531,7 @@ export default {
|
|||
this.form.cusGroup = 'Z001';
|
||||
this.form.cusCountry = 'CN';
|
||||
this.form.cusLanguage = 'ZH';
|
||||
this.form.cusType = 'saleCus';
|
||||
this.form.cusType = '0';
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
|
@ -566,25 +566,18 @@ export default {
|
|||
}
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
commitForm() {
|
||||
/*this.$refs["form"].validate(valid => {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.bankList = this.bankList;
|
||||
if (this.form.cusId != null) {
|
||||
commitCustomer(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
commitCustomer(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$modal.msgSuccess("提交成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});*/
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
|
|
Loading…
Reference in New Issue