|
|
@@ -60,6 +60,16 @@ public class LeadServiceImpl extends ServiceImpl<LeadMapper, Lead> implements IL
|
|
|
return list.isEmpty() ? null : list.get(0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Lead getByExternalId(Long externalId) {
|
|
|
+ List<Lead> list = this.list(new LambdaQueryWrapper<Lead>()
|
|
|
+ .eq(Lead::getExternalId, externalId));
|
|
|
+ if (list.size() > 1) {
|
|
|
+ log.error("查询投流外部联系人信息不唯一:{}", externalId);
|
|
|
+ }
|
|
|
+ return list.isEmpty() ? null : list.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Async
|
|
|
public void updateGroupAddMemberLead(String name, String chatId, String corpId, String unionid) {
|
|
|
@@ -111,6 +121,23 @@ public class LeadServiceImpl extends ServiceImpl<LeadMapper, Lead> implements IL
|
|
|
this.updateAddMemberLead(qwExternalContact);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateDeleteMemberLead(String externalUserID, String userID, String corpId) {
|
|
|
+ QwExternalContact qwExternalContact = qwExternalContactMapper.selectQwExternalByExternalIdAndCompanyIdToIdAndFs(externalUserID, userID, corpId);
|
|
|
+ if (qwExternalContact != null) {
|
|
|
+ Lead byExternalId = this.getByExternalId(qwExternalContact.getId());
|
|
|
+ if (ObjectUtil.isEmpty(byExternalId)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ log.info("用户删除微线索信息:{}", byExternalId.getTraceId());
|
|
|
+ Lead tempLead = new Lead();
|
|
|
+ tempLead.setId(byExternalId.getId());
|
|
|
+ tempLead.setWechatDelete(1);
|
|
|
+ this.updateById(tempLead);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void updateAddMemberLead(QwExternalContact qwExternalContact) {
|
|
|
log.info("用户加微线索信息:{}", qwExternalContact);
|
|
|
LambdaQueryWrapper<Lead> last = new LambdaQueryWrapper<Lead>();
|
|
|
@@ -143,8 +170,8 @@ public class LeadServiceImpl extends ServiceImpl<LeadMapper, Lead> implements IL
|
|
|
|
|
|
@Override
|
|
|
@Async
|
|
|
- public void weChatAuthorizationLead(String traceId, String unionId, String maOpenId, String phone) {
|
|
|
- log.info("用户微信授权线索信息:{} {} {} {}", traceId, unionId, phone, maOpenId);
|
|
|
+ public void weChatAuthorizationLead(String traceId, String unionId, String maOpenId, String phone, Long userId) {
|
|
|
+ log.info("用户微信授权线索信息:{} {} {} {} {}", traceId, unionId, phone, maOpenId, userId);
|
|
|
Lead byTraceId = this.getByTraceId(traceId);
|
|
|
if (byTraceId == null) {
|
|
|
return;
|
|
|
@@ -154,6 +181,7 @@ public class LeadServiceImpl extends ServiceImpl<LeadMapper, Lead> implements IL
|
|
|
.set(ObjectUtil.isNotEmpty(unionId), Lead::getUnionid, unionId)
|
|
|
.set(ObjectUtil.isNotEmpty(phone), Lead::getPhone, phone)
|
|
|
.set(ObjectUtil.isNotEmpty(maOpenId), Lead::getOpenid, maOpenId)
|
|
|
+ .set(ObjectUtil.isNotEmpty(userId), Lead::getSystemUserId, userId)
|
|
|
.set(Lead::getMiniAuth, 1));
|
|
|
if (ObjectUtil.isNotEmpty(byTraceId.getLandingPageTs()) && byTraceId.getLandingPageTs().toLocalDate().isEqual(LocalDate.now())) {
|
|
|
// 微信授权且当日创建事件
|