feat:第三方支付接口完善

This commit is contained in:
dzc committed 2026-03-30 11:44:33 +08:00
1 parent 035f077e0c
commit 907a557c34
4 files changed
+62 -4

No files matched your search

@@ -3,7 +3,13 @@ package com.bsd.pjcloud.thirdparty.dto.pay;
import com.bsd.pjcloud.thirdparty.entity.pay.ThirdPayOrderEntity;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ThirdPayOrderDto extends ThirdPayOrderEntity {
private LocalDateTime[] payTimeList;
private LocalDateTime[] refundTimeList;
}
@@ -6,4 +6,8 @@ import lombok.Data;
@Data
public class ThirdPayOrderVo extends ThirdPayOrderEntity {
private String username;
private String userPhone;
}
@@ -1,24 +1,59 @@
package com.bsd.pjcloud.thirdparty.service.impl.pay;
import cn.hutool.core.collection.IterUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.admin.api.entity.SysUser;
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import com.bsd.pjcloud.thirdparty.dto.pay.ThirdPayOrderDto;
import com.bsd.pjcloud.thirdparty.entity.pay.ThirdPayOrderEntity;
import com.bsd.pjcloud.thirdparty.mapper.pay.ThirdPayOrderMapper;
import com.bsd.pjcloud.thirdparty.service.ThirdPayOrderService;
import com.bsd.pjcloud.thirdparty.vo.pay.ThirdPayOrderVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.Map;
/**
* 第三方支付订单
*/
@Service
@Validated
@Slf4j
@RequiredArgsConstructor
public class ThirdPayOrderServiceImpl extends ServiceImpl<ThirdPayOrderMapper, ThirdPayOrderEntity> implements ThirdPayOrderService {
private final RemoteUserService remoteUserService;
@Override
public Page<ThirdPayOrderVo> scopePage(Page page, ThirdPayOrderDto dto, DataScope dataScope) {
return baseMapper.scopePage(page, dto, dataScope);
Page<ThirdPayOrderVo> pageList = baseMapper.scopePage(page, dto, dataScope);
disposePageList(pageList.getRecords(), dto);
return pageList;
}
private void disposePageList(List<ThirdPayOrderVo> list, ThirdPayOrderDto dto) {
if (ObjectUtil.isEmpty(list)) return;
// 查询用户
List<Long> userIdList = list.stream().map(ThirdPayOrderEntity::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
if (ObjectUtil.isNotEmpty(userIdList)) {
List<SysUser> userList = remoteUserService.getInnerUserById(userIdList).getData();
if (ObjectUtil.isNotEmpty(userList)) {
Map<Long, SysUser> userMap = IterUtil.toMap(userList, SysUser::getUserId);
for (ThirdPayOrderVo user : list) {
SysUser targetUser = userMap.get(user.getUserId());
if (ObjectUtil.isEmpty(targetUser)) continue;
user.setUsername(targetUser.getName());
user.setUserPhone(targetUser.getPhone());
}
}
}
}
}
@@ -2,7 +2,6 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bsd.pjcloud.thirdparty.mapper.pay.ThirdPayOrderMapper">
<sql id="selectA">
select a.id,
a.pay_platform_type,
@@ -30,7 +29,22 @@
<sql id="whereA">
a.del_flag = '0'
<if test="dto.id != null">
and a.id = #{dto.id}
</if>
<if test="dto.payPlatformType != null and dto.payPlatformType != '' ">
and a.pay_platform_type = #{dto.payPlatformType}
</if>
<if test="dto.bizType != null and dto.bizType != '' ">
and a.biz_type = #{dto.bizType}
</if>
<if test="dto.userId != null">
and a.user_id = #{dto.userId}
</if>
<if test="dto.payTimeList != null and dto.payTimeList.length == 2">
and a.pay_time between #{dto.payTimeList[0]} and #{dto.payTimeList[1]}
</if>
<if test="dto.refundTimeList != null and dto.refundTimeList.length == 2">
and a.refund_time between #{dto.refundTimeList[0]} and #{dto.refundTimeList[1]}
</if>
</sql>
@@ -42,5 +56,4 @@
</where>
order by a.create_time desc, a.id desc
</select>
</mapper>