ソースを参照

95:红德堂APP调试 会员关联项目代码同步

Long 1 週間 前
コミット
5c5bfbfb0c

+ 11 - 0
fs-service/src/main/java/com/fs/course/config/CourseConfig.java

@@ -40,6 +40,17 @@ public class CourseConfig implements Serializable {
     private Integer delayStart;
     private Integer delayEnd;
 
+    /**
+     * 小程序授权头像昵称方式(目前仅会员看课有效)
+     * 1:小程序原生授权 2:跳转H5服务号授权
+     */
+    private Integer miniAppAuthType;
+    /**
+     * 会员看课
+     * 小程序授权头像昵称,跳转H5服务号授权域名
+     */
+    private String userCourseAuthDomain;
+
 
     @Data
     public static class DisabledTimeVo{

+ 4 - 0
fs-service/src/main/java/com/fs/course/mapper/FsUserCourseVideoRedPackageMapper.java

@@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * 课程公司红包Mapper接口
  *
@@ -98,4 +100,6 @@ public interface FsUserCourseVideoRedPackageMapper
             "</foreach>" +
             "</script>")
     int updateBatchDelFlag(@Param("ids") Long [] ids, @Param("delFlag") Integer delFlag);
+
+    Integer selectRedPacketByCompanyCount(@Param("videoId") Long videoId,@Param("companyId") Long companyId, @Param("periodId") Long periodId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/course/service/IFsUserCourseVideoService.java

@@ -182,4 +182,6 @@ public interface IFsUserCourseVideoService
     String selectFsUserCourseVideoByVideoForTitle(Long videoId);
 
     R updateVideo();
+
+    R checkUserInfo(Long userId);
 }

+ 27 - 2
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1589,8 +1589,12 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         }
 //
         if (courseVideoDetails != null && courseVideoDetails.getDuration() != null){
-            tipsTime = courseVideoDetails.getDuration() / 3;
-            tipsTime2 = (courseVideoDetails.getDuration() * 2) / 3;
+            // 查询视频是否设置了红包,没有就不提示
+            Integer fsUserCourseVideoRedPackage = fsUserCourseVideoRedPackageMapper.selectRedPacketByCompanyCount(param.getVideoId(), null, param.getPeriodId());
+            if(fsUserCourseVideoRedPackage>0){
+                tipsTime = courseVideoDetails.getDuration() / 3;
+                tipsTime2 = (courseVideoDetails.getDuration() * 2) / 3;
+            }
         }
         vo.setTipsTime(tipsTime);
         vo.setTipsTime2(tipsTime2);
@@ -2196,4 +2200,25 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         }
         return R.ok();
     }
+
+    @Override
+    public R checkUserInfo(Long userId) {
+        FsUser user=fsUserService.selectFsUserById(userId);
+        if (user==null) {
+            return R.error(404,"用户不存在!");
+        }
+        //读取配置给前端返回
+        String json = sysConfigService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        if (StringUtils.isEmpty(user.getNickName())){
+            Map<String,Object> map = new HashMap<>();
+            map.put("authType", config.getMiniAppAuthType());
+            if (config.getMiniAppAuthType()==2){
+                map.put("domain", config.getUserCourseAuthDomain());
+            }
+            map.put("code",500);
+            return R.ok(map);
+        }
+        return R.ok().put("user",user);
+    }
 }

+ 8 - 0
fs-service/src/main/resources/mapper/course/FsUserCourseVideoRedPackageMapper.xml

@@ -136,4 +136,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="listByRuleIds" resultType="com.fs.course.domain.FsUserCourseVideoRedPackage">
         select * from fs_user_course_video_red_package where del_flag ='0' and data_type = 3 and rule_id in <foreach collection="ids" item="item" open="(" separator="," close=")">#{item}</foreach>
     </select>
+    <select id="selectRedPacketByCompanyCount" resultType="java.lang.Integer">
+        select count(0) from fs_user_course_video_red_package
+        <where>
+            <if test="videoId != null "> and video_id =#{videoId}</if>
+            <if test="companyId != null "> and company_id = #{companyId}</if>
+            <if test="periodId != null "> and period_id = #{periodId}</if>
+        </where>
+    </select>
 </mapper>

+ 28 - 9
fs-user-app/src/main/java/com/fs/app/controller/UserController.java

@@ -8,6 +8,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.exception.CustomException;
 import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.sign.Md5Utils;
+import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.his.domain.FsDoctor;
 import com.fs.his.domain.FsPackage;
 import com.fs.his.domain.FsUser;
@@ -29,6 +30,7 @@ import com.github.pagehelper.PageInfo;
 import com.google.zxing.WriterException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -36,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletRequest;
+import javax.validation.Valid;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
@@ -52,6 +55,7 @@ import static com.fs.his.utils.PhoneUtil.encryptPhone;
 
 @Api("个人中心")
 @RestController
+@Slf4j
 @RequestMapping(value="/app/user")
 public class UserController extends  AppBaseController {
 
@@ -66,6 +70,8 @@ public class UserController extends  AppBaseController {
     private IFsUserCouponService couponService;
     @Autowired
     private IQwAppContactWayService qwAppContactWayService;
+    @Autowired
+    private IFsUserCourseVideoService courseVideoService;
 
     /**
      * 获取用户信息
@@ -88,6 +94,14 @@ public class UserController extends  AppBaseController {
         }
     }
 
+    @Login
+    @ApiOperation("判断用户是否存在头像昵称")
+    @GetMapping("/checkUserInfo")
+    public R checkUserInfo(){
+        log.info("【判断判断用户是否存在头像昵称】:{}",getUserId());
+        return courseVideoService.checkUserInfo(Long.parseLong(getUserId()));
+    }
+
     @Login
     @ApiOperation("查看推送设置")
     @GetMapping("/getUserPushSetting")
@@ -130,17 +144,23 @@ public class UserController extends  AppBaseController {
         }
     }
 
-
-
-
     @Login
     @ApiOperation("修改用户信息")
     @PostMapping("/editUser")
-    public R editUser(@RequestBody FsUserEditParam param, HttpServletRequest request){
-        FsUser map=new FsUser();
-        BeanUtils.copyProperties(param,map);
-        map.setUserId(Long.parseLong(getUserId()));
-        if(userService.updateFsUser(map)>0){
+    public R editUser(@RequestBody @Valid FsUserEditParam param, HttpServletRequest request){
+        param.setUserId(Long.parseLong(getUserId()));
+        log.info("【修改用户头像昵称】:{}",param);
+        if (param.getNickName().length()>50){
+            return R.error("请授权正确的昵称!");
+        }
+        if (StringUtils.isEmpty(param.getAvatar())){
+            param.setAvatar("https://zkzh-2025.oss-cn-beijing.aliyuncs.com/fs/20250715/533c6f87cc2e4ba4a9504374bb58416d.png");
+        }
+        FsUser user=new FsUser();
+        user.setUserId(Long.parseLong(getUserId()));
+        user.setAvatar(param.getAvatar());
+        user.setNickName(param.getNickName());
+        if(userService.updateFsUser(user)>0){
             return R.ok("修改成功");
         }
         else{
@@ -148,7 +168,6 @@ public class UserController extends  AppBaseController {
         }
     }
 
-
     @Login
     @ApiOperation("注册医生")
     @PostMapping("/registerDoctor")

+ 5 - 8
fs-user-app/src/main/java/com/fs/app/param/FsUserEditParam.java

@@ -11,14 +11,11 @@ import java.io.Serializable;
 @Setter
 public class FsUserEditParam implements Serializable {
 
-    @NotBlank(message = "头像不能为空")
-    private String avatar;
-    @NotBlank(message = "昵称不能为空")
+    @NotNull(message = "用户昵称不能为空!")
     private String nickName;
-    @NotBlank(message = "手机号不能为空")
-    private String phone;
-    @NotNull(message = "性别不能为空")
-    private Integer sex;
-    private Integer isWeixinAuth;
 
+    //    @NotBlank(message = "用户头像不能为空!")
+    private String avatar;
+
+    private Long userId;
 }