|
|
@ -14,18 +14,18 @@ import com.daqing.framework.domain.crms.CustomerEntity; |
|
|
|
import com.daqing.framework.domain.crms.PersonalCustomerEntity; |
|
|
|
import com.daqing.framework.domain.crms.PersonalCustomerEntity; |
|
|
|
import com.daqing.framework.domain.crms.ext.CrmsConstant; |
|
|
|
import com.daqing.framework.domain.crms.ext.CrmsConstant; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerTO; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerTO; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerVOCompany; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerCompanyVO; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerVOPersonal; |
|
|
|
import com.daqing.framework.domain.crms.ext.CustomerPersonalVO; |
|
|
|
import com.daqing.framework.domain.crms.request.CustomerRequest; |
|
|
|
import com.daqing.framework.domain.crms.request.CustomerRequest; |
|
|
|
import com.daqing.framework.domain.hrms.EmployeeEntity; |
|
|
|
|
|
|
|
import com.daqing.framework.domain.hrms.ext.EmployeeTO; |
|
|
|
import com.daqing.framework.domain.hrms.ext.EmployeeTO; |
|
|
|
import com.daqing.framework.model.response.ResponseResult; |
|
|
|
import com.daqing.framework.model.response.ResponseResult; |
|
|
|
import com.daqing.framework.utils.PageUtils; |
|
|
|
import com.daqing.framework.utils.PageUtils; |
|
|
|
|
|
|
|
import com.daqing.framework.utils.SnowflakeIdUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
|
@ -107,13 +107,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType())) { |
|
|
|
if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType())) { |
|
|
|
PersonalCustomerEntity personalCustomerEntity = personalCustomerDao.queryPersonalCustomerById(id); |
|
|
|
PersonalCustomerEntity personalCustomerEntity = personalCustomerDao.queryPersonalCustomerById(id); |
|
|
|
//封装个人类型客户信息
|
|
|
|
//封装个人类型客户信息
|
|
|
|
CustomerVOPersonal customerVOPersonal = this.setPersonal(customer, name, personalCustomerEntity); |
|
|
|
CustomerPersonalVO customerPersonalVO = this.setPersonal(customer, name, personalCustomerEntity); |
|
|
|
return new ResponseResult<CustomerVOPersonal>().SUCCESS(customerVOPersonal); |
|
|
|
return new ResponseResult<CustomerPersonalVO>().SUCCESS(customerPersonalVO); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); |
|
|
|
CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); |
|
|
|
//封装企业类型客户信息
|
|
|
|
//封装企业类型客户信息
|
|
|
|
CustomerVOCompany customerVOCompany = this.setCompany(customer, name, companyCustomerEntity); |
|
|
|
CustomerCompanyVO customerCompanyVO = this.setCompany(customer, name, companyCustomerEntity); |
|
|
|
return new ResponseResult<CustomerVOCompany>().SUCCESS(customerVOCompany); |
|
|
|
return new ResponseResult<CustomerCompanyVO>().SUCCESS(customerCompanyVO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -136,6 +136,57 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 插入个人类型客户信息 |
|
|
|
|
|
|
|
* @param customerEntity 客户基本信息 |
|
|
|
|
|
|
|
* @param personalCustomerEntity 个人类型信息 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean saveCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity) { |
|
|
|
|
|
|
|
customerEntity.setId(SnowflakeIdUtils.getRandomid()); |
|
|
|
|
|
|
|
//TODO 设置客户编号
|
|
|
|
|
|
|
|
customerEntity.setCode(((int)(Math.random()*100+1))+""); |
|
|
|
|
|
|
|
customerEntity.setCreateTime(new Date()); |
|
|
|
|
|
|
|
customerEntity.setMotifyTime(new Date()); |
|
|
|
|
|
|
|
personalCustomerEntity.setId(SnowflakeIdUtils.getRandomid()); |
|
|
|
|
|
|
|
personalCustomerEntity.setCustomerId(customerEntity.getId()); |
|
|
|
|
|
|
|
return customerDao.saveCustomer(customerEntity) && personalCustomerDao.savePersonalCustomer(personalCustomerEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 插入企业类型客户信息 |
|
|
|
|
|
|
|
* @param customerEntity 客户基本信息 |
|
|
|
|
|
|
|
* @param companyCustomerEntity 企业类型信息 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Transactional |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean saveCustomerCompany(CustomerEntity customerEntity, CompanyCustomerEntity companyCustomerEntity) { |
|
|
|
|
|
|
|
customerEntity.setId(SnowflakeIdUtils.getRandomid()); |
|
|
|
|
|
|
|
//TODO 设置客户编号
|
|
|
|
|
|
|
|
customerEntity.setCode(((int)(Math.random()*100+1))+""); |
|
|
|
|
|
|
|
customerEntity.setCreateTime(new Date()); |
|
|
|
|
|
|
|
customerEntity.setMotifyTime(new Date()); |
|
|
|
|
|
|
|
companyCustomerEntity.setId(SnowflakeIdUtils.getRandomid()); |
|
|
|
|
|
|
|
companyCustomerEntity.setCustomerId(customerEntity.getId()); |
|
|
|
|
|
|
|
return customerDao.saveCustomer(customerEntity) && companyCustomerDao.saveCompanyCustomer(companyCustomerEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 更新个人类型客户信息 |
|
|
|
|
|
|
|
* @param customerEntity 客户基本信息 |
|
|
|
|
|
|
|
* @param personalCustomerEntity 企业类型信息 |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean updateCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity) { |
|
|
|
|
|
|
|
customerEntity.setMotifyTime(new Date()); |
|
|
|
|
|
|
|
personalCustomerEntity.setCustomerId(customerEntity.getId()); |
|
|
|
|
|
|
|
return customerDao.updateCustomer(customerEntity) && personalCustomerDao.updatePersonalCustomer(personalCustomerEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 选择某段时间内客户信息的时间参数校验 |
|
|
|
* 选择某段时间内客户信息的时间参数校验 |
|
|
|
* |
|
|
|
* |
|
|
@ -243,31 +294,31 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
* @param personal 个人类型信息 |
|
|
|
* @param personal 个人类型信息 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private CustomerVOPersonal setPersonal(CustomerEntity customer, String name, PersonalCustomerEntity personal) { |
|
|
|
private CustomerPersonalVO setPersonal(CustomerEntity customer, String name, PersonalCustomerEntity personal) { |
|
|
|
//BeanUtils能批量封装相同字段名称和类型的属性的值
|
|
|
|
//BeanUtils能批量封装相同字段名称和类型的属性的值
|
|
|
|
CustomerVOPersonal customerVOPersonal = new CustomerVOPersonal(); |
|
|
|
CustomerPersonalVO customerPersonalVO = new CustomerPersonalVO(); |
|
|
|
customerVOPersonal.setCode(customer.getCode()); |
|
|
|
customerPersonalVO.setCode(customer.getCode()); |
|
|
|
customerVOPersonal.setType(customer.getType()); |
|
|
|
customerPersonalVO.setType(customer.getType()); |
|
|
|
customerVOPersonal.setManager(name); |
|
|
|
customerPersonalVO.setManager(name); |
|
|
|
customerVOPersonal.setName(customer.getName()); |
|
|
|
customerPersonalVO.setName(customer.getName()); |
|
|
|
customerVOPersonal.setAddress(customer.getAddr()); |
|
|
|
customerPersonalVO.setAddress(customer.getAddr()); |
|
|
|
customerVOPersonal.setPhone(customer.getPhone()); |
|
|
|
customerPersonalVO.setPhone(customer.getPhone()); |
|
|
|
customerVOPersonal.setIdCard(personal.getIdCard()); |
|
|
|
customerPersonalVO.setIdCard(personal.getIdCard()); |
|
|
|
customerVOPersonal.setAge(personal.getAge()); |
|
|
|
customerPersonalVO.setAge(personal.getAge()); |
|
|
|
customerVOPersonal.setGender(personal.getGender()); |
|
|
|
customerPersonalVO.setGender(personal.getGender()); |
|
|
|
customerVOPersonal.setMaritalStatus(personal.getMaritalStatus()); |
|
|
|
customerPersonalVO.setMaritalStatus(personal.getMaritalStatus()); |
|
|
|
customerVOPersonal.setEducation(personal.getEducation()); |
|
|
|
customerPersonalVO.setEducation(personal.getEducation()); |
|
|
|
customerVOPersonal.setEmployer(personal.getEmployer()); |
|
|
|
customerPersonalVO.setEmployer(personal.getEmployer()); |
|
|
|
customerVOPersonal.setPosition(personal.getPosition()); |
|
|
|
customerPersonalVO.setPosition(personal.getPosition()); |
|
|
|
customerVOPersonal.setWorkingYears(personal.getWorkingYears()); |
|
|
|
customerPersonalVO.setWorkingYears(personal.getWorkingYears()); |
|
|
|
customerVOPersonal.setSocialSecurityNum(personal.getSocialSecurityNum()); |
|
|
|
customerPersonalVO.setSocialSecurityNum(personal.getSocialSecurityNum()); |
|
|
|
customerVOPersonal.setLivingSituation(personal.getLivingSituation()); |
|
|
|
customerPersonalVO.setLivingSituation(personal.getLivingSituation()); |
|
|
|
customerVOPersonal.setResidenceAddr(personal.getResidenceAddr()); |
|
|
|
customerPersonalVO.setResidenceAddr(personal.getResidenceAddr()); |
|
|
|
customerVOPersonal.setBusinessSource(personal.getBusinessSource()); |
|
|
|
customerPersonalVO.setBusinessSource(personal.getBusinessSource()); |
|
|
|
customerVOPersonal.setEmergencyLinkman(personal.getEmergencyLinkman()); |
|
|
|
customerPersonalVO.setEmergencyLinkman(personal.getEmergencyLinkman()); |
|
|
|
customerVOPersonal.setEmergencyLinkmanRelationship(personal.getEmergencyLinkmanRelationship()); |
|
|
|
customerPersonalVO.setEmergencyLinkmanRelationship(personal.getEmergencyLinkmanRelationship()); |
|
|
|
customerVOPersonal.setEmergencyLinkmanPhone(personal.getEmergencyLinkmanPhone()); |
|
|
|
customerPersonalVO.setEmergencyLinkmanPhone(personal.getEmergencyLinkmanPhone()); |
|
|
|
return customerVOPersonal; |
|
|
|
return customerPersonalVO; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -278,23 +329,23 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
* @param company 企业类型信息 |
|
|
|
* @param company 企业类型信息 |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private CustomerVOCompany setCompany(CustomerEntity customer, String name, CompanyCustomerEntity company) { |
|
|
|
private CustomerCompanyVO setCompany(CustomerEntity customer, String name, CompanyCustomerEntity company) { |
|
|
|
CustomerVOCompany customerVOCompany = new CustomerVOCompany(); |
|
|
|
CustomerCompanyVO customerCompanyVO = new CustomerCompanyVO(); |
|
|
|
customerVOCompany.setCode(customer.getCode()); |
|
|
|
customerCompanyVO.setCode(customer.getCode()); |
|
|
|
customerVOCompany.setType(customer.getType()); |
|
|
|
customerCompanyVO.setType(customer.getType()); |
|
|
|
customerVOCompany.setManager(name); |
|
|
|
customerCompanyVO.setManager(name); |
|
|
|
customerVOCompany.setName(customer.getName()); |
|
|
|
customerCompanyVO.setName(customer.getName()); |
|
|
|
customerVOCompany.setAddress(customer.getAddr()); |
|
|
|
customerCompanyVO.setAddress(customer.getAddr()); |
|
|
|
customerVOCompany.setPhone(customer.getPhone()); |
|
|
|
customerCompanyVO.setPhone(customer.getPhone()); |
|
|
|
customerVOCompany.setRegisteredCapital(company.getRegisteredCapital()); |
|
|
|
customerCompanyVO.setRegisteredCapital(company.getRegisteredCapital()); |
|
|
|
customerVOCompany.setIndustry(company.getIndustry()); |
|
|
|
customerCompanyVO.setIndustry(company.getIndustry()); |
|
|
|
customerVOCompany.setYears(company.getYears()); |
|
|
|
customerCompanyVO.setYears(company.getYears()); |
|
|
|
customerVOCompany.setRegion(company.getRegion()); |
|
|
|
customerCompanyVO.setRegion(company.getRegion()); |
|
|
|
customerVOCompany.setShareholder(company.getShareholder()); |
|
|
|
customerCompanyVO.setShareholder(company.getShareholder()); |
|
|
|
customerVOCompany.setAffiliatedCompany(company.getAffiliatedCompany()); |
|
|
|
customerCompanyVO.setAffiliatedCompany(company.getAffiliatedCompany()); |
|
|
|
customerVOCompany.setEmployeeNumber(company.getEmpNum()); |
|
|
|
customerCompanyVO.setEmployeeNumber(company.getEmpNum()); |
|
|
|
customerVOCompany.setLinkman(company.getLinkman()); |
|
|
|
customerCompanyVO.setLinkman(company.getLinkman()); |
|
|
|
customerVOCompany.setBusinessSource(company.getBusinessSource()); |
|
|
|
customerCompanyVO.setBusinessSource(company.getBusinessSource()); |
|
|
|
return customerVOCompany; |
|
|
|
return customerCompanyVO; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |