Commit dcf8e802 by 徐高华

群逻辑调整

parent 0a0e42cd
......@@ -280,7 +280,11 @@ public class GroupChatHmServiceImpl implements GroupChatHmService {
}
if (CollectionUtils.isNotEmpty(relationList)) {
this.groupChatHmRelationMapper.insertBatch(relationList);
// 更新群的企业id到活码的企业ID
logger.info("自动更新群关联的GIC企业ID,eid={},addIdList={}",hm.getEnterpriseId(),addIdList);
this.groupChatMapper.updateChatEnterpriseId(wxEnterpriseId, hm.getEnterpriseId(), addIdList);
}
} else {
ServiceResponse<String> addResp = this.qywxChatApiService.addJoinWay(qwDTO.getDkCorpid(),
secretSetting.getSecretVal(), joinDTO);
......
......@@ -441,32 +441,36 @@ public class GroupChatServiceImpl implements GroupChatService {
chat.setStaffId(null);
logger.info("群主未关联好办,不同步群成员,userid={}", owner);
}
// 匹配GIC企业ID
if (StringUtils.isBlank(enterpriseId)) {
List<TabHaobanWxEnterpriseRelated> list = this.wxEnterpriseRelatedService.getByWxEnterpriseId(enterpriseId);
if (CollectionUtils.isNotEmpty(list) && list.size() == 1) {
logger.info("匹配群的gic商户id,gic={}", list.get(0).getEnterpriseId());
enterpriseId = list.get(0).getEnterpriseId();
// 匹配GIC商户ID ,如果已经初始化过,不再自动匹配GIC商户
if (chat.getInitFlag() == 0) {
if (StringUtils.isBlank(enterpriseId)) {
List<TabHaobanWxEnterpriseRelated> list = this.wxEnterpriseRelatedService
.getByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isNotEmpty(list) && list.size() == 1) {
logger.info("匹配群的gic商户id,gic={}", list.get(0).getEnterpriseId());
enterpriseId = list.get(0).getEnterpriseId();
chat.setEnterpriseId(enterpriseId);
}
}
}
if (StringUtils.isBlank(enterpriseId) && null != staff) {
logger.info("匹配群的gic商户id,staffid={}", staff.getStaffId());
List<StaffClerkRelationDTO> clerkList = this.staffClerkRelationService.listByStaffId(wxEnterpriseId,
staff.getStaffId());
if (CollectionUtils.isNotEmpty(clerkList)) {
Set<String> enterpriseIdSet = clerkList.stream().map(dto -> dto.getEnterpriseId())
.collect(Collectors.toSet());
logger.info("成员关联导购数={},商户={}", clerkList.size(), enterpriseIdSet);
if (enterpriseIdSet.size() == 1) {
enterpriseId = clerkList.get(0).getEnterpriseId();
chat.setEnterpriseId(enterpriseId);
if (StringUtils.isBlank(enterpriseId) && null != staff) {
logger.info("匹配群的gic商户id,staffid={}", staff.getStaffId());
List<StaffClerkRelationDTO> clerkList = this.staffClerkRelationService.listByStaffId(wxEnterpriseId,
staff.getStaffId());
if (CollectionUtils.isNotEmpty(clerkList)) {
Set<String> enterpriseIdSet = clerkList.stream().map(dto -> dto.getEnterpriseId())
.collect(Collectors.toSet());
logger.info("成员关联导购数={},商户={}", clerkList.size(), enterpriseIdSet);
if (enterpriseIdSet.size() == 1) {
enterpriseId = clerkList.get(0).getEnterpriseId();
chat.setEnterpriseId(enterpriseId);
}
}
}
}
logger.info("更新群信息={}", JSON.toJSONString(chat));
if (StringUtils.isNotEmpty(chat.getEnterpriseId())) {
chat.setGicFlag(1);
logger.info("更新群信息={}", JSON.toJSONString(chat));
if (StringUtils.isNotEmpty(chat.getEnterpriseId())) {
chat.setGicFlag(1);
}
}
// 判断是否更新群主
this.saveOwnerHistory(wxEnterpriseId, groupChatId, newStaffId, oldStaffId);
......
......@@ -317,7 +317,7 @@
#{id}
</foreach>
</if>
and delete_flag = 0 and enterprise_id is null
and delete_flag = 0
</update>
</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