| @@ -696,8 +696,13 @@ public class WxUserGrantController extends BaseController { | |||||
| record.setUpdChild(true); | record.setUpdChild(true); | ||||
| wxCUserBasicInfoService.update(record); | wxCUserBasicInfoService.update(record); | ||||
| //推送猫酷 | |||||
| mallCooUserInfoService.pullByMobile(tenantEntity, record); | |||||
| try{ | |||||
| //推送猫酷 | |||||
| mallCooUserInfoService.pullByMobileMsg(tenantEntity, record.getId()); | |||||
| }catch(Exception e){ | |||||
| logger.error("发送同步会员消息异常"); | |||||
| } | |||||
| wxScoreRulesService.addScore(tenantEntity,EnumScoreType.COMPLETE_INFO, record); | wxScoreRulesService.addScore(tenantEntity,EnumScoreType.COMPLETE_INFO, record); | ||||
| //增加积分 | //增加积分 | ||||
| @@ -55,6 +55,9 @@ public class MqBaseConsumer { | |||||
| @Autowired | @Autowired | ||||
| private FmInsideProductPushMsgServiceImpl fmInsideProductPushMsgServiceImpl; | private FmInsideProductPushMsgServiceImpl fmInsideProductPushMsgServiceImpl; | ||||
| @Autowired | |||||
| private FmInsideBasicUserPushMsgServiceImpl fmInsideBasicUserPushMsgServiceImpl; | |||||
| @@ -140,6 +143,12 @@ public class MqBaseConsumer { | |||||
| fmInsideProductPushMsgServiceImpl.send(msg); | fmInsideProductPushMsgServiceImpl.send(msg); | ||||
| } | } | ||||
| else if(EnumMsgRecordType.MALL_COO_USER_PUSH.getCode().equals(baseMsg.getMsgType())) { | |||||
| // 内部消息 - 同步会员 | |||||
| FmInsideBasicUserPushMsg msg = (FmInsideBasicUserPushMsg)JsonUtil.readValue(message,FmInsideBasicUserPushMsg.class); | |||||
| fmInsideBasicUserPushMsgServiceImpl.send(msg); | |||||
| } | |||||
| }catch (Throwable e){ | }catch (Throwable e){ | ||||
| log.error("consum received error: ", e); | log.error("consum received error: ", e); | ||||
| /** | /** | ||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.domain.po.msg; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| @Data | |||||
| @ToString(callSuper = true) | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| public class FmInsideBasicUserPushMsg extends BaseMsg{ | |||||
| @io.swagger.annotations.ApiModelProperty(value = "会员Id", name = "basicUserId") | |||||
| private Long basicUserId; | |||||
| } | |||||
| @@ -25,7 +25,6 @@ public enum EnumMsgRecordType { | |||||
| INSIDE_PRODUCT_PUSH(109, "商品状态或库存同步"), | INSIDE_PRODUCT_PUSH(109, "商品状态或库存同步"), | ||||
| MALL_COO_USER_PUSH(110, "猫酷同步会员"), | MALL_COO_USER_PUSH(110, "猫酷同步会员"), | ||||
| ORDER_SNAPSHOT_PUSH(111, "订单快照"), | |||||
| ; | ; | ||||
| public static EnumMsgRecordType getEnum(Integer code) { | public static EnumMsgRecordType getEnum(Integer code) { | ||||
| @@ -26,7 +26,8 @@ public interface MallCooUserInfoService { | |||||
| MallCooUserInfo getByPhone(String phone,String finalTenantId); | MallCooUserInfo getByPhone(String phone,String finalTenantId); | ||||
| void pullByMobile(TenantEntity tenantEntity, WxCUserBasicInfo basicInfo); | |||||
| void pullByMobile(TenantEntity tenantEntity, Long basicUserId); | |||||
| void pullByMobileMsg(TenantEntity tenantEntity, Long id); | |||||
| } | } | ||||
| @@ -159,8 +159,12 @@ public class BasicCUserService { | |||||
| // 外部注券 | // 外部注券 | ||||
| memCouponFromDspService.couponOrderFromDsp(tenantEntity, userPhone); | memCouponFromDspService.couponOrderFromDsp(tenantEntity, userPhone); | ||||
| //推送猫酷 | |||||
| mallCooUserInfoService.pullByMobile(tenantEntity, basicInfo); | |||||
| try{ | |||||
| //推送猫酷 | |||||
| mallCooUserInfoService.pullByMobileMsg(tenantEntity, basicInfo.getId()); | |||||
| }catch(Exception e){ | |||||
| logger.error("发送同步会员消息异常"); | |||||
| } | |||||
| return basicInfo.getId(); | return basicInfo.getId(); | ||||
| } | } | ||||
| @@ -1,21 +1,21 @@ | |||||
| package com.iformall.service.impl; | package com.iformall.service.impl; | ||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| 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.enums.EnumThirdPartyConfigType; | |||||
| import com.iformall.domain.po.msg.FmInsideBasicUserPushMsg; | |||||
| import com.iformall.enums.*; | |||||
| import com.iformall.mallcoo.MallcooHelper; | import com.iformall.mallcoo.MallcooHelper; | ||||
| import com.iformall.mallcoo.McUserInfo; | import com.iformall.mallcoo.McUserInfo; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| import com.iformall.mq.MqBaseProducer; | |||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.scheduling.annotation.Async; | |||||
| import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -34,6 +34,9 @@ public class MallCooUserInfoServiceImpl implements MallCooUserInfoService { | |||||
| @Autowired | @Autowired | ||||
| WxThirdPartyConfigMapper wxThirdPartyConfigMapper; | WxThirdPartyConfigMapper wxThirdPartyConfigMapper; | ||||
| @Autowired | |||||
| private MqBaseProducer mqBaseProducer; | |||||
| @Override | @Override | ||||
| public PageInfo<MallCooUserInfo> listAsPage(MallCooUserInfo record, Integer pageIndex, Integer pageSize) { | public PageInfo<MallCooUserInfo> listAsPage(MallCooUserInfo record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -54,18 +57,18 @@ public class MallCooUserInfoServiceImpl implements MallCooUserInfoService { | |||||
| return mallCooUserInfoMapper.selectOne(new QueryWrapper<>(userInfo)); | return mallCooUserInfoMapper.selectOne(new QueryWrapper<>(userInfo)); | ||||
| } | } | ||||
| @Async | |||||
| @Override | @Override | ||||
| public void pullByMobile(TenantEntity tenantEntity, WxCUserBasicInfo basicInfo) { | |||||
| public void pullByMobile(TenantEntity tenantEntity, Long basicUserId) { | |||||
| try{ | try{ | ||||
| WxThirdPartyConfig config = getThirdPartyConfig(tenantEntity); | WxThirdPartyConfig config = getThirdPartyConfig(tenantEntity); | ||||
| if(config == null){ | if(config == null){ | ||||
| logger.error("未找到猫酷配置信息"); | logger.error("未找到猫酷配置信息"); | ||||
| return; | return; | ||||
| } | } | ||||
| if(StringUtils.isBlank(basicInfo.getPhone())){ | |||||
| basicInfo = wxCUserBasicInfoMapper.selectById(basicInfo.getId(),basicInfo.getFinalTenantId()); | |||||
| WxCUserBasicInfo basicInfo = wxCUserBasicInfoMapper.selectById(basicUserId, tenantEntity.getFinalTenantId()); | |||||
| if(null == basicInfo){ | |||||
| logger.error("未找到会员信息"+basicUserId); | |||||
| return; | |||||
| } | } | ||||
| MallCooUserInfo mallCooUserInfo = this.getByPhone(basicInfo.getPhone(), basicInfo.getFinalTenantId()); | MallCooUserInfo mallCooUserInfo = this.getByPhone(basicInfo.getPhone(), basicInfo.getFinalTenantId()); | ||||
| if(mallCooUserInfo == null){ | if(mallCooUserInfo == null){ | ||||
| @@ -109,6 +112,16 @@ public class MallCooUserInfoServiceImpl implements MallCooUserInfoService { | |||||
| } | } | ||||
| @Override | |||||
| public void pullByMobileMsg(TenantEntity tenantEntity, Long id) { | |||||
| FmInsideBasicUserPushMsg basicUserPushMsg = new FmInsideBasicUserPushMsg(); | |||||
| basicUserPushMsg.setMsgType(EnumMsgRecordType.MALL_COO_USER_PUSH.getCode()); | |||||
| basicUserPushMsg.updateTenantInfo(tenantEntity); | |||||
| basicUserPushMsg.setBasicUserId(id); | |||||
| logger.info(">>>>>>>>>>>send pullByMobileMsg :"+basicUserPushMsg); | |||||
| mqBaseProducer.sendMessage(basicUserPushMsg, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); | |||||
| } | |||||
| private WxThirdPartyConfig getThirdPartyConfig(TenantEntity tenantEntity){ | private WxThirdPartyConfig getThirdPartyConfig(TenantEntity tenantEntity){ | ||||
| WxThirdPartyConfig configQ = new WxThirdPartyConfig(); | WxThirdPartyConfig configQ = new WxThirdPartyConfig(); | ||||
| configQ.updateTenantInfo(tenantEntity); | configQ.updateTenantInfo(tenantEntity); | ||||
| @@ -67,7 +67,6 @@ public class OrderSnapshotServiceImpl implements OrderSnapshotService { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到订单数据"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到订单数据"); | ||||
| } | } | ||||
| @Async | |||||
| @Override | @Override | ||||
| public void saveOrderSnapshot(WxOrder order) { | public void saveOrderSnapshot(WxOrder order) { | ||||
| try{ | try{ | ||||
| @@ -213,6 +213,9 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| @Lazy | @Lazy | ||||
| @Autowired | @Autowired | ||||
| private WxMsgService wxMsgService; | private WxMsgService wxMsgService; | ||||
| @Autowired | |||||
| private OrderSnapshotService orderSnapshotService; | |||||
| @Override | @Override | ||||
| public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) { | ||||
| @@ -2064,6 +2067,8 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| * @param user | * @param user | ||||
| */ | */ | ||||
| public void actionAfterCouponOrderSuccess(WxOrder order, WxCoupon coupon, WxCUserBasicInfo user) { | public void actionAfterCouponOrderSuccess(WxOrder order, WxCoupon coupon, WxCUserBasicInfo user) { | ||||
| if(EnumCouponType.COUPON_GIFT.getCode().equals(coupon.getType())){ | if(EnumCouponType.COUPON_GIFT.getCode().equals(coupon.getType())){ | ||||
| WxCouponOrder couponOrderQ = new WxCouponOrder(); | WxCouponOrder couponOrderQ = new WxCouponOrder(); | ||||
| couponOrderQ.setOrderId(order.getId()); | couponOrderQ.setOrderId(order.getId()); | ||||
| @@ -2078,7 +2083,13 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| logger.error("系统券包核销异常:" + e.getMessage(),e); | logger.error("系统券包核销异常:" + e.getMessage(),e); | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| //订单快照 | |||||
| try { | |||||
| orderSnapshotService.saveOrderSnapshot(order); | |||||
| } catch (Exception e) { | |||||
| logger.error("订单快照error:" + e.getMessage(),e); | |||||
| } | } | ||||
| /// TODO 晚上会定时打一下tag | /// TODO 晚上会定时打一下tag | ||||
| wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_BUY, user,order,null); | wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_BUY, user,order,null); | ||||
| @@ -935,11 +935,6 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| } | } | ||||
| } | } | ||||
| try{ | |||||
| orderSnapshotService.saveOrderSnapshot(order); | |||||
| }catch(Exception e){ | |||||
| logger.error("订单快照 error"+e.getMessage()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,32 @@ | |||||
| 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.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 FmInsideBasicUserPushMsgServiceImpl implements MsgSendService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private MallCooUserInfoService mallCooUserInfoService; | |||||
| @Override | |||||
| public void send(BaseMsg baseMsg) throws Exception{ | |||||
| FmInsideBasicUserPushMsg msg = (FmInsideBasicUserPushMsg)baseMsg; | |||||
| mallCooUserInfoService.pullByMobile(msg.getTenantInfo(),msg.getBasicUserId()); | |||||
| } | |||||
| } | |||||