| | |
| | | import cc.mrbird.febs.mall.entity.*; |
| | | import cc.mrbird.febs.mall.mapper.*; |
| | | import cc.mrbird.febs.mall.service.*; |
| | | import cc.mrbird.febs.mall.vo.ApiShopApplyVo; |
| | | import cc.mrbird.febs.mall.vo.OrderDetailVo; |
| | | import cc.mrbird.febs.mall.vo.OrderListVo; |
| | | import cc.mrbird.febs.mall.vo.OrderRefundVo; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.pay.model.AgreementPayDto; |
| | | import cc.mrbird.febs.pay.model.AgreementSignDto; |
| | | import cc.mrbird.febs.pay.model.UnipayDto; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | |
| | | private final MallShopApplyMapper mallShopApplyMapper; |
| | | private final DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private final MallAchieveRecordMapper mallAchieveRecordMapper; |
| | | private final MallMemberWalletMapper mallMemberWalletMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | orderInfo.setPayTime(new Date()); |
| | | orderInfo.setPayResult("1"); |
| | | |
| | | changeWallet(orderInfo.getId(), member.getId()); |
| | | |
| | | agentProducer.sendAutoLevelUpMsg(member.getId()); |
| | | changeWallet(orderInfo.getId()); |
| | | //发送补贴消息 |
| | | agentProducer.sendPerkMoneyMsg(orderInfo.getId()); |
| | | // agentProducer.sendOrderReturn(orderInfo.getId()); |
| | | break; |
| | | case "4": |
| | |
| | | * 增加贡献值,增加流水 |
| | | * 产生一条业绩记录 |
| | | * @param orderId |
| | | * @param memberId |
| | | */ |
| | | public void changeWallet(Long orderId,Long memberId){ |
| | | public void changeWallet(Long orderId){ |
| | | MallOrderInfo orderInfo = this.baseMapper.selectById(orderId); |
| | | Long memberId = orderInfo.getMemberId(); |
| | | boolean hasTc = false; |
| | | //总贡献值 |
| | | BigDecimal starSum = BigDecimal.ZERO; |
| | |
| | | */ |
| | | if (mallGoods.getIsNormal() == 2) { |
| | | hasTc = true; |
| | | BigDecimal star = mallGoods.getStar(); |
| | | BigDecimal star = mallGoods.getStar()==null ? BigDecimal.ZERO : mallGoods.getStar(); |
| | | starSum = starSum.add(star); |
| | | scoreSum = scoreSum.add( |
| | | new BigDecimal(mallGoods.getPresentPrice()) |
| | |
| | | * 增加贡献值,增加流水 |
| | | */ |
| | | if (starSum.compareTo(BigDecimal.ZERO) > 0) { |
| | | memberWalletService.add(starSum, memberId, "star"); |
| | | mallMemberWalletMapper.addStarByMemberId(starSum.intValue(), memberId); |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | memberId, |
| | | starSum, |
| | |
| | | BigDecimal score = ObjectUtil.isEmpty(addOrderDto.getScore()) ? BigDecimal.ZERO : addOrderDto.getScore(); |
| | | if(ObjectUtil.isNotEmpty(scorePercentDic)){ |
| | | //商品的现金折扣比例 |
| | | BigDecimal scorePercent = new BigDecimal(scorePercentDic.getValue()).divide(new BigDecimal(100), BigDecimal.ROUND_DOWN); |
| | | BigDecimal scorePercent = new BigDecimal(scorePercentDic.getValue()).multiply(BigDecimal.valueOf(0.01)); |
| | | //最大折扣金额对应需要的总积分数目 |
| | | BigDecimal scorePercentMaxAmount = total.multiply(scorePercent); |
| | | BigDecimal scoreChange = BigDecimal.ONE; |
| | |
| | | } |
| | | scorePercentMaxAmount = scorePercentMaxAmount.multiply(scoreChange); |
| | | if(scorePercentMaxAmount.compareTo(score) < 0){ |
| | | return false; |
| | | flag = false; |
| | | }else{ |
| | | flag = true; |
| | | } |
| | | }else{ |
| | | flag = true; |
| | |
| | | return flag; |
| | | } |
| | | |
| | | @Override |
| | | public ApiScoreSetVo myScoreSet() { |
| | | ApiScoreSetVo apiScoreSetVo = new ApiScoreSetVo(); |
| | | DataDictionaryCustom scorePercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.SCORE_PERCENT.getType(), |
| | | DataDictionaryEnum.SCORE_PERCENT.getCode() |
| | | ); |
| | | DataDictionaryCustom scoreChangeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.SCORE_CHANGE.getType(), |
| | | DataDictionaryEnum.SCORE_CHANGE.getCode() |
| | | ); |
| | | apiScoreSetVo.setScorePercent(new BigDecimal(scorePercentDic.getValue()).multiply(BigDecimal.valueOf(0.01)).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | apiScoreSetVo.setScoreChange(new BigDecimal(scoreChangeDic.getValue()).setScale(2,BigDecimal.ROUND_DOWN)); |
| | | return apiScoreSetVo; |
| | | } |
| | | |
| | | } |