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 new file mode 100644 index 0000000..bd91c14 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/customer/CustomerController.java @@ -0,0 +1,104 @@ +package com.ruoyi.web.controller.customer; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.customer.domain.Customer; +import com.ruoyi.customer.service.ICustomerService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 客户管理Controller + * + * @author ruoyi + * @date 2024-03-25 + */ +@RestController +@RequestMapping("/customer/customer") +public class CustomerController extends BaseController +{ + @Autowired + private ICustomerService customerService; + + /** + * 查询客户管理列表 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:list')") + @GetMapping("/list") + public TableDataInfo list(Customer customer) + { + startPage(); + List list = customerService.selectCustomerList(customer); + return getDataTable(list); + } + + /** + * 导出客户管理列表 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:export')") + @Log(title = "客户管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Customer customer) + { + List list = customerService.selectCustomerList(customer); + ExcelUtil util = new ExcelUtil(Customer.class); + util.exportExcel(response, list, "客户管理数据"); + } + + /** + * 获取客户管理详细信息 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:query')") + @GetMapping(value = "/{cusId}") + public AjaxResult getInfo(@PathVariable("cusId") Long cusId) + { + return success(customerService.selectCustomerByCusId(cusId)); + } + + /** + * 新增客户管理 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:add')") + @Log(title = "客户管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody Customer customer) + { + return toAjax(customerService.insertCustomer(customer)); + } + + /** + * 修改客户管理 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:edit')") + @Log(title = "客户管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody Customer customer) + { + return toAjax(customerService.updateCustomer(customer)); + } + + /** + * 删除客户管理 + */ + @PreAuthorize("@ss.hasPermi('customer:customer:remove')") + @Log(title = "客户管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{cusIds}") + public AjaxResult remove(@PathVariable Long[] cusIds) + { + return toAjax(customerService.deleteCustomerByCusIds(cusIds)); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Bank.java b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Bank.java new file mode 100644 index 0000000..437272a --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Bank.java @@ -0,0 +1,79 @@ +package com.ruoyi.customer.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 银行对象 bank + * + * @author ruoyi + * @date 2024-03-25 + */ +public class Bank extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 银行ID */ + private Long bankId; + + /** 银行名称 */ + @Excel(name = "银行名称") + private String bankName; + + /** 银行账户 */ + @Excel(name = "银行账户") + private String bankAccount; + + /** 客户ID */ + @Excel(name = "客户ID") + private Long cusId; + + public void setBankId(Long bankId) + { + this.bankId = bankId; + } + + public Long getBankId() + { + return bankId; + } + public void setBankName(String bankName) + { + this.bankName = bankName; + } + + public String getBankName() + { + return bankName; + } + public void setBankAccount(String bankAccount) + { + this.bankAccount = bankAccount; + } + + public String getBankAccount() + { + return bankAccount; + } + public void setCusId(Long cusId) + { + this.cusId = cusId; + } + + public Long getCusId() + { + return cusId; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("bankId", getBankId()) + .append("bankName", getBankName()) + .append("bankAccount", getBankAccount()) + .append("cusId", getCusId()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Customer.java b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Customer.java new file mode 100644 index 0000000..e4e42d6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/domain/Customer.java @@ -0,0 +1,317 @@ +package com.ruoyi.customer.domain; + +import java.util.List; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 客户管理对象 customer + * + * @author ruoyi + * @date 2024-03-25 + */ +public class Customer extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 客户ID */ + private Long cusId; + + /** 客户编码 */ + @Excel(name = "客户编码") + private String cusCode; + + /** 客户名称 */ + @Excel(name = "客户名称") + private String cusName; + + /** SAP客户编码 */ + @Excel(name = "SAP客户编码") + private String cusSapCode; + + /** 街道/门牌号 */ + private String cusStreet; + + /** 付款条件 */ + private String cusPaymentTerms; + + /** 电话号码 */ + private String cusPhoneNumber; + + /** 行业代码 */ + private String cusIndustryCode; + + /** 客户组类别 */ + private String cusGroup; + + /** 增值税号 */ + private String cusVatNo; + + /** 客户类型 */ + private String cusType; + + /** 国家 */ + private String cusCountry; + + /** 语言 */ + private String cusLanguage; + + /** 客户标签 */ + private String cusLabel; + + /** 客户分类 */ + private String cusClassification; + + /** 电子发票接收邮箱 */ + private String cusReceivingEmail; + + /** 收件人 */ + private String cusRecipient; + + /** 收件人电话 */ + private String cusRecipientPhone; + + /** 备注 */ + private String cusRemark; + + /** 客户禁用状态 */ + @Excel(name = "客户禁用状态") + private String cusState; + + /** 客户审批状态 */ + @Excel(name = "客户审批状态") + private String cusApprovalStatus; + + /** 银行信息 */ + private List bankList; + + public void setCusId(Long cusId) + { + this.cusId = cusId; + } + + public Long getCusId() + { + return cusId; + } + public void setCusCode(String cusCode) + { + this.cusCode = cusCode; + } + + public String getCusCode() + { + return cusCode; + } + public void setCusName(String cusName) + { + this.cusName = cusName; + } + + public String getCusName() + { + return cusName; + } + public void setCusSapCode(String cusSapCode) + { + this.cusSapCode = cusSapCode; + } + + public String getCusSapCode() + { + return cusSapCode; + } + public void setCusStreet(String cusStreet) + { + this.cusStreet = cusStreet; + } + + public String getCusStreet() + { + return cusStreet; + } + public void setCusPaymentTerms(String cusPaymentTerms) + { + this.cusPaymentTerms = cusPaymentTerms; + } + + public String getCusPaymentTerms() + { + return cusPaymentTerms; + } + public void setCusPhoneNumber(String cusPhoneNumber) + { + this.cusPhoneNumber = cusPhoneNumber; + } + + public String getCusPhoneNumber() + { + return cusPhoneNumber; + } + public void setCusIndustryCode(String cusIndustryCode) + { + this.cusIndustryCode = cusIndustryCode; + } + + public String getCusIndustryCode() + { + return cusIndustryCode; + } + public void setCusGroup(String cusGroup) + { + this.cusGroup = cusGroup; + } + + public String getCusGroup() + { + return cusGroup; + } + public void setCusVatNo(String cusVatNo) + { + this.cusVatNo = cusVatNo; + } + + public String getCusVatNo() + { + return cusVatNo; + } + public void setCusType(String cusType) + { + this.cusType = cusType; + } + + public String getCusType() + { + return cusType; + } + public void setCusCountry(String cusCountry) + { + this.cusCountry = cusCountry; + } + + public String getCusCountry() + { + return cusCountry; + } + public void setCusLanguage(String cusLanguage) + { + this.cusLanguage = cusLanguage; + } + + public String getCusLanguage() + { + return cusLanguage; + } + public void setCusLabel(String cusLabel) + { + this.cusLabel = cusLabel; + } + + public String getCusLabel() + { + return cusLabel; + } + public void setCusClassification(String cusClassification) + { + this.cusClassification = cusClassification; + } + + public String getCusClassification() + { + return cusClassification; + } + public void setCusReceivingEmail(String cusReceivingEmail) + { + this.cusReceivingEmail = cusReceivingEmail; + } + + public String getCusReceivingEmail() + { + return cusReceivingEmail; + } + public void setCusRecipient(String cusRecipient) + { + this.cusRecipient = cusRecipient; + } + + public String getCusRecipient() + { + return cusRecipient; + } + public void setCusRecipientPhone(String cusRecipientPhone) + { + this.cusRecipientPhone = cusRecipientPhone; + } + + public String getCusRecipientPhone() + { + return cusRecipientPhone; + } + public void setCusRemark(String cusRemark) + { + this.cusRemark = cusRemark; + } + + public String getCusRemark() + { + return cusRemark; + } + public void setCusState(String cusState) + { + this.cusState = cusState; + } + + public String getCusState() + { + return cusState; + } + public void setCusApprovalStatus(String cusApprovalStatus) + { + this.cusApprovalStatus = cusApprovalStatus; + } + + public String getCusApprovalStatus() + { + return cusApprovalStatus; + } + + public List getBankList() + { + return bankList; + } + + public void setBankList(List bankList) + { + this.bankList = bankList; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("cusId", getCusId()) + .append("cusCode", getCusCode()) + .append("cusName", getCusName()) + .append("cusSapCode", getCusSapCode()) + .append("cusStreet", getCusStreet()) + .append("cusPaymentTerms", getCusPaymentTerms()) + .append("cusPhoneNumber", getCusPhoneNumber()) + .append("cusIndustryCode", getCusIndustryCode()) + .append("cusGroup", getCusGroup()) + .append("cusVatNo", getCusVatNo()) + .append("cusType", getCusType()) + .append("cusCountry", getCusCountry()) + .append("cusLanguage", getCusLanguage()) + .append("cusLabel", getCusLabel()) + .append("cusClassification", getCusClassification()) + .append("cusReceivingEmail", getCusReceivingEmail()) + .append("cusRecipient", getCusRecipient()) + .append("cusRecipientPhone", getCusRecipientPhone()) + .append("cusRemark", getCusRemark()) + .append("cusState", getCusState()) + .append("cusApprovalStatus", getCusApprovalStatus()) + .append("bankList", getBankList()) + .toString(); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/mapper/CustomerMapper.java b/ruoyi-system/src/main/java/com/ruoyi/customer/mapper/CustomerMapper.java new file mode 100644 index 0000000..d1c8172 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/mapper/CustomerMapper.java @@ -0,0 +1,87 @@ +package com.ruoyi.customer.mapper; + +import java.util.List; +import com.ruoyi.customer.domain.Customer; +import com.ruoyi.customer.domain.Bank; + +/** + * 客户管理Mapper接口 + * + * @author ruoyi + * @date 2024-03-25 + */ +public interface CustomerMapper +{ + /** + * 查询客户管理 + * + * @param cusId 客户管理主键 + * @return 客户管理 + */ + public Customer selectCustomerByCusId(Long cusId); + + /** + * 查询客户管理列表 + * + * @param customer 客户管理 + * @return 客户管理集合 + */ + public List selectCustomerList(Customer customer); + + /** + * 新增客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + public int insertCustomer(Customer customer); + + /** + * 修改客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + public int updateCustomer(Customer customer); + + /** + * 删除客户管理 + * + * @param cusId 客户管理主键 + * @return 结果 + */ + public int deleteCustomerByCusId(Long cusId); + + /** + * 批量删除客户管理 + * + * @param cusIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCustomerByCusIds(Long[] cusIds); + + /** + * 批量删除银行 + * + * @param cusIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBankByCusIds(Long[] cusIds); + + /** + * 批量新增银行 + * + * @param bankList 银行列表 + * @return 结果 + */ + public int batchBank(List bankList); + + + /** + * 通过客户管理主键删除银行信息 + * + * @param cusId 客户管理ID + * @return 结果 + */ + public int deleteBankByCusId(Long cusId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/service/ICustomerService.java b/ruoyi-system/src/main/java/com/ruoyi/customer/service/ICustomerService.java new file mode 100644 index 0000000..ec909c9 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/service/ICustomerService.java @@ -0,0 +1,61 @@ +package com.ruoyi.customer.service; + +import java.util.List; +import com.ruoyi.customer.domain.Customer; + +/** + * 客户管理Service接口 + * + * @author ruoyi + * @date 2024-03-25 + */ +public interface ICustomerService +{ + /** + * 查询客户管理 + * + * @param cusId 客户管理主键 + * @return 客户管理 + */ + public Customer selectCustomerByCusId(Long cusId); + + /** + * 查询客户管理列表 + * + * @param customer 客户管理 + * @return 客户管理集合 + */ + public List selectCustomerList(Customer customer); + + /** + * 新增客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + public int insertCustomer(Customer customer); + + /** + * 修改客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + public int updateCustomer(Customer customer); + + /** + * 批量删除客户管理 + * + * @param cusIds 需要删除的客户管理主键集合 + * @return 结果 + */ + public int deleteCustomerByCusIds(Long[] cusIds); + + /** + * 删除客户管理信息 + * + * @param cusId 客户管理主键 + * @return 结果 + */ + public int deleteCustomerByCusId(Long cusId); +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/customer/service/impl/CustomerServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/customer/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..4c9fd96 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/customer/service/impl/CustomerServiceImpl.java @@ -0,0 +1,131 @@ +package com.ruoyi.customer.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.ArrayList; +import com.ruoyi.common.utils.StringUtils; +import org.springframework.transaction.annotation.Transactional; +import com.ruoyi.customer.domain.Bank; +import com.ruoyi.customer.mapper.CustomerMapper; +import com.ruoyi.customer.domain.Customer; +import com.ruoyi.customer.service.ICustomerService; + +/** + * 客户管理Service业务层处理 + * + * @author ruoyi + * @date 2024-03-25 + */ +@Service +public class CustomerServiceImpl implements ICustomerService +{ + @Autowired + private CustomerMapper customerMapper; + + /** + * 查询客户管理 + * + * @param cusId 客户管理主键 + * @return 客户管理 + */ + @Override + public Customer selectCustomerByCusId(Long cusId) + { + return customerMapper.selectCustomerByCusId(cusId); + } + + /** + * 查询客户管理列表 + * + * @param customer 客户管理 + * @return 客户管理 + */ + @Override + public List selectCustomerList(Customer customer) + { + return customerMapper.selectCustomerList(customer); + } + + /** + * 新增客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + @Transactional + @Override + public int insertCustomer(Customer customer) + { + int rows = customerMapper.insertCustomer(customer); + insertBank(customer); + return rows; + } + + /** + * 修改客户管理 + * + * @param customer 客户管理 + * @return 结果 + */ + @Transactional + @Override + public int updateCustomer(Customer customer) + { + customerMapper.deleteBankByCusId(customer.getCusId()); + insertBank(customer); + return customerMapper.updateCustomer(customer); + } + + /** + * 批量删除客户管理 + * + * @param cusIds 需要删除的客户管理主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteCustomerByCusIds(Long[] cusIds) + { + customerMapper.deleteBankByCusIds(cusIds); + return customerMapper.deleteCustomerByCusIds(cusIds); + } + + /** + * 删除客户管理信息 + * + * @param cusId 客户管理主键 + * @return 结果 + */ + @Transactional + @Override + public int deleteCustomerByCusId(Long cusId) + { + customerMapper.deleteBankByCusId(cusId); + return customerMapper.deleteCustomerByCusId(cusId); + } + + /** + * 新增银行信息 + * + * @param customer 客户管理对象 + */ + public void insertBank(Customer customer) + { + List bankList = customer.getBankList(); + Long cusId = customer.getCusId(); + if (StringUtils.isNotNull(bankList)) + { + List list = new ArrayList(); + for (Bank bank : bankList) + { + bank.setCusId(cusId); + list.add(bank); + } + if (list.size() > 0) + { + customerMapper.batchBank(list); + } + } + } +} diff --git a/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml b/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml new file mode 100644 index 0000000..346cbe0 --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/customer/CustomerMapper.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select cus_id, cus_code, cus_name, cus_sap_code, cus_street, cus_payment_terms, cus_phone_number, cus_industry_code, cus_group, cus_vat_no, cus_type, cus_country, cus_language, cus_label, cus_classification, cus_receiving_email, cus_recipient, cus_recipient_phone, cus_remark, cus_state, cus_approval_status from customer + + + + + + + + insert into customer + + cus_id, + cus_code, + cus_name, + cus_sap_code, + cus_street, + cus_payment_terms, + cus_phone_number, + cus_industry_code, + cus_group, + cus_vat_no, + cus_type, + cus_country, + cus_language, + cus_label, + cus_classification, + cus_receiving_email, + cus_recipient, + cus_recipient_phone, + cus_remark, + cus_state, + cus_approval_status, + + + #{cusId}, + #{cusCode}, + #{cusName}, + #{cusSapCode}, + #{cusStreet}, + #{cusPaymentTerms}, + #{cusPhoneNumber}, + #{cusIndustryCode}, + #{cusGroup}, + #{cusVatNo}, + #{cusType}, + #{cusCountry}, + #{cusLanguage}, + #{cusLabel}, + #{cusClassification}, + #{cusReceivingEmail}, + #{cusRecipient}, + #{cusRecipientPhone}, + #{cusRemark}, + #{cusState}, + #{cusApprovalStatus}, + + + + + update customer + + cus_code = #{cusCode}, + cus_name = #{cusName}, + cus_sap_code = #{cusSapCode}, + cus_street = #{cusStreet}, + cus_payment_terms = #{cusPaymentTerms}, + cus_phone_number = #{cusPhoneNumber}, + cus_industry_code = #{cusIndustryCode}, + cus_group = #{cusGroup}, + cus_vat_no = #{cusVatNo}, + cus_type = #{cusType}, + cus_country = #{cusCountry}, + cus_language = #{cusLanguage}, + cus_label = #{cusLabel}, + cus_classification = #{cusClassification}, + cus_receiving_email = #{cusReceivingEmail}, + cus_recipient = #{cusRecipient}, + cus_recipient_phone = #{cusRecipientPhone}, + cus_remark = #{cusRemark}, + cus_state = #{cusState}, + cus_approval_status = #{cusApprovalStatus}, + + where cus_id = #{cusId} + + + + delete from customer where cus_id = #{cusId} + + + + delete from customer where cus_id in + + #{cusId} + + + + + delete from bank where cus_id in + + #{cusId} + + + + + delete from bank where cus_id = #{cusId} + + + + insert into bank( bank_id, bank_name, bank_account, cus_id) values + + ( #{item.bankId}, #{item.bankName}, #{item.bankAccount}, #{item.cusId}) + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/customer/customer.js b/ruoyi-ui/src/api/customer/customer.js new file mode 100644 index 0000000..262ccf2 --- /dev/null +++ b/ruoyi-ui/src/api/customer/customer.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询客户管理列表 +export function listCustomer(query) { + return request({ + url: '/customer/customer/list', + method: 'get', + params: query + }) +} + +// 查询客户管理详细 +export function getCustomer(cusId) { + return request({ + url: '/customer/customer/' + cusId, + method: 'get' + }) +} + +// 新增客户管理 +export function addCustomer(data) { + return request({ + url: '/customer/customer', + method: 'post', + data: data + }) +} + +// 修改客户管理 +export function updateCustomer(data) { + return request({ + url: '/customer/customer', + method: 'put', + data: data + }) +} + +// 删除客户管理 +export function delCustomer(cusId) { + return request({ + url: '/customer/customer/' + cusId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/views/customer/customer/index.vue b/ruoyi-ui/src/views/customer/customer/index.vue new file mode 100644 index 0000000..85fc23f --- /dev/null +++ b/ruoyi-ui/src/views/customer/customer/index.vue @@ -0,0 +1,461 @@ + + +