package org.springblade.gateway.common_gateway.controller;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.ldt.mall.entity.Mall;
import org.springblade.ldt.mall.service.IMallService;
import org.springblade.ldt.shop.service.IShopService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author cy-computer
 */
@Api(tags = "账单模块")
@RestController
@RequestMapping("/web/index")
@AllArgsConstructor
public class WebIndexController {

	private IMallService mallService;
	private IShopService shopService;


	@RequestMapping("statistics")
	public R statistics(){

		DateTime beginOfDay = DateUtil.beginOfDay(new Date());
		DateTime endOfDay = DateUtil.endOfDay(new Date());

		//商场总数
		int mallCount = mallService.count();
		//今日新增商场
		int mallCountToday = mallService.count(Condition.getQueryWrapper(new Mall()).lambda()
			.between(Mall::getCreateTime, beginOfDay, endOfDay));
		//商店总数


		return null;
	}
}
