| @@ -8,8 +8,10 @@ import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.TenantThreadLocal; | import com.iformall.common.TenantThreadLocal; | ||||
| import com.iformall.domain.po.WxMall; | import com.iformall.domain.po.WxMall; | ||||
| import com.iformall.domain.po.base.BaseCUserEntity; | import com.iformall.domain.po.base.BaseCUserEntity; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.service.CUserTokenService; | import com.iformall.service.CUserTokenService; | ||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.WxMallService; | import com.iformall.service.WxMallService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -33,6 +35,9 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| @Autowired | @Autowired | ||||
| private CUserTokenService cUserTokenService; | private CUserTokenService cUserTokenService; | ||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Autowired | @Autowired | ||||
| private WxMallService wxMallService; | private WxMallService wxMallService; | ||||
| @@ -112,6 +117,13 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { | |||||
| request.setAttribute(Constant.REQUEST_C_USER_KEY, cUser); | request.setAttribute(Constant.REQUEST_C_USER_KEY, cUser); | ||||
| if(cUser.basicInfoIs()){ | if(cUser.basicInfoIs()){ | ||||
| request.setAttribute(Constant.LOGIN_MEMBER_KEY, cUser.getUserId()); | request.setAttribute(Constant.LOGIN_MEMBER_KEY, cUser.getUserId()); | ||||
| if(!cUser.getTenantId().equals(tenantId)){ | |||||
| //标记会员 | |||||
| TenantEntity mallTenant = new TenantEntity(); | |||||
| mallTenant.setTenantId(tenantId); | |||||
| mallTenant.setParentTenantId(parenTenantId); | |||||
| wxCUserBasicInfoService.updateTenantIdMsg(cUser,mallTenant,cUser.getUserId()); | |||||
| } | |||||
| }else{ | }else{ | ||||
| request.setAttribute(Constant.LOGIN_MEMBER_KEY, null); | request.setAttribute(Constant.LOGIN_MEMBER_KEY, null); | ||||
| } | } | ||||
| @@ -70,6 +70,9 @@ public class MqBaseConsumer { | |||||
| @Autowired | @Autowired | ||||
| private FmInsideBasicUserPushMsgServiceImpl fmInsideBasicUserPushMsgServiceImpl; | private FmInsideBasicUserPushMsgServiceImpl fmInsideBasicUserPushMsgServiceImpl; | ||||
| @Autowired | |||||
| private FmInsideBasicUserTenantMsgServiceImpl FmInsideBasicUserTenantMsgService; | |||||
| @@ -205,6 +208,12 @@ public class MqBaseConsumer { | |||||
| fmInsideBasicUserPushMsgServiceImpl.send(msg); | fmInsideBasicUserPushMsgServiceImpl.send(msg); | ||||
| } | } | ||||
| else if(EnumMsgRecordType.MEMBER_UPDATE_TENANT.getCode().equals(baseMsg.getMsgType())) { | |||||
| // 内部消息 - 集团会员广场标签 | |||||
| FmInsideBasicUserPushMsg msg = (FmInsideBasicUserPushMsg)JsonUtil.readValue(message,FmInsideBasicUserPushMsg.class); | |||||
| FmInsideBasicUserTenantMsgService.send(msg); | |||||
| } | |||||
| }catch (Throwable e){ | }catch (Throwable e){ | ||||
| log.error("consum received error: ", e); | log.error("consum received error: ", e); | ||||
| /** | /** | ||||
| @@ -32,6 +32,7 @@ public enum EnumMsgRecordType { | |||||
| INSIDE_PRODUCT_PUSH(109, "商品状态或库存同步"), | INSIDE_PRODUCT_PUSH(109, "商品状态或库存同步"), | ||||
| MALL_COO_USER_PUSH(110, "猫酷同步会员"), | MALL_COO_USER_PUSH(110, "猫酷同步会员"), | ||||
| MEMBER_UPDATE_TENANT(111, "集团会员标签广场"), | |||||
| INSIDE_ORDER_PUSH_DELIVERY(200, "2.0核销同步"), | INSIDE_ORDER_PUSH_DELIVERY(200, "2.0核销同步"), | ||||
| ; | ; | ||||
| @@ -174,5 +174,9 @@ public interface WxCUserBasicInfoService { | |||||
| int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType wechatPhone); | int addCredit(Long userId, TenantEntity tenantInfo, EnumScoreType wechatPhone); | ||||
| void registerJinmao(TenantEntity tenantInfo,WxCUserBasicInfo basicInfo); | void registerJinmao(TenantEntity tenantInfo,WxCUserBasicInfo basicInfo); | ||||
| void updateTenantIdMsg(TenantEntity tenantInfo, TenantEntity mallTenant, Long userId); | |||||
| void updateTenantId(String finalTenantId, String tenantId, Long userId); | |||||
| } | } | ||||
| @@ -11,9 +11,11 @@ import com.iformall.domain.dto.WxCUserBasicInfoFilterDto; | |||||
| import com.iformall.domain.dto.WxCUserBasicInfoFilterListDto; | import com.iformall.domain.dto.WxCUserBasicInfoFilterListDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.msg.FmInsideBasicUserPushMsg; | |||||
| import com.iformall.domain.vo.*; | import com.iformall.domain.vo.*; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | import cn.afterturn.easypoi.handler.inter.IExcelExportServer; | ||||
| @@ -95,6 +97,9 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| @Autowired | @Autowired | ||||
| WxMallService wxMallService; | WxMallService wxMallService; | ||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | |||||
| /***************user filter start******************************************/ | /***************user filter start******************************************/ | ||||
| @@ -736,6 +741,29 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService,IExc | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public void updateTenantIdMsg(TenantEntity tenantInfo, TenantEntity mallTenant, Long userId) { | |||||
| FmInsideBasicUserPushMsg basicUserPushMsg = new FmInsideBasicUserPushMsg(); | |||||
| basicUserPushMsg.setMsgType(EnumMsgRecordType.MEMBER_UPDATE_TENANT.getCode()); | |||||
| basicUserPushMsg.updateTenantInfo(tenantInfo); | |||||
| basicUserPushMsg.setMallTenantEntity(mallTenant); | |||||
| basicUserPushMsg.setBasicUserId(userId); | |||||
| mqBaseProducer.sendMessage(basicUserPushMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } | |||||
| @Override | |||||
| public void updateTenantId(String finalTenantId, String tenantId, Long userId) { | |||||
| WxCUserBasicInfo basicInfo = this.getById(userId, finalTenantId); | |||||
| if(basicInfo != null && !basicInfo.getTenantId().contains("," + tenantId + ",")){ | |||||
| WxCUserBasicInfo basicInfoUpd = new WxCUserBasicInfo(); | |||||
| basicInfoUpd.setFinalTenantId(finalTenantId); | |||||
| basicInfoUpd.setId(userId); | |||||
| basicInfoUpd.setTenantId(basicInfo.getTenantId() + tenantId + ","); | |||||
| wxCUserBasicInfoMapper.updateById(basicInfoUpd); | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| public WxCUserBasicInfo getById(Long id,String finalTenantId) { | public WxCUserBasicInfo getById(Long id,String finalTenantId) { | ||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.service.msg.impl; | |||||
| import com.iformall.domain.po.msg.BaseMsg; | |||||
| import com.iformall.domain.po.msg.FmInsideBasicUserPushMsg; | |||||
| import com.iformall.service.MallCooUserInfoService; | |||||
| import com.iformall.service.WxCUserBasicInfoService; | |||||
| import com.iformall.service.msg.MsgSendService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| /** | |||||
| * | |||||
| * @author Stormeye Wu | |||||
| * @date 2019/5/10 | |||||
| */ | |||||
| @Service | |||||
| public class FmInsideBasicUserTenantMsgServiceImpl implements MsgSendService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| @Override | |||||
| public void send(BaseMsg baseMsg) throws Exception{ | |||||
| FmInsideBasicUserPushMsg msg = (FmInsideBasicUserPushMsg)baseMsg; | |||||
| wxCUserBasicInfoService.updateTenantId(msg.getFinalTenantId(),msg.getMallTenantEntity().getTenantId(),msg.getBasicUserId()); | |||||
| } | |||||
| } | |||||