Commit fd91d5cf9bf10d6ecae7208b193fa4e42bf5300c
Merge remote-tracking branch 'origin/feature_v1.1.2.20241212' into dev
Showing
10 changed files
with
580 additions
and
413 deletions
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderPayDto.java
@@ -70,6 +70,11 @@ public class OrderPayDto { | @@ -70,6 +70,11 @@ public class OrderPayDto { | ||
70 | @Valid | 70 | @Valid |
71 | private OrderDeliveryDto delivery; | 71 | private OrderDeliveryDto delivery; |
72 | 72 | ||
73 | + /** | ||
74 | + * 园区卡支付子渠道分类 | ||
75 | + */ | ||
76 | + private Integer payChannelSub; | ||
77 | + | ||
73 | public String getPaymentId() { | 78 | public String getPaymentId() { |
74 | return paymentId; | 79 | return paymentId; |
75 | } | 80 | } |
@@ -245,7 +250,7 @@ public class OrderPayDto { | @@ -245,7 +250,7 @@ public class OrderPayDto { | ||
245 | 250 | ||
246 | public OrderPayDto(String str,Long marketId,Long payerCustomerId,Long payerStoreCustomerId,String payerCustomerName,String payerPhone,String payerCardNo | 251 | public OrderPayDto(String str,Long marketId,Long payerCustomerId,Long payerStoreCustomerId,String payerCustomerName,String payerPhone,String payerCardNo |
247 | ,Long payerAccountId,Long payerFundAccountId,String payerPassWord,Long operateId,String operateName,String holdName,String holdCertificateNumber,String holdContactsPhone | 252 | ,Long payerAccountId,Long payerFundAccountId,String payerPassWord,Long operateId,String operateName,String holdName,String holdCertificateNumber,String holdContactsPhone |
248 | - ,String customerAbbr,String paymentId){ | 253 | + ,String customerAbbr,String paymentId,Integer payChannelSub){ |
249 | this.code = str; | 254 | this.code = str; |
250 | this.marketId = marketId; | 255 | this.marketId = marketId; |
251 | this.payerCustomerId = payerCustomerId; | 256 | this.payerCustomerId = payerCustomerId; |
@@ -265,6 +270,7 @@ public class OrderPayDto { | @@ -265,6 +270,7 @@ public class OrderPayDto { | ||
265 | this.holdCertificateNumber = holdCertificateNumber; | 270 | this.holdCertificateNumber = holdCertificateNumber; |
266 | this.holdContactsPhone = holdContactsPhone; | 271 | this.holdContactsPhone = holdContactsPhone; |
267 | this.paymentId = paymentId; | 272 | this.paymentId = paymentId; |
273 | + this.payChannelSub = payChannelSub; | ||
268 | } | 274 | } |
269 | 275 | ||
270 | public OrderPayDto(){ | 276 | public OrderPayDto(){ |
@@ -286,4 +292,12 @@ public class OrderPayDto { | @@ -286,4 +292,12 @@ public class OrderPayDto { | ||
286 | public void setDelivery(OrderDeliveryDto delivery) { | 292 | public void setDelivery(OrderDeliveryDto delivery) { |
287 | this.delivery = delivery; | 293 | this.delivery = delivery; |
288 | } | 294 | } |
295 | + | ||
296 | + public Integer getPayChannelSub() { | ||
297 | + return payChannelSub; | ||
298 | + } | ||
299 | + | ||
300 | + public void setPayChannelSub(Integer payChannelSub) { | ||
301 | + this.payChannelSub = payChannelSub; | ||
302 | + } | ||
289 | } | 303 | } |
etrade-order/src/main/java/com/diligrp/etrade/order/domain/OrderWeChatPayBatch.java
@@ -61,6 +61,11 @@ public class OrderWeChatPayBatch { | @@ -61,6 +61,11 @@ public class OrderWeChatPayBatch { | ||
61 | @Valid | 61 | @Valid |
62 | private OrderDeliveryDto delivery; | 62 | private OrderDeliveryDto delivery; |
63 | 63 | ||
64 | + /** | ||
65 | + * 园区卡支付子渠道分类 | ||
66 | + */ | ||
67 | + private Integer payChannelSub; | ||
68 | + | ||
64 | public String getPayType() { | 69 | public String getPayType() { |
65 | return payType; | 70 | return payType; |
66 | } | 71 | } |
@@ -204,4 +209,12 @@ public class OrderWeChatPayBatch { | @@ -204,4 +209,12 @@ public class OrderWeChatPayBatch { | ||
204 | public void setDelivery(OrderDeliveryDto delivery) { | 209 | public void setDelivery(OrderDeliveryDto delivery) { |
205 | this.delivery = delivery; | 210 | this.delivery = delivery; |
206 | } | 211 | } |
212 | + | ||
213 | + public Integer getPayChannelSub() { | ||
214 | + return payChannelSub; | ||
215 | + } | ||
216 | + | ||
217 | + public void setPayChannelSub(Integer payChannelSub) { | ||
218 | + this.payChannelSub = payChannelSub; | ||
219 | + } | ||
207 | } | 220 | } |
etrade-order/src/main/java/com/diligrp/etrade/order/model/OrderPayment.java
@@ -87,6 +87,11 @@ public class OrderPayment { | @@ -87,6 +87,11 @@ public class OrderPayment { | ||
87 | */ | 87 | */ |
88 | private Long relationId; | 88 | private Long relationId; |
89 | 89 | ||
90 | + /** | ||
91 | + * 园区卡支付子渠道分类 | ||
92 | + */ | ||
93 | + private Integer payChannelSub; | ||
94 | + | ||
90 | public Long getTotleSellerFee() { | 95 | public Long getTotleSellerFee() { |
91 | return totleSellerFee; | 96 | return totleSellerFee; |
92 | } | 97 | } |
@@ -344,4 +349,12 @@ public class OrderPayment { | @@ -344,4 +349,12 @@ public class OrderPayment { | ||
344 | public void setRelationId(Long relationId) { | 349 | public void setRelationId(Long relationId) { |
345 | this.relationId = relationId; | 350 | this.relationId = relationId; |
346 | } | 351 | } |
352 | + | ||
353 | + public Integer getPayChannelSub() { | ||
354 | + return payChannelSub; | ||
355 | + } | ||
356 | + | ||
357 | + public void setPayChannelSub(Integer payChannelSub) { | ||
358 | + this.payChannelSub = payChannelSub; | ||
359 | + } | ||
347 | } | 360 | } |
348 | \ No newline at end of file | 361 | \ No newline at end of file |
etrade-order/src/main/java/com/diligrp/etrade/order/service/OrderPaymentService.java
@@ -6,6 +6,7 @@ import com.diligrp.etrade.order.model.Order; | @@ -6,6 +6,7 @@ import com.diligrp.etrade.order.model.Order; | ||
6 | import com.diligrp.etrade.order.model.OrderCoupon; | 6 | import com.diligrp.etrade.order.model.OrderCoupon; |
7 | import com.diligrp.etrade.order.model.OrderPayment; | 7 | import com.diligrp.etrade.order.model.OrderPayment; |
8 | import com.diligrp.etrade.order.type.OrderPaymentAllChannel; | 8 | import com.diligrp.etrade.order.type.OrderPaymentAllChannel; |
9 | +import com.diligrp.etrade.order.type.OrderPaymentSubChannel; | ||
9 | import com.diligrp.etrade.rpc.dto.WeChatPayFunctionBackDto; | 10 | import com.diligrp.etrade.rpc.dto.WeChatPayFunctionBackDto; |
10 | import com.diligrp.etrade.rpc.dto.WeChatPayFunctionDto; | 11 | import com.diligrp.etrade.rpc.dto.WeChatPayFunctionDto; |
11 | import com.diligrp.etrade.rpc.dto.WeChatPayTradeBackDto; | 12 | import com.diligrp.etrade.rpc.dto.WeChatPayTradeBackDto; |
@@ -79,7 +80,7 @@ public interface OrderPaymentService { | @@ -79,7 +80,7 @@ public interface OrderPaymentService { | ||
79 | */ | 80 | */ |
80 | OrderPayment payOrderBuyCreditCode(Order order, OrderPayDto orderPayDto, Integer identityType); | 81 | OrderPayment payOrderBuyCreditCode(Order order, OrderPayDto orderPayDto, Integer identityType); |
81 | 82 | ||
82 | - void checkPayChannel(OrderPaymentAllChannel orderPaymentChannel, Long marketId); | 83 | + void checkPayChannel(OrderPaymentAllChannel orderPaymentChannel, Long marketId, OrderPaymentSubChannel subChannel); |
83 | 84 | ||
84 | /** | 85 | /** |
85 | * 店员检测 | 86 | * 店员检测 |
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderPaymenServiceImpl.java
@@ -103,53 +103,53 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -103,53 +103,53 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
103 | @Override | 103 | @Override |
104 | public OrderPayment OrderPaymentByCard(Order order, OrderPayDto orderPayDto, Integer identityType) { | 104 | public OrderPayment OrderPaymentByCard(Order order, OrderPayDto orderPayDto, Integer identityType) { |
105 | //根据状态检查入参 | 105 | //根据状态检查入参 |
106 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_CARD, OrderPaymentAllChannel.CARD_CHANNEL); | 106 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_CARD, OrderPaymentAllChannel.CARD_CHANNEL); |
107 | //效验店铺 | 107 | //效验店铺 |
108 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 108 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
109 | - if(shop.getFundAccountId()==null){ | ||
110 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"店铺未绑定收款园区卡,不能使用园区卡付款。"); | 109 | + if (shop.getFundAccountId() == null) { |
110 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "店铺未绑定收款园区卡,不能使用园区卡付款。"); | ||
111 | } | 111 | } |
112 | - LOGGER.info("开始生成结算单,{}",order.getCode()); | 112 | + LOGGER.info("开始生成结算单,{}", order.getCode()); |
113 | //生成结算单 | 113 | //生成结算单 |
114 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 114 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
115 | , OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger()); | 115 | , OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger()); |
116 | List<OrderCoupon> feeList = null; | 116 | List<OrderCoupon> feeList = null; |
117 | - if(orderPayment.getPayDiscount()>0){ | ||
118 | - LOGGER.info("优惠券调取,{}",order.getCode()); | 117 | + if (orderPayment.getPayDiscount() > 0) { |
118 | + LOGGER.info("优惠券调取,{}", order.getCode()); | ||
119 | //获取优惠信息 | 119 | //获取优惠信息 |
120 | - feeList = orderCouponService.getCouponList(order.getId(),order.getMarketId(),OrderCouponState.COUPON_NORMAL.getCodeInteger()); | 120 | + feeList = orderCouponService.getCouponList(order.getId(), order.getMarketId(), OrderCouponState.COUPON_NORMAL.getCodeInteger()); |
121 | // //优惠券使用记录 | 121 | // //优惠券使用记录 |
122 | // orderCouponService.usedCoupon(feeList,order,shop); | 122 | // orderCouponService.usedCoupon(feeList,order,shop); |
123 | } | 123 | } |
124 | //扣减库存T | 124 | //扣减库存T |
125 | - orderGoodsService.deduct(order,orderPayment.getPayerCustomerId(),orderPayment.getPayerCustomerName()); | ||
126 | - LOGGER.info("准备调用支付,{}",order.getCode()); | 125 | + orderGoodsService.deduct(order, orderPayment.getPayerCustomerId(), orderPayment.getPayerCustomerName()); |
126 | + LOGGER.info("准备调用支付,{}", order.getCode()); | ||
127 | //调用支付服务 | 127 | //调用支付服务 |
128 | - CreateSubmitTradeDto createSubmitTradeDto = createCreateSubmitTradeDto(order,orderPayment,feeList,orderPayDto.getPayerPassWord()); | 128 | + CreateSubmitTradeDto createSubmitTradeDto = createCreateSubmitTradeDto(order, orderPayment, feeList, orderPayDto.getPayerPassWord()); |
129 | Message<BalanceResponseDto> submitTrade = payRpcResolver.createSubmitTrade(createSubmitTradeDto); | 129 | Message<BalanceResponseDto> submitTrade = payRpcResolver.createSubmitTrade(createSubmitTradeDto); |
130 | - if(!submitTrade.isSuccess()){ | ||
131 | - throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR,"园区卡支付异常"); | 130 | + if (!submitTrade.isSuccess()) { |
131 | + throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR, "园区卡支付异常"); | ||
132 | } | 132 | } |
133 | - LOGGER.info("调用支付完成,{}",order.getCode()); | ||
134 | - try{ | 133 | + LOGGER.info("调用支付完成,{}", order.getCode()); |
134 | + try { | ||
135 | //修改订单与支付单状态 | 135 | //修改订单与支付单状态 |
136 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_CARD,submitTrade.getData().getTradeId(),shop); | 136 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_CARD, submitTrade.getData().getTradeId(), shop); |
137 | //写入流水记录 | 137 | //写入流水记录 |
138 | - sendSerialRecord(submitTrade.getData(),order,orderPayment,feeList,orderPayDto,null); | ||
139 | - }catch (OrderException oe){ | ||
140 | - LOGGER.info("支付成功后,订单{}其他功能异常,{}",order.getCode(),oe.getMessage()); | 138 | + sendSerialRecord(submitTrade.getData(), order, orderPayment, feeList, orderPayDto, null); |
139 | + } catch (OrderException oe) { | ||
140 | + LOGGER.info("支付成功后,订单{}其他功能异常,{}", order.getCode(), oe.getMessage()); | ||
141 | CancelTradeDto cancelDto = new CancelTradeDto(); | 141 | CancelTradeDto cancelDto = new CancelTradeDto(); |
142 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); | 142 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); |
143 | cancelDto.setMchId(orderPayment.getMarketId().toString()); | 143 | cancelDto.setMchId(orderPayment.getMarketId().toString()); |
144 | payRpcResolver.cancelTrade(cancelDto); | 144 | payRpcResolver.cancelTrade(cancelDto); |
145 | throw oe; | 145 | throw oe; |
146 | - }catch (Exception e){ | ||
147 | - LOGGER.error("订单支付系统异常",e); | 146 | + } catch (Exception e) { |
147 | + LOGGER.error("订单支付系统异常", e); | ||
148 | CancelTradeDto cancelDto = new CancelTradeDto(); | 148 | CancelTradeDto cancelDto = new CancelTradeDto(); |
149 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); | 149 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); |
150 | cancelDto.setMchId(orderPayment.getMarketId().toString()); | 150 | cancelDto.setMchId(orderPayment.getMarketId().toString()); |
151 | payRpcResolver.cancelTrade(cancelDto); | 151 | payRpcResolver.cancelTrade(cancelDto); |
152 | - throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR,"订单支付系统异常"); | 152 | + throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR, "订单支付系统异常"); |
153 | } | 153 | } |
154 | 154 | ||
155 | return orderPayment; | 155 | return orderPayment; |
@@ -161,48 +161,48 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -161,48 +161,48 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
161 | public OrderPayVo OrderPaymentByCardOnly(Order order, OrderPayDto orderPayDto, Integer identityType) { | 161 | public OrderPayVo OrderPaymentByCardOnly(Order order, OrderPayDto orderPayDto, Integer identityType) { |
162 | OrderPayVo payVo = new OrderPayVo(); | 162 | OrderPayVo payVo = new OrderPayVo(); |
163 | //根据状态检查入参 | 163 | //根据状态检查入参 |
164 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_CARD, OrderPaymentAllChannel.CARD_CHANNEL); | 164 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_CARD, OrderPaymentAllChannel.CARD_CHANNEL); |
165 | //效验店铺 | 165 | //效验店铺 |
166 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 166 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
167 | - if(shop.getFundAccountId()==null){ | ||
168 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"店铺未绑定收款园区卡,不能使用园区卡付款。"); | 167 | + if (shop.getFundAccountId() == null) { |
168 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "店铺未绑定收款园区卡,不能使用园区卡付款。"); | ||
169 | } | 169 | } |
170 | - LOGGER.info("开始生成结算单,{}",order.getCode()); | 170 | + LOGGER.info("开始生成结算单,{}", order.getCode()); |
171 | //生成结算单 | 171 | //生成结算单 |
172 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 172 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
173 | , OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger()); | 173 | , OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger()); |
174 | List<OrderCoupon> feeList = null; | 174 | List<OrderCoupon> feeList = null; |
175 | - if(orderPayment.getPayDiscount()>0){ | ||
176 | - LOGGER.info("优惠券调取,{}",order.getCode()); | 175 | + if (orderPayment.getPayDiscount() > 0) { |
176 | + LOGGER.info("优惠券调取,{}", order.getCode()); | ||
177 | //获取优惠信息 | 177 | //获取优惠信息 |
178 | - feeList = orderCouponService.getCouponList(order.getId(),order.getMarketId(),OrderCouponState.COUPON_NORMAL.getCodeInteger()); | 178 | + feeList = orderCouponService.getCouponList(order.getId(), order.getMarketId(), OrderCouponState.COUPON_NORMAL.getCodeInteger()); |
179 | // //优惠券使用记录 | 179 | // //优惠券使用记录 |
180 | // orderCouponService.usedCoupon(feeList,order,shop); | 180 | // orderCouponService.usedCoupon(feeList,order,shop); |
181 | } | 181 | } |
182 | - LOGGER.info("准备调用支付,{}",order.getCode()); | 182 | + LOGGER.info("准备调用支付,{}", order.getCode()); |
183 | //调用支付服务 | 183 | //调用支付服务 |
184 | - CreateSubmitTradeDto createSubmitTradeDto = createCreateSubmitTradeDto(order,orderPayment,feeList,orderPayDto.getPayerPassWord()); | 184 | + CreateSubmitTradeDto createSubmitTradeDto = createCreateSubmitTradeDto(order, orderPayment, feeList, orderPayDto.getPayerPassWord()); |
185 | Message<BalanceResponseDto> submitTrade = payRpcResolver.createSubmitTrade(createSubmitTradeDto); | 185 | Message<BalanceResponseDto> submitTrade = payRpcResolver.createSubmitTrade(createSubmitTradeDto); |
186 | - LOGGER.info("调用支付完成,{}",order.getCode()); | ||
187 | - try{ | 186 | + LOGGER.info("调用支付完成,{}", order.getCode()); |
187 | + try { | ||
188 | //修改订单与支付单状态 | 188 | //修改订单与支付单状态 |
189 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_CARD,submitTrade.getData().getTradeId(),shop); | 189 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_CARD, submitTrade.getData().getTradeId(), shop); |
190 | //获取流水记录 | 190 | //获取流水记录 |
191 | - payVo.setSerialRecordDtos(getSerialRecord(submitTrade.getData(), order, orderPayment, feeList, orderPayDto,null)); | ||
192 | - }catch (OrderException oe){ | ||
193 | - LOGGER.info("支付成功后,订单{}其他功能异常,{}",order.getCode(),oe.getMessage()); | 191 | + payVo.setSerialRecordDtos(getSerialRecord(submitTrade.getData(), order, orderPayment, feeList, orderPayDto, null)); |
192 | + } catch (OrderException oe) { | ||
193 | + LOGGER.info("支付成功后,订单{}其他功能异常,{}", order.getCode(), oe.getMessage()); | ||
194 | CancelTradeDto cancelDto = new CancelTradeDto(); | 194 | CancelTradeDto cancelDto = new CancelTradeDto(); |
195 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); | 195 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); |
196 | cancelDto.setMchId(orderPayment.getMarketId().toString()); | 196 | cancelDto.setMchId(orderPayment.getMarketId().toString()); |
197 | payRpcResolver.cancelTrade(cancelDto); | 197 | payRpcResolver.cancelTrade(cancelDto); |
198 | throw oe; | 198 | throw oe; |
199 | - }catch (Exception e){ | ||
200 | - LOGGER.error("订单支付系统异常",e); | 199 | + } catch (Exception e) { |
200 | + LOGGER.error("订单支付系统异常", e); | ||
201 | CancelTradeDto cancelDto = new CancelTradeDto(); | 201 | CancelTradeDto cancelDto = new CancelTradeDto(); |
202 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); | 202 | cancelDto.setTradeId(submitTrade.getData().getTradeId()); |
203 | cancelDto.setMchId(orderPayment.getMarketId().toString()); | 203 | cancelDto.setMchId(orderPayment.getMarketId().toString()); |
204 | payRpcResolver.cancelTrade(cancelDto); | 204 | payRpcResolver.cancelTrade(cancelDto); |
205 | - throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR,"订单支付系统异常"); | 205 | + throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR, "订单支付系统异常"); |
206 | } | 206 | } |
207 | payVo.setOrderPayment(orderPayment); | 207 | payVo.setOrderPayment(orderPayment); |
208 | return payVo; | 208 | return payVo; |
@@ -211,114 +211,114 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -211,114 +211,114 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
211 | @Override | 211 | @Override |
212 | public OrderPayment OrderPaymentByCash(Order order, OrderPayDto orderPayDto, Integer identityType) { | 212 | public OrderPayment OrderPaymentByCash(Order order, OrderPayDto orderPayDto, Integer identityType) { |
213 | //根据状态检查入参 | 213 | //根据状态检查入参 |
214 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_CASH, OrderPaymentAllChannel.CASH_CHANNEL); | 214 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_CASH, OrderPaymentAllChannel.CASH_CHANNEL); |
215 | //效验店铺 | 215 | //效验店铺 |
216 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 216 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
217 | //生成结算单 | 217 | //生成结算单 |
218 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 218 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
219 | , OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger()); | 219 | , OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger()); |
220 | //扣减库存T | 220 | //扣减库存T |
221 | - orderGoodsService.deduct(order,orderPayDto.getOperateId(),orderPayDto.getOperateName()); | 221 | + orderGoodsService.deduct(order, orderPayDto.getOperateId(), orderPayDto.getOperateName()); |
222 | //修改订单与支付单状态 | 222 | //修改订单与支付单状态 |
223 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_CASH,null,shop); | 223 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_CASH, null, shop); |
224 | //写入流水记录 | 224 | //写入流水记录 |
225 | - sendSerialRecord(null,order,orderPayment,null,orderPayDto,null); | 225 | + sendSerialRecord(null, order, orderPayment, null, orderPayDto, null); |
226 | return orderPayment; | 226 | return orderPayment; |
227 | } | 227 | } |
228 | 228 | ||
229 | @Override | 229 | @Override |
230 | public OrderPayment OrderPaymentByWx(Order order, OrderPayDto orderPayDto, Integer identityType) { | 230 | public OrderPayment OrderPaymentByWx(Order order, OrderPayDto orderPayDto, Integer identityType) { |
231 | //根据状态检查入参 | 231 | //根据状态检查入参 |
232 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_WX, OrderPaymentAllChannel.WX_CHANNEL); | 232 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_WX, OrderPaymentAllChannel.WX_CHANNEL); |
233 | //效验店铺 | 233 | //效验店铺 |
234 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 234 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
235 | //生成结算单 | 235 | //生成结算单 |
236 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 236 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
237 | , OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger()); | 237 | , OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger()); |
238 | //扣减库存T | 238 | //扣减库存T |
239 | - orderGoodsService.deduct(order,orderPayDto.getOperateId(),orderPayDto.getOperateName()); | 239 | + orderGoodsService.deduct(order, orderPayDto.getOperateId(), orderPayDto.getOperateName()); |
240 | //修改订单与支付单状态 | 240 | //修改订单与支付单状态 |
241 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_WX,null,shop); | 241 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_WX, null, shop); |
242 | //写入流水记录 | 242 | //写入流水记录 |
243 | - sendSerialRecord(null,order,orderPayment,null,orderPayDto,null); | 243 | + sendSerialRecord(null, order, orderPayment, null, orderPayDto, null); |
244 | return orderPayment; | 244 | return orderPayment; |
245 | } | 245 | } |
246 | 246 | ||
247 | @Override | 247 | @Override |
248 | public OrderPayment OrderPaymentByZfb(Order order, OrderPayDto orderPayDto, Integer identityType) { | 248 | public OrderPayment OrderPaymentByZfb(Order order, OrderPayDto orderPayDto, Integer identityType) { |
249 | //根据状态检查入参 | 249 | //根据状态检查入参 |
250 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_ZFB, OrderPaymentAllChannel.ZFB_CHANNEL); | 250 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_ZFB, OrderPaymentAllChannel.ZFB_CHANNEL); |
251 | //效验店铺 | 251 | //效验店铺 |
252 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 252 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
253 | //生成结算单 | 253 | //生成结算单 |
254 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 254 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
255 | , OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger()); | 255 | , OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger()); |
256 | //扣减库存T | 256 | //扣减库存T |
257 | - orderGoodsService.deduct(order,orderPayDto.getOperateId(),orderPayDto.getOperateName()); | 257 | + orderGoodsService.deduct(order, orderPayDto.getOperateId(), orderPayDto.getOperateName()); |
258 | //修改订单与支付单状态 | 258 | //修改订单与支付单状态 |
259 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_ZFB,null,shop); | 259 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_ZFB, null, shop); |
260 | //写入流水记录 | 260 | //写入流水记录 |
261 | - sendSerialRecord(null,order,orderPayment,null,orderPayDto,null); | 261 | + sendSerialRecord(null, order, orderPayment, null, orderPayDto, null); |
262 | return orderPayment; | 262 | return orderPayment; |
263 | } | 263 | } |
264 | 264 | ||
265 | @Override | 265 | @Override |
266 | public OrderPayment payOrderBuyCredit(Order order, OrderPayDto orderPayDto, Integer identityType) { | 266 | public OrderPayment payOrderBuyCredit(Order order, OrderPayDto orderPayDto, Integer identityType) { |
267 | //根据状态检查入参 | 267 | //根据状态检查入参 |
268 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_CREDIT, OrderPaymentAllChannel.CREDIT_CHANNEL); | 268 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_CREDIT, OrderPaymentAllChannel.CREDIT_CHANNEL); |
269 | //效验店铺 | 269 | //效验店铺 |
270 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 270 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
271 | //生成结算单 | 271 | //生成结算单 |
272 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.CREDIT.getCodeInteger() | 272 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.CREDIT.getCodeInteger() |
273 | , OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger()); | 273 | , OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger()); |
274 | //扣减库存T | 274 | //扣减库存T |
275 | - orderGoodsService.deduct(order,orderPayDto.getOperateId(),orderPayDto.getOperateName()); | 275 | + orderGoodsService.deduct(order, orderPayDto.getOperateId(), orderPayDto.getOperateName()); |
276 | //修改订单与支付单状态 | 276 | //修改订单与支付单状态 |
277 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_CREDIT,null,shop); | 277 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_CREDIT, null, shop); |
278 | //生成赊销记账单 | 278 | //生成赊销记账单 |
279 | - createLedgerDto(order,orderPayment,orderPayDto, shop); | 279 | + createLedgerDto(order, orderPayment, orderPayDto, shop); |
280 | //写入流水记录 | 280 | //写入流水记录 |
281 | - sendSerialRecord(null,order,orderPayment,null,orderPayDto,null); | 281 | + sendSerialRecord(null, order, orderPayment, null, orderPayDto, null); |
282 | return orderPayment; | 282 | return orderPayment; |
283 | } | 283 | } |
284 | 284 | ||
285 | @Override | 285 | @Override |
286 | public OrderPayment payOrderBuyCreditCode(Order order, OrderPayDto orderPayDto, Integer identityType) { | 286 | public OrderPayment payOrderBuyCreditCode(Order order, OrderPayDto orderPayDto, Integer identityType) { |
287 | //根据状态检查入参 | 287 | //根据状态检查入参 |
288 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_PAY_CREDITCODE, OrderPaymentAllChannel.CREDIT_CODE_CHANNEL); | 288 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_PAY_CREDITCODE, OrderPaymentAllChannel.CREDIT_CODE_CHANNEL); |
289 | //效验店铺 | 289 | //效验店铺 |
290 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); | 290 | ShopVo shop = orderGoodsService.checkShop(order.getShopId()); |
291 | //生成结算单 | 291 | //生成结算单 |
292 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.CREDIT.getCodeInteger() | 292 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.CREDIT.getCodeInteger() |
293 | , OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger()); | 293 | , OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger()); |
294 | //扣减库存 | 294 | //扣减库存 |
295 | - orderGoodsService.deduct(order,orderPayDto.getOperateId(),orderPayDto.getOperateName()); | 295 | + orderGoodsService.deduct(order, orderPayDto.getOperateId(), orderPayDto.getOperateName()); |
296 | //修改订单与支付单状态 | 296 | //修改订单与支付单状态 |
297 | - updateOrderByPay(order,orderPayment,OrderOrderState.BUYER_PAY_CREDITCODE,null,shop); | 297 | + updateOrderByPay(order, orderPayment, OrderOrderState.BUYER_PAY_CREDITCODE, null, shop); |
298 | //生成赊销记账单 | 298 | //生成赊销记账单 |
299 | - createLedgerDto(order,orderPayment,orderPayDto,shop); | 299 | + createLedgerDto(order, orderPayment, orderPayDto, shop); |
300 | //写入流水记录 | 300 | //写入流水记录 |
301 | - sendSerialRecord(null,order,orderPayment,null,orderPayDto,null); | 301 | + sendSerialRecord(null, order, orderPayment, null, orderPayDto, null); |
302 | return orderPayment; | 302 | return orderPayment; |
303 | } | 303 | } |
304 | 304 | ||
305 | - private void updateOrderByPay(Order order, OrderPayment orderPayment,OrderOrderState operateState,String tradeId,ShopVo shop) { | 305 | + private void updateOrderByPay(Order order, OrderPayment orderPayment, OrderOrderState operateState, String tradeId, ShopVo shop) { |
306 | orderPayment.setState(OrderPaymentState.FINISH_PAY.getCodeInteger()); | 306 | orderPayment.setState(OrderPaymentState.FINISH_PAY.getCodeInteger()); |
307 | orderPayment.setTradeId(tradeId); | 307 | orderPayment.setTradeId(tradeId); |
308 | orderPayment.setPayTime(LocalDateTime.now()); | 308 | orderPayment.setPayTime(LocalDateTime.now()); |
309 | - if(orderPayment.getPayMode().equals(OrderPaymentPayMode.PAY.getCodeInteger())){ | ||
310 | - order.setTotlePaidAmount(order.getTotlePaidAmount()+orderPayment.getPayAmount()); | ||
311 | - if(order.getTotleAmount().equals(order.getTotlePaidAmount())){ | 309 | + if (orderPayment.getPayMode().equals(OrderPaymentPayMode.PAY.getCodeInteger())) { |
310 | + order.setTotlePaidAmount(order.getTotlePaidAmount() + orderPayment.getPayAmount()); | ||
311 | + if (order.getTotleAmount().equals(order.getTotlePaidAmount())) { | ||
312 | order.setPayState(OrderPayState.PAY_FINISH.getCodeInteger()); | 312 | order.setPayState(OrderPayState.PAY_FINISH.getCodeInteger()); |
313 | order.setPayTime(orderPayment.getPayTime()); | 313 | order.setPayTime(orderPayment.getPayTime()); |
314 | - }else{ | 314 | + } else { |
315 | order.setPayState(OrderPayState.PART_PAY.getCodeInteger()); | 315 | order.setPayState(OrderPayState.PART_PAY.getCodeInteger()); |
316 | } | 316 | } |
317 | - }else if(orderPayment.getPayMode().equals(OrderPaymentPayMode.CREDIT.getCodeInteger())){ | ||
318 | - if(order.getTotleAmount().equals(order.getTotlePaidAmount()+orderPayment.getPayAmount())){ | 317 | + } else if (orderPayment.getPayMode().equals(OrderPaymentPayMode.CREDIT.getCodeInteger())) { |
318 | + if (order.getTotleAmount().equals(order.getTotlePaidAmount() + orderPayment.getPayAmount())) { | ||
319 | order.setPayState(OrderPayState.PAY_FINISH.getCodeInteger()); | 319 | order.setPayState(OrderPayState.PAY_FINISH.getCodeInteger()); |
320 | order.setPayTime(orderPayment.getPayTime()); | 320 | order.setPayTime(orderPayment.getPayTime()); |
321 | - }else{ | 321 | + } else { |
322 | order.setPayState(OrderPayState.PART_PAY.getCodeInteger()); | 322 | order.setPayState(OrderPayState.PART_PAY.getCodeInteger()); |
323 | } | 323 | } |
324 | } | 324 | } |
@@ -331,12 +331,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -331,12 +331,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
331 | 331 | ||
332 | private void updatepaymentOnly(OrderPayment orderPayment) { | 332 | private void updatepaymentOnly(OrderPayment orderPayment) { |
333 | int u = orderPaymentMapper.updatepayment(orderPayment); | 333 | int u = orderPaymentMapper.updatepayment(orderPayment); |
334 | - if(u==0){ | ||
335 | - throw new OrderException(OrderErrorCode.REPEATED_SUBMISSION,"请勿重复操作"); | 334 | + if (u == 0) { |
335 | + throw new OrderException(OrderErrorCode.REPEATED_SUBMISSION, "请勿重复操作"); | ||
336 | } | 336 | } |
337 | } | 337 | } |
338 | 338 | ||
339 | - private CreateSubmitTradeDto createCreateSubmitTradeDto(Order order, OrderPayment orderPayment, List<OrderCoupon> feeList,String password) { | 339 | + private CreateSubmitTradeDto createCreateSubmitTradeDto(Order order, OrderPayment orderPayment, List<OrderCoupon> feeList, String password) { |
340 | CreateSubmitTradeDto tradeDto = new CreateSubmitTradeDto(); | 340 | CreateSubmitTradeDto tradeDto = new CreateSubmitTradeDto(); |
341 | tradeDto.setAmount(orderPayment.getPayAmount()); | 341 | tradeDto.setAmount(orderPayment.getPayAmount()); |
342 | tradeDto.setBusinessId(order.getId()); | 342 | tradeDto.setBusinessId(order.getId()); |
@@ -352,9 +352,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -352,9 +352,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
352 | } | 352 | } |
353 | 353 | ||
354 | private List<DeductFeesDto> createDeductFeesDtos(List<OrderCoupon> feeList) { | 354 | private List<DeductFeesDto> createDeductFeesDtos(List<OrderCoupon> feeList) { |
355 | - if(feeList!=null&&feeList.size()>0){ | 355 | + if (feeList != null && feeList.size() > 0) { |
356 | List<DeductFeesDto> deductFeesDtos = new ArrayList<>(); | 356 | List<DeductFeesDto> deductFeesDtos = new ArrayList<>(); |
357 | - for(OrderCoupon coupon : feeList){ | 357 | + for (OrderCoupon coupon : feeList) { |
358 | DeductFeesDto deductFeesDto = new DeductFeesDto(); | 358 | DeductFeesDto deductFeesDto = new DeductFeesDto(); |
359 | deductFeesDto.setAmount(coupon.getAmount()); | 359 | deductFeesDto.setAmount(coupon.getAmount()); |
360 | deductFeesDto.setType(FundItem.TRADE_PAYMENT.getCode()); | 360 | deductFeesDto.setType(FundItem.TRADE_PAYMENT.getCode()); |
@@ -362,42 +362,51 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -362,42 +362,51 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
362 | deductFeesDtos.add(deductFeesDto); | 362 | deductFeesDtos.add(deductFeesDto); |
363 | } | 363 | } |
364 | return deductFeesDtos; | 364 | return deductFeesDtos; |
365 | - }else{ | 365 | + } else { |
366 | return null; | 366 | return null; |
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | - private OrderPayment createOrderPayment(Order order, OrderPayDto orderPayDto,ShopVo shop, Integer identityType,Integer payMode,Integer payChannel) { | ||
371 | - OrderPayment paydorderPayment = this.getOrderPaymentById(order.getId(),order.getMarketId(),OrderPaymentState.FINISH_PAY.getCodeInteger()); | ||
372 | - if(paydorderPayment!=null){ | 370 | + private OrderPayment createOrderPayment(Order order, OrderPayDto orderPayDto, ShopVo shop, Integer identityType, Integer payMode, Integer payChannel) { |
371 | + OrderPayment paydorderPayment = this.getOrderPaymentById(order.getId(), order.getMarketId(), OrderPaymentState.FINISH_PAY.getCodeInteger()); | ||
372 | + if (paydorderPayment != null) { | ||
373 | LOGGER.info("订单已支付,无需再次支付"); | 373 | LOGGER.info("订单已支付,无需再次支付"); |
374 | - throw new OrderException(OrderErrorCode.PAYING,"订单已支付,无需再次支付"); | 374 | + throw new OrderException(OrderErrorCode.PAYING, "订单已支付,无需再次支付"); |
375 | } | 375 | } |
376 | //获取未支付的结算单。将之改变 | 376 | //获取未支付的结算单。将之改变 |
377 | - OrderPayment orderPayment = this.getOrderPaymentById(order.getId(),order.getMarketId(),OrderPaymentState.WAIT_PAY.getCodeInteger()); | ||
378 | - if(orderPayment!=null){ | ||
379 | - if(orderPayment.getPayChannel()!=null&& OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())&&StringUtils.isNotBlank(orderPayment.getTradeId())){ | 377 | + OrderPayment orderPayment = this.getOrderPaymentById(order.getId(), order.getMarketId(), OrderPaymentState.WAIT_PAY.getCodeInteger()); |
378 | + if (orderPayment != null) { | ||
379 | + if (orderPayment.getPayChannel() != null && OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel()) && StringUtils.isNotBlank(orderPayment.getTradeId())) { | ||
380 | RLock lock = redissonClient.getLock(OrderConstant.OrderLock + orderPayment.getTradeId()); | 380 | RLock lock = redissonClient.getLock(OrderConstant.OrderLock + orderPayment.getTradeId()); |
381 | - try{ | 381 | + try { |
382 | lock.lock(); | 382 | lock.lock(); |
383 | - if(closePaymentOrder(orderPayment.getTradeId(),orderPayment.getMarketId())){ | ||
384 | - finishPayUpdata(OrderPaymentState.CANCEL.getCodeInteger(),orderPayment.getTradeId(),null); | 383 | + if (closePaymentOrder(orderPayment.getTradeId(), orderPayment.getMarketId())) { |
384 | + finishPayUpdata(OrderPaymentState.CANCEL.getCodeInteger(), orderPayment.getTradeId(), null); | ||
385 | } | 385 | } |
386 | - }catch(PlatformServiceException e){ | ||
387 | - LOGGER.info("关闭订单失败:交易单号{},异常编码{},错误信息{}",orderPayment.getTradeId(),e.getCode(),e.getMessage()); | ||
388 | - throw new OrderException(OrderErrorCode.REPEATED_SUBMISSION,"存在微信支付待付款信息,无法继续支付,请等待微信支付结果"); | ||
389 | - }finally { | 386 | + } catch (PlatformServiceException e) { |
387 | + LOGGER.info("关闭订单失败:交易单号{},异常编码{},错误信息{}", orderPayment.getTradeId(), e.getCode(), e.getMessage()); | ||
388 | + throw new OrderException(OrderErrorCode.REPEATED_SUBMISSION, "存在微信支付待付款信息,无法继续支付,请等待微信支付结果"); | ||
389 | + } finally { | ||
390 | lock.unlock(); | 390 | lock.unlock(); |
391 | } | 391 | } |
392 | orderPayment = new OrderPayment(); | 392 | orderPayment = new OrderPayment(); |
393 | } | 393 | } |
394 | - }else{ | 394 | + } else { |
395 | orderPayment = new OrderPayment(); | 395 | orderPayment = new OrderPayment(); |
396 | } | 396 | } |
397 | + | ||
398 | + //卖方订单并且使用买方元气卡支付时,记录园区卡支付的具体方式 | ||
399 | + if (payChannel.equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger()) && OrderOrderType.SELLER_ORDER.getCodeInteger().equals(order.getOrderType())) { | ||
400 | + if (orderPayDto.getPayChannelSub() == null) { | ||
401 | + orderPayment.setPayChannelSub(OrderPaymentSubChannel.CARD_CHANNEL_BUYER.getCodeInteger()); | ||
402 | + } else { | ||
403 | + orderPayment.setPayChannelSub(orderPayDto.getPayChannelSub()); | ||
404 | + } | ||
405 | + } | ||
397 | orderPayment.setMarketId(order.getMarketId()); | 406 | orderPayment.setMarketId(order.getMarketId()); |
398 | orderPayment.setOrderId(order.getId()); | 407 | orderPayment.setOrderId(order.getId()); |
399 | orderPayment.setOrderCode(order.getCode()); | 408 | orderPayment.setOrderCode(order.getCode()); |
400 | - orderPayment.setCode(order.getCode()+"P"); | 409 | + orderPayment.setCode(order.getCode() + "P"); |
401 | orderPayment.setPayAmount(order.getTotleAmount()); | 410 | orderPayment.setPayAmount(order.getTotleAmount()); |
402 | orderPayment.setPayMode(payMode); | 411 | orderPayment.setPayMode(payMode); |
403 | orderPayment.setTradeId(orderPayDto.getPaymentId()); | 412 | orderPayment.setTradeId(orderPayDto.getPaymentId()); |
@@ -420,14 +429,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -420,14 +429,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
420 | orderPayment.setVersion(NumberTransform.DEFAULT_VERSION); | 429 | orderPayment.setVersion(NumberTransform.DEFAULT_VERSION); |
421 | orderPayment.setState(OrderPaymentState.WAIT_PAY.getCodeInteger()); | 430 | orderPayment.setState(OrderPaymentState.WAIT_PAY.getCodeInteger()); |
422 | int l = orderPaymentMapper.save(orderPayment); | 431 | int l = orderPaymentMapper.save(orderPayment); |
423 | - if(l == 0 ){ | ||
424 | - throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR,"创建并保存结算单失败"); | 432 | + if (l == 0) { |
433 | + throw new OrderException(OrderErrorCode.ORDER_SYSTEM_ERROR, "创建并保存结算单失败"); | ||
425 | } | 434 | } |
426 | return orderPayment; | 435 | return orderPayment; |
427 | } | 436 | } |
428 | 437 | ||
429 | /** | 438 | /** |
430 | * 效验并补充支付参数 | 439 | * 效验并补充支付参数 |
440 | + * | ||
431 | * @param order | 441 | * @param order |
432 | * @param orderPayDto | 442 | * @param orderPayDto |
433 | * @param identityType | 443 | * @param identityType |
@@ -435,68 +445,72 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -435,68 +445,72 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
435 | * @param orderPaymentChannel | 445 | * @param orderPaymentChannel |
436 | */ | 446 | */ |
437 | private void checkPaymentParameter(Order order, OrderPayDto orderPayDto, Integer identityType, OrderOrderState orderOrderState, OrderPaymentAllChannel orderPaymentChannel) { | 447 | private void checkPaymentParameter(Order order, OrderPayDto orderPayDto, Integer identityType, OrderOrderState orderOrderState, OrderPaymentAllChannel orderPaymentChannel) { |
438 | - if(!OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPaymentChannel.getCodeInteger())){ | ||
439 | - checkPayChannel(orderPaymentChannel,order.getMarketId()); | 448 | + if (!OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPaymentChannel.getCodeInteger())) { |
449 | + if (orderPayDto.getPayChannelSub() != null) { | ||
450 | + checkPayChannel(orderPaymentChannel, order.getMarketId(), OrderPaymentSubChannel.getByCode(orderPayDto.getPayChannelSub())); | ||
451 | + } else { | ||
452 | + checkPayChannel(orderPaymentChannel, order.getMarketId(), null); | ||
453 | + } | ||
440 | } | 454 | } |
441 | //效验市场 | 455 | //效验市场 |
442 | - if(!orderPayDto.getMarketId().equals(order.getMarketId())){ | ||
443 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"与订单市场不一致"); | 456 | + if (!orderPayDto.getMarketId().equals(order.getMarketId())) { |
457 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "与订单市场不一致"); | ||
444 | } | 458 | } |
445 | //买方 | 459 | //买方 |
446 | - if(order.getOrderType().equals(OrderOrderType.BUYER_ORDER.getCodeInteger())){ | 460 | + if (order.getOrderType().equals(OrderOrderType.BUYER_ORDER.getCodeInteger())) { |
447 | //园区卡 | 461 | //园区卡 |
448 | - if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger())){ | ||
449 | - if(!order.getBuyerId().equals(orderPayDto.getPayerCustomerId())){ | ||
450 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"非本人订单不允许支付"); | 462 | + if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger())) { |
463 | + if (!order.getBuyerId().equals(orderPayDto.getPayerCustomerId())) { | ||
464 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "非本人订单不允许支付"); | ||
451 | } | 465 | } |
452 | - if(orderPayDto.getPayerCustomerId()==null){ | ||
453 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户id不能为空"); | 466 | + if (orderPayDto.getPayerCustomerId() == null) { |
467 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户id不能为空"); | ||
454 | } | 468 | } |
455 | - if(!orderPayDto.getOperateId().equals(order.getBuyerId())){ | ||
456 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请勿操纵他人订单"); | 469 | + if (!orderPayDto.getOperateId().equals(order.getBuyerId())) { |
470 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "请勿操纵他人订单"); | ||
457 | } | 471 | } |
458 | - if(StrUtil.isEmpty(orderPayDto.getPayerCardNo())){ | ||
459 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡号不能为空"); | 472 | + if (StrUtil.isEmpty(orderPayDto.getPayerCardNo())) { |
473 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡号不能为空"); | ||
460 | } | 474 | } |
461 | - if(orderPayDto.getPayerAccountId()==null){ | ||
462 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡账户不能为空"); | 475 | + if (orderPayDto.getPayerAccountId() == null) { |
476 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡账户不能为空"); | ||
463 | } | 477 | } |
464 | - if(orderPayDto.getPayerFundAccountId()==null){ | ||
465 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户资金账户不能为空"); | 478 | + if (orderPayDto.getPayerFundAccountId() == null) { |
479 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户资金账户不能为空"); | ||
466 | } | 480 | } |
467 | - if(StrUtil.isEmpty(orderPayDto.getPayerCustomerName())){ | ||
468 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户名称不能为空"); | 481 | + if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { |
482 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户名称不能为空"); | ||
469 | } | 483 | } |
470 | - if(StrUtil.isEmpty(orderPayDto.getPayerPassWord())){ | ||
471 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡密码不能为空"); | 484 | + if (StrUtil.isEmpty(orderPayDto.getPayerPassWord())) { |
485 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡密码不能为空"); | ||
472 | } | 486 | } |
473 | - }else if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDITCODE.getCodeInteger())){ | ||
474 | - if(!orderPayDto.getPayerCustomerId().equals(order.getBuyerId())){ | ||
475 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请勿操纵他人订单"); | 487 | + } else if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDITCODE.getCodeInteger())) { |
488 | + if (!orderPayDto.getPayerCustomerId().equals(order.getBuyerId())) { | ||
489 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "请勿操纵他人订单"); | ||
476 | } | 490 | } |
477 | - if(!orderPayDto.getOperateId().equals(order.getBuyerId())){ | ||
478 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请勿操纵他人订单"); | 491 | + if (!orderPayDto.getOperateId().equals(order.getBuyerId())) { |
492 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "请勿操纵他人订单"); | ||
479 | } | 493 | } |
480 | - if(orderPayDto.getPayerCustomerId()==null){ | ||
481 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户id不能为空"); | 494 | + if (orderPayDto.getPayerCustomerId() == null) { |
495 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户id不能为空"); | ||
482 | } | 496 | } |
483 | - if(StrUtil.isEmpty(orderPayDto.getPayerCustomerName())){ | ||
484 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户名称不能为空"); | 497 | + if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { |
498 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户名称不能为空"); | ||
485 | } | 499 | } |
486 | - if(StrUtil.isEmpty(orderPayDto.getPayerPhone())){ | ||
487 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户电话不能为空"); | 500 | + if (StrUtil.isEmpty(orderPayDto.getPayerPhone())) { |
501 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户电话不能为空"); | ||
488 | } | 502 | } |
489 | - if(orderPayDto.getOperateId()==null){ | ||
490 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人id不能为空"); | 503 | + if (orderPayDto.getOperateId() == null) { |
504 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人id不能为空"); | ||
491 | } | 505 | } |
492 | - if(StrUtil.isEmpty(orderPayDto.getOperateName())){ | ||
493 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人名称不能为空"); | 506 | + if (StrUtil.isEmpty(orderPayDto.getOperateName())) { |
507 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人名称不能为空"); | ||
494 | } | 508 | } |
495 | - }else if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CASH.getCodeInteger()) | ||
496 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_WX.getCodeInteger()) | ||
497 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_ZFB.getCodeInteger()) | ||
498 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_WECHAT_PAY.getCodeInteger()) | ||
499 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())){ | 509 | + } else if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CASH.getCodeInteger()) |
510 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_WX.getCodeInteger()) | ||
511 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_ZFB.getCodeInteger()) | ||
512 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_WECHAT_PAY.getCodeInteger()) | ||
513 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())) { | ||
500 | orderPayDto.setPayerCustomerId(order.getBuyerId()); | 514 | orderPayDto.setPayerCustomerId(order.getBuyerId()); |
501 | orderPayDto.setPayerCustomerName(order.getBuyerName()); | 515 | orderPayDto.setPayerCustomerName(order.getBuyerName()); |
502 | orderPayDto.setPayerAccountId(order.getBuyerAccountId()); | 516 | orderPayDto.setPayerAccountId(order.getBuyerAccountId()); |
@@ -507,9 +521,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -507,9 +521,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
507 | Long payerStoreCustomerId = getCustomerStoreId(order.getShopCustomerId(), order.getBuyerId(), order.getMarketId()); | 521 | Long payerStoreCustomerId = getCustomerStoreId(order.getShopCustomerId(), order.getBuyerId(), order.getMarketId()); |
508 | orderPayDto.setPayerStoreCustomerId(payerStoreCustomerId); | 522 | orderPayDto.setPayerStoreCustomerId(payerStoreCustomerId); |
509 | order.setBuyerStoreCustomerId(payerStoreCustomerId); | 523 | order.setBuyerStoreCustomerId(payerStoreCustomerId); |
510 | - }else if( order.getOrderType().equals(OrderOrderType.SELLER_ORDER.getCodeInteger())){ | ||
511 | - if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())) { | ||
512 | - if (orderPayDto.getPayerStoreCustomerId() == null && orderPayDto.getPayerCustomerId() ==null) { | 524 | + } else if (order.getOrderType().equals(OrderOrderType.SELLER_ORDER.getCodeInteger())) { |
525 | + if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())) { | ||
526 | + if (orderPayDto.getPayerStoreCustomerId() == null && orderPayDto.getPayerCustomerId() == null) { | ||
513 | throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款方常客id不能为空"); | 527 | throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款方常客id不能为空"); |
514 | } | 528 | } |
515 | if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { | 529 | if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { |
@@ -519,124 +533,132 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -519,124 +533,132 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
519 | throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款方常客电话不能为空"); | 533 | throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款方常客电话不能为空"); |
520 | } | 534 | } |
521 | } | 535 | } |
522 | - if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger())){ | ||
523 | - if(orderPayDto.getPayerCustomerId()==null){ | ||
524 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户id不能为空"); | 536 | + if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger())) { |
537 | + if (orderPayDto.getPayerCustomerId() == null) { | ||
538 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户id不能为空"); | ||
525 | } | 539 | } |
526 | - if(StrUtil.isEmpty(orderPayDto.getPayerCardNo())){ | ||
527 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡号不能为空"); | 540 | + if (StrUtil.isEmpty(orderPayDto.getPayerCardNo())) { |
541 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡号不能为空"); | ||
528 | } | 542 | } |
529 | - if(orderPayDto.getPayerAccountId()==null){ | ||
530 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡账户不能为空"); | 543 | + if (orderPayDto.getPayerAccountId() == null) { |
544 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡账户不能为空"); | ||
531 | } | 545 | } |
532 | - if(orderPayDto.getPayerFundAccountId()==null){ | ||
533 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户资金账户不能为空"); | 546 | + if (orderPayDto.getPayerFundAccountId() == null) { |
547 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户资金账户不能为空"); | ||
534 | } | 548 | } |
535 | - if(StrUtil.isEmpty(orderPayDto.getPayerCustomerName())){ | ||
536 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户名称不能为空"); | 549 | + if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { |
550 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户名称不能为空"); | ||
537 | } | 551 | } |
538 | - if(StrUtil.isEmpty(orderPayDto.getPayerPassWord())){ | ||
539 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"付款客户卡密码不能为空"); | 552 | + if (StrUtil.isEmpty(orderPayDto.getPayerPassWord())) { |
553 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "付款客户卡密码不能为空"); | ||
540 | } | 554 | } |
541 | order.setBuyerAccountId(orderPayDto.getPayerAccountId()); | 555 | order.setBuyerAccountId(orderPayDto.getPayerAccountId()); |
542 | - checkStoreEmployee(orderPayDto.getStoreEmployeeId(),order.getShopCustomerId(),order.getMarketId()); | ||
543 | - }else if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDITCODE.getCodeInteger())){ | ||
544 | - if(orderPayDto.getPayerCustomerId()==null){ | ||
545 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户id不能为空"); | 556 | + checkStoreEmployee(orderPayDto.getStoreEmployeeId(), order.getShopCustomerId(), order.getMarketId()); |
557 | + } else if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDITCODE.getCodeInteger())) { | ||
558 | + if (orderPayDto.getPayerCustomerId() == null) { | ||
559 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户id不能为空"); | ||
546 | } | 560 | } |
547 | - if(StrUtil.isEmpty(orderPayDto.getPayerCustomerName())){ | ||
548 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户名称不能为空"); | 561 | + if (StrUtil.isEmpty(orderPayDto.getPayerCustomerName())) { |
562 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户名称不能为空"); | ||
549 | } | 563 | } |
550 | - if(StrUtil.isEmpty(orderPayDto.getPayerPhone())){ | ||
551 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"赊销客户电话不能为空"); | 564 | + if (StrUtil.isEmpty(orderPayDto.getPayerPhone())) { |
565 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "赊销客户电话不能为空"); | ||
552 | } | 566 | } |
553 | - if(orderPayDto.getOperateId()==null){ | ||
554 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人id不能为空"); | 567 | + if (orderPayDto.getOperateId() == null) { |
568 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人id不能为空"); | ||
555 | } | 569 | } |
556 | - if(StrUtil.isEmpty(orderPayDto.getOperateName())){ | ||
557 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人名称不能为空"); | 570 | + if (StrUtil.isEmpty(orderPayDto.getOperateName())) { |
571 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人名称不能为空"); | ||
558 | } | 572 | } |
559 | - checkStoreEmployee(orderPayDto.getStoreEmployeeId(),order.getShopCustomerId(),order.getMarketId()); | ||
560 | - }else if(orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CASH.getCodeInteger()) | ||
561 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_WX.getCodeInteger()) | ||
562 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_ZFB.getCodeInteger()) | ||
563 | - ||orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())){ | ||
564 | - if(orderPayDto.getOperateId()==null){ | ||
565 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人id不能为空"); | 573 | + checkStoreEmployee(orderPayDto.getStoreEmployeeId(), order.getShopCustomerId(), order.getMarketId()); |
574 | + } else if (orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CASH.getCodeInteger()) | ||
575 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_WX.getCodeInteger()) | ||
576 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_ZFB.getCodeInteger()) | ||
577 | + || orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CREDIT.getCodeInteger())) { | ||
578 | + if (orderPayDto.getOperateId() == null) { | ||
579 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人id不能为空"); | ||
566 | } | 580 | } |
567 | - if(StrUtil.isEmpty(orderPayDto.getOperateName())){ | ||
568 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人名称不能为空"); | 581 | + if (StrUtil.isEmpty(orderPayDto.getOperateName())) { |
582 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人名称不能为空"); | ||
569 | } | 583 | } |
570 | - checkOperate(orderPayDto,order); | 584 | + checkOperate(orderPayDto, order); |
571 | } | 585 | } |
572 | order.setBuyerId(orderPayDto.getPayerCustomerId()); | 586 | order.setBuyerId(orderPayDto.getPayerCustomerId()); |
573 | order.setBuyerPhone(orderPayDto.getPayerPhone()); | 587 | order.setBuyerPhone(orderPayDto.getPayerPhone()); |
574 | order.setBuyerName(orderPayDto.getPayerCustomerName()); | 588 | order.setBuyerName(orderPayDto.getPayerCustomerName()); |
575 | order.setBuyerStoreCustomerId(orderPayDto.getPayerStoreCustomerId()); | 589 | order.setBuyerStoreCustomerId(orderPayDto.getPayerStoreCustomerId()); |
576 | - if(orderPayDto.getPayerCustomerId()!=null){ | 590 | + if (orderPayDto.getPayerCustomerId() != null) { |
577 | Long payerStoreCustomerId = getCustomerStoreId(order.getShopCustomerId(), orderPayDto.getPayerCustomerId(), order.getMarketId()); | 591 | Long payerStoreCustomerId = getCustomerStoreId(order.getShopCustomerId(), orderPayDto.getPayerCustomerId(), order.getMarketId()); |
578 | - if(payerStoreCustomerId!=null&&orderPayDto.getPayerStoreCustomerId()!=null&&!orderPayDto.getPayerStoreCustomerId().equals(payerStoreCustomerId)){ | ||
579 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"常客数据异常,常客与客户不匹配"); | 592 | + if (payerStoreCustomerId != null && orderPayDto.getPayerStoreCustomerId() != null && !orderPayDto.getPayerStoreCustomerId().equals(payerStoreCustomerId)) { |
593 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "常客数据异常,常客与客户不匹配"); | ||
580 | } | 594 | } |
581 | orderPayDto.setPayerStoreCustomerId(payerStoreCustomerId); | 595 | orderPayDto.setPayerStoreCustomerId(payerStoreCustomerId); |
582 | order.setBuyerStoreCustomerId(payerStoreCustomerId); | 596 | order.setBuyerStoreCustomerId(payerStoreCustomerId); |
583 | } | 597 | } |
584 | } | 598 | } |
585 | - if(!orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger())&&order.getTotleDiscount()>0){ | ||
586 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"存在优惠,请使用园区卡支付"); | 599 | + if (!orderOrderState.getCodeInteger().equals(OrderOrderState.BUYER_PAY_CARD.getCodeInteger()) && order.getTotleDiscount() > 0) { |
600 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "存在优惠,请使用园区卡支付"); | ||
587 | } | 601 | } |
588 | - if(order.getShopCustomerId().equals(orderPayDto.getPayerCustomerId())){ | ||
589 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"买方卖方不能为同一客户"); | 602 | + if (order.getShopCustomerId().equals(orderPayDto.getPayerCustomerId())) { |
603 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "买方卖方不能为同一客户"); | ||
590 | } | 604 | } |
591 | } | 605 | } |
592 | 606 | ||
593 | /** | 607 | /** |
594 | * 效验卖方操作人 | 608 | * 效验卖方操作人 |
609 | + * | ||
595 | * @param orderPayDto | 610 | * @param orderPayDto |
596 | * @param order | 611 | * @param order |
597 | */ | 612 | */ |
598 | - private void checkOperate(OrderPayDto orderPayDto,Order order) { | 613 | + private void checkOperate(OrderPayDto orderPayDto, Order order) { |
599 | Long employeeId = orderPayDto.getStoreEmployeeId(); | 614 | Long employeeId = orderPayDto.getStoreEmployeeId(); |
600 | Long shopCustomerId = order.getShopCustomerId(); | 615 | Long shopCustomerId = order.getShopCustomerId(); |
601 | Long operateId = orderPayDto.getOperateId(); | 616 | Long operateId = orderPayDto.getOperateId(); |
602 | Long marketId = order.getMarketId(); | 617 | Long marketId = order.getMarketId(); |
603 | //效验店员操作人 | 618 | //效验店员操作人 |
604 | - if(employeeId==null){ | ||
605 | - if(!operateId.equals(shopCustomerId)){ | ||
606 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"操作人异常"); | 619 | + if (employeeId == null) { |
620 | + if (!operateId.equals(shopCustomerId)) { | ||
621 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "操作人异常"); | ||
607 | } | 622 | } |
608 | - }else{ | ||
609 | - if(!operateId.equals(employeeId)){ | ||
610 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"店员信息异常"); | 623 | + } else { |
624 | + if (!operateId.equals(employeeId)) { | ||
625 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "店员信息异常"); | ||
611 | } | 626 | } |
612 | } | 627 | } |
613 | - checkStoreEmployee(operateId,shopCustomerId,marketId); | 628 | + checkStoreEmployee(operateId, shopCustomerId, marketId); |
614 | } | 629 | } |
615 | 630 | ||
616 | private Long getCustomerStoreId(Long shopCustomerId, Long payerCustomerId, Long marketId) { | 631 | private Long getCustomerStoreId(Long shopCustomerId, Long payerCustomerId, Long marketId) { |
617 | StoreCustomerResponseDto storeCustomerByCustomerId = storeCustomerService.findStoreCustomerByCustomerId(shopCustomerId, payerCustomerId, marketId); | 632 | StoreCustomerResponseDto storeCustomerByCustomerId = storeCustomerService.findStoreCustomerByCustomerId(shopCustomerId, payerCustomerId, marketId); |
618 | - if(storeCustomerByCustomerId!=null){ | 633 | + if (storeCustomerByCustomerId != null) { |
619 | return storeCustomerByCustomerId.getId(); | 634 | return storeCustomerByCustomerId.getId(); |
620 | - }else { | 635 | + } else { |
621 | return null; | 636 | return null; |
622 | } | 637 | } |
623 | } | 638 | } |
624 | 639 | ||
625 | @Override | 640 | @Override |
626 | - public void checkPayChannel(OrderPaymentAllChannel orderPaymentChannel, Long marketId) { | ||
627 | - if(!settingPaymentMethodService.isExist(marketId,orderPaymentChannel.getSettingChannel().longValue())){ | ||
628 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"该市场不支持该支付渠道"); | 641 | + public void checkPayChannel(OrderPaymentAllChannel orderPaymentChannel, Long marketId, OrderPaymentSubChannel subChannel) { |
642 | + if (subChannel != null) { | ||
643 | + if (!settingPaymentMethodService.isExist(marketId, subChannel.getRealSettingChannel().longValue())) { | ||
644 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "该市场不支持该支付渠道"); | ||
645 | + } | ||
646 | + } else { | ||
647 | + if (!settingPaymentMethodService.isExist(marketId, orderPaymentChannel.getSettingChannel().longValue())) { | ||
648 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "该市场不支持该支付渠道"); | ||
649 | + } | ||
629 | } | 650 | } |
651 | + | ||
630 | } | 652 | } |
631 | 653 | ||
632 | - private void createLedgerDto(Order order, OrderPayment orderPayment, OrderPayDto orderPayDto,ShopVo shop) { | 654 | + private void createLedgerDto(Order order, OrderPayment orderPayment, OrderPayDto orderPayDto, ShopVo shop) { |
633 | LedgerCreateDto ledgerDto = new LedgerCreateDto(); | 655 | LedgerCreateDto ledgerDto = new LedgerCreateDto(); |
634 | ledgerDto.setCodeCreated(orderPayment.getPayTime()); | 656 | ledgerDto.setCodeCreated(orderPayment.getPayTime()); |
635 | - ledgerDto.setAmount(orderPayment.getPayAmount()-orderPayment.getPayDiscount()); | 657 | + ledgerDto.setAmount(orderPayment.getPayAmount() - orderPayment.getPayDiscount()); |
636 | ledgerDto.setBusinessCode(orderPayment.getOrderCode()); | 658 | ledgerDto.setBusinessCode(orderPayment.getOrderCode()); |
637 | ledgerDto.setOrderType(order.getOrderType()); | 659 | ledgerDto.setOrderType(order.getOrderType()); |
638 | - ledgerDto.setCustomerId(orderPayment.getPayerCustomerId()==null?order.getBuyerId():orderPayment.getPayerCustomerId()); | ||
639 | - ledgerDto.setCustomerName(StrUtil.isEmpty(orderPayment.getPayerCustomerName())?order.getBuyerName():orderPayment.getPayerCustomerName()); | 660 | + ledgerDto.setCustomerId(orderPayment.getPayerCustomerId() == null ? order.getBuyerId() : orderPayment.getPayerCustomerId()); |
661 | + ledgerDto.setCustomerName(StrUtil.isEmpty(orderPayment.getPayerCustomerName()) ? order.getBuyerName() : orderPayment.getPayerCustomerName()); | ||
640 | ledgerDto.setShopId(order.getShopId()); | 662 | ledgerDto.setShopId(order.getShopId()); |
641 | ledgerDto.setMarketId(order.getMarketId()); | 663 | ledgerDto.setMarketId(order.getMarketId()); |
642 | ledgerDto.setCustomerCellphone(order.getBuyerPhone()); | 664 | ledgerDto.setCustomerCellphone(order.getBuyerPhone()); |
@@ -645,26 +667,27 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -645,26 +667,27 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
645 | } | 667 | } |
646 | 668 | ||
647 | @Override | 669 | @Override |
648 | - public StoreEmployee checkStoreEmployee(Long employeeId, Long shopCustomerId, Long marketId){ | 670 | + public StoreEmployee checkStoreEmployee(Long employeeId, Long shopCustomerId, Long marketId) { |
649 | //不是店铺负责人时统统使用雇员id | 671 | //不是店铺负责人时统统使用雇员id |
650 | - if(employeeId!=null&&!employeeId.equals(shopCustomerId)){ | ||
651 | - StoreEmployee storeEmployeeByParam = storeEmployeeService.findStoreEmployeeByParam(employeeId,shopCustomerId,marketId); | ||
652 | - if(storeEmployeeByParam==null||storeEmployeeByParam.getId()==null){ | ||
653 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"请勿操作其他店铺订单"); | 672 | + if (employeeId != null && !employeeId.equals(shopCustomerId)) { |
673 | + StoreEmployee storeEmployeeByParam = storeEmployeeService.findStoreEmployeeByParam(employeeId, shopCustomerId, marketId); | ||
674 | + if (storeEmployeeByParam == null || storeEmployeeByParam.getId() == null) { | ||
675 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "请勿操作其他店铺订单"); | ||
654 | } | 676 | } |
655 | return storeEmployeeByParam; | 677 | return storeEmployeeByParam; |
656 | } | 678 | } |
657 | return null; | 679 | return null; |
658 | } | 680 | } |
681 | + | ||
659 | @Override | 682 | @Override |
660 | - public OrderPayVo createOrderPayment(Order order, OrderPayDto orderPayDto, Integer identityType,ShopVo shop) { | 683 | + public OrderPayVo createOrderPayment(Order order, OrderPayDto orderPayDto, Integer identityType, ShopVo shop) { |
661 | OrderPayVo payVo = new OrderPayVo(); | 684 | OrderPayVo payVo = new OrderPayVo(); |
662 | //根据状态检查入参 | 685 | //根据状态检查入参 |
663 | - checkPaymentParameter(order,orderPayDto,identityType, OrderOrderState.BUYER_WECHAT_PAY, OrderPaymentAllChannel.BUYER_WX_CHANNEL); | 686 | + checkPaymentParameter(order, orderPayDto, identityType, OrderOrderState.BUYER_WECHAT_PAY, OrderPaymentAllChannel.BUYER_WX_CHANNEL); |
664 | 687 | ||
665 | - LOGGER.info("开始生成结算单,{}",order.getCode()); | 688 | + LOGGER.info("开始生成结算单,{}", order.getCode()); |
666 | //生成结算单 | 689 | //生成结算单 |
667 | - OrderPayment orderPayment = createOrderPayment(order,orderPayDto,shop,identityType,OrderPaymentPayMode.PAY.getCodeInteger() | 690 | + OrderPayment orderPayment = createOrderPayment(order, orderPayDto, shop, identityType, OrderPaymentPayMode.PAY.getCodeInteger() |
668 | , OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger()); | 691 | , OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger()); |
669 | payVo.setOrderPayment(orderPayment); | 692 | payVo.setOrderPayment(orderPayment); |
670 | return payVo; | 693 | return payVo; |
@@ -678,7 +701,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -678,7 +701,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
678 | @Override | 701 | @Override |
679 | public WeChatPayTradeBackDto WeChatPay(WeChatPayTradeDto weChatPayTradeDto) { | 702 | public WeChatPayTradeBackDto WeChatPay(WeChatPayTradeDto weChatPayTradeDto) { |
680 | Message<WeChatPayTradeBackDto> weChatPayTrade = weChatPayRpcResolver.createWeChatPayTrade(weChatPayTradeDto); | 703 | Message<WeChatPayTradeBackDto> weChatPayTrade = weChatPayRpcResolver.createWeChatPayTrade(weChatPayTradeDto); |
681 | - if(weChatPayTrade.getData()!=null){ | 704 | + if (weChatPayTrade.getData() != null) { |
682 | return weChatPayTrade.getData(); | 705 | return weChatPayTrade.getData(); |
683 | } | 706 | } |
684 | return null; | 707 | return null; |
@@ -686,7 +709,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -686,7 +709,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
686 | 709 | ||
687 | @Override | 710 | @Override |
688 | public List<OrderPayment> getOrderPaymentList(String paymentId, Integer state) { | 711 | public List<OrderPayment> getOrderPaymentList(String paymentId, Integer state) { |
689 | - return orderPaymentMapper.getPaymentListByPaymentId(paymentId,state); | 712 | + return orderPaymentMapper.getPaymentListByPaymentId(paymentId, state); |
690 | } | 713 | } |
691 | 714 | ||
692 | @Override | 715 | @Override |
@@ -695,11 +718,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -695,11 +718,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
695 | } | 718 | } |
696 | 719 | ||
697 | @Override | 720 | @Override |
698 | - public void finishPayUpdata(Integer state, String paymentId,LocalDateTime payTime) { | ||
699 | - if(!(Objects.equals(state, OrderPaymentState.CANCEL.getCodeInteger()) || Objects.equals(state, OrderPaymentState.FINISH_PAY.getCodeInteger()))){ | ||
700 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"参数范围异常"); | 721 | + public void finishPayUpdata(Integer state, String paymentId, LocalDateTime payTime) { |
722 | + if (!(Objects.equals(state, OrderPaymentState.CANCEL.getCodeInteger()) || Objects.equals(state, OrderPaymentState.FINISH_PAY.getCodeInteger()))) { | ||
723 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "参数范围异常"); | ||
701 | } | 724 | } |
702 | - int a = orderPaymentMapper.finishPayUpdata(paymentId,state,payTime); | 725 | + int a = orderPaymentMapper.finishPayUpdata(paymentId, state, payTime); |
703 | } | 726 | } |
704 | 727 | ||
705 | @Override | 728 | @Override |
@@ -715,25 +738,25 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -715,25 +738,25 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
715 | 738 | ||
716 | @Override | 739 | @Override |
717 | public UserAccountCardResponseDto getAccountInfo(Long payerAccountId) { | 740 | public UserAccountCardResponseDto getAccountInfo(Long payerAccountId) { |
718 | - try{ | ||
719 | - UserAccountSingleQueryDto userAccountSingleQueryDto=new UserAccountSingleQueryDto(); | 741 | + try { |
742 | + UserAccountSingleQueryDto userAccountSingleQueryDto = new UserAccountSingleQueryDto(); | ||
720 | userAccountSingleQueryDto.setAccountId(payerAccountId); | 743 | userAccountSingleQueryDto.setAccountId(payerAccountId); |
721 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); | 744 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); |
722 | - if(message.isSuccess()){ | 745 | + if (message.isSuccess()) { |
723 | return message.getData(); | 746 | return message.getData(); |
724 | - }else{ | 747 | + } else { |
725 | LOGGER.warn(message.getMessage()); | 748 | LOGGER.warn(message.getMessage()); |
726 | return null; | 749 | return null; |
727 | } | 750 | } |
728 | - }catch (Exception e){ | ||
729 | - LOGGER.warn("账户调用异常",e); | 751 | + } catch (Exception e) { |
752 | + LOGGER.warn("账户调用异常", e); | ||
730 | return null; | 753 | return null; |
731 | } | 754 | } |
732 | } | 755 | } |
733 | 756 | ||
734 | @Override | 757 | @Override |
735 | public List<String> checkNotPayPaymentOrder(List<String> codes) { | 758 | public List<String> checkNotPayPaymentOrder(List<String> codes) { |
736 | - if(CollectionUtils.isEmpty(codes)){ | 759 | + if (CollectionUtils.isEmpty(codes)) { |
737 | return null; | 760 | return null; |
738 | } | 761 | } |
739 | return orderPaymentMapper.getPaymentIdsByCodes(codes); | 762 | return orderPaymentMapper.getPaymentIdsByCodes(codes); |
@@ -741,22 +764,22 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -741,22 +764,22 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
741 | 764 | ||
742 | @Override | 765 | @Override |
743 | public Boolean closePaymentOrder(String paymentId, Long marketId) { | 766 | public Boolean closePaymentOrder(String paymentId, Long marketId) { |
744 | - WeChatPayFunctionDto functionDto = new WeChatPayFunctionDto(paymentId,null, marketId); | 767 | + WeChatPayFunctionDto functionDto = new WeChatPayFunctionDto(paymentId, null, marketId); |
745 | Boolean closeFlag = false; | 768 | Boolean closeFlag = false; |
746 | - try{ | 769 | + try { |
747 | closeFlag = weChatPayRpcResolver.closeWeChatPay(functionDto); | 770 | closeFlag = weChatPayRpcResolver.closeWeChatPay(functionDto); |
748 | - }catch(PlatformServiceException e){ | 771 | + } catch (PlatformServiceException e) { |
749 | functionDto.setMode("online"); | 772 | functionDto.setMode("online"); |
750 | Message<WeChatPayFunctionBackDto> weChatPayFunctionBackDtoMessage = weChatPayRpcResolver.checkWeChatPayState(functionDto); | 773 | Message<WeChatPayFunctionBackDto> weChatPayFunctionBackDtoMessage = weChatPayRpcResolver.checkWeChatPayState(functionDto); |
751 | - if(weChatPayFunctionBackDtoMessage.isSuccess()){ | ||
752 | - if(weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.NOT_PAY.getCode())){ | ||
753 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"存在未支付的微信订单,关闭失败,请稍后再试"); | ||
754 | - }else if(weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.SUCCESS.getCode())){ | ||
755 | - throw new OrderException(OrderErrorCode.PARAM_ERROR,"存在已缴费订单,请刷新后重新选择单据缴费!"); | ||
756 | - }else if(weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.PAY_FAIL.getCode())){ | 774 | + if (weChatPayFunctionBackDtoMessage.isSuccess()) { |
775 | + if (weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.NOT_PAY.getCode())) { | ||
776 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "存在未支付的微信订单,关闭失败,请稍后再试"); | ||
777 | + } else if (weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.SUCCESS.getCode())) { | ||
778 | + throw new OrderException(OrderErrorCode.PARAM_ERROR, "存在已缴费订单,请刷新后重新选择单据缴费!"); | ||
779 | + } else if (weChatPayFunctionBackDtoMessage.getData().getState().equals(WeChatPayState.PAY_FAIL.getCode())) { | ||
757 | return true; | 780 | return true; |
758 | } | 781 | } |
759 | - }else{ | 782 | + } else { |
760 | return false; | 783 | return false; |
761 | } | 784 | } |
762 | } | 785 | } |
@@ -769,13 +792,13 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -769,13 +792,13 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
769 | } | 792 | } |
770 | 793 | ||
771 | @Override | 794 | @Override |
772 | - public OrderPaymentDto getPaymenDtoByOrderId(Long orderId, Long marketId,Integer paymentState) { | ||
773 | - return orderPaymentMapper.getPaymenDtoByOrderId(orderId, marketId,paymentState); | 795 | + public OrderPaymentDto getPaymenDtoByOrderId(Long orderId, Long marketId, Integer paymentState) { |
796 | + return orderPaymentMapper.getPaymenDtoByOrderId(orderId, marketId, paymentState); | ||
774 | } | 797 | } |
775 | 798 | ||
776 | @Override | 799 | @Override |
777 | public OrderPayment getOrderPaymentById(Long orderId, Long marketId, Integer paymentState) { | 800 | public OrderPayment getOrderPaymentById(Long orderId, Long marketId, Integer paymentState) { |
778 | - return orderPaymentMapper.getPaymenByOrderId(orderId, marketId,paymentState); | 801 | + return orderPaymentMapper.getPaymenByOrderId(orderId, marketId, paymentState); |
779 | } | 802 | } |
780 | 803 | ||
781 | @Transactional | 804 | @Transactional |
@@ -785,17 +808,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -785,17 +808,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
785 | cancelDto.setTradeId(orderPaymentDto.getTradeId()); | 808 | cancelDto.setTradeId(orderPaymentDto.getTradeId()); |
786 | cancelDto.setMchId(orderPaymentDto.getMarketId().toString()); | 809 | cancelDto.setMchId(orderPaymentDto.getMarketId().toString()); |
787 | Message<BalanceResponseDto> balanceResponseDtoMessage = payRpcResolver.cancelTradeOnly(cancelDto); | 810 | Message<BalanceResponseDto> balanceResponseDtoMessage = payRpcResolver.cancelTradeOnly(cancelDto); |
788 | - if(!balanceResponseDtoMessage.getCode().equals(200)){ | ||
789 | - if(balanceResponseDtoMessage.getCode().equals(503002)){ | ||
790 | - throw new OrderException(OrderErrorCode.ACCOUNT_ERROR,"卖方资金账户异常,无法付款,订单作废失败"); | ||
791 | - }else if(balanceResponseDtoMessage.getCode().equals(504002)){ | ||
792 | - throw new OrderException(OrderErrorCode.ACCOUNT_ERROR,"买方资金账户异常,无法收款,订单作废失败"); | ||
793 | - }else if(balanceResponseDtoMessage.getCode().equals(503004)){ | ||
794 | - throw new OrderException(OrderErrorCode.ACCOUNT_ERROR,"卖方账户资金不足,订单作废失败"); | ||
795 | - }else{ | 811 | + if (!balanceResponseDtoMessage.getCode().equals(200)) { |
812 | + if (balanceResponseDtoMessage.getCode().equals(503002)) { | ||
813 | + throw new OrderException(OrderErrorCode.ACCOUNT_ERROR, "卖方资金账户异常,无法付款,订单作废失败"); | ||
814 | + } else if (balanceResponseDtoMessage.getCode().equals(504002)) { | ||
815 | + throw new OrderException(OrderErrorCode.ACCOUNT_ERROR, "买方资金账户异常,无法收款,订单作废失败"); | ||
816 | + } else if (balanceResponseDtoMessage.getCode().equals(503004)) { | ||
817 | + throw new OrderException(OrderErrorCode.ACCOUNT_ERROR, "卖方账户资金不足,订单作废失败"); | ||
818 | + } else { | ||
796 | throw new PlatformServiceException(ErrorCode.SYSTEM_UNKNOWN_ERROR, "作废交易信息失败:" + balanceResponseDtoMessage.getMessage()); | 819 | throw new PlatformServiceException(ErrorCode.SYSTEM_UNKNOWN_ERROR, "作废交易信息失败:" + balanceResponseDtoMessage.getMessage()); |
797 | } | 820 | } |
798 | - }else{ | 821 | + } else { |
799 | return balanceResponseDtoMessage.getData(); | 822 | return balanceResponseDtoMessage.getData(); |
800 | } | 823 | } |
801 | } | 824 | } |
@@ -803,7 +826,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -803,7 +826,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
803 | @Override | 826 | @Override |
804 | public OrderPayment saveInvalidOrderPayment(Order order, OrderPayment orderPaymentDto) { | 827 | public OrderPayment saveInvalidOrderPayment(Order order, OrderPayment orderPaymentDto) { |
805 | OrderPayment payment = new OrderPayment(); | 828 | OrderPayment payment = new OrderPayment(); |
806 | - BeanUtils.copyProperties(orderPaymentDto,payment); | 829 | + BeanUtils.copyProperties(orderPaymentDto, payment); |
807 | payment.setCreatedTime(null); | 830 | payment.setCreatedTime(null); |
808 | payment.setModifiedTime(null); | 831 | payment.setModifiedTime(null); |
809 | payment.setVersion(1); | 832 | payment.setVersion(1); |
@@ -811,51 +834,51 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -811,51 +834,51 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
811 | payment.setOrderStatus(OrderStatus.INVALID.getCodeInteger()); | 834 | payment.setOrderStatus(OrderStatus.INVALID.getCodeInteger()); |
812 | payment.setRelationId(orderPaymentDto.getId()); | 835 | payment.setRelationId(orderPaymentDto.getId()); |
813 | payment.setPayTime(order.getPayTime()); | 836 | payment.setPayTime(order.getPayTime()); |
814 | - payment.setTotleSellerFee(orderPaymentDto.getTotleSellerFee()==null?null:orderPaymentDto.getTotleSellerFee()*-1); | ||
815 | - payment.setPayAmount(orderPaymentDto.getPayAmount()*-1); | ||
816 | - payment.setPayDiscount(orderPaymentDto.getPayDiscount()==null?null:orderPaymentDto.getPayDiscount()*-1); | 837 | + payment.setTotleSellerFee(orderPaymentDto.getTotleSellerFee() == null ? null : orderPaymentDto.getTotleSellerFee() * -1); |
838 | + payment.setPayAmount(orderPaymentDto.getPayAmount() * -1); | ||
839 | + payment.setPayDiscount(orderPaymentDto.getPayDiscount() == null ? null : orderPaymentDto.getPayDiscount() * -1); | ||
817 | payment.setId(null); | 840 | payment.setId(null); |
818 | orderPaymentMapper.save(payment); | 841 | orderPaymentMapper.save(payment); |
819 | return payment; | 842 | return payment; |
820 | } | 843 | } |
821 | 844 | ||
822 | - private void sendSerialRecord(BalanceResponseDto balanceResponseDto,Order order ,OrderPayment orderPayment,List<OrderCoupon> coupons,OrderPayDto orderPayDto,OrderPaymentPayeeInfoDto payeeInfo) { | 845 | + private void sendSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, List<OrderCoupon> coupons, OrderPayDto orderPayDto, OrderPaymentPayeeInfoDto payeeInfo) { |
823 | 846 | ||
824 | - try{ | 847 | + try { |
825 | //买方信息 | 848 | //买方信息 |
826 | - if(order.getBuyerId()!=null && (StringUtils.isBlank(orderPayDto.getCustomerAbbr())||StringUtils.isBlank(order.getBuyerCode()))){ | 849 | + if (order.getBuyerId() != null && (StringUtils.isBlank(orderPayDto.getCustomerAbbr()) || StringUtils.isBlank(order.getBuyerCode()))) { |
827 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(orderPayDto.getPayerCustomerId()); | 850 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(orderPayDto.getPayerCustomerId()); |
828 | - if(extenMessage.getCode().equals("200")){ | 851 | + if (extenMessage.getCode().equals("200")) { |
829 | orderPayDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); | 852 | orderPayDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); |
830 | - if(StringUtils.isBlank(order.getBuyerCode())){ | 853 | + if (StringUtils.isBlank(order.getBuyerCode())) { |
831 | order.setBuyerCode(extenMessage.getData().getCode()); | 854 | order.setBuyerCode(extenMessage.getData().getCode()); |
832 | } | 855 | } |
833 | - }else{ | ||
834 | - LOGGER.warn("客户服务调用失败:{}",extenMessage.getMessage()); | 856 | + } else { |
857 | + LOGGER.warn("客户服务调用失败:{}", extenMessage.getMessage()); | ||
835 | } | 858 | } |
836 | } | 859 | } |
837 | //卖方信息 | 860 | //卖方信息 |
838 | - if(payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 861 | + if (payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
839 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); | 862 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); |
840 | - }else if(payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 863 | + } else if (payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
841 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); | 864 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); |
842 | } | 865 | } |
843 | - }catch (Exception e){ | ||
844 | - LOGGER.warn("客户服务调用异常",e); | 866 | + } catch (Exception e) { |
867 | + LOGGER.warn("客户服务调用异常", e); | ||
845 | } | 868 | } |
846 | List<SerialRecordDto> list = new ArrayList<>(); | 869 | List<SerialRecordDto> list = new ArrayList<>(); |
847 | //买家付款 | 870 | //买家付款 |
848 | - List<SerialRecordDto> mainSerialRecordDtoBuyer = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto,payeeInfo); | 871 | + List<SerialRecordDto> mainSerialRecordDtoBuyer = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto, payeeInfo); |
849 | list.addAll(mainSerialRecordDtoBuyer); | 872 | list.addAll(mainSerialRecordDtoBuyer); |
850 | //卖家收款 | 873 | //卖家收款 |
851 | - List<SerialRecordDto> mainSerialRecordDtoSeller = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto,payeeInfo); | 874 | + List<SerialRecordDto> mainSerialRecordDtoSeller = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto, payeeInfo); |
852 | list.addAll(mainSerialRecordDtoSeller); | 875 | list.addAll(mainSerialRecordDtoSeller); |
853 | - if(coupons!=null&&coupons.size()>0){ | 876 | + if (coupons != null && coupons.size() > 0) { |
854 | //买家优惠 | 877 | //买家优惠 |
855 | - List<SerialRecordDto> couponsSerialRecordDtoBuyer = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto,payeeInfo); | 878 | + List<SerialRecordDto> couponsSerialRecordDtoBuyer = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto, payeeInfo); |
856 | list.addAll(couponsSerialRecordDtoBuyer); | 879 | list.addAll(couponsSerialRecordDtoBuyer); |
857 | //卖家优惠 | 880 | //卖家优惠 |
858 | - List<SerialRecordDto> couponsSerialRecordDtoSeller = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto,payeeInfo); | 881 | + List<SerialRecordDto> couponsSerialRecordDtoSeller = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto, payeeInfo); |
859 | list.addAll(couponsSerialRecordDtoSeller); | 882 | list.addAll(couponsSerialRecordDtoSeller); |
860 | } | 883 | } |
861 | //发送mq | 884 | //发送mq |
@@ -864,81 +887,82 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -864,81 +887,82 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
864 | 887 | ||
865 | @Override | 888 | @Override |
866 | @Transactional | 889 | @Transactional |
867 | - public void sendSerialRecord(List<SerialRecordDto> list){ | 890 | + public void sendSerialRecord(List<SerialRecordDto> list) { |
868 | rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGE_ACCOUNT_SERIAL, RabbitConfig.ROUTING_ACCOUNT_SERIAL, JsonUtils.toJsonString(list)); | 891 | rabbitTemplate.convertAndSend(RabbitConfig.EXCHANGE_ACCOUNT_SERIAL, RabbitConfig.ROUTING_ACCOUNT_SERIAL, JsonUtils.toJsonString(list)); |
869 | } | 892 | } |
870 | 893 | ||
871 | @Override | 894 | @Override |
872 | - public List<SerialRecordDto> getSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, List<OrderCoupon> coupons, OrderPayDto orderPayDto,OrderPaymentPayeeInfoDto payeeInfo) { | ||
873 | - try{ | ||
874 | - if(order.getBuyerId()!=null && (StringUtils.isBlank(orderPayDto.getCustomerAbbr())||StringUtils.isBlank(order.getBuyerCode()))){ | 895 | + public List<SerialRecordDto> getSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, List<OrderCoupon> coupons, OrderPayDto orderPayDto, OrderPaymentPayeeInfoDto payeeInfo) { |
896 | + try { | ||
897 | + if (order.getBuyerId() != null && (StringUtils.isBlank(orderPayDto.getCustomerAbbr()) || StringUtils.isBlank(order.getBuyerCode()))) { | ||
875 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(orderPayDto.getPayerCustomerId()); | 898 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(orderPayDto.getPayerCustomerId()); |
876 | - if(extenMessage.getCode().equals("200")){ | 899 | + if (extenMessage.getCode().equals("200")) { |
877 | orderPayDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); | 900 | orderPayDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); |
878 | - if(StringUtils.isBlank(order.getBuyerCode())){ | 901 | + if (StringUtils.isBlank(order.getBuyerCode())) { |
879 | order.setBuyerCode(extenMessage.getData().getCode()); | 902 | order.setBuyerCode(extenMessage.getData().getCode()); |
880 | } | 903 | } |
881 | - }else{ | ||
882 | - LOGGER.warn("客户服务调用失败:{}",extenMessage.getMessage()); | 904 | + } else { |
905 | + LOGGER.warn("客户服务调用失败:{}", extenMessage.getMessage()); | ||
883 | } | 906 | } |
884 | } | 907 | } |
885 | //流水所需卖方信息 | 908 | //流水所需卖方信息 |
886 | - if(payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 909 | + if (payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
887 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); | 910 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); |
888 | - }else if(payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 911 | + } else if (payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
889 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); | 912 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); |
890 | } | 913 | } |
891 | - }catch (Exception e){ | ||
892 | - LOGGER.warn("客户服务调用异常",e); | 914 | + } catch (Exception e) { |
915 | + LOGGER.warn("客户服务调用异常", e); | ||
893 | } | 916 | } |
894 | List<SerialRecordDto> list = new ArrayList<>(); | 917 | List<SerialRecordDto> list = new ArrayList<>(); |
895 | //买家付款 | 918 | //买家付款 |
896 | - List<SerialRecordDto> mainSerialRecordDtoBuyer = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto,payeeInfo); | 919 | + List<SerialRecordDto> mainSerialRecordDtoBuyer = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto, payeeInfo); |
897 | list.addAll(mainSerialRecordDtoBuyer); | 920 | list.addAll(mainSerialRecordDtoBuyer); |
898 | //卖家收款 | 921 | //卖家收款 |
899 | - List<SerialRecordDto> mainSerialRecordDtoSeller = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto,payeeInfo); | 922 | + List<SerialRecordDto> mainSerialRecordDtoSeller = createMainSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto, payeeInfo); |
900 | list.addAll(mainSerialRecordDtoSeller); | 923 | list.addAll(mainSerialRecordDtoSeller); |
901 | - if(coupons!=null&&coupons.size()>0){ | 924 | + if (coupons != null && coupons.size() > 0) { |
902 | //买家优惠 | 925 | //买家优惠 |
903 | - List<SerialRecordDto> couponsSerialRecordDtoBuyer = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto,payeeInfo); | 926 | + List<SerialRecordDto> couponsSerialRecordDtoBuyer = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, orderPayDto, payeeInfo); |
904 | list.addAll(couponsSerialRecordDtoBuyer); | 927 | list.addAll(couponsSerialRecordDtoBuyer); |
905 | //卖家优惠 | 928 | //卖家优惠 |
906 | - List<SerialRecordDto> couponsSerialRecordDtoSeller = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto,payeeInfo); | 929 | + List<SerialRecordDto> couponsSerialRecordDtoSeller = createCouponsSerialRecordDto(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, orderPayDto, payeeInfo); |
907 | list.addAll(couponsSerialRecordDtoSeller); | 930 | list.addAll(couponsSerialRecordDtoSeller); |
908 | } | 931 | } |
909 | return list; | 932 | return list; |
910 | } | 933 | } |
911 | 934 | ||
912 | private OrderPaymentPayeeInfoDto getPayeeInfo(Long shopCustomerId) { | 935 | private OrderPaymentPayeeInfoDto getPayeeInfo(Long shopCustomerId) { |
913 | - try{ | ||
914 | - if(shopCustomerId!=null){ | 936 | + try { |
937 | + if (shopCustomerId != null) { | ||
915 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(shopCustomerId); | 938 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(shopCustomerId); |
916 | - if(extenMessage.getCode().equals("200")&&extenMessage.getData()!=null){ | 939 | + if (extenMessage.getCode().equals("200") && extenMessage.getData() != null) { |
917 | OrderPaymentPayeeInfoDto payeeInfoDto = new OrderPaymentPayeeInfoDto(); | 940 | OrderPaymentPayeeInfoDto payeeInfoDto = new OrderPaymentPayeeInfoDto(); |
918 | payeeInfoDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); | 941 | payeeInfoDto.setCustomerAbbr(extenMessage.getData().getCustomerAbbr()); |
919 | payeeInfoDto.setCustomerId(extenMessage.getData().getCustomerId()); | 942 | payeeInfoDto.setCustomerId(extenMessage.getData().getCustomerId()); |
920 | payeeInfoDto.setCustomerNo(extenMessage.getData().getCode()); | 943 | payeeInfoDto.setCustomerNo(extenMessage.getData().getCode()); |
921 | payeeInfoDto.setCustomerName(extenMessage.getData().getName()); | 944 | payeeInfoDto.setCustomerName(extenMessage.getData().getName()); |
922 | return payeeInfoDto; | 945 | return payeeInfoDto; |
923 | - }else{ | ||
924 | - LOGGER.warn("客户服务调用失败:{}",extenMessage.getMessage()); | 946 | + } else { |
947 | + LOGGER.warn("客户服务调用失败:{}", extenMessage.getMessage()); | ||
925 | } | 948 | } |
926 | } | 949 | } |
927 | - }catch (Exception e){ | ||
928 | - LOGGER.warn("客户服务调用异常",e); | 950 | + } catch (Exception e) { |
951 | + LOGGER.warn("客户服务调用异常", e); | ||
929 | } | 952 | } |
930 | return null; | 953 | return null; |
931 | } | 954 | } |
932 | 955 | ||
933 | /** | 956 | /** |
934 | * 创建买方货款流水 | 957 | * 创建买方货款流水 |
958 | + * | ||
935 | * @param order | 959 | * @param order |
936 | * @param orderPayment | 960 | * @param orderPayment |
937 | - * @param actionEnum 买家角度 | 961 | + * @param actionEnum 买家角度 |
938 | * @return | 962 | * @return |
939 | */ | 963 | */ |
940 | - private List<SerialRecordDto> createMainSerialRecordDto(BalanceResponseDto balanceResponseDto,Order order ,OrderPayment orderPayment,ActionEnum actionEnum | ||
941 | - ,List<OrderCoupon> coupons,OrderPayDto orderPayDto,OrderPaymentPayeeInfoDto payeeInfo){ | 964 | + private List<SerialRecordDto> createMainSerialRecordDto(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, ActionEnum actionEnum |
965 | + , List<OrderCoupon> coupons, OrderPayDto orderPayDto, OrderPaymentPayeeInfoDto payeeInfo) { | ||
942 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); | 966 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); |
943 | 967 | ||
944 | //买方货款 | 968 | //买方货款 |
@@ -946,10 +970,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -946,10 +970,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
946 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); | 970 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); |
947 | serialRecord.setType(BizNumberTypeEnum.ETRADE_TRADE.getCode()); | 971 | serialRecord.setType(BizNumberTypeEnum.ETRADE_TRADE.getCode()); |
948 | serialRecord.setTypeName(BizNumberTypeEnum.ETRADE_TRADE.getName()); | 972 | serialRecord.setTypeName(BizNumberTypeEnum.ETRADE_TRADE.getName()); |
949 | - if(actionEnum.getCode()==ActionEnum.EXPENSE.getCode()){ | 973 | + if (actionEnum.getCode() == ActionEnum.EXPENSE.getCode()) { |
950 | //买方 | 974 | //买方 |
951 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); | 975 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); |
952 | - if(balanceResponseDto == null){ | 976 | + if (balanceResponseDto == null) { |
953 | serialRecord.setAccountId(null); | 977 | serialRecord.setAccountId(null); |
954 | serialRecord.setStartBalance(null); | 978 | serialRecord.setStartBalance(null); |
955 | serialRecord.setEndBalance(null); | 979 | serialRecord.setEndBalance(null); |
@@ -961,10 +985,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -961,10 +985,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
961 | //持卡人联系电话(客户联系电话) | 985 | //持卡人联系电话(客户联系电话) |
962 | serialRecord.setHoldContactsPhone(null); | 986 | serialRecord.setHoldContactsPhone(null); |
963 | 987 | ||
964 | - }else{ | 988 | + } else { |
965 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); | 989 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); |
966 | serialRecord.setStartBalance(balanceResponseDto.getBalance()); | 990 | serialRecord.setStartBalance(balanceResponseDto.getBalance()); |
967 | - serialRecord.setEndBalance(balanceResponseDto.getBalance()-orderPayment.getPayAmount()+orderPayment.getPayDiscount()); | 991 | + serialRecord.setEndBalance(balanceResponseDto.getBalance() - orderPayment.getPayAmount() + orderPayment.getPayDiscount()); |
968 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 992 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
969 | //持卡人姓名(客户姓名) | 993 | //持卡人姓名(客户姓名) |
970 | serialRecord.setHoldName(orderPayDto.getHoldName()); | 994 | serialRecord.setHoldName(orderPayDto.getHoldName()); |
@@ -975,57 +999,57 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -975,57 +999,57 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
975 | //客户简称 | 999 | //客户简称 |
976 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); | 1000 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); |
977 | } | 1001 | } |
978 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1002 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
979 | serialRecord.setCardNo(orderPayment.getPayerCardNo()); | 1003 | serialRecord.setCardNo(orderPayment.getPayerCardNo()); |
980 | } | 1004 | } |
981 | - serialRecord.setCustomerId(orderPayment.getPayerCustomerId()==null?0L:orderPayment.getPayerCustomerId()); | 1005 | + serialRecord.setCustomerId(orderPayment.getPayerCustomerId() == null ? 0L : orderPayment.getPayerCustomerId()); |
982 | serialRecord.setCustomerNo(order.getBuyerCode()); | 1006 | serialRecord.setCustomerNo(order.getBuyerCode()); |
983 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); | 1007 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); |
984 | - serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName())?"默认用户":orderPayment.getPayerCustomerName()); | ||
985 | - serialRecord.setAmount(orderPayment.getPayAmount()-orderPayment.getPayDiscount()); | 1008 | + serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); |
1009 | + serialRecord.setAmount(orderPayment.getPayAmount() - orderPayment.getPayDiscount()); | ||
986 | serialRecord.setNotes(String.format("买方,订单号 %s", order.getCode())); | 1010 | serialRecord.setNotes(String.format("买方,订单号 %s", order.getCode())); |
987 | - }else if(actionEnum.getCode()==ActionEnum.INCOME.getCode()){ | 1011 | + } else if (actionEnum.getCode() == ActionEnum.INCOME.getCode()) { |
988 | //卖方 | 1012 | //卖方 |
989 | serialRecord.setAction(ActionEnum.INCOME.getCode()); | 1013 | serialRecord.setAction(ActionEnum.INCOME.getCode()); |
990 | - if(balanceResponseDto != null){ | 1014 | + if (balanceResponseDto != null) { |
991 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); | 1015 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); |
992 | serialRecord.setStartBalance(balanceResponseDto.getRelation().getBalance()); | 1016 | serialRecord.setStartBalance(balanceResponseDto.getRelation().getBalance()); |
993 | - serialRecord.setEndBalance(balanceResponseDto.getRelation().getBalance()+orderPayment.getPayAmount()-orderPayment.getPayDiscount()); | 1017 | + serialRecord.setEndBalance(balanceResponseDto.getRelation().getBalance() + orderPayment.getPayAmount() - orderPayment.getPayDiscount()); |
994 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1018 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
995 | - if(payeeInfo!=null){ | 1019 | + if (payeeInfo != null) { |
996 | serialRecord.setHoldName(payeeInfo.getHoldName()); | 1020 | serialRecord.setHoldName(payeeInfo.getHoldName()); |
997 | serialRecord.setHoldCertificateNumber(payeeInfo.getHoldCertificateNumber()); | 1021 | serialRecord.setHoldCertificateNumber(payeeInfo.getHoldCertificateNumber()); |
998 | serialRecord.setHoldContactsPhone(payeeInfo.getHoldContactsPhone()); | 1022 | serialRecord.setHoldContactsPhone(payeeInfo.getHoldContactsPhone()); |
999 | } | 1023 | } |
1000 | } | 1024 | } |
1001 | - if(payeeInfo!=null){ | 1025 | + if (payeeInfo != null) { |
1002 | serialRecord.setCustomerAbbr(payeeInfo.getCustomerAbbr()); | 1026 | serialRecord.setCustomerAbbr(payeeInfo.getCustomerAbbr()); |
1003 | serialRecord.setCustomerNo(payeeInfo.getCustomerNo()); | 1027 | serialRecord.setCustomerNo(payeeInfo.getCustomerNo()); |
1004 | } | 1028 | } |
1005 | serialRecord.setCustomerId(order.getShopCustomerId()); | 1029 | serialRecord.setCustomerId(order.getShopCustomerId()); |
1006 | serialRecord.setCustomerName(order.getShopCustomerName()); | 1030 | serialRecord.setCustomerName(order.getShopCustomerName()); |
1007 | 1031 | ||
1008 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1032 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1009 | serialRecord.setCardNo(order.getShopCardNo()); | 1033 | serialRecord.setCardNo(order.getShopCardNo()); |
1010 | } | 1034 | } |
1011 | - serialRecord.setAmount(orderPayment.getPayAmount()-orderPayment.getPayDiscount()); | 1035 | + serialRecord.setAmount(orderPayment.getPayAmount() - orderPayment.getPayDiscount()); |
1012 | serialRecord.setNotes(String.format("卖方,订单号 %s", order.getCode())); | 1036 | serialRecord.setNotes(String.format("卖方,订单号 %s", order.getCode())); |
1013 | } | 1037 | } |
1014 | //serialRecord.setCustomerType(); //买家身份类型暂无 | 1038 | //serialRecord.setCustomerType(); //买家身份类型暂无 |
1015 | //serialRecord.setTradeType();// | 1039 | //serialRecord.setTradeType();// |
1016 | - if(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1040 | + if (OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1017 | serialRecord.setTradeChannel(TradeChannelEnum.BALANCE.getCode()); | 1041 | serialRecord.setTradeChannel(TradeChannelEnum.BALANCE.getCode()); |
1018 | - }else if(OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1042 | + } else if (OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1019 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); | 1043 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); |
1020 | - }else if(OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1044 | + } else if (OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1021 | serialRecord.setTradeChannel(TradeChannelEnum.ALI.getCode()); | 1045 | serialRecord.setTradeChannel(TradeChannelEnum.ALI.getCode()); |
1022 | - }else if(OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1046 | + } else if (OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1023 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1047 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1024 | - }else if(OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1048 | + } else if (OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1025 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1049 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1026 | - }else if(OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1050 | + } else if (OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1027 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1051 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1028 | - }else if(OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1052 | + } else if (OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1029 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); | 1053 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); |
1030 | } | 1054 | } |
1031 | serialRecord.setFundItem(FundItem.TRADE_PAYMENT.getIntegerCode().longValue()); | 1055 | serialRecord.setFundItem(FundItem.TRADE_PAYMENT.getIntegerCode().longValue()); |
@@ -1041,9 +1065,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1041,9 +1065,9 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1041 | return serialRecordDtos; | 1065 | return serialRecordDtos; |
1042 | } | 1066 | } |
1043 | 1067 | ||
1044 | - private void setSerialRecordCustomerInfo(Long marketId, Long shopCustomerId,SerialRecordDto serialRecordDto) { | 1068 | + private void setSerialRecordCustomerInfo(Long marketId, Long shopCustomerId, SerialRecordDto serialRecordDto) { |
1045 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(shopCustomerId); | 1069 | BaseOutput<CustomerBaseExtensionInfo> extenMessage = customerRpc.getCustomerAndBaseExtensionById(shopCustomerId); |
1046 | - if(extenMessage.getData()!=null){ | 1070 | + if (extenMessage.getData() != null) { |
1047 | CustomerBaseExtensionInfo customerBaseExtensionInfo = extenMessage.getData(); | 1071 | CustomerBaseExtensionInfo customerBaseExtensionInfo = extenMessage.getData(); |
1048 | serialRecordDto.setCustomerId(customerBaseExtensionInfo.getCustomerId()); | 1072 | serialRecordDto.setCustomerId(customerBaseExtensionInfo.getCustomerId()); |
1049 | serialRecordDto.setCustomerNo(customerBaseExtensionInfo.getCode()); | 1073 | serialRecordDto.setCustomerNo(customerBaseExtensionInfo.getCode()); |
@@ -1054,6 +1078,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1054,6 +1078,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1054 | 1078 | ||
1055 | /** | 1079 | /** |
1056 | * 买方优惠券流水 | 1080 | * 买方优惠券流水 |
1081 | + * | ||
1057 | * @param balanceResponseDto | 1082 | * @param balanceResponseDto |
1058 | * @param order | 1083 | * @param order |
1059 | * @param orderPayment | 1084 | * @param orderPayment |
@@ -1062,15 +1087,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1062,15 +1087,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1062 | * @param orderPayDto | 1087 | * @param orderPayDto |
1063 | * @return | 1088 | * @return |
1064 | */ | 1089 | */ |
1065 | - private List<SerialRecordDto> createCouponsSerialRecordDto(BalanceResponseDto balanceResponseDto,Order order ,OrderPayment orderPayment,ActionEnum actionEnum | ||
1066 | - ,List<OrderCoupon> coupons,OrderPayDto orderPayDto,OrderPaymentPayeeInfoDto payeeInfoDto){ | 1090 | + private List<SerialRecordDto> createCouponsSerialRecordDto(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, ActionEnum actionEnum |
1091 | + , List<OrderCoupon> coupons, OrderPayDto orderPayDto, OrderPaymentPayeeInfoDto payeeInfoDto) { | ||
1067 | Long startBalance = 0L; | 1092 | Long startBalance = 0L; |
1068 | - if(balanceResponseDto != null){ | ||
1069 | - startBalance = balanceResponseDto.getRelation().getBalance()+orderPayment.getPayAmount()-orderPayment.getPayDiscount(); | 1093 | + if (balanceResponseDto != null) { |
1094 | + startBalance = balanceResponseDto.getRelation().getBalance() + orderPayment.getPayAmount() - orderPayment.getPayDiscount(); | ||
1070 | } | 1095 | } |
1071 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); | 1096 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); |
1072 | 1097 | ||
1073 | - for(OrderCoupon coupon : coupons) { | 1098 | + for (OrderCoupon coupon : coupons) { |
1074 | //买方货款 | 1099 | //买方货款 |
1075 | SerialRecordDto serialRecord = new SerialRecordDto(); | 1100 | SerialRecordDto serialRecord = new SerialRecordDto(); |
1076 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); | 1101 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); |
@@ -1099,11 +1124,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1099,11 +1124,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1099 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); | 1124 | serialRecord.setCustomerAbbr(orderPayDto.getCustomerAbbr()); |
1100 | serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); | 1125 | serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); |
1101 | serialRecord.setAmount(coupon.getAmount()); | 1126 | serialRecord.setAmount(coupon.getAmount()); |
1102 | - serialRecord.setNotes(String.format("买方,订单号: %s,优惠券码:%s", order.getCode(),coupon.getCouponCode())); | ||
1103 | - }else if(actionEnum.getCode()==ActionEnum.INCOME.getCode()){ | 1127 | + serialRecord.setNotes(String.format("买方,订单号: %s,优惠券码:%s", order.getCode(), coupon.getCouponCode())); |
1128 | + } else if (actionEnum.getCode() == ActionEnum.INCOME.getCode()) { | ||
1104 | //卖方 | 1129 | //卖方 |
1105 | serialRecord.setAction(ActionEnum.INCOME.getCode()); | 1130 | serialRecord.setAction(ActionEnum.INCOME.getCode()); |
1106 | - if(balanceResponseDto == null){ | 1131 | + if (balanceResponseDto == null) { |
1107 | serialRecord.setAccountId(null); | 1132 | serialRecord.setAccountId(null); |
1108 | serialRecord.setStartBalance(null); | 1133 | serialRecord.setStartBalance(null); |
1109 | serialRecord.setEndBalance(null); | 1134 | serialRecord.setEndBalance(null); |
@@ -1115,12 +1140,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1115,12 +1140,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1115 | //持卡人联系电话(客户联系电话) | 1140 | //持卡人联系电话(客户联系电话) |
1116 | serialRecord.setHoldContactsPhone(null); | 1141 | serialRecord.setHoldContactsPhone(null); |
1117 | 1142 | ||
1118 | - }else{ | 1143 | + } else { |
1119 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); | 1144 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); |
1120 | serialRecord.setStartBalance(startBalance); | 1145 | serialRecord.setStartBalance(startBalance); |
1121 | - serialRecord.setEndBalance(startBalance+coupon.getAmount()); | 1146 | + serialRecord.setEndBalance(startBalance + coupon.getAmount()); |
1122 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1147 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
1123 | - if(payeeInfoDto!=null){ | 1148 | + if (payeeInfoDto != null) { |
1124 | //持卡人姓名(客户姓名) | 1149 | //持卡人姓名(客户姓名) |
1125 | serialRecord.setHoldName(payeeInfoDto.getHoldName()); | 1150 | serialRecord.setHoldName(payeeInfoDto.getHoldName()); |
1126 | //持卡人证件号(客户证件号) | 1151 | //持卡人证件号(客户证件号) |
@@ -1130,17 +1155,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1130,17 +1155,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1130 | } | 1155 | } |
1131 | startBalance += coupon.getAmount(); | 1156 | startBalance += coupon.getAmount(); |
1132 | } | 1157 | } |
1133 | - if(payeeInfoDto!=null){ | 1158 | + if (payeeInfoDto != null) { |
1134 | serialRecord.setCustomerAbbr(payeeInfoDto.getCustomerAbbr()); | 1159 | serialRecord.setCustomerAbbr(payeeInfoDto.getCustomerAbbr()); |
1135 | serialRecord.setCustomerNo(payeeInfoDto.getCustomerNo()); | 1160 | serialRecord.setCustomerNo(payeeInfoDto.getCustomerNo()); |
1136 | } | 1161 | } |
1137 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1162 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1138 | serialRecord.setCardNo(order.getShopCardNo()); | 1163 | serialRecord.setCardNo(order.getShopCardNo()); |
1139 | } | 1164 | } |
1140 | serialRecord.setCustomerId(order.getShopCustomerId()); | 1165 | serialRecord.setCustomerId(order.getShopCustomerId()); |
1141 | serialRecord.setCustomerName(order.getShopCustomerName()); | 1166 | serialRecord.setCustomerName(order.getShopCustomerName()); |
1142 | serialRecord.setAmount(coupon.getAmount()); | 1167 | serialRecord.setAmount(coupon.getAmount()); |
1143 | - serialRecord.setNotes(String.format("卖方,订单号: %s,优惠券码:%s", order.getCode(),coupon.getCouponCode())); | 1168 | + serialRecord.setNotes(String.format("卖方,订单号: %s,优惠券码:%s", order.getCode(), coupon.getCouponCode())); |
1144 | } | 1169 | } |
1145 | //serialRecord.setCustomerType(); //买家身份类型暂无 | 1170 | //serialRecord.setCustomerType(); //买家身份类型暂无 |
1146 | //serialRecord.setTradeType();// | 1171 | //serialRecord.setTradeType();// |
@@ -1160,47 +1185,48 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1160,47 +1185,48 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1160 | 1185 | ||
1161 | /** | 1186 | /** |
1162 | * 作废流水 | 1187 | * 作废流水 |
1188 | + * | ||
1163 | * @param balanceResponseDto | 1189 | * @param balanceResponseDto |
1164 | * @param order | 1190 | * @param order |
1165 | * @param orderPayment | 1191 | * @param orderPayment |
1166 | * @param coupons | 1192 | * @param coupons |
1167 | - * @param payeeInfo 买方信息 | 1193 | + * @param payeeInfo 买方信息 |
1168 | */ | 1194 | */ |
1169 | @Override | 1195 | @Override |
1170 | - public void sendInvalidSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, List<OrderCoupon> coupons,OrderPaymentPayeeInfoDto payeeInfo) { | 1196 | + public void sendInvalidSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, List<OrderCoupon> coupons, OrderPaymentPayeeInfoDto payeeInfo) { |
1171 | OrderPaymentPayeeInfoDto payerInfo = null; | 1197 | OrderPaymentPayeeInfoDto payerInfo = null; |
1172 | - try{ | 1198 | + try { |
1173 | //买方信息 | 1199 | //买方信息 |
1174 | - if(payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | ||
1175 | - if(order.getBuyerId()!=null){ | 1200 | + if (payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1201 | + if (order.getBuyerId() != null) { | ||
1176 | payerInfo = getPayeeInfo(order.getBuyerId()); | 1202 | payerInfo = getPayeeInfo(order.getBuyerId()); |
1177 | } | 1203 | } |
1178 | - }else if(payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1204 | + } else if (payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1179 | payerInfo = getPayeeInfoByAccountId(orderPayment.getPayerAccountId()); | 1205 | payerInfo = getPayeeInfoByAccountId(orderPayment.getPayerAccountId()); |
1180 | } | 1206 | } |
1181 | //卖方信息 | 1207 | //卖方信息 |
1182 | - if(payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1208 | + if (payeeInfo == null && !orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1183 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); | 1209 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); |
1184 | - }else if(payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1210 | + } else if (payeeInfo == null && orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1185 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); | 1211 | payeeInfo = getPayeeInfoByAccountId(orderPayment.getPayeeAccountId()); |
1186 | } | 1212 | } |
1187 | - }catch (Exception e){ | ||
1188 | - LOGGER.warn("客户服务调用异常",e); | 1213 | + } catch (Exception e) { |
1214 | + LOGGER.warn("客户服务调用异常", e); | ||
1189 | } | 1215 | } |
1190 | 1216 | ||
1191 | List<SerialRecordDto> list = new ArrayList<>(); | 1217 | List<SerialRecordDto> list = new ArrayList<>(); |
1192 | //买家收款 | 1218 | //买家收款 |
1193 | - List<SerialRecordDto> mainSerialRecordDtoBuyer = createInvalidSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons,payerInfo,payeeInfo); | 1219 | + List<SerialRecordDto> mainSerialRecordDtoBuyer = createInvalidSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, payerInfo, payeeInfo); |
1194 | list.addAll(mainSerialRecordDtoBuyer); | 1220 | list.addAll(mainSerialRecordDtoBuyer); |
1195 | //卖家付款 | 1221 | //卖家付款 |
1196 | - List<SerialRecordDto> mainSerialRecordDtoSeller = createInvalidSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons,payerInfo,payeeInfo); | 1222 | + List<SerialRecordDto> mainSerialRecordDtoSeller = createInvalidSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, payerInfo, payeeInfo); |
1197 | list.addAll(mainSerialRecordDtoSeller); | 1223 | list.addAll(mainSerialRecordDtoSeller); |
1198 | - if(coupons!=null&&coupons.size()>0){ | 1224 | + if (coupons != null && coupons.size() > 0) { |
1199 | //买家优惠作废 | 1225 | //买家优惠作废 |
1200 | - List<SerialRecordDto> couponsSerialRecordDtoBuyer = createInvalidCouponsSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons,payerInfo,payeeInfo); | 1226 | + List<SerialRecordDto> couponsSerialRecordDtoBuyer = createInvalidCouponsSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.INCOME, coupons, payerInfo, payeeInfo); |
1201 | list.addAll(couponsSerialRecordDtoBuyer); | 1227 | list.addAll(couponsSerialRecordDtoBuyer); |
1202 | //卖家优惠作废 | 1228 | //卖家优惠作废 |
1203 | - List<SerialRecordDto> couponsSerialRecordDtoSeller = createInvalidCouponsSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons,payerInfo,payeeInfo); | 1229 | + List<SerialRecordDto> couponsSerialRecordDtoSeller = createInvalidCouponsSerialRecord(balanceResponseDto, order, orderPayment, ActionEnum.EXPENSE, coupons, payerInfo, payeeInfo); |
1204 | list.addAll(couponsSerialRecordDtoSeller); | 1230 | list.addAll(couponsSerialRecordDtoSeller); |
1205 | } | 1231 | } |
1206 | //发送mq | 1232 | //发送mq |
@@ -1209,13 +1235,14 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1209,13 +1235,14 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1209 | 1235 | ||
1210 | /** | 1236 | /** |
1211 | * 创建买方货款流水 | 1237 | * 创建买方货款流水 |
1238 | + * | ||
1212 | * @param order | 1239 | * @param order |
1213 | * @param orderPayment | 1240 | * @param orderPayment |
1214 | - * @param actionEnum 买家角度 | 1241 | + * @param actionEnum 买家角度 |
1215 | * @return | 1242 | * @return |
1216 | */ | 1243 | */ |
1217 | - private List<SerialRecordDto> createInvalidSerialRecord(BalanceResponseDto balanceResponseDto,Order order ,OrderPayment orderPayment,ActionEnum actionEnum | ||
1218 | - ,List<OrderCoupon> coupons,OrderPaymentPayeeInfoDto payerInfo ,OrderPaymentPayeeInfoDto payeeInfo){ | 1244 | + private List<SerialRecordDto> createInvalidSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, ActionEnum actionEnum |
1245 | + , List<OrderCoupon> coupons, OrderPaymentPayeeInfoDto payerInfo, OrderPaymentPayeeInfoDto payeeInfo) { | ||
1219 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); | 1246 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); |
1220 | 1247 | ||
1221 | //买方货款 | 1248 | //买方货款 |
@@ -1223,10 +1250,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1223,10 +1250,10 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1223 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); | 1250 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); |
1224 | serialRecord.setType(BizNumberTypeEnum.ETRADE_TRADE.getCode()); | 1251 | serialRecord.setType(BizNumberTypeEnum.ETRADE_TRADE.getCode()); |
1225 | serialRecord.setTypeName(BizNumberTypeEnum.ETRADE_TRADE.getName()); | 1252 | serialRecord.setTypeName(BizNumberTypeEnum.ETRADE_TRADE.getName()); |
1226 | - if(actionEnum.getCode()==ActionEnum.INCOME.getCode()){ | 1253 | + if (actionEnum.getCode() == ActionEnum.INCOME.getCode()) { |
1227 | //买方 | 1254 | //买方 |
1228 | serialRecord.setAction(ActionEnum.INCOME.getCode()); | 1255 | serialRecord.setAction(ActionEnum.INCOME.getCode()); |
1229 | - if(balanceResponseDto == null){ | 1256 | + if (balanceResponseDto == null) { |
1230 | serialRecord.setAccountId(null); | 1257 | serialRecord.setAccountId(null); |
1231 | serialRecord.setStartBalance(null); | 1258 | serialRecord.setStartBalance(null); |
1232 | serialRecord.setEndBalance(null); | 1259 | serialRecord.setEndBalance(null); |
@@ -1238,18 +1265,18 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1238,18 +1265,18 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1238 | //持卡人联系电话(客户联系电话) | 1265 | //持卡人联系电话(客户联系电话) |
1239 | serialRecord.setHoldContactsPhone(null); | 1266 | serialRecord.setHoldContactsPhone(null); |
1240 | 1267 | ||
1241 | - }else{ | ||
1242 | - if(balanceResponseDto.getRelation()!=null){ | 1268 | + } else { |
1269 | + if (balanceResponseDto.getRelation() != null) { | ||
1243 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); | 1270 | serialRecord.setAccountId(balanceResponseDto.getRelation().getAccountId()); |
1244 | serialRecord.setStartBalance(balanceResponseDto.getRelation().getBalance()); | 1271 | serialRecord.setStartBalance(balanceResponseDto.getRelation().getBalance()); |
1245 | - serialRecord.setEndBalance(balanceResponseDto.getRelation().getBalance()-orderPayment.getPayAmount()+orderPayment.getPayDiscount()); | ||
1246 | - }else{ | 1272 | + serialRecord.setEndBalance(balanceResponseDto.getRelation().getBalance() - orderPayment.getPayAmount() + orderPayment.getPayDiscount()); |
1273 | + } else { | ||
1247 | serialRecord.setAccountId(null); | 1274 | serialRecord.setAccountId(null); |
1248 | serialRecord.setStartBalance(null); | 1275 | serialRecord.setStartBalance(null); |
1249 | serialRecord.setEndBalance(null); | 1276 | serialRecord.setEndBalance(null); |
1250 | } | 1277 | } |
1251 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1278 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
1252 | - if(payerInfo!=null){ | 1279 | + if (payerInfo != null) { |
1253 | //持卡人姓名(客户姓名) | 1280 | //持卡人姓名(客户姓名) |
1254 | serialRecord.setHoldName(payerInfo.getHoldName()); | 1281 | serialRecord.setHoldName(payerInfo.getHoldName()); |
1255 | //持卡人证件号(客户证件号) | 1282 | //持卡人证件号(客户证件号) |
@@ -1258,22 +1285,22 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1258,22 +1285,22 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1258 | serialRecord.setHoldContactsPhone(payerInfo.getHoldContactsPhone()); | 1285 | serialRecord.setHoldContactsPhone(payerInfo.getHoldContactsPhone()); |
1259 | } | 1286 | } |
1260 | } | 1287 | } |
1261 | - if(payerInfo!=null){ | 1288 | + if (payerInfo != null) { |
1262 | serialRecord.setCustomerNo(payerInfo.getCustomerNo()); | 1289 | serialRecord.setCustomerNo(payerInfo.getCustomerNo()); |
1263 | serialRecord.setCustomerAbbr(payerInfo.getCustomerAbbr()); | 1290 | serialRecord.setCustomerAbbr(payerInfo.getCustomerAbbr()); |
1264 | } | 1291 | } |
1265 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())){ | 1292 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1266 | serialRecord.setCardNo(orderPayment.getPayerCardNo()); | 1293 | serialRecord.setCardNo(orderPayment.getPayerCardNo()); |
1267 | } | 1294 | } |
1268 | - serialRecord.setCustomerId(orderPayment.getPayerCustomerId()==null?0L:orderPayment.getPayerCustomerId()); | 1295 | + serialRecord.setCustomerId(orderPayment.getPayerCustomerId() == null ? 0L : orderPayment.getPayerCustomerId()); |
1269 | serialRecord.setCustomerNo(order.getBuyerCode()); | 1296 | serialRecord.setCustomerNo(order.getBuyerCode()); |
1270 | - serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName())?"默认用户":orderPayment.getPayerCustomerName()); | ||
1271 | - serialRecord.setAmount(Math.abs(orderPayment.getPayAmount())-Math.abs(orderPayment.getPayDiscount())); | 1297 | + serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); |
1298 | + serialRecord.setAmount(Math.abs(orderPayment.getPayAmount()) - Math.abs(orderPayment.getPayDiscount())); | ||
1272 | serialRecord.setNotes(String.format("作废买方,订单号 %s", order.getCode())); | 1299 | serialRecord.setNotes(String.format("作废买方,订单号 %s", order.getCode())); |
1273 | - }else if(actionEnum.getCode()==ActionEnum.EXPENSE.getCode()){ | 1300 | + } else if (actionEnum.getCode() == ActionEnum.EXPENSE.getCode()) { |
1274 | //卖方 | 1301 | //卖方 |
1275 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); | 1302 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); |
1276 | - if(balanceResponseDto == null){ | 1303 | + if (balanceResponseDto == null) { |
1277 | serialRecord.setAccountId(null); | 1304 | serialRecord.setAccountId(null); |
1278 | serialRecord.setStartBalance(null); | 1305 | serialRecord.setStartBalance(null); |
1279 | serialRecord.setEndBalance(null); | 1306 | serialRecord.setEndBalance(null); |
@@ -1284,12 +1311,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1284,12 +1311,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1284 | serialRecord.setHoldCertificateNumber(null); | 1311 | serialRecord.setHoldCertificateNumber(null); |
1285 | //持卡人联系电话(客户联系电话) | 1312 | //持卡人联系电话(客户联系电话) |
1286 | serialRecord.setHoldContactsPhone(null); | 1313 | serialRecord.setHoldContactsPhone(null); |
1287 | - }else{ | 1314 | + } else { |
1288 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); | 1315 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); |
1289 | serialRecord.setStartBalance(balanceResponseDto.getBalance()); | 1316 | serialRecord.setStartBalance(balanceResponseDto.getBalance()); |
1290 | - serialRecord.setEndBalance(balanceResponseDto.getBalance()+orderPayment.getPayAmount()-orderPayment.getPayDiscount()); | 1317 | + serialRecord.setEndBalance(balanceResponseDto.getBalance() + orderPayment.getPayAmount() - orderPayment.getPayDiscount()); |
1291 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1318 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
1292 | - if(payeeInfo!=null){ | 1319 | + if (payeeInfo != null) { |
1293 | //持卡人姓名(客户姓名) | 1320 | //持卡人姓名(客户姓名) |
1294 | serialRecord.setHoldName(payeeInfo.getHoldName()); | 1321 | serialRecord.setHoldName(payeeInfo.getHoldName()); |
1295 | //持卡人证件号(客户证件号) | 1322 | //持卡人证件号(客户证件号) |
@@ -1298,33 +1325,33 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1298,33 +1325,33 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1298 | serialRecord.setHoldContactsPhone(payeeInfo.getHoldContactsPhone()); | 1325 | serialRecord.setHoldContactsPhone(payeeInfo.getHoldContactsPhone()); |
1299 | } | 1326 | } |
1300 | } | 1327 | } |
1301 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { | 1328 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1302 | serialRecord.setCardNo(order.getShopCardNo()); | 1329 | serialRecord.setCardNo(order.getShopCardNo()); |
1303 | } | 1330 | } |
1304 | serialRecord.setCustomerId(order.getShopCustomerId()); | 1331 | serialRecord.setCustomerId(order.getShopCustomerId()); |
1305 | serialRecord.setCustomerName(order.getShopCustomerName()); | 1332 | serialRecord.setCustomerName(order.getShopCustomerName()); |
1306 | - if(payeeInfo!=null){ | 1333 | + if (payeeInfo != null) { |
1307 | serialRecord.setCustomerNo(payeeInfo.getCustomerNo()); | 1334 | serialRecord.setCustomerNo(payeeInfo.getCustomerNo()); |
1308 | serialRecord.setCustomerAbbr(payeeInfo.getCustomerAbbr()); | 1335 | serialRecord.setCustomerAbbr(payeeInfo.getCustomerAbbr()); |
1309 | } | 1336 | } |
1310 | - serialRecord.setAmount(Math.abs(orderPayment.getPayAmount())-Math.abs(orderPayment.getPayDiscount())); | 1337 | + serialRecord.setAmount(Math.abs(orderPayment.getPayAmount()) - Math.abs(orderPayment.getPayDiscount())); |
1311 | serialRecord.setNotes(String.format("作废卖方,订单号 %s", order.getCode())); | 1338 | serialRecord.setNotes(String.format("作废卖方,订单号 %s", order.getCode())); |
1312 | } | 1339 | } |
1313 | //serialRecord.setCustomerType(); //买家身份类型暂无 | 1340 | //serialRecord.setCustomerType(); //买家身份类型暂无 |
1314 | //serialRecord.setTradeType();// | 1341 | //serialRecord.setTradeType();// |
1315 | - if(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1342 | + if (OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1316 | serialRecord.setTradeChannel(TradeChannelEnum.BALANCE.getCode()); | 1343 | serialRecord.setTradeChannel(TradeChannelEnum.BALANCE.getCode()); |
1317 | - }else if(OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1344 | + } else if (OrderPaymentAllChannel.WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1318 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); | 1345 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); |
1319 | - }else if(OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1346 | + } else if (OrderPaymentAllChannel.ZFB_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1320 | serialRecord.setTradeChannel(TradeChannelEnum.ALI.getCode()); | 1347 | serialRecord.setTradeChannel(TradeChannelEnum.ALI.getCode()); |
1321 | - }else if(OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1348 | + } else if (OrderPaymentAllChannel.CASH_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1322 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1349 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1323 | - }else if(OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1350 | + } else if (OrderPaymentAllChannel.CREDIT_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1324 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1351 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1325 | - }else if(OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1352 | + } else if (OrderPaymentAllChannel.CREDIT_CODE_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1326 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); | 1353 | serialRecord.setTradeChannel(TradeChannelEnum.CASH.getCode()); |
1327 | - }else if(OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())){ | 1354 | + } else if (OrderPaymentAllChannel.BUYER_WX_CHANNEL.getCodeInteger().equals(orderPayment.getPayChannel())) { |
1328 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); | 1355 | serialRecord.setTradeChannel(TradeChannelEnum.WECHAT.getCode()); |
1329 | } | 1356 | } |
1330 | serialRecord.setFundItem(FundItem.TRADE_PAYMENT.getIntegerCode().longValue()); | 1357 | serialRecord.setFundItem(FundItem.TRADE_PAYMENT.getIntegerCode().longValue()); |
@@ -1342,24 +1369,25 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1342,24 +1369,25 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1342 | 1369 | ||
1343 | /** | 1370 | /** |
1344 | * 买方优惠券流水 | 1371 | * 买方优惠券流水 |
1372 | + * | ||
1345 | * @param balanceResponseDto | 1373 | * @param balanceResponseDto |
1346 | * @param order | 1374 | * @param order |
1347 | * @param orderPayment | 1375 | * @param orderPayment |
1348 | * @param actionEnum | 1376 | * @param actionEnum |
1349 | * @param coupons | 1377 | * @param coupons |
1350 | - * @param payerInfo 买方信息 | ||
1351 | - * @param payeeInfoDto 卖方信息 | 1378 | + * @param payerInfo 买方信息 |
1379 | + * @param payeeInfoDto 卖方信息 | ||
1352 | * @return | 1380 | * @return |
1353 | */ | 1381 | */ |
1354 | - private List<SerialRecordDto> createInvalidCouponsSerialRecord(BalanceResponseDto balanceResponseDto,Order order ,OrderPayment orderPayment,ActionEnum actionEnum | ||
1355 | - ,List<OrderCoupon> coupons,OrderPaymentPayeeInfoDto payerInfo,OrderPaymentPayeeInfoDto payeeInfoDto){ | 1382 | + private List<SerialRecordDto> createInvalidCouponsSerialRecord(BalanceResponseDto balanceResponseDto, Order order, OrderPayment orderPayment, ActionEnum actionEnum |
1383 | + , List<OrderCoupon> coupons, OrderPaymentPayeeInfoDto payerInfo, OrderPaymentPayeeInfoDto payeeInfoDto) { | ||
1356 | Long startBalance = 0L; | 1384 | Long startBalance = 0L; |
1357 | - if(balanceResponseDto != null){ | ||
1358 | - startBalance = balanceResponseDto.getBalance()+orderPayment.getPayAmount()-orderPayment.getPayDiscount(); | 1385 | + if (balanceResponseDto != null) { |
1386 | + startBalance = balanceResponseDto.getBalance() + orderPayment.getPayAmount() - orderPayment.getPayDiscount(); | ||
1359 | } | 1387 | } |
1360 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); | 1388 | List<SerialRecordDto> serialRecordDtos = new ArrayList<>(); |
1361 | 1389 | ||
1362 | - for(OrderCoupon coupon : coupons) { | 1390 | + for (OrderCoupon coupon : coupons) { |
1363 | //买方货款 | 1391 | //买方货款 |
1364 | SerialRecordDto serialRecord = new SerialRecordDto(); | 1392 | SerialRecordDto serialRecord = new SerialRecordDto(); |
1365 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); | 1393 | serialRecord.setSettleDayNo(DateUtils.formatDate(orderPayment.getPayTime().toLocalDate(), "yyyy-MM-dd")); |
@@ -1379,7 +1407,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1379,7 +1407,7 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1379 | if (balanceResponseDto != null) { | 1407 | if (balanceResponseDto != null) { |
1380 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1408 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
1381 | } | 1409 | } |
1382 | - if(payerInfo!=null){ | 1410 | + if (payerInfo != null) { |
1383 | serialRecord.setCustomerAbbr(payerInfo.getCustomerAbbr()); | 1411 | serialRecord.setCustomerAbbr(payerInfo.getCustomerAbbr()); |
1384 | } | 1412 | } |
1385 | serialRecord.setOperateTime(orderPayment.getPayTime()); | 1413 | serialRecord.setOperateTime(orderPayment.getPayTime()); |
@@ -1387,11 +1415,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1387,11 +1415,11 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1387 | serialRecord.setCustomerNo(order.getBuyerCode()); | 1415 | serialRecord.setCustomerNo(order.getBuyerCode()); |
1388 | serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); | 1416 | serialRecord.setCustomerName(StrUtil.isBlank(orderPayment.getPayerCustomerName()) ? "默认用户" : orderPayment.getPayerCustomerName()); |
1389 | serialRecord.setAmount(Math.abs(coupon.getAmount())); | 1417 | serialRecord.setAmount(Math.abs(coupon.getAmount())); |
1390 | - serialRecord.setNotes(String.format("作废买方,订单号: %s,优惠券码:%s", order.getCode(),coupon.getCouponCode())); | ||
1391 | - }else if(actionEnum.getCode()==ActionEnum.EXPENSE.getCode()){ | 1418 | + serialRecord.setNotes(String.format("作废买方,订单号: %s,优惠券码:%s", order.getCode(), coupon.getCouponCode())); |
1419 | + } else if (actionEnum.getCode() == ActionEnum.EXPENSE.getCode()) { | ||
1392 | //卖方 | 1420 | //卖方 |
1393 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); | 1421 | serialRecord.setAction(ActionEnum.EXPENSE.getCode()); |
1394 | - if(balanceResponseDto == null){ | 1422 | + if (balanceResponseDto == null) { |
1395 | serialRecord.setAccountId(null); | 1423 | serialRecord.setAccountId(null); |
1396 | serialRecord.setStartBalance(null); | 1424 | serialRecord.setStartBalance(null); |
1397 | serialRecord.setEndBalance(null); | 1425 | serialRecord.setEndBalance(null); |
@@ -1402,12 +1430,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1402,12 +1430,12 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1402 | serialRecord.setHoldCertificateNumber(null); | 1430 | serialRecord.setHoldCertificateNumber(null); |
1403 | //持卡人联系电话(客户联系电话) | 1431 | //持卡人联系电话(客户联系电话) |
1404 | serialRecord.setHoldContactsPhone(null); | 1432 | serialRecord.setHoldContactsPhone(null); |
1405 | - }else{ | 1433 | + } else { |
1406 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); | 1434 | serialRecord.setAccountId(balanceResponseDto.getAccountId()); |
1407 | serialRecord.setStartBalance(startBalance); | 1435 | serialRecord.setStartBalance(startBalance); |
1408 | - serialRecord.setEndBalance(startBalance+coupon.getAmount()); | 1436 | + serialRecord.setEndBalance(startBalance + coupon.getAmount()); |
1409 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); | 1437 | serialRecord.setTradeNo(balanceResponseDto.getTradeId()); |
1410 | - if(payeeInfoDto!=null){ | 1438 | + if (payeeInfoDto != null) { |
1411 | serialRecord.setHoldContactsPhone(payeeInfoDto.getHoldContactsPhone()); | 1439 | serialRecord.setHoldContactsPhone(payeeInfoDto.getHoldContactsPhone()); |
1412 | serialRecord.setHoldName(payeeInfoDto.getHoldName()); | 1440 | serialRecord.setHoldName(payeeInfoDto.getHoldName()); |
1413 | serialRecord.setHoldCertificateNumber(payeeInfoDto.getHoldCertificateNumber()); | 1441 | serialRecord.setHoldCertificateNumber(payeeInfoDto.getHoldCertificateNumber()); |
@@ -1415,17 +1443,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1415,17 +1443,17 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1415 | } | 1443 | } |
1416 | startBalance += coupon.getAmount(); | 1444 | startBalance += coupon.getAmount(); |
1417 | } | 1445 | } |
1418 | - if(payeeInfoDto!=null){ | 1446 | + if (payeeInfoDto != null) { |
1419 | serialRecord.setCustomerNo(payeeInfoDto.getCustomerNo()); | 1447 | serialRecord.setCustomerNo(payeeInfoDto.getCustomerNo()); |
1420 | serialRecord.setCustomerAbbr(payeeInfoDto.getCustomerAbbr()); | 1448 | serialRecord.setCustomerAbbr(payeeInfoDto.getCustomerAbbr()); |
1421 | } | 1449 | } |
1422 | - if(orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { | 1450 | + if (orderPayment.getPayChannel().equals(OrderPaymentAllChannel.CARD_CHANNEL.getCodeInteger())) { |
1423 | serialRecord.setCardNo(order.getShopCardNo()); | 1451 | serialRecord.setCardNo(order.getShopCardNo()); |
1424 | } | 1452 | } |
1425 | serialRecord.setCustomerId(order.getShopCustomerId()); | 1453 | serialRecord.setCustomerId(order.getShopCustomerId()); |
1426 | serialRecord.setCustomerName(order.getShopCustomerName()); | 1454 | serialRecord.setCustomerName(order.getShopCustomerName()); |
1427 | serialRecord.setAmount(Math.abs(coupon.getAmount())); | 1455 | serialRecord.setAmount(Math.abs(coupon.getAmount())); |
1428 | - serialRecord.setNotes(String.format("作废卖方,订单号: %s,优惠券码:%s", order.getCode(),coupon.getCouponCode())); | 1456 | + serialRecord.setNotes(String.format("作废卖方,订单号: %s,优惠券码:%s", order.getCode(), coupon.getCouponCode())); |
1429 | } | 1457 | } |
1430 | //serialRecord.setCustomerType(); //买家身份类型暂无 | 1458 | //serialRecord.setCustomerType(); //买家身份类型暂无 |
1431 | //serialRecord.setTradeType();// | 1459 | //serialRecord.setTradeType();// |
@@ -1443,14 +1471,14 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1443,14 +1471,14 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1443 | return serialRecordDtos; | 1471 | return serialRecordDtos; |
1444 | } | 1472 | } |
1445 | 1473 | ||
1446 | - private SerialRecordDto setSerialRecordAccountInfo(SerialRecordDto recordDto,Long AccountId){ | ||
1447 | - if(recordDto!=null&&AccountId!=null){ | ||
1448 | - UserAccountSingleQueryDto userAccountSingleQueryDto=new UserAccountSingleQueryDto(); | 1474 | + private SerialRecordDto setSerialRecordAccountInfo(SerialRecordDto recordDto, Long AccountId) { |
1475 | + if (recordDto != null && AccountId != null) { | ||
1476 | + UserAccountSingleQueryDto userAccountSingleQueryDto = new UserAccountSingleQueryDto(); | ||
1449 | userAccountSingleQueryDto.setAccountId(AccountId); | 1477 | userAccountSingleQueryDto.setAccountId(AccountId); |
1450 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); | 1478 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); |
1451 | // | 1479 | // |
1452 | UserAccountCardResponseDto userAccountCardResponseDto = message.getData(); | 1480 | UserAccountCardResponseDto userAccountCardResponseDto = message.getData(); |
1453 | - AssertUtils.notNull(userAccountCardResponseDto,"未获取到买方持卡人信息"); | 1481 | + AssertUtils.notNull(userAccountCardResponseDto, "未获取到买方持卡人信息"); |
1454 | recordDto.setCustomerId(userAccountCardResponseDto.getCustomerId()); | 1482 | recordDto.setCustomerId(userAccountCardResponseDto.getCustomerId()); |
1455 | recordDto.setCustomerNo(userAccountCardResponseDto.getCustomerCode()); | 1483 | recordDto.setCustomerNo(userAccountCardResponseDto.getCustomerCode()); |
1456 | recordDto.setCustomerName(userAccountCardResponseDto.getCustomerName()); | 1484 | recordDto.setCustomerName(userAccountCardResponseDto.getCustomerName()); |
@@ -1465,15 +1493,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | @@ -1465,15 +1493,15 @@ public class OrderPaymenServiceImpl implements OrderPaymentService { | ||
1465 | return recordDto; | 1493 | return recordDto; |
1466 | } | 1494 | } |
1467 | 1495 | ||
1468 | - private OrderPaymentPayeeInfoDto getPayeeInfoByAccountId(Long AccountId){ | ||
1469 | - if(AccountId!=null){ | 1496 | + private OrderPaymentPayeeInfoDto getPayeeInfoByAccountId(Long AccountId) { |
1497 | + if (AccountId != null) { | ||
1470 | OrderPaymentPayeeInfoDto payeeInfoDto = new OrderPaymentPayeeInfoDto(); | 1498 | OrderPaymentPayeeInfoDto payeeInfoDto = new OrderPaymentPayeeInfoDto(); |
1471 | - UserAccountSingleQueryDto userAccountSingleQueryDto=new UserAccountSingleQueryDto(); | 1499 | + UserAccountSingleQueryDto userAccountSingleQueryDto = new UserAccountSingleQueryDto(); |
1472 | userAccountSingleQueryDto.setAccountId(AccountId); | 1500 | userAccountSingleQueryDto.setAccountId(AccountId); |
1473 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); | 1501 | Message<UserAccountCardResponseDto> message = accountRpc.findSingle(userAccountSingleQueryDto); |
1474 | // | 1502 | // |
1475 | UserAccountCardResponseDto userAccountCardResponseDto = message.getData(); | 1503 | UserAccountCardResponseDto userAccountCardResponseDto = message.getData(); |
1476 | - AssertUtils.notNull(userAccountCardResponseDto,"未获取到买方持卡人信息"); | 1504 | + AssertUtils.notNull(userAccountCardResponseDto, "未获取到买方持卡人信息"); |
1477 | payeeInfoDto.setCustomerId(userAccountCardResponseDto.getCustomerId()); | 1505 | payeeInfoDto.setCustomerId(userAccountCardResponseDto.getCustomerId()); |
1478 | payeeInfoDto.setCustomerNo(userAccountCardResponseDto.getCustomerCode()); | 1506 | payeeInfoDto.setCustomerNo(userAccountCardResponseDto.getCustomerCode()); |
1479 | payeeInfoDto.setCustomerName(userAccountCardResponseDto.getCustomerName()); | 1507 | payeeInfoDto.setCustomerName(userAccountCardResponseDto.getCustomerName()); |
etrade-order/src/main/java/com/diligrp/etrade/order/service/impl/OrderServiceImpl.java
@@ -814,7 +814,7 @@ public class OrderServiceImpl implements OrderService { | @@ -814,7 +814,7 @@ public class OrderServiceImpl implements OrderService { | ||
814 | OrderPayDto orderPayDto = new OrderPayDto(order.getCode(), orderWeChatPayBatch.getMarketId(),orderWeChatPayBatch.getPayerCustomerId() | 814 | OrderPayDto orderPayDto = new OrderPayDto(order.getCode(), orderWeChatPayBatch.getMarketId(),orderWeChatPayBatch.getPayerCustomerId() |
815 | ,orderWeChatPayBatch.getPayerStoreCustomerId(),orderWeChatPayBatch.getPayerCustomerName(),orderWeChatPayBatch.getPayerPhone() | 815 | ,orderWeChatPayBatch.getPayerStoreCustomerId(),orderWeChatPayBatch.getPayerCustomerName(),orderWeChatPayBatch.getPayerPhone() |
816 | ,null,null,null,null,orderWeChatPayBatch.getOperateId(),orderWeChatPayBatch.getOperateName() | 816 | ,null,null,null,null,orderWeChatPayBatch.getOperateId(),orderWeChatPayBatch.getOperateName() |
817 | - ,null,null,null,orderWeChatPayBatch.getCustomerAbbr(),weChatPayTradeBackDto.getPaymentId()); | 817 | + ,null,null,null,orderWeChatPayBatch.getCustomerAbbr(),weChatPayTradeBackDto.getPaymentId(),orderWeChatPayBatch.getPayChannelSub()); |
818 | orderPaymentService.createOrderPayment(order, orderPayDto, identityType,shop); | 818 | orderPaymentService.createOrderPayment(order, orderPayDto, identityType,shop); |
819 | }catch (PlatformServiceException pe){ | 819 | }catch (PlatformServiceException pe){ |
820 | LOGGER.info("微信支付异常,支付订单号:{},异常信息{}",orderWeChatPayBatch.getCodes(),pe.getMessage()); | 820 | LOGGER.info("微信支付异常,支付订单号:{},异常信息{}",orderWeChatPayBatch.getCodes(),pe.getMessage()); |
@@ -917,7 +917,7 @@ public class OrderServiceImpl implements OrderService { | @@ -917,7 +917,7 @@ public class OrderServiceImpl implements OrderService { | ||
917 | orderPayDto = new OrderPayDto(order.getCode(), order.getMarketId(),payment.getPayerCustomerId() | 917 | orderPayDto = new OrderPayDto(order.getCode(), order.getMarketId(),payment.getPayerCustomerId() |
918 | ,payment.getPayerStoreCustomerId(),payment.getPayerCustomerName(),order.getBuyerPhone() | 918 | ,payment.getPayerStoreCustomerId(),payment.getPayerCustomerName(),order.getBuyerPhone() |
919 | ,null,null,null,null, order.getBuyerId(), order.getBuyerName() | 919 | ,null,null,null,null, order.getBuyerId(), order.getBuyerName() |
920 | - ,null,null,null,payerInfo.getCustomerAbbr(),payment.getTradeId()); | 920 | + ,null,null,null,payerInfo.getCustomerAbbr(),payment.getTradeId(),null); |
921 | if(StringUtils.isBlank(order.getBuyerCode())){ | 921 | if(StringUtils.isBlank(order.getBuyerCode())){ |
922 | order.setBuyerCode(payerInfo.getCustomerNo()); | 922 | order.setBuyerCode(payerInfo.getCustomerNo()); |
923 | } | 923 | } |
@@ -925,7 +925,7 @@ public class OrderServiceImpl implements OrderService { | @@ -925,7 +925,7 @@ public class OrderServiceImpl implements OrderService { | ||
925 | orderPayDto = new OrderPayDto(order.getCode(), order.getMarketId(),payment.getPayerCustomerId() | 925 | orderPayDto = new OrderPayDto(order.getCode(), order.getMarketId(),payment.getPayerCustomerId() |
926 | ,payment.getPayerStoreCustomerId(),payment.getPayerCustomerName(),order.getBuyerPhone() | 926 | ,payment.getPayerStoreCustomerId(),payment.getPayerCustomerName(),order.getBuyerPhone() |
927 | ,null,null,null,null, order.getBuyerId(), order.getBuyerName() | 927 | ,null,null,null,null, order.getBuyerId(), order.getBuyerName() |
928 | - ,null,null,null,null,payment.getTradeId()); | 928 | + ,null,null,null,null,payment.getTradeId(),null); |
929 | } | 929 | } |
930 | if(payeeInfo==null){ | 930 | if(payeeInfo==null){ |
931 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); | 931 | payeeInfo = getPayeeInfo(order.getShopCustomerId()); |
etrade-order/src/main/java/com/diligrp/etrade/order/type/OrderPaymentSubChannel.java
0 → 100644
1 | +package com.diligrp.etrade.order.type; | ||
2 | + | ||
3 | +import com.diligrp.etrade.core.type.EnumArrayValuableEnums; | ||
4 | +import com.diligrp.etrade.core.type.IEnumType; | ||
5 | + | ||
6 | +import java.util.Map; | ||
7 | +import java.util.stream.Collectors; | ||
8 | +import java.util.stream.Stream; | ||
9 | + | ||
10 | +/** | ||
11 | + * 操作类型 | ||
12 | + */ | ||
13 | +public enum OrderPaymentSubChannel implements IEnumType, EnumArrayValuableEnums { | ||
14 | + //1现金,2支付宝,3微信,4园区卡 | ||
15 | + CARD_CHANNEL_BUYER("买方扫码", 1, 4, 4), | ||
16 | + CARD_CHANNEL_SELLER("卖方扫码", 2, 4, 8), | ||
17 | + CARD_CHANNEL_NFC("NFC", 3, 4, 8); | ||
18 | + | ||
19 | + private String name; | ||
20 | + private Integer code; | ||
21 | + | ||
22 | + private Integer settingChannel; | ||
23 | + | ||
24 | + private Integer realSettingChannel; | ||
25 | + | ||
26 | + private OrderPaymentSubChannel(String name, Integer code, Integer channel, Integer realSettingChannel) { | ||
27 | + this.name = name; | ||
28 | + this.code = code; | ||
29 | + this.settingChannel = channel; | ||
30 | + this.realSettingChannel = realSettingChannel; | ||
31 | + } | ||
32 | + | ||
33 | + public static OrderPaymentSubChannel getByCode(Integer code) { | ||
34 | + for (OrderPaymentSubChannel temp : OrderPaymentSubChannel.values()) { | ||
35 | + if (temp.getCodeInteger().equals(code)) { | ||
36 | + return temp; | ||
37 | + } | ||
38 | + } | ||
39 | + return null; | ||
40 | + } | ||
41 | + | ||
42 | + public static String getNameByCode(Integer code) { | ||
43 | + for (OrderPaymentSubChannel temp : OrderPaymentSubChannel.values()) { | ||
44 | + if (temp.getCodeInteger().equals(code)) { | ||
45 | + return temp.getName(); | ||
46 | + } | ||
47 | + } | ||
48 | + return null; | ||
49 | + } | ||
50 | + | ||
51 | + public Integer getSettingChannel() { | ||
52 | + return this.settingChannel; | ||
53 | + } | ||
54 | + | ||
55 | + public Integer getCodeInteger() { | ||
56 | + return this.code; | ||
57 | + } | ||
58 | + | ||
59 | + public String getName() { | ||
60 | + return this.name; | ||
61 | + } | ||
62 | + | ||
63 | + public int getCode() { | ||
64 | + return this.code; | ||
65 | + } | ||
66 | + | ||
67 | + public String toString() { | ||
68 | + return this.name; | ||
69 | + } | ||
70 | + | ||
71 | + public Integer getRealSettingChannel() { | ||
72 | + return realSettingChannel; | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * 自定义序列化 | ||
77 | + * | ||
78 | + * @return {@link Map}<{@link String}, {@link String}> | ||
79 | + */ | ||
80 | + @Override | ||
81 | + public Map<String, String> keyValue() { | ||
82 | + return Stream.of(OrderPaymentSubChannel.values()) | ||
83 | + .collect(Collectors.toMap(OrderPaymentSubChannel::getCode, OrderPaymentSubChannel::getName)).entrySet().stream() | ||
84 | + .collect(Collectors.toMap(vo -> vo.getKey().toString(), Map.Entry::getValue)); | ||
85 | + } | ||
86 | +} | ||
0 | \ No newline at end of file | 87 | \ No newline at end of file |
etrade-order/src/main/resources/com/diligrp/etrade/dao/mapper/order/OrderPaymentMapper.xml
@@ -34,13 +34,14 @@ | @@ -34,13 +34,14 @@ | ||
34 | <result column="seller_fee_state" jdbcType="VARCHAR" property="sellerFeeState" /> | 34 | <result column="seller_fee_state" jdbcType="VARCHAR" property="sellerFeeState" /> |
35 | <result column="order_status" jdbcType="TINYINT" property="orderStatus" /> | 35 | <result column="order_status" jdbcType="TINYINT" property="orderStatus" /> |
36 | <result column="relation_id" jdbcType="BIGINT" property="relationId" /> | 36 | <result column="relation_id" jdbcType="BIGINT" property="relationId" /> |
37 | + <result column="pay_channel_sub" jdbcType="TINYINT" property="payChannelSub"/> | ||
37 | </resultMap> | 38 | </resultMap> |
38 | <sql id="Base_Column_List"> | 39 | <sql id="Base_Column_List"> |
39 | id, `code`, order_id, order_code,market_id, pay_amount, pay_discount, payer_customer_id, payer_store_customer_id, | 40 | id, `code`, order_id, order_code,market_id, pay_amount, pay_discount, payer_customer_id, payer_store_customer_id, |
40 | payer_customer_name, payer_card_no, payer_account_id, payer_fund_account_id, payee_shop_id, | 41 | payer_customer_name, payer_card_no, payer_account_id, payer_fund_account_id, payee_shop_id, |
41 | payee_shop_name, payee_card_no, payee_account_id, payee_fund_account_id, payee_seller_id, | 42 | payee_shop_name, payee_card_no, payee_account_id, payee_fund_account_id, payee_seller_id, |
42 | payee_seller_name, pay_time, pay_mode, pay_channel, version, created_time, modified_time, | 43 | payee_seller_name, pay_time, pay_mode, pay_channel, version, created_time, modified_time, |
43 | - `state`, trade_id,totle_seller_fee,seller_fee_state,order_status,relation_id | 44 | + `state`, trade_id,totle_seller_fee,seller_fee_state,order_status,relation_id,pay_channel_sub |
44 | </sql> | 45 | </sql> |
45 | <sql id="VO_Column_List"> | 46 | <sql id="VO_Column_List"> |
46 | id, `code`, order_id, order_code, convert(pay_amount, decimal(20,2))/100 as pay_amount, convert(pay_discount, decimal(20,2))/100 as pay_discount, payer_customer_id, payer_store_customer_id, | 47 | id, `code`, order_id, order_code, convert(pay_amount, decimal(20,2))/100 as pay_amount, convert(pay_discount, decimal(20,2))/100 as pay_discount, payer_customer_id, payer_store_customer_id, |
@@ -58,7 +59,8 @@ | @@ -58,7 +59,8 @@ | ||
58 | payee_account_id, payee_fund_account_id, payee_seller_id, | 59 | payee_account_id, payee_fund_account_id, payee_seller_id, |
59 | payee_seller_name, pay_time, pay_mode, | 60 | payee_seller_name, pay_time, pay_mode, |
60 | pay_channel, version, state, trade_id, | 61 | pay_channel, version, state, trade_id, |
61 | - totle_seller_fee,seller_fee_state,order_status,relation_id | 62 | + totle_seller_fee,seller_fee_state,order_status,relation_id, |
63 | + pay_channel_sub | ||
62 | ) | 64 | ) |
63 | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{orderId,jdbcType=INTEGER},#{marketId,jdbcType=BIGINT}, | 65 | values (#{id,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, #{orderId,jdbcType=INTEGER},#{marketId,jdbcType=BIGINT}, |
64 | #{orderCode,jdbcType=VARCHAR}, #{payAmount,jdbcType=BIGINT}, #{payDiscount,jdbcType=BIGINT}, | 66 | #{orderCode,jdbcType=VARCHAR}, #{payAmount,jdbcType=BIGINT}, #{payDiscount,jdbcType=BIGINT}, |
@@ -68,7 +70,8 @@ | @@ -68,7 +70,8 @@ | ||
68 | #{payeeAccountId,jdbcType=BIGINT}, #{payeeFundAccountId,jdbcType=BIGINT}, #{payeeSellerId,jdbcType=BIGINT}, | 70 | #{payeeAccountId,jdbcType=BIGINT}, #{payeeFundAccountId,jdbcType=BIGINT}, #{payeeSellerId,jdbcType=BIGINT}, |
69 | #{payeeSellerName,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP}, #{payMode,jdbcType=INTEGER}, | 71 | #{payeeSellerName,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP}, #{payMode,jdbcType=INTEGER}, |
70 | #{payChannel,jdbcType=INTEGER}, #{version,jdbcType=INTEGER}, #{state,jdbcType=TINYINT}, #{tradeId,jdbcType=VARCHAR}, | 72 | #{payChannel,jdbcType=INTEGER}, #{version,jdbcType=INTEGER}, #{state,jdbcType=TINYINT}, #{tradeId,jdbcType=VARCHAR}, |
71 | - #{totleSellerFee,jdbcType=BIGINT}, #{sellerFeeState,jdbcType=TINYINT},#{orderStatus,jdbcType=TINYINT}, #{relationId,jdbcType=BIGINT}) | 73 | + #{totleSellerFee,jdbcType=BIGINT}, #{sellerFeeState,jdbcType=TINYINT},#{orderStatus,jdbcType=TINYINT}, #{relationId,jdbcType=BIGINT}, |
74 | + #{payChannelSub,jdbcType=INTEGER}) | ||
72 | </insert> | 75 | </insert> |
73 | <insert id="saveBatch" useGeneratedKeys="true" keyProperty="id"> | 76 | <insert id="saveBatch" useGeneratedKeys="true" keyProperty="id"> |
74 | insert into order_payment (id, code, order_id,market_id, | 77 | insert into order_payment (id, code, order_id,market_id, |
@@ -79,7 +82,8 @@ | @@ -79,7 +82,8 @@ | ||
79 | payee_account_id, payee_fund_account_id, payee_seller_id, | 82 | payee_account_id, payee_fund_account_id, payee_seller_id, |
80 | payee_seller_name, pay_time, pay_mode, | 83 | payee_seller_name, pay_time, pay_mode, |
81 | pay_channel, version, state, trade_id, | 84 | pay_channel, version, state, trade_id, |
82 | - totle_seller_fee,seller_fee_state,order_status,relation_id | 85 | + totle_seller_fee,seller_fee_state,order_status,relation_id, |
86 | + pay_channel_sub | ||
83 | ) | 87 | ) |
84 | values | 88 | values |
85 | <foreach collection="list" item="payment" separator=","> | 89 | <foreach collection="list" item="payment" separator=","> |
@@ -91,7 +95,8 @@ | @@ -91,7 +95,8 @@ | ||
91 | #{payment.payeeAccountId,jdbcType=BIGINT}, #{payment.payeeFundAccountId,jdbcType=BIGINT}, #{payment.payeeSellerId,jdbcType=BIGINT}, | 95 | #{payment.payeeAccountId,jdbcType=BIGINT}, #{payment.payeeFundAccountId,jdbcType=BIGINT}, #{payment.payeeSellerId,jdbcType=BIGINT}, |
92 | #{payment.payeeSellerName,jdbcType=VARCHAR}, #{payment.payTime,jdbcType=TIMESTAMP}, #{payment.payMode,jdbcType=INTEGER}, | 96 | #{payment.payeeSellerName,jdbcType=VARCHAR}, #{payment.payTime,jdbcType=TIMESTAMP}, #{payment.payMode,jdbcType=INTEGER}, |
93 | #{payment.payChannel,jdbcType=INTEGER}, #{payment.version,jdbcType=INTEGER}, #{payment.state,jdbcType=TINYINT}, #{payment.tradeId,jdbcType=VARCHAR}, | 97 | #{payment.payChannel,jdbcType=INTEGER}, #{payment.version,jdbcType=INTEGER}, #{payment.state,jdbcType=TINYINT}, #{payment.tradeId,jdbcType=VARCHAR}, |
94 | - #{payment.totleSellerFee,jdbcType=BIGINT}, #{payment.sellerFeeState,jdbcType=TINYINT},#{payment.orderStatus,jdbcType=TINYINT}, #{payment.relationId,jdbcType=BIGINT}) | 98 | + #{payment.totleSellerFee,jdbcType=BIGINT}, #{payment.sellerFeeState,jdbcType=TINYINT},#{payment.orderStatus,jdbcType=TINYINT}, #{payment.relationId,jdbcType=BIGINT}, |
99 | + #{payChannelSub,jdbcType=INTEGER}) | ||
95 | </foreach> | 100 | </foreach> |
96 | </insert> | 101 | </insert> |
97 | <update id="updatepayment" parameterType="com.diligrp.etrade.order.model.OrderPayment"> | 102 | <update id="updatepayment" parameterType="com.diligrp.etrade.order.model.OrderPayment"> |
scripts/etrade-order/etrade_order.sql
@@ -213,6 +213,7 @@ CREATE TABLE `order_payment` ( | @@ -213,6 +213,7 @@ CREATE TABLE `order_payment` ( | ||
213 | `seller_fee_state` tinyint DEFAULT NULL COMMENT '卖方手续费缴费状态', | 213 | `seller_fee_state` tinyint DEFAULT NULL COMMENT '卖方手续费缴费状态', |
214 | `order_status` tinyint DEFAULT NULL COMMENT '单据类型', | 214 | `order_status` tinyint DEFAULT NULL COMMENT '单据类型', |
215 | `relation_id` bigint DEFAULT NULL COMMENT '关联id', | 215 | `relation_id` bigint DEFAULT NULL COMMENT '关联id', |
216 | + `pay_channel_sub` tinyint DEFAULT NULL COMMENT '园区卡支付子分类', | ||
216 | PRIMARY KEY (`id`) USING BTREE, | 217 | PRIMARY KEY (`id`) USING BTREE, |
217 | KEY `orderId` (`order_id`,`market_id`) USING BTREE, | 218 | KEY `orderId` (`order_id`,`market_id`) USING BTREE, |
218 | KEY `shop` (`payee_shop_id`,`pay_channel`) USING BTREE, | 219 | KEY `shop` (`payee_shop_id`,`pay_channel`) USING BTREE, |
scripts/zr-upgrade/v1.1.2/etrade_order_v1.1.2_fengliang.sql
0 → 100644
1 | +ALTER TABLE `zr_etrade`.`order_payment` | ||
2 | + ADD COLUMN `pay_channel_sub` tinyint NULL COMMENT '园区卡支付子分类'; | ||
3 | + | ||
4 | +UPDATE zr_etrade.`order_payment` payment LEFT JOIN zr_etrade.`order` ord ON payment.order_id = ord.id | ||
5 | +SET payment.pay_channel_sub = 1 | ||
6 | +WHERE ord.order_type = 2 | ||
0 | \ No newline at end of file | 7 | \ No newline at end of file |