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