15 changed files with 885 additions and 0 deletions
-
4src/main/java/com/gaotao/common/utils/QueryPage.java
-
158src/main/java/com/gaotao/modules/customer/controller/CustomerController.java
-
85src/main/java/com/gaotao/modules/customer/entity/Customer.java
-
153src/main/java/com/gaotao/modules/customer/entity/CustomerBillingOutData.java
-
128src/main/java/com/gaotao/modules/customer/entity/ProjectPersonData.java
-
22src/main/java/com/gaotao/modules/customer/mapper/CustomerBillingMapper.java
-
24src/main/java/com/gaotao/modules/customer/mapper/CustomerMapper.java
-
17src/main/java/com/gaotao/modules/customer/mapper/ProjectPersonMapper.java
-
20src/main/java/com/gaotao/modules/customer/service/CustomerBillingService.java
-
28src/main/java/com/gaotao/modules/customer/service/CustomerService.java
-
23src/main/java/com/gaotao/modules/customer/service/ProjectPersonService.java
-
66src/main/java/com/gaotao/modules/customer/service/impl/CustomerBillingServiceImpl.java
-
69src/main/java/com/gaotao/modules/customer/service/impl/CustomerServiceImpl.java
-
72src/main/java/com/gaotao/modules/customer/service/impl/ProjectPersonServiceImpl.java
-
16src/main/resources/mapper/customer/CustomerMapper.xml
@ -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<CustomerBillingOutData> 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<ProjectPersonData> 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(); |
|||
} |
|||
|
|||
} |
|||
@ -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; |
|||
} |
|||
@ -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; |
|||
} |
|||
|
|||
} |
|||
@ -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; |
|||
} |
|||
} |
|||
@ -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<CustomerBillingOutData> { |
|||
|
|||
|
|||
} |
|||
@ -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<Customer> { |
|||
|
|||
IPage<Customer> findAll(Page<Customer> customerPage, @Param("query") Customer data); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -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<ProjectPersonData> { |
|||
|
|||
} |
|||
@ -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<CustomerBillingOutData> { |
|||
|
|||
List<CustomerBillingOutData> findBillingById(Integer id); |
|||
|
|||
void billingSave(CustomerBillingOutData data); |
|||
} |
|||
@ -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<Customer> { |
|||
|
|||
|
|||
/** |
|||
* 查询所有客户信息 |
|||
* @param data |
|||
* @return |
|||
*/ |
|||
PageUtils findAll(Customer data); |
|||
|
|||
void customerSave(Customer data); |
|||
} |
|||
@ -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<ProjectPersonData> { |
|||
|
|||
List<ProjectPersonData> findPersonById(Integer id); |
|||
|
|||
void personSave(ProjectPersonData data); |
|||
|
|||
void updatePersonInactiveById(ProjectPersonData data); |
|||
} |
|||
@ -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<CustomerBillingMapper, CustomerBillingOutData> implements CustomerBillingService { |
|||
|
|||
@Autowired |
|||
private NamedParameterJdbcTemplate parameterJdbcTemplate; |
|||
|
|||
@Override |
|||
public List<CustomerBillingOutData> findBillingById(Integer customerId) { |
|||
StringBuilder sql = new StringBuilder(); |
|||
Map<String,Object> 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); |
|||
} |
|||
} |
|||
} |
|||
@ -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<CustomerMapper, Customer> |
|||
implements CustomerService{ |
|||
|
|||
@Autowired |
|||
private CustomerMapper customerMapper; |
|||
|
|||
@Autowired |
|||
private NamedParameterJdbcTemplate parameterJdbcTemplate; |
|||
|
|||
@Override |
|||
public PageUtils findAll(Customer data) { |
|||
IPage<Customer> resultList = this.customerMapper.findAll(new Page<Customer>(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); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -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<ProjectPersonMapper, ProjectPersonData> implements ProjectPersonService { |
|||
|
|||
@Autowired |
|||
private NamedParameterJdbcTemplate parameterJdbcTemplate; |
|||
|
|||
@Override |
|||
public List<ProjectPersonData> findPersonById(Integer customerId) { |
|||
StringBuilder sql = new StringBuilder(); |
|||
Map<String,Object> 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(); |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper |
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.gaotao.modules.customer.mapper.CustomerMapper"> |
|||
|
|||
<select id="findAll" resultType="com.gaotao.modules.customer.entity.Customer"> |
|||
SELECT * FROM customer |
|||
<where> |
|||
<if test="query.customerName != null and query.customerName != ''"> |
|||
customer_name like '%' + #{query.customerName} + '%' |
|||
</if> |
|||
</where> |
|||
order by entered_date desc |
|||
</select> |
|||
</mapper> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue