ERPCommonController.java 1.63 KB
package cn.fw.valhalla.controller.erp;

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.IgnoreUserToken;
import cn.fw.security.auth.client.enums.AuthType;
import cn.fw.valhalla.sdk.param.CustomerQueryReq;
import cn.fw.valhalla.service.bus.cust.CustomerBizService;
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 static cn.fw.common.web.util.ResultBuilder.success;

/**
 * @author : kurisu
 * @className : CustomerController
 * @description : 档案控制器
 * @date: 2020-08-12 15:30
 */
@Slf4j
@Validated
@RestController
@Authorization(AuthType.ERP)
@RequiredArgsConstructor
@RequestMapping("/erp/customer")
public class ERPCommonController {
    private final CustomerBizService customerBizService;


    @GetMapping("/condition/count")
    @IgnoreUserToken
    @ControllerMethod("查询满足条件的档案数量")
    public Message<Number> conditionCustomerCount(@CurrentUser LoginAuthBean currentUser, @Valid CustomerQueryReq customerQueryReq) {
        customerQueryReq.setGroupId(currentUser.getGroupId());
        return success(customerBizService.queryCustomCount(customerQueryReq));
    }
}