售中提成计算,售前推送提成计算,优化修改客户手机号时更改绑定对应的微信用户逻辑
This commit is contained in:
@ -38,6 +38,11 @@ public class SysCommision extends BaseEntity {
|
||||
*/
|
||||
private Long postId;
|
||||
|
||||
/**
|
||||
* 岗位编码code
|
||||
*/
|
||||
private String postCode;
|
||||
|
||||
/**
|
||||
* 业务员
|
||||
*/
|
||||
|
@ -70,4 +70,11 @@ public interface SysWxUserInfoMapper
|
||||
* @return
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(@Param("phone")String phone);
|
||||
|
||||
/**
|
||||
* 根据openid移除对应绑定的cusId
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
public int removeCusIdByOpenId(@Param("openid")String openid);
|
||||
}
|
@ -70,5 +70,12 @@ public interface ISysWxUserInfoService
|
||||
*/
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone);
|
||||
|
||||
/**
|
||||
* 根据openid移除对应绑定的cusId
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
public int removeCusIdByOpenId(String openid);
|
||||
|
||||
|
||||
}
|
@ -198,11 +198,33 @@ public class SysCustomerServiceImpl implements ISysCustomerService {
|
||||
if(newCustomer == null || newCustomer.getId() == null || StringUtils.isEmpty(newCustomer.getPhone())){
|
||||
return;
|
||||
}
|
||||
//先根据cusId查询是否已经绑定过微信用户
|
||||
SysWxUserInfo cusIdWxUserInfo = sysWxUserInfoService.selectSysWxUserInfoByCusId(newCustomer.getId());
|
||||
//根据手机号查询微信用户记录
|
||||
SysWxUserInfo wxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone());
|
||||
if(wxUserInfo != null && (wxUserInfo.getCusId() == null || wxUserInfo.getCusId().longValue() != newCustomer.getId())){
|
||||
wxUserInfo.setCusId(newCustomer.getId());
|
||||
sysWxUserInfoService.updateSysWxUserInfo(wxUserInfo);
|
||||
SysWxUserInfo phoneWxUserInfo = sysWxUserInfoService.getSysWxUserInfoByPhone(newCustomer.getPhone());
|
||||
if(cusIdWxUserInfo != null) {
|
||||
if(phoneWxUserInfo != null){
|
||||
if(!cusIdWxUserInfo.getOpenid().equals(phoneWxUserInfo.getOpenid())){
|
||||
//解绑之前记录
|
||||
sysWxUserInfoService.removeCusIdByOpenId(cusIdWxUserInfo.getOpenid());
|
||||
//更新
|
||||
SysWxUserInfo param = new SysWxUserInfo();
|
||||
param.setOpenid(phoneWxUserInfo.getOpenid());
|
||||
param.setCusId(newCustomer.getId());
|
||||
sysWxUserInfoService.updateSysWxUserInfo(param);
|
||||
}
|
||||
}else{
|
||||
//解绑之前记录
|
||||
sysWxUserInfoService.removeCusIdByOpenId(cusIdWxUserInfo.getOpenid());
|
||||
}
|
||||
}else{
|
||||
if(phoneWxUserInfo != null){
|
||||
//更新
|
||||
SysWxUserInfo param = new SysWxUserInfo();
|
||||
param.setOpenid(phoneWxUserInfo.getOpenid());
|
||||
param.setCusId(newCustomer.getId());
|
||||
sysWxUserInfoService.updateSysWxUserInfo(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -106,4 +106,13 @@ public class SysWxUserInfoServiceImpl implements ISysWxUserInfoService {
|
||||
public SysWxUserInfo getSysWxUserInfoByPhone(String phone){
|
||||
return sysWxUserInfoMapper.getSysWxUserInfoByPhone(phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据openid移除对应绑定的cusId
|
||||
* @param openid
|
||||
* @return
|
||||
*/
|
||||
public int removeCusIdByOpenId(String openid){
|
||||
return sysWxUserInfoMapper.removeCusIdByOpenId(openid);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user