| | |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackExchangeService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackForbidService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | |
|
| | |
| | | @Resource
|
| | | private RedPackForbidService redPackForbidService;
|
| | |
|
| | | |
| | | @Override
|
| | | public List<RedPackExchange> query(Integer start, Integer count, String key, Integer state){
|
| | | return redPackExchangeMapper.query(start, count, key, state);
|
| | |
| | | return redPackExchangeMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void exchangeCash(Long uid, BigDecimal amount) throws RedPackExchangeException {
|
| | |
| | | if (amount.compareTo(new BigDecimal(moneyMin)) < 0 || amount.compareTo(new BigDecimal(moneyMax)) > 0)
|
| | | throw new RedPackExchangeException(1, "提现金额至少" + moneyMin + "元至多" + moneyMax + "元");
|
| | |
|
| | | |
| | | long countToday = redPackExchangeMapper.countTodayByUid(uid);
|
| | | String extractDayMax = redPackConfigService.getValueByKey("extract_day_max");
|
| | | if (!StringUtil.isNullOrEmpty(extractDayMax) && countToday >= Long.parseLong(extractDayMax))
|
| | | throw new RedPackExchangeException(1, "今日红包提现次数超限");
|
| | | |
| | |
|
| | | Date nowDate = new Date();
|
| | | // 提现申请
|
| | |
| | | throw new RedPackExchangeException(1, "红包信息异常");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | | throw new RedPackExchangeException(1,"更新提现明细出错");
|
| | | }
|
| | |
|
| | | |
| | | //消息
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | String beizu = "红包提现成功后请到“我的-账户余额”中查看";
|
| | |
| | | dto.setHandle("人工审核" + sd.format(new Date()));
|
| | | dto.setMoney("¥" + record.getMoney().setScale(2));
|
| | | dto.setBalance("¥" + redPackBalanceService.getBalance(record.getUid()));
|
| | | userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass, new Gson().toJson(dto), beizu);
|
| | | userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangePass,
|
| | | new Gson().toJson(dto), beizu);
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | |
| | |
|
| | | // 退回红包
|
| | | try {
|
| | | redPackBalanceService.addRedPack(record.getUid(), record.getMoney(), RedPackDetailFactory.createExchangeReject(record));
|
| | | redPackBalanceService.addRedPack(record.getUid(), record.getMoney(),
|
| | | RedPackDetailFactory.createExchangeReject(record));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new RedPackExchangeException(1, "红包退回时出错");
|
| | |
| | | dto.setReason(reason);
|
| | | dto.setHandle(""); // TODO 处理方式待定
|
| | | dto.setTime(sd.format(record.getCreateTime()));
|
| | | userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangeReject, new Gson().toJson(dto), null);
|
| | | userMoneyMsgNotificationService.redPackMsg(record.getUid(), MsgTypeMoneyTypeEnum.redPackExchangeReject,
|
| | | new Gson().toJson(dto), null);
|
| | | }
|
| | |
|
| | | }
|