| | |
| | | package com.ruoyi.order.controller; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.BaseEntity; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.exception.GlobalException; |
| | | import com.ruoyi.common.core.vo.AddressDto; |
| | | import com.ruoyi.common.core.vo.PaperInVo; |
| | | import com.ruoyi.common.core.vo.Path; |
| | | |
| | | import com.ruoyi.order.entity.*; |
| | | import com.ruoyi.order.request.OrderCountDataRequest; |
| | | import com.ruoyi.order.request.OrderRequest; |
| | |
| | | return R.ok(orderService.lambdaUpdate() |
| | | .eq(Order::getId, orderId).set(Order::getState, state).update()); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "订单列表-增加打印次数", tags = {"后台-订单管理"}) |
| | | @PostMapping(value = "/count") |
| | | public R<Boolean> count(@RequestParam("orderId") String orderId) { |
| | | Order byId = orderService.getById(orderId); |
| | | byId.setPrintCount(byId.getPrintCount()==null?1:byId.getPrintCount()+1); |
| | | orderService.updateById(byId); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "订单列表-获取入库单", tags = {"后台-订单管理"}) |
| | | @PostMapping(value = "/papercount") |
| | | public R<List<PaperInVo>> inpaper(@RequestParam("workId") String workId,@RequestParam("date") String date) { |
| | | |
| | | List<PaperInVo> paper = orderService.papercout(workId,date); |
| | | return R.ok(paper); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 更改订单状态且清空到达时间 |
| | |
| | | order.setIsEvaluate(Constants.ZERO); |
| | | order.setCityCode(orderRequest.getCityCode()); |
| | | order.setOrderMoney(orderRequest.getOrderMoney()); |
| | | order.setProvinceCode(orderRequest.getProvinceCode()); |
| | | order.setAreaCode(orderRequest.getAreaCode()); |
| | | return R.ok(orderService.save(order)); |
| | | } |
| | | |
| | |
| | | if (order.getSubsidy()!=null){ |
| | | order.setOrderMoney(order.getServePrice().add(order.getSubsidy())); |
| | | } |
| | | order.setProvinceCode(orderRequest.getProvinceCode()); |
| | | order.setAreaCode(orderRequest.getAreaCode()); |
| | | return R.ok(orderService.updateById(order)); |
| | | } |
| | | |
| | |
| | | return R.ok(orderService.orderCountHome(orderCount)); |
| | | } |
| | | |
| | | //获取师傅当天的订单 |
| | | @PostMapping(value = "/workday") |
| | | public R<List<Order>> workday(@RequestBody Integer workId) { |
| | | // 获取当前日期 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | |
| | | // 使用 format 方法将 LocalDate 对象转换为字符串 |
| | | String formattedToday = LocalDate.now().format(formatter); |
| | | |
| | | System.out.println(formattedToday); // 输出:2023-09-12(假设今天是2023年9月12日) |
| | | |
| | | |
| | | // 构建 Lambda 查询条件 |
| | | LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper |
| | | .eq(Order::getTime, formattedToday) // 当天开始时间 |
| | | ; // 当天结束时间 |
| | | |
| | | // 执行查询 |
| | | List<Order> orders = orderService.list(queryWrapper.eq(Order::getServerId,workId)); |
| | | |
| | | // 处理查询结果 |
| | | for (Order order : orders) { |
| | | System.out.println(order); |
| | | } |
| | | return R.ok(orders); |
| | | } |
| | | /** |
| | | * 用户所关联订单记录分页列表 |
| | | * |
| | |
| | | .orderByAsc("CASE WHEN topSort IS NULL THEN 1 ELSE 0 END") |
| | | .orderByAsc("topSort"); |
| | | |
| | | return R.ok(orderService.list(wrapper)); |
| | | List<Order> list = orderService.list(wrapper); |
| | | for (Order order : list) { |
| | | if (order.getAcceptTime()==null){ |
| | | order.setAcceptTime(order.getCreateTime()); |
| | | } |
| | | } |
| | | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |