| | |
| | | criteria.andEqualTo("orderId",id); |
| | | List<ScoreOrderDetails> scoreOrderDetails = scoreOrderDetailsMapper.selectByExample(example); |
| | | if(CollUtil.isNotEmpty(scoreOrderDetails)){ |
| | | StringBuffer stringBuffer = new StringBuffer(); |
| | | for(ScoreOrderDetails scoreOrderDetail : scoreOrderDetails){ |
| | | String goodsName = scoreOrderDetail.getGoodsName(); |
| | | BigDecimal unitPrice = scoreOrderDetail.getUnitPrice(); |
| | | String sku = scoreOrderDetail.getSku(); |
| | | Integer cnt = scoreOrderDetail.getCnt(); |
| | | BigDecimal totalPriceOrderDetail = scoreOrderDetail.getTotalPrice(); |
| | | stringBuffer = stringBuffer.append(goodsName+"(") |
| | | .append("规格:"+sku+","+unitPrice.setScale( 2, BigDecimal.ROUND_DOWN ).toString()+"*"+cnt.toString()+",") |
| | | .append("总价:"+totalPriceOrderDetail.setScale( 2, BigDecimal.ROUND_DOWN ).toString()+";)"); |
| | | } |
| | | queryOrderListVo.setOrderDetails(stringBuffer.toString()); |
| | | queryOrderListVo.setOrderDetails(scoreOrderDetails); |
| | | // StringBuffer stringBuffer = new StringBuffer(); |
| | | // for(ScoreOrderDetails scoreOrderDetail : scoreOrderDetails){ |
| | | // String goodsName = scoreOrderDetail.getGoodsName(); |
| | | // BigDecimal unitPrice = scoreOrderDetail.getUnitPrice(); |
| | | // String sku = scoreOrderDetail.getSku(); |
| | | // Integer cnt = scoreOrderDetail.getCnt(); |
| | | // BigDecimal totalPriceOrderDetail = scoreOrderDetail.getTotalPrice(); |
| | | // stringBuffer = stringBuffer.append(goodsName+"(") |
| | | // .append("规格:"+sku+","+unitPrice.setScale( 2, BigDecimal.ROUND_DOWN ).toString()+"*"+cnt.toString()+",") |
| | | // .append("总价:"+totalPriceOrderDetail.setScale( 2, BigDecimal.ROUND_DOWN ).toString()+";)"); |
| | | // } |
| | | // queryOrderListVo.setOrderDetails(stringBuffer.toString()); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(addGoodsOrderDto.getUserId()); |
| | | log.info("积分:{}", accountInfo.getCollectScore()); |
| | | if (accountInfo.getCollectScore() == null) { |
| | | throw new RestException(-3, "积分不足"); |
| | | } |
| | | |
| | | BigDecimal totalPrice = sku.getPresentPrice().multiply(BigDecimal.valueOf(addGoodsOrderDto.getCnt())); |
| | | BigDecimal score = new BigDecimal(accountInfo.getCollectScore()); |
| | | log.info("积分:{}", score); |
| | | log.info("积分1:{}", totalPrice); |
| | | if (score.compareTo(totalPrice) < 0) { |
| | | throw new RestException(-3, "积分不足"); |
| | | } |