| | |
| | | BigDecimal totalScore = BigDecimal.ZERO; |
| | | for (JhyOrderConfirmItemsDto item : confirmDto.getItems()) { |
| | | JhyOrderItems orderItem = jhyOrderItemsMapper.selectByPrimaryKey(item.getId()); |
| | | BigDecimal total = orderItem.getPrice().multiply(BigDecimal.valueOf(40)).multiply(new BigDecimal(item.getWeight())); |
| | | BigDecimal weight = StrUtil.isNotBlank(item.getWeight()) ? new BigDecimal(item.getWeight()) : BigDecimal.ZERO; |
| | | BigDecimal total = orderItem.getPrice().multiply(BigDecimal.valueOf(40)).multiply(weight); |
| | | orderItem.setScore(total.setScale(0, BigDecimal.ROUND_DOWN).toString()); |
| | | orderItem.setWeight(StrUtil.isNotBlank(item.getWeight()) ? new BigDecimal(item.getWeight()) : BigDecimal.ZERO); |
| | | orderItem.setWeight(weight); |
| | | jhyOrderItemsMapper.updateByPrimaryKey(orderItem); |
| | | |
| | | totalScore = totalScore.add(total); |
| | |
| | | BigDecimal userScore = StrUtil.isBlank(userAccount.getCollectScore()) ? BigDecimal.ZERO : new BigDecimal(userAccount.getCollectScore()); |
| | | ScoreDetails userScoreDetail = new ScoreDetails(); |
| | | userScoreDetail.setOrderNo(order.getOrderNo()); |
| | | userScoreDetail.setUserId(order.getJhyId()); |
| | | // userScoreDetail.setUserId(order.getJhyId()); |
| | | userScoreDetail.setUserId(order.getUserId()); |
| | | userScoreDetail.setType(ScoreDetails.SCORE_TYPE_EXCHANGE); |
| | | userScoreDetail.setChangeScore(totalScore); |
| | | userScoreDetail.setOriginalScore(userScore); |