ocr 数签子

登录更新了用户名称的问题
更新用户信息的问题
This commit is contained in:
2025-12-25 11:18:14 +08:00
parent 22a5ae8f68
commit bae1762dba
18 changed files with 866 additions and 388 deletions

View File

@@ -1,16 +1,13 @@
package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.czg.account.dto.ShopConfigDTO;
import com.czg.account.entity.ShopConfig;
import com.czg.account.entity.ShopInfo;
import com.czg.account.service.ShopConfigService;
import com.czg.exception.CzgException;
import com.czg.sa.StpKit;
import com.czg.service.RedisService;
import com.czg.service.account.mapper.ShopConfigMapper;
import com.czg.service.account.mapper.ShopInfoMapper;
import com.czg.utils.PageUtil;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
@@ -90,19 +87,10 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
});
if (isEnable == 0 && !onyUpValid) {
updateChain().or(or -> {
or.eq(ShopConfig::getId, mainShopId);
}).or(or -> {
or.in(ShopConfig::getId, childShopIdList);
}).set(property, 0).update();
updateChain().in(ShopConfig::getId, childShopIdList).set(property, 0).update();
}else {
if ("all".equals(useShopType)) {
updateChain().or(or -> {
or.eq(ShopConfig::getId, mainShopId);
}).or(or -> {
or.in(ShopConfig::getId, childShopIdList);
}).set(property, 1).update();
updateChain().in(ShopConfig::getId, childShopIdList).set(property, 1).update();
}else {
if (shopIdList.isEmpty()) {
updateChain().eq(ShopConfig::getId, mainShopId).set(property, 1).update();
@@ -115,7 +103,6 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
}
}
extistList.forEach(item -> redisService.del("shopInfo::" + item));
redisService.del("shopInfo::" + mainShopId);
}

View File

@@ -6,7 +6,6 @@ import com.alibaba.fastjson2.JSONObject;
import com.czg.account.dto.auth.GetPhoneDTO;
import com.czg.account.dto.auth.LoginTokenDTO;
import com.czg.account.dto.auth.UserAuthorizationLoginDTO;
import com.czg.account.dto.auth.WechatRawDataDTO;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.UserAuthorizationService;
import com.czg.account.service.UserInfoService;
@@ -95,19 +94,13 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
openId = wechatAuthUtil.getSessionKeyOrOpenId(userAuthorizationLoginDTO.getCode(), false);
userInfo = userInfoService.queryChain().eq(UserInfo::getWechatOpenId, openId).one();
userInfo = userInfo == null ? new UserInfo() : userInfo;
if (StrUtil.isNotBlank(userAuthorizationLoginDTO.getRawData())) {
WechatRawDataDTO wechatRawDataDTO = JSONObject.parseObject(userAuthorizationLoginDTO.getRawData(), WechatRawDataDTO.class);
userInfo.setHeadImg(wechatRawDataDTO.getAvatarUrl());
userInfo.setNickName(StrUtil.isNotBlank(wechatRawDataDTO.getNickName()) ? wechatRawDataDTO.getNickName() : "微信用户");
} else {
userInfo.setNickName("微信用户");
}
userInfo.setNickName(StrUtil.isNotBlank(userInfo.getNickName()) ? userInfo.getNickName() : "微信用户");
userInfo.setWechatOpenId(openId);
} else {
openId = alipayUtil.getOpenId(userAuthorizationLoginDTO.getCode(), false);
userInfo = userInfoService.queryChain().eq(UserInfo::getAlipayOpenId, openId).one();
userInfo = userInfo == null ? new UserInfo() : userInfo;
userInfo.setNickName("支付宝用户");
userInfo.setNickName(StrUtil.isNotBlank(userInfo.getNickName()) ? userInfo.getNickName() : "支付宝用户");
userInfo.setAlipayOpenId(openId);
}

View File

@@ -10,6 +10,7 @@ import com.czg.account.dto.user.userinfo.UserInfoEditDTO;
import com.czg.account.dto.user.userinfo.UserInfoPwdEditDTO;
import com.czg.account.entity.ShopUser;
import com.czg.account.entity.UserInfo;
import com.czg.account.service.ShopInfoService;
import com.czg.account.service.UserInfoService;
import com.czg.config.RedisCst;
import com.czg.exception.CzgException;
@@ -38,6 +39,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
@Resource
private ShopUserMapper shopUserMapper;
@Resource
private ShopInfoService shopInfoService;
@Resource
private RedisService redisService;
@Resource
private AcAccountUtil acAccountUtil;
@@ -62,9 +65,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
UserInfo userInfo = getById(userId);
BeanUtil.copyProperties(userInfoEditDTO, userInfo);
if (updateById(userInfo)) {
if (shopId != -1L) {
if (shopId != 0L) {
ShopUser shopUser = BeanUtil.copyProperties(userInfo, ShopUser.class);
return shopUserMapper.updateByQuery(shopUser, new QueryWrapper().eq(ShopUser::getSourceShopId, shopId).eq(ShopUser::getUserId, userId)) > 0;
Long mainIdByShopId = shopInfoService.getMainIdByShopId(shopId);
return shopUserMapper.updateByQuery(shopUser, new QueryWrapper().eq(ShopUser::getMainShopId, mainIdByShopId).eq(ShopUser::getUserId, userId)) > 0;
}
return true;
}