Compare commits
	
		
			2 Commits
		
	
	
		
			3edcc599e8
			...
			8932587bac
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8932587bac | |||
| 150b2b7c9a | 
| 
						 | 
				
			
			@ -12,7 +12,8 @@ import lombok.Getter;
 | 
			
		|||
public enum RedisLockKey {
 | 
			
		||||
 | 
			
		||||
    DEDUCTION("deduction", "押金抵扣"),
 | 
			
		||||
    EDITPRICE("editPrice", "改价");
 | 
			
		||||
    EDITPRICE("editPrice", "改价"),
 | 
			
		||||
    PAYCALLBACK("payCallback", "支付回调");
 | 
			
		||||
 | 
			
		||||
    private final String key;
 | 
			
		||||
    private final String name;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,7 @@ public class EtWithdraw extends BaseEntity
 | 
			
		|||
 | 
			
		||||
    /** 微信openid */
 | 
			
		||||
    @Excel(name = "微信openid")
 | 
			
		||||
    private String wxopenid;
 | 
			
		||||
    private String wxOpenid;
 | 
			
		||||
 | 
			
		||||
    /** 回调状态 */
 | 
			
		||||
    @Excel(name = "回调状态")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -13,6 +13,8 @@ import com.ruoyi.common.core.domain.entity.AsUser;
 | 
			
		|||
import com.ruoyi.common.core.domain.entity.SysDept;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.common.core.redis.RedisCache;
 | 
			
		||||
import com.ruoyi.common.core.redis.RedisLock;
 | 
			
		||||
import com.ruoyi.common.core.redis.enums.RedisLockKey;
 | 
			
		||||
import com.ruoyi.common.exception.ServiceException;
 | 
			
		||||
import com.ruoyi.common.pay.wx.domain.NotifyEventType;
 | 
			
		||||
import com.ruoyi.common.utils.*;
 | 
			
		||||
| 
						 | 
				
			
			@ -141,10 +143,12 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
    @Value("${aliyun.templateCode2}")
 | 
			
		||||
    private String templateCode2;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private EtMsgLogMapper etMsgLogMapper;
 | 
			
		||||
 | 
			
		||||
    @Autowired
 | 
			
		||||
    private RedisLock redisLock;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 微信支付回调
 | 
			
		||||
| 
						 | 
				
			
			@ -183,9 +187,21 @@ public class CallbackServiceImpl implements CallbackService {
 | 
			
		|||
    public void businessHandle(String outTradeNo,AttachVo attachVo,String payType) {
 | 
			
		||||
        // 充值成功后的业务处理
 | 
			
		||||
        EtOrder order = orderService.selectEtOrderByOutTradeNo(outTradeNo);
 | 
			
		||||
        String orderNo = order.getOrderNo();
 | 
			
		||||
        if(order.getPaid().equals(ServiceConstants.ORDER_PAY_STATUS_PAID)){
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        // 加锁
 | 
			
		||||
        ServiceUtil.assertion(!redisLock.lock(RedisLockKey.PAYCALLBACK, orderNo), "当前订单正在支付,请稍后再试!");
 | 
			
		||||
        try {
 | 
			
		||||
            busHandle(order, attachVo, payType);
 | 
			
		||||
        } finally {
 | 
			
		||||
            // 解锁
 | 
			
		||||
            redisLock.unlock(RedisLockKey.PAYCALLBACK, orderNo);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private void busHandle(EtOrder order, AttachVo attachVo, String payType) {
 | 
			
		||||
        EtOrder order1 = new EtOrder();
 | 
			
		||||
        order1.setOrderId(order.getOrderId());
 | 
			
		||||
        logger.info("【支付回调】订单信息 : {}", JSON.toJSONString(order));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
 | 
			
		|||
        }
 | 
			
		||||
        AsUser asUser = asUserMapper.selectUserById(user.getAppUserId());
 | 
			
		||||
        log.info("获取到app用户:{}", JSON.toJSON(asUser));
 | 
			
		||||
        etWithdraw.setWxopenid(asUser.getWxOpenid());
 | 
			
		||||
        etWithdraw.setWxOpenid(asUser.getWxOpenid());
 | 
			
		||||
        etWithdraw.setStatus(ServiceConstants.WITHDRAW_STATUS_APPLY);
 | 
			
		||||
        return etWithdrawMapper.insertEtWithdraw(etWithdraw);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ public class EtWithdrawServiceImpl implements IEtWithdrawService
 | 
			
		|||
            transferDetailInput.setOutDetailNo(IdUtils.getOrderNo("txd"));//明细订单号
 | 
			
		||||
            transferDetailInput.setTransferAmount(etWithdraw.getAmount().multiply(new BigDecimal(100)).longValue());
 | 
			
		||||
            transferDetailInput.setTransferRemark(sysDept.getDeptName()+"共享电动车提现");
 | 
			
		||||
            transferDetailInput.setOpenid(etWithdraw.getWxopenid());
 | 
			
		||||
            transferDetailInput.setOpenid(etWithdraw.getWxOpenid());
 | 
			
		||||
            transferDetailInputs.add(transferDetailInput);
 | 
			
		||||
            log.info("【审核通过】发起转账到零钱:{}",JSON.toJSONString(transferDetailInputs));
 | 
			
		||||
            // todo 暂时先不发起真实提现  真正的提现是
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -136,7 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
 | 
			
		||||
	<select id="selectUserByWxOpenid" parameterType="String" resultMap="AsUserResult">
 | 
			
		||||
		<include refid="selectUserVo"/>
 | 
			
		||||
		where u.wxopenid = #{openid}
 | 
			
		||||
		where u.wxOpenid = #{openid}
 | 
			
		||||
	</select>
 | 
			
		||||
 | 
			
		||||
	<select id="selectUserByAliOpenid" parameterType="String" resultMap="AsUserResult">
 | 
			
		||||
| 
						 | 
				
			
			@ -229,7 +229,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
 			<if test="status != null and status != ''">#{status},</if>
 | 
			
		||||
 			<if test="createBy != null and createBy != ''">#{createBy},</if>
 | 
			
		||||
 			<if test="remark != null and remark != ''">#{remark},</if>
 | 
			
		||||
 			<if test="wxOpenid != null and wxOpenid != ''">#{wxopenid},</if>
 | 
			
		||||
 			<if test="wxOpenid != null and wxOpenid != ''">#{wxOpenid},</if>
 | 
			
		||||
 		    <if test="aliOpenid != null and aliOpenid != ''">#{aliOpenid},</if>
 | 
			
		||||
 			<if test="role != null and role != ''">#{role},</if>
 | 
			
		||||
		    <if test="sysRole != null and sysRole != ''">#{sysRole},</if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
        <result property="deptId"    column="dept_id"    />
 | 
			
		||||
        <result property="status"    column="status"    />
 | 
			
		||||
        <result property="applicant"    column="applicant"    />
 | 
			
		||||
        <result property="wxopenid"    column="wxopenid"    />
 | 
			
		||||
        <result property="wxOpenid"    column="wxopenid"    />
 | 
			
		||||
        <result property="createTime"    column="create_time"    />
 | 
			
		||||
        <result property="callStatus"    column="call_status"    />
 | 
			
		||||
        <result property="rejectReason"    column="reject_reason"    />
 | 
			
		||||
| 
						 | 
				
			
			@ -44,7 +44,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="deptId != null">dept_id,</if>
 | 
			
		||||
            <if test="status != null">status,</if>
 | 
			
		||||
            <if test="applicant != null">applicant,</if>
 | 
			
		||||
            <if test="wxopenid != null">wxopenid,</if>
 | 
			
		||||
            <if test="wxOpenid != null">wxopenid,</if>
 | 
			
		||||
            <if test="createTime != null">create_time,</if>
 | 
			
		||||
            <if test="callStatus != null">call_status,</if>
 | 
			
		||||
            <if test="rejectReason != null">reject_reason,</if>
 | 
			
		||||
| 
						 | 
				
			
			@ -55,7 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="deptId != null">#{deptId},</if>
 | 
			
		||||
            <if test="status != null">#{status},</if>
 | 
			
		||||
            <if test="applicant != null">#{applicant},</if>
 | 
			
		||||
            <if test="wxopenid != null">#{wxopenid},</if>
 | 
			
		||||
            <if test="wxOpenid != null">#{wxopenid},</if>
 | 
			
		||||
            <if test="createTime != null">#{createTime},</if>
 | 
			
		||||
            <if test="callStatus != null">#{callStatus},</if>
 | 
			
		||||
            <if test="rejectReason != null">#{rejectReason},</if>
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 | 
			
		|||
            <if test="deptId != null">dept_id = #{deptId},</if>
 | 
			
		||||
            <if test="status != null">status = #{status},</if>
 | 
			
		||||
            <if test="applicant != null">applicant = #{applicant},</if>
 | 
			
		||||
            <if test="wxopenid != null">wxopenid = #{wxopenid},</if>
 | 
			
		||||
            <if test="wxOpenid != null">wxopenid = #{wxopenid},</if>
 | 
			
		||||
            <if test="createTime != null">create_time = #{createTime},</if>
 | 
			
		||||
            <if test="callStatus != null">call_status = #{callStatus},</if>
 | 
			
		||||
            <if test="rejectReason != null">reject_reason = #{rejectReason},</if>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user