Commit 226ea8d1 by 15755158258

提交客户离职相关代码

1 parent 8a3fec62
Showing 19 changed files with 921 additions and 82 deletions
...@@ -40,7 +40,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC ...@@ -40,7 +40,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
* *
* @param name * @param name
* @return Object 一个以所给名字注册的bean的实例 * @return Object 一个以所给名字注册的bean的实例
* @throws org.springframework.beans.BeansException * @throws BeansException
* *
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -54,7 +54,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC ...@@ -54,7 +54,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
* *
* @param clz * @param clz
* @return * @return
* @throws org.springframework.beans.BeansException * @throws BeansException
* *
*/ */
public static <T> T getBean(Class<T> clz) throws BeansException public static <T> T getBean(Class<T> clz) throws BeansException
...@@ -79,7 +79,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC ...@@ -79,7 +79,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
* *
* @param name * @param name
* @return boolean * @return boolean
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException * @throws NoSuchBeanDefinitionException
* *
*/ */
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
...@@ -90,7 +90,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC ...@@ -90,7 +90,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
/** /**
* @param name * @param name
* @return Class 注册对象的类型 * @return Class 注册对象的类型
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException * @throws NoSuchBeanDefinitionException
* *
*/ */
public static Class<?> getType(String name) throws NoSuchBeanDefinitionException public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
...@@ -103,7 +103,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC ...@@ -103,7 +103,7 @@ public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationC
* *
* @param name * @param name
* @return * @return
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException * @throws NoSuchBeanDefinitionException
* *
*/ */
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
......
package com.linkwechat.wecom.domain; package com.linkwechat.wecom.domain;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil; import com.linkwechat.common.utils.SnowFlakeUtil;
...@@ -50,20 +52,6 @@ public class WeCustomer extends BaseEntity ...@@ -50,20 +52,6 @@ public class WeCustomer extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
/** 添加人员id */
private String userId;
/** 添加人员名称 */
private String userName;
/** 所在部门名称 */
private String departmentName;
/** 描述 */
private String description;
/** 客户备注的手机号码 */
private String remarkMobiles;
/** 客户企业简称 */ /** 客户企业简称 */
private String corpName; private String corpName;
...@@ -74,9 +62,9 @@ public class WeCustomer extends BaseEntity ...@@ -74,9 +62,9 @@ public class WeCustomer extends BaseEntity
/** 职位 */ /** 职位 */
private String position; private String position;
/** 添加人员 */
List<WeFlowerCustomerRel> weFlowerCustomerRels;
/** 客户来源 */
private String addWay;
......
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.Data;
import java.util.List;
/**
* 具有外部联系人功能企业员工也客户的关系对象 we_flower_customer_rel
*
* @author ruoyi
* @date 2020-09-19
*/
@Data
public class WeFlowerCustomerRel extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id= SnowFlakeUtil.nextId();
/** 添加了此外部联系人的企业成员userid */
private String userId;
/** 该成员对此外部联系人的描述 */
private String description;
/** 该成员对此客户备注的企业名称 */
private String remarkCorpName;
/** 该成员对此客户备注的手机号码 */
private String[] remarkMobiles;
/** 发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid */
private String operUserid;
/** 该成员添加此客户的来源, */
private String addWay;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
private String state;
/** 客户id */
private Long customerId;
/** 微信用户添加的标签 */
private List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels;
}
package com.linkwechat.wecom.domain;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 客户标签关系对象 we_flower_customer_tag_rel
*
* @author ruoyi
* @date 2020-09-19
*/
@Data
public class WeFlowerCustomerTagRel extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 添加客户的企业微信用户 */
private Long flowerCustomerRelId;
/** 标签id */
private Long tagId;
/** 标签名 */
private String tagName;
}
...@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -4,8 +4,10 @@ import cn.hutool.core.collection.CollectionUtil;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.bean.BeanUtils; import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.WeCustomer; import com.linkwechat.wecom.domain.WeCustomer;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
...@@ -70,20 +72,20 @@ public class WeCustomerDto extends WeResultDto{ ...@@ -70,20 +72,20 @@ public class WeCustomerDto extends WeResultDto{
} }
if(CollectionUtil.isNotEmpty(follow_user)){ if(CollectionUtil.isNotEmpty(follow_user)){
WeFollowUserDto weFollowUserDto = follow_user.get(0); List<WeFlowerCustomerRel> weFlowerCustomerRels=new ArrayList<>();
List<WeTagDto> weTagDtos=new ArrayList<>();
weCustomer.setUserId(weFollowUserDto.getUserid()); follow_user.stream().forEach(k->{
weCustomer.setDescription(weFollowUserDto.getDescription()); WeFlowerCustomerRel weFlowerCustomerRel=new WeFlowerCustomerRel();
weCustomer.setRemarkMobiles(StringUtils.join(weFollowUserDto.getRemark_mobiles(),",")); BeanUtils.copyPropertiesignoreOther(k,weFlowerCustomerRel);
// weCustomer.setAddWay(); weFlowerCustomerRels.add(weFlowerCustomerRel);
if(CollectionUtil.isNotEmpty(k.getTags())){
k.getTags().stream().forEach(v->v.setFlower_customer_rel_id(k.getId()));
weTagDtos.addAll(k.getTags());
}
});
} }
return weCustomer; return weCustomer;
} }
......
...@@ -26,7 +26,7 @@ public class WeDepartMentDto extends WeResultDto { ...@@ -26,7 +26,7 @@ public class WeDepartMentDto extends WeResultDto {
public WeDepartMentDto(WeDepartment weDepartment){ public WeDepartMentDto(WeDepartment weDepartment){
WeDepartMentDto.DeartMentDto deartMentDto=new WeDepartMentDto().new DeartMentDto(); DeartMentDto deartMentDto=new WeDepartMentDto().new DeartMentDto();
BeanUtils.copyPropertiesignoreOther(weDepartment,deartMentDto); BeanUtils.copyPropertiesignoreOther(weDepartment,deartMentDto);
department.add(deartMentDto); department.add(deartMentDto);
} }
......
...@@ -12,4 +12,5 @@ public class WeTagDto extends WeResultDto{ ...@@ -12,4 +12,5 @@ public class WeTagDto extends WeResultDto{
private String group_name; private String group_name;
private String tag_name; private String tag_name;
private Integer type; private Integer type;
private Long flower_customer_rel_id;
} }
package com.linkwechat.wecom.mapper;
import java.util.List;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
/**
* 具有外部联系人功能企业员工也客户的关系Mapper接口
*
* @author ruoyi
* @date 2020-09-19
*/
public interface WeFlowerCustomerRelMapper
{
/**
* 查询具有外部联系人功能企业员工也客户的关系
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 具有外部联系人功能企业员工也客户的关系
*/
public WeFlowerCustomerRel selectWeFlowerCustomerRelById(Long id);
/**
* 查询具有外部联系人功能企业员工也客户的关系列表
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 具有外部联系人功能企业员工也客户的关系集合
*/
public List<WeFlowerCustomerRel> selectWeFlowerCustomerRelList(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 新增具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
public int insertWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 修改具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
public int updateWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 删除具有外部联系人功能企业员工也客户的关系
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerRelById(Long id);
/**
* 批量删除具有外部联系人功能企业员工也客户的关系
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeFlowerCustomerRelByIds(Long[] ids);
/**
* 批量插入
* @param WeFlowerCustomerRels
* @return
*/
public int batchInsetWeFlowerCustomerRel(List<WeFlowerCustomerRel> WeFlowerCustomerRels);
}
package com.linkwechat.wecom.mapper;
import java.util.List;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
/**
* 客户标签关系Mapper接口
*
* @author ruoyi
* @date 2020-09-19
*/
public interface WeFlowerCustomerTagRelMapper
{
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
public WeFlowerCustomerTagRel selectWeFlowerCustomerTagRelById(Long id);
/**
* 查询客户标签关系列表
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 客户标签关系集合
*/
public List<WeFlowerCustomerTagRel> selectWeFlowerCustomerTagRelList(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 新增客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
public int insertWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 修改客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
public int updateWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 删除客户标签关系
*
* @param id 客户标签关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerTagRelById(Long id);
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteWeFlowerCustomerTagRelByIds(Long[] ids);
/**
* 批量插入
* @param weFlowerCustomerTagRels
* @return
*/
public int batchInsetWeFlowerCustomerTagRel(List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels);
}
package com.linkwechat.wecom.service;
import java.util.List;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
/**
* 具有外部联系人功能企业员工也客户的关系Service接口
*
* @author ruoyi
* @date 2020-09-19
*/
public interface IWeFlowerCustomerRelService
{
/**
* 查询具有外部联系人功能企业员工也客户的关系
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 具有外部联系人功能企业员工也客户的关系
*/
public WeFlowerCustomerRel selectWeFlowerCustomerRelById(Long id);
/**
* 查询具有外部联系人功能企业员工也客户的关系列表
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 具有外部联系人功能企业员工也客户的关系集合
*/
public List<WeFlowerCustomerRel> selectWeFlowerCustomerRelList(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 新增具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
public int insertWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 修改具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
public int updateWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel);
/**
* 批量删除具有外部联系人功能企业员工也客户的关系
*
* @param ids 需要删除的具有外部联系人功能企业员工也客户的关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerRelByIds(Long[] ids);
/**
* 删除具有外部联系人功能企业员工也客户的关系信息
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerRelById(Long id);
/**
* 批量插入
* @param WeFlowerCustomerRels
* @return
*/
public int batchInsetWeFlowerCustomerRel(List<WeFlowerCustomerRel> WeFlowerCustomerRels);
}
package com.linkwechat.wecom.service;
import java.util.List;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
/**
* 客户标签关系Service接口
*
* @author ruoyi
* @date 2020-09-19
*/
public interface IWeFlowerCustomerTagRelService
{
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
public WeFlowerCustomerTagRel selectWeFlowerCustomerTagRelById(Long id);
/**
* 查询客户标签关系列表
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 客户标签关系集合
*/
public List<WeFlowerCustomerTagRel> selectWeFlowerCustomerTagRelList(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 新增客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
public int insertWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 修改客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
public int updateWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel);
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的客户标签关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerTagRelByIds(Long[] ids);
/**
* 删除客户标签关系信息
*
* @param id 客户标签关系ID
* @return 结果
*/
public int deleteWeFlowerCustomerTagRelById(Long id);
/**
* 批量插入
* @param weFlowerCustomerTagRels
* @return
*/
public int batchInsetWeFlowerCustomerTagRel(List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels);
}
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import java.util.List; import java.util.List;
import com.linkwechat.wecom.domain.WeTag; import com.linkwechat.wecom.domain.WeTag;
import com.linkwechat.wecom.domain.dto.WeTagDto;
/** /**
* 企业微信标签Service接口 * 企业微信标签Service接口
...@@ -58,4 +59,13 @@ public interface IWeTagService ...@@ -58,4 +59,13 @@ public interface IWeTagService
* @return 结果 * @return 结果
*/ */
public int deleteWeTagById(Long id); public int deleteWeTagById(Long id);
/**
* 来自企业微信传输实体添加标签
* @param weTagDto
* @return
*/
public int insertWeTagFromWeTagDto(WeTagDto weTagDto);
} }
...@@ -9,9 +9,12 @@ import com.linkwechat.common.constant.WeConstans; ...@@ -9,9 +9,12 @@ import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.client.WeCustomerClient; import com.linkwechat.wecom.client.WeCustomerClient;
import com.linkwechat.wecom.client.WeUserClient; import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
import com.linkwechat.wecom.domain.dto.WeCustomerDto; import com.linkwechat.wecom.domain.dto.WeCustomerDto;
import com.linkwechat.wecom.domain.dto.WeFollowUserDto; import com.linkwechat.wecom.domain.dto.WeFollowUserDto;
import com.linkwechat.wecom.domain.dto.WeUserDto; import com.linkwechat.wecom.domain.dto.WeUserDto;
import com.linkwechat.wecom.service.IWeFlowerCustomerRelService;
import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService;
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 com.linkwechat.wecom.mapper.WeCustomerMapper; import com.linkwechat.wecom.mapper.WeCustomerMapper;
...@@ -38,6 +41,14 @@ public class WeCustomerServiceImpl implements IWeCustomerService ...@@ -38,6 +41,14 @@ public class WeCustomerServiceImpl implements IWeCustomerService
@Autowired @Autowired
private WeUserClient weUserClient; private WeUserClient weUserClient;
@Autowired
private IWeFlowerCustomerTagRelService iWeFlowerCustomerTagRelService;
@Autowired
private IWeFlowerCustomerRelService iWeFlowerCustomerRelService;
/** /**
* 查询企业微信客户 * 查询企业微信客户
* *
...@@ -143,10 +154,18 @@ public class WeCustomerServiceImpl implements IWeCustomerService ...@@ -143,10 +154,18 @@ public class WeCustomerServiceImpl implements IWeCustomerService
WeCustomer weCustomer WeCustomer weCustomer
= externalContact.transformWeCustomer(); = externalContact.transformWeCustomer();
WeUserDto weUserDto if(null != weCustomer){
= weUserClient.getUserByUserId(weCustomer.getUserId());
if(WeConstans.WE_SUCCESS_CODE.equals(weUserDto.getErrcode())){ this.insertWeCustomer(weCustomer);
weCustomer.setName(weUserDto.getName());
if(CollectionUtil.isNotEmpty(weCustomer.getWeFlowerCustomerRels())){
iWeFlowerCustomerRelService.batchInsetWeFlowerCustomerRel(weCustomer.getWeFlowerCustomerRels());
}
} }
......
package com.linkwechat.wecom.service.impl;
import java.util.List;
import com.linkwechat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeFlowerCustomerRelMapper;
import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
import com.linkwechat.wecom.service.IWeFlowerCustomerRelService;
/**
* 具有外部联系人功能企业员工也客户的关系Service业务层处理
*
* @author ruoyi
* @date 2020-09-19
*/
@Service
public class WeFlowerCustomerRelServiceImpl implements IWeFlowerCustomerRelService
{
@Autowired
private WeFlowerCustomerRelMapper weFlowerCustomerRelMapper;
/**
* 查询具有外部联系人功能企业员工也客户的关系
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 具有外部联系人功能企业员工也客户的关系
*/
@Override
public WeFlowerCustomerRel selectWeFlowerCustomerRelById(Long id)
{
return weFlowerCustomerRelMapper.selectWeFlowerCustomerRelById(id);
}
/**
* 查询具有外部联系人功能企业员工也客户的关系列表
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 具有外部联系人功能企业员工也客户的关系
*/
@Override
public List<WeFlowerCustomerRel> selectWeFlowerCustomerRelList(WeFlowerCustomerRel weFlowerCustomerRel)
{
return weFlowerCustomerRelMapper.selectWeFlowerCustomerRelList(weFlowerCustomerRel);
}
/**
* 新增具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
@Override
public int insertWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel)
{
weFlowerCustomerRel.setCreateTime(DateUtils.getNowDate());
return weFlowerCustomerRelMapper.insertWeFlowerCustomerRel(weFlowerCustomerRel);
}
/**
* 修改具有外部联系人功能企业员工也客户的关系
*
* @param weFlowerCustomerRel 具有外部联系人功能企业员工也客户的关系
* @return 结果
*/
@Override
public int updateWeFlowerCustomerRel(WeFlowerCustomerRel weFlowerCustomerRel)
{
return weFlowerCustomerRelMapper.updateWeFlowerCustomerRel(weFlowerCustomerRel);
}
/**
* 批量删除具有外部联系人功能企业员工也客户的关系
*
* @param ids 需要删除的具有外部联系人功能企业员工也客户的关系ID
* @return 结果
*/
@Override
public int deleteWeFlowerCustomerRelByIds(Long[] ids)
{
return weFlowerCustomerRelMapper.deleteWeFlowerCustomerRelByIds(ids);
}
/**
* 删除具有外部联系人功能企业员工也客户的关系信息
*
* @param id 具有外部联系人功能企业员工也客户的关系ID
* @return 结果
*/
@Override
public int deleteWeFlowerCustomerRelById(Long id)
{
return weFlowerCustomerRelMapper.deleteWeFlowerCustomerRelById(id);
}
/**
* 批量插入
* @param WeFlowerCustomerRels
* @return
*/
@Override
public int batchInsetWeFlowerCustomerRel(List<WeFlowerCustomerRel> WeFlowerCustomerRels) {
return weFlowerCustomerRelMapper.batchInsetWeFlowerCustomerRel(WeFlowerCustomerRels);
}
}
package com.linkwechat.wecom.service.impl;
import java.util.List;
import com.linkwechat.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.linkwechat.wecom.mapper.WeFlowerCustomerTagRelMapper;
import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService;
/**
* 客户标签关系Service业务层处理
*
* @author ruoyi
* @date 2020-09-19
*/
@Service
public class WeFlowerCustomerTagRelServiceImpl implements IWeFlowerCustomerTagRelService
{
@Autowired
private WeFlowerCustomerTagRelMapper weFlowerCustomerTagRelMapper;
/**
* 查询客户标签关系
*
* @param id 客户标签关系ID
* @return 客户标签关系
*/
@Override
public WeFlowerCustomerTagRel selectWeFlowerCustomerTagRelById(Long id)
{
return weFlowerCustomerTagRelMapper.selectWeFlowerCustomerTagRelById(id);
}
/**
* 查询客户标签关系列表
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 客户标签关系
*/
@Override
public List<WeFlowerCustomerTagRel> selectWeFlowerCustomerTagRelList(WeFlowerCustomerTagRel weFlowerCustomerTagRel)
{
return weFlowerCustomerTagRelMapper.selectWeFlowerCustomerTagRelList(weFlowerCustomerTagRel);
}
/**
* 新增客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
@Override
public int insertWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel)
{
weFlowerCustomerTagRel.setCreateTime(DateUtils.getNowDate());
return weFlowerCustomerTagRelMapper.insertWeFlowerCustomerTagRel(weFlowerCustomerTagRel);
}
/**
* 修改客户标签关系
*
* @param weFlowerCustomerTagRel 客户标签关系
* @return 结果
*/
@Override
public int updateWeFlowerCustomerTagRel(WeFlowerCustomerTagRel weFlowerCustomerTagRel)
{
return weFlowerCustomerTagRelMapper.updateWeFlowerCustomerTagRel(weFlowerCustomerTagRel);
}
/**
* 批量删除客户标签关系
*
* @param ids 需要删除的客户标签关系ID
* @return 结果
*/
@Override
public int deleteWeFlowerCustomerTagRelByIds(Long[] ids)
{
return weFlowerCustomerTagRelMapper.deleteWeFlowerCustomerTagRelByIds(ids);
}
/**
* 删除客户标签关系信息
*
* @param id 客户标签关系ID
* @return 结果
*/
@Override
public int deleteWeFlowerCustomerTagRelById(Long id)
{
return weFlowerCustomerTagRelMapper.deleteWeFlowerCustomerTagRelById(id);
}
/**
* 批量插入
* @param weFlowerCustomerTagRels
* @return
*/
@Override
public int batchInsetWeFlowerCustomerTagRel(List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels) {
return weFlowerCustomerTagRelMapper.batchInsetWeFlowerCustomerTagRel(weFlowerCustomerTagRels);
}
}
...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service.impl; ...@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service.impl;
import java.util.List; import java.util.List;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.wecom.domain.dto.WeTagDto;
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 com.linkwechat.wecom.mapper.WeTagMapper; import com.linkwechat.wecom.mapper.WeTagMapper;
...@@ -93,4 +94,24 @@ public class WeTagServiceImpl implements IWeTagService ...@@ -93,4 +94,24 @@ public class WeTagServiceImpl implements IWeTagService
{ {
return weTagMapper.deleteWeTagById(id); return weTagMapper.deleteWeTagById(id);
} }
/**
* 来自weTagDto实体添加标签(该实体为获取客户时相关联系人下的实体)
* @param weTagDto
* @return
*/
@Override
public int insertWeTagFromWeTagDto(WeTagDto weTagDto) {
//查询有无当前标签组,没有则创建一个标签组,同时创建该标签
//查询当前标签组+标签名校验查询当前标签,没有,则创建标签
//之后将标签体转化为关系入库
return 0;
}
} }
...@@ -13,36 +13,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -13,36 +13,82 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="gender" column="gender" /> <result property="gender" column="gender" />
<result property="unionid" column="unionid" /> <result property="unionid" column="unionid" />
<result property="birthday" column="birthday" /> <result property="birthday" column="birthday" />
<result property="userId" column="user_id" /> <result property="corpName" column="corp_name" />
<result property="userName" column="user_name" /> <result property="corpFullName" column="corp_full_name" />
<result property="createTime" column="create_time" /> <result property="position" column="position" />
<result property="departmentName" column="department_name" /> <collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">
<result property="description" column="description" /> <result property="id" column="wfcrId" />
<result property="remarkMobiles" column="remark_mobiles" /> <result property="userId" column="user_id" />
<result property="remarkCorpName" column="remark_corp_name" /> <result property="remark" column="remark" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="remarkCorpName" column="remark_corp_name" />
<result property="remarkMobiles" column="remark_mobiles" />
<result property="operUserid" column="oper_userid" />
<result property="addWay" column="add_way" />
<result property="state" column="state" />
<result property="customerId" column="customer_id" />
<collection property="weFlowerCustomerTagRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerTagRel">
<result property="id" column="tagRelid" />
<result property="flowerCustomerRelId" column="flower_customer_rel_id" />
<result property="tagId" column="tag_id" />
<result property="createTime" column="create_time" />
<result property="tagName" column="tagName"/>
</collection>
</collection>
</resultMap> </resultMap>
<sql id="selectWeCustomerVo"> <sql id="selectWeCustomerVo">
select id, external_userid, name, avatar, type, gender, unionid, birthday, user_id, user_name, create_time, department_name, description, remark_mobiles, remark_corp_name from we_customer select id, external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position from we_customer
</sql> </sql>
<select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult"> <select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult">
<include refid="selectWeCustomerVo"/> SELECT
<where> wc.id,
<if test="externalUserid != null and externalUserid != ''"> and external_userid = #{externalUserid}</if> wc.external_userid,
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> wc.`name`,
<if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if> wc.avatar,
<if test="type != null "> and type = #{type}</if> wc.type,
<if test="gender != null "> and gender = #{gender}</if> wc.gender,
<if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if> wc.unionid,
<if test="birthday != null "> and birthday = #{birthday}</if> wc.birthday,
<if test="userId != null and userId != ''"> and user_id = #{userId}</if> wc.position,
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if> wc.corp_name,
<if test="departmentName != null and departmentName != ''"> and department_name like concat('%', #{departmentName}, '%')</if> wc.corp_full_name,
<if test="description != null and description != ''"> and description = #{description}</if> wfcr.id as wfcrId,
<if test="remarkMobiles != null and remarkMobiles != ''"> and remark_mobiles = #{remarkMobiles}</if> wfcr.user_id,
<if test="remarkCorpName != null and remarkCorpName != ''"> and remark_corp_name like concat('%', #{remarkCorpName}, '%')</if> wfcr.remark,
</where> wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.remark_mobiles,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.customer_id,
wfcrf.id as tagRelid,
wfcrf.flower_customer_rel_id,
wfcrf.tag_id,
wfcrf.create_time,
wt.`name` as tagName
FROM
we_customer wc
INNER JOIN we_flower_customer_rel wfcr ON wc.id = wfcr.customer_id
INNER JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
INNER JOIN we_tag wt ON wt.id = wfcrf.tag_id
<!-- <include refid="selectWeCustomerVo"/>-->
<!-- <where> -->
<!-- <if test="externalUserid != null and externalUserid != ''"> and external_userid = #{externalUserid}</if>-->
<!-- <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>-->
<!-- <if test="avatar != null and avatar != ''"> and avatar = #{avatar}</if>-->
<!-- <if test="type != null "> and type = #{type}</if>-->
<!-- <if test="gender != null "> and gender = #{gender}</if>-->
<!-- <if test="unionid != null and unionid != ''"> and unionid = #{unionid}</if>-->
<!-- <if test="birthday != null "> and birthday = #{birthday}</if>-->
<!-- <if test="corpName != null and corpName != ''"> and corp_name like concat('%', #{corpName}, '%')</if>-->
<!-- <if test="corpFullName != null and corpFullName != ''"> and corp_full_name like concat('%', #{corpFullName}, '%')</if>-->
<!-- <if test="position != null and position != ''"> and position = #{position}</if>-->
<!-- </where>-->
</select> </select>
<select id="selectWeCustomerById" parameterType="Long" resultMap="WeCustomerResult"> <select id="selectWeCustomerById" parameterType="Long" resultMap="WeCustomerResult">
...@@ -61,13 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -61,13 +107,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gender != null">gender,</if> <if test="gender != null">gender,</if>
<if test="unionid != null">unionid,</if> <if test="unionid != null">unionid,</if>
<if test="birthday != null">birthday,</if> <if test="birthday != null">birthday,</if>
<if test="userId != null">user_id,</if> <if test="corpName != null">corp_name,</if>
<if test="userName != null">user_name,</if> <if test="corpFullName != null">corp_full_name,</if>
<if test="createTime != null">create_time,</if> <if test="position != null">position,</if>
<if test="departmentName != null">department_name,</if>
<if test="description != null">description,</if>
<if test="remarkMobiles != null">remark_mobiles,</if>
<if test="remarkCorpName != null">remark_corp_name,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if> <if test="id != null">#{id},</if>
...@@ -78,13 +120,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -78,13 +120,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gender != null">#{gender},</if> <if test="gender != null">#{gender},</if>
<if test="unionid != null">#{unionid},</if> <if test="unionid != null">#{unionid},</if>
<if test="birthday != null">#{birthday},</if> <if test="birthday != null">#{birthday},</if>
<if test="userId != null">#{userId},</if> <if test="corpName != null">#{corpName},</if>
<if test="userName != null">#{userName},</if> <if test="corpFullName != null">#{corpFullName},</if>
<if test="createTime != null">#{createTime},</if> <if test="position != null">#{position},</if>
<if test="departmentName != null">#{departmentName},</if>
<if test="description != null">#{description},</if>
<if test="remarkMobiles != null">#{remarkMobiles},</if>
<if test="remarkCorpName != null">#{remarkCorpName},</if>
</trim> </trim>
</insert> </insert>
...@@ -98,13 +136,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -98,13 +136,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="gender != null">gender = #{gender},</if> <if test="gender != null">gender = #{gender},</if>
<if test="unionid != null">unionid = #{unionid},</if> <if test="unionid != null">unionid = #{unionid},</if>
<if test="birthday != null">birthday = #{birthday},</if> <if test="birthday != null">birthday = #{birthday},</if>
<if test="userId != null">user_id = #{userId},</if> <if test="corpName != null">corp_name = #{corpName},</if>
<if test="userName != null">user_name = #{userName},</if> <if test="corpFullName != null">corp_full_name = #{corpFullName},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="position != null">position = #{position},</if>
<if test="departmentName != null">department_name = #{departmentName},</if>
<if test="description != null">description = #{description},</if>
<if test="remarkMobiles != null">remark_mobiles = #{remarkMobiles},</if>
<if test="remarkCorpName != null">remark_corp_name = #{remarkCorpName},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeFlowerCustomerRelMapper">
<resultMap type="WeFlowerCustomerRel" id="WeFlowerCustomerRelResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="remark" column="remark" />
<result property="description" column="description" />
<result property="createTime" column="create_time" />
<result property="remarkCorpName" column="remark_corp_name" />
<result property="remarkMobiles" column="remark_mobiles" />
<result property="operUserid" column="oper_userid" />
<result property="addWay" column="add_way" />
<result property="state" column="state" />
<result property="customerId" column="customer_id" />
</resultMap>
<sql id="selectWeFlowerCustomerRelVo">
select id, user_id, remark, description, create_time, remark_corp_name, remark_mobiles, oper_userid, add_way, state, customer_id from we_flower_customer_rel
</sql>
<select id="selectWeFlowerCustomerRelList" parameterType="WeFlowerCustomerRel" resultMap="WeFlowerCustomerRelResult">
<include refid="selectWeFlowerCustomerRelVo"/>
<where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="remarkCorpName != null and remarkCorpName != ''"> and remark_corp_name like concat('%', #{remarkCorpName}, '%')</if>
<if test="remarkMobiles != null and remarkMobiles != ''"> and remark_mobiles = #{remarkMobiles}</if>
<if test="operUserid != null and operUserid != ''"> and oper_userid = #{operUserid}</if>
<if test="addWay != null and addWay != ''"> and add_way = #{addWay}</if>
<if test="state != null and state != ''"> and state = #{state}</if>
<if test="customerId != null "> and customer_id = #{customerId}</if>
</where>
</select>
<select id="selectWeFlowerCustomerRelById" parameterType="Long" resultMap="WeFlowerCustomerRelResult">
<include refid="selectWeFlowerCustomerRelVo"/>
where id = #{id}
</select>
<insert id="insertWeFlowerCustomerRel" parameterType="WeFlowerCustomerRel">
insert into we_flower_customer_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="remark != null">remark,</if>
<if test="description != null">description,</if>
<if test="createTime != null">create_time,</if>
<if test="remarkCorpName != null">remark_corp_name,</if>
<if test="remarkMobiles != null">remark_mobiles,</if>
<if test="operUserid != null">oper_userid,</if>
<if test="addWay != null">add_way,</if>
<if test="state != null">state,</if>
<if test="customerId != null">customer_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="remark != null">#{remark},</if>
<if test="description != null">#{description},</if>
<if test="createTime != null">#{createTime},</if>
<if test="remarkCorpName != null">#{remarkCorpName},</if>
<if test="remarkMobiles != null">#{remarkMobiles},</if>
<if test="operUserid != null">#{operUserid},</if>
<if test="addWay != null">#{addWay},</if>
<if test="state != null">#{state},</if>
<if test="customerId != null">#{customerId},</if>
</trim>
</insert>
<update id="updateWeFlowerCustomerRel" parameterType="WeFlowerCustomerRel">
update we_flower_customer_rel
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="description != null">description = #{description},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="remarkCorpName != null">remark_corp_name = #{remarkCorpName},</if>
<if test="remarkMobiles != null">remark_mobiles = #{remarkMobiles},</if>
<if test="operUserid != null">oper_userid = #{operUserid},</if>
<if test="addWay != null">add_way = #{addWay},</if>
<if test="state != null">state = #{state},</if>
<if test="customerId != null">customer_id = #{customerId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeFlowerCustomerRelById" parameterType="Long">
delete from we_flower_customer_rel where id = #{id}
</delete>
<delete id="deleteWeFlowerCustomerRelByIds" parameterType="String">
delete from we_flower_customer_rel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsetWeFlowerCustomerRel" >
insert into we_flower_customer_rel (id, user_id, remark, description, create_time, remark_corp_name, remark_mobiles, oper_userid, add_way, state, customer_id)
values
<foreach collection="list" item="tag" index="index" separator=",">
(#{tag.id},#{tag.userId},#{tag.remark},#{tag.description},#{tag.createTime},#{tag.remarkCorpName},#{tag.remarkMobiles},#{tag.operUserid},#{tag.addWay},#{tag.state},#{tag.customerId})
</foreach>
</insert>
</mapper>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeFlowerCustomerTagRelMapper">
<resultMap type="WeFlowerCustomerTagRel" id="WeFlowerCustomerTagRelResult">
<result property="id" column="id" />
<result property="flowerCustomerRelId" column="flower_customer_rel_id" />
<result property="tagId" column="tag_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWeFlowerCustomerTagRelVo">
select id, flower_customer_rel_id, tag_id, create_time from we_flower_customer_tag_rel
</sql>
<select id="selectWeFlowerCustomerTagRelList" parameterType="WeFlowerCustomerTagRel" resultMap="WeFlowerCustomerTagRelResult">
<include refid="selectWeFlowerCustomerTagRelVo"/>
<where>
<if test="flowerCustomerRelId != null "> and flower_customer_rel_id = #{flowerCustomerRelId}</if>
<if test="tagId != null "> and tag_id = #{tagId}</if>
</where>
</select>
<select id="selectWeFlowerCustomerTagRelById" parameterType="Long" resultMap="WeFlowerCustomerTagRelResult">
<include refid="selectWeFlowerCustomerTagRelVo"/>
where id = #{id}
</select>
<insert id="insertWeFlowerCustomerTagRel" parameterType="WeFlowerCustomerTagRel">
insert into we_flower_customer_tag_rel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="flowerCustomerRelId != null">flower_customer_rel_id,</if>
<if test="tagId != null">tag_id,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="flowerCustomerRelId != null">#{flowerCustomerRelId},</if>
<if test="tagId != null">#{tagId},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWeFlowerCustomerTagRel" parameterType="WeFlowerCustomerTagRel">
update we_flower_customer_tag_rel
<trim prefix="SET" suffixOverrides=",">
<if test="flowerCustomerRelId != null">flower_customer_rel_id = #{flowerCustomerRelId},</if>
<if test="tagId != null">tag_id = #{tagId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWeFlowerCustomerTagRelById" parameterType="Long">
delete from we_flower_customer_tag_rel where id = #{id}
</delete>
<delete id="deleteWeFlowerCustomerTagRelByIds" parameterType="String">
delete from we_flower_customer_tag_rel where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsetWeFlowerCustomerTagRel" >
insert into we_flower_customer_tag_rel (id, flower_customer_rel_id, tag_id, create_time)
values
<foreach collection="list" item="tag" index="index" separator=",">
(#{tag.id},#{tag.flowerCustomerRelId},#{tag.tagId},#{tag.createTime})
</foreach>
</insert>
</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!