Jelajahi Sumber

Merge remote-tracking branch 'origin/济南顺亿景' into 济南顺亿景

# Conflicts:
#	fs-service/src/main/java/com/fs/course/vo/FsCoursePlaySourceConfigVO.java
15376779826 2 minggu lalu
induk
melakukan
e3b1ffdaea

+ 5 - 0
fs-service/src/main/java/com/fs/course/domain/FsCoursePlaySourceConfig.java

@@ -109,4 +109,9 @@ public class FsCoursePlaySourceConfig {
      * 商户支付配置id
      */
     private Long merchantConfigId;
+
+    /**
+     * 授权类型:1-静默授权登录(绑定开放平台),2-服务号登录
+     */
+    private Integer authType;
 }

+ 3 - 0
fs-service/src/main/java/com/fs/course/param/FsCoursePlaySourceConfigEditParam.java

@@ -58,4 +58,7 @@ public class FsCoursePlaySourceConfigEditParam {
 
     @ApiModelProperty("商户支付配置id")
     private Long merchantConfigId;
+
+    // 授权类型
+    private Integer authType;
 }

+ 15 - 5
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.course.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -41,10 +42,7 @@ import com.fs.course.param.newfs.FsUserCourseAddCompanyUserParam;
 import com.fs.course.param.newfs.FsUserCourseVideoLinkParam;
 import com.fs.course.param.newfs.FsUserCourseVideoUParam;
 import com.fs.course.param.newfs.UserCourseVideoPageParam;
-import com.fs.course.service.IFsCourseLinkService;
-import com.fs.course.service.IFsUserCompanyBindService;
-import com.fs.course.service.IFsUserCompanyUserService;
-import com.fs.course.service.IFsUserCourseVideoService;
+import com.fs.course.service.*;
 import com.fs.course.vo.*;
 import com.fs.course.vo.newfs.*;
 import com.fs.enums.ExceptionCodeEnum;
@@ -252,6 +250,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
     @Autowired
     private IFsCourseLinkService linkService;
 
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+
 
     /**
      * 查询课堂视频
@@ -1590,6 +1591,15 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
             return R.error("未识别到用户信息");
         }
 
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigByAppId(param.getAppId());
+
+        if (ObjectUtil.isNotEmpty(fsCoursePlaySourceConfig)) {
+            param.setSource(fsCoursePlaySourceConfig.getAuthType().equals(1)?2:1);
+        }
+        if (param.getSource()==1&&StringUtils.isEmpty(user.getMpOpenId())){
+            return R.error(401,"请重新授权!");
+        }
+
         FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByFsUser(param.getUserId(), param.getVideoId(), param.getCompanyUserId());
         if (log == null) {
             return R.error("无记录");
@@ -1993,7 +2003,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
 //            if (company.getCourseMiniAppId()==null){
 //                return R.error("销售公司参数错误,未绑定小程序");
 //            }
-            if (user.getMpOpenId() != null && !isNewWxMerchant) {
+            if (StringUtils.isNotEmpty(user.getMpOpenId()) && !isNewWxMerchant) {
                 packetParam.setOpenId(user.getMpOpenId());
             } else {
                 //查询是否绑定小程序

+ 7 - 0
fs-service/src/main/java/com/fs/course/vo/FsCoursePlaySourceConfigVO.java

@@ -67,4 +67,11 @@ public class FsCoursePlaySourceConfigVO {
 
     @ApiModelProperty("小程序支付配置id")
     private Long merchantConfigId;
+
+    /**
+     * 授权类型:1-静默授权登录(绑定开放平台),2-服务号登录
+     */
+    private Integer authType;
+
+
 }

+ 1 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -894,7 +894,7 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     private R sendRedPacketLegacyInternal(WxSendRedPacketParam param, RedPacketConfig config) {
         //如果服务号的配置存在,小程序红包接口可以使用服务号来发红包,重新赋值
         //仅老商户支持
-        if (param.getUser().getMpOpenId()!=null && StringUtils.isNotEmpty(param.getMpAppId())){
+        if (StringUtils.isNotEmpty(param.getUser().getMpOpenId())  && StringUtils.isNotEmpty(param.getMpAppId())){
             config.setAppId(param.getMpAppId());
             param.setOpenId(param.getUser().getMpOpenId());
         }

+ 1 - 0
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -646,6 +646,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update fs_user
         <trim prefix="SET" suffixOverrides=",">
             <if test="nickName != null">nick_name = #{nickName},</if>
+            <if test="nickname != null">nickname = #{nickname},</if>
             <if test="avatar != null">avatar = #{avatar},</if>
             <if test="phone != null">phone = #{phone},</if>
             <if test="integral != null">integral = #{integral},</if>

+ 25 - 3
fs-user-app/src/main/java/com/fs/app/controller/WxUserController.java

@@ -20,6 +20,9 @@ import com.fs.company.domain.CompanyUser;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxMpConfiguration;
 import com.fs.course.config.CourseMaConfig;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
+import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.*;
 import com.fs.his.enums.FsUserOperationEnum;
@@ -89,6 +92,9 @@ public class WxUserController extends AppBaseController{
     @Autowired
     private OpenIMService openIMService;
 
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+
 
     /**
      * 登陆接口
@@ -441,12 +447,12 @@ public class WxUserController extends AppBaseController{
         if (StringUtils.isEmpty(newAppId)) {
             return currentAppIds == null ? "" : currentAppIds;
         }
-        
+
         // 如果当前appId为空,直接返回新appId
         if (StringUtils.isEmpty(currentAppIds)) {
             return newAppId;
         }
-        
+
         // 检查是否已存在
         String[] appIdArray = currentAppIds.split(",");
         for (String appId : appIdArray) {
@@ -455,9 +461,25 @@ public class WxUserController extends AppBaseController{
                 return currentAppIds;
             }
         }
-        
+
         // 不存在,追加到末尾
         return currentAppIds + "," + newAppId;
     }
 
+
+    /**
+     * 通过appId查询配置(正常状态)
+     */
+    @GetMapping("/getByAppId/{appId}")
+    @ApiOperation("通过appId查询配置")
+    public R getByAppId(
+            @PathVariable
+            String appId) {
+        FsCoursePlaySourceConfig config = fsCoursePlaySourceConfigService.selectCoursePlaySourceConfigByAppId(appId);
+        if (config == null) {
+            return R.error("未找到对应的配置信息");
+        }
+        return R.ok().put("config", config);
+    }
+
 }

+ 6 - 0
fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwLoginController.java

@@ -147,6 +147,12 @@ public class CourseQwLoginController extends AppBaseController {
             map.put("token", token);
             map.put("user", user);
             map.put("isNew", isNewUser);
+            // 如果是微信用户返回
+            if("微信用户".equals(user.getNickname())){
+                map.put("isEditUser", true);
+            }else {
+                map.put("isEditUser", false);
+            }
 
             logger.info("zyp \n 【点播{}登录】:{}", logName, user.getUserId());
             return R.ok(map);