From c253b555c7905c5136d47cd615ef545fa50cc6ad Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Sun, 20 Feb 2022 21:24:16 +0800 Subject: [PATCH] Merge branch 'api_score_meger' --- zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java | 144 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 144 insertions(+), 0 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java b/zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java new file mode 100644 index 0000000..8c147d5 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/fenxiao/action/FenXiaoOrderAction.java @@ -0,0 +1,144 @@ +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") +public class FenXiaoOrderAction { + + @Autowired + private ShopSalesmanOrderService shopSalesmanOrderService; + + /** + * 分销订单基本信息 + */ + @ApiOperation(value = "分销订单基本信息") + @ApiResponses({ + @ApiResponse(code = 200, message = "OK", response = LoadFenxiaoOrderBasicVo.class) + }) + @PostMapping(value = "/loadFenxiaoOrderBasic") + public @ResponseBody + AjaxResult loadFenxiaoOrderBasic(@RequestBody LoadFenxiaoOrderBasicDto loadFenxiaoOrderBasicDto) { + return shopSalesmanOrderService.loadFenxiaoOrderBasic(loadFenxiaoOrderBasicDto); + } + + /** + * 分销订单 + */ + @ApiOperation(value = "分销订单") + @ApiResponses({ + @ApiResponse(code = 200, message = "OK", response = LoadFenxiaoOrderListVo.class) + }) + @PostMapping(value = "/loadFenxiaoOrderList") + public @ResponseBody + AjaxResult loadFenxiaoOrderList(@RequestBody LoadFenxiaoOrderListDto loadFenxiaoOrderListDto) { + return shopSalesmanOrderService.loadFenxiaoOrderList(loadFenxiaoOrderListDto); + } + + /** + *批量结算分销订单 + */ + @ApiOperation(value = "批量结算分销订单") + @PostMapping(value = "/updateSetOrderDone") + public @ResponseBody + AjaxResult updateSetOrderDone(@RequestBody UpdateSetOrderDoneDto updateSetOrderDoneDto) { + return shopSalesmanOrderService.updateSetOrderDone(updateSetOrderDoneDto); + } + + /** + * 结算记录 + */ + @ApiOperation(value = "结算记录") + @ApiResponses({ + @ApiResponse(code = 200, message = "OK", response = LoadSetOrderListDtoVo.class) + }) + @PostMapping(value = "/loadSetOrderList") + public @ResponseBody + 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); + } + + + + + + + + + + + + + + + + + + +} -- Gitblit v1.9.1