mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
查询时间段内的订单分账记录
This commit is contained in:
@@ -99,6 +99,11 @@ public class OrderSplitRecord {
|
||||
*/
|
||||
private BigDecimal serviceSplitAmount;
|
||||
|
||||
/**
|
||||
* 手续费(只能有一方承担手续费)
|
||||
*/
|
||||
private BigDecimal feeAmount;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ public interface OrderSplitRecordMapper {
|
||||
List<OrderSplitRecord> selectByOrderCode(String orderCode);
|
||||
|
||||
List<OrderSplitRecord> queryOrderSplitDataList(@Param("merchantId") String merchantId,
|
||||
@Param("stationId") String stationId,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
@Param("stationId") String stationId,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.service;
|
||||
|
||||
import com.jsowell.adapay.dto.PaymentConfirmParam;
|
||||
import com.jsowell.adapay.dto.SplitData;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.vo.OrderInfoDetailVO;
|
||||
import com.jsowell.pile.vo.web.OrderSplitDailySummaryData;
|
||||
@@ -27,6 +28,7 @@ public interface OrderSplitRecordService {
|
||||
|
||||
/**
|
||||
* 批量保存订单分账记录
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
@@ -35,16 +37,17 @@ public interface OrderSplitRecordService {
|
||||
/**
|
||||
* 保存订单分账记录
|
||||
*/
|
||||
void saveOrderSplitRecord(PaymentConfirmParam param, String id, List<SplitData> stationSplitConfigList, OrderInfoDetailVO orderInfoDetailVO);
|
||||
void saveOrderSplitRecord(PaymentConfirmParam param, PaymentConfirmResponse response, List<SplitData> stationSplitConfigList, OrderInfoDetailVO orderInfoDetailVO);
|
||||
|
||||
List<OrderSplitRecordVO> selectByOrderCode(String orderCode);
|
||||
|
||||
/**
|
||||
* 根据入参拉出时间段内所有订单的分账记录
|
||||
*
|
||||
* @param merchantId 运营商id
|
||||
* @param stationId 站点id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param stationId 站点id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
List<OrderSplitRecord> queryOrderSplitRecordList(String merchantId, String stationId, String startTime, String endTime);
|
||||
|
||||
@@ -1708,7 +1708,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
.build();
|
||||
splitDataList.add(splitData);
|
||||
OrderInfoDetailVO orderInfoDetailVO = getOrderInfoDetailVO(orderBasicInfo, orderDetail);
|
||||
orderSplitRecordService.saveOrderSplitRecord(param, paymentConfirmResponse.getId(), splitDataList, orderInfoDetailVO);
|
||||
orderSplitRecordService.saveOrderSplitRecord(param, paymentConfirmResponse, splitDataList, orderInfoDetailVO);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -1879,7 +1879,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
||||
PaymentConfirmResponse paymentConfirmRequest = adapayService.createPaymentConfirmRequest(param);
|
||||
// 保存订单分账记录
|
||||
OrderInfoDetailVO orderInfoDetailVO = getOrderInfoDetailVO(orderCode);
|
||||
orderSplitRecordService.saveOrderSplitRecord(param, paymentConfirmRequest.getId(), splitDataList, orderInfoDetailVO);
|
||||
orderSplitRecordService.saveOrderSplitRecord(param, paymentConfirmRequest, splitDataList, orderInfoDetailVO);
|
||||
return paymentConfirmRequest;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.jsowell.adapay.dto.PaymentConfirmParam;
|
||||
import com.jsowell.adapay.dto.SplitData;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.enums.DelFlagEnum;
|
||||
import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||
@@ -38,66 +39,33 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
@Autowired
|
||||
private AdapayMemberAccountService adapayMemberAccountService;
|
||||
|
||||
// @Override
|
||||
// public int deleteByPrimaryKey(Integer id) {
|
||||
// return orderSplitRecordMapper.deleteByPrimaryKey(id);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int insertOrUpdate(OrderSplitRecord record) {
|
||||
// return orderSplitRecordMapper.insertOrUpdate(record);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int insertOrUpdateSelective(OrderSplitRecord record) {
|
||||
// return orderSplitRecordMapper.insertOrUpdateSelective(record);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int insertSelective(OrderSplitRecord record) {
|
||||
// return orderSplitRecordMapper.insertSelective(record);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public OrderSplitRecord selectByPrimaryKey(Integer id) {
|
||||
// return orderSplitRecordMapper.selectByPrimaryKey(id);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int updateByPrimaryKeySelective(OrderSplitRecord record) {
|
||||
// return orderSplitRecordMapper.updateByPrimaryKeySelective(record);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int updateBatchSelective(List<OrderSplitRecord> list) {
|
||||
// return orderSplitRecordMapper.updateBatchSelective(list);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<OrderSplitRecord> list) {
|
||||
return orderSplitRecordMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveOrderSplitRecord(PaymentConfirmParam param, String paymentConfirmId, List<SplitData> splitDataList, OrderInfoDetailVO orderInfoDetailVO) {
|
||||
List<OrderSplitRecord> list = Lists.newArrayList();
|
||||
|
||||
String orderCode = param.getOrderCode();
|
||||
BigDecimal settleAmount = param.getConfirmAmt();
|
||||
String paymentId = param.getPaymentId();
|
||||
|
||||
public void saveOrderSplitRecord(PaymentConfirmParam param, PaymentConfirmResponse response, List<SplitData> splitDataList, OrderInfoDetailVO orderInfoDetailVO) {
|
||||
// 判断入参
|
||||
if (param == null || response == null || CollectionUtils.isEmpty(param.getDivMemberList()) || orderInfoDetailVO == null) {
|
||||
return;
|
||||
}
|
||||
String paymentConfirmId = response.getId(); // 支付确认id
|
||||
String feeAmt = response.getFee_amt(); // 手续费
|
||||
String orderCode = param.getOrderCode(); // 订单号
|
||||
BigDecimal settleAmount = param.getConfirmAmt(); // 结算金额
|
||||
String paymentId = param.getPaymentId(); // 支付id
|
||||
List<OrderSplitRecord> list = Lists.newArrayList(); // 订单分账记录集合
|
||||
for (SplitData splitData : splitDataList) {
|
||||
OrderSplitRecord orderSplitRecord = new OrderSplitRecord();
|
||||
orderSplitRecord.setOrderCode(orderCode);
|
||||
orderSplitRecord.setStatus(AdapayStatusEnum.SUCCEEDED.getValue());
|
||||
orderSplitRecord.setSettleAmount(settleAmount);
|
||||
orderSplitRecord.setTradeDate(DateUtils.getDate()); // 订单结算日期 yyyy-MM-dd
|
||||
if (orderInfoDetailVO != null) {
|
||||
orderSplitRecord.setMerchantId(orderInfoDetailVO.getMerchantId());
|
||||
orderSplitRecord.setStationId(orderInfoDetailVO.getStationId());
|
||||
orderSplitRecord.setElectricityAmount(orderInfoDetailVO.getTotalElectricityAmount());
|
||||
orderSplitRecord.setServiceAmount(orderInfoDetailVO.getTotalServiceAmount());
|
||||
}
|
||||
orderSplitRecord.setMerchantId(orderInfoDetailVO.getMerchantId());
|
||||
orderSplitRecord.setStationId(orderInfoDetailVO.getStationId());
|
||||
orderSplitRecord.setElectricityAmount(orderInfoDetailVO.getTotalElectricityAmount());
|
||||
orderSplitRecord.setServiceAmount(orderInfoDetailVO.getTotalServiceAmount());
|
||||
orderSplitRecord.setAdapayMemberId(splitData.getMemberId());
|
||||
orderSplitRecord.setPaymentId(paymentId);
|
||||
orderSplitRecord.setPaymentConfirmId(paymentConfirmId);
|
||||
@@ -109,6 +77,12 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
orderSplitRecord.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
||||
orderSplitRecord.setCreateBy(Constants.SYSTEM);
|
||||
orderSplitRecord.setCreateTime(DateUtils.getNowDate());
|
||||
// 如果是手续费承担方, 保存feeAmt, 否则保存0
|
||||
if (StringUtils.equals(splitData.getFeeFlag(), Constants.Y)) {
|
||||
orderSplitRecord.setFeeAmount(new BigDecimal(feeAmt));
|
||||
} else {
|
||||
orderSplitRecord.setFeeAmount(BigDecimal.ZERO);
|
||||
}
|
||||
list.add(orderSplitRecord);
|
||||
}
|
||||
this.batchInsert(list);
|
||||
@@ -144,10 +118,11 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
|
||||
/**
|
||||
* 根据入参拉出时间段内所有订单的分账记录
|
||||
*
|
||||
* @param merchantId 运营商id
|
||||
* @param stationId 站点id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @param stationId 站点id
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@@ -254,3 +229,4 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<result column="electricity_split_amount" jdbcType="DECIMAL" property="electricitySplitAmount" />
|
||||
<result column="service_split_ratio" jdbcType="DECIMAL" property="serviceSplitRatio" />
|
||||
<result column="service_split_amount" jdbcType="DECIMAL" property="serviceSplitAmount" />
|
||||
<result column="fee_amount" jdbcType="DECIMAL" property="feeAmount" />
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
@@ -31,8 +32,8 @@
|
||||
<!--@mbg.generated-->
|
||||
id, order_code, merchant_id, station_id, `status`, settle_amount, electricity_amount,
|
||||
service_amount, trade_date, adapay_member_id, payment_id, payment_confirm_id, electricity_split_ratio,
|
||||
electricity_split_amount, service_split_ratio, service_split_amount, remark, create_by,
|
||||
create_time, update_by, update_time, del_flag
|
||||
electricity_split_amount, service_split_ratio, service_split_amount, fee_amount,
|
||||
remark, create_by, create_time, update_by, update_time, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
<!--@mbg.generated-->
|
||||
@@ -95,6 +96,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
service_split_amount,
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
@@ -160,6 +164,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
#{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
#{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -229,6 +236,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
service_split_amount = #{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount = #{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -359,6 +369,13 @@
|
||||
</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="remark = case" suffix="end,">
|
||||
<foreach collection="list" index="index" item="item">
|
||||
<if test="item.remark != null">
|
||||
@@ -412,8 +429,8 @@
|
||||
insert into order_split_record
|
||||
(order_code, merchant_id, station_id, `status`, settle_amount, electricity_amount,
|
||||
service_amount, trade_date, adapay_member_id, payment_id, payment_confirm_id, electricity_split_ratio,
|
||||
electricity_split_amount, service_split_ratio, service_split_amount, remark, create_by,
|
||||
create_time, update_by, update_time, del_flag)
|
||||
electricity_split_amount, service_split_ratio, service_split_amount, fee_amount,
|
||||
remark, create_by, create_time, update_by, update_time, del_flag)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.orderCode,jdbcType=VARCHAR}, #{item.merchantId,jdbcType=VARCHAR}, #{item.stationId,jdbcType=VARCHAR},
|
||||
@@ -422,9 +439,9 @@
|
||||
#{item.paymentId,jdbcType=VARCHAR}, #{item.paymentConfirmId,jdbcType=VARCHAR},
|
||||
#{item.electricitySplitRatio,jdbcType=DECIMAL}, #{item.electricitySplitAmount,jdbcType=DECIMAL},
|
||||
#{item.serviceSplitRatio,jdbcType=DECIMAL}, #{item.serviceSplitAmount,jdbcType=DECIMAL},
|
||||
#{item.remark,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP},
|
||||
#{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP}, #{item.delFlag,jdbcType=VARCHAR}
|
||||
)
|
||||
#{item.feeAmount,jdbcType=DECIMAL}, #{item.remark,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.OrderSplitRecord" useGeneratedKeys="true">
|
||||
@@ -449,6 +466,7 @@
|
||||
electricity_split_amount,
|
||||
service_split_ratio,
|
||||
service_split_amount,
|
||||
fee_amount,
|
||||
remark,
|
||||
create_by,
|
||||
create_time,
|
||||
@@ -476,6 +494,7 @@
|
||||
#{electricitySplitAmount,jdbcType=DECIMAL},
|
||||
#{serviceSplitRatio,jdbcType=DECIMAL},
|
||||
#{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
#{feeAmount,jdbcType=DECIMAL},
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
#{createBy,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
@@ -503,6 +522,7 @@
|
||||
electricity_split_amount = #{electricitySplitAmount,jdbcType=DECIMAL},
|
||||
service_split_ratio = #{serviceSplitRatio,jdbcType=DECIMAL},
|
||||
service_split_amount = #{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
fee_amount = #{feeAmount,jdbcType=DECIMAL},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_by = #{createBy,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
@@ -563,6 +583,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
service_split_amount,
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
@@ -632,6 +655,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
#{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
#{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
@@ -701,6 +727,9 @@
|
||||
<if test="serviceSplitAmount != null">
|
||||
service_split_amount = #{serviceSplitAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="feeAmount != null">
|
||||
fee_amount = #{feeAmount,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user