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 | 46 | <artifactId>hutool-all</artifactId> |
| 47 | 47 | <version>5.3.8</version> |
| 48 | 48 | </dependency> |
| 49 | + <dependency> | |
| 50 | + <groupId>com.trash</groupId> | |
| 51 | + <artifactId>trash-unit</artifactId> | |
| 52 | + </dependency> | |
| 49 | 53 | </dependencies> |
| 50 | 54 | <!-- 项目打包时会将java目录中的*.xml文件也进行打包 --> |
| 51 | 55 | <build> | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/global/GlobalStatus.java
| ... | ... | @@ -87,8 +87,7 @@ public class GlobalStatus { |
| 87 | 87 | NEW_ORDER(0, "新订单"), |
| 88 | 88 | ACTIVE_ORDER(1, "处理中"), |
| 89 | 89 | ALL_ORDER(2, "全部订单"), |
| 90 | - PAY_ORDER(3, "待支付订单"), | |
| 91 | - SUCCESS_ORDER(4, "完成订单"), | |
| 90 | + SUCCESS_ORDER(3, "待支付订单"), | |
| 92 | 91 | FAIL_ORDER(9, "订单处理失败"), |
| 93 | 92 | CANCEL_FLAG_NO(0, "未取消订单"), |
| 94 | 93 | IMAGE_TYPE_CURRENT(0, "现场图片"), | ... | ... |
trash-garbage/src/main/java/com/trash/garbage/pojo/dto/EvaluateDto.java
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/OrderDetailVo.java
| ... | ... | @@ -89,10 +89,16 @@ public class OrderDetailVo { |
| 89 | 89 | */ |
| 90 | 90 | private String garRemark; |
| 91 | 91 | |
| 92 | + /** | |
| 93 | + * 允许处理标识 | |
| 94 | + */ | |
| 95 | + private Boolean handleFlag; | |
| 96 | + | |
| 92 | 97 | public OrderDetailVo(){ |
| 93 | 98 | this.currentImages = new ArrayList<>(); |
| 94 | 99 | this.putDownImages = new ArrayList<>(); |
| 95 | 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 | 1 | package com.trash.garbage.service.impl; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollectionUtil; | |
| 3 | 4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 4 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| 5 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| ... | ... | @@ -7,6 +8,8 @@ import com.github.pagehelper.PageHelper; |
| 7 | 8 | import com.github.pagehelper.PageInfo; |
| 8 | 9 | import com.trash.common.utils.SecurityUtils; |
| 9 | 10 | import com.trash.common.utils.bean.BeanUtils; |
| 11 | +import com.trash.driver.domain.vo.DriverVo; | |
| 12 | +import com.trash.driver.service.IDriverService; | |
| 10 | 13 | import com.trash.garbage.global.GlobalStatus; |
| 11 | 14 | import com.trash.garbage.pojo.domain.GarOrder; |
| 12 | 15 | import com.trash.garbage.pojo.domain.GarOrderEvaluate; |
| ... | ... | @@ -48,6 +51,9 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 48 | 51 | @Autowired |
| 49 | 52 | private GarUserService garUserService; |
| 50 | 53 | |
| 54 | + @Autowired | |
| 55 | + private IDriverService driverService; | |
| 56 | + | |
| 51 | 57 | @Override |
| 52 | 58 | @Transactional(rollbackFor = Exception.class) |
| 53 | 59 | public String saveOrder(OrderDto dto) { |
| ... | ... | @@ -75,10 +81,18 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 75 | 81 | @Override |
| 76 | 82 | public OrderDetailVo queryOrderDetail(String id) { |
| 77 | 83 | GarOrder order = this.getById(id); |
| 84 | + String tel = SecurityUtils.getLoginUser().getUser().getPhonenumber(); | |
| 78 | 85 | LambdaQueryWrapper<GarOrderImage> qwi = new LambdaQueryWrapper<>(); |
| 79 | 86 | qwi.eq(GarOrderImage::getGarOrderId, id); |
| 80 | 87 | OrderDetailVo vo = new OrderDetailVo(); |
| 81 | 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 | 96 | List<GarOrderImage> imageList = garOrderImageService.list(qwi); |
| 83 | 97 | for (GarOrderImage image : imageList) { |
| 84 | 98 | if (GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue().equals(image.getGarOrderImageType())) { |
| ... | ... | @@ -98,39 +112,60 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 98 | 112 | public PageInfo queryOrderList(Integer type, Integer pageNo, Integer pageSize) { |
| 99 | 113 | String userId = SecurityUtils.getLoginUser().getUser().getUserId(); |
| 100 | 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 | 123 | if (GlobalStatus.GarOrderStatus.NEW_ORDER.getValue().equals(type) |
| 106 | 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 | 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 | 128 | List<GarOrder> orderList = list(qw); |
| 115 | 129 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| 116 | 130 | return pageInfo; |
| 117 | 131 | } |
| 118 | 132 | // 全部 |
| 119 | 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 | 135 | List<GarOrder> orderList = list(qw); |
| 125 | 136 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| 126 | 137 | return pageInfo; |
| 127 | 138 | } |
| 128 | - | |
| 129 | 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 | 169 | return null; |
| 135 | 170 | } |
| 136 | 171 | |
| ... | ... | @@ -151,22 +186,12 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> |
| 151 | 186 | } |
| 152 | 187 | // 运输员操作 清运中 ==》待支付 TODO |
| 153 | 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 | 189 | && GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(dto.getHandleType())) { |
| 164 | 190 | LambdaUpdateWrapper<GarOrder> uw = new LambdaUpdateWrapper<>(); |
| 165 | 191 | uw.eq(GarOrder::getGarOrderId, dto.getGarOrderId()) |
| 166 | 192 | .set(GarOrder::getGarOrderHandlerStatus, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue()) |
| 167 | 193 | .set(GarOrder::getGarEvaluateFlag, GlobalStatus.GarOrderStatus.EVALUATE_ORDER_NO.getValue()); |
| 168 | 194 | update(uw); |
| 169 | - // 修改评价状态 | |
| 170 | 195 | } |
| 171 | 196 | return ""; |
| 172 | 197 | } | ... | ... |