Commit 3a281202 by 徐高华

Merge branch 'feature/社群' into 'developer'

Feature/社群

See merge request !736
parents 89489332 b7c10a9c
...@@ -260,43 +260,58 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -260,43 +260,58 @@ public class GroupChatServiceImpl implements GroupChatService {
// 处理群通知 // 处理群通知
@Override @Override
public void handChatNotice(String params) { public void handChatNotice(String params) {
List<Integer> typeList = Arrays.asList(1, 2, 3); logger.info("企微群定时,处理群通知");
Date endTime = new Date(); String key = "handChatNotice";
Date startTime = DateUtil.addNumForMinute(endTime, -30); try {
List<TabChatNotice> list = this.chatNoticeMapper.listAll(typeList, startTime, endTime); Object o = RedisUtil.getCache(key);
logger.info("开始群通知定时,count={}", list.size()); if (null != o) {
if (CollectionUtils.isEmpty(list)) { logger.info("有缓存,进行中");
return; return;
} }
this.chatNoticeMapper.closeAll(typeList, startTime, endTime); RedisUtil.setCache(key, "1");
for (TabChatNotice item : list) { List<Integer> typeList = Arrays.asList(1, 2, 3);
try { Date endTime = new Date();
int type = item.getType(); Date startTime = DateUtil.addNumForMinute(endTime, -30);
String wxEnterpriseId = item.getWxEnterpriseId(); List<TabChatNotice> list = this.chatNoticeMapper.listAll(typeList, startTime, endTime);
Long groupChatId = item.getChatId(); logger.info("开始群通知定时,count={}", list.size());
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); if (CollectionUtils.isEmpty(list)) {
if (type == 1) { return;
this.updateGroupChatDetail(qwDTO, groupChatId, false); }
} this.chatNoticeMapper.closeAll(typeList, startTime, endTime);
if (type == 2) { for (TabChatNotice item : list) {
this.updateChatStatus(qwDTO, groupChatId); try {
} int type = item.getType();
if (type == 3) { String wxEnterpriseId = item.getWxEnterpriseId();
this.updateGroupChatDetail(qwDTO, groupChatId, true); Long groupChatId = item.getChatId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (type == 1) {
this.updateGroupChatDetail(qwDTO, groupChatId, false);
}
if (type == 2) {
this.updateChatStatus(qwDTO, groupChatId);
}
if (type == 3) {
this.updateGroupChatDetail(qwDTO, groupChatId, true);
}
} catch (Exception e) {
e.printStackTrace();
} }
} catch (Exception e) {
e.printStackTrace();
} }
} catch (Exception e) {
e.printStackTrace();
} finally {
RedisUtil.delCache(key);
} }
} }
@Override @Override
public void initGroupChatForTimer(String params) { public void initGroupChatForTimer(String params) {
logger.info("企微群定时,初始化"); logger.info("企微群定时,初始化");
String key = "initGroupChatForTimer"; String key = "initGroupChatForTimer";
try { try {
Object o = RedisUtil.getCache(key); Object o = RedisUtil.getCache(key);
if (null != o) { if (null != o) {
logger.info("有缓存,进行中");
return; return;
} }
RedisUtil.setCache(key, "1"); RedisUtil.setCache(key, "1");
...@@ -359,11 +374,12 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -359,11 +374,12 @@ public class GroupChatServiceImpl implements GroupChatService {
@Override @Override
public void initHaobaonGroupChat(String params) { public void initHaobaonGroupChat(String params) {
logger.info("企微群定时,整个企业初始化");
String key = "initHaobaonGroupChat"; String key = "initHaobaonGroupChat";
try { try {
Object o = RedisUtil.getCache(key); Object o = RedisUtil.getCache(key);
if (null != o) { if (null != o) {
logger.info("企业群初始化进行中"); logger.info("有缓存,进行中");
return; return;
} }
RedisUtil.setCache(key, "1"); RedisUtil.setCache(key, "1");
...@@ -401,6 +417,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -401,6 +417,7 @@ public class GroupChatServiceImpl implements GroupChatService {
// 群主离职列表 // 群主离职列表
public void ownerDimission() { public void ownerDimission() {
logger.info("企微群定时,离职群主群状态更新");
List<GroupChatOwnerDTO> dimissionOwnerList = this.groupChatOwnerMapper.dimissionOwnerList(); List<GroupChatOwnerDTO> dimissionOwnerList = this.groupChatOwnerMapper.dimissionOwnerList();
for (GroupChatOwnerDTO dto : dimissionOwnerList) { for (GroupChatOwnerDTO dto : dimissionOwnerList) {
try { try {
...@@ -464,7 +481,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -464,7 +481,7 @@ public class GroupChatServiceImpl implements GroupChatService {
// 同步群列表 // 同步群列表
private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor, private void syncGroupChatList(WxEnterpriseQwDTO qwDTO, List<String> userIdList, String cursor,
boolean syncDetailFlag) { boolean syncDetailFlag) {
logger.info("qwDTO={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor); logger.info("同步群列表={},idlist={},cursor={}", JSON.toJSONString(qwDTO), JSON.toJSONString(userIdList), cursor);
ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getDkCorpid(), ServiceResponse<GroupChatListDTO> resp = this.qywxChatApiService.groupchatList3th(qwDTO.getDkCorpid(),
config.getWxSuiteid(), userIdList, limit, cursor); config.getWxSuiteid(), userIdList, limit, cursor);
if (!resp.isSuccess()) { if (!resp.isSuccess()) {
...@@ -494,7 +511,7 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -494,7 +511,7 @@ public class GroupChatServiceImpl implements GroupChatService {
Long groupChatId = null; Long groupChatId = null;
if (null != groupChat) { if (null != groupChat) {
groupChatId = groupChat.getGroupChatId(); groupChatId = groupChat.getGroupChatId();
logger.info("更新群状态,wxchatid={},groupChatId={},新老状态={}", wxChatId, groupChatId, chatStatus, logger.info("更新群状态,wxchatid={},groupChatId={},新老状态={}-{}", wxChatId, groupChatId, chatStatus,
groupChat.getChatStatus()); groupChat.getChatStatus());
if (groupChat.getChatStatus() != chatStatus) { if (groupChat.getChatStatus() != chatStatus) {
this.groupChatMapper.updateChatStatus(groupChatId, chatStatus); this.groupChatMapper.updateChatStatus(groupChatId, chatStatus);
...@@ -981,11 +998,12 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -981,11 +998,12 @@ public class GroupChatServiceImpl implements GroupChatService {
@Override @Override
public void handleHmChatFull(String params) { public void handleHmChatFull(String params) {
logger.info("企微群定时,群满");
List<Integer> typeList = Arrays.asList(4); List<Integer> typeList = Arrays.asList(4);
Date endTime = new Date(); Date endTime = new Date();
Date startTime = DateUtil.addNumForMinute(endTime, -30); Date startTime = DateUtil.addNumForMinute(endTime, -30);
List<TabChatNotice> list = this.chatNoticeMapper.listAll(typeList, startTime, endTime); List<TabChatNotice> list = this.chatNoticeMapper.listAll(typeList, startTime, endTime);
logger.info("开始群加满处理活码定时,count={}", list.size()); logger.info("群满处理活码,count={}", list.size());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
return; return;
} }
...@@ -999,8 +1017,8 @@ public class GroupChatServiceImpl implements GroupChatService { ...@@ -999,8 +1017,8 @@ public class GroupChatServiceImpl implements GroupChatService {
if (null == chat || chat.getHmAddStatus() == 1 || null == chat.getOffTime()) { if (null == chat || chat.getHmAddStatus() == 1 || null == chat.getOffTime()) {
continue; continue;
} }
if (chat.getOffTime().getTime() + 1000 * 60 * 60 * 24 < new Date().getTime()) { if (chat.getOffTime().getTime() + 1000 * 60 * 60 * 8 < new Date().getTime()) {
logger.info("超过一天不再重试groupChatId={}", groupChatId); logger.info("超过8小时不重试groupChatId={}", groupChatId);
continue; continue;
} }
this.groupChatHmService.handleChatOff(wxEnterpriseId, groupChatId); this.groupChatHmService.handleChatOff(wxEnterpriseId, groupChatId);
......
...@@ -96,7 +96,7 @@ public class GroupChatApiServiceImpl implements GroupChatApiService { ...@@ -96,7 +96,7 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
if (needClerkReltaion) { if (needClerkReltaion) {
List<String> staffIdList = dtoList.stream().filter(dto -> StringUtils.isNotBlank(dto.getStaffId())) List<String> staffIdList = dtoList.stream().filter(dto -> StringUtils.isNotBlank(dto.getStaffId()))
.map(dto -> dto.getStaffId()).collect(Collectors.toList()); .map(dto -> dto.getStaffId()).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(staffIdList)) { if (CollectionUtils.isNotEmpty(staffIdList)) {
List<String> relationIdList = this.staffClerkRelationService List<String> relationIdList = this.staffClerkRelationService
.listRelationsStaffId(new HashSet<>(staffIdList)); .listRelationsStaffId(new HashSet<>(staffIdList));
dtoList.forEach(one -> { dtoList.forEach(one -> {
...@@ -131,7 +131,7 @@ public class GroupChatApiServiceImpl implements GroupChatApiService { ...@@ -131,7 +131,7 @@ public class GroupChatApiServiceImpl implements GroupChatApiService {
} }
List<String> staffIdList = new ArrayList<>(staffIdSet); List<String> staffIdList = new ArrayList<>(staffIdSet);
Map<String, TabHaobanStaff> map = new HashMap<>(); Map<String, TabHaobanStaff> map = new HashMap<>();
if(CollectionUtils.isNotEmpty(staffIdList)) { if (CollectionUtils.isNotEmpty(staffIdList)) {
List<TabHaobanStaff> staffList = this.staffService.listNoStatusByStaffIds(wxEnterpriseId, staffIdList); List<TabHaobanStaff> staffList = this.staffService.listNoStatusByStaffIds(wxEnterpriseId, staffIdList);
if (CollectionUtils.isNotEmpty(staffList)) { if (CollectionUtils.isNotEmpty(staffList)) {
map = staffList.stream().collect(Collectors.toMap(TabHaobanStaff::getStaffId, o -> o, (k1, k2) -> k2)); map = staffList.stream().collect(Collectors.toMap(TabHaobanStaff::getStaffId, o -> o, (k1, k2) -> k2));
......
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