Browse Source

Merge remote-tracking branch 'origin/master'

yuhongqi 2 weeks ago
parent
commit
0a13a712be

+ 10 - 0
fs-company/src/main/java/com/fs/company/controller/company/CompanyController.java

@@ -17,6 +17,7 @@ import com.fs.framework.service.TokenService;
 import com.fs.his.vo.OptionsVO;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
@@ -121,4 +122,13 @@ public class CompanyController extends BaseController
         List<OptionsVO> list = companyService.getCompanyListByCorpId(corpId);
         return R.ok().put("data",list);
     }
+
+    // 同步销售公司的 图片
+    @GetMapping("/syncCompanyCorIdImage")
+    @PreAuthorize("@ss.hasPermi('qw:tagGroup:imageSync')")
+    public R SyncCompanyCorIdImage() {
+        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+        companyService.SyncCompanyCorIdImage(loginUser.getUser().getCompanyId());
+        return R.ok();
+    }
 }

+ 2 - 0
fs-service/src/main/java/com/fs/company/service/ICompanyService.java

@@ -212,4 +212,6 @@ public interface ICompanyService
      * 根据公司id集合查询多个公司
      * */
     List<Company> queryCompanyListByCompanyIds(List<Long> companyIds);
+
+    void SyncCompanyCorIdImage(Long companyId);
 }

+ 44 - 0
fs-service/src/main/java/com/fs/company/service/impl/CompanyServiceImpl.java

@@ -27,8 +27,11 @@ import com.fs.company.vo.*;
 import com.fs.course.config.CourseConfig;
 import com.fs.course.config.RedPacketConfig;
 import com.fs.course.domain.FsCourseRedPacketLog;
+import com.fs.course.domain.FsUserCourse;
 import com.fs.course.mapper.FsCourseRedPacketLogMapper;
+import com.fs.course.mapper.FsUserCourseMapper;
 import com.fs.course.service.IFsCourseRedPacketLogService;
+import com.fs.course.service.impl.FsUserCourseServiceImpl;
 import com.fs.his.config.StoreConfig;
 import com.fs.his.domain.FsInquiryOrder;
 import com.fs.his.domain.FsStoreOrder;
@@ -44,6 +47,9 @@ import com.fs.hisStore.mapper.FsStoreOrderScrmMapper;
 import com.fs.live.domain.LiveOrder;
 import com.fs.live.mapper.LiveOrderMapper;
 import com.fs.live.service.ILiveService;
+import com.fs.qw.domain.QwCompany;
+import com.fs.qw.mapper.QwCompanyMapper;
+import com.fs.qw.service.IQwCompanyService;
 import com.fs.store.config.CompanyMenuConfig;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
@@ -148,6 +154,15 @@ public class CompanyServiceImpl implements ICompanyService
     private ICompanyConfigService companyConfigService;
     @Autowired
     CompanyBindGatewayMapper companyBindGatewayMapper;
+    @Autowired
+    private FsUserCourseMapper fsUserCourseMapper;
+
+    @Autowired
+    private QwCompanyMapper qwCompanyMapper;
+
+    @Autowired
+    @Lazy
+    private FsUserCourseServiceImpl fsUserCourseService;
 
     @Value("${cloud_host.company_name}")
     private String companyName;
@@ -2040,4 +2055,33 @@ public class CompanyServiceImpl implements ICompanyService
         return companyList;
     }
 
+    @Override
+    public void SyncCompanyCorIdImage(Long companyId) {
+
+        // 获取所有需要处理的课程列表
+        List<FsUserCourse> fsUserCourses = fsUserCourseMapper.selectFsUserCourseAllCourseByQw();
+
+        // 获取所有企业微信配置
+        List<String> cropIds = qwCompanyMapper.selectQwCompanyCorpIdListByCompanyId(companyId);
+
+        // 遍历每个企业微信配置
+        for (String corpId : cropIds) {
+
+            if (corpId == null) {
+                continue;
+            }
+
+            // 遍历每个课程,上传图片到对应企业的素材库
+            for (FsUserCourse course : fsUserCourses) {
+                try {
+
+                    fsUserCourseService.uploadCourseImage(course, corpId);
+                } catch (Exception e) {
+                    logger.error("处理课程图片失败: courseId={}, corpId={}, error={}",
+                            course.getCourseId(), corpId, e.getMessage());
+                }
+            }
+        }
+    }
+
 }

+ 3 - 1
fs-service/src/main/java/com/fs/course/param/FsCourseListBySidebarParam.java

@@ -1,5 +1,6 @@
 package com.fs.course.param;
 
+import com.fs.common.core.domain.BaseEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -9,7 +10,8 @@ import java.util.List;
 
 @Data
 @ApiModel
-public class FsCourseListBySidebarParam implements Serializable {
+public class FsCourseListBySidebarParam extends BaseEntity {
+
 
     @ApiModelProperty(value = "页码,默认为1", required = true)
     private Integer pageNum = 1;

+ 1 - 1
fs-service/src/main/java/com/fs/live/domain/LiveWatchUser.java

@@ -77,7 +77,7 @@ public class LiveWatchUser extends BaseEntity {
     */
     private Integer sendType;
     /**
-    * 奖励类型 1红包 2积分 3 红包 + 积分 (1|2) 4核销卷 5 红包 + 核销卷 (1|4) 6积分 + 核销卷 (2|4) 7 全部 (1|2|4) 99 未设置奖励
+    * 奖励类型 1红包 2积分 3 红包 + 积分 (1|2) 4核销卷 5 红包 + 核销卷 (1|4) 6积分 + 核销卷 (2|4) 7 全部 (1|2|4) 97 直播题目没答对且次数耗尽  98已跳转但是没点确定领取 99 未设置奖励
     */
     private Integer rewardType;
 

+ 60 - 29
fs-service/src/main/java/com/fs/live/service/impl/LiveRedPacketLogServiceImpl.java

@@ -277,6 +277,10 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
                     if (watchUser==null){
                         return R.error("您没有观看过该课程,无奖励发放!");
                     }
+
+                    if (watchUser.getSendType() != null){
+                        return R.error("奖励已发放!请勿重复领取");
+                    }
                 }
                 //直播不空 那要存一下录播
                 else {
@@ -285,28 +289,46 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
 
                 }
 
+                if (watchUser.getSendType() != null || (replayUser != null && replayUser.getSendType() != null)){
+                    return R.error("奖励已发放!请勿重复领取");
+                }
 
-                //是否以及领取了奖励 看直播或者录播 俩者只要有一个领取了奖励 就返回
-                if (watchUser.getRewardType() != null || (replayUser != null && replayUser.getRewardType() != null)) {
-
-                    LiveRedPacketLog liveRedPacketLog = redPacketLogMapper.selectLiveRedPacketLogByTemporary(param.getLiveId(), param.getUserId());
+                // 查是否有领取记录
+                LiveRedPacketLog liveRedPacketLog = redPacketLogMapper.selectLiveRedPacketLogByTemporary(param.getLiveId(), param.getUserId());
 
-                    log.info("直播课程红包:{}", liveRedPacketLog);
-                    if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 1) {
-                        return R.error("已领取该直播课程奖励,不可重复领取!");
-                    }
-                    if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 0) {
-                        if (StringUtils.isNotEmpty(liveRedPacketLog.getResult())) {
-                            R r = JSON.parseObject(liveRedPacketLog.getResult(), R.class);
-                            return r;
-                        } else {
-                            return R.error("操作频繁,请稍后再试!");
-                        }
-                    }
-                    if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 2) {
-                        return R.error("请联系客服补发");
+                log.info("直播课程红包:{}", liveRedPacketLog);
+                if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 1) {
+                    //已领确定领取
+                    watchUser.setRewardType(1);
+                    watchUser.setSendType(1);
+                    watchUserMapper.updateLiveWatchUser(watchUser);
+                    return R.error("已领取该直播课程奖励,不可重复领取!");
+                }
+                if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 0) {
+                    //已跳转但是没点确定领取
+                    watchUser.setRewardType(1);
+                    watchUser.setSendType(1);
+                    watchUserMapper.updateLiveWatchUser(watchUser);
+
+                    if (!StringUtil.strIsNullOrEmpty(liveRedPacketLog.getResult())) {
+                        R r = JSON.parseObject(liveRedPacketLog.getResult(), R.class);
+                        return r;
+                    } else {
+                        return R.error("操作频繁,请稍后再试!");
                     }
-                    return R.error("奖励已发放");
+                }
+                if (liveRedPacketLog != null && liveRedPacketLog.getStatus() == 2) {
+                    return R.error("请联系客服补发");
+                }
+
+                //已经有领取记录了 但是 奖励状态没变更 给它改了
+                if (liveRedPacketLog!=null && (watchUser.getRewardType() != null || (replayUser != null && replayUser.getRewardType() != null))) {
+                    //已跳转但是没点确定领取
+                    watchUser.setRewardType(98);
+                    watchUser.setSendType(1);
+                    watchUserMapper.updateLiveWatchUser(watchUser);
+
+                    return R.error("奖励已发放!请勿重复领取");
                 }
 
                 //判断直播数据 是否满足 完课/如果有录播数据 再判断录播是否满足完课
@@ -363,6 +385,12 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
                         LiveCompletionAnswerRecordListVO answerRecordListVO = liveCompletionAnswerRecordService.selectLiveCompletionAnswerRecordByLiveUserId(param.getLiveId(), param.getUserId());
                         //没有答对的 直接红包OK 答对了走下面的 红包
                         if (answerRecordListVO==null){
+
+                            // 97 直播题目没答对且次数耗尽
+                            watchUser.setRewardType(97);
+                            watchUser.setSendType(1);
+
+                            watchUserMapper.updateLiveWatchUser(watchUser);
                             return R.ok();
                         }
                     }
@@ -830,9 +858,10 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
                 if (sendRedPacket.get("code").equals(200)) {
 
                     // 更新观看记录的奖励类型
-//                    watchUser.setRewardType(1);
-//                    watchUser.setSendType(1);
-//                    watchUserMapper.updateLiveWatchUser(watchUser);
+                    watchUser.setRewardType(1);
+                    watchUser.setSendType(1);
+                    watchUserMapper.updateLiveWatchUser(watchUser);
+
 
                     LiveRedPacketLog liveRedPacketLog = new LiveRedPacketLog();
                     TransferBillsResult transferBillsResult;
@@ -886,9 +915,10 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
                     if (sendRedPacket.get("code").equals(200)) {
 
                         // 更新观看记录的奖励类型
-//                        watchUser.setRewardType(1);
-//                        watchUser.setSendType(1);
-//                        watchUserMapper.updateLiveWatchUser(watchUser);
+                        watchUser.setRewardType(1);
+                        watchUser.setSendType(1);
+                        watchUserMapper.updateLiveWatchUser(watchUser);
+
 
                         LiveRedPacketLog liveRedPacketLog = new LiveRedPacketLog();
                         TransferBillsResult transferBillsResult;
@@ -925,10 +955,11 @@ public class LiveRedPacketLogServiceImpl extends ServiceImpl<LiveRedPacketLogMap
             }
         } else {
 
-//            // 更新直播观看记录的奖励类型
-//            watchUser.setRewardType(1);
-//            watchUser.setSendType(1);
-//            watchUserMapper.updateLiveWatchUser(watchUser);
+            // 更新观看记录的奖励类型
+            watchUser.setRewardType(1);
+            watchUser.setSendType(1);
+            watchUserMapper.updateLiveWatchUser(watchUser);
+
 
             LiveRedPacketLog liveRedPacketLog = new LiveRedPacketLog();
             // 添加红包记录