| | |
| | | private final MallScoreRecordMapper mallScoreRecordMapper; |
| | | private final MallScoreAchieveReleaseMapper mallScoreAchieveReleaseMapper; |
| | | private final MallScoreVoucherMapper mallScoreVoucherMapper; |
| | | private final CommonService commonService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void fcmNFTExchangeMsg(String cnt) { |
| | | //销毁数量 |
| | | BigDecimal destoryCnt = new BigDecimal(cnt); |
| | | DataDictionaryCustom fcmDestoryCntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.FCM_DESTORY_CNT.getType(), |
| | | DataDictionaryEnum.FCM_DESTORY_CNT.getCode() |
| | | ); |
| | | BigDecimal fcmDestoryCnt = new BigDecimal(fcmDestoryCntDic.getValue()); |
| | | |
| | | BigDecimal fcmDestoryCntAdd = fcmDestoryCnt.add(destoryCnt); |
| | | /** |
| | | * 每次销毁10000个,价格增加0.1 |
| | | * 满足的次数 divide |
| | | */ |
| | | BigDecimal divide = fcmDestoryCntAdd.divide(AppContants.FCM_BASIC, 0, BigDecimal.ROUND_DOWN); |
| | | if(BigDecimal.ZERO.compareTo(divide) == 0){ |
| | | commonService.updateDataDic( |
| | | DataDictionaryEnum.BANK_TRANS_URL.getType(), |
| | | DataDictionaryEnum.BANK_TRANS_URL.getCode(), |
| | | fcmDestoryCntAdd.toString()); |
| | | } |
| | | |
| | | if(BigDecimal.ZERO.compareTo(divide) < 0){ |
| | | //例:累计15000 去掉10000,累计只剩5000 |
| | | BigDecimal fcmDestoryCntReal = fcmDestoryCntAdd.subtract(divide.multiply(AppContants.FCM_BASIC)); |
| | | commonService.updateDataDic( |
| | | DataDictionaryEnum.FCM_DESTORY_CNT.getType(), |
| | | DataDictionaryEnum.FCM_DESTORY_CNT.getCode(), |
| | | fcmDestoryCntReal.toString()); |
| | | |
| | | //更新总销毁数量 |
| | | DataDictionaryCustom fcmDestoryTotalDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(), |
| | | DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode() |
| | | ); |
| | | BigDecimal fcmDestoryTotal = new BigDecimal(fcmDestoryTotalDic.getValue()); |
| | | fcmDestoryTotal = fcmDestoryTotal.add(destoryCnt); |
| | | commonService.updateDataDic( |
| | | DataDictionaryEnum.FCM_DESTORY_TOTAL.getType(), |
| | | DataDictionaryEnum.FCM_DESTORY_TOTAL.getCode(), |
| | | fcmDestoryTotal.toString()); |
| | | //更新价格 |
| | | DataDictionaryCustom fcmPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.FCM_PRICE.getType(), |
| | | DataDictionaryEnum.FCM_PRICE.getCode() |
| | | ); |
| | | BigDecimal fcmPrice = new BigDecimal(fcmPriceDic.getValue()); |
| | | fcmPrice = fcmPrice.add(AppContants.FCM_BASIC_ADD_PRICE.multiply(divide)); |
| | | commonService.updateDataDic( |
| | | DataDictionaryEnum.FCM_PRICE.getType(), |
| | | DataDictionaryEnum.FCM_PRICE.getCode(), |
| | | fcmPrice.toString()); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | BigDecimal divide = new BigDecimal(12000).divide(new BigDecimal(10000), 0, BigDecimal.ROUND_DOWN); |
| | | System.out.println(divide); |
| | | } |
| | | |
| | | /** |
| | | * 给用户的增加凭证数据,并且增加流水 |
| | | * @param memberAchieveRelease 释放数量 |