客户回调bug修复

1 parent 2ed49e8b
......@@ -24,6 +24,9 @@ public class WeCustomerList {
//标签名称,使用逗号隔开
private String tagNames;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
// private List<WeFlowerCustomerRel> weFlowerCustomerRels;
......
......@@ -41,6 +41,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
@Autowired
private IWeFlowerCustomerTagRelService weFlowerCustomerTagRelService;
@Autowired
private IWeMaterialService weMaterialService;
@Autowired
......@@ -154,7 +155,8 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
);
});
if(weFlowerCustomerTagRelService.saveOrUpdateBatch(weFlowerCustomerTagRels)){
weFlowerCustomerTagRelService.batchAddOrUpdate(weFlowerCustomerTagRels);
//标签同步到企业微信端
weCustomerClient.makeCustomerLabel(CutomerTagEdit.builder()
.external_userid(externalUserId)
......@@ -162,7 +164,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
.add_tag(weFlowerCustomerTagRels.stream()
.map(WeFlowerCustomerTagRel::getTagId).toArray(String[]::new))
.build());
}
}
......
......@@ -41,6 +41,7 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
@Autowired
private IWeFlowerCustomerTagRelService weFlowerCustomerTagRelService;
@Autowired
private IWeMaterialService weMaterialService;
......@@ -73,7 +74,7 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
);
});
weFlowerCustomerTagRelService.saveOrUpdateBatch(weFlowerCustomerTagRels);
weFlowerCustomerTagRelService.batchAddOrUpdate(weFlowerCustomerTagRels);
}
......
......@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
@Slf4j
@Component("transfer_fail")
public class WeCallbackTransferFailImpl extends WeEventStrategy {
@Autowired
private IWeAllocateCustomerService iWeAllocateCustomerService;
......@@ -31,4 +32,5 @@ public class WeCallbackTransferFailImpl extends WeEventStrategy {
iWeAllocateCustomerService.update(weAllocateCustomer,new LambdaQueryWrapper<WeAllocateCustomer>().eq(WeAllocateCustomer::getTakeoverUserid,userId)
.eq(WeAllocateCustomer::getExternalUserid,externalUserId));
}
}
......@@ -25,10 +25,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -102,7 +99,8 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
//发给客户
if(CollectionUtils.isNotEmpty(customers)){
customers.stream().collect(Collectors.groupingBy(WeCustomer::getUserId)).forEach((k,v)->{
customers.stream().collect(Collectors.groupingBy(WeCustomer::getFirstUserId)).forEach((k,v)->{
customerMessagePushDto.setStaffId(k);
//发送群发消息
......
......@@ -56,11 +56,6 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Autowired
private WeCropTagClient weCropTagClient;
@Autowired
private IWeTagService iWeTagService;
@Autowired
......@@ -331,13 +326,12 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
);
});
if(iWeFlowerCustomerTagRelService.saveBatch(newTagRels)){
iWeFlowerCustomerTagRelService.batchAddOrUpdate(newTagRels);
weCustomerClient.makeCustomerLabel(
cutomerTagEdit
);
}
}else{//为空,取消当前客户所有标签
List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = iWeFlowerCustomerTagRelService.list(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
.eq(WeFlowerCustomerTagRel::getExternalUserid, weMakeCustomerTag.getExternalUserid())
......
......@@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="position" column="position" />
<result property="userName" column="user_name" />
<result property="userId" column="user_id" />
<result property="firstUserId" column="first_user_id"></result>
<result property="isOpenChat" column="is_open_chat" jdbcType="INTEGER" />
</resultMap>
......@@ -32,26 +33,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.unionid,
wc.birthday,
wc.corp_name,
wc.first_user_id,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.status,
wu.user_name,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_userid
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.external_userid = wc.external_userid
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
<where>
<if test="name != null and name !=''">
......@@ -59,21 +50,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="userIds != null and userIds !=''">
<if test="userIds.indexOf(',') != -1">
AND wfcr.user_id in
AND wu.user_id in
<foreach item="item" index="index" collection="userIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="userIds.indexOf(',') == -1">
AND wfcr.user_id=#{userIds}
AND wu.user_id=#{userIds}
</if>
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
AND date_format(wc.first_add_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
AND date_format(wc.first_add_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
<if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1">
......@@ -98,13 +89,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
<if test="status !=null and status !=''">
AND wfcr.status=#{status}
AND wc.del_flag=#{status}
</if>
<if test="isOpenChat !=null ">
AND wc.is_open_chat=#{isOpenChat}
</if>
</where>
ORDER BY wfcr.create_time DESC
ORDER BY wc.first_add_time DESC
</select>
......@@ -199,23 +190,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.status,
wu.user_name,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_userid
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_user wu ON wu.user_id=wc.first_user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.external_userid = wc.external_userid
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
<where>
<if test="name != null and name !=''">
......@@ -223,21 +203,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="userIds != null and userIds !=''">
<if test="userIds.indexOf(',') != -1">
AND wfcr.user_id in
AND wc.user_id in
<foreach item="item" index="index" collection="userIds.split(',')" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="userIds.indexOf(',') == -1">
AND wfcr.user_id=#{userIds}
AND wc.user_id=#{userIds}
</if>
</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
AND date_format(wc.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
AND date_format(wc.create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
<if test="tagIds != null and tagIds !=''">
<if test="tagIds.indexOf(',') != -1">
......@@ -262,13 +242,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</if>
<if test="status !=null and status !=''">
AND wfcr.status=#{status}
AND wc.del_flag=#{status}
</if>
<if test="isOpenChat !=null ">
AND wc.is_open_chat=#{isOpenChat}
</if>
</where>
ORDER BY wfcr.create_time DESC
ORDER BY wc.first_add_time DESC
</select>
......@@ -294,7 +274,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wu.user_name,
wc.first_add_time,
GROUP_CONCAT(wt.`name`) as tagNames,
GROUP_CONCAT(wt.`tag_id`) as tagIds
GROUP_CONCAT(wt.`tag_id`) as tagIds,
wc.birthday
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!