Commit d4cefdec by 徐高华

操作日志

parent 9a669b4d
package com.gic.haoban.manage.api.service.chat;
import java.util.List;
import com.gic.api.base.commons.BasePageInfo;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
......@@ -51,4 +53,6 @@ public interface GroupChatHmApiService {
*/
public ServiceResponse<Page<HmLinkChatDTO>> listPageChatLink(HmLinkChatQDTO qdto, BasePageInfo basePageInfo);
public ServiceResponse<List<Long>> listHmGroupChatId(String wxEnterpriseId, Long chatHmId) ;
}
......@@ -23,9 +23,6 @@ public interface GroupChatHmRelationMapper {
public int delete(@Param("chatHmId") Long chatHmId, @Param("groupChatIdList") List<Long> groupChatIdList,
@Param("statusFlag") int statusFlag);
public int updateStatus(@Param("chatHmId") Long chatHmId, @Param("groupChatId") Long groupChatId,
@Param("statusFlag") int statusFlag);
public List<TabGroupChatHmRelation> listByChatHmId(@Param("chatHmId") Long chatHmId);
/**
......
......@@ -38,8 +38,18 @@ public interface GroupChatHmService {
public void discard(Long chatHmId, String wxEnterpriseId, String clerkId, String clerkName);
public void updateLinkCount(String wxEnterpriseId, Long chatHmId);
public void updateLinkCount(String wxEnterpriseId , List<Long> chatHmIdList);
/**
*
* @Title: listHmGroupChatId
* @Description: 查询活码下的群id列表
* @author xgh331
* @param wxEnterpriseId
* @param chatHmId
* @return
* @throws
*/
public List<Long> listHmGroupChatId(String wxEnterpriseId, Long chatHmId) ;
}
\ No newline at end of file
......@@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -124,7 +123,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
if (null == hm) {
return null;
}
this.updateLinkCount(hm.getWxEnterpriseId(), hmId);
this.updateLinkCount(hm.getWxEnterpriseId(), Arrays.asList(hmId));
GroupChatHmBO bo = EntityUtil.changeEntityByJSON(GroupChatHmBO.class, hm);
return bo;
}
......@@ -258,13 +257,8 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
/**
*
* @Title: saveHm
* @Description: TODO(这里用一句话描述这个方法的作用)
* @author xugh
* @param dto
* @param autoDel 自动剔除1否 2是
* @return
* @throws
* @Title: saveHm @Description: TODO(这里用一句话描述这个方法的作用) @author xugh @param
* dto @param autoDel 自动剔除1否 2是 @return @throws
*/
private ServiceResponse<GroupChatHmDTO> saveHm(GroupChatHmDTO dto, int autoDel) {
String wxEnterpriseId = dto.getWxEnterpriseId();
......@@ -382,13 +376,13 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
@Override
public void updateLinkCount(String wxEnterpriseId, List<Long> chatHmIdList) {
logger.info("更新活码链接数1={},{}",wxEnterpriseId,chatHmIdList);
logger.info("更新活码链接数={},{}", wxEnterpriseId, chatHmIdList);
if (CollectionUtils.isNotEmpty(chatHmIdList)) {
Set<Long> set = new HashSet<>(chatHmIdList);
List<HmLinkChatDTO> linkGroup = this.hmLinkChatService.getLinkCountForHm(wxEnterpriseId,
new ArrayList<>(set));
List<Long> allList = linkGroup.stream().map(dto -> dto.getChatHmId()).collect(Collectors.toList());
logger.info("更新活码链接数2={},{}",wxEnterpriseId,allList);
logger.info("更新活码链接数,有数据={}", allList);
linkGroup.forEach(dto -> {
Long hmId = dto.getChatHmId();
int count = dto.getLinkCount();
......@@ -396,7 +390,7 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
});
for (Long id : chatHmIdList) {
if (!allList.contains(id)) {
logger.info("更新活码链接数3={},{}",wxEnterpriseId,id);
logger.info("更新活码链接数,全删除的{}", wxEnterpriseId, id);
this.groupChatHmMapper.updateLinkCount(id, 0);
}
}
......@@ -404,8 +398,9 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
}
@Override
public void updateLinkCount(String wxEnterpriseId, Long chatHmId) {
this.updateLinkCount(wxEnterpriseId, Arrays.asList(chatHmId));
public List<Long> listHmGroupChatId(String wxEnterpriseId, Long chatHmId) {
List<TabGroupChatHmRelation> list = this.groupChatHmRelationMapper.listByChatHmId(chatHmId);
return list.stream().map(dto -> dto.getGroupChatId()).collect(Collectors.toList());
}
}
\ No newline at end of file
......@@ -82,4 +82,9 @@ public class GroupChatHmApiServiceImpl implements GroupChatHmApiService {
return ServiceResponse.success(page);
}
@Override
public ServiceResponse<List<Long>> listHmGroupChatId(String wxEnterpriseId, Long chatHmId) {
return ServiceResponse.success(this.groupChatHmService.listHmGroupChatId(wxEnterpriseId, chatHmId));
}
}
......@@ -28,6 +28,7 @@ import com.gic.haoban.manage.api.service.hm.HmWelcomeRelationApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.HmWelcomeRelationBO;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.hm.WelcomeRelationService;
import com.gic.redis.data.util.RedisUtil;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
......@@ -51,8 +52,11 @@ public class HmPageServiceTest {
@Test
public void test(){
String key = "haoban_fresh_wx_friend" + "20221004" + "dc4c06fd6ff94cb8be6a8beef639f873";
System.out.println(RedisUtil.getCache(key));
RedisUtil.delCache(key);
this.externalClerkRelatedService.repairExternalUserId("218a8a6c2ca14e28a1053f541be0e49d,ca66a01b79474c40b3e7c7f93daf1a3b");
// this.externalClerkRelatedService.repairExternalUserId("218a8a6c2ca14e28a1053f541be0e49d,ca66a01b79474c40b3e7c7f93daf1a3b");
// this.wxEnterpriseApiService.stopHaoban("ff80808182c3a46b0182c3a4ea7d0000");
/* HmPageQDTO pageQDTO = new HmPageQDTO();
......
......@@ -10,12 +10,15 @@ import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -56,6 +59,7 @@ import com.gic.qcloud.FileUploadUtil;
import com.gic.web.common.utils.DataPermissionExport;
import com.gic.web.common.utils.ExecutorPoolSingleton;
import com.gic.web.common.utils.SessionContextUtils;
import com.google.common.collect.Sets;
/**
*
......@@ -69,6 +73,8 @@ import com.gic.web.common.utils.SessionContextUtils;
@RequestMapping("/chat/hm")
public class GroupChatHmController {
private static Logger logger = LogManager.getLogger(GroupChatHmController.class);
@Autowired
private GroupChatHmApiService groupChatHmApiService;
@Autowired
......@@ -158,6 +164,31 @@ public class GroupChatHmController {
if (null != b) {
content.append(b);
}
String o = null ;
List<Long> newIdList = newDTO.getChatIdList() ;
List<Long> oldIdList = this.groupChatHmApiService.listHmGroupChatId(wxEnterpriseId, oldDTO.getChatHmId()).getResult() ;
Sets.SetView<Long> delView = Sets.difference(Sets.newHashSet(oldIdList), Sets.newHashSet(newIdList));
List<Long> delIdList = delView.stream().collect(Collectors.toList());
logger.info("删除的群={}", delIdList);
if (CollectionUtils.isNotEmpty(delIdList)) {
String chats = this.getGroupChatName(wxEnterpriseId, delIdList) ;
if(StringUtils.isNotBlank(chats)) {
o = "删除可加入群聊【" + chats + "】";
}
}
String p = null ;
Sets.SetView<Long> addView = Sets.difference(Sets.newHashSet(newIdList), Sets.newHashSet(oldIdList));
List<Long> addIdList = addView.stream().collect(Collectors.toList());
logger.info("增加的群={}", addIdList);
if(CollectionUtils.isNotEmpty(addIdList)) {
String chats = this.getGroupChatName(wxEnterpriseId, newIdList) ;
if(StringUtils.isNotBlank(chats)) {
p = "新增可加入群聊【" + chats + "】";
}
}
String c = null;
if (oldDTO.getAutoCreateRoom() == 1 && newDTO.getAutoCreateRoom() == 0) {
c = "关闭自动建群功能";
......@@ -181,7 +212,7 @@ public class GroupChatHmController {
content.append(f);
}
}
if (org.apache.commons.lang3.StringUtils.isAllBlank(a, b, c, d, e, f)) {
if (org.apache.commons.lang3.StringUtils.isAllBlank(a, b, c, d, e, f,o,p)) {
return null;
}
StringBuilder sb = new StringBuilder("编辑群活码").append("【").append(oldDTO.getChatHmCode()).append("-")
......@@ -189,6 +220,21 @@ public class GroupChatHmController {
return sb.append(content).toString();
}
private String getGroupChatName(String wxEnterpriseId , List<Long> groupChatIdList) {
ServiceResponse<List<GroupChatDTO>> resp = this.groupChatApiService.listChatByIdList(wxEnterpriseId, groupChatIdList) ;
List<GroupChatDTO> list = resp.getResult() ;
String names = list.stream().map(dto->joint(dto.getWxChatId(),"-",dto.getName())).collect(Collectors.joining(",")) ;
return names ;
}
private String joint(String... arr) {
StringBuilder sb = new StringBuilder() ;
for(String s : arr) {
sb.append(s) ;
}
return sb.toString() ;
}
public String comp(String wxEnterpriseId, String enterpriseId, String title, String oldValue, String newValue,
int type) {
StringBuilder sb = new StringBuilder();
......
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