点单小程序跳转

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

@@ -96,6 +96,8 @@ public enum ErrorCodeEnum {
CREATE_CALL_REQUEST_ERROR(10211160, "创建电话请求失败!", null),
CREATE_APPOINTMENT_TIME_ERROR(10211161, "当前时间不可预约面试,请选择其他时间", null),
USER_CHANNEL_NOT_EXISTS(10211162, "当前用户渠道不存在", null),
CONTENT_DUPLICATED(10211200, "动态标题重复!", null),
SIGN_FAIL(600000, "验签失败", null),
GET_ACCESSTOKEN_ERROR(600001, "获取小程序TOKEN错误", null),

View File

@@ -26,5 +26,5 @@ public class MiniProgramLoginDTO {
@NotBlank(message = "ivStr不能为空")
private String ivStr;
private UserChannelEnum userChannelEnum;
private String userChannelEnum;
}

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