PoolController.java 4.76 KB
package cn.fw.shirasawa.server.controller.app;

import cn.fw.common.page.AppPage;
import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.common.web.auth.LoginAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.annotation.IgnoreAuth;
import cn.fw.security.auth.client.enums.AuthType;
import cn.fw.shirasawa.domain.query.CluePoolQueryVO;
import cn.fw.shirasawa.domain.query.FollowPoolQueryVO;
import cn.fw.shirasawa.domain.query.FollowRecordPoolQuery;
import cn.fw.shirasawa.domain.query.SecretReportHistoryQuery;
import cn.fw.shirasawa.domain.vo.SecretReportHistoryVO;
import cn.fw.shirasawa.domain.vo.follow.FollowDetailVO;
import cn.fw.shirasawa.domain.vo.follow.FollowRecordHistoryVO;
import cn.fw.shirasawa.domain.vo.pool.CluePoolVO;
import cn.fw.shirasawa.domain.vo.pool.FollowPoolListVO;
import cn.fw.shirasawa.domain.vo.pool.FollowRecordPoolVO;
import cn.fw.shirasawa.service.bus.follow.FollowBizService;
import cn.fw.shirasawa.service.bus.follow.PoolBizService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

import static cn.fw.common.web.util.ResultBuilder.success;

/**
 * @author : kurisu
 * @className : PoolController
 * @description :
 * @date: 2020-11-11 17:26
 */
@Slf4j
@RestController
@Authorization(AuthType.APP)
@RequiredArgsConstructor
@Validated
@RequestMapping("/app/pool")
public class PoolController {

    private final PoolBizService poolBizService;
    private final FollowBizService followBizService;


    @GetMapping("/follow/own/list")
    @ControllerMethod("查询自己的跟进池列表")
    public Message<AppPage<FollowPoolListVO>> ownFollowList(@CurrentUser LoginAuthBean currentUser, @Valid final FollowPoolQueryVO queryVO) {
        AppPage<FollowPoolListVO> page = poolBizService.followList(currentUser, queryVO);
        return success(page);
    }

    @GetMapping("/follow/list")
    @IgnoreAuth
    @ControllerMethod("查询跟进池列表")
    public Message<AppPage<FollowPoolListVO>> followList(@Valid final FollowPoolQueryVO queryVO) {
        AppPage<FollowPoolListVO> page = poolBizService.followList(null, queryVO);
        return success(page);
    }

    @GetMapping("/follow/task/referId")
    @IgnoreAuth
    @ControllerMethod("根据业务id查询跟进任务id")
    public Message<Long> queryTaskByReferId(@NotBlank(message = "业务id不能为空") final String referId,
                                            @NotNull(message = "跟进类型不能为空") final Integer type,
                                            @CurrentUser LoginAuthBean currentUser) {
        return success(followBizService.queryTaskByReferId(referId, currentUser.getGroupId(), type));
    }

    @GetMapping("/follow/record/history")
    @IgnoreAuth
    @ControllerMethod("查询跟进待办历史记录")
    public Message<List<FollowRecordHistoryVO>> todoRecordHistory(@NotNull(message = "跟进池id不能为空") final Long taskId) {
        return success(followBizService.todoHistoryTask(taskId));
    }

    @GetMapping("/follow/detail")
    @IgnoreAuth
    @ControllerMethod("根据跟进池id查询跟进池详情")
    public Message<FollowDetailVO> detail(@NotNull(message = "跟进池id不能为空") final Long taskId) {
        return success(followBizService.followPoolDetail(taskId));
    }


    @GetMapping("/clue/list")
    @IgnoreAuth
    @ControllerMethod("查询客户线索池列表")
    public Message<AppPage<CluePoolVO>> clueList(@Valid final CluePoolQueryVO queryVO) {
        AppPage<CluePoolVO> page = poolBizService.clueList(queryVO);
        return success(page);
    }


    @GetMapping("/secret/report/list")
    @IgnoreAuth
    @ControllerMethod("查询智能通话记录池列表")
    public Message<AppPage<SecretReportHistoryVO>> reportList(@Valid final SecretReportHistoryQuery queryVO) {
        AppPage<SecretReportHistoryVO> page = poolBizService.secretReportList(queryVO);
        return success(page);
    }


    @GetMapping("/follow/record/log/list")
    @IgnoreAuth
    @ControllerMethod("查询跟进记录池列表")
    public Message<AppPage<FollowRecordPoolVO>> recordPoolList(@CurrentUser LoginAuthBean currentUser, @Valid final FollowRecordPoolQuery queryVO) {
        AppPage<FollowRecordPoolVO> page = poolBizService.recordPoolList(currentUser, queryVO);
        return success(page);
    }
}