Просмотр исходного кода

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real_202204_refund

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
5e8a2cbe4a
18 измененных файлов: 145 добавлений и 47 удалений
  1. +12
    -12
      mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java
  2. +1
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java
  3. +7
    -2
      mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java
  4. +9
    -0
      mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java
  5. +15
    -0
      mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideBasicUserPushMsg.java
  6. +2
    -0
      mallinkService/src/main/java/com/iformall/domain/vo/WxCouponCVo.java
  7. +4
    -2
      mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebGetRequestExecutor.java
  8. +4
    -2
      mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPostRequestExecutor.java
  9. +2
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java
  10. +2
    -1
      mallinkService/src/main/java/com/iformall/service/MallCooUserInfoService.java
  11. +6
    -2
      mallinkService/src/main/java/com/iformall/service/cuser/BasicCUserService.java
  12. +21
    -8
      mallinkService/src/main/java/com/iformall/service/impl/MallCooUserInfoServiceImpl.java
  13. +0
    -1
      mallinkService/src/main/java/com/iformall/service/impl/OrderSnapshotServiceImpl.java
  14. +9
    -4
      mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java
  15. +8
    -8
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java
  16. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  17. +0
    -5
      mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java
  18. +32
    -0
      mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPushMsgServiceImpl.java

+ 12
- 12
mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java Просмотреть файл

@@ -164,18 +164,18 @@ public class TtMerchantPoiController extends BaseController {
if(couponChannelId == null){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
String merchantIdStr = param.get("merchantIds");
List<Long> merchantIds = new ArrayList<>();
try{
List<String> strings = Arrays.asList(merchantIdStr.split(","));
merchantIds = strings.stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
}catch(Exception e){
return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR);
}
if(merchantIds == null || merchantIds.size() == 0){
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
}
return ttMerchantPoiService.spuSync(getTenantInfo(),couponChannelId,merchantIds);
// String merchantIdStr = param.get("merchantIds");
// List<Long> merchantIds = new ArrayList<>();
// try{
// List<String> strings = Arrays.asList(merchantIdStr.split(","));
// merchantIds = strings.stream().map(s -> Long.parseLong(s.trim())).collect(Collectors.toList());
// }catch(Exception e){
// return new ResultData(ErrorCode.SYS_PARAMETER_CAST_ERROR);
// }
// if(merchantIds == null || merchantIds.size() == 0){
// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL);
// }
return ttMerchantPoiService.spuSync(getTenantInfo(),couponChannelId,null);
}

@ApiOperation("商品同步查询")


+ 1
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxCouponController.java Просмотреть файл

@@ -266,6 +266,7 @@ public class WxCouponController extends BaseController {
wxcv.setBeginTime(cc.getBeginTime());
wxcv.setEndTime(cc.getEndTime());
wxcv.setQrCode(cc.getQrCode());
wxcv.setTtSpuId(cc.getTtSpuId());
return wxcv;
}else if(couponIdL > 0l){
WxCouponCVo wxcv = couponService.getVoById(couponIdL,tenantId);


+ 7
- 2
mallinkCApi/src/main/java/com/iformall/controller/WxUserGrantController.java Просмотреть файл

@@ -696,8 +696,13 @@ public class WxUserGrantController extends BaseController {
record.setUpdChild(true);
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);
//增加积分


+ 9
- 0
mallinkMQConsumer/src/main/java/com/iformall/mq/MqBaseConsumer.java Просмотреть файл

@@ -55,6 +55,9 @@ public class MqBaseConsumer {

@Autowired
private FmInsideProductPushMsgServiceImpl fmInsideProductPushMsgServiceImpl;

@Autowired
private FmInsideBasicUserPushMsgServiceImpl fmInsideBasicUserPushMsgServiceImpl;


@@ -140,6 +143,12 @@ public class MqBaseConsumer {
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){
log.error("consum received error: ", e);
/**


+ 15
- 0
mallinkService/src/main/java/com/iformall/domain/po/msg/FmInsideBasicUserPushMsg.java Просмотреть файл

@@ -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;

}

+ 2
- 0
mallinkService/src/main/java/com/iformall/domain/vo/WxCouponCVo.java Просмотреть файл

@@ -37,6 +37,8 @@ public class WxCouponCVo extends WxCoupon implements Serializable {
private String qrCode;
@TableField(exist = false)
private String ttQrCode;
@TableField(exist = false)
private String ttSpuId;


@io.swagger.annotations.ApiModelProperty(value="券ID",name="couponId")


+ 4
- 2
mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebGetRequestExecutor.java Просмотреть файл

@@ -45,8 +45,7 @@ public class TtWebGetRequestExecutor implements RequestExecutor<String, String>

@Override
public String execute(String uri, String queryParam, WxType wxType) throws WxErrorException, IOException {
logger.info("uri{}"+uri);
logger.info("request{}"+queryParam);

String access_token = handleUrl(uri);
if(StringUtils.isBlank(access_token)){
WxError wxError = WxError.fromJson("{\n" +
@@ -66,6 +65,9 @@ public class TtWebGetRequestExecutor implements RequestExecutor<String, String>
HttpGet httpGet = new HttpGet(uri);
httpGet.addHeader("Content-Type","application/json");
httpGet.addHeader("access-token",access_token);
logger.info("get请求地址uri{}"+uri);
logger.info("header-----access_token{}"+access_token);

if (requestHttp.getRequestHttpProxy() != null) {
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();
httpGet.setConfig(config);


+ 4
- 2
mallinkService/src/main/java/com/iformall/douyin/web/api/TtWebPostRequestExecutor.java Просмотреть файл

@@ -46,8 +46,7 @@ public class TtWebPostRequestExecutor implements RequestExecutor<String, String>

@Override
public String execute(String uri, String postEntity, WxType wxType) throws WxErrorException, IOException {
logger.info("uri{}"+uri);
logger.info("request{}"+postEntity);

String access_token = handleUrl(uri);
if(StringUtils.isBlank(access_token)){
WxError wxError = WxError.fromJson("{\n" +
@@ -60,6 +59,9 @@ public class TtWebPostRequestExecutor implements RequestExecutor<String, String>
HttpPost httpPost = new HttpPost(uri);
httpPost.addHeader("Content-Type","application/json");
httpPost.addHeader("access-token",access_token);
logger.info("post请求地址uri{}"+uri);
logger.info("header-----access_token{}"+access_token);
logger.info("请求参数{}"+postEntity);

if (requestHttp.getRequestHttpProxy() != null) {
RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build();


+ 2
- 0
mallinkService/src/main/java/com/iformall/enums/EnumMsgRecordType.java Просмотреть файл

@@ -23,6 +23,8 @@ public enum EnumMsgRecordType {
INSIDE_ORDER_REFUND(107, "退款提交成功"),
INSIDE_ORDER_PUSH(108, "订单同步"),
INSIDE_PRODUCT_PUSH(109, "商品状态或库存同步"),

MALL_COO_USER_PUSH(110, "猫酷同步会员"),
;

public static EnumMsgRecordType getEnum(Integer code) {


+ 2
- 1
mallinkService/src/main/java/com/iformall/service/MallCooUserInfoService.java Просмотреть файл

@@ -26,7 +26,8 @@ public interface MallCooUserInfoService {

MallCooUserInfo getByPhone(String phone,String finalTenantId);

void pullByMobile(TenantEntity tenantEntity, WxCUserBasicInfo basicInfo);
void pullByMobile(TenantEntity tenantEntity, Long basicUserId);

void pullByMobileMsg(TenantEntity tenantEntity, Long id);
}


+ 6
- 2
mallinkService/src/main/java/com/iformall/service/cuser/BasicCUserService.java Просмотреть файл

@@ -159,8 +159,12 @@ public class BasicCUserService {
// 外部注券
memCouponFromDspService.couponOrderFromDsp(tenantEntity, userPhone);

//推送猫酷
mallCooUserInfoService.pullByMobile(tenantEntity, basicInfo);
try{
//推送猫酷
mallCooUserInfoService.pullByMobileMsg(tenantEntity, basicInfo.getId());
}catch(Exception e){
logger.error("发送同步会员消息异常");
}

return basicInfo.getId();
}


+ 21
- 8
mallinkService/src/main/java/com/iformall/service/impl/MallCooUserInfoServiceImpl.java Просмотреть файл

@@ -1,21 +1,21 @@
package com.iformall.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.iformall.domain.po.*;
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.McUserInfo;
import com.iformall.mapper.*;
import com.iformall.mq.MqBaseProducer;
import com.iformall.service.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Date;
@@ -34,6 +34,9 @@ public class MallCooUserInfoServiceImpl implements MallCooUserInfoService {
@Autowired
WxThirdPartyConfigMapper wxThirdPartyConfigMapper;

@Autowired
private MqBaseProducer mqBaseProducer;


@Override
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));
}

@Async
@Override
public void pullByMobile(TenantEntity tenantEntity, WxCUserBasicInfo basicInfo) {
public void pullByMobile(TenantEntity tenantEntity, Long basicUserId) {
try{
WxThirdPartyConfig config = getThirdPartyConfig(tenantEntity);
if(config == null){
logger.error("未找到猫酷配置信息");
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());
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){
WxThirdPartyConfig configQ = new WxThirdPartyConfig();
configQ.updateTenantInfo(tenantEntity);


+ 0
- 1
mallinkService/src/main/java/com/iformall/service/impl/OrderSnapshotServiceImpl.java Просмотреть файл

@@ -67,7 +67,6 @@ public class OrderSnapshotServiceImpl implements OrderSnapshotService {
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到订单数据");
}

@Async
@Override
public void saveOrderSnapshot(WxOrder order) {
try{


+ 9
- 4
mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java Просмотреть файл

@@ -579,18 +579,23 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService {
if(!EnumCouponType.getSpuSyncType().contains(coupon.getType())){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"卷类型不支持同步poi");
}
List<Long> couponMerchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), tenantInfo.getTenantId());
if(couponMerchantIds == null || couponMerchantIds.size() == 0 ){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到门店");
}

TtMerchantPoi poi = new TtMerchantPoi();
poi.updateTenantInfo(tenantInfo);
poi.setIds(merchantIds);
poi.setIds(couponMerchantIds);
poi.setMatchStatus(EnumSupplierMathStatus.match_success.getCode());
poi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode());
List<TtMerchantPoi> poiList = ttMerchantPoiMapper.findList(poi);
if(merchantIds.size() != poiList.size()){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到poi或poi不匹配");
if(poiList == null || poiList.isEmpty()){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到可用poi");
}
List<Long> collect = poiList.stream().map(p -> p.getId()).collect(Collectors.toList());

String spuId = spuSync(coupon,couponChannel,merchantIds);
String spuId = spuSync(coupon,couponChannel,collect);
if(StringUtils.isBlank(spuId)){
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败");
}


+ 8
- 8
mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java Просмотреть файл

@@ -969,13 +969,13 @@ public class WxCouponServiceImpl implements WxCouponService {
}

private void spuStockSync(TenantEntity tenantEntity,Long id){
new Thread(() -> {
//1秒之后同步poi
try {
Thread.currentThread().sleep(1000);
} catch (Exception e) {
logger.error("sleep error: " + e.getMessage());
}
// new Thread(() -> {
// //1秒之后同步poi
// try {
// Thread.currentThread().sleep(1000);
// } catch (Exception e) {
// logger.error("sleep error: " + e.getMessage());
// }

List<Long> couponChannelIds = wxCouponChannelMapper.getPoiProductIdList(tenantEntity.getTenantId(),id);
if(couponChannelIds != null && couponChannelIds.size() > 0){
@@ -991,7 +991,7 @@ public class WxCouponServiceImpl implements WxCouponService {
}
}

}).start();
// }).start();

}



+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java Просмотреть файл

@@ -213,6 +213,9 @@ public class WxOrderServiceImpl implements WxOrderService {
@Lazy
@Autowired
private WxMsgService wxMsgService;

@Autowired
private OrderSnapshotService orderSnapshotService;
@Override
public PageInfo<WxOrder> listAsPage(WxOrder record, Integer pageIndex, Integer pageSize) {
@@ -2034,6 +2037,8 @@ public class WxOrderServiceImpl implements WxOrderService {
* @param user
*/
public void actionAfterCouponOrderSuccess(WxOrder order, WxCoupon coupon, WxCUserBasicInfo user) {


if(EnumCouponType.COUPON_GIFT.getCode().equals(coupon.getType())){
WxCouponOrder couponOrderQ = new WxCouponOrder();
couponOrderQ.setOrderId(order.getId());
@@ -2048,7 +2053,13 @@ public class WxOrderServiceImpl implements WxOrderService {
logger.error("系统券包核销异常:" + e.getMessage(),e);
}
}
}

//订单快照
try {
orderSnapshotService.saveOrderSnapshot(order);
} catch (Exception e) {
logger.error("订单快照error:" + e.getMessage(),e);
}
/// TODO 晚上会定时打一下tag
wxCUserTagsService.triggerAssignTags(EnumAssignTagsTrigger.ASSIGN_TAGS_TRIGGER_BUY, user,order,null);


+ 0
- 5
mallinkService/src/main/java/com/iformall/service/impl/WxPayOrderServiceImpl.java Просмотреть файл

@@ -936,11 +936,6 @@ public class WxPayOrderServiceImpl implements WxPayOrderService {
}
}

try{
orderSnapshotService.saveOrderSnapshot(order);
}catch(Exception e){
logger.error("订单快照 error"+e.getMessage());
}

}
}


+ 32
- 0
mallinkService/src/main/java/com/iformall/service/msg/impl/FmInsideBasicUserPushMsgServiceImpl.java Просмотреть файл

@@ -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());

}
}

Загрузка…
Отмена
Сохранить