Sfoglia il codice sorgente

用户绑定接口添加字段

wangzhijun 1 settimana fa
parent
commit
9ddfe277c2

+ 6 - 0
nightFragrance-common/src/main/java/com/ylx/common/core/domain/model/WxLoginUser.java

@@ -142,6 +142,12 @@ public class WxLoginUser implements UserDetails {
      */
     private String cMrAddressId;
 
+    @ApiModelProperty("是否绑定一账通 0否 1是")
+    private Integer isBind;
+
+    @ApiModelProperty("本地生活用户id")
+    private String localLiveUserId;
+
     @Override
     public Collection<? extends GrantedAuthority> getAuthorities() {
         return null;

+ 3 - 0
nightFragrance-massage/src/main/java/com/ylx/massage/domain/TWxUser.java

@@ -163,6 +163,9 @@ public class TWxUser implements Serializable {
     @ApiModelProperty("是否绑定一账通 0否 1是")
     private Integer isBind;
 
+    @ApiModelProperty("本地生活用户id")
+    private String localLiveUserId;
+
     public String getcOpenid() {
         return cOpenid;
     }

+ 9 - 8
nightFragrance-massage/src/main/java/com/ylx/usercenter/service/impl/UnifiedUserCenterServiceImpl.java

@@ -199,16 +199,17 @@ public class UnifiedUserCenterServiceImpl implements UnifiedUserCenterService {
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public void updateUserBindStatus(UnifiedUserCenterDTO dto) {
         try {
-            TWxUser wxUser = this.wxUserService.getById(dto.getSourceUserId());
+            TWxUser wxUser = this.wxUserService.getById(dto.getTargetUserId());
             wxUser.setIsBind(1);
+            wxUser.setLocalLiveUserId(dto.getSourceUserId());
             boolean wxUserBool = this.wxUserService.updateById(wxUser);
             if (!wxUserBool) {
-                log.error("更新用户绑定状态失败, userId: {}", dto.getSourceUserId());
+                log.error("更新用户绑定状态失败, userId: {}", dto.getTargetUserId());
                 throw new ServiceException("更新用户绑定状态失败");
             }
-            log.info("更新用户绑定一账通信息成功, userId:{}", dto.getSourceUserId());
+            log.info("更新用户绑定一账通信息成功, userId:{}", dto.getTargetUserId());
         } catch (Exception e) {
-            log.error("更新用户绑定状态异常, userId: {}", dto.getSourceUserId(), e);
+            log.error("更新用户绑定状态异常, userId: {}", dto.getTargetUserId(), e);
             // 如果本地更新失败,异步调用远程解绑接口进行补偿
             asyncCompensateUnbind(dto);
             throw e;
@@ -248,19 +249,19 @@ public class UnifiedUserCenterServiceImpl implements UnifiedUserCenterService {
         while (retryCount < maxRetries && !success) {
             retryCount++;
             try {
-                log.info("异步补偿:尝试解除用户绑定, userId: {}, 重试次数: {}", dto.getSourceUserId(), retryCount);
+                log.info("异步补偿:尝试解除用户绑定, userId: {}, 重试次数: {}", dto.getTargetUserId(), retryCount);
                 executePost(UNBIND_PATH, dto, "补偿:解除用户绑定信息");
-                log.info("异步补偿:成功解除用户绑定, userId: {}", dto.getSourceUserId());
+                log.info("异步补偿:成功解除用户绑定, userId: {}", dto.getTargetUserId());
                 success = true;
             } catch (Exception e) {
-                log.error("异步补偿:解除用户绑定失败, userId: {}, 重试次数: {}", dto.getSourceUserId(), retryCount, e);
+                log.error("异步补偿:解除用户绑定失败, userId: {}, 重试次数: {}", dto.getTargetUserId(), retryCount, e);
                 if (retryCount < maxRetries) {
                     try {
                         // 等待一段时间后重试
                         Thread.sleep(1000 * retryCount);
                     } catch (InterruptedException ie) {
                         Thread.currentThread().interrupt();
-                        log.error("异步补偿:线程被中断, userId: {}", dto.getSourceUserId(), ie);
+                        log.error("异步补偿:线程被中断, userId: {}", dto.getTargetUserId(), ie);
                         break;
                     }
                 } else {