lqc 4 лет назад
Родитель
Сommit
e0a8020dea

+ 11 - 1
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashAccountScheduleController.java

@@ -1,5 +1,6 @@
 package com.mokamrp.privates.controller.pangu;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.controller.BaseController;
 import com.mokamrp.privates.entity.ResHandle;
@@ -9,6 +10,7 @@ import com.mokamrp.privates.help.AjaxResult;
 import com.mokamrp.privates.help.Analysis;
 import com.mokamrp.privates.interceptor.AuthUser;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashAccountSchedule;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.mapper.pojo.User;
 import com.mokamrp.privates.service.pangu.FosterwxCashAccountScheduleService;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
@@ -136,7 +138,15 @@ public class FosterwxCashAccountScheduleController extends BaseController<Foster
     @PostMapping("/cancelTask")
     @ApiOperation(value = "取消任务按钮")
     public Object cancelTask(FosterwxCashAccountScheduleHandle handle, @AuthUser User user) {
-        Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> fosterwxCashScheduleTaskListService.cancelTask(Integer.valueOf(id), user.getId()));
+        Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> {
+            LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, id);
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.notIn(FosterwxCashScheduleTaskList::getStatus, 3, 5, 6);
+
+            List<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskLists = fosterwxCashScheduleTaskListService.list(fosterwxCashScheduleTaskListLambdaQueryWrapper);
+            fosterwxCashScheduleTaskLists.forEach(fosterwxCashScheduleTaskList -> fosterwxCashScheduleTaskListService.cancelTask(fosterwxCashScheduleTaskList.getId(), user.getId()));
+
+        });
 
         return AjaxResult.success("取消任务成功");
     }

+ 23 - 3
src/main/java/com/mokamrp/privates/controller/pangu/FosterwxCashScheduleTaskListController.java

@@ -2,12 +2,15 @@ package com.mokamrp.privates.controller.pangu;
 
 import com.mokamrp.privates.constant.HttpStatus;
 import com.mokamrp.privates.controller.BaseController;
-import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.help.AjaxResult;
+import com.mokamrp.privates.interceptor.AuthUser;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
+import com.mokamrp.privates.mapper.pojo.User;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.Arrays;
 import java.util.List;
 
 
@@ -32,6 +36,8 @@ import java.util.List;
 @Api(tags = "变现-任务列表")
 public class FosterwxCashScheduleTaskListController extends BaseController<FosterwxCashScheduleTaskList> {
 
+    public static final String REGEX = ",";
+
     @Autowired
     public FosterwxCashScheduleTaskListService fosterwxCashScheduleTaskListService;
 
@@ -42,14 +48,28 @@ public class FosterwxCashScheduleTaskListController extends BaseController<Foste
      */
 
     @PostMapping("/list")
-    public Object list(@Valid @RequestBody PostBasePageHandle postBasePageHandle, BindingResult bindingResult) {
+    public Object list(@Valid @RequestBody FosterwxCashScheduleTaskListHandle handle, BindingResult bindingResult) {
         if (bindingResult.hasErrors()) {
             return AjaxResult.error(HttpStatus.ERROR, bindingResult.getFieldError().getDefaultMessage());
         }
-        ResHandle<List<FosterwxCashScheduleTaskList>> res = fosterwxCashScheduleTaskListService.getList(postBasePageHandle);
+        ResHandle<List<FosterwxCashScheduleTaskList>> res = fosterwxCashScheduleTaskListService.getList(handle);
         return AjaxResult.success(res);
     }
 
+    @PostMapping("/cancelTask")
+    @ApiOperation(value = "取消任务按钮")
+    public Object cancelTask(FosterwxCashScheduleTaskListHandle handle, @AuthUser User user) {
+        Arrays.asList(handle.getIds().split(REGEX)).forEach(id -> fosterwxCashScheduleTaskListService.cancelTask(Integer.valueOf(id), user.getId()));
+
+        return AjaxResult.success("取消任务成功");
+    }
 
+    @PostMapping("/reCreate")
+    @ApiOperation("重新生成")
+    public Object reCreate(FosterwxCashScheduleTaskList fosterwxCashScheduleTaskList) {
+        //TODO 等typer接口
+
+        return AjaxResult.success("重新生成成功");
+    }
 }
 

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

@@ -12,7 +12,7 @@ import lombok.Data;
  * @since 2021-10-08
  */
 @Data
-public class FosterwxCashAccountScheduleHandle extends Model<FosterwxCashAccountScheduleHandle> {
+public class FosterwxCashAccountScheduleHandle{
     private Integer page;
     private Integer pageSize;
     private Integer id;

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

@@ -0,0 +1,28 @@
+package com.mokamrp.privates.entity.pangu;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 盘古微信变现排期任务列表
+ * </p>
+ *
+ * @author leon
+ * @since 2021-10-08
+ */
+@Data
+public class FosterwxCashScheduleTaskListHandle {
+    private Integer page;
+    private Integer pageSize;
+    private Integer id;
+    private Integer templateId;
+    private Integer groupId;
+    private Integer taskType;
+    private Integer status;
+    private LocalDateTime sendTimeFrom;
+    private LocalDateTime sendTimeTo;
+    private Integer createUid;
+    private String ids;
+}

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

@@ -1,10 +1,11 @@
 package com.mokamrp.privates.mapper.pangu;
 
-import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springframework.stereotype.Component;
+import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
 import java.util.List;
 
 /**
@@ -17,5 +18,5 @@ import java.util.List;
  */
 @Component
 public interface FosterwxCashScheduleTaskListMapper extends BaseMapper<FosterwxCashScheduleTaskList> {
-    public List<FosterwxCashScheduleTaskList> getList(Page<FosterwxCashScheduleTaskList> pageObj);
+    public List<FosterwxCashScheduleTaskList> getList(@Param("ew") LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper, @Param("limit") Integer page, @Param("offset") Integer offset);
 }

+ 20 - 1
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxCashScheduleTaskListMapper.xml

@@ -26,6 +26,25 @@
         id, schedule_id, template_id, group_id, task_type, remark, task_content, status, err_info, send_time, create_uid, update_uid, create_at, update_at
     </sql>
     <select id="getList" resultType="com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList">
-        SELECT * FROM pan_fosterwx_cash_schedule_task_list
+        SELECT
+            task_list.id,
+            task_template.template_name,
+            mobile_group.group_name,
+            task_list.task_type,
+            task_list.remark,
+            task_list.task_content,
+            task_list.`status`,
+            task_list.err_info,
+            task_list.create_user,
+            task_list.send_time
+        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>
+        order by task_list.id desc
+        limit #{limit} offset #{offset}
     </select>
 </mapper>

+ 2 - 2
src/main/java/com/mokamrp/privates/service/pangu/FosterwxCashScheduleTaskListService.java

@@ -1,8 +1,8 @@
 package com.mokamrp.privates.service.pangu;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 
 import java.util.List;
@@ -17,7 +17,7 @@ import java.util.List;
  */
 public interface FosterwxCashScheduleTaskListService extends IService<FosterwxCashScheduleTaskList> {
     //.@leon 获取数据列表
-    public ResHandle<List<FosterwxCashScheduleTaskList>> getList(PostBasePageHandle handle);
+    public ResHandle<List<FosterwxCashScheduleTaskList>> getList(FosterwxCashScheduleTaskListHandle handle);
 
 
     /**

+ 25 - 13
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxCashScheduleTaskListServiceImpl.java

@@ -1,10 +1,9 @@
 package com.mokamrp.privates.service.pangu.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.mokamrp.privates.entity.PostBasePageHandle;
 import com.mokamrp.privates.entity.ResHandle;
+import com.mokamrp.privates.entity.pangu.FosterwxCashScheduleTaskListHandle;
 import com.mokamrp.privates.mapper.pangu.FosterwxCashScheduleTaskListMapper;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxCashScheduleTaskList;
 import com.mokamrp.privates.service.pangu.FosterwxCashScheduleTaskListService;
@@ -33,14 +32,30 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
      * @param handle
      * @return
      */
-    public ResHandle<List<FosterwxCashScheduleTaskList>> getList(PostBasePageHandle handle) {
-        Integer pagesize = handle.getPagesize();
+    public ResHandle<List<FosterwxCashScheduleTaskList>> getList(FosterwxCashScheduleTaskListHandle handle) {
+        Integer pagesize = handle.getPageSize();
         Integer page = handle.getPage();
-        Page<FosterwxCashScheduleTaskList> pageObj = new Page<FosterwxCashScheduleTaskList>(page, pagesize);
-        List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(pageObj);
+        LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        // 任务模板名称
+        if (null != handle.getTemplateId())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getTemplateId, handle.getTemplateId());
+        // 创建人
+        if (null != handle.getCreateUid())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getCreateUid, handle.getCreateUid());
+        // 状态
+        if (null != handle.getStatus())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getStatus, handle.getStatus());
+        // 发送日期
+        if (null != handle.getSendTimeFrom() && null != handle.getSendTimeTo())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.between(FosterwxCashScheduleTaskList::getSendTime, handle.getSendTimeFrom(), handle.getSendTimeTo());
+        // 账号分组
+        if (null != handle.getGroupId())
+            fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getGroupId, handle.getGroupId());
+
+        List<FosterwxCashScheduleTaskList> list = fosterwxCashScheduleTaskListMapper.getList(fosterwxCashScheduleTaskListLambdaQueryWrapper, pagesize, (page - 1) * pagesize);
         ResHandle<List<FosterwxCashScheduleTaskList>> res = new ResHandle<>();
         res.setList(list);
-        res.setTotal(pageObj.getTotal());
+        res.setTotal(Long.valueOf(fosterwxCashScheduleTaskListMapper.selectCount(fosterwxCashScheduleTaskListLambdaQueryWrapper)));
         return res;
     }
 
@@ -51,14 +66,11 @@ public class FosterwxCashScheduleTaskListServiceImpl extends ServiceImpl<Fosterw
      */
     @Override
     public void cancelTask(Integer id, Integer userId) {
-        LambdaQueryWrapper<FosterwxCashScheduleTaskList> fosterwxCashScheduleTaskListLambdaQueryWrapper = new LambdaQueryWrapper<>();
-        fosterwxCashScheduleTaskListLambdaQueryWrapper.eq(FosterwxCashScheduleTaskList::getScheduleId, id);
-        fosterwxCashScheduleTaskListLambdaQueryWrapper.notIn(FosterwxCashScheduleTaskList::getStatus, 3, 5, 6);
-
-        fosterwxCashScheduleTaskListMapper.update(new FosterwxCashScheduleTaskList() {{
+        fosterwxCashScheduleTaskListMapper.updateById(new FosterwxCashScheduleTaskList() {{
+            setId(id);
             setStatus(6);
             setUpdateUid(userId);
             setUpdateAt(LocalDateTime.now());
-        }}, fosterwxCashScheduleTaskListLambdaQueryWrapper);
+        }});
     }
 }