| | |
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.redpack.RedPackExchange;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackBalanceException;
|
| | | import com.yeshi.fanli.exception.redpack.RedPackExchangeException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | |
| | | import com.yeshi.fanli.service.inter.redpack.RedPackConfigService;
|
| | | import com.yeshi.fanli.service.inter.redpack.RedPackDetailService;
|
| | | 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.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.RedPackDetailFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | | |
| | | @Resource
|
| | | private RedPackForbidService redPackForbidService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | public void exchangeCash(Long uid, BigDecimal amount) throws RedPackExchangeException {
|
| | | if (uid == null || amount == null)
|
| | | throw new RedPackExchangeException(1, "参数不正确");
|
| | |
|
| | | |
| | | if(redPackForbidService.verifyForbid(uid))
|
| | | throw new RedPackExchangeException(1, "红包功能已被封禁");
|
| | | |
| | | String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min");
|
| | |
|
| | | BigDecimal balance = null;
|
| | | try {
|
| | | balance = redPackBalanceService.getBalance(uid);
|
| | | } catch (RedPackBalanceException e1) {
|
| | | throw new RedPackExchangeException(1, e1.getMsg());
|
| | | }
|
| | | |
| | | BigDecimal balance = redPackBalanceService.getBalance(uid);
|
| | | if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0)
|
| | | throw new RedPackExchangeException(1, "余额不足" + extractBanlenMin + "元");
|
| | |
|
| | |
| | | if (RedPackExchange.STATE_INIT != record.getState())
|
| | | throw new RedPackExchangeException(1,"该申请已被处理,请刷新");
|
| | |
|
| | | if(redPackForbidService.verifyForbid(record.getUid()))
|
| | | throw new RedPackExchangeException(1, "红包功能已被封禁");
|
| | | |
| | | Date nowDate = new Date();
|
| | | record.setAuditId(admin.getId());
|
| | | record.setAuditTime(nowDate);
|
| | |
| | | throw new RedPackExchangeException(1,"更新提现明细出错");
|
| | | }
|
| | |
|
| | | try {
|
| | | //消息
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | String beizu = "红包提现成功后请到“我的-账户余额”中查看";
|
| | | MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
|
| | | dto.setTitle("红包提现");
|
| | | dto.setTime(sd.format(record.getCreateTime()));
|
| | | 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);
|
| | | } catch (RedPackBalanceException e) {
|
| | | throw new RedPackExchangeException(1, e.getMsg());
|
| | | }
|
| | | |
| | | //消息
|
| | | SimpleDateFormat sd = new SimpleDateFormat("yyyy.MM.dd HH:mm");
|
| | | String beizu = "红包提现成功后请到“我的-账户余额”中查看";
|
| | | MsgRedPackExchangeContentDTO dto = new MsgRedPackExchangeContentDTO();
|
| | | dto.setTitle("红包提现");
|
| | | dto.setTime(sd.format(record.getCreateTime()));
|
| | | 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);
|
| | | |
| | | }
|
| | |
|
| | |
|