src/main/java/com/nathan/crm/service/CustomerService.java
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.nathan.crm.service;
import com.nathan.base.BaseService;
import com.nathan.crm.dao.CustomerLossMapper;
import com.nathan.crm.dao.CustomerMapper;
import com.nathan.crm.dao.CustomerOrderMapper;
import com.nathan.crm.utils.AssertUtil;
import com.nathan.crm.utils.PhoneUtil;
import com.nathan.crm.vo.Customer;
import com.nathan.crm.vo.CustomerLoss;
import com.nathan.crm.vo.CustomerOrder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Service
public class CustomerService extends BaseService<Customer,Integer> {
@Resource
private CustomerMapper customerMapper;
@Resource
private CustomerOrderMapper customerOrderMapper;
@Resource
private CustomerLossMapper customerLossMapper;
/**
* 添加客户
* 1、参数校验
* 客户名称name 非空,名称唯一
* 客户级别level 非空
* 法人代表fr 非空
* 手机号码 非空,格式正确
* 2、设置参数的默认值
* 是否有效isValid 1
* 创建时间createDate 系统当前时间
* 修改时间updateDate 系统当前时间
* 客户编号khno 系统生成,唯一(uuid|时间戳|年月日时分秒|雪花算法)格式:KH+时间戳
* 3、执行添加操作,判断受影响的行数
* @param customer
*/
@Transactional
public void addCustomer(Customer customer) {
/* 1、参数校验 */
checkCustomerParams(customer.getName(),customer.getLevel(),customer.getFr(),customer.getPhone());
// 判断客户名惟一
Customer cus = customerMapper.selectByName(customer.getName());
AssertUtil.isTrue(null != cus,"客户已存在!");
/* 2、设置默认值 */
customer.setCreateDate(new Date());
customer.setUpdateDate(new Date());
String khno = "KH" + System.currentTimeMillis();
customer.setKhno(khno);
/* 3、执行添加操作 */
后面还有 108 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。