Bläddra i källkod

Merge branch 'test' of http://git.mokasz.com/marketing/moka-private into test

leon 4 år sedan
förälder
incheckning
daa9da38b6

+ 18 - 5
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashScheduleTaskListController.java

@@ -57,7 +57,10 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
         }
         }
         ResHandle<List<FosterwxCashScheduleTaskList>> res = fosterwxCashScheduleTaskListService.getList(handle);
         ResHandle<List<FosterwxCashScheduleTaskList>> res = fosterwxCashScheduleTaskListService.getList(handle);
 
 
-        res.getList().forEach(fosterwxCashScheduleTaskList -> fosterwxCashScheduleTaskList.setFosterwxCashWorkwxTaskList(fosterwxCashWorkwxTaskListService.getById(fosterwxCashScheduleTaskList.getChildTaskId())));
+        res.getList().forEach(fosterwxCashScheduleTaskList -> {
+            FosterwxCashScheduleTaskList detail = fosterwxCashScheduleTaskListService.getById(fosterwxCashScheduleTaskList.getId());
+            fosterwxCashScheduleTaskList.setFosterwxCashWorkwxTaskList(fosterwxCashWorkwxTaskListService.getById(detail.getChildTaskId()));
+        });
         return AjaxResult.success(res);
         return AjaxResult.success(res);
     }
     }
 
 
@@ -68,10 +71,15 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
             Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> fosterwxCashScheduleTaskListService.cancelTask(Integer.valueOf(id), user.getId()));
             Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> fosterwxCashScheduleTaskListService.cancelTask(Integer.valueOf(id), user.getId()));
         } else {
         } else {
             Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
             Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
-                FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = fosterwxCashScheduleTaskListService.getById(id);
-                List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListList = fosterwxCashScheduleTaskListService.list(new LambdaQueryWrapper<FosterwxCashScheduleTaskList>().eq(FosterwxCashScheduleTaskList::getTaskId, fosterwxCashScheduleTaskList.getTaskId()));
-
-                fosterwxCashScheduleTaskListList.forEach(detail -> fosterwxCashScheduleTaskListService.cancelTask(detail.getId(), user.getId()));
+                // 企微任务列表 页面的取消任务是全部取消 预览页面的取消任务是精准取消
+                if (handle.getIsAllDel() == 1) {
+                    FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = fosterwxCashScheduleTaskListService.getById(id);
+                    List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListList = fosterwxCashScheduleTaskListService.list(new LambdaQueryWrapper<FosterwxCashScheduleTaskList>().eq(FosterwxCashScheduleTaskList::getTaskId, fosterwxCashScheduleTaskList.getTaskId()));
+
+                    fosterwxCashScheduleTaskListList.forEach(detail -> fosterwxCashScheduleTaskListService.cancelTask(detail.getId(), user.getId()));
+                } else {
+                    fosterwxCashScheduleTaskListService.cancelTask(Integer.valueOf(id), user.getId());
+                }
             });
             });
         }
         }
 
 
@@ -80,6 +88,7 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
 
 
 
 
     @GetMapping("/preview")
     @GetMapping("/preview")
+    @ApiOperation(value = "给企微任务列表使用的预览接口 页面展示的是聚合的数据 需要单独提供查看同一个任务的所有子任务")
     public Object preview(String id) {
     public Object preview(String id) {
         // 获取详细信息
         // 获取详细信息
         FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = fosterwxCashScheduleTaskListService.getById(id);
         FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList = fosterwxCashScheduleTaskListService.getById(id);
@@ -88,6 +97,10 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
                 eq(FosterwxCashScheduleTaskList::getTemplateId, fosterwxCashScheduleTaskList.getTemplateId()).
                 eq(FosterwxCashScheduleTaskList::getTemplateId, fosterwxCashScheduleTaskList.getTemplateId()).
                 eq(FosterwxCashScheduleTaskList::getTaskId, fosterwxCashScheduleTaskList.getTaskId()));
                 eq(FosterwxCashScheduleTaskList::getTaskId, fosterwxCashScheduleTaskList.getTaskId()));
 
 
+        fosterwxCashScheduleTaskLists.forEach(detail -> {
+            detail.setFosterwxCashWorkwxTaskList(fosterwxCashWorkwxTaskListService.getById(detail.getChildTaskId()));
+        });
+
         return AjaxResult.success(fosterwxCashScheduleTaskLists);
         return AjaxResult.success(fosterwxCashScheduleTaskLists);
     }
     }
 }
 }

+ 1 - 0
src/main/java/com/mokamrp/privates/entity/pangu/FosterwxCashScheduleTaskListHandle.java

@@ -27,4 +27,5 @@ public class FosterwxCashScheduleTaskListHandle {
     private LocalDateTime sendTimeTo;
     private LocalDateTime sendTimeTo;
     private Integer createUid;
     private Integer createUid;
     private String ids;
     private String ids;
+    private Integer isAllDel = 1;
 }
 }

+ 4 - 2
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.java

@@ -1,6 +1,6 @@
 package com.mokamrp.privates.mapper.pangu;
 package com.mokamrp.privates.mapper.pangu;
 
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
@@ -19,7 +19,9 @@ import java.util.List;
  */
  */
 @Component
 @Component
 public interface FosterwxCashScheduleTaskListMapper extends BaseMapper<FosterwxCashScheduleTaskList> {
 public interface FosterwxCashScheduleTaskListMapper extends BaseMapper<FosterwxCashScheduleTaskList> {
-    public List<FosterwxCashScheduleTaskList> getList(@Param("ew") LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper, @Param("limit") Integer page, @Param("offset") Integer offset, @Param("handle") FosterwxCashScheduleTaskListHandle handle);
+    public List<FosterwxCashScheduleTaskList> getList(@Param("ew") QueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper, @Param("limit") Integer page, @Param("offset") Integer offset, @Param("handle") FosterwxCashScheduleTaskListHandle handle);
 
 
     List<FosterwxCashScheduleTaskList> getBannedGhid();
     List<FosterwxCashScheduleTaskList> getBannedGhid();
+
+    Long count(@Param("ew") QueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListQueryWrapper, @Param("handle") FosterwxCashScheduleTaskListHandle handle);
 }
 }

+ 31 - 2
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.xml

@@ -69,18 +69,25 @@
             task_list.schedule_id,
             task_list.schedule_id,
             task_list.template_id,
             task_list.template_id,
             task_list.task_id,
             task_list.task_id,
-            task_list.group_id
+            task_list.group_id,
+            task_list.type,
+            task_list.send_time
             FROM
             FROM
             pan_fosterwx_cash_schedule_task_list task_list
             pan_fosterwx_cash_schedule_task_list task_list
             GROUP BY
             GROUP BY
             task_list.schedule_id,
             task_list.schedule_id,
             task_list.template_id,
             task_list.template_id,
             task_list.task_id,
             task_list.task_id,
-            task_list.group_id
+            task_list.group_id,
+            task_list.type,
+            task_list.send_time
             ) task_list
             ) task_list
             LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
             LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
             LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
             LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
             LEFT JOIN pan_fosterwx_cash_workwx_task_catalog catalog ON task_list.task_id = catalog.id
             LEFT JOIN pan_fosterwx_cash_workwx_task_catalog catalog ON task_list.task_id = catalog.id
+            <where>
+                ${ew.sqlSegment}
+            </where>
             ORDER BY
             ORDER BY
             task_list.id DESC
             task_list.id DESC
             limit #{limit} offset #{offset}
             limit #{limit} offset #{offset}
@@ -108,4 +115,26 @@
         WHERE box.fobidden_status = 2
         WHERE box.fobidden_status = 2
           AND task_list.`status` = 4
           AND task_list.`status` = 4
     </select>
     </select>
+    <select id="count" resultType="java.lang.Long">
+        <if test="handle.type == 2">
+            SELECT
+                count(*)
+            FROM
+            ( SELECT task_list.schedule_id, task_list.template_id, task_list.task_id, task_list.group_id, task_list.type, task_list.send_time FROM pan_fosterwx_cash_schedule_task_list task_list GROUP BY task_list.schedule_id, task_list.template_id, task_list.task_id, task_list.group_id, task_list.type, task_list.send_time ) task_list
+            <where>
+                ${ew.sqlSegment}
+            </where>
+        </if>
+        <if test="handle.type == 1">
+            SELECT
+                count(1)
+            FROM
+            pan_fosterwx_cash_schedule_task_list task_list
+            LEFT JOIN pan_fosterwx_cash_task_template task_template ON task_template.id = task_list.template_id
+            LEFT JOIN pan_fosterwx_cash_mobile_group mobile_group ON task_list.group_id = mobile_group.id
+            <where>
+                ${ew.sqlSegment}
+            </where>
+        </if>
+    </select>
 </mapper>
 </mapper>

+ 15 - 11
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashScheduleTaskListServiceImpl.java

@@ -2,6 +2,7 @@ package com.mokamrp.privates.service.pangu.impl;
 
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.ResHandle;
 import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
@@ -16,6 +17,7 @@ import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashWorkwxTaskListService;
 import com.mokamrp.privates.service.pangu.FosterwxCashWorkwxTaskListService;
 import com.mokamrp.privates.utils.pangu.redis.task.TaskRedis;
 import com.mokamrp.privates.utils.pangu.redis.task.TaskRedis;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -32,6 +34,7 @@ import java.util.List;
  * @since 2021-10-08
  * @since 2021-10-08
  */
  */
 @Service
 @Service
+@Slf4j
 public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<FosterwxCashScheduleTaskListMapper, FosterwxCashScheduleTaskList> implements FosterwxCashScheduleTaskListService {
 public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<FosterwxCashScheduleTaskListMapper, FosterwxCashScheduleTaskList> implements FosterwxCashScheduleTaskListService {
 
 
     @Autowired
     @Autowired
@@ -60,33 +63,33 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
     public ResHandle<List<FosterwxCashScheduleTaskList>> getList(FosterwxCashScheduleTaskListHandle handle) {
     public ResHandle<List<FosterwxCashScheduleTaskList>> getList(FosterwxCashScheduleTaskListHandle handle) {
         Integer pagesize = handle.getPageSize();
         Integer pagesize = handle.getPageSize();
         Integer page = handle.getPage();
         Integer page = handle.getPage();
-        LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getType, handle.getType());
+        QueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListQueryWrapper = new QueryWrapper<>();
+        fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.type", handle.getType());
 
 
         // 任务模板名称
         // 任务模板名称
         if (null != handle.getTemplateId())
         if (null != handle.getTemplateId())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getTemplateId, handle.getTemplateId());
+            fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.template_id", handle.getTemplateId());
         // 创建人
         // 创建人
         if (null != handle.getCreateUid())
         if (null != handle.getCreateUid())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getCreateUid, handle.getCreateUid());
+            fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.create_uid", handle.getCreateUid());
         // 状态
         // 状态
         if (null != handle.getStatus())
         if (null != handle.getStatus())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getStatus, handle.getStatus());
+            fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.status", handle.getStatus());
         // 发送日期
         // 发送日期
         if (null != handle.getSendTimeFrom() && null != handle.getSendTimeTo())
         if (null != handle.getSendTimeFrom() && null != handle.getSendTimeTo())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.between(FosterwxCashScheduleTaskList::getSendTime, handle.getSendTimeFrom(), handle.getSendTimeTo());
+            fosterwxCashScheduleTaskListQueryWrapper.between("task_list.send_time", handle.getSendTimeFrom(), handle.getSendTimeTo());
         // 账号分组
         // 账号分组
         if (null != handle.getGroupId())
         if (null != handle.getGroupId())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getGroupId, handle.getGroupId());
+            fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.group_id", handle.getGroupId());
         // 排期id
         // 排期id
         if (null != handle.getScheduleId())
         if (null != handle.getScheduleId())
-            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, handle.getScheduleId());
+            fosterwxCashScheduleTaskListQueryWrapper.eq("task_list.schedule_id", handle.getScheduleId());
 
 
-        List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(fosterwxCashScheduleTaskListLambdaQueryWrapper, pagesize, (page - 1) * pagesize, handle);
+        List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(fosterwxCashScheduleTaskListQueryWrapper, pagesize, (page - 1) * pagesize, handle);
 
 
         ResHandle<List<FosterwxCashScheduleTaskList>> res = new ResHandle<>();
         ResHandle<List<FosterwxCashScheduleTaskList>> res = new ResHandle<>();
         res.setList(list);
         res.setList(list);
-        res.setTotal(Long.valueOf(fosterwxCashScheduleTaskListMapper.selectCount(fosterwxCashScheduleTaskListLambdaQueryWrapper)));
+        res.setTotal(fosterwxCashScheduleTaskListMapper.count(fosterwxCashScheduleTaskListQueryWrapper, handle));
         return res;
         return res;
     }
     }
 
 
@@ -166,6 +169,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
             i--;
             i--;
         }
         }
         fosterwxCashOasBoxService.addSendTextCnt(groupId, ghid);
         fosterwxCashOasBoxService.addSendTextCnt(groupId, ghid);
+        log.info("typr生成发文需要的信息{}", JSON.toJSONString(tempList));
         taskRedis.createUrlByTyper(JSON.toJSONString(tempList));
         taskRedis.createUrlByTyper(JSON.toJSONString(tempList));
         tempList.clear();
         tempList.clear();
     }
     }
@@ -221,7 +225,7 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
             sendUrl = "/pages/index/index?type=tuiguang&videoId=" + fosterwxCashTaskList.getVideoId();
             sendUrl = "/pages/index/index?type=tuiguang&videoId=" + fosterwxCashTaskList.getVideoId();
         } else {
         } else {
             // 盘古版视频
             // 盘古版视频
-            sendUrl = String.format("pages/index/index?type=tuiguang&materialId=%d&categoryId=&d", fosterwxCashTaskList.getVideoId(), fosterwxCashTaskList.getTagId());
+            sendUrl = String.format("pages/index/index?type=tuiguang&materialId=%d&categoryId=%d", fosterwxCashTaskList.getVideoId(), fosterwxCashTaskList.getTagId());
         }
         }
 
 
         fosterwxCashScheduleTaskList.setSendUrl(sendUrl);
         fosterwxCashScheduleTaskList.setSendUrl(sendUrl);