From 4525d92eb8cfec5f2cd43a96862328ae6cbdf386 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 25 Jun 2021 18:27:23 +0800 Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop --- gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java | 36 ++++++++++++++++++++++++++---------- 1 files changed, 26 insertions(+), 10 deletions(-) diff --git a/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java b/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java index 2bb7477..44e9640 100644 --- a/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java +++ b/gc-shop/src/main/java/com/xzx/gc/shop/service/OrderService.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.xzx.gc.common.utils.StringUtils; import com.xzx.gc.common.constant.Constants; import com.xzx.gc.common.exception.RestException; import com.xzx.gc.common.utils.IdUtils; @@ -69,6 +70,12 @@ Date createdTimeEnd = model.getCreatedTimeEnd(); PageHelper.startPage(model.getPage(), model.getLimit()); List<QueryOrderListVo> maps = scoreOrderMapper.queryOrderList(name,orderNo,status,createdTimeStart,createdTimeEnd); + if(CollUtil.isNotEmpty(maps)){ + for(QueryOrderListVo queryOrderListVo : maps){ + String decode = StringUtils.decode(queryOrderListVo.getName()); + queryOrderListVo.setName(decode); + } + } PageInfo pageInfo = new PageInfo(maps); int count = Convert.toInt(pageInfo.getTotal()); Map<String, Object> map = new HashMap<>(); @@ -96,17 +103,17 @@ viewOrderVo.setVoucherImgs(lists); //2-待收货3-已收货4-已完成5-已评价,获取物流信息 Integer status = scoreOrder.getStatus() == null ? 0:scoreOrder.getStatus(); - if(ScoreOrder.STATUS_DOING == status - || ScoreOrder.STATUS_DONE == status - || ScoreOrder.STATUS_ON == status - || ScoreOrder.STATUS_EVALUATE == status){ +// if(ScoreOrder.STATUS_DOING == status +// || ScoreOrder.STATUS_DONE == status +// || ScoreOrder.STATUS_ON == status +// || ScoreOrder.STATUS_EVALUATE == status){ Example exampleExpress = new Example(ScoreExpressInfo.class); Example.Criteria criteriaExpress = exampleExpress.createCriteria(); criteriaExpress.andEqualTo("orderId",id); ScoreExpressInfo scoreExpressInfo = scoreExpressInfoMapper.selectOneByExample(exampleExpress); ExpressInfoVo expressInfoVo = objectMapper.convertValue(scoreExpressInfo, ExpressInfoVo.class); viewOrderVo.setExpressInfoVo(expressInfoVo); - } +// } //订单详情 Example exampleDetails = new Example(ScoreOrderDetails.class); Example.Criteria criteriaDetails = exampleDetails.createCriteria(); @@ -160,6 +167,17 @@ if (goods == null || ScoreGoods.ISSALE_NO.equals(goods.getIsSale())) { throw new RestException(-3, "商品不存在或已下架"); } + + if (ScoreGoods.ISQG_YES.equals(goods.getIsQg())) { + if (new Date().before(goods.getQgStartTime())) { + throw new RestException(-3, "抢购未开始"); + } + + if (new Date().after(goods.getQgEndTime())) { + throw new RestException(-3, "抢购已结束"); + } + } + AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(addGoodsOrderDto.getUserId()); if (accountInfo.getCollectScore() == null) { @@ -215,11 +233,9 @@ expressInfo.setCreatedTime(new Date()); scoreExpressInfoMapper.insert(expressInfo); - AccountInfo update = new AccountInfo(); - update.setAccountId(accountInfo.getAccountId()); - BigDecimal remianScore = score.subtract(totalPrice); - update.setCollectScore(remianScore.toString()); - accountInfoMapper.updateByPrimaryKey(update); + BigDecimal remianScore = score.subtract(totalPrice).setScale(0, BigDecimal.ROUND_DOWN); + accountInfo.setCollectScore(remianScore.toString()); + accountInfoMapper.updateByPrimaryKey(accountInfo); ScoreDetails scoreDetails = new ScoreDetails(); scoreDetails.setOrderNo(order.getOrderNo()); -- Gitblit v1.9.1