5 Commits c18aab9ba6 ... 21677d779f

Author SHA1 Message Date
  lk 21677d779f 今正 1 month ago
  lk c2fb567bea Merge remote-tracking branch 'origin/master' 1 month ago
  lk 598eda39a5 Merge remote-tracking branch 'origin/master' 1 month ago
  lk d694d13677 Merge remote-tracking branch 'origin/master' 1 month ago
  lk eeb68468b1 今正 1 month ago

+ 1 - 1
fs-admin/src/main/java/com/fs/course/controller/FsCourseWatchLogController.java

@@ -100,7 +100,7 @@ public class FsCourseWatchLogController extends BaseController
     {
         logger.info("会员课程数据汇总 参数: {}",param);
 
-        if(param.getCompanyId() == null){
+        if(param.getCompanyId() == null && (param.getUserIds() == null || param.getUserIds().isEmpty())){
             throw new CustomException("必须选择公司!");
         }
         if (param.getSTime()==null||param.getETime()==null){

+ 241 - 0
fs-admin/src/main/java/com/fs/qw/controller/QwWorkTaskNewController.java

@@ -0,0 +1,241 @@
+package com.fs.qw.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.page.TableDataInfo;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.ServletUtils;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.company.service.impl.CompanyDeptServiceImpl;
+import com.fs.course.mapper.FsCourseWatchLogMapper;
+//import com.fs.framework.security.LoginUser;
+//import com.fs.framework.service.TokenService;
+import com.fs.qw.domain.QwExternalContact;
+import com.fs.qw.domain.QwWorkTask;
+import com.fs.qw.mapper.QwExternalContactMapper;
+import com.fs.qw.param.QwWorkTaskListParam;
+import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwWorkTaskService;
+import com.fs.qw.vo.QwWorkTaskAllListVO;
+import com.fs.qw.vo.QwWorkTaskListVO;
+import com.fs.qwApi.domain.QwExternalContactRemarkResult;
+import com.fs.qwApi.param.QwExternalContactRemarkParam;
+import com.fs.qwApi.service.QwApiService;
+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.Date;
+import java.util.List;
+
+/**
+ * 企微任务看板Controller
+ *
+ * @author fs
+ * @date 2025-03-25
+ */
+@RestController
+@RequestMapping("/qw/QwWorkTaskNew")
+public class QwWorkTaskNewController extends BaseController
+{
+    @Autowired
+    private IQwWorkTaskService qwWorkTaskService;
+//    @Autowired
+//    private TokenService tokenService;
+    @Autowired
+    private FsCourseWatchLogMapper fsCourseWatchLogMapper;
+
+    @Autowired
+    private CompanyDeptServiceImpl companyDeptService;
+
+    /**
+     * 查询企微任务看板列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(QwWorkTaskListParam qwWorkTask)
+    {
+        startPage();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        qwWorkTask.setCompanyId(loginUser.getCompany().getCompanyId());
+//        qwWorkTask.setCompanyUserId(loginUser.getUser().getUserId());
+        List<QwWorkTaskListVO> list = qwWorkTaskService.selectQwWorkTaskListVO(qwWorkTask);
+
+        for (QwWorkTaskListVO qwWorkTaskListVO : list) {
+            qwWorkTaskListVO.setLogs(fsCourseWatchLogMapper.selectFsCourseWatchLog7DayByExtId(qwWorkTaskListVO.getExtId()));
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询企微任务部门催课看板列表
+     */
+//    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:deptList')")
+//    @GetMapping("/deptList")
+//    public TableDataInfo deptList(QwWorkTaskListParam qwWorkTask)
+//    {
+//
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        qwWorkTask.setCompanyId(loginUser.getCompany().getCompanyId());
+//
+//        List<Long> combinedList = new ArrayList<>();
+//        //本部门
+//        Long deptId = loginUser.getUser().getDeptId();
+//        if (deptId!=null){
+//            combinedList.add(deptId);
+//        }
+//        //本部门的下级部门
+//        List<Long> deptList = companyDeptService.selectCompanyDeptByParentId(deptId);
+//        if (!deptList.isEmpty()){
+//            combinedList.addAll(deptList);
+//        }
+//
+//        qwWorkTask.setCuDeptIdList(combinedList);
+//        qwWorkTask.setUserType(loginUser.getUser().getUserType());
+//
+//
+//        startPage();
+//        List<QwWorkTaskListVO> list = qwWorkTaskService.selectQwWorkTaskListVO(qwWorkTask);
+//        for (QwWorkTaskListVO qwWorkTaskListVO : list) {
+//            qwWorkTaskListVO.setLogs(fsCourseWatchLogMapper.selectFsCourseWatchLog7DayByExtId(qwWorkTaskListVO.getExtId()));
+//        }
+//        return getDataTable(list);
+//    }
+
+    @GetMapping("/glList")
+    public TableDataInfo glList(QwWorkTaskListParam qwWorkTask)
+    {
+        startPage();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        qwWorkTask.setCompanyId(loginUser.getCompany().getCompanyId());
+        List<QwWorkTaskListVO> list = qwWorkTaskService.selectQwWorkTaskListVO(qwWorkTask);
+        for (QwWorkTaskListVO qwWorkTaskListVO : list) {
+            qwWorkTaskListVO.setLogs(fsCourseWatchLogMapper.selectFsCourseWatchLog7DayByExtId(qwWorkTaskListVO.getExtId()));
+        }
+        return getDataTable(list);
+    }
+
+    @GetMapping("/allList")
+    public TableDataInfo allList(QwWorkTaskListParam qwWorkTask)
+    {
+        startPage();
+//        LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
+//        qwWorkTask.setCompanyId(loginUser.getCompany().getCompanyId());
+        if (qwWorkTask.getSTime()==null||qwWorkTask.getETime()==null){
+            return new TableDataInfo();
+        }
+        List<QwWorkTaskAllListVO> list = qwWorkTaskService.selectQwWorkTaskAllListVO(qwWorkTask);
+
+        return getDataTable(list);
+    }
+    /**
+     * 导出企微任务看板列表
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:export')")
+    @Log(title = "企微任务看板", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(QwWorkTask qwWorkTask)
+    {
+        List<QwWorkTask> list = qwWorkTaskService.selectQwWorkTaskList(qwWorkTask);
+        ExcelUtil<QwWorkTask> util = new ExcelUtil<QwWorkTask>(QwWorkTask.class);
+        return util.exportExcel(list, "企微任务看板数据");
+    }
+
+    /**
+     * 获取企微任务看板详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(qwWorkTaskService.selectQwWorkTaskById(id));
+    }
+
+    /**
+     * 新增企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:add')")
+    @Log(title = "企微任务看板", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody QwWorkTask qwWorkTask)
+    {
+        return toAjax(qwWorkTaskService.insertQwWorkTask(qwWorkTask));
+    }
+    @Autowired
+    QwApiService qwApiService;
+    @Autowired
+    IQwExternalContactService qwExternalContactService;
+    @Autowired
+    QwExternalContactMapper qwExternalContactMapper;
+    /**
+     * 修改企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:edit')")
+    @Log(title = "企微任务看板处理", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody QwWorkTask qwWorkTask)
+    {
+        QwWorkTask task = new QwWorkTask();
+        task.setId(qwWorkTask.getId());
+        task.setStatus(1);
+        task.setTrackType(qwWorkTask.getTrackType());
+        task.setDescription(qwWorkTask.getDescription());
+        task.setUpdateTime(new Date());
+        if (task.getDescription()!=null&& !task.getDescription().isEmpty()){
+
+            QwExternalContact qwExternalContact = qwExternalContactService.selectQwExternalContactById(qwWorkTask.getExtId());
+            if (qwExternalContact!=null){
+                QwExternalContactRemarkParam param = new QwExternalContactRemarkParam();
+                param.setUserid(qwExternalContact.getUserId());
+                param.setExternal_userid(qwExternalContact.getExternalUserId());
+                param.setDescription(task.getDescription());
+
+                QwExternalContactRemarkResult qwExternalContactRemarkResult = qwApiService.externalcontactRemark(param, qwExternalContact.getCorpId());
+                logger.info("QwExternalContactRemarkResult206:" + qwExternalContactRemarkResult);
+                if (qwExternalContactRemarkResult.getErrcode() == 0) {
+                    QwExternalContact ext = new QwExternalContact();
+                    ext.setId(qwExternalContact.getId());
+                    ext.setDescription(task.getDescription());
+                    qwExternalContactMapper.updateQwExternalContact(ext);
+                }
+            }
+        }
+        return toAjax(qwWorkTaskService.updateQwWorkTask(task));
+    }
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:edit')")
+    @Log(title = "企微任务看板处理", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit2")
+    public AjaxResult edit2(@RequestBody QwWorkTask qwWorkTask)
+    {
+        QwWorkTask task = new QwWorkTask();
+        task.setId(qwWorkTask.getId());
+        task.setStatus(1);
+        task.setUpdateTime(new Date());
+        task.setTrackType(2);
+        return toAjax(qwWorkTaskService.updateQwWorkTask(task));
+    }
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:edit')")
+    @Log(title = "企微任务看板处理", businessType = BusinessType.UPDATE)
+    @PutMapping("/edit3")
+    public AjaxResult edit3(@RequestBody QwWorkTask qwWorkTask)
+    {
+        QwWorkTask task = new QwWorkTask();
+        task.setId(qwWorkTask.getId());
+        task.setStatus(1);
+        task.setUpdateTime(new Date());
+        task.setTrackType(3);
+        return toAjax(qwWorkTaskService.updateQwWorkTask(task));
+    }
+    /**
+     * 删除企微任务看板
+     */
+    @PreAuthorize("@ss.hasPermi('qw:QwWorkTaskNew:remove')")
+    @Log(title = "企微任务看板", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(qwWorkTaskService.deleteQwWorkTaskByIds(ids));
+    }
+}

+ 11 - 1
fs-service/src/main/java/com/fs/course/mapper/FsCourseWatchLogMapper.java

@@ -260,7 +260,16 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
             "<if test= 'sendType == 1 '> " +
             " LEFT JOIN company_user cu on cu.user_id=o.company_user_id\n" +
             "</if>\n" +
-            "where o.company_id=#{companyId} " +
+            "<where> \n" +
+            "<if test = 'companyId != null and companyId != 0'>\n" +
+            "and o.company_id=#{companyId} \n" +
+            "</if>\n" +
+            "<if test = 'userIds != null and userIds.size() > 0'>\n" +
+            "and o.company_user_id in \n" +
+            "        <foreach collection='userIds' item='id' open='(' separator=',' close=')'>\n" +
+            "            #{id}\n" +
+            "        </foreach>\n" +
+            "</if>\n" +
             "<if test= 'sendType != null '> " +
             "       and  send_type= #{sendType} " +
             "</if>\n" +
@@ -282,6 +291,7 @@ public interface FsCourseWatchLogMapper extends BaseMapper<FsCourseWatchLog> {
             "<if test ='videoId !=null'> " +
             "     and o.video_id = #{videoId} " +
             "</if>" +
+            "</where>" +
             "GROUP BY o.video_id," +
             "<if test= 'sendType != 1 '> " +
             " o.qw_user_id," +

+ 25 - 0
fs-service/src/main/java/com/fs/course/param/FsCourseWatchLogStatisticsListParam.java

@@ -4,8 +4,12 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.utils.DateUtils;
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.StringJoiner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 @Data
 public class FsCourseWatchLogStatisticsListParam {
@@ -56,4 +60,25 @@ public class FsCourseWatchLogStatisticsListParam {
      * 标识('course','company')
      */
     private  String dimension ;
+    /**
+     * 今正要求把公司筛选条件优化到细分至部门,销售(前端判断,只有今正传)
+     */
+    private List<String> userIds;
+    public List<String> getUserIds() {
+        if (userIds == null || userIds.isEmpty()) {
+            return userIds;
+        }
+        ArrayList<String> longs = new ArrayList<>();
+        userIds.forEach(userId -> {
+            if (userId.contains("user_")){
+                StringJoiner joiner = new StringJoiner("");
+                Matcher matcher = Pattern.compile("\\d+").matcher(userId);
+                while (matcher.find()) {
+                    joiner.add(matcher.group());
+                }
+                longs.add(joiner.toString());
+            }
+        });
+        return longs;
+    }
 }

+ 1 - 0
fs-service/src/main/java/com/fs/course/service/impl/FsCourseWatchLogServiceImpl.java

@@ -763,6 +763,7 @@ public class FsCourseWatchLogServiceImpl extends ServiceImpl<FsCourseWatchLogMap
 
     @Override
     public List<FsCourseWatchLogStatisticsListVO> selectFsCourseWatchLogStatisticsListVO(FsCourseWatchLogStatisticsListParam param) {
+        if (param.getUserIds() != null && !param.getUserIds().isEmpty())param.setUserIds(param.getUserIds());
         return fsCourseWatchLogMapper.selectFsCourseWatchLogStatisticsListVO(param);
     }
 

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

@@ -4,8 +4,12 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fs.common.utils.DateUtils;
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.StringJoiner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 @Data
 public class QwWatchLogStatisticsListParam {
@@ -41,4 +45,26 @@ public class QwWatchLogStatisticsListParam {
     private Long pageNum;
     private Long pageSize;
     private List<Long> filterDeptIds;
+    /**
+     * 今正要求把公司筛选条件优化到细分至部门,销售(前端判断,只有今正传)
+     */
+    private List<String> userIds;
+    public List<String> getUserIds() {
+        if (userIds == null || userIds.isEmpty()) {
+            return userIds;
+        }
+        ArrayList<String> longs = new ArrayList<>();
+        userIds.forEach(userId -> {
+            if (userId.contains("user_")){
+                StringJoiner joiner = new StringJoiner("");
+                Matcher matcher = Pattern.compile("\\d+").matcher(userId);
+                while (matcher.find()) {
+                    joiner.add(matcher.group());
+                }
+                longs.add(joiner.toString());
+            }
+
+        });
+        return longs;
+    }
 }

+ 4 - 2
fs-service/src/main/java/com/fs/qw/service/impl/QwWatchLogServiceImpl.java

@@ -403,7 +403,7 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
     public TableDataInfo selectQwWatchLogAllStatisticsListVONew(QwWatchLogStatisticsListParam param) {
         // 获取当前公司下的所有销售
         List<Long> userIds;
-        if(param.getCompanyUserId()  == null){
+        if(param.getCompanyUserId()  == null && (param.getUserIds() == null || param.getUserIds().isEmpty())){
             List<CompanyUser> companyUsers = companyUserMapper.selectCompanyUserByCompanyId(param.getCompanyId());
             if(CollectionUtils.isEmpty(companyUsers)){
                 throw new CustomException("该公司下面没有任何销售!");
@@ -412,7 +412,9 @@ public class QwWatchLogServiceImpl extends ServiceImpl<QwWatchLogMapper, QwWatch
                     .map(CompanyUser::getUserId)
                     .filter(Objects::nonNull)
                     .collect(Collectors.toList());
-        } else {
+        } else if((param.getUserIds() != null && !param.getUserIds().isEmpty())){
+            userIds = param.getUserIds().stream().map(Long::valueOf).collect(Collectors.toList());
+        }else{
             userIds = new ArrayList<>();
             userIds.add(param.getCompanyUserId());
         }

+ 10 - 1
fs-service/src/main/resources/mapper/course/FsCourseWatchLogMapper.xml

@@ -1058,7 +1058,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="sendType == 1">
             LEFT JOIN company_user cu ON cu.user_id = o.company_user_id
         </if>
-        WHERE o.company_id = #{companyId}
+        WHERE 1=1
+        <if test = 'companyId != null and companyId != 0'>
+            and o.company_id=#{companyId}
+            </if>
+        <if test = 'userIds != null and userIds.size() > 0'>
+        and o.company_user_id in
+                <foreach collection='userIds' item='id' open='(' separator=',' close=')'>
+                        #{id}
+                   </foreach>
+        </if>
         <!-- 发送类型筛选 -->
         <if test="sendType != null">
             AND send_type = #{sendType}