mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-05-04 18:10:10 +08:00
优化清分账单逻辑
This commit is contained in:
@@ -2,7 +2,6 @@ package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.ClearingBillInfo;
|
||||
import com.jsowell.pile.dto.GetClearingBillDTO;
|
||||
import com.jsowell.pile.vo.web.ClearingBillVO;
|
||||
import com.jsowell.pile.vo.web.MerchantClearingBillVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -25,6 +24,10 @@ public interface ClearingBillInfoMapper {
|
||||
*/
|
||||
int insert(ClearingBillInfo record);
|
||||
|
||||
int insertOrUpdate(ClearingBillInfo record);
|
||||
|
||||
int insertOrUpdateSelective(ClearingBillInfo record);
|
||||
|
||||
/**
|
||||
* insert record to table selective
|
||||
*
|
||||
@@ -57,12 +60,19 @@ public interface ClearingBillInfoMapper {
|
||||
*/
|
||||
int updateByPrimaryKey(ClearingBillInfo record);
|
||||
|
||||
int updateBatch(List<ClearingBillInfo> list);
|
||||
|
||||
int updateBatchSelective(List<ClearingBillInfo> list);
|
||||
|
||||
int batchInsert(@Param("list") List<ClearingBillInfo> list);
|
||||
|
||||
List<ClearingBillInfo> selectByMerchantId(@Param("merchantId") String merchantId, @Param("billStatus") String billStatus);
|
||||
|
||||
void updateStatus(@Param("clearingBillIds") List<Integer> clearingBillIds, @Param("billStatus") String billStatus);
|
||||
|
||||
/**
|
||||
* 后管用 查询运营商账单列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.jsowell.pile.vo.web.MerchantClearingBillVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ClearingBillInfoService{
|
||||
public interface ClearingBillInfoService {
|
||||
|
||||
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
@@ -27,8 +27,20 @@ public interface ClearingBillInfoService{
|
||||
|
||||
/**
|
||||
* 后管用 查询运营商账单列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<MerchantClearingBillVO> getMerchantClearingBillList(GetClearingBillDTO dto);
|
||||
|
||||
int insertOrUpdate(ClearingBillInfo record);
|
||||
|
||||
int insertOrUpdateSelective(ClearingBillInfo record);
|
||||
|
||||
int updateBatch(List<ClearingBillInfo> list);
|
||||
|
||||
int updateBatchSelective(List<ClearingBillInfo> list);
|
||||
|
||||
int batchInsert(List<ClearingBillInfo> list);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class ClearingBillInfoServiceImpl implements ClearingBillInfoService{
|
||||
public class ClearingBillInfoServiceImpl implements ClearingBillInfoService {
|
||||
|
||||
@Resource
|
||||
private ClearingBillInfoMapper clearingBillInfoMapper;
|
||||
@@ -63,6 +63,7 @@ public class ClearingBillInfoServiceImpl implements ClearingBillInfoService{
|
||||
|
||||
/**
|
||||
* 后管用 查询运营商账单列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@@ -71,4 +72,29 @@ public class ClearingBillInfoServiceImpl implements ClearingBillInfoService{
|
||||
return clearingBillInfoMapper.getMerchantClearingBillList(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertOrUpdate(ClearingBillInfo record) {
|
||||
return clearingBillInfoMapper.insertOrUpdate(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertOrUpdateSelective(ClearingBillInfo record) {
|
||||
return clearingBillInfoMapper.insertOrUpdateSelective(record);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBatch(List<ClearingBillInfo> list) {
|
||||
return clearingBillInfoMapper.updateBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBatchSelective(List<ClearingBillInfo> list) {
|
||||
return clearingBillInfoMapper.updateBatchSelective(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<ClearingBillInfo> list) {
|
||||
return clearingBillInfoMapper.batchInsert(list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1465,27 +1465,34 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
// 获取余额支付扣除金额 也许存在一笔不够扣,需要扣多笔的情况
|
||||
List<BalanceDeductionAmountVO> list = calculateSplitTheBillAmount(orderBasicInfo.getMemberId(), settleAmount);
|
||||
for (BalanceDeductionAmountVO vo : list) {
|
||||
String paymentId = vo.getPaymentId();
|
||||
BigDecimal deductionAmount = vo.getDeductionAmount();
|
||||
List<String> collect = list.stream().map(BalanceDeductionAmountVO::getPaymentId).collect(Collectors.toList());
|
||||
// 校验是否分账
|
||||
OrderSettleResult result = verifyOrderConfirmAmount(collect, orderCode, settleAmount, wechatAppId);
|
||||
if (!AdapayStatusEnum.SUCCEEDED.getValue().equals(result.getStatus())) {
|
||||
// 没有分账,执行分账逻辑
|
||||
for (BalanceDeductionAmountVO vo : list) {
|
||||
String paymentId = vo.getPaymentId();
|
||||
BigDecimal deductionAmount = vo.getDeductionAmount();
|
||||
|
||||
// 延时分账,使用确认交易API
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, deductionAmount, orderCode, wechatAppId);
|
||||
// 延时分账,使用确认交易API
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, deductionAmount, orderCode, wechatAppId);
|
||||
|
||||
if (paymentConfirmResponse != null && paymentConfirmResponse.isNotFailed()) {
|
||||
confirmAmt = confirmAmt.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
||||
feeAmt = feeAmt.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
status = paymentConfirmResponse.getStatus();
|
||||
memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount(paymentId, confirmAmt, confirmAmt);
|
||||
if (paymentConfirmResponse != null && paymentConfirmResponse.isNotFailed()) {
|
||||
confirmAmt = confirmAmt.add(new BigDecimal(paymentConfirmResponse.getConfirm_amt()));
|
||||
feeAmt = feeAmt.add(new BigDecimal(paymentConfirmResponse.getFee_amt()));
|
||||
status = paymentConfirmResponse.getStatus();
|
||||
memberAdapayRecordService.unfreezeAmountAndUpdateSpendAmount(paymentId, confirmAmt, confirmAmt);
|
||||
}
|
||||
}
|
||||
|
||||
// 分账接口返回的信息
|
||||
result = new OrderSettleResult();
|
||||
result.setConfirmAmt(confirmAmt.toString());
|
||||
result.setStatus(status);
|
||||
result.setFeeAmt(feeAmt.toString());
|
||||
}
|
||||
|
||||
// 分账接口返回的信息
|
||||
OrderSettleResult result = new OrderSettleResult();
|
||||
result.setConfirmAmt(confirmAmt.toString());
|
||||
result.setStatus(status);
|
||||
result.setFeeAmt(feeAmt.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1592,15 +1599,69 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
// 订单结算金额
|
||||
BigDecimal settleAmount = orderBasicInfo.getSettleAmount();
|
||||
|
||||
// 调汇付的分账接口 确认交易
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, settleAmount, orderCode, wechatAppId);
|
||||
OrderSettleResult result = verifyOrderConfirmAmount(Lists.newArrayList(paymentId), orderCode, settleAmount, wechatAppId);
|
||||
|
||||
// 校验订单是否分账 状态为非交易完成的时候,进行分账处理
|
||||
if (!AdapayStatusEnum.SUCCEEDED.getValue().equals(result.getStatus())) {
|
||||
// 调汇付的分账接口 确认交易
|
||||
PaymentConfirmResponse paymentConfirmResponse = adapayService.createPaymentConfirmRequest(paymentId,
|
||||
adapayMemberAccount, settleAmount, orderCode, wechatAppId);
|
||||
|
||||
// 分账接口返回的信息
|
||||
result = new OrderSettleResult();
|
||||
result.setConfirmAmt(paymentConfirmResponse.getConfirm_amt());
|
||||
result.setStatus(paymentConfirmResponse.getStatus());
|
||||
result.setFeeAmt(paymentConfirmResponse.getFee_amt());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验订单分账金额
|
||||
* @param paymentIds 支付id集合
|
||||
* @param orderCode 订单编号
|
||||
* @param settleAmount 结算金额
|
||||
*/
|
||||
private OrderSettleResult verifyOrderConfirmAmount(List<String> paymentIds, String orderCode, BigDecimal settleAmount, String wechatAppId) {
|
||||
// 分账金额
|
||||
BigDecimal confirmAmt = BigDecimal.ZERO;
|
||||
// 手续费
|
||||
BigDecimal feeAmt = BigDecimal.ZERO;
|
||||
// 通过支付id查询分账情况
|
||||
for (String paymentId : paymentIds) {
|
||||
QueryPaymentConfirmDTO dto = new QueryPaymentConfirmDTO();
|
||||
dto.setPaymentId(paymentId);
|
||||
dto.setWechatAppId(wechatAppId);
|
||||
QueryPaymentConfirmDetailResponse response = adapayService.queryPaymentConfirmList(dto);
|
||||
if (response != null) {
|
||||
List<QueryPaymentConfirmDetailResponse.PaymentConfirmInfo> confirms = response.getPaymentConfirms();
|
||||
if (CollectionUtils.isNotEmpty(confirms)) {
|
||||
for (QueryPaymentConfirmDetailResponse.PaymentConfirmInfo confirm : confirms) {
|
||||
JSONObject jsonObject = JSON.parseObject(confirm.getDescription());
|
||||
if (StringUtils.equals(jsonObject.getString("orderCode"), orderCode)) {
|
||||
// 订单号对的上,累计分账金额
|
||||
confirmAmt = confirmAmt.add(new BigDecimal(confirm.getConfirmAmt()));
|
||||
feeAmt = feeAmt.add(new BigDecimal(confirm.getFeeAmt()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 分账接口返回的信息
|
||||
OrderSettleResult result = new OrderSettleResult();
|
||||
result.setConfirmAmt(paymentConfirmResponse.getConfirm_amt());
|
||||
result.setStatus(paymentConfirmResponse.getStatus());
|
||||
result.setFeeAmt(paymentConfirmResponse.getFee_amt());
|
||||
result.setOrderCode(orderCode);
|
||||
result.setSettleAmt(settleAmount.toString());
|
||||
result.setConfirmAmt(confirmAmt.toString());
|
||||
result.setFeeAmt(feeAmt.toString());
|
||||
String status;
|
||||
// 如果确认金额和结算金额相等,返回succeeded,其他情况返回PENDING
|
||||
if (settleAmount.compareTo(confirmAmt) >= 0) {
|
||||
// 返回succeeded 标识该笔订单已经完成了分账,不要再次执行分账
|
||||
status = AdapayStatusEnum.SUCCEEDED.getValue();
|
||||
} else {
|
||||
status = AdapayStatusEnum.PENDING.getValue();
|
||||
}
|
||||
result.setStatus(status);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -248,6 +248,494 @@
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateBatch" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update clearing_bill_info
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="bill_status = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.billStatus,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="trade_date = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.tradeDate,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="clearing_bill_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingBillCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="clearing_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_source = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.orderSource,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="receivable_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.receivableAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="should_clearing_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.shouldClearingAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="actual_clearing_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.actualClearingAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="fee_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.feeAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="withdrawable_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawableAmount,jdbcType=DECIMAL}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="withdraw_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawCode,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
<update id="updateBatchSelective" parameterType="java.util.List">
|
||||
<!--@mbg.generated-->
|
||||
update clearing_bill_info
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<trim prefix="bill_status = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.billStatus != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.billStatus,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="trade_date = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.tradeDate != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.tradeDate,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="clearing_bill_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.clearingBillCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingBillCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="clearing_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.clearingTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.clearingTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="merchant_id = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.merchantId != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.merchantId,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="order_source = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.orderSource != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.orderSource,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="receivable_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.receivableAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.receivableAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="should_clearing_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.shouldClearingAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.shouldClearingAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="actual_clearing_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.actualClearingAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.actualClearingAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="fee_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.feeAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.feeAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="withdrawable_amount = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.withdrawableAmount != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawableAmount,jdbcType=DECIMAL}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="withdraw_code = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.withdrawCode != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.withdrawCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="create_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.createTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_by = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateBy != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateBy,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="update_time = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.updateTime != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
<trim prefix="del_flag = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.delFlag != null">
|
||||
when id = #{item.id,jdbcType=INTEGER} then #{item.delFlag,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</foreach>
|
||||
</trim>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach close=")" collection="list" item="item" open="(" separator=", ">
|
||||
#{item.id,jdbcType=INTEGER}
|
||||
</foreach>
|
||||
</update>
|
||||
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into clearing_bill_info
|
||||
(bill_status, trade_date, clearing_bill_code, clearing_time, merchant_id, order_source,
|
||||
receivable_amount, should_clearing_amount, actual_clearing_amount, fee_amount,
|
||||
withdrawable_amount, withdraw_code, create_by, create_time, update_by, update_time,
|
||||
del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.billStatus,jdbcType=VARCHAR}, #{item.tradeDate,jdbcType=VARCHAR}, #{item.clearingBillCode,jdbcType=VARCHAR},
|
||||
#{item.clearingTime,jdbcType=TIMESTAMP}, #{item.merchantId,jdbcType=VARCHAR}, #{item.orderSource,jdbcType=VARCHAR},
|
||||
#{item.receivableAmount,jdbcType=DECIMAL}, #{item.shouldClearingAmount,jdbcType=DECIMAL},
|
||||
#{item.actualClearingAmount,jdbcType=DECIMAL}, #{item.feeAmount,jdbcType=DECIMAL},
|
||||
#{item.withdrawableAmount,jdbcType=DECIMAL}, #{item.withdrawCode,jdbcType=VARCHAR},
|
||||
#{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR},
|
||||
#{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=VARCHAR})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ClearingBillInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into clearing_bill_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
bill_status,
|
||||
trade_date,
|
||||
clearing_bill_code,
|
||||
clearing_time,
|
||||
merchant_id,
|
||||
order_source,
|
||||
receivable_amount,
|
||||
should_clearing_amount,
|
||||
actual_clearing_amount,
|
||||
fee_amount,
|
||||
withdrawable_amount,
|
||||
withdraw_code,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
del_flag,
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
#{billStatus,jdbcType=VARCHAR},
|
||||
#{tradeDate,jdbcType=VARCHAR},
|
||||
#{clearingBillCode,jdbcType=VARCHAR},
|
||||
#{clearingTime,jdbcType=TIMESTAMP},
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
#{orderSource,jdbcType=VARCHAR},
|
||||
#{receivableAmount,jdbcType=DECIMAL},
|
||||
#{shouldClearingAmount,jdbcType=DECIMAL},
|
||||
#{actualClearingAmount,jdbcType=DECIMAL},
|
||||
#{feeAmount,jdbcType=DECIMAL},
|
||||
#{withdrawableAmount,jdbcType=DECIMAL},
|
||||
#{withdrawCode,jdbcType=VARCHAR},
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
#{delFlag,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
bill_status = #{billStatus,jdbcType=VARCHAR},
|
||||
trade_date = #{tradeDate,jdbcType=VARCHAR},
|
||||
clearing_bill_code = #{clearingBillCode,jdbcType=VARCHAR},
|
||||
clearing_time = #{clearingTime,jdbcType=TIMESTAMP},
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
order_source = #{orderSource,jdbcType=VARCHAR},
|
||||
receivable_amount = #{receivableAmount,jdbcType=DECIMAL},
|
||||
should_clearing_amount = #{shouldClearingAmount,jdbcType=DECIMAL},
|
||||
actual_clearing_amount = #{actualClearingAmount,jdbcType=DECIMAL},
|
||||
fee_amount = #{feeAmount,jdbcType=DECIMAL},
|
||||
withdrawable_amount = #{withdrawableAmount,jdbcType=DECIMAL},
|
||||
withdraw_code = #{withdrawCode,jdbcType=VARCHAR},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.ClearingBillInfo" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into clearing_bill_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="billStatus != null">
|
||||
bill_status,
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
trade_date,
|
||||
</if>
|
||||
<if test="clearingBillCode != null">
|
||||
clearing_bill_code,
|
||||
</if>
|
||||
<if test="clearingTime != null">
|
||||
clearing_time,
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id,
|
||||
</if>
|
||||
<if test="orderSource != null">
|
||||
order_source,
|
||||
</if>
|
||||
<if test="receivableAmount != null">
|
||||
receivable_amount,
|
||||
</if>
|
||||
<if test="shouldClearingAmount != null">
|
||||
should_clearing_amount,
|
||||
</if>
|
||||
<if test="actualClearingAmount != null">
|
||||
actual_clearing_amount,
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount,
|
||||
</if>
|
||||
<if test="withdrawableAmount != null">
|
||||
withdrawable_amount,
|
||||
</if>
|
||||
<if test="withdrawCode != null">
|
||||
withdraw_code,
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag,
|
||||
</if>
|
||||
</trim>
|
||||
values
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billStatus != null">
|
||||
#{billStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
#{tradeDate,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clearingBillCode != null">
|
||||
#{clearingBillCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clearingTime != null">
|
||||
#{clearingTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
#{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderSource != null">
|
||||
#{orderSource,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="receivableAmount != null">
|
||||
#{receivableAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="shouldClearingAmount != null">
|
||||
#{shouldClearingAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="actualClearingAmount != null">
|
||||
#{actualClearingAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
#{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="withdrawableAmount != null">
|
||||
#{withdrawableAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="withdrawCode != null">
|
||||
#{withdrawCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
#{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
#{delFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
on duplicate key update
|
||||
<trim suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id = #{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="billStatus != null">
|
||||
bill_status = #{billStatus,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="tradeDate != null">
|
||||
trade_date = #{tradeDate,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clearingBillCode != null">
|
||||
clearing_bill_code = #{clearingBillCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="clearingTime != null">
|
||||
clearing_time = #{clearingTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="merchantId != null">
|
||||
merchant_id = #{merchantId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="orderSource != null">
|
||||
order_source = #{orderSource,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="receivableAmount != null">
|
||||
receivable_amount = #{receivableAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="shouldClearingAmount != null">
|
||||
should_clearing_amount = #{shouldClearingAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="actualClearingAmount != null">
|
||||
actual_clearing_amount = #{actualClearingAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount = #{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="withdrawableAmount != null">
|
||||
withdrawable_amount = #{withdrawableAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="withdrawCode != null">
|
||||
withdraw_code = #{withdrawCode,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="delFlag != null">
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="selectByMerchantId" resultMap="BaseResultMap">
|
||||
select
|
||||
@@ -269,7 +757,7 @@
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getMerchantClearingBillList" resultType="com.jsowell.pile.vo.web.MerchantClearingBillVO" parameterType="com.jsowell.pile.dto.GetClearingBillDTO">
|
||||
<select id="getMerchantClearingBillList" parameterType="com.jsowell.pile.dto.GetClearingBillDTO" resultType="com.jsowell.pile.vo.web.MerchantClearingBillVO">
|
||||
select
|
||||
t1.trade_date as tradeDate,
|
||||
t1.bill_status as billStatus,
|
||||
|
||||
Reference in New Issue
Block a user