客户体征优化、客户健康修改
This commit is contained in:
@ -19,9 +19,17 @@ public class SysCustomerHealthy extends BaseEntity
|
||||
private Long id;
|
||||
|
||||
/** 客户ID */
|
||||
@Excel(name = "客户ID")
|
||||
//@Excel(name = "客户ID")
|
||||
private Long customerId;
|
||||
|
||||
/** 客户姓名,非持久化字段 */
|
||||
@Excel(name = "客户姓名")
|
||||
private String name;
|
||||
|
||||
/** 客户手机号,非持久化字段 */
|
||||
@Excel(name = "客户手机号")
|
||||
private String phone;
|
||||
|
||||
/** 调理项目id */
|
||||
@Excel(name = "调理项目id")
|
||||
private Long conditioningProjectId;
|
||||
@ -1145,6 +1153,22 @@ public class SysCustomerHealthy extends BaseEntity
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -17,13 +17,21 @@ public class SysCustomerPhysicalSigns extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
/** 体征ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户id */
|
||||
@Excel(name = "客户id")
|
||||
//@Excel(name = "客户id")
|
||||
private Long customerId;
|
||||
|
||||
/** 客户姓名,非持久化字段 */
|
||||
@Excel(name = "客户姓名")
|
||||
private String name;
|
||||
|
||||
/** 客户手机号,非持久化字段 */
|
||||
@Excel(name = "客户手机号")
|
||||
private String phone;
|
||||
|
||||
/** 客户性别 0男 1女 */
|
||||
@Excel(name = "客户性别 0男 1女")
|
||||
private Integer sex;
|
||||
@ -425,6 +433,22 @@ public class SysCustomerPhysicalSigns extends BaseEntity
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
@ -15,9 +15,12 @@ public class CustomerInvestigateRequest extends BaseEntity
|
||||
|
||||
//基础信息
|
||||
|
||||
/** $column.columnComment */
|
||||
/** 体征信息ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户ID */
|
||||
private Long customerId;
|
||||
|
||||
/** 名字 */
|
||||
@Excel(name = "名字")
|
||||
private String name;
|
||||
@ -26,16 +29,7 @@ public class CustomerInvestigateRequest extends BaseEntity
|
||||
@Excel(name = "手机号")
|
||||
private String phone;
|
||||
|
||||
/** 邮箱 */
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
private String address;
|
||||
|
||||
//体征信息
|
||||
|
||||
/** 客户性别 0男 1女 */
|
||||
@Excel(name = "客户性别 0男 1女")
|
||||
private Integer sex;
|
||||
@ -152,42 +146,34 @@ public class CustomerInvestigateRequest extends BaseEntity
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setCustomerId(Long customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 客户健康Mapper接口
|
||||
@ -58,4 +61,10 @@ public interface SysCustomerHealthyMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysCustomerHealthyByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户健康评估信息
|
||||
* @param phone
|
||||
*/
|
||||
SysCustomerHealthy selectSysCustomerHealthyByPhone(@Param("phone") String phone);
|
||||
}
|
@ -67,14 +67,4 @@ public interface SysCustomerMapper
|
||||
* @return 结果
|
||||
*/
|
||||
SysCustomer getCustomerByPhone(@Param("phone")String phone);
|
||||
|
||||
//查询客户基础信息以及体征信息
|
||||
List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
SysCustomer selectSysCustomerAndSignByPhone(String phone);
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -20,14 +22,6 @@ public interface SysCustomerPhysicalSignsMapper
|
||||
*/
|
||||
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询客户体征信息列表
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 客户体征信息
|
||||
* @return 客户体征信息集合
|
||||
*/
|
||||
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
|
||||
|
||||
/**
|
||||
* 新增客户体征信息
|
||||
*
|
||||
@ -60,13 +54,14 @@ public interface SysCustomerPhysicalSignsMapper
|
||||
*/
|
||||
public int deleteSysCustomerPhysicalSignsByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据客户id修改客户体征信息
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 客户体征信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateSysCustomerPhysicalSignsByCustomerId(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
|
||||
|
||||
int deleteSysCustomerPhysicalSignsByCustomerIds(Long[] ids);
|
||||
//查询客户体征信息
|
||||
List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.custom.domain.SysCustomerHealthy;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 客户健康Service接口
|
||||
@ -28,20 +31,12 @@ public interface ISysCustomerHealthyService
|
||||
public List<SysCustomerHealthy> selectSysCustomerHealthyList(SysCustomerHealthy sysCustomerHealthy);
|
||||
|
||||
/**
|
||||
* 新增客户健康
|
||||
* 新增或修改客户健康
|
||||
*
|
||||
* @param sysCustomerHealthy 客户健康
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
|
||||
|
||||
/**
|
||||
* 修改客户健康
|
||||
*
|
||||
* @param sysCustomerHealthy 客户健康
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
|
||||
public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy);
|
||||
|
||||
/**
|
||||
* 批量删除客户健康
|
||||
@ -58,4 +53,10 @@ public interface ISysCustomerHealthyService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysCustomerHealthyById(Long id);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户健康评估信息
|
||||
* @param phone
|
||||
*/
|
||||
SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone);
|
||||
}
|
@ -1,7 +1,11 @@
|
||||
package com.stdiet.custom.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||
|
||||
/**
|
||||
* 客户体征信息Service接口
|
||||
@ -18,14 +22,6 @@ public interface ISysCustomerPhysicalSignsService {
|
||||
*/
|
||||
public SysCustomerPhysicalSigns selectSysCustomerPhysicalSignsById(Long id);
|
||||
|
||||
/**
|
||||
* 查询客户体征信息列表
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 客户体征信息
|
||||
* @return 客户体征信息集合
|
||||
*/
|
||||
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
|
||||
|
||||
/**
|
||||
* 新增客户体征信息
|
||||
*
|
||||
@ -57,4 +53,28 @@ public interface ISysCustomerPhysicalSignsService {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysCustomerPhysicalSignsById(Long id);
|
||||
|
||||
/**
|
||||
* 客户体征资料填写
|
||||
*
|
||||
* @param customerInvestigateRequest 客户建档相关资料
|
||||
* @return 结果
|
||||
*/
|
||||
AjaxResult addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询客户基础信息以及体征信息列表
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 查询条件
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone);
|
||||
|
||||
}
|
@ -67,37 +67,4 @@ public interface ISysCustomerService
|
||||
* @return 结果
|
||||
*/
|
||||
SysCustomer getCustomerByPhone(String phone);
|
||||
|
||||
/**
|
||||
* 客户建档资料填写
|
||||
*
|
||||
* @param customerInvestigateRequest 客户建档相关资料
|
||||
* @return 结果
|
||||
*/
|
||||
int addOrupdateCustomerAndSign( CustomerInvestigateRequest customerInvestigateRequest) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询客户基础信息以及体征信息列表
|
||||
*
|
||||
* @param sysCustomer 查询条件
|
||||
* @return 结果
|
||||
*/
|
||||
List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer);
|
||||
|
||||
/**
|
||||
* 根据id查询客户信息(基础信息以及体征信息)
|
||||
*
|
||||
* @param id 客户id
|
||||
* @return 结果
|
||||
*/
|
||||
SysCustomer getCustomerAndSignById(Long id);
|
||||
|
||||
int delCustomerAndSignById(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
SysCustomer selectSysCustomerAndSignByPhone(String phone);
|
||||
}
|
@ -1,7 +1,12 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.utils.bean.ObjectUtils;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.domain.SysCustomerPhysicalSigns;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysCustomerHealthyMapper;
|
||||
@ -20,6 +25,9 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
@Autowired
|
||||
private SysCustomerHealthyMapper sysCustomerHealthyMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
|
||||
/**
|
||||
* 查询客户健康
|
||||
*
|
||||
@ -51,23 +59,64 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy)
|
||||
public AjaxResult insertOrUpdateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
sysCustomerHealthy.setCreateTime(DateUtils.getNowDate());
|
||||
return sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改客户健康
|
||||
*
|
||||
* @param sysCustomerHealthy 客户健康
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysCustomerHealthy(SysCustomerHealthy sysCustomerHealthy)
|
||||
{
|
||||
sysCustomerHealthy.setUpdateTime(DateUtils.getNowDate());
|
||||
return sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy);
|
||||
//当前登录用户
|
||||
//LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long cutomerId = 0L;
|
||||
//新增
|
||||
if(sysCustomerHealthy.getId() == null){
|
||||
//根据手机号查询客户健康信息,判断是否已存在
|
||||
SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByPhone(sysCustomerHealthy.getPhone());
|
||||
if(customerHealthy != null){
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
//根据手机号查询客户基础信息,判断是否已存在
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(sysCustomerHealthy.getPhone());
|
||||
if(phoneCustomer != null){
|
||||
if(!sysCustomerHealthy.getName().equals(phoneCustomer.getName())){
|
||||
return AjaxResult.error("该手机号与姓名不符");
|
||||
}
|
||||
cutomerId = phoneCustomer.getId();
|
||||
}else{
|
||||
SysCustomer newSysCustomer = new SysCustomer();
|
||||
newSysCustomer.setName(sysCustomerHealthy.getName());
|
||||
newSysCustomer.setPhone(sysCustomerHealthy.getPhone());
|
||||
if(sysCustomerService.insertSysCustomer(newSysCustomer) > 0){
|
||||
cutomerId = newSysCustomer.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新
|
||||
else{
|
||||
SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(sysCustomerHealthy.getCustomerId());
|
||||
//如果修改了手机号,则需要判断手机号是否已经存在
|
||||
if(oldCustomer != null && !oldCustomer.getPhone().equals(sysCustomerHealthy.getPhone())) {
|
||||
//验证该手机号是否已存在客户健康信息
|
||||
SysCustomerHealthy customerHealthy = selectSysCustomerHealthyByPhone(sysCustomerHealthy.getPhone());
|
||||
if (customerHealthy != null) {
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
//根据手机号查询客户基础信息,判断是否已存在
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(sysCustomerHealthy.getPhone());
|
||||
if(phoneCustomer != null) {
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
}
|
||||
SysCustomer newSysCustomer = new SysCustomer();
|
||||
newSysCustomer.setId(sysCustomerHealthy.getCustomerId());
|
||||
newSysCustomer.setName(sysCustomerHealthy.getName());
|
||||
newSysCustomer.setPhone(sysCustomerHealthy.getPhone());
|
||||
if(sysCustomerService.updateSysCustomer(newSysCustomer) > 0){
|
||||
cutomerId = newSysCustomer.getId();
|
||||
}
|
||||
}
|
||||
int rows = 0;
|
||||
if(cutomerId != null && cutomerId > 0){
|
||||
sysCustomerHealthy.setCustomerId(cutomerId);
|
||||
rows = sysCustomerHealthy.getId() == null ? sysCustomerHealthyMapper.insertSysCustomerHealthy(sysCustomerHealthy) : sysCustomerHealthyMapper.updateSysCustomerHealthy(sysCustomerHealthy);
|
||||
}
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -93,4 +142,13 @@ public class SysCustomerHealthyServiceImpl implements ISysCustomerHealthyService
|
||||
{
|
||||
return sysCustomerHealthyMapper.deleteSysCustomerHealthyById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户健康评估信息
|
||||
* @param phone
|
||||
*/
|
||||
@Override
|
||||
public SysCustomerHealthy selectSysCustomerHealthyByPhone(String phone){
|
||||
return sysCustomerHealthyMapper.selectSysCustomerHealthyByPhone(phone);
|
||||
}
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.stdiet.common.core.domain.AjaxResult;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.bean.ObjectUtils;
|
||||
import com.stdiet.custom.domain.SysCustomer;
|
||||
import com.stdiet.custom.dto.request.CustomerInvestigateRequest;
|
||||
import com.stdiet.custom.service.ISysCustomerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
|
||||
@ -20,6 +26,9 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
|
||||
@Autowired
|
||||
private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysCustomerService sysCustomerService;
|
||||
|
||||
/**
|
||||
* 查询客户体征信息
|
||||
*
|
||||
@ -32,18 +41,6 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
|
||||
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户体征信息列表
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 客户体征信息
|
||||
* @return 客户体征信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysCustomerPhysicalSigns> selectSysCustomerPhysicalSignsList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns)
|
||||
{
|
||||
return sysCustomerPhysicalSignsMapper.selectSysCustomerPhysicalSignsList(sysCustomerPhysicalSigns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增客户体征信息
|
||||
*
|
||||
@ -93,4 +90,91 @@ public class SysCustomerPhysicalSignsServiceImpl implements ISysCustomerPhysical
|
||||
{
|
||||
return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户体征资料填写
|
||||
*
|
||||
* @param customerInvestigateRequest 客户体征资料
|
||||
* @return 结果
|
||||
*/
|
||||
public AjaxResult addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception{
|
||||
//当前登录用户
|
||||
//LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long cutomerId = 0L;
|
||||
//新增
|
||||
if(customerInvestigateRequest.getId() == null){
|
||||
//根据手机号查询客户体征信息,判断是否已存在
|
||||
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = selectSysCustomerAndSignByPhone(customerInvestigateRequest.getPhone());
|
||||
if(sysCustomerPhysicalSigns != null){
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
//根据手机号查询客户基础信息,判断是否已存在
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
|
||||
if(phoneCustomer != null){
|
||||
if(!customerInvestigateRequest.getName().equals(phoneCustomer.getName())){
|
||||
return AjaxResult.error("该手机号与姓名不符");
|
||||
}
|
||||
cutomerId = phoneCustomer.getId();
|
||||
}else{
|
||||
SysCustomer newSysCustomer = new SysCustomer();
|
||||
newSysCustomer.setName(customerInvestigateRequest.getName());
|
||||
newSysCustomer.setPhone(customerInvestigateRequest.getPhone());
|
||||
if(sysCustomerService.insertSysCustomer(newSysCustomer) > 0){
|
||||
cutomerId = newSysCustomer.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新
|
||||
else{
|
||||
SysCustomer oldCustomer = sysCustomerService.selectSysCustomerById(customerInvestigateRequest.getCustomerId());
|
||||
//如果修改了手机号,则需要判断手机号是否已经存在
|
||||
if(oldCustomer != null && !oldCustomer.getPhone().equals(customerInvestigateRequest.getPhone())) {
|
||||
//验证该手机号是否已存在客户体征信息
|
||||
SysCustomerPhysicalSigns sysCustomerPhysicalSigns = selectSysCustomerAndSignByPhone(customerInvestigateRequest.getPhone());
|
||||
if (sysCustomerPhysicalSigns != null) {
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
//根据手机号查询客户基础信息,判断是否已存在
|
||||
SysCustomer phoneCustomer = sysCustomerService.getCustomerByPhone(customerInvestigateRequest.getPhone());
|
||||
if(phoneCustomer != null) {
|
||||
return AjaxResult.error("该手机号已存在");
|
||||
}
|
||||
}
|
||||
SysCustomer newSysCustomer = new SysCustomer();
|
||||
newSysCustomer.setId(customerInvestigateRequest.getCustomerId());
|
||||
newSysCustomer.setName(customerInvestigateRequest.getName());
|
||||
newSysCustomer.setPhone(customerInvestigateRequest.getPhone());
|
||||
if(sysCustomerService.updateSysCustomer(newSysCustomer) > 0){
|
||||
cutomerId = newSysCustomer.getId();
|
||||
}
|
||||
}
|
||||
int rows = 0;
|
||||
if(cutomerId != null && cutomerId > 0){
|
||||
SysCustomerPhysicalSigns customerSigns = ObjectUtils.getObjectByObject(customerInvestigateRequest, SysCustomerPhysicalSigns.class);
|
||||
customerSigns.setCustomerId(cutomerId);
|
||||
customerSigns.setId(customerInvestigateRequest.getId());
|
||||
rows = customerInvestigateRequest.getId() == null ? insertSysCustomerPhysicalSigns(customerSigns) : updateSysCustomerPhysicalSigns(customerSigns);
|
||||
}
|
||||
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户基础信息以及体征信息列表
|
||||
*
|
||||
* @param sysCustomerPhysicalSigns 查询条件
|
||||
* @return 结果
|
||||
*/
|
||||
public List<SysCustomerPhysicalSigns> selectSysCustomerAndSignList(SysCustomerPhysicalSigns sysCustomerPhysicalSigns){
|
||||
return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignList(sysCustomerPhysicalSigns);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SysCustomerPhysicalSigns selectSysCustomerAndSignByPhone(String phone){
|
||||
return sysCustomerPhysicalSignsMapper.selectSysCustomerAndSignByPhone(phone);
|
||||
}
|
||||
}
|
@ -115,77 +115,4 @@ public class SysCustomerServiceImpl implements ISysCustomerService
|
||||
public SysCustomer getCustomerByPhone(String phone){
|
||||
return sysCustomerMapper.getCustomerByPhone(phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户建档资料填写
|
||||
*
|
||||
* @param customerInvestigateRequest 客户建档相关资料
|
||||
* @return 结果
|
||||
*/
|
||||
public int addOrupdateCustomerAndSign(CustomerInvestigateRequest customerInvestigateRequest) throws Exception{
|
||||
//当前登录用户
|
||||
//LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysCustomer sysCustomer = new SysCustomer();
|
||||
sysCustomer.setId(customerInvestigateRequest.getId());
|
||||
sysCustomer.setName(customerInvestigateRequest.getName());
|
||||
sysCustomer.setPhone(customerInvestigateRequest.getPhone());
|
||||
//添加人、更新人
|
||||
/*if(loginUser != null){
|
||||
if(customerInvestigateRequest.getId() == null){
|
||||
sysCustomer.setCreateBy(loginUser.getUser().getUserId()+"");
|
||||
}else{
|
||||
sysCustomer.setUpdateBy(loginUser.getUser().getUserId()+"");
|
||||
}
|
||||
}*/
|
||||
//sysCustomer.setEmail(customerInvestigateRequest.getEmail());
|
||||
//sysCustomer.setAddress(customerInvestigateRequest.getAddress());
|
||||
int addOrUpdateRow = customerInvestigateRequest.getId() == null ? insertSysCustomer(sysCustomer) : updateSysCustomer(sysCustomer);
|
||||
if(addOrUpdateRow > 0){
|
||||
SysCustomerPhysicalSigns customerSigns = ObjectUtils.getObjectByObject(customerInvestigateRequest, SysCustomerPhysicalSigns.class);
|
||||
customerSigns.setCustomerId(sysCustomer.getId());
|
||||
customerSigns.setId(null);
|
||||
addOrUpdateRow = customerInvestigateRequest.getId() == null ? sysCustomerPhysicalSignsMapper.insertSysCustomerPhysicalSigns(customerSigns) : sysCustomerPhysicalSignsMapper.updateSysCustomerPhysicalSignsByCustomerId(customerSigns);
|
||||
}
|
||||
return addOrUpdateRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询客户基础信息以及体征信息列表
|
||||
*
|
||||
* @param sysCustomer 查询条件
|
||||
* @return 结果
|
||||
*/
|
||||
public List<SysCustomer> selectSysCustomerAndSignList(SysCustomer sysCustomer){
|
||||
return sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询客户信息(基础信息以及体征信息)
|
||||
*
|
||||
* @param id 客户id
|
||||
* @return 结果
|
||||
*/
|
||||
public SysCustomer getCustomerAndSignById(Long id){
|
||||
SysCustomer sysCustomer = new SysCustomer();
|
||||
sysCustomer.setId(id);
|
||||
List<SysCustomer> list = sysCustomerMapper.selectSysCustomerAndSignList(sysCustomer);
|
||||
return list.size() > 0 ? list.get(0) : null;
|
||||
}
|
||||
|
||||
public int delCustomerAndSignById(Long[] ids){
|
||||
if(deleteSysCustomerByIds(ids) > 0){
|
||||
return sysCustomerPhysicalSignsMapper.deleteSysCustomerPhysicalSignsByCustomerIds(ids);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据手机号查询客户以及体征
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SysCustomer selectSysCustomerAndSignByPhone(String phone){
|
||||
return sysCustomerMapper.selectSysCustomerAndSignByPhone(phone);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user