Commit a541fbf5 by linkwechat8856@163.com

Merge branch 'master' into back_end_dev

2 parents d11dc7ea 1f8f5258
......@@ -197,4 +197,7 @@ public class WeCustomer extends BaseEntity {
*/
@TableLogic
private Integer delFlag;
//添加方式
private Integer addMethod;
}
......@@ -21,7 +21,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* @param externalUserId 企业微信客户ID
* @return 企业微信客户
*/
public WeCustomer selectWeCustomerById(String externalUserId);
public WeCustomer selectWeCustomerById(@Param("externalUserId") String externalUserId,@Param("userId") String userId);
/**
* 查询企业微信客户列表
......
......@@ -165,6 +165,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> {
weCustomer.setFirstUserId(followInfo.getUserid());
weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L));
weCustomer.setAddMethod(followInfo.getAdd_way());
weCustomerList.add(weCustomer);
List<String> tags = Stream.of(followInfo.getTag_id()).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(tags)) {
......
......@@ -256,7 +256,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
if (StringUtils.isNotEmpty(resultDto.getDetail_list())) {
for (DetailMessageStatusResultDto detail : resultDto.getDetail_list()) {
WePresTagGroupTaskStatVo statVo = new WePresTagGroupTaskStatVo();
WeCustomer customer = customerMapper.selectWeCustomerById(detail.getExternal_userid());
WeCustomer customer = customerMapper.selectWeCustomerById(detail.getExternal_userid(),detail.getUserid());
statVo.setCustomerName(customer.getName());
statVo.setStatus(detail.getStatus());
statVo.setInGroup(externalIdList.contains(detail.getExternal_userid()));
......
......@@ -323,7 +323,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectWeCustomerById" parameterType="String" resultType="WeCustomer">
<include refid="selectWeCustomerVo"/>
where external_userid = #{externalUserId}
where external_userid = #{externalUserId} and first_user_id=#{userId}
</select>
<insert id="insertWeCustomer" parameterType="WeCustomer">
......@@ -589,12 +589,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qq,
email,
address,
phone
phone,
add_method
) values
<foreach collection="weCustomers" item="item" index="index" separator=",">
(#{item.externalUserid},#{item.name},#{item.avatar},#{item.type},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.corpFullName},#{item.position},#{item.isOpenChat}, #{item.createTime},
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone}
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod}
)
</foreach>
ON DUPLICATE KEY UPDATE
......@@ -613,7 +614,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
qq=IF(we_customer.qq != null, VALUES(qq), we_customer.qq),
email=IF(we_customer.email != null, VALUES(email), we_customer.email),
address=IF(we_customer.address != null, VALUES(address), we_customer.address),
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone);
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone),
add_method=IF(we_customer.add_method != null, VALUES(add_method), we_customer.add_method);
</insert>
......
......@@ -120,20 +120,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getUserAddCustomerStat" parameterType="WeFlowerCustomerRel" resultType="java.util.HashMap">
select
left(wfcr.create_time,10) as createTime , count(1) as total
from
we_flower_customer_rel wfcr
<where>
<if test="userId != null and userId != ''">and wfcr.user_id = #{userId}</if>
<if test="addWay != null and addWay != ''">and wfcr.add_way = #{addWay}</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.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')
</if>
</where>
group by
left(wfcr.create_time,10)
left(wfcr.first_add_time,10) as createTime , count(1) as total
from
we_customer wfcr
<where>
<if test="userId != null and userId != ''">and wfcr.first_user_id = #{userId}</if>
<if test="addWay != null and addWay != ''">and wfcr.add_method = #{addWay}</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wfcr.first_add_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if>
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
AND date_format(wfcr.first_add_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if>
</where>
group by
left(wfcr.first_add_time,10)
</select>
</mapper>
\ 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!