Forráskód Böngészése

微信主动注册USERID问题修复

zuy 7 hónapja
szülő
commit
b1f8ca7084

+ 1 - 1
car-wash-common/src/main/java/com/kym/common/handler/GlobalExceptionHandler.java

@@ -44,7 +44,7 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(value = BusinessException.class)
     @ResponseBody
     public R<?> handleBusinessException(BaseException e) {
-        LOGGER.error(e.getMessage());
+        LOGGER.error(e.getMessage(),e);
         return R.failed(e.getCode(), e.getMessage());
     }
 

+ 4 - 1
car-wash-service/src/main/java/com/kym/service/impl/UserServiceImpl.java

@@ -13,6 +13,7 @@ import com.kym.common.enums.WxApi;
 import com.kym.common.exception.BusinessException;
 import com.kym.common.utils.CommUtil;
 import com.kym.common.utils.HttpUtil;
+import com.kym.common.utils.IDGenerator;
 import com.kym.entity.*;
 import com.kym.entity.common.PageBean;
 import com.kym.entity.queryParams.CommonQueryParam;
@@ -135,8 +136,10 @@ public class UserServiceImpl extends MPJBaseServiceImpl<UserMapper, User> implem
                     // todo 用户归属 扫设备二维码以外注册的用户,统一归属平台自己的商户,初始化系统时创建对应的商户
                     newUser.setStationId("000");
                 }
-                KymCache.INSTANCE.putUserId2StationId(Map.of(newUser.getId(), newUser.getStationId()));
+               long userId = IDGenerator.INS().nextId();
                 baseMapper.insert(newUser);
+                newUser.setId(userId);
+                KymCache.INSTANCE.putUserId2StationId(Map.of(newUser.getId(), newUser.getStationId()));
                 // 创建用户账户
                 var account = new Account();
                 account.setUserId(newUser.getId());