| | |
| | | package com.matrix.system.fenxiao.action; |
| | | |
| | | import com.matrix.core.pojo.AjaxResult; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.excl.ExcelSheetPO; |
| | | import com.matrix.core.tools.excl.ExcelUtil; |
| | | import com.matrix.core.tools.excl.ExcelVersion; |
| | | import com.matrix.system.common.tools.ResponseHeadUtil; |
| | | import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderBasicDto; |
| | | import com.matrix.system.fenxiao.dto.LoadFenxiaoOrderListDto; |
| | | import com.matrix.system.fenxiao.dto.LoadSetOrderListDtoDto; |
| | | import com.matrix.system.fenxiao.dto.UpdateSetOrderDoneDto; |
| | | import com.matrix.system.fenxiao.service.ShopSalesmanOrderService; |
| | | import com.matrix.system.fenxiao.vo.FenxiaoOrderListExportVo; |
| | | import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderBasicVo; |
| | | import com.matrix.system.fenxiao.vo.LoadFenxiaoOrderListVo; |
| | | import com.matrix.system.fenxiao.vo.LoadSetOrderListDtoVo; |
| | | import com.matrix.system.hive.bean.SysProjServices; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | | import io.swagger.annotations.ApiResponses; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping(value = "/fenXiao/fenXiaoOrder") |
| | |
| | | AjaxResult loadSetOrderList(@RequestBody LoadSetOrderListDtoDto loadSetOrderListDto) { |
| | | return shopSalesmanOrderService.loadSetOrderList(loadSetOrderListDto); |
| | | } |
| | | |
| | | |
| | | @RequestMapping(value = "/exportExcel") |
| | | public void exportExcel(HttpServletResponse response, LoadFenxiaoOrderListDto loadFenxiaoOrderListDto) throws IOException { |
| | | List<ExcelSheetPO> res = new ArrayList<>(); |
| | | ExcelSheetPO orderSheet = new ExcelSheetPO(); |
| | | String title = "分销订单明细"; |
| | | orderSheet.setSheetName(title); |
| | | orderSheet.setTitle(title); |
| | | String[] header = {"订单编号","实付金额(元)", "订单状态", "下单门店","客户", "推广员","收益类型","收益金额", "结算状态", "结算编号", "结算时间", "结算人"}; |
| | | orderSheet.setHeaders(header); |
| | | |
| | | List<FenxiaoOrderListExportVo> dataList = shopSalesmanOrderService.findFenxiaoOrderList(loadFenxiaoOrderListDto); |
| | | List<List<Object>> list = new ArrayList<>(); |
| | | if (dataList.size() > 0) { |
| | | for (FenxiaoOrderListExportVo item : dataList) { |
| | | List<Object> temp = new ArrayList<>(); |
| | | temp.add(item.getOrderNo()); |
| | | temp.add(item.getActualBalance()); |
| | | temp.add(item.getOrderState()); |
| | | temp.add(item.getAddress()); |
| | | temp.add(item.getCustom()); |
| | | temp.add(item.getParentSale()); |
| | | temp.add(item.getProfitType()); |
| | | temp.add(item.getProfitBalance()); |
| | | temp.add(item.getSettleType()); |
| | | temp.add(item.getSettleNo()); |
| | | temp.add(DateUtil.dateToString(item.getSettleTime(), DateUtil.DATE_FORMAT_MM)); |
| | | temp.add(item.getSettler()); |
| | | list.add(temp); |
| | | } |
| | | } |
| | | orderSheet.setDataList(list); |
| | | res.add(orderSheet); |
| | | response = ResponseHeadUtil.setExcelHead(response); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode(title + DateUtil.getTimeMark() + ".xlsx".trim(), "UTF-8")); |
| | | OutputStream os = response.getOutputStream(); |
| | | ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true); |
| | | } |
| | | |
| | | |
| | | |