//package com.gree.mall.manager.controller.report;
//
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.gree.mall.manager.bean.ExcelData;
//import com.gree.mall.manager.bean.Freight.FreightTemplateBean;
//import com.gree.mall.manager.helper.ResponseHelper;
//import com.gree.mall.manager.logic.report.OfflineDataLogic;
//import com.gree.mall.manager.plus.entity.FreightTemplate;
//import com.gree.mall.manager.plus.entity.OfflineSaleRecord;
//import com.gree.mall.manager.utils.excel.ExcelUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.math.BigDecimal;
//import java.text.SimpleDateFormat;
//import java.util.Date;
//import java.util.List;
//
//@Slf4j
//@RestController
//@Api(value = "线下销售", tags = {"线下销售"})
//@RequestMapping(value = "/offline", produces = "application/json; charset=utf-8")
//public class OfflineDataController {
//    @Autowired
//    private OfflineDataLogic offlineDataLogic;
//
//    @GetMapping("/list")
//    @ApiOperation(value = "列表")
//    public ResponseHelper<Page<OfflineSaleRecord>> page(HttpServletRequest request,
//            @ApiParam(value = "销售员姓名", required = false) @RequestParam(required = false) String name,
//            @ApiParam(value = "销售员手机号", required = false) @RequestParam(required = false) String phone,
//            @ApiParam(value = "网点名称", required = false) @RequestParam(required = false) String websitName,
//            @ApiParam(value = "网点编号", required = false) @RequestParam(required = false) String websitNumber,
//            @ApiParam(value = "商品类别", required = false) @RequestParam(required = false) String category,
//            @ApiParam(value = "商品数量", required = false) @RequestParam(required = false) Integer num,
//            @ApiParam(value = "销售额下限", required = false) @RequestParam(required = false) BigDecimal minAmount,
//            @ApiParam(value = "销售额上限", required = false) @RequestParam(required = false) BigDecimal maxAmount,
//            @ApiParam(value = "状态(true：正常 false:作废", required = false) @RequestParam(required = false) Boolean status,
//            @ApiParam(value = "销售开始时间", required = false) @RequestParam(required = false) String startTime,
//            @ApiParam(value = "销售结束时间", required = false) @RequestParam(required = false) String endTime,
//            @ApiParam(value = "页号", required = true) @RequestParam(required = true) Integer pageNum,
//            @ApiParam(value = "页大小", required = true) @RequestParam(required = true) Integer pageSize
//    ) {
//        IPage page = offlineDataLogic.page(request,name, phone, websitName, websitNumber,
//                category, num, minAmount, maxAmount, status,
//                startTime, endTime, pageNum, pageSize);
//        return ResponseHelper.success(page);
//    }
//
//    @GetMapping("/export")
//    @ApiOperation(value = "导出")
//    public void importData(
//            HttpServletRequest request,
//            @ApiParam(value = "销售员姓名", required = false) @RequestParam(required = false) String name,
//            @ApiParam(value = "销售员手机号", required = false) @RequestParam(required = false) String phone,
//            @ApiParam(value = "网点名称", required = false) @RequestParam(required = false) String websitName,
//            @ApiParam(value = "网点编号", required = false) @RequestParam(required = false) String websitNumber,
//            @ApiParam(value = "商品类别", required = false) @RequestParam(required = false) String category,
//            @ApiParam(value = "商品数量", required = false) @RequestParam(required = false) Integer num,
//            @ApiParam(value = "销售额下限", required = false) @RequestParam(required = false) BigDecimal minAmount,
//            @ApiParam(value = "销售额上限", required = false) @RequestParam(required = false) BigDecimal maxAmount,
//            @ApiParam(value = "状态(true：正常 false:作废", required = false) @RequestParam(required = false) Boolean status,
//            @ApiParam(value = "销售开始时间", required = false) @RequestParam(required = false) String startTime,
//            @ApiParam(value = "销售结束时间", required = false) @RequestParam(required = false) String endTime,
//            HttpServletResponse response
//    ) throws Exception {
//        List<OfflineSaleRecord> records = offlineDataLogic.page(request, name, phone, websitName, websitNumber,
//                category, num, minAmount, maxAmount, status,
//                startTime, endTime, 1, -1).getRecords();
//        ExcelData excelData = offlineDataLogic.exportData(records);
//        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
//        ExcelUtils.exportExcel(request, response, "线下数据"+simpleDateFormat.format(new Date())+".xlsx", excelData);
//
//    }
//
//
//
//    @PostMapping("/delete")
//    @ApiOperation(value = "删除销售数据")
//    public ResponseHelper delete(
//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
//    ) {
//        offlineDataLogic.delete(id);
//        return ResponseHelper.success();
//    }
//
//    @GetMapping("/detail")
//    @ApiOperation(value = "销售数据详情")
//    public ResponseHelper detail(
//            @ApiParam(value = "id", required = true) @RequestParam(required = true) String id
//    ) {
//        return ResponseHelper.success(offlineDataLogic.detail(id));
//    }
//
//    @PostMapping("/save")
//    @ApiOperation(value = "新增销售数据")
//    public ResponseHelper save(HttpServletRequest request,
//            @ApiParam(value = "销售数据", required = true) @RequestBody(required = true) OfflineSaleRecord offlineSaleRecord
//    ) {
//        String id = offlineDataLogic.save(request,offlineSaleRecord);
//        return ResponseHelper.success(id);
//    }
//
//    @PostMapping("/update")
//    @ApiOperation(value = "修改销售数据")
//    public ResponseHelper update(
//            @ApiParam(value = "销售数据", required = true) @RequestBody(required = true) OfflineSaleRecord offlineSaleRecord
//    ) {
//        offlineDataLogic.update(offlineSaleRecord);
//        return ResponseHelper.success();
//    }
//
//}
