admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java
@@ -13,7 +13,9 @@
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;
@@ -147,6 +149,9 @@
    @Resource
    private CommonOrderCountService commonOrderCountService;
    @Resource
    private RabbitmqManager rabbitmqManager;
    @Transactional
    public Integer addExtract(Extract extract) {
@@ -348,7 +353,6 @@
     * @param extract
     * @param session
     */
    @Transactional
    private void transfer(Extract extract, AdminUser adminUser) {
        Integer type = extract.getType();
        if (Constant.ZHIFUBAO == type) {
@@ -405,6 +409,15 @@
        return 0;
    }
    private String getOrderPrefix(SystemEnum system) {
        if (system == SystemEnum.yhqjx) {
            return "TJ";
        } else if (system == SystemEnum.hsb) {
            return "HSB";
        }
        return "";
    }
    /**
     * 提现到支付宝
     *
@@ -412,12 +425,19 @@
     * @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(), "");
@@ -425,7 +445,7 @@
        }
        try {
            CMQManager.getInstance().addExtractResultMsg(extract, response, adminUser);
            rabbitmqManager.addExtractResultMsg(extract, response, adminUser);
            LogHelper.userErrorInfo("提现:添加处理队列成功-" + extract.getId());
        } catch (Exception e) {
            LogHelper
@@ -443,7 +463,7 @@
        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);
@@ -497,7 +517,6 @@
     * @param extract
     * @param session
     */
    @Transactional
    private void extractSuccess(Extract extract, String alipayNo) {
        // 老版本功能
        // List<MoneyRecord> list = moneyRecordDao.list("from MoneyRecord mr