修复流失客户重新添加bug

1 parent 0245052e
...@@ -14,12 +14,7 @@ import com.linkwechat.wecom.domain.WeFlowerCustomerRel; ...@@ -14,12 +14,7 @@ import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
*/ */
public interface IWeFlowerCustomerRelService extends IService<WeFlowerCustomerRel> public interface IWeFlowerCustomerRelService extends IService<WeFlowerCustomerRel>
{ {
/**
* 删除服务跟进人
* @param userId 企业成员id
* @param externalUserid 用户id
*/
public void deleteFollowUser(String userId, String externalUserid);
/** /**
* 成员添加客户统计 * 成员添加客户统计
......
...@@ -39,35 +39,8 @@ public class WeFlowerCustomerRelServiceImpl extends ServiceImpl<WeFlowerCustomer ...@@ -39,35 +39,8 @@ public class WeFlowerCustomerRelServiceImpl extends ServiceImpl<WeFlowerCustomer
@Autowired @Autowired
WeFlowerCustomerTagRelMapper weFlowerCustomerTagRelMapper; WeFlowerCustomerTagRelMapper weFlowerCustomerTagRelMapper;
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteFollowUser(String userId, String externalUserid) {
//如何是首位添加人删除的客户,直接删除该客户,否则直接删除关系
WeCustomer weCustomer
= iWeCustomerService.getById(externalUserid);
if(weCustomer != null){
if(weCustomer.getFirstUserId().equals(userId)){
//删除客户
iWeCustomerService.removeById(externalUserid);
}
//删除更进关系
this.remove(new LambdaQueryWrapper<WeFlowerCustomerRel>()
.eq(WeFlowerCustomerRel::getExternalUserid,externalUserid)
.eq(WeFlowerCustomerRel::getUserId,userId));
//删除跟进人给客户打的标签
weFlowerCustomerTagRelMapper.delete(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getExternalUserid,externalUserid)
.eq(WeFlowerCustomerTagRel::getUserId,userId));
}
}
@Override @Override
public Map<String, Object> getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel) { public Map<String, Object> getUserAddCustomerStat(WeFlowerCustomerRel weFlowerCustomerRel) {
Map<String, Object> resultMap = new HashMap<>(16); Map<String, Object> resultMap = new HashMap<>(16);
......
package com.linkwechat.wecom.service.impl; package com.linkwechat.wecom.service.impl;
import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
...@@ -10,14 +9,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -10,14 +9,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.QREncode;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.domain.WeCommunityNewGroup; import com.linkwechat.wecom.domain.WeCommunityNewGroup;
import com.linkwechat.wecom.domain.WeGroupCodeActual; import com.linkwechat.wecom.domain.WeGroupCodeActual;
import com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper; import com.linkwechat.wecom.mapper.WeCommunityNewGroupMapper;
import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper; import com.linkwechat.wecom.mapper.WeGroupCodeActualMapper;
import com.linkwechat.wecom.service.IWeGroupCodeActualService; import com.linkwechat.wecom.service.IWeGroupCodeActualService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeGroupCodeMapper; import com.linkwechat.wecom.mapper.WeGroupCodeMapper;
......
...@@ -236,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -236,6 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
address=IF(TRIM(VALUES(address)) != '', VALUES(address), we_customer.address), address=IF(TRIM(VALUES(address)) != '', VALUES(address), we_customer.address),
phone=IF(TRIM(VALUES(phone)) != '', VALUES(phone), we_customer.phone), phone=IF(TRIM(VALUES(phone)) != '', VALUES(phone), we_customer.phone),
add_method=IF(VALUES(add_method), VALUES(add_method), we_customer.add_method), add_method=IF(VALUES(add_method), VALUES(add_method), we_customer.add_method),
del_flag=IFNULL(VALUES(del_flag),we_customer.del_flag),
del_flag=IF(VALUES(del_flag),VALUES(del_flag),we_customer.del_flag), del_flag=IF(VALUES(del_flag),VALUES(del_flag),we_customer.del_flag),
state=IF(TRIM(VALUES(state)) != '',VALUES(state),we_customer.state); state=IF(TRIM(VALUES(state)) != '',VALUES(state),we_customer.state);
</insert> </insert>
......
...@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -88,7 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
user_id=IF(TRIM(VALUES(user_id)) !='', VALUES(user_id), we_flower_customer_tag_rel.user_id), user_id=IF(TRIM(VALUES(user_id)) !='', VALUES(user_id), we_flower_customer_tag_rel.user_id),
external_userid=IF(TRIM(VALUES(external_userid)) !='', VALUES(external_userid), we_flower_customer_tag_rel.external_userid), external_userid=IF(TRIM(VALUES(external_userid)) !='', VALUES(external_userid), we_flower_customer_tag_rel.external_userid),
tag_id=IF(TRIM(VALUES(tag_id)) !='', VALUES(tag_id), we_flower_customer_tag_rel.tag_id), tag_id=IF(TRIM(VALUES(tag_id)) !='', VALUES(tag_id), we_flower_customer_tag_rel.tag_id),
del_flag=IF( VALUES(del_flag), VALUES(del_flag),we_flower_customer_tag_rel.del_flag); del_flag=IFNULL(VALUES(del_flag),we_flower_customer_tag_rel.del_flag);
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!