Kaynağa Gözat

Merge branch 'master' of http://1.14.104.71:10880/root/ylrz_his_scrm_java

caoliqin 1 hafta önce
ebeveyn
işleme
83bc37ada8
24 değiştirilmiş dosya ile 294 ekleme ve 46 silme
  1. 52 9
      fs-admin/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java
  2. 29 0
      fs-service/src/main/java/com/fs/course/domain/FsDepVideoShow.java
  3. 5 0
      fs-service/src/main/java/com/fs/course/domain/FsUserCourseVideo.java
  4. 43 0
      fs-service/src/main/java/com/fs/course/mapper/FsDepVideoShowMapper.java
  5. 4 0
      fs-service/src/main/java/com/fs/his/domain/FsAppVersion.java
  6. 4 0
      fs-service/src/main/java/com/fs/his/domain/FsUser.java
  7. 3 4
      fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java
  8. 6 0
      fs-service/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java
  9. 6 0
      fs-service/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java
  10. 2 2
      fs-service/src/main/resources/application-config-dev-jnlzjk.yml
  11. 2 2
      fs-service/src/main/resources/application-config-dev-xcsw.yml
  12. 2 2
      fs-service/src/main/resources/application-config-druid-bjzm-test.yml
  13. 2 2
      fs-service/src/main/resources/application-config-druid-bjzm.yml
  14. 2 2
      fs-service/src/main/resources/application-config-druid-cfryt.yml
  15. 2 2
      fs-service/src/main/resources/application-config-druid-jnlzjk.yml
  16. 2 2
      fs-service/src/main/resources/application-config-druid-xcsw.yml
  17. 2 2
      fs-service/src/main/resources/application-config-myhk.yml
  18. 2 2
      fs-service/src/main/resources/application-config-shdn.yml
  19. 2 2
      fs-service/src/main/resources/application-config-zlwh.yml
  20. 5 1
      fs-service/src/main/resources/mapper/his/FsAppVersionMapper.xml
  21. 23 1
      fs-service/src/main/resources/mapper/his/FsUserMapper.xml
  22. 83 11
      fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java
  23. 9 0
      fs-user-app/src/main/java/com/fs/app/param/FsUserEditPhoneParam.java
  24. 2 0
      fs-user-app/src/main/java/com/fs/app/param/FsUserLoginByWeChatParam.java

+ 52 - 9
fs-admin/src/main/java/com/fs/course/controller/FsUserCourseVideoController.java

@@ -2,6 +2,7 @@ package com.fs.course.controller;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -12,13 +13,12 @@ import com.fs.common.enums.BusinessType;
 import com.fs.common.utils.ServletUtils;
 import com.fs.common.utils.poi.ExcelUtil;
 import com.fs.course.config.CourseConfig;
+import com.fs.course.domain.FsDepVideoShow;
 import com.fs.course.domain.FsUserCourse;
 import com.fs.course.domain.FsUserCourseVideo;
+import com.fs.course.mapper.FsDepVideoShowMapper;
 import com.fs.course.mapper.FsUserCourseVideoMapper;
-import com.fs.course.param.BatchEditCoverParam;
-import com.fs.course.param.BatchRedUpdate;
-import com.fs.course.param.BatchVideoSvae;
-import com.fs.course.param.CourseVideoUpdates;
+import com.fs.course.param.*;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.course.service.IFsUserCourseVideoService;
 import com.fs.course.vo.FsUserCourseVideoChooseVO;
@@ -29,6 +29,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
@@ -59,7 +60,10 @@ public class FsUserCourseVideoController extends BaseController
 
     @Autowired
     private ISysConfigService configService;
-
+    @Autowired
+    private FsDepVideoShowMapper fsDepVideoShowMapper;
+    @Value("${cloud_host.company_name}")
+    private String companyName;
     /**
      * 查询课堂视频列表
      */
@@ -138,17 +142,56 @@ public class FsUserCourseVideoController extends BaseController
         // 设置项目ID
         FsUserCourse fsUserCourse = fsUserCourseService.selectFsUserCourseByCourseId(fsUserCourseVideo.getCourseId());
         fsUserCourseVideo.setProjectId(fsUserCourse.getProject());
-        return toAjax(fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo));
+        int result = fsUserCourseVideoService.insertFsUserCourseVideo(fsUserCourseVideo);
+        if ("北京卓美".equals(companyName) && result > 0 &&  fsUserCourseVideo.getShowProduct() != null) {
+                // 先检查是否存在相同记录
+                QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
+                Long videoId = fsUserCourseVideo.getVideoId();
+                queryWrapper.eq("video_id", videoId);
+                FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
+                if (fsDepVideoShow != null) {
+                    // 更新现有记录
+                    fsDepVideoShow.setIsShow(fsUserCourseVideo.getShowProduct().toString());
+                    fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
+                } else {
+                    // 插入新记录
+                    fsDepVideoShow = new FsDepVideoShow();
+                    fsDepVideoShow.setVideoId(videoId);
+                    fsDepVideoShow.setIsShow(fsUserCourseVideo.getShowProduct().toString());
+                    fsDepVideoShow.setDepId(loginUser.getDeptId());
+                    fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
+                }
+        }
+        return toAjax(result);
     }
-
     /**
      * 修改课堂视频
      */
     @PreAuthorize("@ss.hasPermi('course:userCourseVideo:edit')")
     @Log(title = "课堂视频", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody FsUserCourseVideo fsUserCourseVideo)
-    {
+    public AjaxResult edit(@RequestBody FsUserCourseVideo fsUserCourseVideo) {
+        if ("北京卓美".equals(companyName)) {
+            Integer showProduct = fsUserCourseVideo.getShowProduct();
+            if (showProduct != null) {
+                // 先检查是否存在相同记录
+                QueryWrapper<FsDepVideoShow> queryWrapper = new QueryWrapper<>();
+                Long videoId = fsUserCourseVideo.getVideoId();
+                queryWrapper.eq("video_id", videoId);
+                FsDepVideoShow fsDepVideoShow = fsDepVideoShowMapper.selectOne(queryWrapper);
+                if (fsDepVideoShow != null) {
+                    // 更新现有记录
+                    fsDepVideoShow.setIsShow(showProduct.toString());
+                    fsDepVideoShowMapper.updateByVideoId(fsDepVideoShow);
+                } else {
+                    // 插入新记录
+                    fsDepVideoShow = new FsDepVideoShow();
+                    fsDepVideoShow.setIsShow(showProduct.toString());
+                    fsDepVideoShow.setVideoId(videoId);
+                    fsDepVideoShowMapper.insertFsDepVideoShowByVideoId(fsDepVideoShow);
+                }
+            }
+        }
         return toAjax(fsUserCourseVideoService.updateFsUserCourseVideo(fsUserCourseVideo));
     }
 

+ 29 - 0
fs-service/src/main/java/com/fs/course/domain/FsDepVideoShow.java

@@ -0,0 +1,29 @@
+package com.fs.course.domain;
+
+import com.fs.common.annotation.Excel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 部门视频疗包展示关联对象 fs_dep_video_show
+ *
+ * @author fs
+ * @date 2025-10-11
+ */
+@Data
+@EqualsAndHashCode()
+public class FsDepVideoShow {
+
+    /** 视频id */
+    private Long videoId;
+
+    /** 是否展示疗包 0展示 1不展示 */
+    @Excel(name = "是否展示疗包 0展示 1不展示")
+    private String isShow;
+
+    /** 部门id */
+    @Excel(name = "部门id")
+    private Long depId;
+
+
+}

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

@@ -1,5 +1,6 @@
 package com.fs.course.domain;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
@@ -128,4 +129,8 @@ public class FsUserCourseVideo extends BaseEntity
     private String jobId;
 
     private String vid;
+
+    @TableField(exist = false)
+    private Integer showProduct; //1不展示疗法,0展示疗法
+
 }

+ 43 - 0
fs-service/src/main/java/com/fs/course/mapper/FsDepVideoShowMapper.java

@@ -0,0 +1,43 @@
+package com.fs.course.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fs.course.domain.FsDepVideoShow;
+import org.apache.ibatis.annotations.Insert;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+
+/**
+ * 部门视频疗包展示关联Mapper接口
+ * 
+ * @author fs
+ * @date 2025-10-11
+ */
+public interface FsDepVideoShowMapper extends BaseMapper<FsDepVideoShow>{
+    /**
+     * 部门视频疗包展示关联
+     * 
+     * @param videoId, depId  部门视频疗包展示关联主键
+     * @return 部门视频疗包展示关联
+     */
+    @Select("<script>" +
+            "SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}" +
+            "<if test='depId != null'> AND dep_id = #{depId}</if>" +
+            "</script>")
+    String selectFsDepVideoShowByVideoId(@Param("videoId")Long videoId,@Param("depId") Long depId);
+
+    @Select("SELECT is_show FROM fs_dep_video_show WHERE video_id = #{videoId}")
+    String searchAllByVideoIdString(Long videoId);
+    /**
+     * 增加部门视频疗包展示关联
+     *
+     * @param fsDepVideoShow 部门视频疗包展示关联主键
+     * @return 部门视频疗包展示关联
+     */
+    @Insert("INSERT INTO fs_dep_video_show(video_id, is_show, dep_id) VALUES(#{videoId}, #{isShow}, #{depId})")
+    int insertFsDepVideoShowByVideoId(FsDepVideoShow fsDepVideoShow);
+
+    @Update("UPDATE fs_dep_video_show SET is_show = #{isShow} WHERE video_id = #{videoId} AND dep_id = #{depId}")
+    int updateByVideoId(FsDepVideoShow fsDepVideoShow);
+
+}

+ 4 - 0
fs-service/src/main/java/com/fs/his/domain/FsAppVersion.java

@@ -36,6 +36,10 @@ public class FsAppVersion extends BaseEntity
     @Excel(name = "下载地址")
     private String url;
 
+    /** 下载地址 */
+    @Excel(name = "wgt下载地址")
+    private String wgtUrl;
+
     /** APP类型 1android 2ios */
     @Excel(name = "APP类型 1android 2ios")
     private Integer type;

+ 4 - 0
fs-service/src/main/java/com/fs/his/domain/FsUser.java

@@ -190,6 +190,10 @@ public class FsUser extends BaseEntity
     /** app登录后不为null(表示是否下载app) */
     private String historyApp;
 
+    private String appOpenId;
+
+    private String appleKey; // 苹果key登陆验证
+
     public void setNickName(String nickname)
     {
         if(StringUtils.isNotEmpty(nickname)){

+ 3 - 4
fs-service/src/main/java/com/fs/his/mapper/FsUserMapper.java

@@ -470,14 +470,13 @@ public interface FsUserMapper
 
     List<FsUser> selectFsUserListByPhone(String phone);
 
-
-    @Select("select * from fs_user where apple_key = #{appleKey}")
-    FsUser findUserByAppleKey(String appleKey);
-
     void updatePasswordByPhone(@Param("password")String password, @Param("encryptPhone")String encryptPhone);
 
     /**
      * 查询用户列表(用于积分管理,支持手机号和昵称模糊查询)
      */
     List<FsUser> selectFsUserListForIntegral(FsUser fsUser);
+
+    @Select("select * from fs_user where apple_key = #{appleKey}")
+    FsUser findUserByAppleKey(String appleKey);
 }

+ 6 - 0
fs-service/src/main/java/com/fs/qw/mapper/QwWatchLogMapper.java

@@ -115,6 +115,12 @@ public interface QwWatchLogMapper extends BaseMapper<QwWatchLog>{
             "<if test ='ids !=null and ids!=\"\"'>\n" +
             "   and qec.qw_user_id in (${ids})\n" +
             "</if>" +
+            "<if test = 'addWays != null and addWays.size()>0' >" +
+            "and qec.add_way in  " +
+            "<foreach collection=\"addWays\" item=\"item\" open=\"(\" close=\")\" separator=\",\">\n" +
+            "       ${item}\n" +
+            "                  </foreach>" +
+            "</if>" +
             "GROUP BY\n" +
             "    qec.qw_user_id, DATE(qec.create_time) \n" +
             "ORDER BY\n" +

+ 6 - 0
fs-service/src/main/java/com/fs/qw/param/QwWatchLogStatisticsListParam.java

@@ -45,6 +45,12 @@ public class QwWatchLogStatisticsListParam {
     private Long pageNum;
     private Long pageSize;
     private List<Long> filterDeptIds;
+
+    /**
+     * 添加方式
+     */
+    private List<Integer> addWays;
+
     /**
      * 今正要求把公司筛选条件优化到细分至部门,销售(前端判断,只有今正传)
      */

+ 2 - 2
fs-service/src/main/resources/application-config-dev-jnlzjk.yml

@@ -70,8 +70,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: jnlzjk-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-dev-xcsw.yml

@@ -71,8 +71,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: shdn-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-druid-bjzm-test.yml

@@ -74,8 +74,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: bjzmky-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-druid-bjzm.yml

@@ -69,8 +69,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: bjzmky-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-druid-cfryt.yml

@@ -73,8 +73,8 @@ nuonuo:
   secret: A2EB20764D304D16
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: ryt-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-druid-jnlzjk.yml

@@ -71,8 +71,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: jnlzjk-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-druid-xcsw.yml

@@ -71,8 +71,8 @@ nuonuo:
 
 # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: xcsw-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-myhk.yml

@@ -78,8 +78,8 @@ nuonuo:
 
   # 存储捅配置
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: myhk-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-shdn.yml

@@ -98,8 +98,8 @@ aifabu:  #爱链接
   appKey: 7b471be905ab17e00f3b858c6710dd117601d008
 
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: beliyo-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 2 - 2
fs-service/src/main/resources/application-config-zlwh.yml

@@ -98,8 +98,8 @@ aifabu:  #爱链接
   appKey: 7b471be905ab17e00f3b858c6710dd117601d008
 
 tencent_cloud_config:
-  secret_id: AKIDiMq9lDf2EOM9lIfqqfKo7FNgM5meD0sT
-  secret_key: u5SuS80342xzx8FRBukza9lVNHKNMSaB
+  secret_id: AKIDraAYkjVIvLch4ReiaIr0FTiyGPOGyUr2
+  secret_key: 3tcDi6QccQ971xoU0KRhpkSyIOIzSikZ
   bucket: zlwh-1323137866
   app_id: 1323137866
   region: ap-chongqing

+ 5 - 1
fs-service/src/main/resources/mapper/his/FsAppVersionMapper.xml

@@ -17,10 +17,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateConfig"    column="update_config"    />
         <result property="baiduUrl"    column="baidu_url"    />
         <result property="h5Url"    column="h5_url"    />
+        <result property="wgtUrl"    column="wgt_url"    />
     </resultMap>
 
     <sql id="selectFsAppVersionVo">
-        select version_id,baidu_url,update_config, version_name, version_code, note, url, type, is_force, create_time, app_type,h5_url from fs_app_version
+        select version_id,baidu_url,update_config, version_name, version_code, note, url, type, is_force, create_time, app_type,h5_url,wgt_url from fs_app_version
     </sql>
 
     <select id="selectFsAppVersionList" parameterType="FsAppVersion" resultMap="FsAppVersionResult">
@@ -57,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateConfig != null">update_config,</if>
             <if test="baiduUrl != null">baidu_url,</if>
             <if test="h5Url != null and h5Url !=''">h5_url,</if>
+            <if test="wgtUrl != null and wgtUrl !=''">wgt_url,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="versionName != null">#{versionName},</if>
@@ -70,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateConfig != null">#{updateConfig},</if>
             <if test="baiduUrl != null">#{baiduUrl},</if>
             <if test="h5Url != null and h5Url !=''">#{h5Url},</if>
+            <if test="wgtUrl != null and wgtUrl !=''">#{wgtUrl},</if>
          </trim>
     </insert>
 
@@ -87,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="updateConfig != null">update_config = #{updateConfig},</if>
             <if test="baiduUrl != null">baidu_url = #{baiduUrl},</if>
             <if test="h5Url != null and h5Url !=''">h5_url = #{h5Url},</if>
+            <if test="wgtUrl != null and wgtUrl !=''">wgt_url = #{wgtUrl},</if>
         </trim>
         where version_id = #{versionId}
     </update>

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

@@ -50,10 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="qwUserId"    column="qw_user_id"    />
         <result property="appId"    column="app_id"    />
         <result property="level" column="level"/>
+        <result property="appOpenId"    column="app_open_id"    />
+        <result property="appleKey"    column="apple_key"    />
     </resultMap>
 
     <sql id="selectFsUserVo">
-        select user_id,qw_ext_id,sex,is_buy,`level`,course_ma_open_id,is_push,is_add_qw,source,login_device,is_individuation_push,store_open_id,password,jpush_id, is_vip,vip_start_date,vip_end_date,vip_level,vip_status,nick_name,integral_status, avatar, phone, integral,sign_num, status, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, create_time, update_time, last_ip, balance,is_weixin_auth,parent_id,qw_user_id,app_id,company_id,company_user_id,is_promoter,now_money,brokerage_price,spread_user_id, spread_time,pay_count, spread_count,user_type from fs_user
+        select user_id,qw_ext_id,sex,is_buy,`level`,course_ma_open_id,is_push,is_add_qw,source,login_device,is_individuation_push,store_open_id,password,jpush_id, is_vip,vip_start_date,vip_end_date,vip_level,vip_status,nick_name,integral_status, avatar, phone, integral,sign_num, status, tui_user_id, tui_time, tui_user_count, ma_open_id, mp_open_id, union_id, is_del, user_code, remark, create_time, update_time, last_ip, balance,is_weixin_auth,parent_id,qw_user_id,app_id,company_id,company_user_id,is_promoter,now_money,brokerage_price,spread_user_id, spread_time,pay_count, spread_count,user_type,app_open_id,apple_key from fs_user
     </sql>
 
     <select id="selectFsUserList" parameterType="FsUser" resultMap="FsUserResult">
@@ -591,6 +593,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="payCount != null">pay_count,</if>
             <if test="spreadCount != null">spread_count,</if>
             <if test="appId != null">app_id,</if>
+            <if test="appOpenId != null">app_open_id,</if>
+            <if test="appleKey != null">apple_key,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="nickName != null">#{nickName},</if>
@@ -641,6 +645,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="payCount != null">#{payCount},</if>
             <if test="spreadCount != null">#{spreadCount},</if>
             <if test="appId != null">#{appId},</if>
+            <if test="appOpenId != null">#{appOpenId},</if>
+            <if test="appleKey != null">#{appleKey},</if>
          </trim>
     </insert>
 
@@ -693,6 +699,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="orderCount != null">order_count = #{orderCount},</if>
             <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
             <if test="appId != null">app_id = #{appId},</if>
+            <if test="appOpenId != null">app_open_id = #{appOpenId},</if>
+            <if test="appleKey != null">apple_key = #{appleKey},</if>
         </trim>
         where user_id = #{userId}
     </update>
@@ -2434,6 +2442,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectFsUserListByPhone" resultType="com.fs.his.domain.FsUser">
         select * from fs_user where phone=#{phone}
     </select>
+    <!-- 查询用户列表(用于积分管理) -->
+    <select id="selectFsUserListForIntegral" parameterType="FsUser" resultMap="FsUserResult">
+        select user_id, nick_name, phone, integral from fs_user
+        <where>
+            and is_del = 0
+            <if test="phone != null and phone != ''">
+                and phone like concat('%', #{phone}, '%')
+            </if>
+            <if test="nickName != null and nickName != ''">
+                and (nick_name like concat('%', #{nickName}, '%') or nickname like concat('%', #{nickName}, '%'))
+            </if>
+        </where>
+        order by user_id desc
+    </select>
 
     <!-- 批量更新用户积分(增加积分) -->
     <update id="batchUpdateUserIntegral">

+ 83 - 11
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java

@@ -3,6 +3,7 @@ package com.fs.app.controller;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateTime;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.app.annotation.Login;
 import com.fs.app.param.*;
 import com.fs.app.utils.WxUtil;
@@ -14,6 +15,8 @@ import com.fs.common.exception.ServiceException;
 import com.fs.common.service.ISmsService;
 import com.fs.common.utils.sign.Md5Utils;
 import com.fs.core.config.WxOpenProperties;
+import com.fs.course.domain.FsCoursePlaySourceConfig;
+import com.fs.course.service.IFsCoursePlaySourceConfigService;
 import com.fs.his.config.FsSysConfig;
 import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserNewTask;
@@ -69,6 +72,9 @@ public class AppLoginController extends AppBaseController{
 
     @Autowired
     private ISmsService smsService;
+    @Autowired
+    private IFsCoursePlaySourceConfigService fsCoursePlaySourceConfigService;
+
     @ApiOperation("注册app用户")
     @PostMapping("/register")
     @RepeatSubmit
@@ -236,8 +242,29 @@ public class AppLoginController extends AppBaseController{
             if (StringUtils.isBlank(param.getCode())) {
                 return R.error("code不存在");
             }
-            logger.info("zyp app微信登录,param:{},输出appid,{},secret:{}", param, openProperties.getAppId(), openProperties.getSecret());
-            Map result = WxUtil.getAccessToken(param.getCode(), openProperties.getAppId(), openProperties.getSecret());
+
+            String appId = param.getAppId();
+            String appSecret = "";
+            if (StringUtils.isBlank(appId)) {
+                List<FsCoursePlaySourceConfig> list = fsCoursePlaySourceConfigService.list(new QueryWrapper<FsCoursePlaySourceConfig>().eq("name", "app").eq("is_del", 0));
+                if(!list.isEmpty()){
+                    FsCoursePlaySourceConfig fsCoursePlaySourceConfig = list.get(0);
+                    appId = fsCoursePlaySourceConfig.getAppid();
+                    appSecret =  fsCoursePlaySourceConfig.getSecret();
+                }
+            } else {
+                FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigService.getOne(new QueryWrapper<FsCoursePlaySourceConfig>().eq("appid", appId).eq("is_del", 0));
+                if(fsCoursePlaySourceConfig != null){
+                    appId = fsCoursePlaySourceConfig.getAppid();
+                    appSecret =  fsCoursePlaySourceConfig.getSecret();
+                }
+            }
+            if (StringUtils.isBlank(appId) || StringUtils.isBlank(appSecret)) {
+                appId = openProperties.getAppId();
+                appSecret = openProperties.getSecret();
+            }
+            logger.info("zyp app微信登录,param:{},输出appid,{},secret:{}", param, appId, appSecret);
+            Map result = WxUtil.getAccessToken(param.getCode(),appId,appSecret);
             String accessToken = result.get("access_token").toString();
             String unionid = result.get("unionid").toString();
 
@@ -257,12 +284,13 @@ public class AppLoginController extends AppBaseController{
                 user.setSource(param.getSource()!=null ? param.getSource() : null);
                 user.setNickName(nickname);
                 user.setAvatar(avatar);
+                user.setAppOpenId(openid);
                 if (sex!=0){
                     user.setSex(sex);
                 }
                 user.setUnionId(unionid);
                 // 新用户 - 添加 appId
-                user.setAppId(openProperties.getAppId());
+                user.setAppId(appId);
                 user.setCreateTime(new Date());
                 user.setStatus(1);
                 if (StringUtils.isNotEmpty(param.getJpushId())) {
@@ -274,7 +302,7 @@ public class AppLoginController extends AppBaseController{
                 return R.ok(map);
             } else {
                 // 老用户 - 检查并添加appId(不重复添加)
-                String updatedAppId = addAppIdIfNotExists(user.getAppId(), openProperties.getAppId());
+                String updatedAppId = addAppIdIfNotExists(user.getAppId(), appId);
                 if (!updatedAppId.equals(user.getAppId())) {
                     FsUser userMap = new FsUser();
                     userMap.setUserId(user.getUserId());
@@ -283,6 +311,7 @@ public class AppLoginController extends AppBaseController{
                 }
 
                 if (StringUtils.isNotEmpty(param.getJpushId())) {
+                    user.setAppOpenId(openid);
                     updateExistingUserJpushId(user, param.getJpushId());
                 }
                 if (StringUtils.isEmpty(user.getPhone())) {
@@ -305,7 +334,6 @@ public class AppLoginController extends AppBaseController{
 
     }
 
-
     @ApiOperation("苹果登录")
     @PostMapping("/loginByApple")
     @Transactional
@@ -323,12 +351,6 @@ public class AppLoginController extends AppBaseController{
             } else {
                 if (StringUtils.isNotEmpty(param.getJpushId())) {
                     updateExistingUserJpushId(user, param.getJpushId());
-                    try {
-                        //发送注册优惠券
-                        fsUserCouponService.sendRegisterCoupon(user);
-                    } catch (Exception e) {
-                        logger.error("发送注册优惠券失败:{}",e.getMessage());
-                    }
                 }
                 if (StringUtils.isEmpty(user.getPhone())) {
                     map.put("isNew", true);
@@ -351,6 +373,52 @@ public class AppLoginController extends AppBaseController{
         }
     }
 
+    private FsUser createNewAppleUser(FsUserEditPhoneParam param, String phoneNumber) {
+        FsUser newUser = new FsUser();
+        newUser.setLoginDevice(param.getLoginDevice()!=null ? param.getLoginDevice() : null);
+        newUser.setSource(param.getSource()!=null ? param.getSource() : null);
+        newUser.setAppleKey(param.getAppleKey());
+        newUser.setPhone(param.getPhone());
+        newUser.setPassword(Md5Utils.hash(param.getPassword()));
+        newUser.setNickName("苹果用户" + param.getPhone().substring(param.getPhone().length() - 4));
+        newUser.setCreateTime(new Date());
+        newUser.setStatus(1);
+        newUser.setAvatar("https://cos.his.cdwjyyh.com/fs/20240926/420728ee06e54575ba82665dedb4756b.png");
+        if (StringUtils.isNotEmpty(param.getJpushId())) {
+            newUser.setJpushId(param.getJpushId());
+        }
+        userService.insertFsUser(newUser);
+        return newUser;
+
+    }
+
+    @ApiOperation("绑定手机号")
+    @PostMapping("/setIPhoneNumber")
+    public R setIPhoneNumber(@Validated @RequestBody FsUserEditPhoneParam param) {
+        FsUser userMap = findUserByPhone(param.getPhone());
+        if (userMap != null) {
+            if (StringUtils.isNotEmpty(userMap.getAppleKey()) && !param.getAppleKey().equals(userMap.getAppleKey())) {
+                return R.error("该手机号已绑定其他账号");
+            }
+            if (param.getSimExist() == 0 && !Md5Utils.hash(param.getPassword()).equals(userMap.getPassword())) {
+                return R.error("密码不正确");
+            }
+        } else {
+            userMap = createNewAppleUser(param, param.getPhone());
+        }
+
+        userMap.setLoginDevice(param.getLoginDevice());
+        userMap.setSource(param.getSource());
+        if (userMap.getNickName().equals("匿名用户**")) {
+            userMap.setNickName("苹果用户" + param.getPhone().substring(param.getPhone().length() - 4));
+        }
+        userMap.setAppleKey(param.getAppleKey());
+        if (userService.updateFsUser(userMap)>0){
+            return generateTokenAndReturn(userMap);
+        }
+        return R.error("绑定手机号失败");
+    }
+
     @PostMapping("/loginByPhone")
     public R loginByPhone(@RequestBody Map<String,String> map){
         String phone = map.get("phone");
@@ -525,6 +593,7 @@ public class AppLoginController extends AppBaseController{
                     user.setAvatar(avatar);
                     user.setSex(sex);
                     user.setUnionId(unionid);
+                    user.setAppOpenId(openid);
                     if (userService.updateFsUser(user)>0){
                         return generateTokenAndReturn(user);
                     }
@@ -544,6 +613,9 @@ public class AppLoginController extends AppBaseController{
         FsUser userMap = new FsUser();
         userMap.setUserId(user.getUserId());
         userMap.setJpushId(jpushId);
+        if (StringUtils.isNotEmpty(user.getAppOpenId())) {
+            userMap.setAppOpenId(user.getAppOpenId());
+        }
         userService.updateFsUser(userMap);
     }
 

+ 9 - 0
fs-user-app/src/main/java/com/fs/app/param/FsUserEditPhoneParam.java

@@ -21,4 +21,13 @@ public class FsUserEditPhoneParam implements Serializable {
     private String jpushId;
 
     private String source;
+
+    private String appleKey;
+
+    private String password;
+
+    /**
+     * 是否有SIM卡 0不存在 1存在
+     */
+    private Integer simExist;
 }

+ 2 - 0
fs-user-app/src/main/java/com/fs/app/param/FsUserLoginByWeChatParam.java

@@ -17,4 +17,6 @@ public class FsUserLoginByWeChatParam implements Serializable {
     private String source; //app来源
 
     private Long userId;
+
+    private String appId; //主要用于app微信登录
 }