Commit ecb3c444 by 徐高华

群活码查询

parent aaf08aa6
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.api.dto.qdto.chat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
public class ChatHmSearchQDTO implements Serializable {
......@@ -12,8 +13,18 @@ public class ChatHmSearchQDTO implements Serializable {
private String wxEnterpriseId;
private String enterpriseId;
private String searchParams;
private Integer status;
private Long linkId ;
// 1有效 2作废
private Integer status = 1;
private Long linkId;
private List<Long> chatHmIdList;
public List<Long> getChatHmIdList() {
return chatHmIdList;
}
public void setChatHmIdList(List<Long> chatHmIdList) {
this.chatHmIdList = chatHmIdList;
}
public Long getLinkId() {
return linkId;
......
package com.gic.haoban.manage.service.dao.mapper.chat;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.qdto.chat.ChatHmSearchQDTO;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatHm;
/**
......@@ -26,9 +24,6 @@ public interface GroupChatHmMapper {
public TabGroupChatHm selectById(Long chatHmId);
public List<TabGroupChatHm> list(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId, @Param("startDate") Date startDate,
@Param("endDate") Date endDate, @Param("searchParams") String searchParams,
@Param("statusFlag") Integer statusFlag);
public List<TabGroupChatHm> list(ChatHmSearchQDTO qdto);
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.chat.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
......@@ -25,11 +24,13 @@ import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.chat.GroupChatHmDTO;
import com.gic.haoban.manage.api.dto.hm.HmLinkChatDTO;
import com.gic.haoban.manage.api.dto.qdto.chat.ChatHmSearchQDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatHmMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatHmRelationMapper;
import com.gic.haoban.manage.service.dao.mapper.chat.GroupChatMapper;
import com.gic.haoban.manage.service.dao.mapper.hm.HmLinkChatMapper;
import com.gic.haoban.manage.service.entity.chat.TabGroupChat;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatHm;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatHmRelation;
......@@ -59,17 +60,25 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
private GroupChatHmMapper groupChatHmMapper;
@Autowired
private GroupChatHmRelationMapper groupChatHmRelationMapper;
@Autowired
private HmLinkChatMapper hmLinkChatMapper;
@Override
public Page<GroupChatHmBO> listPage(ChatHmSearchQDTO qdto, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
String wxEnterpriseId = qdto.getWxEnterpriseId();
String enterpriseId = qdto.getEnterpriseId();
Date startDate = qdto.getStartDate();
Date endDate = qdto.getEndDate();
Integer statusFlag = qdto.getStatus();
List<TabGroupChatHm> list = this.groupChatHmMapper.list(wxEnterpriseId, enterpriseId, startDate, endDate,
qdto.getSearchParams(), statusFlag);
Long linkId = qdto.getLinkId();
if (null != qdto.getLinkId()) {
// 查询链接下的关联的活码列表
List<HmLinkChatDTO> linkChatList = this.hmLinkChatMapper.listByLinkId(wxEnterpriseId, enterpriseId, linkId);
if (CollectionUtils.isEmpty(linkChatList)) {
return new Page<>();
}
List<Long> chatHmIdList = linkChatList.stream().map(o -> o.getChatHmId()).collect(Collectors.toList());
qdto.setChatHmIdList(chatHmIdList);
}
PageHelper.startPage(basePageInfo);
List<TabGroupChatHm> list = this.groupChatHmMapper.list(qdto);
Page<GroupChatHmBO> retPage = PageHelperUtils.changePageHelperToCurrentPage(list, GroupChatHmBO.class);
return retPage;
}
......@@ -190,7 +199,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
return;
}
boolean updateFlag = false;
Long hmid =dto.getChatHmId() ;
Long hmid = dto.getChatHmId();
if (null != hmid) {
updateFlag = true;
} else {
......@@ -217,11 +226,11 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
List<TabGroupChatHmRelation> relationList = new ArrayList<>();
if (updateFlag) {
joinDTO.setConfig_id(hm.getWxConfigId());
/*ServiceResponse<Void> updateResp = this.qywxChatApiService.updateJoinWay(qwDTO.getDkCorpid(),
ServiceResponse<Void> updateResp = this.qywxChatApiService.updateJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), joinDTO);
if (updateResp.isSuccess()) {
this.groupChatHmMapper.updateById(hm);
}*/
}
List<TabGroupChatHmRelation> oldList = this.groupChatHmRelationMapper.listByChatHmId(hmid);
List<Long> oldIdList = oldList.stream().map(o -> o.getGroupChatId()).collect(Collectors.toList());
List<Long> newIdList = dto.getChatIdList();
......@@ -244,7 +253,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
entity.setRelationId(UniqueIdUtils.uniqueLong());
relationList.add(entity);
}
if(CollectionUtils.isNotEmpty(relationList)) {
if (CollectionUtils.isNotEmpty(relationList)) {
this.groupChatHmRelationMapper.insertBatch(relationList);
}
} else {
......
......@@ -134,7 +134,7 @@
</select>
<select id="list" resultMap="result-map-tabHaobanGroupChatHm">
<select id="list" resultMap="result-map-tabHaobanGroupChatHm" parameterType="com.gic.haoban.manage.api.dto.qdto.chat.ChatHmSearchQDTO">
SELECT
<include refid="Base_Column_List" />
FROM tab_haoban_group_chat_hm WHERE wx_enterprise_id =#{wxEnterpriseId} and enterprise_id=#{enterpriseId}
......@@ -145,6 +145,15 @@
<if test="null != searchParams and '' !=searchParams ">
and name like '%${searchParams}%'
</if>
<if test="null != status">
and status_flag = #{statusFlag}
</if>
<if test="null !=chatHmIdList and chatHmIdList.size>0">
and chat_hm_id in
<foreach collection="chatHmIdList" close=")" index="index" item="id" open="(" separator=",">
#{id}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
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