Commit 75c6aab711570b0b1064b3fdd140104d1c08e429

Authored by fengliang
1 parent 62b2f7d2

update:增加返回参数

etrade-order/src/main/java/com/diligrp/etrade/order/controller/OrderManagerController.java
... ... @@ -5,6 +5,7 @@ import com.diligrp.etrade.core.authority.UserTicket;
5 5 import com.diligrp.etrade.core.domain.Message;
6 6 import com.diligrp.etrade.core.exception.PlatformServiceException;
7 7 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  8 +import com.diligrp.etrade.order.domain.OrderRefundAddDto;
8 9 import com.diligrp.etrade.order.domain.OrderRefundDto;
9 10 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
10 11 import com.diligrp.etrade.order.model.OrderRefund;
... ... @@ -42,7 +43,7 @@ public class OrderManagerController {
42 43 * @return
43 44 */
44 45 @RequestMapping(value = "/refund",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
45   - public Message<OrderRefund> refund(@RequestBody OrderRefundDto refundDto){
  46 + public Message<OrderRefund> refund(@RequestBody OrderRefundAddDto refundDto){
46 47 UserTicket userTicket = SessionContext.getUserTicket();
47 48 try{
48 49 RLock lock = redissonClient.getLock(OrderConstant.OrderLock + refundDto.getCode());
... ... @@ -101,12 +102,12 @@ public class OrderManagerController {
101 102 * @return
102 103 */
103 104 @RequestMapping(value = "/refundList",method = {RequestMethod.POST},produces="application/json;charset=UTF-8")
104   - public Message<List<OrderRefund>> getOrderRefundList(@RequestBody OrderRefundQueryDto orderRefundQueryDto){
  105 + public Message<List<OrderRefundDto>> getOrderRefundList(@RequestBody OrderRefundQueryDto orderRefundQueryDto){
105 106 try{
106 107 if(StringUtils.isBlank(orderRefundQueryDto.getOrderCode())){
107 108 return Message.failure("订单号不能为空");
108 109 }
109   - List<OrderRefund> orderRefundList = orderRefundService.getOrderRefundList(orderRefundQueryDto);
  110 + List<OrderRefundDto> orderRefundList = orderRefundService.getOrderRefundList(orderRefundQueryDto);
110 111 return Message.success(orderRefundList);
111 112 }catch (PlatformServiceException pe) {
112 113 LOGGER.warn("服务异常{}:{}",pe.getCode(), pe.getMessage());
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/dao/OrderRefundMapper.java
... ... @@ -2,6 +2,7 @@ package com.diligrp.etrade.order.dao;
2 2  
3 3 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
4 4 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  5 +import com.diligrp.etrade.order.domain.OrderRefundDto;
5 6 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
6 7 import com.diligrp.etrade.order.model.OrderRefund;
7 8 import org.apache.ibatis.annotations.Param;
... ... @@ -40,5 +41,5 @@ public interface OrderRefundMapper extends MybatisMapperSupport {
40 41 * @param queryDto
41 42 * @return
42 43 */
43   - List<OrderRefund> getOrderRefundList(OrderRefundQueryDto queryDto);
  44 + List<OrderRefundDto> getOrderRefundList(OrderRefundQueryDto queryDto);
44 45 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderRefundAddDto.java 0 → 100644
  1 +package com.diligrp.etrade.order.domain;
  2 +
  3 +import jakarta.validation.constraints.NotBlank;
  4 +import jakarta.validation.constraints.NotNull;
  5 +
  6 +import java.math.BigDecimal;
  7 +
  8 +/** 订单出参 */
  9 +public class OrderRefundAddDto {
  10 +
  11 + /**
  12 + * 订单编码(全局唯一)
  13 + */
  14 + @NotBlank(message = "订单编码不能为空")
  15 + private String code;
  16 + /**
  17 + * 退款金额
  18 + */
  19 + @NotNull(message = "退款金额不能为空")
  20 + private BigDecimal refundAmount;
  21 +
  22 + /**
  23 + * 退款说明
  24 + */
  25 + private String refundMessage;
  26 + /**
  27 + * 市场主键
  28 + */
  29 + @NotNull(message = "市场主键不能为空")
  30 + private Long marketId;
  31 +
  32 + public String getCode() {
  33 + return code;
  34 + }
  35 +
  36 + public void setCode(String code) {
  37 + this.code = code;
  38 + }
  39 +
  40 + public BigDecimal getRefundAmount() {
  41 + return refundAmount;
  42 + }
  43 +
  44 + public void setRefundAmount(BigDecimal refundAmount) {
  45 + this.refundAmount = refundAmount;
  46 + }
  47 +
  48 + public String getRefundMessage() {
  49 + return refundMessage;
  50 + }
  51 +
  52 + public void setRefundMessage(String refundMessage) {
  53 + this.refundMessage = refundMessage;
  54 + }
  55 +
  56 + public Long getMarketId() {
  57 + return marketId;
  58 + }
  59 +
  60 + public void setMarketId(Long marketId) {
  61 + this.marketId = marketId;
  62 + }
  63 +}
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderRefundDto.java
1 1 package com.diligrp.etrade.order.domain;
2 2  
3   -import com.diligrp.etrade.order.type.OrderPaymentAllChannel;
4 3 import jakarta.validation.constraints.NotBlank;
5 4 import jakarta.validation.constraints.NotNull;
6 5  
7 6 import java.math.BigDecimal;
8   -import java.math.RoundingMode;
9 7 import java.time.LocalDateTime;
10   -import java.util.List;
11 8  
12 9 /** 订单出参 */
13 10 public class OrderRefundDto {
  11 + private Long id;
14 12  
15 13 /**
16   - * 订单编码(全局唯一)
  14 + * 实际退款单号
17 15 */
18   - @NotBlank(message = "订单编码不能为空")
19   - private String code;
  16 + private String refundId;
  17 +
  18 + /**
  19 + * 市场主键
  20 + */
  21 + private Long marketId;
  22 +
  23 + /**
  24 + * 订单主键
  25 + */
  26 + private Long orderId;
  27 +
  28 + /**
  29 + * 订单编号
  30 + */
  31 + private String orderCode;
  32 +
20 33 /**
21 34 * 退款金额
22 35 */
23   - @NotNull(message = "退款金额不能为空")
24 36 private BigDecimal refundAmount;
25 37  
26 38 /**
27 39 * 退款说明
28 40 */
29 41 private String refundMessage;
  42 +
30 43 /**
31   - * 市场主键
  44 + * 退款单状态
32 45 */
33   - @NotNull(message = "市场主键不能为空")
34   - private Long marketId;
  46 + private Integer state;
  47 +
  48 + /**
  49 + * paymentId微信交易单号
  50 + */
  51 + private String tradeId;
  52 +
  53 + /**
  54 + * 退款失败原因
  55 + */
  56 + private String notic;
  57 +
  58 + /**
  59 + * 交费单主键
  60 + */
  61 + private Long orderPaymentId;
  62 +
  63 + /**
  64 + * 版本号
  65 + */
  66 + private Integer version;
  67 +
  68 + /** 退款单创建时间 */
  69 + private LocalDateTime createdTime;
  70 +
  71 + /** 退款单更新时间 */
  72 + private LocalDateTime modifiedTime;
  73 +
  74 + /**
  75 + * 退款时间
  76 + */
  77 + private LocalDateTime refundTime;
  78 +
  79 + private Long createId;
  80 +
  81 + private String createName;
  82 +
  83 + public Long getId() {
  84 + return id;
  85 + }
  86 +
  87 + public void setId(Long id) {
  88 + this.id = id;
  89 + }
  90 +
  91 + public String getRefundId() {
  92 + return refundId;
  93 + }
  94 +
  95 + public void setRefundId(String refundId) {
  96 + this.refundId = refundId;
  97 + }
  98 +
  99 + public Long getMarketId() {
  100 + return marketId;
  101 + }
  102 +
  103 + public void setMarketId(Long marketId) {
  104 + this.marketId = marketId;
  105 + }
  106 +
  107 + public Long getOrderId() {
  108 + return orderId;
  109 + }
  110 +
  111 + public void setOrderId(Long orderId) {
  112 + this.orderId = orderId;
  113 + }
35 114  
36   - public String getCode() {
37   - return code;
  115 + public String getOrderCode() {
  116 + return orderCode;
38 117 }
39 118  
40   - public void setCode(String code) {
41   - this.code = code;
  119 + public void setOrderCode(String orderCode) {
  120 + this.orderCode = orderCode;
42 121 }
43 122  
44 123 public BigDecimal getRefundAmount() {
... ... @@ -57,11 +136,83 @@ public class OrderRefundDto {
57 136 this.refundMessage = refundMessage;
58 137 }
59 138  
60   - public Long getMarketId() {
61   - return marketId;
  139 + public Integer getState() {
  140 + return state;
62 141 }
63 142  
64   - public void setMarketId(Long marketId) {
65   - this.marketId = marketId;
  143 + public void setState(Integer state) {
  144 + this.state = state;
  145 + }
  146 +
  147 + public String getTradeId() {
  148 + return tradeId;
  149 + }
  150 +
  151 + public void setTradeId(String tradeId) {
  152 + this.tradeId = tradeId;
  153 + }
  154 +
  155 + public String getNotic() {
  156 + return notic;
  157 + }
  158 +
  159 + public void setNotic(String notic) {
  160 + this.notic = notic;
  161 + }
  162 +
  163 + public Long getOrderPaymentId() {
  164 + return orderPaymentId;
  165 + }
  166 +
  167 + public void setOrderPaymentId(Long orderPaymentId) {
  168 + this.orderPaymentId = orderPaymentId;
  169 + }
  170 +
  171 + public Integer getVersion() {
  172 + return version;
  173 + }
  174 +
  175 + public void setVersion(Integer version) {
  176 + this.version = version;
  177 + }
  178 +
  179 + public LocalDateTime getCreatedTime() {
  180 + return createdTime;
  181 + }
  182 +
  183 + public void setCreatedTime(LocalDateTime createdTime) {
  184 + this.createdTime = createdTime;
  185 + }
  186 +
  187 + public LocalDateTime getModifiedTime() {
  188 + return modifiedTime;
  189 + }
  190 +
  191 + public void setModifiedTime(LocalDateTime modifiedTime) {
  192 + this.modifiedTime = modifiedTime;
  193 + }
  194 +
  195 + public LocalDateTime getRefundTime() {
  196 + return refundTime;
  197 + }
  198 +
  199 + public void setRefundTime(LocalDateTime refundTime) {
  200 + this.refundTime = refundTime;
  201 + }
  202 +
  203 + public Long getCreateId() {
  204 + return createId;
  205 + }
  206 +
  207 + public void setCreateId(Long createId) {
  208 + this.createId = createId;
  209 + }
  210 +
  211 + public String getCreateName() {
  212 + return createName;
  213 + }
  214 +
  215 + public void setCreateName(String createName) {
  216 + this.createName = createName;
66 217 }
67 218 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderRefundService.java
... ... @@ -3,6 +3,7 @@ package com.diligrp.etrade.order.service;
3 3 import com.diligrp.etrade.core.authority.UserTicket;
4 4 import com.diligrp.etrade.core.domain.Message;
5 5 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  6 +import com.diligrp.etrade.order.domain.OrderRefundAddDto;
6 7 import com.diligrp.etrade.order.domain.OrderRefundDto;
7 8 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
8 9 import com.diligrp.etrade.order.model.OrderRefund;
... ... @@ -19,7 +20,7 @@ public interface OrderRefundService {
19 20 * @param userTicket
20 21 * @return
21 22 */
22   - Message<OrderRefund> addRefund(OrderRefundDto refundDto, UserTicket userTicket);
  23 + Message<OrderRefund> addRefund(OrderRefundAddDto refundDto, UserTicket userTicket);
23 24  
24 25 /**
25 26 * 根据退款单发起退款
... ... @@ -54,5 +55,5 @@ public interface OrderRefundService {
54 55 * @param queryDto
55 56 * @return
56 57 */
57   - List<OrderRefund> getOrderRefundList(OrderRefundQueryDto queryDto);
  58 + List<OrderRefundDto> getOrderRefundList(OrderRefundQueryDto queryDto);
58 59 }
... ...
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderRefundServiceImpl.java
... ... @@ -3,10 +3,7 @@ package com.diligrp.etrade.order.service.impl;
3 3 import com.diligrp.etrade.core.authority.UserTicket;
4 4 import com.diligrp.etrade.core.domain.Message;
5 5 import com.diligrp.etrade.order.dao.OrderRefundMapper;
6   -import com.diligrp.etrade.order.domain.OrderGetDto;
7   -import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
8   -import com.diligrp.etrade.order.domain.OrderRefundDto;
9   -import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
  6 +import com.diligrp.etrade.order.domain.*;
10 7 import com.diligrp.etrade.order.exception.OrderErrorCode;
11 8 import com.diligrp.etrade.order.exception.OrderException;
12 9 import com.diligrp.etrade.order.model.Order;
... ... @@ -60,7 +57,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
60 57 private WeChatPayRpcResolver weChatPayRpcResolver;
61 58 @Transactional(rollbackFor = Exception.class)
62 59 @Override
63   - public Message<OrderRefund> addRefund(OrderRefundDto refundDto, UserTicket userTicket) {
  60 + public Message<OrderRefund> addRefund(OrderRefundAddDto refundDto, UserTicket userTicket) {
64 61 //基础参数效验
65 62 LOGGER.info("退款单入参{},操作员{}",refundDto,userTicket);
66 63 Order order = orderService.getOneOrder(new OrderGetDto(null, refundDto.getCode(), refundDto.getMarketId()));
... ... @@ -228,7 +225,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
228 225 * @param userTicket
229 226 * @return
230 227 */
231   - private OrderRefund bulidOrderReFund(OrderRefundDto refundDto, Order order, OrderPayment orderPayment,UserTicket userTicket) {
  228 + private OrderRefund bulidOrderReFund(OrderRefundAddDto refundDto, Order order, OrderPayment orderPayment, UserTicket userTicket) {
232 229 OrderRefund orderRefund = new OrderRefund();
233 230 orderRefund.setOrderCode(order.getCode());
234 231 orderRefund.setOrderId(order.getId());
... ... @@ -256,7 +253,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
256 253  
257 254  
258 255 @Override
259   - public List<OrderRefund> getOrderRefundList(OrderRefundQueryDto queryDto){
  256 + public List<OrderRefundDto> getOrderRefundList(OrderRefundQueryDto queryDto){
260 257 if(queryDto==null){
261 258 return new ArrayList<>();
262 259 }
... ...
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderRefundMapper.xml
... ... @@ -26,6 +26,13 @@
26 26 order_payment_id,created_time,modified_time,version,
27 27 refund_time,create_id,create_name
28 28 </sql>
  29 + <sql id="baseDecimalSql" >
  30 + id,refund_id,order_id,order_code,market_id,
  31 + convert(refund_amount, decimal(20,2))/100 as refund_amount,
  32 + refund_message,state,notic,trade_id,
  33 + order_payment_id,created_time,modified_time,version,
  34 + refund_time,create_id,create_name
  35 + </sql>
29 36 <insert id="insert" parameterType="com.diligrp.etrade.order.model.OrderRefund" useGeneratedKeys="true" keyProperty="id" >
30 37 insert into order_refund (refund_id,order_id,order_code,market_id,
31 38 refund_amount,refund_message,state,notic,trade_id,
... ... @@ -105,9 +112,9 @@
105 112 </if>
106 113 </where>
107 114 </select>
108   - <select id="getOrderRefundList" resultType="com.diligrp.etrade.order.model.OrderRefund"
  115 + <select id="getOrderRefundList" resultType="com.diligrp.etrade.order.domain.OrderRefundDto"
109 116 parameterType="com.diligrp.etrade.order.domain.OrderRefundQueryDto">
110   - select <include refid="baseSql"/> from order_refund
  117 + select <include refid="baseDecimalSql"/> from order_refund
111 118 <where>
112 119 <if test="orderCode != null and orderCode !='' " >
113 120 and order_code = #{orderCode,jdbcType=VARCHAR}
... ...