点单小程序跳转

This commit is contained in:
俞扬
2023-09-19 16:46:51 +08:00
parent 645d0ebe75
commit cb15d0e045
3 changed files with 27 additions and 10 deletions

View File

@@ -5,15 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.dto.wx.*;
import com.cool.store.entity.HyOpenAreaInfoDO;
import com.cool.store.entity.HyPartnerLineInfoDO;
import com.cool.store.entity.HyPartnerUserInfoDO;
import com.cool.store.entity.HyPartnerUserPlatformBindDO;
import com.cool.store.entity.*;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.UserChannelEnum;
import com.cool.store.enums.UserPlatformTypeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.http.WechatRest;
import com.cool.store.mapper.HyPartnerUserChannelMapper;
import com.cool.store.request.MobileUpdateRequest;
import com.cool.store.service.HyPhoneLocationService;
import com.cool.store.service.WechatMiniAppService;
@@ -24,12 +22,14 @@ import com.cool.store.vo.PartnerUserInfoVO;
import com.cool.store.vo.wx.MiniProgramUserVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.MessageFormat;
import java.util.Date;
import java.util.Objects;
/**
* @author zhangchenbiao
@@ -58,6 +58,9 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
@Resource
HyPhoneLocationService hyPhoneLocationService;
@Autowired
private HyPartnerUserChannelMapper hyPartnerUserChannelMapper;
@Value("${weixin.appId}")
private String wxAppId;
@Value("${weixin.appSecret}")
@@ -116,11 +119,23 @@ public class WechatMiniAppServiceImpl implements WechatMiniAppService {
hyPartnerUserInfoDO.setPartnerId(UUIDUtils.get32UUID());
hyPartnerUserInfoDO.setIsWritePartnerKnow(0);
Integer channelId = null;
if (param.getUserChannelEnum()!=null && UserChannelEnum.EXHIBITION.getCode().equals(param.getUserChannelEnum().getCode())){
channelId = exhibition;
}
if (param.getUserChannelEnum()!=null && UserChannelEnum.RECOMMENDED.getCode().equals(param.getUserChannelEnum().getCode())){
channelId = recommended;
String userChannel = param.getUserChannelEnum();
if(StringUtils.isNotEmpty(userChannel)){
if(UserChannelEnum.EXHIBITION.getCode().equals(userChannel)){
channelId = exhibition;
}else if(UserChannelEnum.RECOMMENDED.getCode().equals(userChannel)){
channelId = recommended;
}else {
if (StringUtils.isNumeric(userChannel)) {
channelId = Integer.valueOf(userChannel);
HyPartnerUserChannelDO hyPartnerUserChannelDO = hyPartnerUserChannelMapper.selectByChannelId(Long.valueOf(channelId));
if (Objects.isNull(hyPartnerUserChannelDO)|| hyPartnerUserChannelDO.getChannelId() == null ) {
//用户渠道不存在
throw new ServiceException(ErrorCodeEnum.USER_CHANNEL_NOT_EXISTS);
}
}
}
}
hyPartnerUserInfoDO.setUserChannelId(channelId);
hyPartnerUserInfoDAO.insertSelective(hyPartnerUserInfoDO);