Quellcode durchsuchen

调整看课流量统计
注册链接调整

yfh vor 1 Woche
Ursprung
Commit
1bf86fb7c3

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

@@ -257,4 +257,12 @@ public interface IFsUserCourseVideoService extends IService<FsUserCourseVideo> {
     int batchEditCover(BatchEditCoverParam param);
 
     R createZcMiniLink(FsCourseLinkMiniParam param);
+
+    /**
+     * 注册信息
+     *
+     * @param param
+     * @return
+     */
+    R registerQwFsUser(FsUserCourseVideoAddKfUParam param);
 }

+ 40 - 1
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -145,6 +145,8 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
     @Autowired
     private FsUserCourseVideoMapper fsUserCourseVideoMapper;
     @Autowired
+    private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
+    @Autowired
     private QwGroupChatMapper qwGroupChatMapper;
     @Autowired
     private QwGroupChatUserMapper qwGroupChatUserMapper;
@@ -4502,7 +4504,16 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
         news.put("miniprogramAppid", qwCompany.getMiniAppId());
         news.put("miniprogramTitle", "点击注册");
         news.put("miniprogramPage", link.getRealLink());
-        news.put("miniprogramPicUrl", "https://cos.his.cdwjyyh.com/fs/20251008/15512254ec6747949f45071f0338df79.png");
+        FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(qwCompany.getMiniAppId());
+        if (ObjectUtils.isEmpty(fsCoursePlaySourceConfig)) {
+            String json = configService.selectConfigByKey("course.config");
+            CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+
+            news.put("miniprogramPicUrl", config.getSidebarImageUrl());
+        }else {
+            news.put("miniprogramPicUrl",fsCoursePlaySourceConfig.getImg());
+
+        }
 
         return R.ok().put("data",news);
     }
@@ -4530,6 +4541,34 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
 
         return link;
     }
+    @Override
+    public R registerQwFsUser(FsUserCourseVideoAddKfUParam param) {
+        logger.info("zyp \n【判断添加客服】:{}", param);
+
+        // 参数校验
+        if (param == null) {
+            return R.error("参数不能为空");
+        }
 
+        // 查询用户
+        FsUser fsUser = fsUserMapper.selectFsUserByUserId(param.getUserId());
+
+        // 用户不存在唤起重新授权
+        if (fsUser == null) {
+            return R.error(401, "用户不存在");
+        }
+
+        if (fsUser.getStatus() != null && fsUser.getStatus() == 0) {
+            return R.error("会员被停用,无权限,请联系客服!");
+        }
+
+        // 处理群聊逻辑
+        if (param.getChatId() != null) {
+            return handleGroupChatLogic(param,fsUser);
+        }
+
+        // 处理普通外部联系人逻辑
+        return handleExternalContactLogic(param, fsUser);
+    }
 }
 

+ 19 - 5
fs-service/src/main/java/com/fs/qw/service/impl/CustomerTransferApprovalServiceImpl.java

@@ -186,13 +186,27 @@ public class CustomerTransferApprovalServiceImpl implements ICustomerTransferApp
 
     private String safeFormat(String format, Object... args) {
         try {
-            Object[] safeArgs = Arrays.stream(args)
-                    .map(arg -> Objects.toString(arg, ""))
-                    .toArray();
-            return String.format(format, safeArgs);
+            // 尝试直接格式化
+            return String.format(format, args);
         } catch (Exception e) {
             log.warn("字符串格式化异常: format={}, args={}", format, Arrays.toString(args), e);
-            return Arrays.toString(args);
+
+            // 尝试将所有参数转为字符串再格式化
+            try {
+                Object[] stringArgs = Arrays.stream(args)
+                        .map(arg -> arg == null ? "null" : arg.toString())
+                        .toArray();
+                // 将 %d 替换为 %s
+                String safeFormat = format.replace("%d", "%s");
+                return String.format(safeFormat, stringArgs);
+            } catch (Exception ex) {
+                // 如果还是失败,返回最简单的格式
+                StringBuilder result = new StringBuilder(format);
+                for (Object arg : args) {
+                    result.append(" ").append(arg);
+                }
+                return result.toString();
+            }
         }
     }
 

+ 21 - 9
fs-service/src/main/resources/mapper/course/FsCourseTrafficLogMapper.xml

@@ -137,6 +137,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">company_id,</if>
             <if test="courseId != null">course_id,</if>
             <if test="uuId != null">uu_id,</if>
+            <if test="project != null">project,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
@@ -149,6 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">#{companyId},</if>
             <if test="courseId != null">#{courseId},</if>
             <if test="uuId != null">#{uuId},</if>
+            <if test="project != null">#{project},</if>
          </trim>
     </insert>
 
@@ -165,6 +167,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">company_id,</if>
             <if test="courseId != null">course_id,</if>
             <if test="uuId != null">uu_id,</if>
+            <if test="project != null">project,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
@@ -177,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="companyId != null">#{companyId},</if>
             <if test="courseId != null">#{courseId},</if>
             <if test="uuId != null">#{uuId},</if>
+            <if test="project != null">#{project},</if>
         </trim>
         on duplicate key update
         <trim suffixOverrides=",">
@@ -247,26 +251,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <select id="selectTrafficNew" resultType="com.fs.course.vo.FsCourseTrafficLogListVO">
-        select company_id,project,course_id,SUM(internet_traffic) AS total_internet_traffic
-        ,DATE_FORMAT(create_time, '%Y-%m-%d') AS `month`  from fs_course_traffic_log
+        select a.company_id,
+        <if test="tabType!=null and tabType=='project'">
+            b.project,
+        </if>
+
+        a.course_id,SUM(a.internet_traffic) AS total_internet_traffic
+        ,DATE_FORMAT(a.create_time, '%Y-%m-%d') AS `month`  from fs_course_traffic_log a
+        <if test="tabType!=null and tabType=='project'">
+            left join fs_user_course b on a.course_id = b.course_id
+        </if>
         <where>
             <if test="startDate != null and endDate != null">
-                and DATE_FORMAT(create_time, '%Y-%m-%d') between #{startDate} AND #{endDate}
+                and DATE_FORMAT(a.create_time, '%Y-%m-%d') between #{startDate} AND #{endDate}
             </if>
             <if test="companyId !=null">
-                and company_id = #{companyId}
+                and a.company_id = #{companyId}
             </if>
             <if test="courseId != null">
-                and course_id = ${courseId}
+                and a.course_id = ${courseId}
             </if>
             <if test="project != null">
-                and project = ${project}
+                and b.project = ${project}
             </if>
             <if test="common == null">
-                AND company_id IS not NULL
+                AND a.company_id IS not NULL
             </if>
             <if test="common != null ">
-                AND company_id IS NULL
+                AND a.company_id IS NULL
             </if>
         </where>
 
@@ -274,7 +286,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             group by company_id,`month`,course_id,project
         </if>
         <if test="tabType!=null and tabType=='project'">
-            group by project,`month`
+            group by b.project,`month`
         </if>
         <if test="tabType!=null and tabType=='course'">
             group by course_id,`month`

+ 8 - 0
fs-user-app/src/main/java/com/fs/app/controller/course/CourseQwController.java

@@ -486,5 +486,13 @@ public class CourseQwController extends AppBaseController {
         fastgptEventLogTotalService.eventLogTotals(startTime,endTime);
         return R.ok();
     }
+    @Login
+    @ApiOperation("注册链接接口")
+    @PostMapping("/registerQwFsUser")
+    public R registerQwFsUser(@RequestBody FsUserCourseVideoAddKfUParam param) {
+        Long userId = Long.parseLong(getUserId());
+        param.setUserId(userId);
+        return courseVideoService.registerQwFsUser(param);
+    }
 
 }