补充大师傅的子订单的提现时间
This commit is contained in:
parent
08b50407dd
commit
12438386bd
|
|
@ -74,6 +74,8 @@ public class AdapaySyncTimer {
|
||||||
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
||||||
JSONObject drawCash = adapayService.drawCash(deptId, orderNo, "T1", avlBalance, memberId, "提现", null);
|
JSONObject drawCash = adapayService.drawCash(deptId, orderNo, "T1", avlBalance, memberId, "提现", null);
|
||||||
log.info("Worker[{},{}]提现结果: {}", workerBank.getWorkerId(), workerBank.getName(), drawCash.toJSONString());
|
log.info("Worker[{},{}]提现结果: {}", workerBank.getWorkerId(), workerBank.getName(), drawCash.toJSONString());
|
||||||
|
} else {
|
||||||
|
log.error("Worker[{},{}]查询账户余额失败: {}", workerBank.getWorkerId(), workerBank.getName(), accountBalance.toJSONString());
|
||||||
}
|
}
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -101,6 +103,8 @@ public class AdapaySyncTimer {
|
||||||
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
||||||
JSONObject drawCash = adapayService.drawCash(deptId, orderNo, "T1", avlBalance, memberId, "提现", null);
|
JSONObject drawCash = adapayService.drawCash(deptId, orderNo, "T1", avlBalance, memberId, "提现", null);
|
||||||
log.info("Customer[{},{}]提现结果: {}", customer.getCustomerId(), customer.getName(), drawCash.toJSONString());
|
log.info("Customer[{},{}]提现结果: {}", customer.getCustomerId(), customer.getName(), drawCash.toJSONString());
|
||||||
|
} else {
|
||||||
|
log.error("Customer[{},{}]查询账户余额失败: {}", customer.getCustomerId(), customer.getName(), accountBalance.toJSONString());
|
||||||
}
|
}
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
|
|
@ -108,6 +112,9 @@ public class AdapaySyncTimer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时同步提现状态
|
||||||
|
*/
|
||||||
@Scheduled(fixedRate = 5 * 60 * 1000L)
|
@Scheduled(fixedRate = 5 * 60 * 1000L)
|
||||||
public void syncDrawCash() {
|
public void syncDrawCash() {
|
||||||
List<DrawCashRecord> records = drawCashRecordMapper.selectByStatus("pending");
|
List<DrawCashRecord> records = drawCashRecordMapper.selectByStatus("pending");
|
||||||
|
|
@ -147,7 +154,7 @@ public class AdapaySyncTimer {
|
||||||
// 更新提现记录表状态
|
// 更新提现记录表状态
|
||||||
drawCashRecordMapper.updateStatus(record.getId(), "succeeded");
|
drawCashRecordMapper.updateStatus(record.getId(), "succeeded");
|
||||||
// 更新子订单表状态
|
// 更新子订单表状态
|
||||||
orderDetailService.updateDrawCashStatus(record.getId(), 2, new Date());
|
orderDetailService.updateDrawCashStatus(record.getId(), 2, null, new Date());
|
||||||
break;
|
break;
|
||||||
// 提现失败
|
// 提现失败
|
||||||
case "F":
|
case "F":
|
||||||
|
|
@ -155,7 +162,7 @@ public class AdapaySyncTimer {
|
||||||
// 更新提现记录表状态
|
// 更新提现记录表状态
|
||||||
drawCashRecordMapper.updateStatus(record.getId(), "failed");
|
drawCashRecordMapper.updateStatus(record.getId(), "failed");
|
||||||
// 更新子订单表状态
|
// 更新子订单表状态
|
||||||
orderDetailService.updateDrawCashStatus(record.getId(), -1, null);
|
orderDetailService.updateDrawCashStatus(record.getId(), -1, null, null);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,12 @@ public interface OrderDetailMapper {
|
||||||
*
|
*
|
||||||
* @param drawCashId 发起提现后Adapay返回的对象ID
|
* @param drawCashId 发起提现后Adapay返回的对象ID
|
||||||
* @param drawCashStatus 提现状态见{@link OrderDetail#getDrawCashStatus()}
|
* @param drawCashStatus 提现状态见{@link OrderDetail#getDrawCashStatus()}
|
||||||
|
* @param drawCashTime 发起提现时间
|
||||||
* @param arrivalTime 提现到账时间
|
* @param arrivalTime 提现到账时间
|
||||||
* @return 1
|
* @return 1
|
||||||
*/
|
*/
|
||||||
int updateDrawCashStatus(@Param("drawCashId") String drawCashId, @Param("drawCashStatus") int drawCashStatus, @Param("arrivalTime") Date arrivalTime);
|
int updateDrawCashStatus(@Param("drawCashId") String drawCashId, @Param("drawCashStatus") int drawCashStatus,
|
||||||
|
@Param("drawCashTime") Date drawCashTime, @Param("arrivalTime") Date arrivalTime);
|
||||||
|
|
||||||
int deleteByMaster(Long masterId);
|
int deleteByMaster(Long masterId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -143,10 +143,11 @@ public interface OrderDetailService {
|
||||||
*
|
*
|
||||||
* @param drawCashId 发起提现后Adapay返回的对象ID
|
* @param drawCashId 发起提现后Adapay返回的对象ID
|
||||||
* @param drawCashStatus 提现状态见{@link OrderDetail#getDrawCashStatus()}
|
* @param drawCashStatus 提现状态见{@link OrderDetail#getDrawCashStatus()}
|
||||||
|
* @param drawCashTime 发起提现时间
|
||||||
* @param arrivalTime 提现到账时间
|
* @param arrivalTime 提现到账时间
|
||||||
* @return 1
|
* @return 1
|
||||||
*/
|
*/
|
||||||
int updateDrawCashStatus(String drawCashId, int drawCashStatus, Date arrivalTime);
|
int updateDrawCashStatus(String drawCashId, int drawCashStatus, Date drawCashTime, Date arrivalTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款成功时 退款回调接口里会调用这个方法
|
* 退款成功时 退款回调接口里会调用这个方法
|
||||||
|
|
|
||||||
|
|
@ -746,8 +746,8 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int updateDrawCashStatus(String drawCashId, int drawCashStatus, Date arrivalTime) {
|
public int updateDrawCashStatus(String drawCashId, int drawCashStatus, Date drawCashTime, Date arrivalTime) {
|
||||||
return orderDetailMapper.updateDrawCashStatus(drawCashId, drawCashStatus, arrivalTime);
|
return orderDetailMapper.updateDrawCashStatus(drawCashId, drawCashStatus, drawCashTime, arrivalTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,16 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
||||||
}
|
}
|
||||||
String amount = member.getAmount();
|
String amount = member.getAmount();
|
||||||
try {
|
try {
|
||||||
drawCash(orderMaster.getDeptId(), memberId, amount);
|
String drawCashId = drawCash(orderMaster.getDeptId(), memberId, amount);
|
||||||
|
|
||||||
|
if (drawCashId != null) {
|
||||||
|
// 给大师傅的子单设置提现状态和提现时间 2023/5/18
|
||||||
|
for (OrderDetail orderDetail : orderDetails) {
|
||||||
|
if (orderMaster.getWorkerId().equals(orderDetail.getWorkerId())) {
|
||||||
|
orderDetailService.updateDrawCashStatus(drawCashId, 1, new Date(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("自动发起提现失败: orderMasterId={}, memberId={}, cashAmt={}", orderMasterId, memberId, amount, e);
|
logger.error("自动发起提现失败: orderMasterId={}, memberId={}, cashAmt={}", orderMasterId, memberId, amount, e);
|
||||||
}
|
}
|
||||||
|
|
@ -321,15 +330,18 @@ public class OrderMasterServiceImpl implements OrderMasterService {
|
||||||
* @param memberId Adapay实名账户ID
|
* @param memberId Adapay实名账户ID
|
||||||
* @param amount 提现金额
|
* @param amount 提现金额
|
||||||
*/
|
*/
|
||||||
private void drawCash(Long deptId, String memberId, String amount) throws BaseAdaPayException {
|
private String drawCash(Long deptId, String memberId, String amount) throws BaseAdaPayException {
|
||||||
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
String orderNo = AdapayUtils.createOrderNo(AdapayOrderType.DRAW_CASH);
|
||||||
JSONObject response = adapayService.drawCash(deptId, orderNo, "T1", amount, memberId, "订单结算", null);
|
JSONObject response = adapayService.drawCash(deptId, orderNo, "T1", amount, memberId, "订单结算", null);
|
||||||
|
|
||||||
boolean status = AdapayStatusEnum.pending.code.equals(response.getString("status")) ||
|
boolean status = AdapayStatusEnum.pending.code.equals(response.getString("status")) ||
|
||||||
AdapayStatusEnum.succeeded.code.equals(response.getString("status"));
|
AdapayStatusEnum.succeeded.code.equals(response.getString("status"));
|
||||||
if (!status) {
|
if (status) {
|
||||||
|
return response.getString("id");
|
||||||
|
} else {
|
||||||
//如果提现失败 把信息记录到error日志里
|
//如果提现失败 把信息记录到error日志里
|
||||||
logger.error("提现失败: deptId={}, memberId={}, amount={}, 失败原因:{}", deptId, memberId, amount, response.getString("error_msg"));
|
logger.error("提现失败: deptId={}, memberId={}, amount={}, 失败原因:{}", deptId, memberId, amount, response.getString("error_msg"));
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -392,9 +392,12 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updateDrawCashStatus">
|
<update id="updateDrawCashStatus">
|
||||||
UPDATE order_detail
|
UPDATE order_detail SET
|
||||||
SET draw_cash_status = #{drawCashStatus},
|
<if test="drawCashId != null">draw_cash_id = #{drawCashId},</if>
|
||||||
arrival_time = #{arrivalTime}
|
<if test="drawCashTime != null">draw_cash_time = #{drawCashTime},</if>
|
||||||
|
<if test="arrivalTime != null">arrival_time = #{arrivalTime},</if>
|
||||||
|
<if test="drawCashStatus != null">draw_cash_status = #{drawCashStatus},</if>
|
||||||
|
update_time = NOW()
|
||||||
WHERE draw_cash_id = #{drawCashId}
|
WHERE draw_cash_id = #{drawCashId}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue