| | |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.constants.Constants; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.business.model.Orders; |
| | | import com.doumee.dao.dto.ConfirmArriveDTO; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.dao.dto.DispatchDTO; |
| | | import com.doumee.dao.dto.HandleOrderExceptionDTO; |
| | | import com.doumee.dao.dto.ManualRefundDTO; |
| | | import com.doumee.dao.vo.OrderDetailVO; |
| | | import com.doumee.dao.vo.OrderDispatchVO; |
| | | import com.doumee.dao.vo.OrdersExportVO; |
| | | import com.doumee.dao.vo.OrderSummaryVO; |
| | | import com.doumee.service.business.OrdersService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 寄存订单管理 |
| | |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:orders:exportExcel") |
| | | public void exportExcel(@RequestBody PageWrap<Orders> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(Orders.class).export(ordersService.findPage(pageWrap).getRecords(), "寄存订单", response); |
| | | List<Orders> records = ordersService.findPage(pageWrap).getRecords(); |
| | | List<OrdersExportVO> exportList = new ArrayList<>(); |
| | | for (Orders o : records) { |
| | | OrdersExportVO vo = new OrdersExportVO(); |
| | | vo.setCode(o.getCode()); |
| | | vo.setGoodsInfo(o.getGoodsInfo()); |
| | | vo.setTypeName(o.getType() != null ? (o.getType() == 0 ? "就地存取" : "异地存取") : ""); |
| | | vo.setOrderLevel(Constants.getDriverLevelName(Objects.nonNull(o.getOrderLevel())?Integer.valueOf(o.getOrderLevel()):Constants.ZERO)); |
| | | vo.setDeclaredFee(String.valueOf(Constants.getFormatMoney(o.getDeclaredFee()))); |
| | | vo.setBasicAmount(String.valueOf(Constants.getFormatMoney(o.getBasicAmount()))); |
| | | vo.setTotalAmount(String.valueOf(Constants.getFormatMoney(o.getTotalAmount()))); |
| | | vo.setPayAmount(String.valueOf(Constants.getFormatMoney(o.getPayAmount()))); |
| | | vo.setUrgentAmount(String.valueOf(Constants.getFormatMoney(o.getUrgentAmount()))); |
| | | vo.setRefundAmount(String.valueOf(Constants.getFormatMoney(o.getRefundAmount()))); |
| | | vo.setOverdueAmount(String.valueOf(Constants.getFormatMoney(o.getOverdueAmount()))); |
| | | vo.setExceptionAmount(String.valueOf(Constants.getFormatMoney(o.getExceptionAmount()))); |
| | | vo.setDeductionAmount(String.valueOf(Constants.getFormatMoney(o.getDeductionAmount()))); |
| | | vo.setStatusDesc(o.getStatusDesc()); |
| | | vo.setSettlementDesc(o.getSettlementStatus() != null ? (o.getSettlementStatus() == 1 ? "已结算" : "待结算") : ""); |
| | | vo.setPayTime(o.getPayTime()); |
| | | vo.setCreateTime(o.getCreateTime()); |
| | | exportList.add(vo); |
| | | } |
| | | String fileName = "订单管理导出_" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); |
| | | ExcelExporter.build(OrdersExportVO.class).export(exportList, fileName, response); |
| | | } |
| | | |
| | | @ApiOperation("根据ID查询") |
| | |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("确认顾客到店") |
| | | @PostMapping("/confirmArrived") |
| | | @ApiOperation("手动触发订单结算") |
| | | @PostMapping("/settle") |
| | | @RequiresPermissions("business:orders:update") |
| | | public ApiResponse confirmArrived(@RequestBody ConfirmArriveDTO dto) { |
| | | ordersService.confirmCustomerArrived(dto.getOrderId(), dto.getShopId()); |
| | | return ApiResponse.success(null); |
| | | public ApiResponse settleOrders() { |
| | | ordersService.settleOrders(); |
| | | return ApiResponse.success("结算完成"); |
| | | } |
| | | |
| | | @ApiOperation("手动退款") |
| | | @PostMapping("/manualRefund") |
| | | @RequiresPermissions("business:orders:update") |
| | | @PreventRepeat |
| | | public ApiResponse manualRefund(@RequestBody @Valid ManualRefundDTO dto) { |
| | | ordersService.manualRefund(dto, this.getLoginUser().getId()); |
| | | return ApiResponse.success("操作成功"); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("订单异常处理") |
| | | @PostMapping("/handleException") |
| | | @RequiresPermissions("business:orders:update") |
| | | public ApiResponse handleException(@RequestBody @Valid HandleOrderExceptionDTO dto) { |
| | | ordersService.handleOrderException(dto); |
| | | return ApiResponse.success("操作成功"); |
| | | } |
| | | |
| | | } |