| | |
| | | } |
| | | } |
| | | |
| | | if (addGoodsOrderDto.getCnt() > sku.getStock()) { |
| | | throw new RestException(-3, "库存不足"); |
| | | } |
| | | |
| | | AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(addGoodsOrderDto.getUserId()); |
| | | |
| | | if (accountInfo.getCollectScore() == null) { |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | public StatisticsVo orderStatistics(String userId) { |
| | | BigDecimal score = scoreDetailsMapper.selectTotalScoreByUserId(userId, ScoreDetails.SCORE_TYPE_EXCHANGE); |
| | | |
| | | Map<String, Object> userData = scoreOrderMapper.selectOrderStastics(userId); |
| | | Map<String, Object> allData = scoreOrderMapper.selectOrderStastics(null); |
| | | |
| | | StatisticsVo statisticsVo = new StatisticsVo(); |
| | | statisticsVo.setScore(score); |
| | | BigDecimal userPrice = (BigDecimal) userData.get("totalPrice"); |
| | | statisticsVo.setReduceCarbon(userPrice.divide(BigDecimal.TEN, 2, BigDecimal.ROUND_DOWN)); |
| | | statisticsVo.setOrderCnt(Integer.parseInt(userData.get("totalOrder").toString())); |
| | | |
| | | BigDecimal totalPrice = (BigDecimal) allData.get("totalPrice"); |
| | | statisticsVo.setTotalReduceCarbon(totalPrice.divide(BigDecimal.TEN, 2, BigDecimal.ROUND_DOWN)); |
| | | statisticsVo.setTotalOrderCnt(Integer.parseInt(allData.get("totalOrder").toString())); |
| | | statisticsVo.setTotalBuyCnt(Integer.parseInt(allData.get("totalBuy").toString())); |
| | | return statisticsVo; |
| | | } |
| | | } |