Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

yjwang 1 viikko sitten
vanhempi
commit
a3d9ced699
22 muutettua tiedostoa jossa 668 lisäystä ja 17 poistoa
  1. 11 0
      fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java
  2. 67 0
      fs-company-app/src/main/java/com/fs/app/controller/FsUserCoursePeriodController.java
  3. 46 0
      fs-company-app/src/main/java/com/fs/app/controller/qw/QwFsCourseWatchLogController.java
  4. 2 0
      fs-company/src/main/java/com/fs/company/controller/qw/QwMaterialController.java
  5. 1 1
      fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java
  6. 5 3
      fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java
  7. 73 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java
  8. 72 0
      fs-qwhook-sop/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java
  9. 81 0
      fs-qwhook/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java
  10. 73 0
      fs-qwhook/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java
  11. 1 1
      fs-service/src/main/java/com/fs/course/service/IFsUserCoursePeriodDaysService.java
  12. 16 1
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodDaysServiceImpl.java
  13. 3 0
      fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java
  14. 11 2
      fs-service/src/main/java/com/fs/qw/domain/QwMaterial.java
  15. 5 1
      fs-service/src/main/java/com/fs/qw/mapper/QwMaterialMapper.java
  16. 6 1
      fs-service/src/main/java/com/fs/qw/param/QwMaterialParam.java
  17. 28 0
      fs-service/src/main/java/com/fs/qw/param/QwMaterialParamBySidebar.java
  18. 8 0
      fs-service/src/main/java/com/fs/qw/service/IQwMaterialService.java
  19. 147 7
      fs-service/src/main/java/com/fs/qw/service/impl/QwMaterialServiceImpl.java
  20. 1 0
      fs-service/src/main/resources/application-config-dev.yml
  21. 1 0
      fs-service/src/main/resources/application-config-druid-xfk.yml
  22. 10 0
      fs-service/src/main/resources/mapper/qw/QwMaterialMapper.xml

+ 11 - 0
fs-admin/src/main/java/com/fs/qw/qwTask/qwTask.java

@@ -3,6 +3,7 @@ package com.fs.qw.qwTask;
 import com.fs.course.service.IFsUserCourseService;
 import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.service.IQwGroupMsgService;
+import com.fs.qw.service.IQwMaterialService;
 import com.fs.qw.service.IQwUserService;
 import com.fs.sop.service.impl.QwSopLogsServiceImpl;
 import com.fs.sop.service.impl.QwSopServiceImpl;
@@ -46,6 +47,10 @@ public class qwTask {
     @Autowired
     private IFsStatisQwWatchService fsStatisQwWatchService;
 
+    @Autowired
+    private IQwMaterialService iQwMaterialService;
+
+
     //正在使用
     public void qwExternalContact()
     {
@@ -188,4 +193,10 @@ public class qwTask {
         fsStatisQwWatchService.writeData(today.toString());
     }
 
+    /**
+    * 每俩天 更新一次 素材库
+    */
+    public void updateMaterialByTwoDays(){
+        iQwMaterialService.updateQwMaterialByQw();
+    }
 }

+ 67 - 0
fs-company-app/src/main/java/com/fs/app/controller/FsUserCoursePeriodController.java

@@ -0,0 +1,67 @@
+package com.fs.app.controller;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsUserCoursePeriod;
+import com.fs.course.domain.FsUserCoursePeriodDays;
+import com.fs.course.domain.FsUserCourseVideoRedPackage;
+import com.fs.course.param.CompanyRedPacketParam;
+import com.fs.course.param.FsBatchPeriodRedPackageParam;
+import com.fs.course.param.PeriodCountParam;
+import com.fs.course.param.PeriodStatisticCountParam;
+import com.fs.course.service.IFsUserCoursePeriodDaysService;
+import com.fs.course.service.IFsUserCoursePeriodService;
+import com.fs.course.service.IFsUserCourseVideoRedPackageService;
+import com.fs.course.vo.FsPeriodCountVO;
+import com.fs.course.vo.FsUserCoursePeriodVO;
+import com.fs.course.vo.PeriodRedPacketVO;
+import com.fs.course.vo.UpdateCourseTimeVo;
+import com.fs.his.vo.OptionsVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 会员营期Controller
+ *
+ * @author fs
+ * @date 2025-04-11
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/course/period")
+@Slf4j
+public class FsUserCoursePeriodController extends BaseController {
+
+    private final IFsUserCoursePeriodService fsUserCoursePeriodService;
+
+    @PostMapping("/periodCourseStatisticCount")
+    @ApiOperation("会员详情训练营数据总览")
+    public R periodCourseStatisticCount(@RequestBody PeriodStatisticCountParam param) {
+        if (param == null) {
+            return R.error("请求参数不能为空!");
+        }
+        return R.ok().put("data", fsUserCoursePeriodService.periodCourseStatisticCount(param));
+    }
+
+    @PostMapping("/periodlist")
+    public R periodList(@RequestBody PeriodStatisticCountParam param)
+    {
+        List<FsUserCoursePeriod> list = fsUserCoursePeriodService.selectFsPeriodlist(param);
+        return R.ok().put("data", list);
+    }
+}

+ 46 - 0
fs-company-app/src/main/java/com/fs/app/controller/qw/QwFsCourseWatchLogController.java

@@ -0,0 +1,46 @@
+package com.fs.app.controller.qw;
+
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.core.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.exception.CustomException;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.course.domain.FsCourseWatchLog;
+import com.fs.course.param.FsCourseWatchLogListParam;
+import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
+import com.fs.course.param.PeriodStatisticCountParam;
+import com.fs.course.service.IFsCourseWatchLogService;
+import com.fs.course.vo.FsCourseWatchLogListVO;
+import com.fs.course.vo.FsCourseWatchLogStatisticsListVO;
+import com.fs.qw.param.QwWatchLogStatisticsListParam;
+import com.fs.qw.service.IQwWatchLogService;
+import com.fs.qw.vo.QwWatchLogAllStatisticsListVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 短链课程看课记录Controller
+ *
+ * @author fs
+ * @date 2024-10-24
+ */
+@RestController
+@RequestMapping("/qw/course/courseWatchLog")
+public class QwFsCourseWatchLogController extends BaseController {
+    @Autowired
+    private IFsCourseWatchLogService fsCourseWatchLogService;
+
+    //    @PreAuthorize("@ss.hasPermi('course:courseWatchLog:list')")
+    @GetMapping("/listBytrainingCampId")
+    public TableDataInfo listBytrainingCampId(PeriodStatisticCountParam param) {
+        startPage();
+        List<FsCourseWatchLogListVO> list = fsCourseWatchLogService.selectListBytrainingCampId(param);
+        return getDataTable(list);
+    }
+}

+ 2 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwMaterialController.java

@@ -1,6 +1,7 @@
 package com.fs.company.controller.qw;
 
 import com.fs.common.annotation.Log;
+import com.fs.common.annotation.RepeatSubmit;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
 import com.fs.common.core.domain.R;
@@ -101,6 +102,7 @@ public class QwMaterialController extends BaseController
     @PreAuthorize("@ss.hasPermi('qw:material:add')")
     @Log(title = "素材库", businessType = BusinessType.INSERT)
     @PostMapping
+    @RepeatSubmit
     public R add(@RequestBody QwMaterial qwMaterial) throws Exception {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         qwMaterial.setCreateUserId(loginUser.getUser().getUserId());

+ 1 - 1
fs-ipad-task/src/main/java/com/fs/app/task/SendMsg.java

@@ -161,7 +161,7 @@ public class SendMsg {
             Long time = redisCache.getCacheObject(key);
             if (redisCache.getCacheObject(key) != null) {
                 log.error("{}已有发送:{}, :{}", qwUser.getQwUserName(), qwSopLogs.getId(), time);
-                return;
+                continue;
             }
             redisCache.setCacheObject(key, System.currentTimeMillis(), 10, TimeUnit.MINUTES);
             for (QwSopCourseFinishTempSetting.Setting content : setting.getSetting()) {

+ 5 - 3
fs-qw-task/src/main/java/com/fs/app/controller/CommonController.java

@@ -16,6 +16,7 @@ import com.fs.his.service.IFsInquiryOrderService;
 import com.fs.his.service.IFsPackageOrderService;
 import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.sop.mapper.QwSopLogsMapper;
 import com.fs.sop.mapper.QwSopMapper;
@@ -99,6 +100,8 @@ public class CommonController {
     @Autowired
     private IFsInquiryOrderService inquiryOrderService;
 
+    @Autowired
+    private IQwMaterialService iQwMaterialService;
 
     /**
     * 发官方通连
@@ -139,9 +142,8 @@ public class CommonController {
     @GetMapping("/testSop")
     public R testSop() throws Exception {
 
-        byte[] bytes = inquiryOrderService.getWxaCodeInquiryOrderUnLimit(2582616L);
-        String base64 = Base64.getEncoder().encodeToString(bytes);
-        return R.ok().put("data",base64);
+        iQwMaterialService.updateQwMaterialByQw();
+        return R.ok();
     }
 
     @GetMapping("/testRatingSop")

+ 73 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java

@@ -0,0 +1,73 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/apis/app/qw/material")
+@Slf4j
+public class ApisQwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 72 - 0
fs-qwhook-sop/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java

@@ -0,0 +1,72 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/app/qw/material")
+@Slf4j
+public class QwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 81 - 0
fs-qwhook/src/main/java/com/fs/app/controller/ApisQwMaterialBySidebar.java

@@ -0,0 +1,81 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwMaterial;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/apis/app/qw/material")
+@Slf4j
+public class ApisQwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    /**
+    * 更新 素材库的某个素材的 media_id
+    */
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    /**
+    * 获取某个素材id
+    */
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+
+}

+ 73 - 0
fs-qwhook/src/main/java/com/fs/app/controller/QwMaterialBySidebar.java

@@ -0,0 +1,73 @@
+package com.fs.app.controller;
+
+import com.fs.common.core.domain.R;
+import com.fs.qw.domain.QwUser;
+import com.fs.qw.param.QwMaterialParam;
+import com.fs.qw.param.QwMaterialParamBySidebar;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwMaterialService;
+import com.fs.qw.vo.QwMaterialVO;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Api("素材库库相关接口")
+@RestController
+@RequestMapping("/app/qw/material")
+@Slf4j
+public class QwMaterialBySidebar {
+
+
+
+    @Autowired
+    private IQwExternalContactService qwExternalContactService;
+
+    @Autowired
+    private IQwMaterialService qwMaterialService;
+
+    /**
+     * 查询素材库列表
+     */
+    @PostMapping("/MaterialList")
+    public R list(@RequestBody QwMaterialParamBySidebar param)
+    {
+
+        QwUser qwUser = qwExternalContactService.getQwUserByRedis(param.getCorpId().trim(),param.getQwUserId().trim());
+
+        if (qwUser == null || qwUser.getCompanyId() == null) {
+            return R.error("员工未绑定 销售公司 或 未获取到员工信息,请重试!");
+        }
+
+
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+
+        QwMaterialParam materialParam=new QwMaterialParam();
+        materialParam.setCompanyId(qwUser.getCompanyId());
+        materialParam.setTitle(param.getKeyword());
+        List<QwMaterialVO> list = qwMaterialService.selectQwMaterialList(materialParam);
+
+
+        PageInfo<QwMaterialVO> result = new PageInfo<>(list);
+        return R.ok().put("data", result);
+
+
+    }
+
+    @GetMapping("/updateMaterialTime/{materialId}")
+    public R updateMaterialTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTime(materialId));
+    }
+
+    @GetMapping("/getMaterialByTime/{materialId}")
+    public R getMaterialByTime(@PathVariable Long materialId) throws Exception {
+
+        return R.ok().put("data",qwMaterialService.selectQwMaterialByMaterialIdByTimeTwo(materialId));
+    }
+
+}

+ 1 - 1
fs-service/src/main/java/com/fs/course/service/IFsUserCoursePeriodDaysService.java

@@ -13,7 +13,7 @@ import com.fs.his.vo.OptionsVO;
 import java.util.List;
 import java.util.Map;
 
-/**
+    /**
  * 营期课程Service接口
  *
  * @author fs

+ 16 - 1
fs-service/src/main/java/com/fs/course/service/impl/FsUserCoursePeriodDaysServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.course.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
@@ -24,6 +25,8 @@ import com.fs.course.vo.UpdateCourseTimeVo;
 import com.fs.course.vo.newfs.FsCourseAnalysisCountVO;
 import com.fs.his.mapper.FsUserMapper;
 import com.fs.his.vo.OptionsVO;
+import com.fs.system.domain.SysConfig;
+import com.fs.system.mapper.SysConfigMapper;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -54,6 +57,7 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
     private final FsUserCoursePeriodMapper fsUserCoursePeriodMapper;
 
     private final FsUserMapper fsUserMapper;
+    private final SysConfigMapper sysConfigMapper;
 
     private final FsUserCoursePeriodDaysMapper fsUserCoursePeriodDaysMapper;
     private final IFsUserCourseVideoService fsUserCourseVideoService;
@@ -178,6 +182,10 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             }else if(video.getViewEndTime() != null){
                 day.setEndDateTime(LocalDateTime.of(day.getDayDate(), video.getViewEndTime()));
             }
+            SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
+            if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
+                entity.setJoinTime(entity.getEndTime1());
+            }
             if(entity.getJoinTime() != null){
                 day.setLastJoinTime(LocalDateTime.of(day.getDayDate(), entity.getJoinTime()));
             }else if(video.getLastJoinTime() != null){
@@ -339,7 +347,14 @@ public class FsUserCoursePeriodDaysServiceImpl extends ServiceImpl<FsUserCourseP
             // 调整时间为直接接收前端传入的年月日,不使用营期的日期(2025年6月11日 10点41分)
             day.setStartDateTime(vo.getStartTime());
             day.setEndDateTime(vo.getEndTime1());
-            day.setLastJoinTime(vo.getJoinTime());
+
+            SysConfig config = sysConfigMapper.selectConfigByConfigKey("joinTime.switch.config");
+            if (ObjectUtils.isNotEmpty(config)&&config.getConfigValue().equals("1")){
+                day.setLastJoinTime(vo.getEndTime1());
+            }else {
+                day.setLastJoinTime(vo.getJoinTime());
+            }
+
             // 把营期时间改成开始时间
             day.setDayDate(vo.getStartTime().toLocalDate());
             // 设置状态

+ 3 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -858,6 +858,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 //        if (StringUtils.isEmpty(user.getMpOpenId())){
 //            return R.error("未识别到领取信息");
 //        }
+        if (user.getStatus()==0){
+            return R.error("会员被停用,无权限,请联系客服!");
+        }
         FsCourseWatchLog log = new FsCourseWatchLog();
 
         // 根据链接类型判断是否已发放奖励

+ 11 - 2
fs-service/src/main/java/com/fs/qw/domain/QwMaterial.java

@@ -1,5 +1,7 @@
 package com.fs.qw.domain;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
@@ -14,11 +16,12 @@ import java.util.Date;
  * @date 2024-06-20
  */
 @Data
-public class QwMaterial extends BaseEntity
+public class QwMaterial
 {
     private static final long serialVersionUID = 1L;
 
     /** 素材库id */
+    @TableId(type = IdType.AUTO)
     private Long materialId;
 
     /** 媒体文件类型,分别有图片(image),语音(voice),视频(video),普通文件(file) */
@@ -31,7 +34,7 @@ public class QwMaterial extends BaseEntity
 
     /** 媒体文件上传时间戳 */
     @Excel(name = "媒体文件上传时间戳")
-    private String createdAt;
+    private Long createdAt;
 
     /** 文件地址,图片可以上传永久的,其他类型的3天有效 */
     @Excel(name = "文件地址,图片可以上传永久的,其他类型的3天有效")
@@ -74,6 +77,12 @@ public class QwMaterial extends BaseEntity
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
+    /**
+     *  更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
 
     /**
      *  素材分类 1 普通素材组 2 朋友圈素材组

+ 5 - 1
fs-service/src/main/java/com/fs/qw/mapper/QwMaterialMapper.java

@@ -1,6 +1,7 @@
 package com.fs.qw.mapper;
 
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.fs.qw.domain.QwMaterial;
 import com.fs.qw.param.QwMaterialParam;
 import com.fs.qw.vo.QwMaterialVO;
@@ -15,7 +16,7 @@ import java.util.List;
  * @author fs
  * @date 2024-06-20
  */
-public interface QwMaterialMapper
+public interface QwMaterialMapper extends BaseMapper<QwMaterial>
 {
     /**
      * 查询素材库
@@ -107,4 +108,7 @@ public interface QwMaterialMapper
      * @return 结果
      */
     public int deleteQwMaterialByMaterialIds(Long[] materialIds);
+    public List<QwMaterial> selectQwMaterialListByMediaIdList();
+
+
 }

+ 6 - 1
fs-service/src/main/java/com/fs/qw/param/QwMaterialParam.java

@@ -1,10 +1,12 @@
 package com.fs.qw.param;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.annotation.Excel;
 import com.fs.common.core.domain.BaseEntity;
 import lombok.Data;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -14,7 +16,7 @@ import java.util.Date;
  * @date 2024-06-20
  */
 @Data
-public class QwMaterialParam extends BaseEntity
+public class QwMaterialParam extends BaseEntity implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -79,4 +81,7 @@ public class QwMaterialParam extends BaseEntity
      *  素材分类 1 普通素材组 2 朋友圈素材组
      */
     private Integer groupType;
+
+    @TableField(exist = false)
+    private String QwUserId;
 }

+ 28 - 0
fs-service/src/main/java/com/fs/qw/param/QwMaterialParamBySidebar.java

@@ -0,0 +1,28 @@
+package com.fs.qw.param;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class QwMaterialParamBySidebar  implements Serializable  {
+
+
+    @ApiModelProperty(value = "页码,默认为1", required = true)
+    private Integer pageNum = 1;
+
+    @ApiModelProperty(value = "页大小,默认为10", required = true)
+    private Integer pageSize = 10;
+
+    @ApiModelProperty(value = "模糊搜索,通过视频名称来匹配")
+    private String keyword;
+
+    @ApiModelProperty(value = "公司id")
+    private Long companyId;
+
+    private String corpId;
+
+    private String qwUserId;
+
+}

+ 8 - 0
fs-service/src/main/java/com/fs/qw/service/IQwMaterialService.java

@@ -63,4 +63,12 @@ public interface IQwMaterialService
      * @return 结果
      */
     public int deleteQwMaterialByMaterialId(Long materialId);
+
+    /**
+    * 定时更新 上传的企业微信素材库
+    */
+    public void updateQwMaterialByQw();
+
+    public QwMaterial selectQwMaterialByMaterialIdByTime(Long materialId) throws Exception;
+    public QwMaterial selectQwMaterialByMaterialIdByTimeTwo(Long materialId) throws Exception;
 }

+ 147 - 7
fs-service/src/main/java/com/fs/qw/service/impl/QwMaterialServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.qw.service.impl;
 
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.DateUtils;
 import com.fs.qw.domain.QwMaterial;
@@ -11,6 +12,7 @@ import com.fs.qw.vo.QwMaterialVO;
 import com.fs.qwApi.Result.QwUploadResult;
 import com.fs.qwApi.service.QwApiService;
 import com.fs.voice.utils.StringUtil;
+import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -19,8 +21,14 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URL;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
 
 /**
  * 素材库Service业务层处理
@@ -28,8 +36,9 @@ import java.util.List;
  * @author fs
  * @date 2024-06-20
  */
+@Log4j2
 @Service
-public class QwMaterialServiceImpl implements IQwMaterialService
+public class QwMaterialServiceImpl extends ServiceImpl<QwMaterialMapper, QwMaterial> implements IQwMaterialService
 {
     @Autowired
     private QwMaterialMapper qwMaterialMapper;
@@ -73,14 +82,62 @@ public class QwMaterialServiceImpl implements IQwMaterialService
 
         //调用企业微信接口 上次临时图片
 
-        File fileImage = urlToFile(qwMaterial.getMaterialUrl());
-        QwUploadResult imageResult = qwApiService.upload(fileImage, "image", qwMaterial.getCorpId());
-        if (imageResult.getErrCode()==0){
-            qwMaterial.setMaterialMediaId(imageResult.getMediaId());
+        if ("text".equals(qwMaterial.getMaterialType())){
             qwMaterialMapper.insertQwMaterial(qwMaterial);
             return R.ok();
-        }else {
-            return R.error("上传图片失败:"+imageResult.getErrMsg());
+        }else if ("image".equals(qwMaterial.getMaterialType())
+                ||"video".equals(qwMaterial.getMaterialType())
+                ||"file".equals(qwMaterial.getMaterialType())){
+            return uploadAndSaveQwMaterial(qwMaterial);
+        }
+
+        return R.ok();
+
+    }
+
+    public R uploadAndSaveQwMaterial(QwMaterial qwMaterial){
+        try {
+            // 将URL转换为文件
+            File materialFile = urlToFile(qwMaterial.getMaterialUrl());
+
+            // 上传素材到企业微信
+            QwUploadResult uploadResult = qwApiService.upload(materialFile, qwMaterial.getMaterialType(), qwMaterial.getCorpId());
+
+            if (uploadResult.getErrCode() == 0) {
+                // 设置素材信息并保存到数据库
+                qwMaterial.setMaterialMediaId(uploadResult.getMediaId());
+                qwMaterial.setCreatedAt(Long.valueOf(uploadResult.getCreatedAt()));
+                qwMaterialMapper.insertQwMaterial(qwMaterial);
+                return R.ok();
+            } else {
+                return R.error("上传"+qwMaterial.getMaterialType()+"失败:" + uploadResult.getErrMsg());
+            }
+        } catch (Exception e) {
+            return R.error("处理"+qwMaterial.getMaterialType()+"时发生异常:" + e.getMessage());
+        }
+    }
+
+    public QwMaterial uploadAndSaveQwMaterialByDTO(QwMaterial qwMaterial){
+        try {
+            // 将URL转换为文件
+            File materialFile = urlToFile(qwMaterial.getMaterialUrl());
+
+            // 上传素材到企业微信
+            QwUploadResult uploadResult = qwApiService.upload(materialFile, qwMaterial.getMaterialType(), qwMaterial.getCorpId());
+
+            if (uploadResult.getErrCode() == 0) {
+                // 设置素材信息并保存到数据库
+                qwMaterial.setMaterialMediaId(uploadResult.getMediaId());
+                qwMaterial.setCreatedAt(Long.valueOf(uploadResult.getCreatedAt()));
+                qwMaterialMapper.insertQwMaterial(qwMaterial);
+                return qwMaterial;
+            } else {
+                log.error("上传DTO"+qwMaterial.getMaterialType()+"失败:" + uploadResult.getErrMsg());
+                return null;
+            }
+        } catch (Exception e) {
+            log.error("处理DTO"+qwMaterial.getMaterialType()+"时发生异常:" + e.getMessage());
+            return null;
         }
     }
 
@@ -188,6 +245,89 @@ public class QwMaterialServiceImpl implements IQwMaterialService
     @Override
     public int deleteQwMaterialByMaterialId(Long materialId)
     {
+        log.info("删除素材库中信息:{}",qwMaterialMapper.selectQwMaterialByMaterialId(materialId));
         return qwMaterialMapper.deleteQwMaterialByMaterialId(materialId);
     }
+
+    @Override
+    public void updateQwMaterialByQw() {
+
+        List<QwMaterial> qwMaterials = qwMaterialMapper.selectQwMaterialListByMediaIdList();
+
+
+        // 创建线程安全的集合用于存储处理结果
+        ConcurrentLinkedQueue<QwMaterial> successQueue = new ConcurrentLinkedQueue<>();
+
+        // 创建线程池
+        int threadPoolSize = Math.min(8, Runtime.getRuntime().availableProcessors() * 2);
+        ExecutorService executor = Executors.newFixedThreadPool(threadPoolSize);
+
+        try {
+            // 创建并执行所有异步任务
+            List<CompletableFuture<Void>> futures = qwMaterials.stream()
+                    .filter(item -> "image".equals(item.getMaterialType())
+                            || "video".equals(item.getMaterialType())
+                            || "file".equals(item.getMaterialType()))
+                    .map(item -> CompletableFuture.runAsync(() -> {
+                        try {
+                            // 将URL转换为文件
+                            File materialFile = urlToFile(item.getMaterialUrl());
+
+                            // 上传素材到企业微信
+                            QwUploadResult uploadResult = qwApiService.upload(
+                                    materialFile,
+                                    item.getMaterialType(),
+                                    item.getCorpId()
+                            );
+
+                            if (uploadResult.getErrCode() == 0) {
+                                // 设置素材信息
+                                item.setMaterialMediaId(uploadResult.getMediaId());
+                                item.setCreatedAt(Long.valueOf(uploadResult.getCreatedAt()));
+                                successQueue.add(item);
+                            } else {
+                                log.error("上传失败:{},{}", uploadResult.getErrMsg(), item);
+                            }
+                        } catch (Exception e) {
+                            log.error("上传失败异常:{},{}", e.getMessage(), item);
+                        }
+                    }, executor))
+                    .collect(Collectors.toList());
+
+            // 等待所有任务完成
+            CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+
+            // 批量更新成功的记录
+            if (!successQueue.isEmpty()) {
+                super.saveOrUpdateBatch(new ArrayList<>(successQueue),300);
+            }
+
+
+        } finally {
+            // 关闭线程池
+            executor.shutdown();
+        }
+    }
+
+    @Override
+    public QwMaterial selectQwMaterialByMaterialIdByTime(Long materialId) throws Exception {
+
+        return uploadAndSaveQwMaterialByDTO(qwMaterialMapper.selectQwMaterialByMaterialId(materialId));
+    }
+
+    @Override
+    public QwMaterial selectQwMaterialByMaterialIdByTimeTwo(Long materialId) throws Exception {
+
+        QwMaterial qwMaterial = qwMaterialMapper.selectQwMaterialByMaterialId(materialId);
+
+        Long createdAt = qwMaterial.getCreatedAt();
+        boolean isOver48h = createdAt != null
+                && (System.currentTimeMillis() / 1000 - createdAt) > 172800;
+
+        if (qwMaterial.getMaterialType() != null && isOver48h) {
+            return uploadAndSaveQwMaterialByDTO(qwMaterial);
+        }
+
+        return qwMaterial;
+    }
 }

+ 1 - 0
fs-service/src/main/resources/application-config-dev.yml

@@ -85,6 +85,7 @@ headerImg:
   imgUrl: https://jz-cos-1356808054.cos.ap-chengdu.myqcloud.com/fs/20250515/0877754b59814ea8a428fa3697b20e68.png
 ipad:
   ipadUrl: http://ipad.cdwjyyh.com
+  aiApi:
 wx_miniapp_temp:
   pay_order_temp_id:
   inquiry_temp_id:

+ 1 - 0
fs-service/src/main/resources/application-config-druid-xfk.yml

@@ -87,6 +87,7 @@ headerImg:
   imgUrl: https://xiaofangke-1360933944.cos.ap-nanjing.myqcloud.com/xiaofangke/20250610/9c3fb587d224492e8b61f5dece0b8b7b.png
 ipad:
   ipadUrl: http://ipad.cdwjyyh.com
+  aiApi:
 wx_miniapp_temp:
   pay_order_temp_id: VXEvKaGNPFuJmhWK9O_QPrTZxe9umDCukq-maI8Vdek
   inquiry_temp_id: 9POPYeqhI48LOPvq-Rfoklze7H-9SlunJKh10Qt4_2I

+ 10 - 0
fs-service/src/main/resources/mapper/qw/QwMaterialMapper.xml

@@ -54,6 +54,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where material_id = #{materialId}
     </select>
 
+    <select id="selectQwMaterialListByMediaIdList"  resultMap="QwMaterialResult">
+        SELECT
+            material_id, material_type, material_media_id, created_at, material_name,
+            material_url, material_group_id, company_id, text_content, create_time,
+            title, title_url, update_time, create_user_id, send_count, group_type, corp_id
+        FROM qw_material
+        WHERE material_media_id IS NOT NULL
+        AND created_at &lt; UNIX_TIMESTAMP() - 48*3600;
+    </select>
+
     <insert id="insertQwMaterial" parameterType="QwMaterial">
         insert into qw_material
         <trim prefix="(" suffix=")" suffixOverrides=",">