From 4602ddaa6f8c408411aa6521b1f70ba3af629713 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 23 Jul 2021 09:54:36 +0800 Subject: [PATCH] 202107023 --- gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java index 9e0743d..0dba707 100644 --- a/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java +++ b/gc-order/src/main/java/com/xzx/gc/order/service/JhyOrderService.java @@ -63,7 +63,9 @@ public void addJhyOrder(AddJhyOrderDto orderDto) { JhyInfo jhyInfo = jhyInfoMapper.selectJhyInfoByUserId(orderDto.getUserId()); if (jhyInfo != null && JhyInfo.CHECK_PASS.equals(jhyInfo.getStatus())) { - throw new RestException(-3, "集货员不能下单"); + if (JhyInfo.IS_JHY_Y.equals(jhyInfo.getIsJhy())) { + throw new RestException(-3, "集货员不能下单"); + } } AddressInfo addressInfo = addressMapper.selectByPrimaryKey(orderDto.getAddressId()); @@ -150,9 +152,17 @@ throw new RestException(-3, "不是集货员"); } + if (JhyInfo.IS_JHY_N.equals(jhyInfo.getIsJhy())) { + throw new RestException(-3, "暂无法抢单"); + } + JhyOrder order = jhyOrderMapper.selectByPrimaryKey(orderId); if (order == null) { throw new RestException(-3, "订单不存在"); + } + + if (order.getUserId().equals(jhyInfo.getUserId())) { + throw new RestException(-3, "不能抢自己的单"); } order.setJhyId(userId); @@ -197,13 +207,11 @@ orderItems.setTitle(environmentalInfo.getTitle()); orderItems.setPrice(new BigDecimal(environmentalInfo.getPrice())); BigDecimal total = orderItems.getPrice().multiply(BigDecimal.valueOf(40)).multiply(weight); - log.info("======>{}, {}, {}", total, orderItems.getPrice(), weight); orderItems.setScore(total.setScale(0, BigDecimal.ROUND_DOWN).toString()); orderItems.setWeight(weight); jhyOrderItemsMapper.insert(orderItems); totalScore = totalScore.add(total); - log.info("=====>>>{}", totalScore); } JhyOrder order = jhyOrderMapper.selectByPrimaryKey(confirmDto.getOrderId()); -- Gitblit v1.9.1