mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-22 16:19:52 +08:00
update 分账task
This commit is contained in:
@@ -99,6 +99,11 @@ public class AdapayUnsplitRecord {
|
|||||||
*/
|
*/
|
||||||
private String splitFlag;
|
private String splitFlag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分账备注(记录分账成功/失败/跳过的原因或说明)
|
||||||
|
*/
|
||||||
|
private String splitRemark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
@@ -123,6 +128,7 @@ public class AdapayUnsplitRecord {
|
|||||||
.append("settleAmount", settleAmount)
|
.append("settleAmount", settleAmount)
|
||||||
.append("refundFlag", refundFlag)
|
.append("refundFlag", refundFlag)
|
||||||
.append("splitFlag", splitFlag)
|
.append("splitFlag", splitFlag)
|
||||||
|
.append("splitRemark", splitRemark)
|
||||||
.append("updateTime", updateTime)
|
.append("updateTime", updateTime)
|
||||||
.toString();
|
.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,14 @@
|
|||||||
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount" />
|
<result column="settle_amount" jdbcType="DECIMAL" property="settleAmount" />
|
||||||
<result column="refund_flag" jdbcType="VARCHAR" property="refundFlag" />
|
<result column="refund_flag" jdbcType="VARCHAR" property="refundFlag" />
|
||||||
<result column="split_flag" jdbcType="VARCHAR" property="splitFlag" />
|
<result column="split_flag" jdbcType="VARCHAR" property="splitFlag" />
|
||||||
|
<result column="split_remark" jdbcType="VARCHAR" property="splitRemark" />
|
||||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, merchant_code, pay_time, payment_id, order_no, pay_amount, confirmed_split_amount,
|
id, merchant_code, pay_time, payment_id, order_no, pay_amount, confirmed_split_amount,
|
||||||
refund_amount, payment_revoke_amount, remaining_split_amount, order_code, pile_type,
|
refund_amount, payment_revoke_amount, remaining_split_amount, order_code, pile_type,
|
||||||
due_refund_amount, settle_amount, refund_flag, split_flag, update_time
|
due_refund_amount, settle_amount, refund_flag, split_flag, split_remark, update_time
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
@@ -451,7 +452,7 @@
|
|||||||
insert into adapay_unsplit_record
|
insert into adapay_unsplit_record
|
||||||
(merchant_code, pay_time, payment_id, order_no, pay_amount, confirmed_split_amount,
|
(merchant_code, pay_time, payment_id, order_no, pay_amount, confirmed_split_amount,
|
||||||
refund_amount, payment_revoke_amount, remaining_split_amount, order_code, pile_type,
|
refund_amount, payment_revoke_amount, remaining_split_amount, order_code, pile_type,
|
||||||
due_refund_amount, settle_amount, refund_flag, split_flag, update_time)
|
due_refund_amount, settle_amount, refund_flag, split_flag, split_remark, update_time)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
(#{item.merchantCode,jdbcType=VARCHAR}, #{item.payTime,jdbcType=TIMESTAMP}, #{item.paymentId,jdbcType=VARCHAR},
|
(#{item.merchantCode,jdbcType=VARCHAR}, #{item.payTime,jdbcType=TIMESTAMP}, #{item.paymentId,jdbcType=VARCHAR},
|
||||||
@@ -459,7 +460,8 @@
|
|||||||
#{item.refundAmount,jdbcType=DECIMAL}, #{item.paymentRevokeAmount,jdbcType=DECIMAL},
|
#{item.refundAmount,jdbcType=DECIMAL}, #{item.paymentRevokeAmount,jdbcType=DECIMAL},
|
||||||
#{item.remainingSplitAmount,jdbcType=DECIMAL}, #{item.orderCode,jdbcType=VARCHAR},
|
#{item.remainingSplitAmount,jdbcType=DECIMAL}, #{item.orderCode,jdbcType=VARCHAR},
|
||||||
#{item.pileType,jdbcType=VARCHAR}, #{item.dueRefundAmount,jdbcType=DECIMAL}, #{item.settleAmount,jdbcType=DECIMAL},
|
#{item.pileType,jdbcType=VARCHAR}, #{item.dueRefundAmount,jdbcType=DECIMAL}, #{item.settleAmount,jdbcType=DECIMAL},
|
||||||
#{item.refundFlag,jdbcType=VARCHAR}, #{item.splitFlag,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP})
|
#{item.refundFlag,jdbcType=VARCHAR}, #{item.splitFlag,jdbcType=VARCHAR}, #{item.splitRemark,jdbcType=VARCHAR},
|
||||||
|
#{item.updateTime,jdbcType=TIMESTAMP})
|
||||||
</foreach>
|
</foreach>
|
||||||
on duplicate key update
|
on duplicate key update
|
||||||
merchant_code = values(merchant_code),
|
merchant_code = values(merchant_code),
|
||||||
@@ -611,6 +613,9 @@
|
|||||||
<if test="splitFlag != null">
|
<if test="splitFlag != null">
|
||||||
split_flag,
|
split_flag,
|
||||||
</if>
|
</if>
|
||||||
|
<if test="splitRemark != null">
|
||||||
|
split_remark,
|
||||||
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time,
|
update_time,
|
||||||
</if>
|
</if>
|
||||||
@@ -665,6 +670,9 @@
|
|||||||
<if test="splitFlag != null">
|
<if test="splitFlag != null">
|
||||||
#{splitFlag,jdbcType=VARCHAR},
|
#{splitFlag,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="splitRemark != null">
|
||||||
|
#{splitRemark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
#{updateTime,jdbcType=TIMESTAMP},
|
#{updateTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
@@ -719,6 +727,9 @@
|
|||||||
<if test="splitFlag != null">
|
<if test="splitFlag != null">
|
||||||
split_flag = #{splitFlag,jdbcType=VARCHAR},
|
split_flag = #{splitFlag,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="splitRemark != null">
|
||||||
|
split_remark = #{splitRemark,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="updateTime != null">
|
||||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -497,14 +497,14 @@ public class JsowellTask {
|
|||||||
failed++;
|
failed++;
|
||||||
log.error("处理未分账数据到默认账户异常, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
log.error("处理未分账数据到默认账户异常, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
||||||
paymentId, orderCode, confirmAmt, e);
|
paymentId, orderCode, confirmAmt, e);
|
||||||
markSplitResult(paymentId, "FAILED");
|
markSplitResult(paymentId, "FAILED", "请求异常: " + e.getMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response != null && response.isSuccess()) {
|
if (response != null && response.isSuccess()) {
|
||||||
success++;
|
success++;
|
||||||
updateConfirmedSplitAmount(item, confirmAmt, paymentId);
|
updateConfirmedSplitAmount(item, confirmAmt, paymentId);
|
||||||
markSplitResult(paymentId, "SUCCESS");
|
markSplitResult(paymentId, "SUCCESS", "分账金额: " + confirmAmt.toPlainString());
|
||||||
log.info("处理未分账数据成功, paymentId:{}, orderCode:{}, confirmAmt:{}, response:{}",
|
log.info("处理未分账数据成功, paymentId:{}, orderCode:{}, confirmAmt:{}, response:{}",
|
||||||
paymentId, orderCode, confirmAmt, JSON.toJSONString(response));
|
paymentId, orderCode, confirmAmt, JSON.toJSONString(response));
|
||||||
} else {
|
} else {
|
||||||
@@ -513,7 +513,7 @@ public class JsowellTask {
|
|||||||
String errorMsg = response == null ? "response_is_null" : response.getError_msg();
|
String errorMsg = response == null ? "response_is_null" : response.getError_msg();
|
||||||
log.error("处理未分账数据失败, paymentId:{}, orderCode:{}, confirmAmt:{}, errorCode:{}, errorMsg:{}",
|
log.error("处理未分账数据失败, paymentId:{}, orderCode:{}, confirmAmt:{}, errorCode:{}, errorMsg:{}",
|
||||||
paymentId, orderCode, confirmAmt, errorCode, errorMsg);
|
paymentId, orderCode, confirmAmt, errorCode, errorMsg);
|
||||||
markSplitResult(paymentId, "FAILED");
|
markSplitResult(paymentId, "FAILED", errorCode + ": " + errorMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,6 +605,7 @@ public class JsowellTask {
|
|||||||
if (confirmAmt.compareTo(BigDecimal.ZERO) <= 0) {
|
if (confirmAmt.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
skipped.incrementAndGet();
|
skipped.incrementAndGet();
|
||||||
log.info("[processUnsplitRecordBatch] 可分账金额为0,跳过, paymentId:{}, orderCode:{}", paymentId, orderCode);
|
log.info("[processUnsplitRecordBatch] 可分账金额为0,跳过, paymentId:{}, orderCode:{}", paymentId, orderCode);
|
||||||
|
markSplitResult(paymentId, "SKIPPED", "可分账金额为0");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,14 +629,14 @@ public class JsowellTask {
|
|||||||
failed.incrementAndGet();
|
failed.incrementAndGet();
|
||||||
log.error("[processUnsplitRecordBatch] 发起分账请求异常, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
log.error("[processUnsplitRecordBatch] 发起分账请求异常, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
||||||
paymentId, orderCode, confirmAmt, e);
|
paymentId, orderCode, confirmAmt, e);
|
||||||
markSplitResult(paymentId, "FAILED");
|
markSplitResult(paymentId, "FAILED", "请求异常: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response != null && response.isSuccess()) {
|
if (response != null && response.isSuccess()) {
|
||||||
success.incrementAndGet();
|
success.incrementAndGet();
|
||||||
updateConfirmedSplitAmount(item, confirmAmt, paymentId);
|
updateConfirmedSplitAmount(item, confirmAmt, paymentId);
|
||||||
markSplitResult(paymentId, "SUCCESS");
|
markSplitResult(paymentId, "SUCCESS", "分账金额: " + confirmAmt.toPlainString());
|
||||||
log.info("[processUnsplitRecordBatch] 分账成功, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
log.info("[processUnsplitRecordBatch] 分账成功, paymentId:{}, orderCode:{}, confirmAmt:{}",
|
||||||
paymentId, orderCode, confirmAmt);
|
paymentId, orderCode, confirmAmt);
|
||||||
} else {
|
} else {
|
||||||
@@ -644,7 +645,7 @@ public class JsowellTask {
|
|||||||
String errorMsg = response == null ? "response_is_null" : response.getError_msg();
|
String errorMsg = response == null ? "response_is_null" : response.getError_msg();
|
||||||
log.error("[processUnsplitRecordBatch] 分账失败, paymentId:{}, orderCode:{}, confirmAmt:{}, errorCode:{}, errorMsg:{}",
|
log.error("[processUnsplitRecordBatch] 分账失败, paymentId:{}, orderCode:{}, confirmAmt:{}, errorCode:{}, errorMsg:{}",
|
||||||
paymentId, orderCode, confirmAmt, errorCode, errorMsg);
|
paymentId, orderCode, confirmAmt, errorCode, errorMsg);
|
||||||
markSplitResult(paymentId, "FAILED");
|
markSplitResult(paymentId, "FAILED", errorCode + ": " + errorMsg);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
).get();
|
).get();
|
||||||
@@ -928,10 +929,11 @@ public class JsowellTask {
|
|||||||
adapayUnsplitRecordService.insertOrUpdateSelective(updateRecord);
|
adapayUnsplitRecordService.insertOrUpdateSelective(updateRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markSplitResult(String paymentId, String splitFlag) {
|
private void markSplitResult(String paymentId, String splitFlag, String splitRemark) {
|
||||||
AdapayUnsplitRecord updateRecord = new AdapayUnsplitRecord();
|
AdapayUnsplitRecord updateRecord = new AdapayUnsplitRecord();
|
||||||
updateRecord.setPaymentId(paymentId);
|
updateRecord.setPaymentId(paymentId);
|
||||||
updateRecord.setSplitFlag(splitFlag);
|
updateRecord.setSplitFlag(splitFlag);
|
||||||
|
updateRecord.setSplitRemark(splitRemark);
|
||||||
updateRecord.setUpdateTime(DateUtils.getNowDate());
|
updateRecord.setUpdateTime(DateUtils.getNowDate());
|
||||||
adapayUnsplitRecordService.insertOrUpdateSelective(updateRecord);
|
adapayUnsplitRecordService.insertOrUpdateSelective(updateRecord);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user