| | |
| | | import cc.mrbird.febs.mall.dto.*; |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.MallExpressInfoMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallMemberMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderRefundOperationMapper; |
| | | import cc.mrbird.febs.mall.service.IAdminMallGoodsService; |
| | | import cc.mrbird.febs.mall.service.IAdminMallOrderService; |
| | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | private final IAdminMallOrderService adminMallOrderService; |
| | | private final MallExpressInfoMapper mallExpressInfoMapper; |
| | | private final MallMemberMapper mallMemberMapper; |
| | | private final MallOrderInfoMapper mallOrderInfoMapper; |
| | | |
| | | /** |
| | | * 订单列表 |
| | |
| | | public FebsResponse getOrderList(MallOrderInfoDto mallOrderInfo, QueryRequest request) { |
| | | Map<String, Object> data = getDataTable(adminMallOrderService.getOrderListInPage(mallOrderInfo, request)); |
| | | return new FebsResponse().success().data(data); |
| | | } |
| | | |
| | | /** |
| | | * 订单列表-资金流水 |
| | | */ |
| | | @GetMapping("/orderMoneyFlow") |
| | | public FebsResponse orderMoneyFlow(QueryRequest request, MallOrderInfo mallOrderInfo, Integer parentId) { |
| | | if (parentId == null) { |
| | | ViewMallOrderController.idOrderMoneyFlow = 0; |
| | | } |
| | | mallOrderInfo.setId(ViewMallOrderController.idOrderMoneyFlow); |
| | | Map<String, Object> dataTable = getDataTable(adminMallOrderService.orderMoneyFlow(request, mallOrderInfo)); |
| | | return new FebsResponse().success().data(dataTable); |
| | | } |
| | | |
| | | /** |
| | |
| | | @ControllerEndpoint(operation = "订单列表-取消订单", exceptionMessage = "操作失败") |
| | | public FebsResponse cancelOrder(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminMallOrderService.cancelOrder(id); |
| | | } |
| | | |
| | | /** |
| | | * 订单列表-自提订单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @GetMapping("takeGoods/{id}") |
| | | @ControllerEndpoint(operation = "订单列表-自提订单", exceptionMessage = "操作失败") |
| | | public FebsResponse takeGoods(@NotNull(message = "{required}") @PathVariable Long id) { |
| | | return adminMallOrderService.takeGoods(id); |
| | | } |
| | | |
| | | /** |
| | |
| | | String title = "订单列表"; |
| | | orderSheet.setSheetName(title); |
| | | orderSheet.setTitle(title); |
| | | String[] header = {"订单编号", "订单金额", "下单时间", "配送方式", "收货姓名", "收货电话", "收货地址", "商品名称", "订单状态", "物流单号", "物流公司", "物流公司码"}; |
| | | String[] header = {"订单编号", "下单人", "订单金额", "下单时间", "配送方式", "收货姓名", "收货电话", "收货地址", "商品名称", "订单状态", "物流单号", "物流公司", "物流公司码"}; |
| | | orderSheet.setHeaders(header); |
| | | |
| | | QueryRequest request = new QueryRequest(); |
| | |
| | | for (MallOrderInfo item : dataList) { |
| | | List<Object> temp = new ArrayList<>(); |
| | | temp.add(item.getOrderNo()); |
| | | temp.add(mallMemberMapper.selectById(item.getMemberId()).getName()); |
| | | temp.add(item.getAmount()); |
| | | temp.add(DateUtil.format(item.getOrderTime(), "yyyy-MM-dd HH:mm:ss")); |
| | | temp.add("快递配送"); |
| | |
| | | return null; |
| | | } |
| | | |
| | | @GetMapping("exportOrderListAll") |
| | | @ControllerEndpoint(operation = "订单列表", exceptionMessage = "导出失败") |
| | | public FebsResponse exportOrderListAll(MallOrderInfo mallOrderInfo, HttpServletResponse response) throws IOException { |
| | | |
| | | List<ExcelSheetPO> res = new ArrayList<>(); |
| | | ExcelSheetPO orderSheet = new ExcelSheetPO(); |
| | | String title = "订单列表"; |
| | | orderSheet.setSheetName(title); |
| | | orderSheet.setTitle(title); |
| | | String[] header = {"订单编号", "登录账户", "购买人", "手机号码", "订单金额", "状态"}; |
| | | orderSheet.setHeaders(header); |
| | | |
| | | QueryRequest request = new QueryRequest(); |
| | | request.setPageNum(1); |
| | | request.setPageSize(9999); |
| | | List<MallOrderInfo> dataList = mallOrderInfoMapper.selectList(null); |
| | | List<List<Object>> list = new ArrayList<>(); |
| | | if (dataList.size() > 0) { |
| | | for (MallOrderInfo item : dataList) { |
| | | List<Object> temp = new ArrayList<>(); |
| | | temp.add(item.getOrderNo()); |
| | | temp.add(mallMemberMapper.selectById(item.getMemberId()).getAccountLogin()); |
| | | temp.add(mallMemberMapper.selectById(item.getMemberId()).getName()); |
| | | temp.add(mallMemberMapper.selectById(item.getMemberId()).getPhone()); |
| | | temp.add(item.getAmount()); |
| | | switch (item.getStatus()) { |
| | | case 1: |
| | | temp.add("待支付"); |
| | | break; |
| | | case 2: |
| | | temp.add("待发货"); |
| | | break; |
| | | case 3: |
| | | temp.add("待收货"); |
| | | break; |
| | | case 4: |
| | | temp.add("已完成"); |
| | | break; |
| | | case 5: |
| | | temp.add("退款中"); |
| | | break; |
| | | case 6: |
| | | temp.add("已退款"); |
| | | break; |
| | | case 7: |
| | | temp.add("已取消"); |
| | | break; |
| | | default: |
| | | } |
| | | list.add(temp); |
| | | } |
| | | } |
| | | orderSheet.setDataList(list); |
| | | res.add(orderSheet); |
| | | response = ResponseHeadUtil.setExcelHead(response); |
| | | response.setHeader("Content-Disposition", |
| | | "attachment;filename=" + URLEncoder.encode(title + DateUtil.format(new Date(), "yyyyMMDDHHmmss") + ".xlsx".trim(), "UTF-8")); |
| | | OutputStream os = response.getOutputStream(); |
| | | ExcelUtil.createWorkbookAtOutStream(ExcelVersion.V2007, res, os, true); |
| | | return null; |
| | | } |
| | | |
| | | @PostMapping(value = "/importDeliver") |
| | | @ControllerEndpoint(operation = "导入发货", exceptionMessage = "导入失败") |
| | | public FebsResponse importDeliver(@RequestBody MultipartFile file) throws IOException { |