| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.mq.rabbit.RabbitmqManager; |
| | | import org.dom4j.Document; |
| | | import org.dom4j.DocumentException; |
| | | import org.dom4j.DocumentHelper; |
| | |
| | | |
| | | @Resource |
| | | private CommonOrderCountService commonOrderCountService; |
| | | |
| | | @Resource |
| | | private RabbitmqManager rabbitmqManager; |
| | | |
| | | @Transactional |
| | | public Integer addExtract(Extract extract) { |
| | |
| | | * @param extract |
| | | * @param session |
| | | */ |
| | | @Transactional |
| | | private void transfer(Extract extract, AdminUser adminUser) { |
| | | Integer type = extract.getType(); |
| | | if (Constant.ZHIFUBAO == type) { |
| | |
| | | return 0; |
| | | } |
| | | |
| | | private String getOrderPrefix(SystemEnum system) { |
| | | if (system == SystemEnum.yhqjx) { |
| | | return "TJ"; |
| | | } else if (system == SystemEnum.hsb) { |
| | | return "HSB"; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 提现到支付宝 |
| | | * |
| | |
| | | * @param session |
| | | */ |
| | | // TODO 转账逻辑需要改变,固定IP |
| | | @Transactional |
| | | private void extractByZhiFuBao(Extract extract, AdminUser adminUser) { |
| | | LogHelper.userErrorInfo("提现:开始通过提现-" + extract.getId()); |
| | | //获取用户的系统 |
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(extract.getUserInfo().getId()); |
| | | String appName = user.getSystem().getName(); |
| | | //备注 |
| | | String remark = appName + "APP渠道提现"; |
| | | //理由 |
| | | String reason = String.format("用户ID【%s】发起的提现", getOrderPrefix(user.getSystem()) + user.getId()); |
| | | |
| | | AlipayFundTransUniTransferResponse response = null; |
| | | try { |
| | | response = AlipayUtil.transferNoThrowException("widthdraw_" + extract.getId(), extract.getAccount(), extract.getName(), extract.getMoney(), "板栗快省提现到账", "来自板栗快省的提现"); |
| | | response = AlipayUtil.transferNoThrowException("widthdraw_" + extract.getId(), extract.getAccount(), extract.getName(), extract.getMoney(), remark, reason); |
| | | LogHelper.userErrorInfo("提现:支付宝通过提现成功-" + extract.getId()); |
| | | } catch (AlipayApiException e) { |
| | | LogHelper.errorDetailInfo(e, "支付宝转账异常:" + extract.getId(), ""); |
| | |
| | | } |
| | | |
| | | try { |
| | | CMQManager.getInstance().addExtractResultMsg(extract, response, adminUser); |
| | | rabbitmqManager.addExtractResultMsg(extract, response, adminUser); |
| | | LogHelper.userErrorInfo("提现:添加处理队列成功-" + extract.getId()); |
| | | } catch (Exception e) { |
| | | LogHelper |
| | |
| | | UserInfo user = extract.getUserInfo(); |
| | | // MoneyRecord moneyRecord = new MoneyRecord(user, null, extract |
| | | // .getMoney(), "提现", "提现失败", new Date().getTime(), 3); |
| | | if ("PAYER_BALANCE_NOT_ENOUGH".equals(subCode)) { |
| | | if ("PAYER_BALANCE_NOT_ENOUGH".equals(subCode) || "BALANCE_IS_NOT_ENOUGH".equals(subCode)) { |
| | | Extract updateExtract = new Extract(); |
| | | updateExtract.setId(extract.getId()); |
| | | updateExtract.setState(Constant.EXTRACT_DEFUALT); |
| | |
| | | * @param extract |
| | | * @param session |
| | | */ |
| | | @Transactional |
| | | private void extractSuccess(Extract extract, String alipayNo) { |
| | | // 老版本功能 |
| | | // List<MoneyRecord> list = moneyRecordDao.list("from MoneyRecord mr |