| | |
| | | for(QueryOrderListVo queryOrderListVo : maps){ |
| | | String decode = StringUtils.decode(queryOrderListVo.getName()); |
| | | queryOrderListVo.setName(decode); |
| | | BigDecimal totalPrice = new BigDecimal(StrUtil.isEmpty(queryOrderListVo.getTotalPrice()) ? "0" : queryOrderListVo.getTotalPrice()) |
| | | .setScale( 2, BigDecimal.ROUND_DOWN ); |
| | | queryOrderListVo.setTotalPrice(totalPrice.toString()); |
| | | |
| | | Long id = queryOrderListVo.getId(); |
| | | Example example = new Example(ScoreOrderDetails.class); |
| | | Example.Criteria criteria = example.createCriteria(); |
| | | criteria.andEqualTo("orderId",id); |
| | | List<ScoreOrderDetails> scoreOrderDetails = scoreOrderDetailsMapper.selectByExample(example); |
| | | if(CollUtil.isNotEmpty(scoreOrderDetails)){ |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | | PageInfo pageInfo = new PageInfo(maps); |
| | |
| | | public Long insureOrder(InsureOrderDto model) { |
| | | ScoreOrder scoreOrder = new ScoreOrder(); |
| | | scoreOrder.setId(model.getId()); |
| | | scoreOrder.setStatus(ScoreOrder.STATUS_DONE); |
| | | // scoreOrder.setStatus(ScoreOrder.STATUS_DONE); |
| | | scoreOrder.setIsFinish(ScoreOrder.ISFINISH_YES); |
| | | scoreOrder.setVoucherImg(CollUtil.join(model.getVoucherImgs(),",")); |
| | | scoreOrderMapper.updateByPrimaryKeySelective(scoreOrder); |
| | | return scoreOrder.getId(); |
| | |
| | | } |
| | | |
| | | AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(addGoodsOrderDto.getUserId()); |
| | | |
| | | if (accountInfo.getCollectScore() == null) { |
| | | throw new RestException(-3, "积分不足"); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | } |