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,6 +5,7 @@ import com.diligrp.etrade.core.authority.UserTicket;
5 import com.diligrp.etrade.core.domain.Message; 5 import com.diligrp.etrade.core.domain.Message;
6 import com.diligrp.etrade.core.exception.PlatformServiceException; 6 import com.diligrp.etrade.core.exception.PlatformServiceException;
7 import com.diligrp.etrade.order.domain.OrderRefundCheckDto; 7 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  8 +import com.diligrp.etrade.order.domain.OrderRefundAddDto;
8 import com.diligrp.etrade.order.domain.OrderRefundDto; 9 import com.diligrp.etrade.order.domain.OrderRefundDto;
9 import com.diligrp.etrade.order.domain.OrderRefundQueryDto; 10 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
10 import com.diligrp.etrade.order.model.OrderRefund; 11 import com.diligrp.etrade.order.model.OrderRefund;
@@ -42,7 +43,7 @@ public class OrderManagerController { @@ -42,7 +43,7 @@ public class OrderManagerController {
42 * @return 43 * @return
43 */ 44 */
44 @RequestMapping(value = "/refund",method = {RequestMethod.POST},produces="application/json;charset=UTF-8") 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 UserTicket userTicket = SessionContext.getUserTicket(); 47 UserTicket userTicket = SessionContext.getUserTicket();
47 try{ 48 try{
48 RLock lock = redissonClient.getLock(OrderConstant.OrderLock + refundDto.getCode()); 49 RLock lock = redissonClient.getLock(OrderConstant.OrderLock + refundDto.getCode());
@@ -101,12 +102,12 @@ public class OrderManagerController { @@ -101,12 +102,12 @@ public class OrderManagerController {
101 * @return 102 * @return
102 */ 103 */
103 @RequestMapping(value = "/refundList",method = {RequestMethod.POST},produces="application/json;charset=UTF-8") 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 try{ 106 try{
106 if(StringUtils.isBlank(orderRefundQueryDto.getOrderCode())){ 107 if(StringUtils.isBlank(orderRefundQueryDto.getOrderCode())){
107 return Message.failure("订单号不能为空"); 108 return Message.failure("订单号不能为空");
108 } 109 }
109 - List<OrderRefund> orderRefundList = orderRefundService.getOrderRefundList(orderRefundQueryDto); 110 + List<OrderRefundDto> orderRefundList = orderRefundService.getOrderRefundList(orderRefundQueryDto);
110 return Message.success(orderRefundList); 111 return Message.success(orderRefundList);
111 }catch (PlatformServiceException pe) { 112 }catch (PlatformServiceException pe) {
112 LOGGER.warn("服务异常{}:{}",pe.getCode(), pe.getMessage()); 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,6 +2,7 @@ package com.diligrp.etrade.order.dao;
2 2
3 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport; 3 import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
4 import com.diligrp.etrade.order.domain.OrderRefundCheckDto; 4 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  5 +import com.diligrp.etrade.order.domain.OrderRefundDto;
5 import com.diligrp.etrade.order.domain.OrderRefundQueryDto; 6 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
6 import com.diligrp.etrade.order.model.OrderRefund; 7 import com.diligrp.etrade.order.model.OrderRefund;
7 import org.apache.ibatis.annotations.Param; 8 import org.apache.ibatis.annotations.Param;
@@ -40,5 +41,5 @@ public interface OrderRefundMapper extends MybatisMapperSupport { @@ -40,5 +41,5 @@ public interface OrderRefundMapper extends MybatisMapperSupport {
40 * @param queryDto 41 * @param queryDto
41 * @return 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 package com.diligrp.etrade.order.domain; 1 package com.diligrp.etrade.order.domain;
2 2
3 -import com.diligrp.etrade.order.type.OrderPaymentAllChannel;  
4 import jakarta.validation.constraints.NotBlank; 3 import jakarta.validation.constraints.NotBlank;
5 import jakarta.validation.constraints.NotNull; 4 import jakarta.validation.constraints.NotNull;
6 5
7 import java.math.BigDecimal; 6 import java.math.BigDecimal;
8 -import java.math.RoundingMode;  
9 import java.time.LocalDateTime; 7 import java.time.LocalDateTime;
10 -import java.util.List;  
11 8
12 /** 订单出参 */ 9 /** 订单出参 */
13 public class OrderRefundDto { 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 private BigDecimal refundAmount; 36 private BigDecimal refundAmount;
25 37
26 /** 38 /**
27 * 退款说明 39 * 退款说明
28 */ 40 */
29 private String refundMessage; 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 public BigDecimal getRefundAmount() { 123 public BigDecimal getRefundAmount() {
@@ -57,11 +136,83 @@ public class OrderRefundDto { @@ -57,11 +136,83 @@ public class OrderRefundDto {
57 this.refundMessage = refundMessage; 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,6 +3,7 @@ package com.diligrp.etrade.order.service;
3 import com.diligrp.etrade.core.authority.UserTicket; 3 import com.diligrp.etrade.core.authority.UserTicket;
4 import com.diligrp.etrade.core.domain.Message; 4 import com.diligrp.etrade.core.domain.Message;
5 import com.diligrp.etrade.order.domain.OrderRefundCheckDto; 5 import com.diligrp.etrade.order.domain.OrderRefundCheckDto;
  6 +import com.diligrp.etrade.order.domain.OrderRefundAddDto;
6 import com.diligrp.etrade.order.domain.OrderRefundDto; 7 import com.diligrp.etrade.order.domain.OrderRefundDto;
7 import com.diligrp.etrade.order.domain.OrderRefundQueryDto; 8 import com.diligrp.etrade.order.domain.OrderRefundQueryDto;
8 import com.diligrp.etrade.order.model.OrderRefund; 9 import com.diligrp.etrade.order.model.OrderRefund;
@@ -19,7 +20,7 @@ public interface OrderRefundService { @@ -19,7 +20,7 @@ public interface OrderRefundService {
19 * @param userTicket 20 * @param userTicket
20 * @return 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,5 +55,5 @@ public interface OrderRefundService {
54 * @param queryDto 55 * @param queryDto
55 * @return 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,10 +3,7 @@ package com.diligrp.etrade.order.service.impl;
3 import com.diligrp.etrade.core.authority.UserTicket; 3 import com.diligrp.etrade.core.authority.UserTicket;
4 import com.diligrp.etrade.core.domain.Message; 4 import com.diligrp.etrade.core.domain.Message;
5 import com.diligrp.etrade.order.dao.OrderRefundMapper; 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 import com.diligrp.etrade.order.exception.OrderErrorCode; 7 import com.diligrp.etrade.order.exception.OrderErrorCode;
11 import com.diligrp.etrade.order.exception.OrderException; 8 import com.diligrp.etrade.order.exception.OrderException;
12 import com.diligrp.etrade.order.model.Order; 9 import com.diligrp.etrade.order.model.Order;
@@ -60,7 +57,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { @@ -60,7 +57,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
60 private WeChatPayRpcResolver weChatPayRpcResolver; 57 private WeChatPayRpcResolver weChatPayRpcResolver;
61 @Transactional(rollbackFor = Exception.class) 58 @Transactional(rollbackFor = Exception.class)
62 @Override 59 @Override
63 - public Message<OrderRefund> addRefund(OrderRefundDto refundDto, UserTicket userTicket) { 60 + public Message<OrderRefund> addRefund(OrderRefundAddDto refundDto, UserTicket userTicket) {
64 //基础参数效验 61 //基础参数效验
65 LOGGER.info("退款单入参{},操作员{}",refundDto,userTicket); 62 LOGGER.info("退款单入参{},操作员{}",refundDto,userTicket);
66 Order order = orderService.getOneOrder(new OrderGetDto(null, refundDto.getCode(), refundDto.getMarketId())); 63 Order order = orderService.getOneOrder(new OrderGetDto(null, refundDto.getCode(), refundDto.getMarketId()));
@@ -228,7 +225,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { @@ -228,7 +225,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
228 * @param userTicket 225 * @param userTicket
229 * @return 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 OrderRefund orderRefund = new OrderRefund(); 229 OrderRefund orderRefund = new OrderRefund();
233 orderRefund.setOrderCode(order.getCode()); 230 orderRefund.setOrderCode(order.getCode());
234 orderRefund.setOrderId(order.getId()); 231 orderRefund.setOrderId(order.getId());
@@ -256,7 +253,7 @@ public class OrderRefundServiceImpl implements OrderRefundService { @@ -256,7 +253,7 @@ public class OrderRefundServiceImpl implements OrderRefundService {
256 253
257 254
258 @Override 255 @Override
259 - public List<OrderRefund> getOrderRefundList(OrderRefundQueryDto queryDto){ 256 + public List<OrderRefundDto> getOrderRefundList(OrderRefundQueryDto queryDto){
260 if(queryDto==null){ 257 if(queryDto==null){
261 return new ArrayList<>(); 258 return new ArrayList<>();
262 } 259 }
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderRefundMapper.xml
@@ -26,6 +26,13 @@ @@ -26,6 +26,13 @@
26 order_payment_id,created_time,modified_time,version, 26 order_payment_id,created_time,modified_time,version,
27 refund_time,create_id,create_name 27 refund_time,create_id,create_name
28 </sql> 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 <insert id="insert" parameterType="com.diligrp.etrade.order.model.OrderRefund" useGeneratedKeys="true" keyProperty="id" > 36 <insert id="insert" parameterType="com.diligrp.etrade.order.model.OrderRefund" useGeneratedKeys="true" keyProperty="id" >
30 insert into order_refund (refund_id,order_id,order_code,market_id, 37 insert into order_refund (refund_id,order_id,order_code,market_id,
31 refund_amount,refund_message,state,notic,trade_id, 38 refund_amount,refund_message,state,notic,trade_id,
@@ -105,9 +112,9 @@ @@ -105,9 +112,9 @@
105 </if> 112 </if>
106 </where> 113 </where>
107 </select> 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 parameterType="com.diligrp.etrade.order.domain.OrderRefundQueryDto"> 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 <where> 118 <where>
112 <if test="orderCode != null and orderCode !='' " > 119 <if test="orderCode != null and orderCode !='' " >
113 and order_code = #{orderCode,jdbcType=VARCHAR} 120 and order_code = #{orderCode,jdbcType=VARCHAR}