Commit 47b30c5b by danmo

客户添加是否开启会话存档状态

1 parent d89dfebd
......@@ -75,6 +75,9 @@ public class WeCustomer extends BaseEntity
/** 职位 */
private String position;
/** 是否开启会话存档 0:关闭 1:开启 */
private Integer isOpenChat;
/** 添加人员 */
@TableField(exist = false)
private List<WeFlowerCustomerRel> weFlowerCustomerRels;
......
......@@ -100,6 +100,8 @@ public class WeEventChangeExternalContactImpl implements WeCallBackEventFactory
receiveMapping.setReceiveId(userId);
receiveMapping.setIsCustom(WeConstans.ID_TYPE_USER);
weChatContactMappingService.insertWeChatContactMapping(receiveMapping);
weCustomerService.updateCustomerChatStatus(externalUserId);
}
private void weChatChangeEvent(WxCpXmlMessageVO message) {
......
......@@ -97,4 +97,9 @@ public interface IWeCustomerService extends IService<WeCustomer>
*/
public void sendWelcomeMsg(WeWelcomeMsg weWelcomeMsg);
/**
* 修改客户是否开启会话状态
* @param externalUserId 客户id
*/
public boolean updateCustomerChatStatus(String externalUserId);
}
......@@ -606,5 +606,13 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomerClient.sendWelcomeMsg(weWelcomeMsg);
}
@Override
public boolean updateCustomerChatStatus(String externalUserId) {
WeCustomer weCustomer = new WeCustomer();
weCustomer.setExternalUserid(externalUserId);
weCustomer.setIsOpenChat(1);
return weCustomerMapper.updateWeCustomer(weCustomer) == 1;
}
}
......@@ -17,6 +17,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="isOpenChat" column="is_open_chat" />
<collection property="weFlowerCustomerRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerRel">
<result property="id" column="wfcrId" />
<result property="userId" column="user_id" />
......@@ -46,7 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectWeCustomerVo">
select external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position from we_customer
select external_userid, name, avatar, type, gender, unionid, birthday, corp_name, corp_full_name, position, is_open_chat from we_customer
</sql>
<select id="selectWeCustomerList" parameterType="WeCustomer" resultMap="WeCustomerResult">
......@@ -61,6 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.corp_name,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
......@@ -131,7 +133,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status !=null and status !=''">
AND wfcr.status=#{status}
</if>
<if test="isOpenChat !=null">
AND wc.is_open_chat=#{isOpenChat}
</if>
</where>
ORDER BY wfcr.create_time DESC
</select>
......@@ -179,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="corpName != null">corp_name,</if>
<if test="corpFullName != null">corp_full_name,</if>
<if test="position != null">position,</if>
<if test="isOpenChat != null">is_open_chat</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="externalUserid != null">#{externalUserid},</if>
......@@ -191,6 +196,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="corpName != null">#{corpName},</if>
<if test="corpFullName != null">#{corpFullName},</if>
<if test="position != null">#{position},</if>
<if test="isOpenChat != null">#{isOpenChat}</if>
</trim>
</insert>
......@@ -207,6 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="corpName != null">corp_name = #{corpName},</if>
<if test="corpFullName != null">corp_full_name = #{corpFullName},</if>
<if test="position != null">position = #{position},</if>
<if test="isOpenChat != null">is_open_chat = #{isOpenChat}</if>
</trim>
where external_userid = #{externalUserid}
</update>
......@@ -235,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wc.corp_name,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!