package com.sptg.ad.biz.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.ad.api.dto.AdOfflinePushRecordDto;
import com.sptg.ad.api.dto.AdPushTaskDto;
import com.sptg.ad.api.entity.*;
import com.sptg.ad.api.feigns.AdOfflinePushRecordFeign;
import com.sptg.ad.api.feigns.AdPushTaskFeign;
import com.sptg.ad.biz.service.*;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * title: AdPushTaskController
 * package: com.sptg.ad.biz.controller
 * description: 广告任务发布-控制器
 *
 *
 *
 */
@RestController
@RequiredArgsConstructor
public class AdOfflinePushRecordController implements AdOfflinePushRecordFeign {

    private final AdOfflinePushRecordServiceInterface adOfflinePushRecordServiceInterface;

    @Override
    public ResultBean<Page<AdOfflinePushRecord>> showAdOfflinePushRecordList(@RequestBody AdOfflinePushRecordDto adOfflinePushRecordDto) {
        Page<AdOfflinePushRecord> offlinePushRecordPage = this.adOfflinePushRecordServiceInterface.showAdOfflinePushRecordList(adOfflinePushRecordDto);
        return new ResultBean<>(ResultEnum.SUCCESS,offlinePushRecordPage);
    }

    @Override
    public ResultBean<Boolean> addAdOfflinePushRecord(@RequestBody AdOfflinePushRecord adOfflinePushRecord) {
        return this.adOfflinePushRecordServiceInterface.addAdOfflinePushRecord(adOfflinePushRecord);
    }

    @Override
    public ResultBean<Boolean> cancelAdOfflinePushRecord(@RequestBody  Long id) {
        return this.adOfflinePushRecordServiceInterface.cancelAdOfflinePushRecord(id);
    }

    @Override
    public AdOfflinePushRecord findAdOfflinePushRecordById(@RequestBody  Long id) {
        return this.adOfflinePushRecordServiceInterface.findAdOfflinePushRecordById(id);
    }
    @Override
    public ResultBean<Boolean> updateAdOfflinePushRecord(@RequestBody AdOfflinePushRecord adOfflinePushRecord) {
        return this.adOfflinePushRecordServiceInterface.updateAdOfflinePushRecord(adOfflinePushRecord);
    }
    @Override
    public Integer getAdOfflinePushRecordByProvinceName(@RequestParam("provinceShortName") String provinceShortName,@RequestParam("orgPosition") String orgPosition) {
        return this.adOfflinePushRecordServiceInterface.getAdOfflinePushRecordByProvinceName(provinceShortName,orgPosition);
    }
    @Override
    public Integer getAdOfflinePushRecordByYearMonth(@RequestParam(name="year",required = false) String year,@RequestParam(name="month",required = false) String month) {
        return this.adOfflinePushRecordServiceInterface.getAdOfflinePushRecordByYearMonth(year,month);
    }
}
