diff --git a/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/controller/RouteController.java b/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/controller/RouteController.java index 7b7ac10a..6d114486 100644 --- a/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/controller/RouteController.java +++ b/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/controller/RouteController.java @@ -51,6 +51,15 @@ public class RouteController { routeService.deleteById(inputObject, outputObject); } + @ApiOperation(id = "queryRouteById", value = "根据id查询路线信息", method = "GET", allUse = "2") + @ApiImplicitParams({ + @ApiImplicitParam(id = "id", name = "id", value = "路线id", required = "required") + }) + @RequestMapping("/post/RouteController/queryRouteById") + public void queryRouteById(InputObject inputObject, OutputObject outputObject) { + routeService.selectById(inputObject, outputObject); + } + @ApiOperation(id = "queryRoutesByStartAndEnd", value = "根据起点id--终点id 根据路线长度升序排序", method = "GET", allUse = "2") @ApiImplicitParams({ @ApiImplicitParam(id = "startId", name = "startId", value = "起点id", required = "required"), diff --git a/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/service/impl/RouteServiceImpl.java b/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/service/impl/RouteServiceImpl.java index bbd2adb3..88ddeed9 100644 --- a/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/service/impl/RouteServiceImpl.java +++ b/skyeye-school/school-pro/src/main/java/com/skyeye/school/route/service/impl/RouteServiceImpl.java @@ -5,6 +5,7 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; +import com.skyeye.common.constans.CommonNumConstants; import com.skyeye.common.entity.search.CommonPageInfo; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; @@ -57,6 +58,17 @@ public class RouteServiceImpl extends SkyeyeBusinessServiceImpl getOrderCommentListByType(String typeId, Integer type) { + private List getOrderCommentListByType(String typeId, Integer type,String objectId) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq(MybatisPlusUtil.toColumns(OrderComment::getType), type) .and(wrap -> { @@ -202,6 +202,9 @@ public class OrderCommentServiceImpl extends SkyeyeBusinessServiceImpl list = list(queryWrapper); iMaterialService.setDataMation(list, OrderComment::getMaterialId); iMaterialNormsService.setDataMation(list, OrderComment::getNormsId); @@ -214,10 +217,11 @@ public class OrderCommentServiceImpl extends SkyeyeBusinessServiceImpl customerFirst = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERFiRST.getKey()); - List customerLater = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERLATER.getKey()); - List merchantReply = getOrderCommentListByType(typeId, OrderCommentType.MERCHANT.getKey()); + List customerFirst = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERFiRST.getKey(),objectId); + List customerLater = getOrderCommentListByType(typeId, OrderCommentType.CUSTOMERLATER.getKey(),objectId); + List merchantReply = getOrderCommentListByType(typeId, OrderCommentType.MERCHANT.getKey(),objectId); if (CollectionUtil.isEmpty(customerFirst)) { return; } diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java index 85eaccdf..a0b39bd8 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderItemServiceImpl.java @@ -118,7 +118,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper = new UpdateWrapper<>(); updateWrapper.eq(CommonConstants.ID, id) .set(MybatisPlusUtil.toColumns(OrderItem::getCommentState), WhetherEnum.ENABLE_USING.getKey()); @@ -135,7 +135,7 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl updateWrapper = new UpdateWrapper<>(); diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java index b92ba34d..a7632259 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/order/service/impl/OrderServiceImpl.java @@ -13,8 +13,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; +import com.google.common.base.Joiner; import com.skyeye.annotation.service.SkyeyeService; import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl; +import com.skyeye.common.constans.CommonCharConstants; import com.skyeye.common.constans.CommonConstants; import com.skyeye.common.constans.CommonNumConstants; import com.skyeye.common.constans.QuartzConstants; @@ -31,8 +33,6 @@ import com.skyeye.coupon.enums.PromotionDiscountType; import com.skyeye.coupon.enums.PromotionMaterialScope; import com.skyeye.coupon.service.CouponUseMaterialService; import com.skyeye.coupon.service.CouponUseService; -import com.skyeye.erp.service.IMaterialNormsService; -import com.skyeye.erp.service.IMaterialService; import com.skyeye.eve.rest.quartz.SysQuartzMation; import com.skyeye.eve.service.IAreaService; import com.skyeye.eve.service.IQuartzService; @@ -47,8 +47,10 @@ import com.skyeye.order.enums.ShopOrderState; import com.skyeye.order.service.OrderItemService; import com.skyeye.order.service.OrderService; import com.skyeye.rest.pay.service.IPayService; +import com.skyeye.rest.shopmaterialnorms.sevice.IShopMaterialNormsService; import com.skyeye.store.entity.ShopAddress; import com.skyeye.store.service.ShopAddressService; +import com.skyeye.store.service.ShopTradeCartService; import com.xxl.job.core.util.IpUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -78,10 +80,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl private IAreaService iAreaService; @Autowired - private IMaterialService iMaterialService; - - @Autowired - private IMaterialNormsService iMaterialNormsService; + private IShopMaterialNormsService iShopMaterialNormsService; @Autowired private CouponUseService couponUseService; @@ -101,6 +100,9 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl @Autowired private IQuartzService iQuartzService; + @Autowired + private ShopTradeCartService shopTradeCartService; + @Override public void createPrepose(Order order) { // 订单编号 @@ -130,17 +132,21 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl checkAndSetVariable(order); // 活动信息及积分操作方法 checkAndSetActive(order); - refreshCache(order.getId()); } private void checkAndSetItemCouponUse(Order order) {// 子单的优惠券操作 List orderItemList = order.getOrderItemList(); // 设置商品信息、商品规格信息和优惠券信息 - iMaterialNormsService.setDataMation(orderItemList, OrderItem::getNormsId); - iMaterialService.setDataMation(orderItemList, OrderItem::getMaterialId); + List normsIdList = orderItemList.stream().map(OrderItem::getNormsId).collect(Collectors.toList()); + List> normsListMap = iShopMaterialNormsService.queryShopMaterialByNormsIdList(Joiner.on(CommonCharConstants.COMMA_MARK).join(normsIdList)); + Map normsPriceMap = normsListMap.stream() + .collect(Collectors.toMap(map -> map.get("normsId").toString(), map -> map.get("salePrice").toString())); for (OrderItem orderItem : orderItemList) {// 计算每一个子单的总价 + if (!normsPriceMap.containsKey(orderItem.getNormsId())) { + throw new CustomException("商城不存在normsId: " + orderItem.getNormsId()); + } // 获取子单单价 元 -> 分 - String salePrice = CalculationUtil.multiply(orderItem.getNormsMation().get("salePrice").toString(), "100"); + String salePrice = CalculationUtil.multiply(normsPriceMap.get(orderItem.getNormsId()), "100"); // 设置子单总价 String price = CalculationUtil.multiply(String.valueOf(orderItem.getCount()), salePrice, CommonNumConstants.NUM_SIX); orderItem.setPrice(price); @@ -249,6 +255,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl orderItemService.setValueAndCreateEntity(order, userId); couponUseService.updateState(order.getCouponUseId());// 更新用户领取的优惠券状态 startUpTaskQuartz(order.getId(), order.getOddNumber(), DateUtil.getTimeAndToString()); + shopTradeCartService.deleteMySelect(userId); } private void startUpTaskQuartz(String name, String title, String delayedTime) { @@ -285,9 +292,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl ShopOrderState.SIGN.getKey(), // 已签收 ShopOrderState.COMPLETED.getKey(), // 已完成 ShopOrderState.UNEVALUATE.getKey(), // 待评价 - ShopOrderState.EVALUATED.getKey(),// 已评价 - ShopOrderState.PARTIALLYDONE.getKey(),//部分完成 - ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价 + ShopOrderState.EVALUATED.getKey()});// 已评价 break; case "4":// 已取消 stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()}); @@ -350,9 +355,8 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl ShopOrderState.SIGN.getKey(), // 已签收 ShopOrderState.COMPLETED.getKey(), // 已完成 ShopOrderState.UNEVALUATE.getKey(), // 待评价 - ShopOrderState.EVALUATED.getKey(),// 已评价 - ShopOrderState.PARTIALLYDONE.getKey(),//部分完成 - ShopOrderState.PARTIALEVALUATION.getKey()});//部分评价 + ShopOrderState.EVALUATED.getKey()});// 已评价 + ShopOrderState.PARTIALLYDONE.getKey();//部分完成 break; case "4":// 已取消 stateList = Arrays.asList(new Integer[]{ShopOrderState.CANCELED.getKey()}); @@ -375,7 +379,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl } String userId = InputObject.getLogParamsStatic().get("id").toString(); wrapper.eq(MybatisPlusUtil.toColumns(Order::getCreateId), userId);// 查询自己的订单 - wrapper.eq(MybatisPlusUtil.toColumns(Order::getType),commonPageInfo.getType()); wrapper.orderByDesc(MybatisPlusUtil.toColumns(Order::getCreateTime)); List list = list(wrapper); if (CollectionUtil.isEmpty(list)) { @@ -394,7 +397,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl shopAddressService.setDataMation(list, Order::getAddressId); outputObject.setBeans(JSONUtil.toList(JSONUtil.toJsonStr(list), null)); outputObject.settotal(pages.getTotal()); - refreshCache(idList); } @Override @@ -439,7 +441,6 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl iAreaService.setDataMation(order, Order::getTownshipId); shopAddressService.setDataMation(order, Order::getAddressId); pennyToYuan(order);// 分 -> 元 - refreshCache(id); return order; } @@ -606,7 +607,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl orderItemService.UpdateOrderItemState(orderItemId); List orderItemList = orderItemService.queryOrderItemByParentId(orderId); boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState) - .allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO); + .allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO); if (allTwo) { Integer partiallydoneKey = ShopOrderState.COMPLETED.getKey(); updateOrderState(orderId, partiallydoneKey); @@ -616,9 +617,7 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl } } - - @Override - public void updateOrderState(String orderId, Integer partiallydoneKey) { + private void updateOrderState(String orderId, Integer partiallydoneKey) { UpdateWrapper updateWrapper = new UpdateWrapper<>(); updateWrapper.eq(CommonConstants.ID, orderId); updateWrapper.set(MybatisPlusUtil.toColumns(Order::getState), partiallydoneKey); diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopTradeCart.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopTradeCart.java index 3f05f0f3..a2e04a3c 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopTradeCart.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/entity/ShopTradeCart.java @@ -65,6 +65,6 @@ public class ShopTradeCart extends OperatorUserInfo { private Integer count; @TableField("selected") - @ApiModelProperty(value = "是否选中", required = "required,num",enumClass = WhetherEnum.class) + @ApiModelProperty(value = "是否选中", required = "required,num", enumClass = WhetherEnum.class) private Integer selected; } diff --git a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopTradeCartService.java b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopTradeCartService.java index cf7ec565..a49d1ef0 100644 --- a/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopTradeCartService.java +++ b/skyeye-shop/shop-store/src/main/java/com/skyeye/store/service/ShopTradeCartService.java @@ -29,4 +29,6 @@ public interface ShopTradeCartService extends SkyeyeBusinessService queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(MybatisPlusUtil.toColumns(ShopTradeCart::getSelected), WhetherEnum.ENABLE_USING.getKey()) + .eq(MybatisPlusUtil.toColumns(ShopTradeCart::getCreateId), userId); + remove(queryWrapper); + } + @Override public void changeCount(InputObject inputObject, OutputObject outputObject) { Map params = inputObject.getParams();