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);
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|