Commit 30cc644b by 徐高华

成长值

parent 2dabc734
......@@ -224,6 +224,11 @@
<artifactId>gic-content-api</artifactId>
<version>${gic-content-api}</version>
</dependency>
<dependency>
<groupId>com.gic</groupId>
<artifactId>gic-member-ext-api</artifactId>
<version>${gic-member-ext-api}</version>
</dependency>
</dependencies>
<build>
......
......@@ -13,4 +13,6 @@ public interface ExternalMemberService {
public void welcomeForMember();
}
public void updateMemberGrowth(String enterpriseId , String memberId , String ruleCode , String title , String remark) ;
}
......@@ -13,6 +13,8 @@ import java.util.stream.Collectors;
import com.gic.enterprise.api.dto.StoreDTO;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.service.*;
import com.gic.member.ext.api.enums.growth.EnterpriseGrowthRuleEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
......@@ -64,11 +66,6 @@ import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwner;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatOwnerHistory;
import com.gic.haoban.manage.service.entity.chat.TabGroupChatUser;
import com.gic.haoban.manage.service.pojo.bo.chat.GroupChatBO;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.chat.GroupChatHmService;
import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.member.api.dto.MemberDTO;
......@@ -129,6 +126,8 @@ public class GroupChatServiceImpl implements GroupChatService {
private StoreService storeService ;
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper ;
@Autowired
private ExternalMemberService externalMemberService ;
private static GicMQClient mqClient = GICMQClientUtil.getClientInstance();
......@@ -976,6 +975,11 @@ public class GroupChatServiceImpl implements GroupChatService {
logger.info("匹配群客户,externalUserId");
user.setMemberId(related.getMemberId());
user.setUserType(3);
Long groupChatId = user.getGroupChatId() ;
TabGroupChat group = this.groupChatMapper.selectById(groupChatId) ;
if(null != group) {
this.externalMemberService.updateMemberGrowth(related.getEnterpriseId(),related.getMemberId(), EnterpriseGrowthRuleEnum.ADD_HAOBAN_GROUP.getRuleCode(), "群信息",group.getName() + "(" + groupChatId + ")");
}
}
}
}
......
......@@ -3,6 +3,12 @@ package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.ToolUtil;
import com.gic.member.ext.api.dto.growth.req.MemberGrowthOperationReq;
import com.gic.member.ext.api.enums.growth.EnterpriseGrowthRuleEnum;
import com.gic.member.ext.api.service.MemberGrowthWriteApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -35,6 +41,8 @@ public class ExternalMemberServiceImpl implements ExternalMemberService {
private TabHaobanExternalClerkRelatedMapper tabHaobanExternalClerkRelatedMapper ;
@Autowired
private MemberService memberService ;
@Autowired
private MemberGrowthWriteApiService memberGrowthWriteApiService ;
@Override
public int insert(ExternalMemberLogDTO log) {
......@@ -90,4 +98,21 @@ public class ExternalMemberServiceImpl implements ExternalMemberService {
}
}
public void updateMemberGrowth(String enterpriseId , String memberId , String ruleCode , String title , String remark) {
try {
MemberGrowthOperationReq req = new MemberGrowthOperationReq();
req.setEnterpriseId(enterpriseId);
req.setMemberId(memberId);
req.setRuleCode(ruleCode);
req.setChannelCode(com.gic.enterprise.api.enums.PlatformChannelEnum.C_WORK_WECHAT.getChannelCode());
req.setOuterChangeId(ToolUtil.randomUUID());
req = req.desc(title, remark);
ServiceResponse<Long> resp = this.memberGrowthWriteApiService.updateMemberGrowth(req);
logger.info("调用成长值={},{}", JSONObject.toJSONString(req), JSONObject.toJSONString(resp));
}catch (Exception e) {
logger.info("异常",e);
}
}
}
......@@ -9,6 +9,7 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.util.EventUtils;
import com.gic.haoban.manage.service.util.HBQwMonitorUtils;
import com.gic.member.ext.api.enums.growth.EnterpriseGrowthRuleEnum;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -748,13 +749,18 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if (StringUtils.isNotBlank(mobile)) {
memberId = memberService.getMemberIdByPhoneNumber(mobile, enterpriseId);
}
boolean flag = false ;
if (null == memberId) {
memberId = this.getMeberId(enterpriseId,unionId, name, avatar, qrcodeParam, externalUserid, wxEnterpriseRelated.getWxEnterpriseType(), 2 , dto.getAddCreateTime()) ;
memberId = this.getMeberId(enterpriseId,unionId, name, avatar, qrcodeParam, externalUserid, wxEnterpriseRelated.getWxEnterpriseType(), 2 , dto.getAddCreateTime(),clerkId) ;
flag = true ;
}
if (memberId == null) {
log.info("新增外部联系人,创建member失败,unionid={},外部联系人id={},", unionId,externalUserid);
return "";
}
if(!flag) {
this.updateMemberGrowth(enterpriseId,memberId,clerkId);
}
String storeId = staffClerkRelationDTO.getStoreId();
this.saveExternalClerk(memberId, staffId, dto, staffClerkRelationDTO , 1);
// this.sendWelcome(dto, qwDTO, enterpriseId, staffId, clerkId,memberId);
......@@ -1961,7 +1967,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("导购码不存在:" + clerkId);
qrcodeParam = "clerk_clerk_"+clerk.getClerkId() ;
}
String memberId = this.getMeberId(enterpriseId, externalUserDTO.getUnionId(), externalUserDTO.getName(), externalUserDTO.getAvatar(), qrcodeParam, externalUserDTO.getExternalUserId(), wxEnterpriseRelated.getWxEnterpriseType(), 1 , externalUserDTO.getAddCreateTime()) ;
String memberId = this.getMeberId(enterpriseId, externalUserDTO.getUnionId(), externalUserDTO.getName(), externalUserDTO.getAvatar(), qrcodeParam, externalUserDTO.getExternalUserId(), wxEnterpriseRelated.getWxEnterpriseType(), 1 , externalUserDTO.getAddCreateTime(),clerk.getClerkId()) ;
if (memberId == null) {
return "会员不存在:unionid:" + externalUserDTO.getUnionId();
}
......@@ -1969,7 +1975,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return this.saveExternalUser(externalUserDTO);
}
private String getMeberId(String enterpriseId , String unionid , String name , String image ,String qrcodeParam , String externalUserId , int wxEnterpriseType , int sence , String qwTime) {
private String getMeberId(String enterpriseId , String unionid , String name , String image ,String qrcodeParam , String externalUserId , int wxEnterpriseType , int sence , String qwTime,String clerkId) {
QywxMemberQDTO qdto = new QywxMemberQDTO() ;
qdto.setEnterpriseId(enterpriseId);
qdto.setNick(name);
......@@ -1990,10 +1996,22 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
if(resp.isSuccess()) {
MemberSimpleDetailDTO member = resp.getResult() ;
memberId = member.getMemberId() ;
this.updateMemberGrowth(enterpriseId,memberId,clerkId);
}
return memberId ;
}
private void updateMemberGrowth(String enterpriseId,String memberId , String clerkId) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId);
if(clerkDTO != null && null != clerkDTO.getStoreId()) {
String storeId = clerkDTO.getStoreId() ;
StoreDTO storeDTO = storeService.getStore(storeId);
if(null != storeDTO) {
this.externalMemberService.updateMemberGrowth(enterpriseId, memberId, EnterpriseGrowthRuleEnum.ADD_HAOBAN_FRIEND.getRuleCode(), "导购信息", clerkDTO.getClerkName() + "(" + clerkDTO.getClerkCode() + ") , " + storeDTO.getStoreName() + "(" + storeDTO.getStoreCode() + ")");
}
}
}
private void updateExternalStatus(String externalUserId , String staffId) {
List<TabHaobanExternalClerkRelated> tabHaobanExternalClerkRelatedList = externalClerkRelatedService.listByExternalUseridAndWxUserId(externalUserId, staffId);
if (CollectionUtils.isEmpty(tabHaobanExternalClerkRelatedList)) {
......@@ -2004,4 +2022,6 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
TabHaobanExternalClerkRelated related = tabHaobanExternalClerkRelatedList.get(0);
this.externalClerkRelatedMapper.updateExternalStatusById(related.getExternalClerkRelatedId(),1) ;
}
}
......@@ -238,6 +238,6 @@
<dubbo:reference interface="com.gic.content.api.service.ContentMaterialApiService" id="contentMaterialApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.content.api.service.ContentSettingApiService" id="contentSettingApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.clerk.api.service.MenuApiService" id="menuApiService" timeout="10000" retries="0" check="false" />
<dubbo:reference interface="com.gic.member.ext.api.service.MemberGrowthWriteApiService" id="memberGrowthWriteApiService" timeout="10000" retries="0" check="false" />
</beans>
\ 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