客户相关bug修复

1 parent e496c45c
...@@ -83,10 +83,10 @@ ...@@ -83,10 +83,10 @@
<dependency> <!-- <dependency>-->
<groupId>io.github.leejoker</groupId> <!-- <groupId>io.github.leejoker</groupId>-->
<artifactId>linkwechat-nacos-starter</artifactId> <!-- <artifactId>linkwechat-nacos-starter</artifactId>-->
</dependency> <!-- </dependency>-->
......
linkwechat.nacos.host=
linkwechat.nacos.port=
linkwechat.nacos.namespace=
linkwechat.nacos.username=
linkwechat.nacos.password=
\ No newline at end of file \ No newline at end of file
linkwechat.nacos.host=119.45.28.29
linkwechat.nacos.port=10848
linkwechat.nacos.namespace=01cf833f-249e-4483-a286-46d37f018fe7
linkwechat.nacos.username=prod
linkwechat.nacos.password=prod@admin123
package com.linkwechat.common.enums;
public enum TrackState {
//跟踪状态 1:待跟进;2:跟进中;3:已成交;4:无意向;5:已流失
STATE_DGJ(1,"待跟进"),
STATE_GJZ(2,"跟进中"),
STATE_JCJ(3,"已成交"),
STATE_WYX(4,"无意向"),
STATE_YLS(5,"已流失");
private String name;
private Integer type;
TrackState(Integer type,String name){
this.name=name;
this.type=type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
}
...@@ -122,7 +122,7 @@ public class WeCustomerDetail { ...@@ -122,7 +122,7 @@ public class WeCustomerDetail {
public static class CompanyOrPersonTag{ public static class CompanyOrPersonTag{
private String userName; private String userName;
private String tagsNames; private String tagNames;
private String tagIds; private String tagIds;
......
...@@ -45,7 +45,7 @@ public class WeCustomerList { ...@@ -45,7 +45,7 @@ public class WeCustomerList {
//跟进人id //跟进人id
private String firstUserId; private String firstUserId;
//跟踪状态 //跟踪状态 1:待跟进;2:跟进中;3:已成交;4:无意向;5:已流失
private Integer trackState; private Integer trackState;
//添加方式 //添加方式
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity; import com.linkwechat.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
...@@ -62,5 +63,12 @@ public class WeCustomerTrajectory extends BaseEntity { ...@@ -62,5 +63,12 @@ public class WeCustomerTrajectory extends BaseEntity {
private String trackContent; private String trackContent;
//跟进时间 //跟进时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date trackTime; private Date trackTime;
//是否来自同步:1是;0否
private Boolean isSynch;
//标题
private String title;
} }
...@@ -5,5 +5,7 @@ import com.linkwechat.wecom.domain.WeCustomerTrajectory; ...@@ -5,5 +5,7 @@ import com.linkwechat.wecom.domain.WeCustomerTrajectory;
public interface WeCustomerTrajectoryMapper extends BaseMapper<WeCustomerTrajectory> { public interface WeCustomerTrajectoryMapper extends BaseMapper<WeCustomerTrajectory> {
void deleteSynchTrajectory();
} }
...@@ -10,4 +10,7 @@ public interface IWeCustomerTrajectoryService extends IService<WeCustomerTraject ...@@ -10,4 +10,7 @@ public interface IWeCustomerTrajectoryService extends IService<WeCustomerTraject
void inforMationNews(String userId,String externalUserid,Integer trajectoryType); void inforMationNews(String userId,String externalUserid,Integer trajectoryType);
void deleteSynchTrajectory();
} }
...@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; ...@@ -7,9 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.enums.AllocateCustomerStatus; import com.linkwechat.common.enums.*;
import com.linkwechat.common.enums.TrajectorySceneType;
import com.linkwechat.common.enums.WeExceptionTip;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.DateUtils; import com.linkwechat.common.utils.DateUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
...@@ -145,6 +143,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -145,6 +143,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = new ArrayList<>(); List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = new ArrayList<>();
List<WeCustomerTrajectory> trajectories=new ArrayList<>();
list.forEach(userDetail -> { list.forEach(userDetail -> {
//客户入库 //客户入库
...@@ -154,6 +153,19 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -154,6 +153,19 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomer.setCustomerName(userDetail.getExternal_contact().getName()); weCustomer.setCustomerName(userDetail.getExternal_contact().getName());
weCustomer.setDelFlag(new Integer(0)); weCustomer.setDelFlag(new Integer(0));
Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> { Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> {
trajectories.add(
WeCustomerTrajectory.builder()
.trajectoryType(TrajectoryType.TRAJECTORY_TYPE_DBDT.getType())
.externalUserid(weCustomer.getExternalUserid())
.trackState(TrackState.STATE_DGJ.getType())
.isSynch(false)
.content("待跟进状态")
.title("同步客户设置跟进状态")
.trackTime(new Date(followInfo.getCreatetime() * 1000L))
.userId(followInfo.getUserid())
.build()
);
weCustomer.setFirstUserId(followInfo.getUserid()); weCustomer.setFirstUserId(followInfo.getUserid());
weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L)); weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L));
...@@ -167,6 +179,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -167,6 +179,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
.userId(followInfo.getUserid()) .userId(followInfo.getUserid())
.externalUserid(weCustomer.getExternalUserid()) .externalUserid(weCustomer.getExternalUserid())
.tagId(tag) .tagId(tag)
.delFlag(new Integer(0))
.isCompanyTag(true)
.build() .build()
); );
}); });
...@@ -175,6 +189,17 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -175,6 +189,17 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
}); });
if(CollectionUtil.isNotEmpty(trajectories)){
iWeCustomerTrajectoryService.deleteSynchTrajectory();
List<List<WeCustomerTrajectory>> traJectorys = Lists.partition(trajectories, 500);
for(List<WeCustomerTrajectory> traJectory: traJectorys){
//清空状态为等待跟进的数据
iWeCustomerTrajectoryService.saveBatch(traJectory);
}
}
if (CollectionUtil.isNotEmpty(weFlowerCustomerTagRels)) { if (CollectionUtil.isNotEmpty(weFlowerCustomerTagRels)) {
List<List<WeFlowerCustomerTagRel>> tagRels = Lists.partition(weFlowerCustomerTagRels, 500); List<List<WeFlowerCustomerTagRel>> tagRels = Lists.partition(weFlowerCustomerTagRels, 500);
for (List<WeFlowerCustomerTagRel> tagRelss : tagRels) { for (List<WeFlowerCustomerTagRel> tagRelss : tagRels) {
...@@ -722,6 +747,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -722,6 +747,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
.userName(k.getUserName()) .userName(k.getUserName())
.addMethod(k.getAddMethod()) .addMethod(k.getAddMethod())
.trackState(k.getTrackState()) .trackState(k.getTrackState())
.trackUserId(k.getFirstUserId())
.firstAddTime(k.getFirstAddTime()) .firstAddTime(k.getFirstAddTime())
.build() .build()
); );
...@@ -730,7 +756,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -730,7 +756,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
companyTags.add( companyTags.add(
WeCustomerDetail.CompanyOrPersonTag.builder() WeCustomerDetail.CompanyOrPersonTag.builder()
.tagIds(k.getTagIds()) .tagIds(k.getTagIds())
.tagsNames(k.getTagNames()) .tagNames(k.getTagNames())
.userName(k.getUserName()) .userName(k.getUserName())
.build() .build()
); );
...@@ -741,7 +767,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto ...@@ -741,7 +767,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
personTags.add( personTags.add(
WeCustomerDetail.CompanyOrPersonTag.builder() WeCustomerDetail.CompanyOrPersonTag.builder()
.tagIds(k.getPersonTagIds()) .tagIds(k.getPersonTagIds())
.tagsNames(k.getPersonTagNames()) .tagNames(k.getPersonTagNames())
.userName(k.getUserName()) .userName(k.getUserName())
.build() .build()
); );
......
...@@ -108,5 +108,10 @@ public class WeCustomerTrajectoryServiceImpl extends ServiceImpl<WeCustomerTraje ...@@ -108,5 +108,10 @@ public class WeCustomerTrajectoryServiceImpl extends ServiceImpl<WeCustomerTraje
} }
} }
@Override
public void deleteSynchTrajectory() {
this.baseMapper.deleteSynchTrajectory();
}
} }
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeCustomerTrajectoryMapper"> <mapper namespace="com.linkwechat.wecom.mapper.WeCustomerTrajectoryMapper">
<delete id="deleteSynchTrajectory">
DELETE FROM we_customer_trajectory where is_synch=true
</delete>
</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!