mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-07-13 18:48:04 +08:00
add 新增后管页面查询引流抽成订单列表 接口
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package com.jsowell.web.controller.pile;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.common.response.RestApiResponse;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.service.OrderSplitRecordService;
|
||||
import com.jsowell.pile.vo.web.OrderSplitRecordVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 订单分账记录Controller
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2025/7/29 10:21:54
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/order/commission")
|
||||
public class OrderSplitRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private OrderSplitRecordService orderSplitRecordService;
|
||||
|
||||
/**
|
||||
* 后管查询引流抽成订单列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getStationCommissionList")
|
||||
public RestApiResponse<?> getStationCommissionList(@RequestBody QueryOrderSplitRecordDTO dto) {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
List<OrderSplitRecordVO> stationCommissionList = orderSplitRecordService.getStationCommissionList(dto);
|
||||
response = new RestApiResponse<>(ImmutableMap.of("stationCommissionList", stationCommissionList));
|
||||
}catch (Exception e) {
|
||||
logger.error("查询站点引流抽成订单列表 error", e);
|
||||
response = new RestApiResponse<>(e);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.jsowell.pile.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 查询站点引流抽成订单列表DTO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2025/7/29 10:38:58
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class QueryOrderSplitRecordDTO {
|
||||
|
||||
private Integer pageNum;
|
||||
private Integer pageSize;
|
||||
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
private String stationId;
|
||||
|
||||
private String orderCode;
|
||||
|
||||
private String transactionCode;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.jsowell.pile.mapper;
|
||||
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.vo.web.OrderSplitRecordVO;
|
||||
import com.jsowell.pile.vo.web.SplitAggregateDataVO;
|
||||
@@ -61,4 +62,11 @@ public interface OrderSplitRecordMapper {
|
||||
List<SplitConfigStationVO> queryStationAggregateData(@Param("dto") SplitConfigStationDTO dto);
|
||||
|
||||
List<OrderSplitRecord> selectInfoByPaymentConfirmId(String paymentConfirmId);
|
||||
|
||||
/**
|
||||
* 后管配置引流抽成页面查询订单列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<OrderSplitRecordVO> getStationCommissionList(@Param("dto") QueryOrderSplitRecordDTO dto);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.common.core.page.PageResponse;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.dto.SplitOrderDTO;
|
||||
import com.jsowell.pile.vo.OrderInfoDetailVO;
|
||||
@@ -99,5 +100,12 @@ public interface OrderSplitRecordService {
|
||||
* @param paymentConfirmId
|
||||
*/
|
||||
String confirmReverseByPaymentConfirmId(String paymentConfirmId) throws BaseAdaPayException;
|
||||
|
||||
/**
|
||||
* 后管配置引流抽成页面订单列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<OrderSplitRecordVO> getStationCommissionList(QueryOrderSplitRecordDTO dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,14 @@ import com.jsowell.common.enums.adapay.AdapayStatusEnum;
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.DateUtils;
|
||||
import com.jsowell.common.util.PageUtils;
|
||||
import com.jsowell.common.util.SecurityUtils;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.pile.domain.AdapayMemberAccount;
|
||||
import com.jsowell.pile.domain.OrderSplitRecord;
|
||||
import com.jsowell.pile.domain.PileMerchantInfo;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitDTO;
|
||||
import com.jsowell.pile.dto.QueryOrderSplitRecordDTO;
|
||||
import com.jsowell.pile.dto.SplitConfigStationDTO;
|
||||
import com.jsowell.pile.dto.SplitOrderDTO;
|
||||
import com.jsowell.pile.mapper.OrderSplitRecordMapper;
|
||||
@@ -560,6 +562,29 @@ public class OrderSplitRecordServiceImpl implements OrderSplitRecordService {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 后管配置引流抽成页面查询订单列表
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OrderSplitRecordVO> getStationCommissionList(QueryOrderSplitRecordDTO dto) {
|
||||
int pageNo = dto.getPageNum() == null ? 1 : dto.getPageNum();
|
||||
int pageSize = dto.getPageSize() == null ? 10 : dto.getPageSize();
|
||||
// 分页
|
||||
PageUtils.startPage(pageNo, pageSize);
|
||||
List<OrderSplitRecordVO> stationCommissionList = orderSplitRecordMapper.getStationCommissionList(dto);
|
||||
if (CollectionUtils.isEmpty(stationCommissionList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (OrderSplitRecordVO orderSplitRecordVO : stationCommissionList) {
|
||||
// 计算 抽成总金额 = 抽成电费 + 抽成服务费
|
||||
BigDecimal commissionAmount = orderSplitRecordVO.getElectricitySplitAmount().add(orderSplitRecordVO.getServiceSplitAmount());
|
||||
orderSplitRecordVO.setCommissionAmount(commissionAmount);
|
||||
}
|
||||
return stationCommissionList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据汇付会员id查询分账汇总数据
|
||||
* @param dto
|
||||
|
||||
@@ -11,6 +11,8 @@ public class OrderSplitRecordVO {
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
private String transactionCode;
|
||||
|
||||
/**
|
||||
* 站点id
|
||||
*/
|
||||
@@ -42,6 +44,11 @@ public class OrderSplitRecordVO {
|
||||
*/
|
||||
private BigDecimal settleAmount;
|
||||
|
||||
/**
|
||||
* 订单抽成总金额
|
||||
*/
|
||||
private BigDecimal commissionAmount;
|
||||
|
||||
/**
|
||||
* 订单电费金额
|
||||
*/
|
||||
|
||||
@@ -47,7 +47,8 @@
|
||||
delete from order_split_record
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderSplitRecord" useGeneratedKeys="true">
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.jsowell.pile.domain.OrderSplitRecord" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into order_split_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -433,18 +434,23 @@
|
||||
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},
|
||||
#{item.status,jdbcType=VARCHAR}, #{item.settleAmount,jdbcType=DECIMAL}, #{item.electricityAmount,jdbcType=DECIMAL},
|
||||
#{item.serviceAmount,jdbcType=DECIMAL}, #{item.tradeDate,jdbcType=VARCHAR}, #{item.adapayMemberId,jdbcType=VARCHAR},
|
||||
(#{item.orderCode,jdbcType=VARCHAR}, #{item.merchantId,jdbcType=VARCHAR},
|
||||
#{item.stationId,jdbcType=VARCHAR},
|
||||
#{item.status,jdbcType=VARCHAR}, #{item.settleAmount,jdbcType=DECIMAL},
|
||||
#{item.electricityAmount,jdbcType=DECIMAL},
|
||||
#{item.serviceAmount,jdbcType=DECIMAL}, #{item.tradeDate,jdbcType=VARCHAR},
|
||||
#{item.adapayMemberId,jdbcType=VARCHAR},
|
||||
#{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.feeAmount,jdbcType=DECIMAL}, #{item.remark,jdbcType=VARCHAR}, #{item.createBy,jdbcType=VARCHAR},
|
||||
#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateBy,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
||||
#{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">
|
||||
<insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderSplitRecord"
|
||||
useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into order_split_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -531,7 +537,8 @@
|
||||
del_flag = #{delFlag,jdbcType=VARCHAR},
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.OrderSplitRecord" useGeneratedKeys="true">
|
||||
<insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
|
||||
parameterType="com.jsowell.pile.domain.OrderSplitRecord" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into order_split_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
@@ -831,12 +838,9 @@
|
||||
</select>
|
||||
|
||||
<select id="queryOrderCodesByParams" resultType="java.lang.String">
|
||||
SELECT
|
||||
DISTINCT (order_code)
|
||||
from
|
||||
order_split_record
|
||||
where
|
||||
station_id = #{dto.stationId,jdbcType=VARCHAR}
|
||||
SELECT DISTINCT (order_code)
|
||||
from order_split_record
|
||||
where station_id = #{dto.stationId,jdbcType=VARCHAR}
|
||||
AND trade_date BETWEEN #{dto.startTime,jdbcType=VARCHAR} AND #{dto.endTime,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
@@ -890,4 +894,32 @@
|
||||
where del_flag = '0'
|
||||
and payment_confirm_id = #{paymentConfirmId,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="getStationCommissionList" resultType="com.jsowell.pile.vo.web.OrderSplitRecordVO">
|
||||
SELECT
|
||||
t1.order_code AS orderCode,
|
||||
t2.transaction_code AS transactionCode,
|
||||
t1.trade_date AS tradeDate,
|
||||
t1.settle_amount AS settleAmount,
|
||||
t1.electricity_split_ratio AS electricitySplitRatio,
|
||||
t1.electricity_split_amount AS electricitySplitAmount,
|
||||
t1.service_split_ratio AS serviceSplitRatio,
|
||||
t1.service_split_amount AS serviceSplitAmount
|
||||
FROM
|
||||
order_split_record t1
|
||||
JOIN order_basic_info t2 ON t1.order_code = t2.order_code
|
||||
WHERE
|
||||
t1.del_flag = '0'
|
||||
AND adapay_member_id = '0'
|
||||
AND t1.station_id = #{dto.stationId,jdbcType=VARCHAR}
|
||||
<if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
|
||||
AND t1.trade_date BETWEEN #{dto.startTime,jdbcType=VARCHAR} AND #{dto.endTime,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dto.orderCode != null and dto.orderCode != ''">
|
||||
AND t1.order_code = #{dto.orderCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="dto.transactionCode != null and dto.transactionCode != ''">
|
||||
AND t2.transaction_code = #{dto.transactionCode,jdbcType=VARCHAR}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user