Commit 3465a77298fd8720f29741863b397236137c94af
1 parent
eb0a9496
feat: 修改状态 修改订单获取条件
Showing
5 changed files
with
62 additions
and
29 deletions
trash-garbage/pom.xml
| @@ -46,6 +46,10 @@ | @@ -46,6 +46,10 @@ | ||
| 46 | <artifactId>hutool-all</artifactId> | 46 | <artifactId>hutool-all</artifactId> |
| 47 | <version>5.3.8</version> | 47 | <version>5.3.8</version> |
| 48 | </dependency> | 48 | </dependency> |
| 49 | + <dependency> | ||
| 50 | + <groupId>com.trash</groupId> | ||
| 51 | + <artifactId>trash-unit</artifactId> | ||
| 52 | + </dependency> | ||
| 49 | </dependencies> | 53 | </dependencies> |
| 50 | <!-- 项目打包时会将java目录中的*.xml文件也进行打包 --> | 54 | <!-- 项目打包时会将java目录中的*.xml文件也进行打包 --> |
| 51 | <build> | 55 | <build> |
trash-garbage/src/main/java/com/trash/garbage/global/GlobalStatus.java
| @@ -87,8 +87,7 @@ public class GlobalStatus { | @@ -87,8 +87,7 @@ public class GlobalStatus { | ||
| 87 | NEW_ORDER(0, "新订单"), | 87 | NEW_ORDER(0, "新订单"), |
| 88 | ACTIVE_ORDER(1, "处理中"), | 88 | ACTIVE_ORDER(1, "处理中"), |
| 89 | ALL_ORDER(2, "全部订单"), | 89 | ALL_ORDER(2, "全部订单"), |
| 90 | - PAY_ORDER(3, "待支付订单"), | ||
| 91 | - SUCCESS_ORDER(4, "完成订单"), | 90 | + SUCCESS_ORDER(3, "待支付订单"), |
| 92 | FAIL_ORDER(9, "订单处理失败"), | 91 | FAIL_ORDER(9, "订单处理失败"), |
| 93 | CANCEL_FLAG_NO(0, "未取消订单"), | 92 | CANCEL_FLAG_NO(0, "未取消订单"), |
| 94 | IMAGE_TYPE_CURRENT(0, "现场图片"), | 93 | IMAGE_TYPE_CURRENT(0, "现场图片"), |
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/EvaluateDto.java
| @@ -13,7 +13,6 @@ import java.util.List; | @@ -13,7 +13,6 @@ import java.util.List; | ||
| 13 | public class EvaluateDto { | 13 | public class EvaluateDto { |
| 14 | @NotBlank(message = "订单id不能为空") | 14 | @NotBlank(message = "订单id不能为空") |
| 15 | private String orderId; | 15 | private String orderId; |
| 16 | - private String garCompanyId; | ||
| 17 | private String content; | 16 | private String content; |
| 18 | @NotNull | 17 | @NotNull |
| 19 | private Integer score; | 18 | private Integer score; |
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/OrderDetailVo.java
| @@ -89,10 +89,16 @@ public class OrderDetailVo { | @@ -89,10 +89,16 @@ public class OrderDetailVo { | ||
| 89 | */ | 89 | */ |
| 90 | private String garRemark; | 90 | private String garRemark; |
| 91 | 91 | ||
| 92 | + /** | ||
| 93 | + * 允许处理标识 | ||
| 94 | + */ | ||
| 95 | + private Boolean handleFlag; | ||
| 96 | + | ||
| 92 | public OrderDetailVo(){ | 97 | public OrderDetailVo(){ |
| 93 | this.currentImages = new ArrayList<>(); | 98 | this.currentImages = new ArrayList<>(); |
| 94 | this.putDownImages = new ArrayList<>(); | 99 | this.putDownImages = new ArrayList<>(); |
| 95 | this.putOnImages = new ArrayList<>(); | 100 | this.putOnImages = new ArrayList<>(); |
| 101 | + this.handleFlag = false; | ||
| 96 | } | 102 | } |
| 97 | 103 | ||
| 98 | } | 104 | } |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
| 1 | package com.trash.garbage.service.impl; | 1 | package com.trash.garbage.service.impl; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollectionUtil; | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| @@ -7,6 +8,8 @@ import com.github.pagehelper.PageHelper; | @@ -7,6 +8,8 @@ import com.github.pagehelper.PageHelper; | ||
| 7 | import com.github.pagehelper.PageInfo; | 8 | import com.github.pagehelper.PageInfo; |
| 8 | import com.trash.common.utils.SecurityUtils; | 9 | import com.trash.common.utils.SecurityUtils; |
| 9 | import com.trash.common.utils.bean.BeanUtils; | 10 | import com.trash.common.utils.bean.BeanUtils; |
| 11 | +import com.trash.driver.domain.vo.DriverVo; | ||
| 12 | +import com.trash.driver.service.IDriverService; | ||
| 10 | import com.trash.garbage.global.GlobalStatus; | 13 | import com.trash.garbage.global.GlobalStatus; |
| 11 | import com.trash.garbage.pojo.domain.GarOrder; | 14 | import com.trash.garbage.pojo.domain.GarOrder; |
| 12 | import com.trash.garbage.pojo.domain.GarOrderEvaluate; | 15 | import com.trash.garbage.pojo.domain.GarOrderEvaluate; |
| @@ -48,6 +51,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -48,6 +51,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 48 | @Autowired | 51 | @Autowired |
| 49 | private GarUserService garUserService; | 52 | private GarUserService garUserService; |
| 50 | 53 | ||
| 54 | + @Autowired | ||
| 55 | + private IDriverService driverService; | ||
| 56 | + | ||
| 51 | @Override | 57 | @Override |
| 52 | @Transactional(rollbackFor = Exception.class) | 58 | @Transactional(rollbackFor = Exception.class) |
| 53 | public String saveOrder(OrderDto dto) { | 59 | public String saveOrder(OrderDto dto) { |
| @@ -75,10 +81,18 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -75,10 +81,18 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 75 | @Override | 81 | @Override |
| 76 | public OrderDetailVo queryOrderDetail(String id) { | 82 | public OrderDetailVo queryOrderDetail(String id) { |
| 77 | GarOrder order = this.getById(id); | 83 | GarOrder order = this.getById(id); |
| 84 | + String tel = SecurityUtils.getLoginUser().getUser().getPhonenumber(); | ||
| 78 | LambdaQueryWrapper<GarOrderImage> qwi = new LambdaQueryWrapper<>(); | 85 | LambdaQueryWrapper<GarOrderImage> qwi = new LambdaQueryWrapper<>(); |
| 79 | qwi.eq(GarOrderImage::getGarOrderId, id); | 86 | qwi.eq(GarOrderImage::getGarOrderId, id); |
| 80 | OrderDetailVo vo = new OrderDetailVo(); | 87 | OrderDetailVo vo = new OrderDetailVo(); |
| 81 | BeanUtils.copyBeanProp(vo, order); | 88 | BeanUtils.copyBeanProp(vo, order); |
| 89 | + DriverVo driverVo = new DriverVo(); | ||
| 90 | + driverVo.setPhoneNo(tel); | ||
| 91 | + driverVo.setCompanyId(Long.valueOf(order.getGarOrderCompanyId())); | ||
| 92 | + List<DriverVo> driverVos = driverService.selectDriverList(driverVo); | ||
| 93 | + if (CollectionUtil.isNotEmpty(driverVos)){ | ||
| 94 | + vo.setHandleFlag(true); | ||
| 95 | + } | ||
| 82 | List<GarOrderImage> imageList = garOrderImageService.list(qwi); | 96 | List<GarOrderImage> imageList = garOrderImageService.list(qwi); |
| 83 | for (GarOrderImage image : imageList) { | 97 | for (GarOrderImage image : imageList) { |
| 84 | if (GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue().equals(image.getGarOrderImageType())) { | 98 | if (GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue().equals(image.getGarOrderImageType())) { |
| @@ -98,39 +112,60 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -98,39 +112,60 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 98 | public PageInfo queryOrderList(Integer type, Integer pageNo, Integer pageSize) { | 112 | public PageInfo queryOrderList(Integer type, Integer pageNo, Integer pageSize) { |
| 99 | String userId = SecurityUtils.getLoginUser().getUser().getUserId(); | 113 | String userId = SecurityUtils.getLoginUser().getUser().getUserId(); |
| 100 | GarUser user = garUserService.getById(userId); | 114 | GarUser user = garUserService.getById(userId); |
| 101 | - // TODO 区分用户类型 | ||
| 102 | - // 判断用户类型 普通用户 | ||
| 103 | - if (GlobalStatus.UserStatusEnum.NORMAL_USER.getDescription().equals(user.getGarUserType())) { | 115 | + DriverVo driver = new DriverVo(); |
| 116 | + driver.setPhoneNo(user.getGarUserTel()); | ||
| 117 | + List<DriverVo> driverList = driverService.selectDriverList(driver); | ||
| 118 | + LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>(); | ||
| 119 | + qw.orderByAsc(GarOrder::getGarEvaluateFlag, GarOrder::getGarOrderHandlerStatus); | ||
| 120 | + PageHelper.startPage(pageNo, pageSize); | ||
| 121 | + if (CollectionUtil.isEmpty(driverList)) { | ||
| 104 | // 待清运 || 清运中 || 已完成 || 待支付 | 122 | // 待清运 || 清运中 || 已完成 || 待支付 |
| 105 | if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type) | 123 | if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type) |
| 106 | || GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) | 124 | || GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) |
| 107 | - || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type) | ||
| 108 | - || GlobalStatus.GarOrderStatus.PAY_ORDER.getValue().equals(type)) { | ||
| 109 | - LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>(); | 125 | + || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { |
| 110 | qw.eq(GarOrder::getGarOrderUserId, userId) | 126 | qw.eq(GarOrder::getGarOrderUserId, userId) |
| 111 | - .eq(GarOrder::getGarOrderHandlerStatus, type) | ||
| 112 | - .orderByAsc(GarOrder::getGarEvaluateFlag); | ||
| 113 | - PageHelper.startPage(pageNo, pageSize); | 127 | + .eq(GarOrder::getGarOrderHandlerStatus, type); |
| 114 | List<GarOrder> orderList = list(qw); | 128 | List<GarOrder> orderList = list(qw); |
| 115 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | 129 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| 116 | return pageInfo; | 130 | return pageInfo; |
| 117 | } | 131 | } |
| 118 | // 全部 | 132 | // 全部 |
| 119 | if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) { | 133 | if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) { |
| 120 | - LambdaQueryWrapper<GarOrder> qw = new LambdaQueryWrapper<>(); | ||
| 121 | - qw.eq(GarOrder::getGarOrderUserId, userId) | ||
| 122 | - .orderByAsc(GarOrder::getGarEvaluateFlag, GarOrder::getGarOrderHandlerStatus); | ||
| 123 | - PageHelper.startPage(pageNo, pageSize); | 134 | + qw.eq(GarOrder::getGarOrderUserId, userId); |
| 124 | List<GarOrder> orderList = list(qw); | 135 | List<GarOrder> orderList = list(qw); |
| 125 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | 136 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| 126 | return pageInfo; | 137 | return pageInfo; |
| 127 | } | 138 | } |
| 128 | - | ||
| 129 | } else { | 139 | } else { |
| 130 | - // TODO | ||
| 131 | 140 | ||
| 132 | - } | 141 | + DriverVo driverVo = driverList.get(0); |
| 142 | + String companyId = String.valueOf(driverVo.getCompanyId()); | ||
| 143 | + if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type)) { | ||
| 144 | + qw.eq(GarOrder::getGarOrderCompanyId, companyId) | ||
| 145 | + .eq(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.NEW_ORDER.getValue()); | ||
| 146 | + List<GarOrder> orderList = list(qw); | ||
| 147 | + PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | ||
| 148 | + return pageInfo; | ||
| 149 | + } | ||
| 133 | 150 | ||
| 151 | + if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(type) | ||
| 152 | + || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { | ||
| 153 | + qw.eq(GarOrder::getGarOrderCompanyId, companyId) | ||
| 154 | + .eq(GarOrder::getGarOrderHandlerId, user.getGarUserId()) | ||
| 155 | + .eq(GarOrder::getGarOrderHandlerStatus, type); | ||
| 156 | + List<GarOrder> orderList = list(qw); | ||
| 157 | + PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | ||
| 158 | + return pageInfo; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + // 全部 | ||
| 162 | + if (GlobalStatus.GarOrderStatus.ALL_ORDER.getValue().equals(type)) { | ||
| 163 | + qw.eq(GarOrder::getGarOrderHandlerId, userId); | ||
| 164 | + List<GarOrder> orderList = list(qw); | ||
| 165 | + PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | ||
| 166 | + return pageInfo; | ||
| 167 | + } | ||
| 168 | + } | ||
| 134 | return null; | 169 | return null; |
| 135 | } | 170 | } |
| 136 | 171 | ||
| @@ -151,22 +186,12 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -151,22 +186,12 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 151 | } | 186 | } |
| 152 | // 运输员操作 清运中 ==》待支付 TODO | 187 | // 运输员操作 清运中 ==》待支付 TODO |
| 153 | if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(order.getGarOrderHandlerStatus()) | 188 | if (GlobalStatus.GarOrderStatus.ACTIVE_ORDER.getValue().equals(order.getGarOrderHandlerStatus()) |
| 154 | - && GlobalStatus.GarOrderStatus.PAY_ORDER.getValue().equals(dto.getHandleType())) { | ||
| 155 | - LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>(); | ||
| 156 | - uw.eq(GarOrder::getGarOrderId, dto.getGarOrderId()) | ||
| 157 | - .set(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.PAY_ORDER.getValue()); | ||
| 158 | - update(uw); | ||
| 159 | - } | ||
| 160 | - | ||
| 161 | - // 用户确认 待支付 ==》已完成 | ||
| 162 | - if (GlobalStatus.GarOrderStatus.PAY_ORDER.getValue().equals(order.getGarOrderHandlerStatus()) | ||
| 163 | && GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(dto.getHandleType())) { | 189 | && GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(dto.getHandleType())) { |
| 164 | LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>(); | 190 | LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>(); |
| 165 | uw.eq(GarOrder::getGarOrderId, dto.getGarOrderId()) | 191 | uw.eq(GarOrder::getGarOrderId, dto.getGarOrderId()) |
| 166 | .set(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue()) | 192 | .set(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue()) |
| 167 | .set(GarOrder::getGarEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_NO.getValue()); | 193 | .set(GarOrder::getGarEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_NO.getValue()); |
| 168 | update(uw); | 194 | update(uw); |
| 169 | - // 修改评价状态 | ||
| 170 | } | 195 | } |
| 171 | return ""; | 196 | return ""; |
| 172 | } | 197 | } |