Commit f3797a47 by 徐高华

parent 722b42bf
......@@ -9,6 +9,7 @@ public class ChatEventDTO implements Serializable {
*/
private static final long serialVersionUID = -155687993581919178L;
private String changeType;
private String chatId;
private String updateDetail;
private Integer joinScene;
......@@ -16,6 +17,14 @@ public class ChatEventDTO implements Serializable {
private Integer memChangeCnt;
private String corpid;
public String getChangeType() {
return changeType;
}
public void setChangeType(String changeType) {
this.changeType = changeType;
}
public String getChatId() {
return chatId;
}
......
package com.gic.haoban.manage.api.service.chat;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.chat.ChatEventDTO;
public interface GroupChatApiService {
......@@ -12,6 +13,6 @@ public interface GroupChatApiService {
* @param dto
* @throws
*/
public void qwEventNotice(ChatEventDTO dto);
public ServiceResponse<Void> qwEventNotice(ChatEventDTO dto);
}
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.github.pagehelper.Page;
public interface TabHaobanExternalClerkRelatedMapper {
int insertSelective(TabHaobanExternalClerkRelated record);
......@@ -384,5 +385,11 @@ public interface TabHaobanExternalClerkRelatedMapper {
void updateClerkInfo(@Param("staffId")String staffId, @Param("oldClerkId")String oldClerkId, @Param("newClerkId")String newClerkId, @Param("storeId")String storeId);
int updateExternalStatus(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("externalUserid")String externalUserid, @Param("status")int status);
/**
* 通过第三方或者待开发查询是否好友
*/
TabHaobanExternalClerkRelated getMemberForExternalId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("externalUserId") String externalUserId);
}
\ No newline at end of file
......@@ -21,13 +21,17 @@ public interface GroupChatMapper {
public int deleteByPrimaryKey(Long groupChatId);
public int updateByPrimaryKey(TabGroupChat tabHaobanGroupChat);
public int update(TabGroupChat tabHaobanGroupChat);
// 更新群状态
public int updateChatStatus(@Param("groupChatId")Long groupChatId , @Param("chatStatus")int chatStatus) ;
public TabGroupChat selectById(Long groupChatId);
public List<TabGroupChat> listByIdList(@Param("idList")List<String> idList) ;
public TabGroupChat selectByWxChatId(@Param("wxChatId") String wxChatId);
public List<TabGroupChat> listByIdList(@Param("idList") List<String> idList);
public TabGroupChat selectByWxChatId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxChatId") String wxChatId);
public List<TabGroupChat> listAll(TabGroupChat tabHaobanGroupChat);
}
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
......@@ -21,10 +19,11 @@ public interface GroupChatUserMapper {
public int deleteByPrimaryKey(Long chatUserId);
public int updateByPrimaryKey(TabGroupChatUser tabHaobanGroupChatUser);
public int update(TabGroupChatUser tabHaobanGroupChatUser);
public TabGroupChatUser selectById(Long chatUserId);
public TabGroupChatUser selectByUserIdAndChatId(@Param("groupChatId")Long groupChatId , @Param("userId")String userId) ;
public TabGroupChatUser selectByUserIdAndChatId(@Param("groupChatId") Long groupChatId,
@Param("userId") String userId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.chat;
public interface GroupChatService {
// 解散群
public void dismissChat(String corpid, String wxChatId);
// 创建群
public void createChat(String corpid, String wxChatId);
// 更新同步群信息
public void updateChat(String corpid, String wxChatId ,String updateDetail);
// 初始化企业群
public void initEnterpriseGroupChat(String wxEnterpriseId);
}
\ No newline at end of file
......@@ -2,20 +2,40 @@ package com.gic.haoban.manage.service.service.out.impl.chat;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.chat.ChatEventDTO;
import com.gic.haoban.manage.api.service.chat.GroupChatApiService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
@Service("groupChatApiService")
public class GroupChatApiServiceImpl implements GroupChatApiService {
private static final Logger logger = LogManager.getLogger(GroupChatApiService.class);
@Autowired
private GroupChatService groupChatService;
@Override
public void qwEventNotice(ChatEventDTO dto) {
logger.info("群事件,params={}", JSON.toJSONString(dto));
public ServiceResponse<Void> qwEventNotice(ChatEventDTO dto) {
logger.info("收到群事件,params={}", JSON.toJSONString(dto));
String changeType = dto.getChangeType();
String wxChatId = dto.getChatId();
String corpid = dto.getCorpid();
// 群解散事件
if ("dismiss".equals(changeType)) {
this.groupChatService.dismissChat(corpid, wxChatId);
} else if ("create".equals(changeType)) {
// 创建群
this.groupChatService.createChat(corpid, wxChatId);
} else {
String updateDetail = dto.getUpdateDetail();
this.groupChatService.updateChat(corpid, wxChatId, updateDetail);
}
return ServiceResponse.success();
}
}
......@@ -754,5 +754,16 @@
update tab_haoban_external_clerk_related set external_status = #{status} where
external_user_id = #{externalUserid} and wx_enterprise_id = #{wxEnterpriseId}
</update>
<select id="getMemberForExternalId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from tab_haoban_external_clerk_related where wx_enterprise_id = #{wxEnterpriseId}
and self_external_userid = #{externalUserId} and status_flag = 1 and member_id <![CDATA[ <> '' ]]>
union
select <include refid="Base_Column_List"/>
from tab_haoban_external_clerk_related where wx_enterprise_id = #{wxEnterpriseId}
and external_user_id = #{externalUserId} and status_flag = 1 and member_id <![CDATA[ <> '' ]]>
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -105,24 +105,32 @@
<!-- ==================更新 ========== -->
<update id="updateByPrimaryKey"
<update id="update"
parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChat">
<![CDATA[
UPDATE tab_haoban_group_chat SET
group_chat_id=#{groupChatId,jdbcType=BIGINT},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=CHAR},
name=#{name,jdbcType=VARCHAR},
staff_id=#{staffId,jdbcType=CHAR},
chat_add_time=#{chatAddTime,jdbcType=TIMESTAMP},
chat_dissolve_time=#{chatDissolveTime,jdbcType=TIMESTAMP},
chat_notice=#{chatNotice,jdbcType=VARCHAR},
chat_status=#{chatStatus,jdbcType=INTEGER},
update_time=now(),
enterprise_id=#{enterpriseId,jdbcType=CHAR},
status_flag=#{statusFlag,jdbcType=INTEGER}
where group_chat_id = #{groupChatId}
<![CDATA[
UPDATE tab_haoban_group_chat SET
group_chat_id=#{groupChatId,jdbcType=BIGINT},
name=#{name,jdbcType=VARCHAR},
staff_id=#{staffId,jdbcType=CHAR},
chat_add_time=#{chatAddTime,jdbcType=TIMESTAMP},
chat_dissolve_time=#{chatDissolveTime,jdbcType=TIMESTAMP},
chat_notice=#{chatNotice,jdbcType=VARCHAR},
chat_status=#{chatStatus,jdbcType=INTEGER},
update_time=now(),
status_flag=#{statusFlag,jdbcType=INTEGER}
where group_chat_id = #{groupChatId}
]]>
</update>
<update id="updateChatStatus">
update tab_haoban_group_chat set chat_status = #{chatStatus} ,
<if test="chatStatus==4">
and chat_dissolve_time = now()
</if>
update_time =now() where group_chat_id = #{groupChatId}
</update>
<!-- ============ 查询============= -->
<select id="selectById" parameterType="long"
......@@ -132,21 +140,23 @@
FROM tab_haoban_group_chat WHERE group_chat_id = #{groupChatId} and
delete_flag = 0
</select>
<select id="listByIdList" resultMap="result-map-tabHaobanGroupChat">
SELECT
<include refid="Base_Column_List" />
FROM tab_haoban_group_chat WHERE group_chat_id in
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
and delete_flag = 0
FROM tab_haoban_group_chat WHERE group_chat_id in
<foreach collection="idList" item="id" index="index" open="("
close=")" separator=",">
#{id}
</foreach>
and delete_flag = 0
</select>
<select id="selectByWxChatId" resultMap="result-map-tabHaobanGroupChat">
select
<include refid="Base_Column_List" />
FROM tab_haoban_group_chat WHERE wx_chat_id = #{wxChatId} and
wx_enterprise_id = #{wxEnterpriseId}
delete_flag = 0
</select>
......
......@@ -105,12 +105,9 @@
<!-- ==================更新 ========== -->
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChatUser">
<update id="update" parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChatUser">
<![CDATA[
UPDATE tab_haoban_group_chat_user SET
chat_user_id=#{chatUserId,jdbcType=BIGINT},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=CHAR},
enterprise_id=#{enterpriseId,jdbcType=CHAR},
user_type=#{userType,jdbcType=INTEGER},
join_time=#{joinTime,jdbcType=DATE},
user_name=#{userName,jdbcType=VARCHAR},
......@@ -119,7 +116,7 @@
unionid=#{unionid,jdbcType=VARCHAR},
member_id=#{memberId,jdbcType=VARCHAR},
invitor_user_id=#{invitorUserId,jdbcType=VARCHAR},
update_time=#{updateTime,jdbcType=TIMESTAMP},
update_time=now(),
group_chat_id=#{groupChatId,jdbcType=BIGINT},
status_flag=#{statusFlag,jdbcType=INTEGER},
user_quit_time=#{userQuitTime,jdbcType=TIMESTAMP},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment