22 changed files with 441 additions and 35 deletions
@ -0,0 +1,36 @@ |
|||||
|
package com.cyjd.rights.controller; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.cyjd.rights.business.service.RefundOrderService; |
||||
|
import com.cyjd.rights.dto.AliPayInOrderDto; |
||||
|
import com.cyjd.rights.dto.RefundOrderDto; |
||||
|
import com.cyjd.rights.entity.RefundOrderEntity; |
||||
|
import com.cyjd.rights.vo.AliPayOrderVo; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import io.swagger.annotations.ApiParam; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
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; |
||||
|
|
||||
|
@Api(value = "退款类接口", tags = "退款类接口") |
||||
|
@RestController |
||||
|
@RequestMapping("/rights/refund") |
||||
|
@Slf4j |
||||
|
public class RefundOrderController { |
||||
|
@Autowired |
||||
|
private RefundOrderService refundOrderService; |
||||
|
@ApiOperation(value="查看用户退款记录分页") |
||||
|
@PostMapping(value = "/page") |
||||
|
public IPage<RefundOrderEntity> pageOrder(@Validated @RequestBody @ApiParam("用户支付退款对象") RefundOrderDto dto){ |
||||
|
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); |
||||
|
IPage<RefundOrderEntity> page = refundOrderService.getPageOrder(dto); |
||||
|
return page; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,21 @@ |
|||||
|
package com.cyjd.rights.dto; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@ApiModel(value = "用户退款请求") |
||||
|
@Data |
||||
|
public class AliPayRefundDto { |
||||
|
@ApiModelProperty(value = "账户名称") |
||||
|
private String aliAccountName; |
||||
|
|
||||
|
@ApiModelProperty("退订金额") |
||||
|
private Float refundAmount; |
||||
|
|
||||
|
@ApiModelProperty("商户订单号(对应支付表里的other_order_id)") |
||||
|
private String outTradeNo; |
||||
|
|
||||
|
@ApiModelProperty("用户手机号") |
||||
|
private String mobile; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.cyjd.rights.dto; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@ApiModel(value = "支付解约请求") |
||||
|
@Data |
||||
|
public class AliPayUnSignOrderDto{ |
||||
|
|
||||
|
@ApiModelProperty(value = "对应签约表的orderId") |
||||
|
private String orderId; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(value = "手机号") |
||||
|
private String mobile; |
||||
|
|
||||
|
@ApiModelProperty(value = "对应的账户名字") |
||||
|
private String accountName; |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.cyjd.rights.dto; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
|
||||
|
@ApiModel(value = "退款请求") |
||||
|
@Data |
||||
|
public class RefundOrderDto extends BasePageDto{ |
||||
|
|
||||
|
@ApiModelProperty(value = "商户订单号 对应支付表的other_order_id") |
||||
|
private String outTradeNo; |
||||
|
|
||||
|
|
||||
|
@ApiModelProperty(value = "链接Id") |
||||
|
private String linkId; |
||||
|
|
||||
|
@ApiModelProperty(value = "退款订单号") |
||||
|
private String outRequestNo; |
||||
|
|
||||
|
@ApiModelProperty(value = "手机号") |
||||
|
private String mobile; |
||||
|
/** |
||||
|
* 0失败 1成功 |
||||
|
*/ |
||||
|
@ApiModelProperty(value = "订单状态") |
||||
|
private String status; |
||||
|
|
||||
|
@ApiModelProperty(value = "查询开始时间") |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime beginTime; |
||||
|
|
||||
|
@ApiModelProperty(value = "查询结束时间") |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private LocalDateTime endTime; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.cyjd.rights.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import lombok.experimental.Accessors; |
||||
|
|
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@Accessors(chain = true) |
||||
|
@TableName("tb_refund_order") |
||||
|
public class RefundOrderEntity { |
||||
|
@TableId(value = "id", type = IdType.AUTO) |
||||
|
private Integer id; |
||||
|
//手机号
|
||||
|
private String mobile; |
||||
|
|
||||
|
//退款时间
|
||||
|
private LocalDateTime refundTime; |
||||
|
|
||||
|
//商户订单号 对应支付表的other_order_id
|
||||
|
private String outTradeNo; |
||||
|
|
||||
|
//退款订单号,传了这个支付宝会保证同样的退款请求号多次请求只会退一次
|
||||
|
private String outRequestNo; |
||||
|
|
||||
|
//退款金额
|
||||
|
private String refundPrice; |
||||
|
|
||||
|
//链接Id
|
||||
|
private Integer linkId; |
||||
|
|
||||
|
//0失败 1成功
|
||||
|
private Integer status; |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package com.cyjd.rights.business.service; |
||||
|
|
||||
|
import com.alipay.api.CertAlipayRequest; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.cyjd.rights.dto.RefundOrderDto; |
||||
|
import com.cyjd.rights.entity.AliAccountEntity; |
||||
|
import com.cyjd.rights.entity.RefundOrderEntity; |
||||
|
|
||||
|
public interface RefundOrderService extends IService<RefundOrderEntity> { |
||||
|
|
||||
|
IPage<RefundOrderEntity> getPageOrder(RefundOrderDto dto); |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.cyjd.rights.business.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.cyjd.rights.dto.RefundOrderDto; |
||||
|
import com.cyjd.rights.entity.RefundOrderEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface RefundOrderMapper extends BaseMapper<RefundOrderEntity> { |
||||
|
|
||||
|
List<RefundOrderEntity> getPageOrder(RefundOrderDto dto); |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.cyjd.rights.business.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.cyjd.rights.business.mapper.RefundOrderMapper; |
||||
|
import com.cyjd.rights.business.service.RefundOrderService; |
||||
|
import com.cyjd.rights.dto.RefundOrderDto; |
||||
|
import com.cyjd.rights.entity.RefundOrderEntity; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.extern.java.Log; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@Log |
||||
|
public class RefundOrderServiceImpl extends ServiceImpl<RefundOrderMapper, RefundOrderEntity> implements RefundOrderService { |
||||
|
@Resource |
||||
|
private RefundOrderMapper refundOrderMapper; |
||||
|
@Override |
||||
|
public IPage<RefundOrderEntity> getPageOrder(RefundOrderDto dto) { |
||||
|
PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); |
||||
|
List<RefundOrderEntity> pageOrder = refundOrderMapper.getPageOrder(dto); |
||||
|
IPage<RefundOrderEntity> page=new Page<>(dto.getPageNum(),dto.getPageSize(),new PageInfo(pageOrder).getTotal()); |
||||
|
page.setRecords(pageOrder); |
||||
|
return page; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.cyjd.rights.business.mapper.AliPayOrderMapper"> |
||||
|
<select id="getPageOrder" resultType="com.cyjd.rights.entity.RefundOrderEntity"> |
||||
|
select |
||||
|
id,mobile,refund_time,status,out_trade_no,out_request_no,refund_price,link_id |
||||
|
from tb_refund_order |
||||
|
<where> |
||||
|
1=1 |
||||
|
<if test="outTradeNo!=null and outTradeNo!=''"> |
||||
|
and out_trade_no = #{outTradeNo} |
||||
|
</if> |
||||
|
<if test="linkId!=null and linkId!=''"> |
||||
|
and link_id = #{linkId} |
||||
|
</if> |
||||
|
<if test="outRequestNo!=null and outRequestNo!=''"> |
||||
|
and out_request_no = #{outRequestNo} |
||||
|
</if> |
||||
|
<if test="status!=null and status!=''"> |
||||
|
and status = #{status} |
||||
|
</if> |
||||
|
<if test="mobile!=null and mobile!=''"> |
||||
|
and mobile = #{mobile} |
||||
|
</if> |
||||
|
<if test="beginTime!=null"> |
||||
|
and refund_time > #{beginTime} |
||||
|
</if> |
||||
|
<if test="endTime!=null"> |
||||
|
and refund_time < #{endTime} |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
||||
Loading…
Reference in new issue