Commit 0f2f6a018a87b1aec14c380c3dc7ec30a439aa3e
1 parent
4ea8b8de
feat: 超时取消订单,确认趟次重置验证码
Showing
11 changed files
with
165 additions
and
11 deletions
trash-admin/src/main/java/com/trash/Application.java
| @@ -3,6 +3,7 @@ package com.trash; | @@ -3,6 +3,7 @@ package com.trash; | ||
| 3 | import org.springframework.boot.SpringApplication; | 3 | import org.springframework.boot.SpringApplication; |
| 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | 5 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 6 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| 8 | * 启动程序 | 9 | * 启动程序 |
| @@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | @@ -10,6 +11,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ||
| 10 | * @author trash | 11 | * @author trash |
| 11 | */ | 12 | */ |
| 12 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) | 13 | @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) |
| 14 | +@EnableScheduling | ||
| 13 | public class Application | 15 | public class Application |
| 14 | { | 16 | { |
| 15 | public static void main(String[] args) | 17 | public static void main(String[] args) |
trash-common/src/main/java/com/trash/common/core/redis/RedisCache.java
| @@ -93,6 +93,10 @@ public class RedisCache | @@ -93,6 +93,10 @@ public class RedisCache | ||
| 93 | { | 93 | { |
| 94 | return redisTemplate.delete(key); | 94 | return redisTemplate.delete(key); |
| 95 | } | 95 | } |
| 96 | + public boolean deleteObject(final String key,final String hashKey) | ||
| 97 | + { | ||
| 98 | + return redisTemplate.opsForHash().delete(key,hashKey) != 0L; | ||
| 99 | + } | ||
| 96 | 100 | ||
| 97 | /** | 101 | /** |
| 98 | * 删除集合对象 | 102 | * 删除集合对象 |
trash-garbage/src/main/java/com/trash/garbage/global/GlobalStatus.java
| @@ -14,6 +14,10 @@ public class GlobalStatus { | @@ -14,6 +14,10 @@ public class GlobalStatus { | ||
| 14 | * 已注销 | 14 | * 已注销 |
| 15 | */ | 15 | */ |
| 16 | public static final int DEL_FLAG_YES = 1; | 16 | public static final int DEL_FLAG_YES = 1; |
| 17 | + /** 订单超时 */ | ||
| 18 | + public static final boolean ORDER_TIME_OUT_FLAG_YES = true; | ||
| 19 | + /** 订单未超时 */ | ||
| 20 | + public static final boolean ORDER_TIME_OUT_FLAG_NO = false; | ||
| 17 | 21 | ||
| 18 | /** | 22 | /** |
| 19 | * 地址查询类型 当前地址 | 23 | * 地址查询类型 当前地址 |
| @@ -88,6 +92,8 @@ public class GlobalStatus { | @@ -88,6 +92,8 @@ public class GlobalStatus { | ||
| 88 | * 订单 | 92 | * 订单 |
| 89 | */ | 93 | */ |
| 90 | public enum GarOrderStatus { | 94 | public enum GarOrderStatus { |
| 95 | + ORDER_TIME_OUT_FLAG_YES(1,"已超时"), | ||
| 96 | + ORDER_TIME_OUT_FLAG_NO(0,"未超时"), | ||
| 91 | NEW_ORDER(0, "新订单"), | 97 | NEW_ORDER(0, "新订单"), |
| 92 | ACTIVE_ORDER(1, "处理中"), | 98 | ACTIVE_ORDER(1, "处理中"), |
| 93 | ALL_ORDER(2, "全部订单"), | 99 | ALL_ORDER(2, "全部订单"), |
trash-garbage/src/main/java/com/trash/garbage/interceptor/MyMetaObjectHandler.java
| @@ -23,13 +23,21 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | @@ -23,13 +23,21 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | ||
| 23 | this.strictInsertFill(metaObject, "garCreateTime", Date.class, new Date()); | 23 | this.strictInsertFill(metaObject, "garCreateTime", Date.class, new Date()); |
| 24 | } | 24 | } |
| 25 | if (metaObject.hasGetter("garCreateBy")) { | 25 | if (metaObject.hasGetter("garCreateBy")) { |
| 26 | - this.strictInsertFill(metaObject, "garCreateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | 26 | + try { |
| 27 | + this.strictInsertFill(metaObject, "garCreateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | ||
| 28 | + }catch (Exception e) { | ||
| 29 | + log.info("当前操作定时任务"); | ||
| 30 | + } | ||
| 27 | } | 31 | } |
| 28 | if (metaObject.hasGetter("garUpdateTime")) { | 32 | if (metaObject.hasGetter("garUpdateTime")) { |
| 29 | this.strictInsertFill(metaObject, "garUpdateTime", Date.class, new Date()); | 33 | this.strictInsertFill(metaObject, "garUpdateTime", Date.class, new Date()); |
| 30 | } | 34 | } |
| 31 | if (metaObject.hasGetter("garUpdateBy")) { | 35 | if (metaObject.hasGetter("garUpdateBy")) { |
| 32 | - this.strictInsertFill(metaObject, "garUpdateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | 36 | + try { |
| 37 | + this.strictInsertFill(metaObject, "garUpdateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | ||
| 38 | + }catch (Exception e) { | ||
| 39 | + log.info("当前操作定时任务"); | ||
| 40 | + } | ||
| 33 | } | 41 | } |
| 34 | } | 42 | } |
| 35 | 43 | ||
| @@ -39,7 +47,11 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | @@ -39,7 +47,11 @@ public class MyMetaObjectHandler implements MetaObjectHandler { | ||
| 39 | this.strictUpdateFill(metaObject, "garUpdateTime", Date.class, new Date()); | 47 | this.strictUpdateFill(metaObject, "garUpdateTime", Date.class, new Date()); |
| 40 | } | 48 | } |
| 41 | if (metaObject.hasGetter("garUpdateBy")) { | 49 | if (metaObject.hasGetter("garUpdateBy")) { |
| 42 | - this.strictUpdateFill(metaObject, "garUpdateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | 50 | + try { |
| 51 | + this.strictUpdateFill(metaObject, "garUpdateBy", String.class, SecurityUtils.getLoginUser().getUser().getUserId()); | ||
| 52 | + }catch (Exception e) { | ||
| 53 | + log.info("当前操作定时任务"); | ||
| 54 | + } | ||
| 43 | } | 55 | } |
| 44 | } | 56 | } |
| 45 | } | 57 | } |
| 46 | \ No newline at end of file | 58 | \ No newline at end of file |
trash-garbage/src/main/java/com/trash/garbage/job/OrderJob.java
0 → 100644
| 1 | +package com.trash.garbage.job; | ||
| 2 | + | ||
| 3 | +import com.trash.common.utils.DateUtils; | ||
| 4 | +import com.trash.garbage.global.GlobalStatus; | ||
| 5 | +import com.trash.garbage.pojo.domain.GarOrder; | ||
| 6 | +import com.trash.garbage.pojo.domain.GarUserOrderMessage; | ||
| 7 | +import com.trash.garbage.service.GarOrderService; | ||
| 8 | +import com.trash.garbage.service.GarUserOrderMessageService; | ||
| 9 | +import com.trash.garbage.utils.SMSUtils; | ||
| 10 | +import org.slf4j.Logger; | ||
| 11 | +import org.slf4j.LoggerFactory; | ||
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 13 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 14 | +import org.springframework.stereotype.Component; | ||
| 15 | + | ||
| 16 | +import javax.annotation.Resource; | ||
| 17 | +import java.util.ArrayList; | ||
| 18 | +import java.util.Date; | ||
| 19 | +import java.util.List; | ||
| 20 | +import java.util.stream.Collectors; | ||
| 21 | + | ||
| 22 | +@Component | ||
| 23 | +public class OrderJob { | ||
| 24 | + | ||
| 25 | + Logger log = LoggerFactory.getLogger(OrderJob.class); | ||
| 26 | + @Resource | ||
| 27 | + private SMSUtils smsUtils; | ||
| 28 | + | ||
| 29 | + @Autowired | ||
| 30 | + private GarOrderService garOrderService; | ||
| 31 | + @Autowired | ||
| 32 | + private GarUserOrderMessageService orderMessageService; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 超时订单直接完成 | ||
| 37 | + */ | ||
| 38 | + @Scheduled(cron = "0 0/1 * * * ?") | ||
| 39 | + public void computedOrderIsTimeOut() { | ||
| 40 | + // 每3分钟遍历一次订单 超时未处理得修改订单状态为完成,并设置订单超时 | ||
| 41 | + // 查询依据是 新订单,未超时,未取消 | ||
| 42 | + List<GarOrder> list = garOrderService.queryUnprocessedOrder(GlobalStatus.GarOrderStatus.NEW_ORDER.getValue(), GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue(), GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue()); | ||
| 43 | + List<GarOrder> timeOutList = new ArrayList<>(); | ||
| 44 | + Date now = new Date(); | ||
| 45 | + for (GarOrder order : list) { | ||
| 46 | + String agreementTime = order.getGarOrderAgreementTime(); | ||
| 47 | + // 2024-05-22 10:00-11:00 | ||
| 48 | + String[] dateSplit = agreementTime.split(" "); | ||
| 49 | + String dateStr = dateSplit[0] + " " + dateSplit[1].split("-")[0] + ":00"; | ||
| 50 | + Date date = DateUtils.dateTime("yyyy-MM-dd HH:mm:ss", dateStr); | ||
| 51 | + if (date.compareTo(now) < 0) { | ||
| 52 | + timeOutList.add(order); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + log.info("检索订单超时完毕,当前共:{}个订单超时", timeOutList.size()); | ||
| 56 | + garOrderService.updateTimeOutOrderStatus(timeOutList); | ||
| 57 | + // 发送消息 | ||
| 58 | + List<String> tels = timeOutList.stream().map(GarOrder::getGarOrderContactTel).collect(Collectors.toList()); | ||
| 59 | + smsUtils.sendMessage(tels, "订单超时,已取消,请及时登录处理。"); | ||
| 60 | + userOrderMessageSend(timeOutList, "订单超时,已取消。"); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private void userOrderMessageSend(List<GarOrder> orderList, String message) { | ||
| 64 | + for (GarOrder order : orderList) { | ||
| 65 | + GarUserOrderMessage guom = new GarUserOrderMessage(); | ||
| 66 | + guom.setGarMessageState(GlobalStatus.GarUserStatusEnum.ORDER_MESSAGE_UNREAD.getStatus()); | ||
| 67 | + guom.setGarContent(message); | ||
| 68 | + guom.setGarUserId(order.getGarCreateBy()); | ||
| 69 | + guom.setGarUserTel(order.getGarOrderContactTel()); | ||
| 70 | + orderMessageService.save(guom); | ||
| 71 | + } | ||
| 72 | + } | ||
| 73 | +} |
trash-garbage/src/main/java/com/trash/garbage/mapper/GarOrderMapper.java
| @@ -30,6 +30,9 @@ public interface GarOrderMapper extends BaseMapper<GarOrder> { | @@ -30,6 +30,9 @@ public interface GarOrderMapper extends BaseMapper<GarOrder> { | ||
| 30 | 30 | ||
| 31 | OrderDetailTransportVo queryOrderTransportDetail(@Param("orderId") String id); | 31 | OrderDetailTransportVo queryOrderTransportDetail(@Param("orderId") String id); |
| 32 | 32 | ||
| 33 | + List<GarOrder> queryUnprocessedOrder(@Param("orderType")Integer orderType,@Param("timeOutFlag")Integer timeOutFlag,@Param("cancelFlag")Integer cancelFlag); | ||
| 34 | + | ||
| 35 | + void updateTimeOutOrderStatus(@Param("list") List<GarOrder> timeOutList, @Param("status")Integer status,@Param("timeOutFlag") Integer timeOutFlag); | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | 38 |
trash-garbage/src/main/java/com/trash/garbage/pojo/domain/GarOrder.java
| @@ -165,6 +165,8 @@ public class GarOrder implements Serializable { | @@ -165,6 +165,8 @@ public class GarOrder implements Serializable { | ||
| 165 | */ | 165 | */ |
| 166 | private String garReason; | 166 | private String garReason; |
| 167 | 167 | ||
| 168 | + private Integer garTimeOutFlag; | ||
| 169 | + | ||
| 168 | 170 | ||
| 169 | @TableField(exist = false) | 171 | @TableField(exist = false) |
| 170 | private static final long serialVersionUID = 1L; | 172 | private static final long serialVersionUID = 1L; |
| @@ -440,4 +442,12 @@ public class GarOrder implements Serializable { | @@ -440,4 +442,12 @@ public class GarOrder implements Serializable { | ||
| 440 | public void setGarInCarStore(Boolean garInCarStore) { | 442 | public void setGarInCarStore(Boolean garInCarStore) { |
| 441 | this.garInCarStore = garInCarStore; | 443 | this.garInCarStore = garInCarStore; |
| 442 | } | 444 | } |
| 445 | + | ||
| 446 | + public Integer getGarTimeOutFlag() { | ||
| 447 | + return garTimeOutFlag; | ||
| 448 | + } | ||
| 449 | + | ||
| 450 | + public void setGarTimeOutFlag(Integer garTimeOutFlag) { | ||
| 451 | + this.garTimeOutFlag = garTimeOutFlag; | ||
| 452 | + } | ||
| 443 | } | 453 | } |
| 444 | \ No newline at end of file | 454 | \ No newline at end of file |
trash-garbage/src/main/java/com/trash/garbage/pojo/vo/OrderDetailVo.java
| @@ -106,6 +106,8 @@ public class OrderDetailVo { | @@ -106,6 +106,8 @@ public class OrderDetailVo { | ||
| 106 | */ | 106 | */ |
| 107 | private String garOrderContactTel; | 107 | private String garOrderContactTel; |
| 108 | 108 | ||
| 109 | + private Integer garTimeOutFlag; | ||
| 110 | + | ||
| 109 | /** | 111 | /** |
| 110 | * 承接经营单位 | 112 | * 承接经营单位 |
| 111 | */ | 113 | */ |
| @@ -401,4 +403,12 @@ public class OrderDetailVo { | @@ -401,4 +403,12 @@ public class OrderDetailVo { | ||
| 401 | public void setGarOrderScanHandlerFlag(Integer garOrderScanHandlerFlag) { | 403 | public void setGarOrderScanHandlerFlag(Integer garOrderScanHandlerFlag) { |
| 402 | this.garOrderScanHandlerFlag = garOrderScanHandlerFlag; | 404 | this.garOrderScanHandlerFlag = garOrderScanHandlerFlag; |
| 403 | } | 405 | } |
| 406 | + | ||
| 407 | + public Integer getGarTimeOutFlag() { | ||
| 408 | + return garTimeOutFlag; | ||
| 409 | + } | ||
| 410 | + | ||
| 411 | + public void setGarTimeOutFlag(Integer garTimeOutFlag) { | ||
| 412 | + this.garTimeOutFlag = garTimeOutFlag; | ||
| 413 | + } | ||
| 404 | } | 414 | } |
trash-garbage/src/main/java/com/trash/garbage/service/GarOrderService.java
| @@ -95,4 +95,8 @@ public interface GarOrderService extends IService<GarOrder> { | @@ -95,4 +95,8 @@ public interface GarOrderService extends IService<GarOrder> { | ||
| 95 | String readMessage(List<String> messageIds); | 95 | String readMessage(List<String> messageIds); |
| 96 | 96 | ||
| 97 | Integer queryOrderMessageCount(); | 97 | Integer queryOrderMessageCount(); |
| 98 | + | ||
| 99 | + List<GarOrder> queryUnprocessedOrder(Integer value, Integer orderTimeOutFlagNo, Integer value1); | ||
| 100 | + | ||
| 101 | + void updateTimeOutOrderStatus(List<GarOrder> timeOutList); | ||
| 98 | } | 102 | } |
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarOrderServiceImpl.java
| @@ -89,6 +89,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -89,6 +89,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 89 | order.setGarOrderScanHandlerFlag(GlobalStatus.GarOrderStatus.SCAN_HANDLER_NO.getValue()); | 89 | order.setGarOrderScanHandlerFlag(GlobalStatus.GarOrderStatus.SCAN_HANDLER_NO.getValue()); |
| 90 | // 预估车辆等于用户选择得车辆 | 90 | // 预估车辆等于用户选择得车辆 |
| 91 | order.setGarRealCarCount(dto.getGarCarInfoList().stream().mapToInt(OrderDto.CarInfo::getGarOrderCarNumber).sum()); | 91 | order.setGarRealCarCount(dto.getGarCarInfoList().stream().mapToInt(OrderDto.CarInfo::getGarOrderCarNumber).sum()); |
| 92 | + order.setGarTimeOutFlag(GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_NO.getValue()); | ||
| 92 | save(order); | 93 | save(order); |
| 93 | 94 | ||
| 94 | // 保存车辆信息 | 95 | // 保存车辆信息 |
| @@ -215,7 +216,8 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -215,7 +216,8 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 215 | || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { | 216 | || GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue().equals(type)) { |
| 216 | qw.eq(GarOrder::getGarOrderUserId, userId) | 217 | qw.eq(GarOrder::getGarOrderUserId, userId) |
| 217 | .eq(GarOrder::getGarCancelFlag, GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue()) | 218 | .eq(GarOrder::getGarCancelFlag, GlobalStatus.GarOrderStatus.CANCEL_FLAG_NO.getValue()) |
| 218 | - .eq(GarOrder::getGarOrderHandlerStatus, type); | 219 | + .eq(GarOrder::getGarOrderHandlerStatus, type) |
| 220 | + .orderByDesc(GarOrder::getGarCreateTime); | ||
| 219 | List<GarOrder> orderList = list(qw); | 221 | List<GarOrder> orderList = list(qw); |
| 220 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); | 222 | PageInfo<GarOrder> pageInfo = new PageInfo<GarOrder>(orderList, pageSize); |
| 221 | return pageInfo; | 223 | return pageInfo; |
| @@ -305,7 +307,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -305,7 +307,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 305 | // 完成订单 | 307 | // 完成订单 |
| 306 | GarOrder order = getById(dto.getGarOrderId()); | 308 | GarOrder order = getById(dto.getGarOrderId()); |
| 307 | // TODO 发送短信 通知企业和用户 修改订单状态为完成 disposal 和 handler表的状态一起修改 | 309 | // TODO 发送短信 通知企业和用户 修改订单状态为完成 disposal 和 handler表的状态一起修改 |
| 308 | - String message = "您的清运订单已完成,可前往小程序进行评价,感谢您的使用"; | 310 | + String message = "您的清运订单已完成,可前往小程序进行评价,感谢您的使用。"; |
| 309 | smsUtils.sendMessage(order.getGarOrderContactTel(), message); | 311 | smsUtils.sendMessage(order.getGarOrderContactTel(), message); |
| 310 | smsUtils.sendMessage(order.getGarOrderCompanyTel(), "您的清运订单已完成,详情可在小程序查看。"); | 312 | smsUtils.sendMessage(order.getGarOrderCompanyTel(), "您的清运订单已完成,详情可在小程序查看。"); |
| 311 | successOrder(order); | 313 | successOrder(order); |
| @@ -590,6 +592,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -590,6 +592,7 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 590 | } | 592 | } |
| 591 | 593 | ||
| 592 | List<Long> enterpriseIds = list.stream().map(TransportationEnterprise::getId).collect(Collectors.toList()); | 594 | List<Long> enterpriseIds = list.stream().map(TransportationEnterprise::getId).collect(Collectors.toList()); |
| 595 | + // 企业id为空说明没有公司 | ||
| 593 | List<GarOrder> orderList = baseMapper.queryCleanNumberByEnterpriseIds(enterpriseIds, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue()); | 596 | List<GarOrder> orderList = baseMapper.queryCleanNumberByEnterpriseIds(enterpriseIds, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue()); |
| 594 | List<GarOrderEvaluate> evaluateList = garOrderEvaluateService.queryEvaluateByEnterpriseIds(enterpriseIds, GlobalStatus.GarOrderStatus.EVALUATE_TYPE_COMPANY.getValue()); | 597 | List<GarOrderEvaluate> evaluateList = garOrderEvaluateService.queryEvaluateByEnterpriseIds(enterpriseIds, GlobalStatus.GarOrderStatus.EVALUATE_TYPE_COMPANY.getValue()); |
| 595 | Map<String, List<GarOrderEvaluate>> evaluateMap = new HashMap<>(); | 598 | Map<String, List<GarOrderEvaluate>> evaluateMap = new HashMap<>(); |
| @@ -833,9 +836,10 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -833,9 +836,10 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 833 | imageList.add(image); | 836 | imageList.add(image); |
| 834 | } | 837 | } |
| 835 | garOrderImageService.saveBatch(imageList); | 838 | garOrderImageService.saveBatch(imageList); |
| 839 | + // TODO 删除验证码 | ||
| 840 | + redisCache.deleteObject(orderId, dto.getGarOrderHandlerId()); | ||
| 836 | return "当前趟次记录成功"; | 841 | return "当前趟次记录成功"; |
| 837 | } | 842 | } |
| 838 | - | ||
| 839 | throw new BizException(ResultCode.CODE_400, "当前记录无效,已完成所有趟次!"); | 843 | throw new BizException(ResultCode.CODE_400, "当前记录无效,已完成所有趟次!"); |
| 840 | } | 844 | } |
| 841 | 845 | ||
| @@ -950,6 +954,18 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | @@ -950,6 +954,18 @@ public class GarOrderServiceImpl extends ServiceImpl<GarOrderMapper, GarOrder> | ||
| 950 | return count; | 954 | return count; |
| 951 | } | 955 | } |
| 952 | 956 | ||
| 957 | + @Override | ||
| 958 | + public List<GarOrder> queryUnprocessedOrder(Integer value, Integer orderTimeOutFlag, Integer value1) { | ||
| 959 | + return baseMapper.queryUnprocessedOrder(value, orderTimeOutFlag, value1); | ||
| 960 | + } | ||
| 961 | + | ||
| 962 | + @Override | ||
| 963 | + public void updateTimeOutOrderStatus(List<GarOrder> timeOutList) { | ||
| 964 | + if (CollectionUtil.isNotEmpty(timeOutList)) { | ||
| 965 | + baseMapper.updateTimeOutOrderStatus(timeOutList, GlobalStatus.GarOrderStatus.SUCCESS_ORDER.getValue(), GlobalStatus.GarOrderStatus.ORDER_TIME_OUT_FLAG_YES.getValue()); | ||
| 966 | + } | ||
| 967 | + } | ||
| 968 | + | ||
| 953 | private void handleCleanNumber(TransportationEnterpriseVo vo, List<GarOrder> orderList) { | 969 | private void handleCleanNumber(TransportationEnterpriseVo vo, List<GarOrder> orderList) { |
| 954 | Long cleanNumber = 0L; | 970 | Long cleanNumber = 0L; |
| 955 | for (GarOrder order : orderList) { | 971 | for (GarOrder order : orderList) { |
trash-garbage/src/main/resources/mapper/GarOrderMapper.xml
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | <id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/> | 8 | <id property="garOrderId" column="gar_order_id" jdbcType="VARCHAR"/> |
| 9 | <result property="garOrderUserId" column="gar_order_user_id" jdbcType="VARCHAR"/> | 9 | <result property="garOrderUserId" column="gar_order_user_id" jdbcType="VARCHAR"/> |
| 10 | <result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/> | 10 | <result property="garOrderAddress" column="gar_order_address" jdbcType="VARCHAR"/> |
| 11 | + <result property="garTimeOutFlag" column="gar_time_out_flag" jdbcType="TINYINT"/> | ||
| 11 | <result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/> | 12 | <result property="garOrderAddressDetails" column="gar_order_address_details" jdbcType="VARCHAR"/> |
| 12 | <result property="garOrderContactName" column="gar_order_contact_name" jdbcType="VARCHAR"/> | 13 | <result property="garOrderContactName" column="gar_order_contact_name" jdbcType="VARCHAR"/> |
| 13 | <result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/> | 14 | <result property="garOrderTrashType" column="gar_order_trash_type" jdbcType="VARCHAR"/> |
| @@ -64,24 +65,30 @@ | @@ -64,24 +65,30 @@ | ||
| 64 | gar_order_address,gar_order_address_details,gar_order_contact_name, | 65 | gar_order_address,gar_order_address_details,gar_order_contact_name, |
| 65 | gar_order_trash_type,gar_order_contact_tel,gar_order_company_id, | 66 | gar_order_trash_type,gar_order_contact_tel,gar_order_company_id, |
| 66 | gar_order_company_name,gar_order_company_tel,gar_order_handler_status, | 67 | gar_order_company_name,gar_order_company_tel,gar_order_handler_status, |
| 67 | - gar_order_agreement_time,gar_create_time,gar_update_time, | 68 | + gar_order_agreement_time,gar_create_time,gar_update_time,gar_time_out_flag, |
| 68 | gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag, | 69 | gar_create_by,gar_update_by,gar_remark,gar_reason,gar_cancel_flag, |
| 69 | gar_evaluate_flag,gar_handler_evaluate_flag,gar_order_scan_handler_flag,gar_coordinate,gar_longitude,gar_latitude,gar_real_car_count | 70 | gar_evaluate_flag,gar_handler_evaluate_flag,gar_order_scan_handler_flag,gar_coordinate,gar_longitude,gar_latitude,gar_real_car_count |
| 70 | </sql> | 71 | </sql> |
| 72 | + <update id="updateTimeOutOrderStatus"> | ||
| 73 | + update gar_order set gar_order_handler_status = #{status},gar_time_out_flag = #{timeOutFlag} | ||
| 74 | + where gar_order_id in | ||
| 75 | + <foreach collection="list" item="item" open="(" separator="," close=")"> | ||
| 76 | + #{item.garOrderId} | ||
| 77 | + </foreach> | ||
| 78 | + </update> | ||
| 71 | <select id="queryCleanNumberByEnterpriseIds" resultType="com.trash.garbage.pojo.domain.GarOrder"> | 79 | <select id="queryCleanNumberByEnterpriseIds" resultType="com.trash.garbage.pojo.domain.GarOrder"> |
| 80 | + | ||
| 81 | + <if test="list != null and list.size() > 0"> | ||
| 72 | select gar_order_company_id, count(gar_order_company_id) as count | 82 | select gar_order_company_id, count(gar_order_company_id) as count |
| 73 | from gar_order | 83 | from gar_order |
| 74 | where gar_order_handler_status = #{status} | 84 | where gar_order_handler_status = #{status} |
| 75 | - <if test="list != null and list.size() > 0"> | ||
| 76 | and gar_order_company_id in | 85 | and gar_order_company_id in |
| 77 | <foreach collection="list" item="item" open="(" separator="," close=")"> | 86 | <foreach collection="list" item="item" open="(" separator="," close=")"> |
| 78 | #{item} | 87 | #{item} |
| 79 | </foreach> | 88 | </foreach> |
| 80 | group by gar_order_company_id | 89 | group by gar_order_company_id |
| 81 | </if> | 90 | </if> |
| 82 | - <if test="list == null or list.size() == 0"> | ||
| 83 | - and 1 = 0 | ||
| 84 | - </if> | 91 | + |
| 85 | </select> | 92 | </select> |
| 86 | <select id="queryDriverOrderListByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo"> | 93 | <select id="queryDriverOrderListByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo"> |
| 87 | SELECT | 94 | SELECT |
| @@ -103,6 +110,7 @@ | @@ -103,6 +110,7 @@ | ||
| 103 | AND `handler`.gar_cancel_flag = #{cancelFlag} | 110 | AND `handler`.gar_cancel_flag = #{cancelFlag} |
| 104 | </if> | 111 | </if> |
| 105 | </where> | 112 | </where> |
| 113 | + order by desc `order`.gar_order_agreement_time | ||
| 106 | </select> | 114 | </select> |
| 107 | <select id="queryOrderByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo"> | 115 | <select id="queryOrderByTelWithType" resultType="com.trash.garbage.pojo.vo.GarOrderDriverVo"> |
| 108 | SELECT | 116 | SELECT |
| @@ -159,6 +167,7 @@ | @@ -159,6 +167,7 @@ | ||
| 159 | AND `disposal`.gar_order_disposal_status = #{type} | 167 | AND `disposal`.gar_order_disposal_status = #{type} |
| 160 | </if> | 168 | </if> |
| 161 | </where> | 169 | </where> |
| 170 | + order by desc `order`.gar_order_agreement_time | ||
| 162 | </select> | 171 | </select> |
| 163 | <select id="queryDriverDetailByTelWithOrderId" resultType="com.trash.garbage.pojo.vo.ScanDriverDetailVo"> | 172 | <select id="queryDriverDetailByTelWithOrderId" resultType="com.trash.garbage.pojo.vo.ScanDriverDetailVo"> |
| 164 | SELECT | 173 | SELECT |
| @@ -207,4 +216,9 @@ | @@ -207,4 +216,9 @@ | ||
| 207 | LEFT JOIN gar_order_match_ask `ask` ON `ask`.gar_order_id = `order`.gar_order_id | 216 | LEFT JOIN gar_order_match_ask `ask` ON `ask`.gar_order_id = `order`.gar_order_id |
| 208 | WHERE `order`.gar_order_id = #{orderId} | 217 | WHERE `order`.gar_order_id = #{orderId} |
| 209 | </select> | 218 | </select> |
| 219 | + <select id="queryUnprocessedOrder" resultType="com.trash.garbage.pojo.domain.GarOrder"> | ||
| 220 | + select * | ||
| 221 | + from gar_order | ||
| 222 | + where gar_order.gar_order_handler_status = #{orderType} and gar_order.gar_time_out_flag = #{timeOutFlag} and gar_order.gar_cancel_flag = #{cancelFlag} | ||
| 223 | + </select> | ||
| 210 | </mapper> | 224 | </mapper> |