Quellcode durchsuchen

医健宝功能新增

吴树波 vor 1 Woche
Ursprung
Commit
2706954f11

+ 11 - 0
fs-company/src/main/java/com/fs/company/controller/qw/QwSopController.java

@@ -278,6 +278,17 @@ public class QwSopController extends BaseController
         return toAjax(qwSopService.deleteQwSopByIds(ids));
     }
 
+    /**
+     * 批量删除SOP 任务下面的执行记录
+     */
+    @PreAuthorize("@ss.hasPermi('qw:sopLogs:removeAll')")
+    @Log(title = "企微sop", businessType = BusinessType.DELETE)
+	@DeleteMapping("/delSopLogs/{ids}")
+    public AjaxResult removeAll(@PathVariable String[] ids)
+    {
+        return toAjax(qwSopService.deleteQwSopLogsBySopIds(ids));
+    }
+
 
     /**
      * 批量执行SOP

+ 2 - 2
fs-company/src/main/resources/application.yml

@@ -4,11 +4,11 @@ server:
 spring:
   profiles:
 #    active: druid-fcky-test
-#    active: dev
+    active: dev
 #    active: druid-jzzx-test
 #    active: druid-hdt
 #    active: druid-sxjz
 #    active: druid-yzt
 #    active: druid-myhk
 #    active: druid-sft
-    active: dev-yjb
+#    active: dev-yjb

+ 4 - 0
fs-service/src/main/java/com/fs/course/config/CourseConfig.java

@@ -62,6 +62,10 @@ public class CourseConfig implements Serializable {
      * 是否绑定
      */
     private Boolean isBound;
+    /**
+     * 是否单销售观看(只能在第一次绑定的销售头上看课)
+     */
+    private boolean oneCompanyCourse;
 
 
     @Data

+ 14 - 6
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -4,7 +4,6 @@ import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.Wrapper;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.fs.common.BeanCopyUtils;
 import com.fs.common.core.domain.R;
@@ -18,7 +17,6 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.date.DateUtil;
 import com.fs.company.constant.CompanyTrafficConstants;
 import com.fs.company.domain.Company;
-import com.fs.company.domain.CompanyMoneyLogs;
 import com.fs.company.domain.CompanyUser;
 import com.fs.company.mapper.CompanyMapper;
 import com.fs.company.mapper.CompanyMoneyLogsMapper;
@@ -77,7 +75,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
@@ -456,12 +453,21 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 //            logger.error("看课重粉提交mq失败", e);
 //        }
 
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        boolean oneCompanyCourse = config.isOneCompanyCourse();
+        if(oneCompanyCourse && fsUser.getQwExtId() != null){
+            QwExternalContact qwExternalContact = qwExternalContactMapper.selectById(fsUser.getQwExtId());
+            if(qwExternalContact.getCompanyUserId() != null && !qwExternalContact.getCompanyUserId().equals(param.getCompanyUserId())){
+                return R.error(500, "该用户("+fsUser.getUserId() + ")已成为其他销售会员");
+            }
+        }
         Integer isRoom = param.getIsRoom();
 
         // 处理逻辑
         if (isRoom == null || isRoom == 0) {
             // 当 isRoom 为 null 或 0 时走 handleExt
-            return handleExt(param,msg);
+            return handleExt(param,msg, oneCompanyCourse);
         } else if (isRoom == 1) {
             // 当 isRoom 为 1 时走 handleRoom
             return handleRoom(param,fsUser);
@@ -591,7 +597,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         courseWatchLogMapper.insertFsCourseWatchLog(log);
     }
 
-    private R handleExt(FsUserCourseVideoAddKfUParam param,String msg){
+    private R handleExt(FsUserCourseVideoAddKfUParam param, String msg, boolean oneCompanyCourse){
         if (param.getLinkType()!=null&&param.getLinkType()==1){
             if (param.getLinkId()!=null){
                 // 从数据库中查找短链对应的真实链接
@@ -1603,7 +1609,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
     @Transactional
     public ResponseResult<FsUser> isAddCompanyUser(FsUserCourseAddCompanyUserParam param) {
         logger.info("\n 【进入个微-判断是否添加客服】,入参:{}",param);
-
+        String json = configService.selectConfigByKey("course.config");
+        CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
+        boolean oneCompanyCourse = config.isOneCompanyCourse();
         //查询用户
        FsUser fsUser = fsUserMapper.selectFsUserById(param.getUserId());
          if (fsUser == null){

+ 2 - 0
fs-service/src/main/java/com/fs/sop/service/IQwSopService.java

@@ -98,4 +98,6 @@ public interface IQwSopService
     List<QwSop> selectQwSopByTempId(String tempId);
 
     List<QwSop> selectAllQwSopInfo(QwSop qwSop);
+
+    int deleteQwSopLogsBySopIds(String[] ids);
 }

+ 10 - 0
fs-service/src/main/java/com/fs/sop/service/impl/QwSopServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fs.sop.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.fs.common.annotation.DataSource;
 import com.fs.common.core.domain.R;
 import com.fs.common.enums.DataSourceType;
@@ -1090,6 +1091,15 @@ public class QwSopServiceImpl implements IQwSopService
         return qwSopMapper.selectAllQwSopInfo(qwSop);
     }
 
+    @Override
+    @DataSource(DataSourceType.SOP)
+    public int deleteQwSopLogsBySopIds(String[] ids) {
+        if(ids == null || ids.length == 0){
+            return 0;
+        }
+        return qwSopLogsMapper.delete(new QueryWrapper<QwSopLogs>().in("sop_id", Arrays.asList(ids)));
+    }
+
     /**
      *新增员工执行SOP
      */