package org.linlinjava.jz.admin.web.report;

import java.util.List;
import java.util.Map;

import javax.validation.constraints.NotNull;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.linlinjava.jz.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.jz.admin.service.AdminReportService;
import org.linlinjava.jz.admin.util.SecurityHelper;
import org.linlinjava.jz.core.util.PhoneNumberUtil;
import org.linlinjava.jz.core.util.ResponseUtil;
import org.linlinjava.jz.core.validator.Order;
import org.linlinjava.jz.core.validator.Sort;
import org.linlinjava.jz.db.dao.JzReportMapper;
import org.linlinjava.jz.db.domain.JzBuiltList;
import org.linlinjava.jz.db.dto.BuiltlistReportDto;
import org.springframework.beans.factory.annotation.Autowired;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageHelper;

@RestController
@RequestMapping("/admin/builtlistReport")
@Validated
public class AdminBuiltListReportController {
	private final Log logger = LogFactory.getLog(AdminBuiltListReportController.class);

	@Autowired
	AdminReportService adminReportService;

	@RequiresPermissions("admin:builtlistReport:list")
	@RequiresPermissionsDesc(menu = { "报表统计", "电访任务报表" }, button = "查询")
	@GetMapping("/list")
	public Object list(@RequestParam(required = false) Integer campaignId,
			@NotNull @RequestParam(required = false) String startTime,
			@NotNull @RequestParam(required = false) String endTime, @RequestParam(defaultValue = "1") Integer page,
			@RequestParam(defaultValue = "10") Integer limit) {

		List<BuiltlistReportDto> selectByCampaignIdTime = adminReportService.selectBuiltlistReport(page, limit,
				campaignId, startTime, endTime);

		return ResponseUtil.okList(selectByCampaignIdTime);
	}

}
