Commit f3797a47 by 徐高华

parent 722b42bf
...@@ -9,6 +9,7 @@ public class ChatEventDTO implements Serializable { ...@@ -9,6 +9,7 @@ public class ChatEventDTO implements Serializable {
*/ */
private static final long serialVersionUID = -155687993581919178L; private static final long serialVersionUID = -155687993581919178L;
private String changeType;
private String chatId; private String chatId;
private String updateDetail; private String updateDetail;
private Integer joinScene; private Integer joinScene;
...@@ -16,6 +17,14 @@ public class ChatEventDTO implements Serializable { ...@@ -16,6 +17,14 @@ public class ChatEventDTO implements Serializable {
private Integer memChangeCnt; private Integer memChangeCnt;
private String corpid; private String corpid;
public String getChangeType() {
return changeType;
}
public void setChangeType(String changeType) {
this.changeType = changeType;
}
public String getChatId() { public String getChatId() {
return chatId; return chatId;
} }
......
package com.gic.haoban.manage.api.service.chat; package com.gic.haoban.manage.api.service.chat;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.chat.ChatEventDTO; import com.gic.haoban.manage.api.dto.chat.ChatEventDTO;
public interface GroupChatApiService { public interface GroupChatApiService {
...@@ -12,6 +13,6 @@ public interface GroupChatApiService { ...@@ -12,6 +13,6 @@ public interface GroupChatApiService {
* @param dto * @param dto
* @throws * @throws
*/ */
public void qwEventNotice(ChatEventDTO dto); public ServiceResponse<Void> qwEventNotice(ChatEventDTO dto);
} }
package com.gic.haoban.manage.service.dao.mapper; 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.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; 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 { public interface TabHaobanExternalClerkRelatedMapper {
int insertSelective(TabHaobanExternalClerkRelated record); int insertSelective(TabHaobanExternalClerkRelated record);
...@@ -385,4 +386,10 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -385,4 +386,10 @@ public interface TabHaobanExternalClerkRelatedMapper {
int updateExternalStatus(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("externalUserid")String externalUserid, @Param("status")int status); 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 { ...@@ -21,13 +21,17 @@ public interface GroupChatMapper {
public int deleteByPrimaryKey(Long groupChatId); 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 TabGroupChat selectById(Long groupChatId);
public List<TabGroupChat> listByIdList(@Param("idList")List<String> idList) ; public List<TabGroupChat> listByIdList(@Param("idList") List<String> idList);
public TabGroupChat selectByWxChatId(@Param("wxChatId") String wxChatId); public TabGroupChat selectByWxChatId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxChatId") String wxChatId);
public List<TabGroupChat> listAll(TabGroupChat tabHaobanGroupChat); public List<TabGroupChat> listAll(TabGroupChat tabHaobanGroupChat);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper.chat; package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser; import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
...@@ -21,10 +19,11 @@ public interface GroupChatUserMapper { ...@@ -21,10 +19,11 @@ public interface GroupChatUserMapper {
public int deleteByPrimaryKey(Long chatUserId); public int deleteByPrimaryKey(Long chatUserId);
public int updateByPrimaryKey(TabGroupChatUser tabHaobanGroupChatUser); public int update(TabGroupChatUser tabHaobanGroupChatUser);
public TabGroupChatUser selectById(Long chatUserId); 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
...@@ -2,7 +2,15 @@ package com.gic.haoban.manage.service.service.chat; ...@@ -2,7 +2,15 @@ package com.gic.haoban.manage.service.service.chat;
public interface GroupChatService { 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
...@@ -19,13 +19,14 @@ import com.gic.haoban.manage.api.dto.SecretSettingDTO; ...@@ -19,13 +19,14 @@ import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanExternalClerkRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatMapper; import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatUserMapper; import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatUserMapper;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.chat.TabGroupChat; import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser; import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.SecretSettingService; import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatService; import com.gic.haoban.manage.service.service.chat.GroupChatService;
...@@ -37,7 +38,7 @@ import com.gic.wechat.api.dto.qywx.chat.GroupChatListDTO; ...@@ -37,7 +38,7 @@ import com.gic.wechat.api.dto.qywx.chat.GroupChatListDTO;
import com.gic.wechat.api.dto.qywx.chat.GroupChatListItemDTO; import com.gic.wechat.api.dto.qywx.chat.GroupChatListItemDTO;
import com.gic.wechat.api.service.qywx.QywxChatApiService; import com.gic.wechat.api.service.qywx.QywxChatApiService;
@Service @Service("groupChatService")
public class GroupChatServiceImpl implements GroupChatService { public class GroupChatServiceImpl implements GroupChatService {
private static final Logger logger = LoggerFactory.getLogger(GroupChatService.class); private static final Logger logger = LoggerFactory.getLogger(GroupChatService.class);
...@@ -53,13 +54,64 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -53,13 +54,64 @@ public class GroupChatServiceImpl implements GroupChatService {
@Autowired @Autowired
private MemberService memberService; private MemberService memberService;
@Autowired @Autowired
private ExternalClerkRelatedService externalClerkRelatedService; private TabHaobanExternalClerkRelatedMapper externalClerkRelatedMapper;
@Autowired @Autowired
private StaffMapper staffMapper; private StaffMapper staffMapper;
@Autowired @Autowired
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
public void initGroupChat(String wxEnterpriseId) { @Override
public void createChat(String corpid, String wxChatId) {
String wxEnterpriseId = this.getWxEnterpriesId(corpid);
if (null == wxEnterpriseId) {
return;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
this.insertGroupChat(qwDTO, wxChatId, 0, false);
}
@Override
public void dismissChat(String corpid, String wxChatId) {
String wxEnterpriseId = this.getWxEnterpriesId(corpid);
if (null == wxEnterpriseId) {
return;
}
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId(wxEnterpriseId, wxChatId);
if (null == groupChat) {
logger.info("群查不到,wxChatid={}", wxChatId);
return;
}
this.groupChatMapper.updateChatStatus(groupChat.getGroupChatId(), 4);
}
@Override
public void updateChat(String corpid, String wxChatId, String updateDetail) {
String wxEnterpriseId = this.getWxEnterpriesId(corpid);
if (null == wxEnterpriseId) {
return;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) {
logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId);
return;
}
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId(qwDTO.getWxEnterpriseId(), wxChatId);
// change_name=群名变更change_notice=群公告变更
if ("change_name".equals(updateDetail) || "change_notice".equals(updateDetail)) {
this.initGroupChatDetail(qwDTO, groupChat, false);
}
// change_owner=群主变更
if ("change_owner".equals(updateDetail)) {
}
// add_member=成员入群 del_member=成员退群
if ("add_member".equals(updateDetail) || "del_member".equals(updateDetail)) {
}
}
@Override
public void initEnterpriseGroupChat(String wxEnterpriseId) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) { if (null == qwDTO) {
logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId); logger.info("wxEnterpriseId不存在,id={}", wxEnterpriseId);
...@@ -83,13 +135,14 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -83,13 +135,14 @@ public class GroupChatServiceImpl implements GroupChatService {
.map(dto -> dto.getWxUserId()).collect(Collectors.toList()); .map(dto -> dto.getWxUserId()).collect(Collectors.toList());
} }
if (CollectionUtils.isNotEmpty(userIdList)) { if (CollectionUtils.isNotEmpty(userIdList)) {
this.saveGroupChat(qwDTO, userIdList, null); this.syncGroupChat(qwDTO, userIdList, null);
} }
pageNum++; pageNum++;
} }
} }
public void saveGroupChat(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor) { // 同步成员的群
private void syncGroupChat(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor) {
logger.info("qwDTO={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor); logger.info("qwDTO={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
int limit = 1; int limit = 1;
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(),
...@@ -109,7 +162,17 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -109,7 +162,17 @@ public class GroupChatServiceImpl implements GroupChatService {
List<GroupChatListItemDTO> list = dto.getGroup_chat_list(); List<GroupChatListItemDTO> list = dto.getGroup_chat_list();
for (GroupChatListItemDTO item : list) { for (GroupChatListItemDTO item : list) {
String wxChatId = item.getChat_id(); String wxChatId = item.getChat_id();
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId(wxChatId); int chatStatus = item.getStatus();
this.insertGroupChat(qwDTO, wxChatId, chatStatus, true);
}
if (org.apache.commons.lang3.StringUtils.isNotBlank(cursor)) {
this.syncGroupChat(qwDTO, userIdList, cursor);
}
}
// 新增群记录
private void insertGroupChat(WxEnterpriseQwDTO qwDTO, String wxChatId, int chatStatus, boolean syncDetailFlag) {
TabGroupChat groupChat = this.groupChatMapper.selectByWxChatId(qwDTO.getWxEnterpriseId(), wxChatId);
Long groupChatId = null; Long groupChatId = null;
if (null != groupChat) { if (null != groupChat) {
groupChatId = groupChat.getGroupChatId(); groupChatId = groupChat.getGroupChatId();
...@@ -120,7 +183,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -120,7 +183,7 @@ public class GroupChatServiceImpl implements GroupChatService {
chat.setGroupChatId(groupChatId); chat.setGroupChatId(groupChatId);
chat.setWxEnterpriseId(qwDTO.getWxEnterpriseId()); chat.setWxEnterpriseId(qwDTO.getWxEnterpriseId());
chat.setWxChatId(wxChatId); chat.setWxChatId(wxChatId);
chat.setChatStatus(item.getStatus()); chat.setChatStatus(chatStatus);
chat.setCreateTime(new Date()); chat.setCreateTime(new Date());
chat.setUpdateTime(new Date()); chat.setUpdateTime(new Date());
chat.setStatusFlag(0); chat.setStatusFlag(0);
...@@ -133,18 +196,15 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -133,18 +196,15 @@ public class GroupChatServiceImpl implements GroupChatService {
chat.setQuitMemberCount(0); chat.setQuitMemberCount(0);
this.groupChatMapper.insert(chat); this.groupChatMapper.insert(chat);
} }
this.groupChatDetailInit(groupChatId); if (syncDetailFlag) {
} this.initGroupChatDetail(qwDTO, groupChatId, true);
if (org.apache.commons.lang3.StringUtils.isNotBlank(cursor)) {
this.saveGroupChat(qwDTO, userIdList, cursor);
} }
} }
public void groupChatDetailInit(Long groupChatId) { private void initGroupChatDetail(WxEnterpriseQwDTO qwDTO, TabGroupChat chat, boolean syncMember) {
TabGroupChat chat = this.groupChatMapper.selectById(groupChatId); Long groupChatId = chat.getGroupChatId();
String wxEnterpriseId = chat.getWxEnterpriseId(); String wxEnterpriseId = chat.getWxEnterpriseId();
String enterpriseId = chat.getEnterpriseId(); String enterpriseId = chat.getEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(),
SecretTypeEnum.CUSTOMIZED_APP.getVal()); SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting) { if (null == secretSetting) {
...@@ -167,8 +227,11 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -167,8 +227,11 @@ public class GroupChatServiceImpl implements GroupChatService {
} }
chat.setStaffId(staff.getStaffId()); chat.setStaffId(staff.getStaffId());
logger.info("更新群信息={}", JSON.toJSONString(chat)); logger.info("更新群信息={}", JSON.toJSONString(chat));
this.groupChatMapper.updateByPrimaryKey(chat); this.groupChatMapper.update(chat);
if (!syncMember) {
logger.info("不同步群会员信息");
return;
}
List<GroupChatDetailMemberDTO> memberList = detail.getMember_list(); List<GroupChatDetailMemberDTO> memberList = detail.getMember_list();
List<TabGroupChatUser> userList = new ArrayList<>(); List<TabGroupChatUser> userList = new ArrayList<>();
for (GroupChatDetailMemberDTO member : memberList) { for (GroupChatDetailMemberDTO member : memberList) {
...@@ -177,7 +240,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -177,7 +240,7 @@ public class GroupChatServiceImpl implements GroupChatService {
if (null != user) { if (null != user) {
logger.info("更新用户"); logger.info("更新用户");
this.matchGicMember(wxEnterpriseId, enterpriseId, member.getUnionid(), userId, user); this.matchGicMember(wxEnterpriseId, enterpriseId, member.getUnionid(), userId, user);
this.groupChatUserMapper.updateByPrimaryKey(user); this.groupChatUserMapper.update(user);
continue; continue;
} }
user = new TabGroupChatUser(); user = new TabGroupChatUser();
...@@ -207,6 +270,13 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -207,6 +270,13 @@ public class GroupChatServiceImpl implements GroupChatService {
} }
} }
// 初始化群信息-不包括群状态
private void initGroupChatDetail(WxEnterpriseQwDTO qwDTO, Long groupChatId, boolean syncMember) {
TabGroupChat chat = this.groupChatMapper.selectById(groupChatId);
this.initGroupChatDetail(qwDTO, chat, syncMember);
}
// 匹配群成员-客户
private void matchGicMember(String wxEnterpriseId, String enterpriseId, String unionid, String externalUserId, private void matchGicMember(String wxEnterpriseId, String enterpriseId, String unionid, String externalUserId,
TabGroupChatUser user) { TabGroupChatUser user) {
if (StringUtils.isBlank(enterpriseId)) { if (StringUtils.isBlank(enterpriseId)) {
...@@ -219,14 +289,22 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -219,14 +289,22 @@ public class GroupChatServiceImpl implements GroupChatService {
user.setUserType(3); user.setUserType(3);
} }
} else if (StringUtils.isNotBlank(externalUserId)) { } else if (StringUtils.isNotBlank(externalUserId)) {
List<TabHaobanExternalClerkRelated> list = this.externalClerkRelatedService TabHaobanExternalClerkRelated related = this.externalClerkRelatedMapper
.listExternalByExternalUserid(wxEnterpriseId, externalUserId); .getMemberForExternalId(wxEnterpriseId, externalUserId);
list = list.stream().filter(dto -> StringUtils.isNotBlank(dto.getMemberId())).collect(Collectors.toList()); if (null != related) {
if (CollectionUtils.isNotEmpty(list)) { user.setMemberId(related.getMemberId());
user.setMemberId(list.get(0).getMemberId());
user.setUserType(3); user.setUserType(3);
} }
} }
} }
private String getWxEnterpriesId(String corpid) {
TabHaobanWxEnterprise wxEnterprise = this.wxEnterpriseService.getEnterpriseBycorpId(corpid);
if (wxEnterprise == null) {
logger.info("企业不存在,corpid={}", corpid);
return null;
}
return wxEnterprise.getWxEnterpriseId();
}
} }
\ No newline at end of file
...@@ -2,20 +2,40 @@ package com.gic.haoban.manage.service.service.out.impl.chat; ...@@ -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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; 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.dto.chat.ChatEventDTO;
import com.gic.haoban.manage.api.service.chat.GroupChatApiService; import com.gic.haoban.manage.api.service.chat.GroupChatApiService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
@Service("groupChatApiService") @Service("groupChatApiService")
public class GroupChatApiServiceImpl implements GroupChatApiService { public class GroupChatApiServiceImpl implements GroupChatApiService {
private static final Logger logger = LogManager.getLogger(GroupChatApiService.class); private static final Logger logger = LogManager.getLogger(GroupChatApiService.class);
@Autowired
private GroupChatService groupChatService;
@Override @Override
public void qwEventNotice(ChatEventDTO dto) { public ServiceResponse<Void> qwEventNotice(ChatEventDTO dto) {
logger.info("群事件,params={}", JSON.toJSONString(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();
} }
} }
...@@ -755,4 +755,15 @@ ...@@ -755,4 +755,15 @@
external_user_id = #{externalUserid} and wx_enterprise_id = #{wxEnterpriseId} external_user_id = #{externalUserid} and wx_enterprise_id = #{wxEnterpriseId}
</update> </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> </mapper>
\ No newline at end of file
...@@ -105,12 +105,11 @@ ...@@ -105,12 +105,11 @@
<!-- ==================更新 ========== --> <!-- ==================更新 ========== -->
<update id="updateByPrimaryKey" <update id="update"
parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChat"> parameterType="com.gic.haoban.manage.service.entity.chat.TabGroupChat">
<![CDATA[ <![CDATA[
UPDATE tab_haoban_group_chat SET UPDATE tab_haoban_group_chat SET
group_chat_id=#{groupChatId,jdbcType=BIGINT}, group_chat_id=#{groupChatId,jdbcType=BIGINT},
wx_enterprise_id=#{wxEnterpriseId,jdbcType=CHAR},
name=#{name,jdbcType=VARCHAR}, name=#{name,jdbcType=VARCHAR},
staff_id=#{staffId,jdbcType=CHAR}, staff_id=#{staffId,jdbcType=CHAR},
chat_add_time=#{chatAddTime,jdbcType=TIMESTAMP}, chat_add_time=#{chatAddTime,jdbcType=TIMESTAMP},
...@@ -118,12 +117,21 @@ ...@@ -118,12 +117,21 @@
chat_notice=#{chatNotice,jdbcType=VARCHAR}, chat_notice=#{chatNotice,jdbcType=VARCHAR},
chat_status=#{chatStatus,jdbcType=INTEGER}, chat_status=#{chatStatus,jdbcType=INTEGER},
update_time=now(), update_time=now(),
enterprise_id=#{enterpriseId,jdbcType=CHAR},
status_flag=#{statusFlag,jdbcType=INTEGER} status_flag=#{statusFlag,jdbcType=INTEGER}
where group_chat_id = #{groupChatId} where group_chat_id = #{groupChatId}
]]> ]]>
</update> </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" <select id="selectById" parameterType="long"
resultMap="result-map-tabHaobanGroupChat"> resultMap="result-map-tabHaobanGroupChat">
...@@ -137,7 +145,8 @@ ...@@ -137,7 +145,8 @@
SELECT SELECT
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM tab_haoban_group_chat WHERE group_chat_id in FROM tab_haoban_group_chat WHERE group_chat_id in
<foreach collection="idList" item="id" index="index" open="(" close=")" separator=","> <foreach collection="idList" item="id" index="index" open="("
close=")" separator=",">
#{id} #{id}
</foreach> </foreach>
and delete_flag = 0 and delete_flag = 0
...@@ -147,6 +156,7 @@ ...@@ -147,6 +156,7 @@
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
FROM tab_haoban_group_chat WHERE wx_chat_id = #{wxChatId} and FROM tab_haoban_group_chat WHERE wx_chat_id = #{wxChatId} and
wx_enterprise_id = #{wxEnterpriseId}
delete_flag = 0 delete_flag = 0
</select> </select>
......
...@@ -105,12 +105,9 @@ ...@@ -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[ <![CDATA[
UPDATE tab_haoban_group_chat_user SET 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}, user_type=#{userType,jdbcType=INTEGER},
join_time=#{joinTime,jdbcType=DATE}, join_time=#{joinTime,jdbcType=DATE},
user_name=#{userName,jdbcType=VARCHAR}, user_name=#{userName,jdbcType=VARCHAR},
...@@ -119,7 +116,7 @@ ...@@ -119,7 +116,7 @@
unionid=#{unionid,jdbcType=VARCHAR}, unionid=#{unionid,jdbcType=VARCHAR},
member_id=#{memberId,jdbcType=VARCHAR}, member_id=#{memberId,jdbcType=VARCHAR},
invitor_user_id=#{invitorUserId,jdbcType=VARCHAR}, invitor_user_id=#{invitorUserId,jdbcType=VARCHAR},
update_time=#{updateTime,jdbcType=TIMESTAMP}, update_time=now(),
group_chat_id=#{groupChatId,jdbcType=BIGINT}, group_chat_id=#{groupChatId,jdbcType=BIGINT},
status_flag=#{statusFlag,jdbcType=INTEGER}, status_flag=#{statusFlag,jdbcType=INTEGER},
user_quit_time=#{userQuitTime,jdbcType=TIMESTAMP}, 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