This commit is contained in:
hucs
2024-06-06 10:04:16 +08:00
parent e1e44dbab8
commit 0991ae2638
4 changed files with 9 additions and 4 deletions

View File

@@ -7,6 +7,7 @@ import com.starry.admin.modules.custom.module.vo.PlayCustomRankingQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomRankingReturnVo; import com.starry.admin.modules.custom.module.vo.PlayCustomRankingReturnVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomUserQueryVo; import com.starry.admin.modules.custom.module.vo.PlayCustomUserQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomUserReturnVo; import com.starry.admin.modules.custom.module.vo.PlayCustomUserReturnVo;
import com.starry.admin.modules.order.module.entity.PlayOrderInfoEntity;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.List;
@@ -121,5 +122,5 @@ public interface IPlayCustomUserInfoService extends IService<PlayCustomUserInfoE
List<PlayCustomUserInfoEntity> simpleList(); List<PlayCustomUserInfoEntity> simpleList();
void saveOrderTime(String id); void saveOrderInfo(PlayOrderInfoEntity entity);
} }

View File

@@ -284,12 +284,14 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
} }
@Override @Override
public void saveOrderTime(String id) { public void saveOrderInfo(PlayOrderInfoEntity entity) {
String id = entity.getPurchaserBy();
LambdaUpdateWrapper<PlayCustomUserInfoEntity> wrapper = Wrappers.lambdaUpdate(PlayCustomUserInfoEntity.class).eq(PlayCustomUserInfoEntity::getId, id).set(PlayCustomUserInfoEntity::getLastPurchaseTime, new Date()); LambdaUpdateWrapper<PlayCustomUserInfoEntity> wrapper = Wrappers.lambdaUpdate(PlayCustomUserInfoEntity.class).eq(PlayCustomUserInfoEntity::getId, id).set(PlayCustomUserInfoEntity::getLastPurchaseTime, new Date());
PlayCustomUserInfoEntity userInfoEntity = selectById(id); PlayCustomUserInfoEntity userInfoEntity = selectById(id);
if(Objects.isNull(userInfoEntity.getFirstPurchaseTime())){ if(Objects.isNull(userInfoEntity.getFirstPurchaseTime())){
wrapper.set(PlayCustomUserInfoEntity::getFirstPurchaseTime,new Date()); wrapper.set(PlayCustomUserInfoEntity::getFirstPurchaseTime,new Date());
} }
wrapper.set(PlayCustomUserInfoEntity::getWeiChatCode,entity.getWeiChatCode());
this.update(wrapper); this.update(wrapper);
} }
} }

View File

@@ -108,7 +108,7 @@ public class PlayOrderInfoServiceImpl extends ServiceImpl<PlayOrderInfoMapper, P
entity.setOrderStartTime(LocalDateTime.now()); entity.setOrderStartTime(LocalDateTime.now());
entity.setOrderEndTime(LocalDateTime.now()); entity.setOrderEndTime(LocalDateTime.now());
} }
userInfoService.saveOrderTime(purchaserBy); userInfoService.saveOrderInfo(entity);
this.baseMapper.insert(entity); this.baseMapper.insert(entity);
} }

View File

@@ -1,8 +1,8 @@
package com.starry.admin.modules.weichat.service; package com.starry.admin.modules.weichat.service;
import com.starry.common.utils.IdUtils;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSONObject;
import com.starry.admin.common.exception.ServiceException; import com.starry.admin.common.exception.ServiceException;
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity; import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService; import com.starry.admin.modules.clerk.service.IPlayClerkLevelInfoService;
@@ -11,6 +11,7 @@ import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService; import com.starry.admin.modules.custom.service.IPlayCustomLevelInfoService;
import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService; import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import com.starry.common.utils.ConvertUtil; import com.starry.common.utils.ConvertUtil;
import com.starry.common.utils.IdUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo; import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken; import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
@@ -92,6 +93,7 @@ public class WxOauthService {
WxOAuth2AccessToken token = getWxOAuth2AccessToken(code); WxOAuth2AccessToken token = getWxOAuth2AccessToken(code);
String openId = getOpenId(token); String openId = getOpenId(token);
WxOAuth2UserInfo userInfo = getWxOAuth2UserInfo(token); WxOAuth2UserInfo userInfo = getWxOAuth2UserInfo(token);
log.info("微信登录返回用户信息:" + JSONObject.toJSONString(userInfo));
PlayCustomUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayCustomUserInfoEntity.class); PlayCustomUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayCustomUserInfoEntity.class);
entity.setAvatar(userInfo.getHeadImgUrl()); entity.setAvatar(userInfo.getHeadImgUrl());
PlayCustomUserInfoEntity item = customUserInfoService.selectByOpenid(openId); PlayCustomUserInfoEntity item = customUserInfoService.selectByOpenid(openId);