Commit c83407ff by sunxiwang

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

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