Browse Source

[update] message:1.新人引导状态修改

kelei 5 months ago
parent
commit
70b585395e

+ 7 - 3
admin/src/main/java/com/flyer/foster/controller/app/AppUserController.java

@@ -1,15 +1,13 @@
 package com.flyer.foster.controller.app;
 
-import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.flyer.foster.consts.WechatConst;
 import com.flyer.foster.dto.app.AppSubscribeRespDTO;
 import com.flyer.foster.dto.app.AppUserQueryDTO;
+import com.flyer.foster.dto.app.AppUserUpdateDTO;
 import com.flyer.foster.entity.AppSubscribe;
-import com.flyer.foster.entity.AppUser;
 import com.flyer.foster.service.IAppSubscribeService;
 import com.flyer.foster.service.IAppUserService;
 import com.flyer.foster.util.WeChatApiUtil;
-import com.flyer.foster.util.WxAccessToken;
 import com.flyer.util.JwtUtil;
 import com.flyer.util.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -84,4 +82,10 @@ public class AppUserController {
         }
         return R.ok();
     }
+
+    @PutMapping("/{userId}")
+    public R updateUser(@PathVariable Integer userId, @RequestBody AppUserUpdateDTO updateDTO) {
+        updateDTO.setUserId(userId);
+        return R.ok().result(iAppUserService.updateUser(updateDTO));
+    }
 }

+ 5 - 0
admin/src/main/java/com/flyer/foster/dto/app/AppUserRespDTO.java

@@ -39,6 +39,11 @@ public class AppUserRespDTO {
     private Integer totalScore;
 
     /**
+     * 是否完成新人引导-{0:未完成,1:已完成}
+     */
+    private Integer isFinishGuide;
+
+    /**
      * 机构id
      */
     private String icon;

+ 19 - 0
admin/src/main/java/com/flyer/foster/dto/app/AppUserUpdateDTO.java

@@ -0,0 +1,19 @@
+package com.flyer.foster.dto.app;
+
+import lombok.Data;
+
+/**
+ * AppUserQueryDTO
+ *
+ * @author kelei
+ * @since 2024/5/11/14:15
+ */
+@Data
+public class AppUserUpdateDTO {
+    private Integer userId;
+
+    /**
+     * 是否完成新人引导-{0:未完成,1:已完成}
+     */
+    private Integer isFinishGuide;
+}

+ 5 - 0
admin/src/main/java/com/flyer/foster/entity/AppUser.java

@@ -70,6 +70,11 @@ public class AppUser implements Serializable {
     private Integer totalScore;
 
     /**
+     * 是否完成新人引导-{0:未完成,1:已完成}
+     */
+    private Integer isFinishGuide;
+
+    /**
      * 状态-{0.不可用 1.可用}
      */
     private Integer status;

+ 2 - 0
admin/src/main/java/com/flyer/foster/service/IAppSubscribeService.java

@@ -1,6 +1,8 @@
 package com.flyer.foster.service;
 
+import com.flyer.foster.dto.UserAddOrUpdateDTO;
 import com.flyer.foster.dto.app.AppSubscribeRespDTO;
+import com.flyer.foster.dto.app.AppUserUpdateDTO;
 import com.flyer.foster.entity.AppSubscribe;
 import com.baomidou.mybatisplus.extension.service.IService;
 

+ 3 - 0
admin/src/main/java/com/flyer/foster/service/IAppUserService.java

@@ -2,6 +2,7 @@ package com.flyer.foster.service;
 
 import com.flyer.foster.dto.app.AppUserQueryDTO;
 import com.flyer.foster.dto.app.AppUserRespDTO;
+import com.flyer.foster.dto.app.AppUserUpdateDTO;
 import com.flyer.foster.entity.AppUser;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -16,4 +17,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IAppUserService extends IService<AppUser> {
 
     AppUserRespDTO login(AppUserQueryDTO dto);
+
+    boolean updateUser(AppUserUpdateDTO updateDTO);
 }

+ 4 - 0
admin/src/main/java/com/flyer/foster/service/impl/AppSubscribeServiceImpl.java

@@ -1,7 +1,11 @@
 package com.flyer.foster.service.impl;
 
+import com.flyer.foster.dto.UserAddOrUpdateDTO;
 import com.flyer.foster.dto.app.AppSubscribeRespDTO;
+import com.flyer.foster.dto.app.AppUserUpdateDTO;
 import com.flyer.foster.entity.AppSubscribe;
+import com.flyer.foster.entity.AppUser;
+import com.flyer.foster.entity.User;
 import com.flyer.foster.mapper.IAppSubscribeMapper;
 import com.flyer.foster.pojo.StpAppUtil;
 import com.flyer.foster.service.IAppSubscribeService;

+ 16 - 0
admin/src/main/java/com/flyer/foster/service/impl/AppUserServiceImpl.java

@@ -8,6 +8,7 @@ import com.flyer.foster.consts.LoginDevice;
 import com.flyer.foster.consts.WechatConst;
 import com.flyer.foster.dto.app.AppUserQueryDTO;
 import com.flyer.foster.dto.app.AppUserRespDTO;
+import com.flyer.foster.dto.app.AppUserUpdateDTO;
 import com.flyer.foster.entity.AppUser;
 import com.flyer.foster.entity.Garden;
 import com.flyer.foster.mapper.IAppUserMapper;
@@ -87,4 +88,19 @@ public class AppUserServiceImpl extends ServiceImpl<IAppUserMapper, AppUser> imp
         respDTO.setToken(StpAppUtil.getTokenValue());
         return respDTO;
     }
+
+    @Override
+    public boolean updateUser(AppUserUpdateDTO updateDTO) {
+        AppUser appUser = this.lambdaQuery()
+                .eq(AppUser::getId, updateDTO.getUserId())
+                .one();
+        if (appUser == null) {
+            throw new BusinessException("无效的用户id");
+        }
+        BeanUtil.copyProperties(updateDTO, appUser);
+        return this.lambdaUpdate()
+                .set(AppUser::getIsFinishGuide, updateDTO.getIsFinishGuide())
+                .eq(AppUser::getId, appUser.getId())
+                .update();
+    }
 }