From 70a6add6e0616b2ca01810d06ab7651f7f19a8ea Mon Sep 17 00:00:00 2001 From: jiayang yue Date: Fri, 11 Apr 2025 18:23:06 +0800 Subject: [PATCH] =?UTF-8?q?2025-04-11=20=E5=AE=A2=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E7=A7=BB=E6=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gaotao/common/utils/QueryPage.java | 4 + .../controller/CustomerController.java | 158 ++++++++++++++++++ .../modules/customer/entity/Customer.java | 85 ++++++++++ .../entity/CustomerBillingOutData.java | 153 +++++++++++++++++ .../customer/entity/ProjectPersonData.java | 128 ++++++++++++++ .../mapper/CustomerBillingMapper.java | 22 +++ .../customer/mapper/CustomerMapper.java | 24 +++ .../customer/mapper/ProjectPersonMapper.java | 17 ++ .../service/CustomerBillingService.java | 20 +++ .../customer/service/CustomerService.java | 28 ++++ .../service/ProjectPersonService.java | 23 +++ .../impl/CustomerBillingServiceImpl.java | 66 ++++++++ .../service/impl/CustomerServiceImpl.java | 69 ++++++++ .../impl/ProjectPersonServiceImpl.java | 72 ++++++++ .../mapper/customer/CustomerMapper.xml | 16 ++ 15 files changed, 885 insertions(+) create mode 100644 src/main/java/com/gaotao/modules/customer/controller/CustomerController.java create mode 100644 src/main/java/com/gaotao/modules/customer/entity/Customer.java create mode 100644 src/main/java/com/gaotao/modules/customer/entity/CustomerBillingOutData.java create mode 100644 src/main/java/com/gaotao/modules/customer/entity/ProjectPersonData.java create mode 100644 src/main/java/com/gaotao/modules/customer/mapper/CustomerBillingMapper.java create mode 100644 src/main/java/com/gaotao/modules/customer/mapper/CustomerMapper.java create mode 100644 src/main/java/com/gaotao/modules/customer/mapper/ProjectPersonMapper.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/CustomerBillingService.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/CustomerService.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/ProjectPersonService.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/impl/CustomerBillingServiceImpl.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/impl/CustomerServiceImpl.java create mode 100644 src/main/java/com/gaotao/modules/customer/service/impl/ProjectPersonServiceImpl.java create mode 100644 src/main/resources/mapper/customer/CustomerMapper.xml diff --git a/src/main/java/com/gaotao/common/utils/QueryPage.java b/src/main/java/com/gaotao/common/utils/QueryPage.java index 1270216..1776b8b 100644 --- a/src/main/java/com/gaotao/common/utils/QueryPage.java +++ b/src/main/java/com/gaotao/common/utils/QueryPage.java @@ -1,9 +1,13 @@ package com.gaotao.common.utils; +import com.baomidou.mybatisplus.annotation.TableField; + public class QueryPage { + @TableField(exist = false) private int limit; + @TableField(exist = false) private int page; public int getLimit() { diff --git a/src/main/java/com/gaotao/modules/customer/controller/CustomerController.java b/src/main/java/com/gaotao/modules/customer/controller/CustomerController.java new file mode 100644 index 0000000..18e149e --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/controller/CustomerController.java @@ -0,0 +1,158 @@ +package com.gaotao.modules.customer.controller; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gaotao.common.utils.PageUtils; +import com.gaotao.common.utils.R; +import com.gaotao.modules.customer.entity.Customer; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import com.gaotao.modules.customer.entity.ProjectPersonData; +import com.gaotao.modules.customer.service.CustomerBillingService; +import com.gaotao.modules.customer.service.CustomerService; +import com.gaotao.modules.customer.service.ProjectPersonService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/3/26 19:28 + * @param: + * @return: + */ +@RequestMapping("cust") +@RestController +public class CustomerController { + + @Autowired + private CustomerService customerService; + + @Autowired + private CustomerBillingService customerBillingService; + + @Autowired + private ProjectPersonService projectPersonService; + + + /** + * @Description 查询所有客户信息 + * @Title CustomerData + * @param data + * @author jiayang_yue + * @data 2025/3/26 19:59 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/CustomerData") + @ResponseBody + public R CustomerData(@RequestBody Customer data){ + PageUtils page = customerService.findAll(data); + return R.ok().put("page", page); + } + + @PostMapping("/customerSave") + @ResponseBody + public R customerSave(@RequestBody Customer data){ + customerService.customerSave(data); + return R.ok(); + } + + @PostMapping("/customerDel") + @ResponseBody + public R customerDel(@RequestBody Customer data){ + customerService.removeById(data.getId()); + return R.ok(); + } + + /** + * @Description 查询开票信息 + * @Title fetchBillingData + * @param data + * @author jiayang_yue + * @data 2025/4/10 17:36 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/fetchBillingData") + @ResponseBody + public R fetchBillingData(@RequestBody Customer data){ + List list = customerBillingService.findBillingById(data.getId()); + return R.ok().put("list", list); + } + + /** + * @Description 删除开票信息ById + * @Title removeBillingDataById + * @param data + * @author jiayang_yue + * @data 2025/4/10 17:35 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/removeBillingData") + @ResponseBody + public R removeBillingDataById(@RequestBody CustomerBillingOutData data){ + customerBillingService.removeById(data.getId()); + return R.ok(); + } + + /** + * @Description 新增编辑保存开票信息 + * @Title billingSave + * @param data + * @author jiayang_yue + * @data 2025/4/11 17:28 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/billingSave") + @ResponseBody + public R billingSave(@RequestBody CustomerBillingOutData data){ + customerBillingService.billingSave(data); + return R.ok(); + } + + /** + * @Description 查询联系人信息 + * @Title fetchPersonData + * @param data + * @author jiayang_yue + * @data 2025/4/10 17:36 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/fetchPersonData") + @ResponseBody + public R fetchPersonData(@RequestBody Customer data){ + List list = projectPersonService.findPersonById(data.getId()); + return R.ok().put("list", list); + } + + /** + * @Description 新增编辑保存联系人信息 + * @Title personSave + * @param data + * @author jiayang_yue + * @data 2025/4/10 17:35 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/personSave") + @ResponseBody + public R personSave(@RequestBody ProjectPersonData data){ + projectPersonService.personSave(data); + return R.ok(); + } + + /** + * @Description 停用联系人 + * @Title personInactive + * @param data + * @author jiayang_yue + * @data 2025/4/11 17:34 + * @return com.gaotao.common.utils.R + **/ + @PostMapping("/personInactive") + @ResponseBody + public R personInactive(@RequestBody ProjectPersonData data){ + projectPersonService.updatePersonInactiveById(data); + return R.ok(); + } + +} diff --git a/src/main/java/com/gaotao/modules/customer/entity/Customer.java b/src/main/java/com/gaotao/modules/customer/entity/Customer.java new file mode 100644 index 0000000..eefede7 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/entity/Customer.java @@ -0,0 +1,85 @@ +package com.gaotao.modules.customer.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; + +import java.io.Serializable; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.gaotao.common.utils.QueryPage; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +/** + * @TableName customer + */ +@TableName(value ="customer") +@Data +public class Customer extends QueryPage implements Serializable { + private static final long serialVersionUID = 1L; + + private Integer id; + + private String customerName; + + private String customerClassification; + + private String customerType; + + private String customerIndustry; + + private String seller; + + private String district; + + private String serviceChargeFlag; + + private String address; + + private String contact; + + private String phoneNo1; + + private String phoneNo2; + + private String phoneNo3; + + private String qqAccount; + + private String weChatAccount; + + private String emailAddr; + + private String webSite; + + private String customerSource; + + private String customerSourceDesc; + + private String selfDrivingRoute; + + private String roughlyInfo; + + private String enteredBy; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date enteredDate; + + private String latestUpdatedBy; + + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestUpdatedDate; + + private String recordVersion; + + private String remark; + + private String customerShortName; + + private String manageAudit; +} \ No newline at end of file diff --git a/src/main/java/com/gaotao/modules/customer/entity/CustomerBillingOutData.java b/src/main/java/com/gaotao/modules/customer/entity/CustomerBillingOutData.java new file mode 100644 index 0000000..92fa7e3 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/entity/CustomerBillingOutData.java @@ -0,0 +1,153 @@ +package com.gaotao.modules.customer.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +@TableName(value ="customer_billing_info") +@Data +public class CustomerBillingOutData implements Serializable { + + private static final long serialVersionUID = 1L; + + private int id; //Id + private Integer customerId; //客户Id + + @TableField(exist = false) + private String customerName; //客户名称 + private String billingCompanyName; //开票单位名称 + private String billingCompanyAddr; //开票公司地址 + private String bankName; //银行名称 + private String bankNo; //银行账号 + private String taxNo; //税号 + private String phoneNo; //经手人电话 + private String handMan; //经手人 + private String receiver; //收件人 + private String receiverPhone; //收件人电话 + private String receiverAddr; //收件人地址 + private String enteredBy; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date enteredDate; //录入时间 + private String latestUpdatedBy; + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestUpdatedDate; //最后录入时间 + private String recordVersion; //记录标识号 + private String status; //状态 + private String remark; //备注 + public int getId() { + return id; + } + public void setId(int id) { + this.id = id; + } + public Integer getCustomerId() { + return customerId; + } + public void setCustomerId(Integer customerId) { + this.customerId = customerId; + } + public String getCustomerName() { + return customerName; + } + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + public String getBillingCompanyName() { + return billingCompanyName; + } + public void setBillingCompanyName(String billingCompanyName) { + this.billingCompanyName = billingCompanyName; + } + public String getBillingCompanyAddr() { + return billingCompanyAddr; + } + public void setBillingCompanyAddr(String billingCompanyAddr) { + this.billingCompanyAddr = billingCompanyAddr; + } + public String getBankName() { + return bankName; + } + public void setBankName(String bankName) { + this.bankName = bankName; + } + public String getBankNo() { + return bankNo; + } + public void setBankNo(String bankNo) { + this.bankNo = bankNo; + } + public String getTaxNo() { + return taxNo; + } + public void setTaxNo(String taxNo) { + this.taxNo = taxNo; + } + public String getPhoneNo() { + return phoneNo; + } + public void setPhoneNo(String phoneNo) { + this.phoneNo = phoneNo; + } + public String getHandMan() { + return handMan; + } + public void setHandMan(String handMan) { + this.handMan = handMan; + } + public String getReceiver() { + return receiver; + } + public void setReceiver(String receiver) { + this.receiver = receiver; + } + public String getReceiverPhone() { + return receiverPhone; + } + public void setReceiverPhone(String receiverPhone) { + this.receiverPhone = receiverPhone; + } + public String getReceiverAddr() { + return receiverAddr; + } + public void setReceiverAddr(String receiverAddr) { + this.receiverAddr = receiverAddr; + } + public String getEnteredBy() { + return enteredBy; + } + public void setEnteredBy(String enteredBy) { + this.enteredBy = enteredBy; + } + public String getLatestUpdatedBy() { + return latestUpdatedBy; + } + public void setLatestUpdatedBy(String latestUpdatedBy) { + this.latestUpdatedBy = latestUpdatedBy; + } + public String getRecordVersion() { + return recordVersion; + } + public void setRecordVersion(String recordVersion) { + this.recordVersion = recordVersion; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getRemark() { + return remark; + } + public void setRemark(String remark) { + this.remark = remark; + } + +} diff --git a/src/main/java/com/gaotao/modules/customer/entity/ProjectPersonData.java b/src/main/java/com/gaotao/modules/customer/entity/ProjectPersonData.java new file mode 100644 index 0000000..b9e644d --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/entity/ProjectPersonData.java @@ -0,0 +1,128 @@ +package com.gaotao.modules.customer.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +import java.util.Date; + +@TableName(value = "project_person") +@Data +public class ProjectPersonData { + private int id; //id + private int customerId; //客户编码 + private String personName; //姓名 + private String jobTitle; //职位 + private String phoneNo1; //联系电话 + private String phoneNo2; //联系电话 + private String phoneNo3; //联系电话 + private String emailAddress; //邮箱 + private String remark; //备注 + private String defaultExpress; //默认快递 + private String active; //在用 + private Date enteredDate; //录入时间 + private Date inactiveDate; //停用时间 + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getCustomerId() { + return customerId; + } + + public void setCustomerId(int customerId) { + this.customerId = customerId; + } + + public String getPersonName() { + return personName; + } + + public void setPersonName(String personName) { + this.personName = personName; + } + + public String getJobTitle() { + return jobTitle; + } + + public void setJobTitle(String jobTitle) { + this.jobTitle = jobTitle; + } + + public String getPhoneNo1() { + return phoneNo1; + } + + public void setPhoneNo1(String phoneNo1) { + this.phoneNo1 = phoneNo1; + } + + public String getPhoneNo2() { + return phoneNo2; + } + + public void setPhoneNo2(String phoneNo2) { + this.phoneNo2 = phoneNo2; + } + + public String getPhoneNo3() { + return phoneNo3; + } + + public void setPhoneNo3(String phoneNo3) { + this.phoneNo3 = phoneNo3; + } + + public String getEmailAddress() { + return emailAddress; + } + + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getDefaultExpress() { + return defaultExpress; + } + + public void setDefaultExpress(String defaultExpress) { + this.defaultExpress = defaultExpress; + } + + public String getActive() { + return active; + } + + public void setActive(String active) { + this.active = active; + } + + public Date getEnteredDate() { + return enteredDate; + } + + public void setEnteredDate(Date enteredDate) { + this.enteredDate = enteredDate; + } + + public Date getInactiveDate() { + return inactiveDate; + } + + public void setInactiveDate(Date inactiveDate) { + this.inactiveDate = inactiveDate; + } +} diff --git a/src/main/java/com/gaotao/modules/customer/mapper/CustomerBillingMapper.java b/src/main/java/com/gaotao/modules/customer/mapper/CustomerBillingMapper.java new file mode 100644 index 0000000..2e31cc1 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/mapper/CustomerBillingMapper.java @@ -0,0 +1,22 @@ +package com.gaotao.modules.customer.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gaotao.modules.customer.entity.Customer; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/10 17:02 + * @param: + * @return: + */ +@Mapper +public interface CustomerBillingMapper extends BaseMapper { + + +} diff --git a/src/main/java/com/gaotao/modules/customer/mapper/CustomerMapper.java b/src/main/java/com/gaotao/modules/customer/mapper/CustomerMapper.java new file mode 100644 index 0000000..f448872 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/mapper/CustomerMapper.java @@ -0,0 +1,24 @@ +package com.gaotao.modules.customer.mapper; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.gaotao.modules.customer.entity.Customer; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** +* @author jia +* @description 针对表【customer】的数据库操作Mapper +* @createDate 2025-03-26 19:24:23 +* @Entity com.gaotao.modules.customer.entity.Customer +*/ +@Mapper +public interface CustomerMapper extends BaseMapper { + + IPage findAll(Page customerPage, @Param("query") Customer data); +} + + + + diff --git a/src/main/java/com/gaotao/modules/customer/mapper/ProjectPersonMapper.java b/src/main/java/com/gaotao/modules/customer/mapper/ProjectPersonMapper.java new file mode 100644 index 0000000..83a3e40 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/mapper/ProjectPersonMapper.java @@ -0,0 +1,17 @@ +package com.gaotao.modules.customer.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.gaotao.modules.customer.entity.ProjectPersonData; +import org.apache.ibatis.annotations.Mapper; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/11 17:34 + * @param: + * @return: + */ +@Mapper +public interface ProjectPersonMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/src/main/java/com/gaotao/modules/customer/service/CustomerBillingService.java b/src/main/java/com/gaotao/modules/customer/service/CustomerBillingService.java new file mode 100644 index 0000000..281a16b --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/CustomerBillingService.java @@ -0,0 +1,20 @@ +package com.gaotao.modules.customer.service; +import com.baomidou.mybatisplus.extension.service.IService; + +import com.gaotao.modules.customer.entity.CustomerBillingOutData; + +import java.util.List; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/10 16:59 + * @param: + * @return: + */ +public interface CustomerBillingService extends IService { + + List findBillingById(Integer id); + + void billingSave(CustomerBillingOutData data); +} diff --git a/src/main/java/com/gaotao/modules/customer/service/CustomerService.java b/src/main/java/com/gaotao/modules/customer/service/CustomerService.java new file mode 100644 index 0000000..b0509d8 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/CustomerService.java @@ -0,0 +1,28 @@ +package com.gaotao.modules.customer.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.gaotao.common.utils.PageUtils; +import com.gaotao.modules.customer.entity.Customer; +import com.baomidou.mybatisplus.extension.service.IService; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** +* @author jia +* @description 针对表【customer】的数据库操作Service +* @createDate 2025-03-26 19:24:23 +*/ +public interface CustomerService extends IService { + + + /** + * 查询所有客户信息 + * @param data + * @return + */ + PageUtils findAll(Customer data); + + void customerSave(Customer data); +} diff --git a/src/main/java/com/gaotao/modules/customer/service/ProjectPersonService.java b/src/main/java/com/gaotao/modules/customer/service/ProjectPersonService.java new file mode 100644 index 0000000..4a23432 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/ProjectPersonService.java @@ -0,0 +1,23 @@ +package com.gaotao.modules.customer.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import com.gaotao.modules.customer.entity.ProjectPersonData; + +import java.util.List; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/11 17:31 + * @param: + * @return: + */ +public interface ProjectPersonService extends IService { + + List findPersonById(Integer id); + + void personSave(ProjectPersonData data); + + void updatePersonInactiveById(ProjectPersonData data); +} diff --git a/src/main/java/com/gaotao/modules/customer/service/impl/CustomerBillingServiceImpl.java b/src/main/java/com/gaotao/modules/customer/service/impl/CustomerBillingServiceImpl.java new file mode 100644 index 0000000..68ac1e6 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/impl/CustomerBillingServiceImpl.java @@ -0,0 +1,66 @@ +package com.gaotao.modules.customer.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import com.gaotao.modules.customer.mapper.CustomerBillingMapper; +import com.gaotao.modules.customer.service.CustomerBillingService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.BeanPropertyRowMapper; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/10 17:00 + * @param: + * @return: + */ +@Service +public class CustomerBillingServiceImpl extends ServiceImpl implements CustomerBillingService { + + @Autowired + private NamedParameterJdbcTemplate parameterJdbcTemplate; + + @Override + public List findBillingById(Integer customerId) { + StringBuilder sql = new StringBuilder(); + Map paramMap = new HashMap<>(); + sql.append("select cbi.id, cbi.customer_id, cus.customer_name customerName, "); + sql.append("cbi.billing_company_name, cbi.billing_company_addr,"); + sql.append("cbi.bank_name, cbi.bank_no, cbi.tax_no, cbi.phone_no, cbi.hand_man, cbi.receiver,"); + sql.append("cbi.receiver_phone, cbi.receiver_addr, cbi.entered_by, cbi.entered_date, "); + sql.append("cbi.latest_updated_by, cbi.latest_updated_date, cbi.record_version, cbi.status, cbi.remark"); + sql.append(" from customer_billing_info cbi join customer cus on cbi.customer_id = cus.id"); + if(customerId > 0) { + sql.append(" where cus.id = :id"); + paramMap.put("id", customerId); + } + return parameterJdbcTemplate.query(sql.toString(), paramMap, new BeanPropertyRowMapper<>(CustomerBillingOutData.class)); + } + + @Override + public void billingSave(CustomerBillingOutData data) { + if (data.getId() == 0) { + lambdaQuery().eq(CustomerBillingOutData::getBillingCompanyName, data.getBillingCompanyName()) + .list() + .forEach(item -> { + throw new RuntimeException("公司名称已存在"); + }); + this.save(data); + } else { + lambdaQuery().eq(CustomerBillingOutData::getBillingCompanyName, data.getBillingCompanyName()) + .ne(CustomerBillingOutData::getId, data.getId()) + .list() + .forEach(item -> { + throw new RuntimeException("公司名称已存在"); + }); + this.updateById(data); + } + } +} diff --git a/src/main/java/com/gaotao/modules/customer/service/impl/CustomerServiceImpl.java b/src/main/java/com/gaotao/modules/customer/service/impl/CustomerServiceImpl.java new file mode 100644 index 0000000..d5bf430 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/impl/CustomerServiceImpl.java @@ -0,0 +1,69 @@ +package com.gaotao.modules.customer.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gaotao.common.utils.PageUtils; +import com.gaotao.common.utils.Query; +import com.gaotao.modules.customer.entity.Customer; +import com.gaotao.modules.customer.entity.CustomerBillingOutData; +import com.gaotao.modules.customer.mapper.CustomerMapper; +import com.gaotao.modules.customer.service.CustomerService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.BeanPropertyRowMapper; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** +* @author jia +* @description 针对表【customer】的数据库操作Service实现 +* @createDate 2025-03-26 19:24:23 +*/ +@Service +public class CustomerServiceImpl extends ServiceImpl + implements CustomerService{ + + @Autowired + private CustomerMapper customerMapper; + + @Autowired + private NamedParameterJdbcTemplate parameterJdbcTemplate; + + @Override + public PageUtils findAll(Customer data) { + IPage resultList = this.customerMapper.findAll(new Page(data.getPage(), data.getLimit()), + data); + return new PageUtils(resultList); + } + + @Override + public void customerSave(Customer data) { + if (data.getId() == null || data.getId() == 0) { + lambdaQuery().eq(Customer::getCustomerName, data.getCustomerName()) + .list() + .forEach(item -> { + throw new RuntimeException("客户名称已存在"); + }); + this.save(data); + } else { + lambdaQuery().eq(Customer::getCustomerName, data.getCustomerName()) + .ne(Customer::getId, data.getId()) + .list() + .forEach(item -> { + throw new RuntimeException("客户名称已存在"); + }); + this.updateById(data); + } + } +} + + + + diff --git a/src/main/java/com/gaotao/modules/customer/service/impl/ProjectPersonServiceImpl.java b/src/main/java/com/gaotao/modules/customer/service/impl/ProjectPersonServiceImpl.java new file mode 100644 index 0000000..8fa99d2 --- /dev/null +++ b/src/main/java/com/gaotao/modules/customer/service/impl/ProjectPersonServiceImpl.java @@ -0,0 +1,72 @@ +package com.gaotao.modules.customer.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.gaotao.modules.customer.entity.ProjectPersonData; +import com.gaotao.modules.customer.mapper.ProjectPersonMapper; +import com.gaotao.modules.customer.service.ProjectPersonService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.BeanPropertyRowMapper; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.stereotype.Service; + +import java.util.*; + +/** + * @description: + * @author: jiayang_yue + * @date: 2025/4/11 17:32 + * @param: + * @return: + */ +@Service +public class ProjectPersonServiceImpl extends ServiceImpl implements ProjectPersonService { + + @Autowired + private NamedParameterJdbcTemplate parameterJdbcTemplate; + + @Override + public List findPersonById(Integer customerId) { + StringBuilder sql = new StringBuilder(); + Map paramMap = new HashMap<>(); + sql.append("SELECT id,customer_id,person_name,job_title,phone_no1,phone_no2,phone_no3,email_address,remark, "); + sql.append("default_express,active,entered_date,inactive_date FROM project_person "); + if(customerId > 0) { + sql.append(" where customer_id = :id"); + paramMap.put("id", customerId); + } + sql.append(" ORDER BY default_express DESC"); + return parameterJdbcTemplate.query(sql.toString(), paramMap, new BeanPropertyRowMapper<>(ProjectPersonData.class)); + } + + @Override + public void personSave(ProjectPersonData data) { + if (data.getId() == 0) { + lambdaQuery().eq(ProjectPersonData::getPersonName, data.getPersonName()) + .list() + .forEach(item -> { + throw new RuntimeException("联系人已存在"); + }); + data.setEnteredDate(new Date()); + data.setActive("Y"); + this.save(data); + } else { + lambdaQuery().eq(ProjectPersonData::getPersonName, data.getPersonName()) + .ne(ProjectPersonData::getId, data.getId()) + .list() + .forEach(item -> { + throw new RuntimeException("联系人已存在"); + }); + this.updateById(data); + } + } + + @Override + public void updatePersonInactiveById(ProjectPersonData data) { + lambdaUpdate() + .eq(ProjectPersonData::getId, data.getId()) + .set(ProjectPersonData::getActive, "N") + .set(ProjectPersonData::getInactiveDate, new Date()) + .set(ProjectPersonData::getDefaultExpress, "N") + .update(); + } +} \ No newline at end of file diff --git a/src/main/resources/mapper/customer/CustomerMapper.xml b/src/main/resources/mapper/customer/CustomerMapper.xml new file mode 100644 index 0000000..b17b35b --- /dev/null +++ b/src/main/resources/mapper/customer/CustomerMapper.xml @@ -0,0 +1,16 @@ + + + + + +