Commit 76cb0073 by 徐高华

链接数

parent 7b398a95
......@@ -33,6 +33,15 @@ public class HmLinkChatDTO implements Serializable {
private String linkCode;
private String shortCode;
private String name;
private Integer linkCount ;
public Integer getLinkCount() {
return linkCount;
}
public void setLinkCount(Integer linkCount) {
this.linkCount = linkCount;
}
public String getName() {
return name;
......
package com.gic.haoban.manage.service.dao.mapper.hm;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
......@@ -28,5 +29,8 @@ public interface HmLinkChatMapper {
public List<HmLinkChatDTO> listByLinkId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("enterpriseId") String enterpriseId, @Param("linkId") Long linkId);
public List<HmLinkChatDTO> getLinkCountForHm(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("chatHmIdList") List<Long> chatHmIdList) ;
public List<HmLinkChatDTO> listPage(HmLinkChatQDTO qdto) ;
}
\ No newline at end of file
......@@ -38,8 +38,6 @@ public class TabGroupChatHm implements Serializable{
private java.util.Date updateTime;
/**关联群数量*/
private Integer chatCount;
/**已关联链接数*/
private Integer linkCount;
// 1有效 2作废 3待生效
private Integer statusFlag ;
......@@ -184,11 +182,4 @@ public class TabGroupChatHm implements Serializable{
public Integer getChatCount(){
return chatCount;
}
public void setLinkCount(Integer linkCount){
this.linkCount = linkCount;
}
public Integer getLinkCount(){
return linkCount;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.hm;
import java.util.List;
import java.util.Map;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
......@@ -23,4 +24,16 @@ public interface HmLinkChatService {
public Page<HmLinkChatDTO> listPage(HmLinkChatQDTO qdto, BasePageInfo basePageInfo);
/**
*
* @Title: getLinkCountForHm
* @Description: 查询活码关联链接数量
* @author xugh
* @param wxEnterpriseId
* @param chatHmIdList
* @return
* @throws
*/
public List<HmLinkChatDTO> getLinkCountForHm(String wxEnterpriseId, List<Long> chatHmIdList) ;
}
......@@ -63,4 +63,10 @@ public class HmLinkChatServiceImpl implements HmLinkChatService {
return retPage;
}
@Override
public List<HmLinkChatDTO> getLinkCountForHm(String wxEnterpriseId, List<Long> chatHmIdList) {
return this.hmLinkChatMapper.getLinkCountForHm(wxEnterpriseId, chatHmIdList) ;
}
}
package com.gic.haoban.manage.service.service.out.impl.chat;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -37,6 +42,22 @@ public class GroupChatHmApiServiceImpl implements GroupChatHmApiService {
public ServiceResponse<Page<GroupChatHmDTO>> listPage(ChatHmSearchQDTO qdto, BasePageInfo basePageInfo) {
Page<GroupChatHmBO> page = this.groupChatHmService.listPage(qdto, basePageInfo);
Page<GroupChatHmDTO> resultPage = PageHelperUtils.changePageToCurrentPage(page, GroupChatHmDTO.class);
if(CollectionUtils.isNotEmpty(resultPage.getResult())) {
List<Long> chatHmIdList = resultPage.getResult().stream().map(dto -> dto.getChatHmId())
.collect(Collectors.toList());
List<HmLinkChatDTO> linkCount = this.hmLinkChatService.getLinkCountForHm(qdto.getWxEnterpriseId(),
chatHmIdList);
Map<Long, Integer> map = linkCount.stream()
.collect(Collectors.toMap(HmLinkChatDTO::getChatHmId, HmLinkChatDTO::getLinkCount, (k1, k2) -> k1));
resultPage.getResult().forEach(dto -> {
if (null != map.get(dto.getChatHmId())) {
dto.setChatCount(map.get(dto.getChatHmId()));
} else {
dto.setChatCount(0);
}
});
}
return ServiceResponse.success(resultPage);
}
......@@ -54,14 +75,13 @@ public class GroupChatHmApiServiceImpl implements GroupChatHmApiService {
}
@Override
public ServiceResponse<Void> discard(Long chatHmId, String wxEnterpriseId , String clerkId, String clerkName) {
this.groupChatHmService.discard(chatHmId,wxEnterpriseId,clerkId,clerkName) ;
public ServiceResponse<Void> discard(Long chatHmId, String wxEnterpriseId, String clerkId, String clerkName) {
this.groupChatHmService.discard(chatHmId, wxEnterpriseId, clerkId, clerkName);
return ServiceResponse.success();
}
@Override
public ServiceResponse<Page<HmLinkChatDTO>> listPageChatLink(HmLinkChatQDTO qdto,
BasePageInfo basePageInfo) {
public ServiceResponse<Page<HmLinkChatDTO>> listPageChatLink(HmLinkChatQDTO qdto, BasePageInfo basePageInfo) {
Page<HmLinkChatDTO> page = this.hmLinkChatService.listPage(qdto, basePageInfo);
return ServiceResponse.success(page);
}
......
......@@ -23,7 +23,6 @@
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="chat_count" property="chatCount" />
<result column="link_count" property="linkCount" />
<result column="status_flag" property="statusFlag"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -46,7 +45,7 @@
create_time,
update_time,
chat_count,
link_count , status_flag
status_flag
</sql>
<!-- ===================== 新增 ======================== -->
<insert id="insert"
......@@ -72,7 +71,7 @@
create_time,
update_time,
chat_count,
link_count , status_flag
status_flag
)VALUES(
#{chatHmId},
#{chatHmCode},
......@@ -93,7 +92,7 @@
now(),
now(),
#{chatCount},
0 , 1
1
)
]]>
</insert>
......
......@@ -95,6 +95,16 @@
</select>
<select id="getLinkCountForHm" resultType="com.gic.haoban.manage.api.dto.hm.HmLinkChatDTO">
select chat_hm_id chatHmId, COUNT(DISTINCT(link_id)) linkCount from tab_haoban_hm_link_chat where wx_enterprise_id = #{wxEnterpriseId}
and chat_hm_id in
<foreach collection="chatHmIdList" item="item" separator="," index="index" close=")" open="(">
#{item}
</foreach>
and delete_flag = 0 group by chat_hm_id
</select>
<select id="listPage" parameterType="com.gic.haoban.manage.api.dto.qdto.hm.HmLinkChatQDTO" resultType="com.gic.haoban.manage.api.dto.hm.HmLinkChatDTO">
SELECT a.link_id linkId , b.`name` name , b.`link_code` linkCode , b.`short_code` shortCode FROM tab_haoban_hm_link_chat a LEFT JOIN tab_haoban_hm_link b ON a.link_id = b.link_id
WHERE a.wx_enterprise_id=#{wxEnterpriseId} and a.enterprise_id=#{enterpriseId} and a.chat_hm_id = #{chatHmId}
......
......@@ -176,7 +176,7 @@ public class GroupChatHmController {
}
@RequestMapping("download")
public RestResponse<Object> download(String params) {
public RestResponse<Object> download(ChatHmSearchQDTO qdto) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String qrCodeName = "群活码";
final String fileName = qrCodeName + "_" + sdf.format(new Date()) + ".zip";
......@@ -200,7 +200,6 @@ public class GroupChatHmController {
BasePageInfo basePageInfo = new BasePageInfo();
basePageInfo.setPageNum(1);
basePageInfo.setPageSize(1000);
ChatHmSearchQDTO qdto = new ChatHmSearchQDTO();
qdto.setEnterpriseId(enterpriseId);
qdto.setWxEnterpriseId(wxEnterpriseId);
ServiceResponse<Page<GroupChatHmDTO>> resp = this.groupChatHmApiService.listPage(qdto, basePageInfo);
......
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