Authored by chenchao

Merge branch 'master' into hotfix_防止恶意刷单

@@ -94,7 +94,7 @@ public class ChargeService { @@ -94,7 +94,7 @@ public class ChargeService {
94 //如果是门店自提,则免运费 94 //如果是门店自提,则免运费
95 if (shoppingSupport.isDeliveryWayByStore(chargeContext.getChargeParam().getDeliveryWay())){ 95 if (shoppingSupport.isDeliveryWayByStore(chargeContext.getChargeParam().getDeliveryWay())){
96 deliveryWayCost = 0D; 96 deliveryWayCost = 0D;
97 - }else if(chargeContext.getUserAddressPair() != null){ 97 + }else/* if(chargeContext.getUserAddressPair() != null){
98 String areaCode = chargeContext.getUserAddressPair().getLeft().getAreaCode(); 98 String areaCode = chargeContext.getUserAddressPair().getLeft().getAreaCode();
99 deliveryWayCost = deliveryWayCostSupport.getCostOfSfByAreaCode(areaCode); 99 deliveryWayCost = deliveryWayCostSupport.getCostOfSfByAreaCode(areaCode);
100 }else{ 100 }else{
@@ -102,6 +102,8 @@ public class ChargeService { @@ -102,6 +102,8 @@ public class ChargeService {
102 if (chargeContext.isShipFeeRequird()){ 102 if (chargeContext.isShipFeeRequird()){
103 deliveryWayCost = deliveryWayCostSupport.getCostOfSf(); 103 deliveryWayCost = deliveryWayCostSupport.getCostOfSf();
104 } 104 }
  105 + }*/{
  106 + deliveryWayCost = deliveryWayCostSupport.getCostOfSf();
105 } 107 }
106 //运费 108 //运费
107 chargeContext.getChargeResult().setDeliveryWay(chargeContext.getChargeParam().getDeliveryWay()); 109 chargeContext.getChargeResult().setDeliveryWay(chargeContext.getChargeParam().getDeliveryWay());
@@ -40,10 +40,12 @@ public class ShoppingController { @@ -40,10 +40,12 @@ public class ShoppingController {
40 */ 40 */
41 @RequestMapping(params = "method=ufo.order.payment") 41 @RequestMapping(params = "method=ufo.order.payment")
42 public ApiResponse payment(@RequestParam(name = "uid") int uid, 42 public ApiResponse payment(@RequestParam(name = "uid") int uid,
43 - @RequestParam(name = "skup") int skup){ 43 + @RequestParam(name = "skup") int skup,
  44 + @RequestParam(value = "app_version", required = false)String appVersion){
44 //AUTO 自动匹配 45 //AUTO 自动匹配
45 ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup) 46 ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup)
46 - .couponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES).build(); 47 + .couponCodes(CouponConstants.AUTO_RECOMMENDED_COUPON_CODES)
  48 + .appVersion(appVersion).build();
47 logger.info("in ufo.order.payment, req {}", req); 49 logger.info("in ufo.order.payment, req {}", req);
48 PaymentResponse paymentResponse = buyerOrderService.payment(req); 50 PaymentResponse paymentResponse = buyerOrderService.payment(req);
49 return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build(); 51 return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("结算成功").build();
@@ -59,7 +61,10 @@ public class ShoppingController { @@ -59,7 +61,10 @@ public class ShoppingController {
59 @RequestParam(name = "skup") int skup, 61 @RequestParam(name = "skup") int skup,
60 @RequestParam(name = "coupon_code",required = false) String couponCode) { 62 @RequestParam(name = "coupon_code",required = false) String couponCode) {
61 63
62 - ShoppingRequest req = ShoppingRequest.builder().uid(uid).skup(skup).couponCodes(CouponCodeUtils.asList(couponCode)).build(); 64 + ShoppingRequest req = ShoppingRequest.builder()
  65 + .uid(uid).skup(skup)
  66 + .couponCodes(CouponCodeUtils.asList(couponCode))
  67 + .build();
63 logger.info("in ufo.order.selectCoupon, req {}", req); 68 logger.info("in ufo.order.selectCoupon, req {}", req);
64 ShoppingCouponListResp resp = buyerOrderService.selectCoupon(req); 69 ShoppingCouponListResp resp = buyerOrderService.selectCoupon(req);
65 return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build(); 70 return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build();
@@ -74,12 +79,14 @@ public class ShoppingController { @@ -74,12 +79,14 @@ public class ShoppingController {
74 public ApiResponse compute(@RequestParam(name = "uid") int uid, 79 public ApiResponse compute(@RequestParam(name = "uid") int uid,
75 @RequestParam(name = "skup") int skup, 80 @RequestParam(name = "skup") int skup,
76 @RequestParam(name = "coupon_code",required = false) String couponCode, 81 @RequestParam(name = "coupon_code",required = false) String couponCode,
77 - @RequestParam(name = "addressId", required = false) String addressId) { 82 + @RequestParam(name = "addressId", required = false) String addressId,
  83 + @RequestParam(value = "app_version", required = false)String appVersion) {
78 84
79 ShoppingRequest req = ShoppingRequest.builder().uid(uid) 85 ShoppingRequest req = ShoppingRequest.builder().uid(uid)
80 .skup(skup) 86 .skup(skup)
81 .couponCodes(CouponCodeUtils.asList(couponCode)) 87 .couponCodes(CouponCodeUtils.asList(couponCode))
82 .addressId(addressId) 88 .addressId(addressId)
  89 + .appVersion(appVersion)
83 .build(); 90 .build();
84 logger.info("in ufo.order.compute, req {}", req); 91 logger.info("in ufo.order.compute, req {}", req);
85 ComputeResponse resp = buyerOrderService.compute(req); 92 ComputeResponse resp = buyerOrderService.compute(req);
@@ -9,8 +9,8 @@ public class PayQueryBo { @@ -9,8 +9,8 @@ public class PayQueryBo {
9 //退款成功状态 9 //退款成功状态
10 private boolean refundStatus = false; 10 private boolean refundStatus = false;
11 11
12 - //订单编号  
13 - private String orderCode; 12 +// //订单编号
  13 +// private String orderCode;
14 //订单金额 14 //订单金额
15 private double amount; 15 private double amount;
16 // 16 //
@@ -46,14 +46,14 @@ public class PayQueryBo { @@ -46,14 +46,14 @@ public class PayQueryBo {
46 } 46 }
47 47
48 48
49 -  
50 - public String getOrderCode() {  
51 - return orderCode;  
52 - }  
53 -  
54 - public void setOrderCode(String orderCode) {  
55 - this.orderCode = orderCode;  
56 - } 49 +//
  50 +// public String getOrderCode() {
  51 +// return orderCode;
  52 +// }
  53 +//
  54 +// public void setOrderCode(String orderCode) {
  55 +// this.orderCode = orderCode;
  56 +// }
57 57
58 public double getAmount() { 58 public double getAmount() {
59 return amount; 59 return amount;
@@ -46,4 +46,9 @@ public class ShoppingRequest { @@ -46,4 +46,9 @@ public class ShoppingRequest {
46 */ 46 */
47 private String inviteCode; 47 private String inviteCode;
48 48
  49 + /**
  50 + *
  51 + */
  52 + private String appVersion;
  53 +
49 } 54 }
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
  4 +import com.alibaba.fastjson.JSONObject;
4 import com.google.common.collect.Lists; 5 import com.google.common.collect.Lists;
5 import com.yoho.core.common.helpers.ImagesHelper; 6 import com.yoho.core.common.helpers.ImagesHelper;
6 import com.yoho.core.rabbitmq.YhProducer; 7 import com.yoho.core.rabbitmq.YhProducer;
@@ -22,6 +23,7 @@ import com.yohoufo.common.utils.UserInfoHiddenHelper; @@ -22,6 +23,7 @@ import com.yohoufo.common.utils.UserInfoHiddenHelper;
22 import com.yohoufo.dal.order.*; 23 import com.yohoufo.dal.order.*;
23 import com.yohoufo.dal.order.model.*; 24 import com.yohoufo.dal.order.model.*;
24 import com.yohoufo.order.common.ExpressForMqSend; 25 import com.yohoufo.order.common.ExpressForMqSend;
  26 +import com.yohoufo.order.constants.MetaKey;
25 import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent; 27 import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
26 import com.yohoufo.order.event.ErpBuyerOrderEvent; 28 import com.yohoufo.order.event.ErpBuyerOrderEvent;
27 import com.yohoufo.order.model.response.AppraiseAddressResp; 29 import com.yohoufo.order.model.response.AppraiseAddressResp;
@@ -979,6 +981,40 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -979,6 +981,40 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
979 return buyerOrderList.get(0); 981 return buyerOrderList.get(0);
980 } 982 }
981 983
  984 + private AddressInfo findBuyerAddressInfo(Integer uid, Long orderCode, Integer skup){
  985 + boolean skupIsNull = (null == skup);
  986 + boolean orderCodeIsNull = (null == orderCode);
  987 +
  988 +
  989 + BuyerOrder buyerOrder = null;
  990 + if (orderCodeIsNull){
  991 + //4 compatible before version 6.9.3(exclude), client transfer without order code
  992 + buyerOrder = findOrderCodeBySkup(skup);
  993 + orderCode = buyerOrder.getOrderCode();
  994 + LOGGER.info("in queryAppraiseAddress find buyer OrderCode By Skup , orderCode {} skup {}", orderCode, skup);
  995 + }
  996 + buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
  997 + AddressInfo buyerAddress = buyerOrderMetaService.getAddressInfo(buyerOrder.getUid(), orderCode);
  998 + LOGGER.info("in queryAppraiseAddress get buyerAddress {} orderCode {}, skup {}", buyerAddress, orderCode, skup);
  999 + return buyerAddress;
  1000 + }
  1001 +
  1002 + private AddressInfo findSellerAddressInfo(Integer uid, Integer skup){
  1003 + SellerOrderMeta addressMeta = sellerOrderMetaMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
  1004 + AddressInfo addressInfo = null;
  1005 + if (null != addressMeta) {
  1006 + LOGGER.info("addressMeta is not null uid is {}, skup is {}", uid, skup);
  1007 + try {
  1008 + addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class);
  1009 +
  1010 + }catch (Exception ex){
  1011 + LOGGER.warn("findSellerAddressInfo parse addressMeta fail, uid {} skup {}, addressMeta {}",
  1012 + uid, skup, addressMeta, ex);
  1013 + }
  1014 + }
  1015 + return addressInfo;
  1016 + }
  1017 +
982 /** 1018 /**
983 * 根据用户默认地址的省份定位到鉴定中心的地址返回 * 1019 * 根据用户默认地址的省份定位到鉴定中心的地址返回 *
984 * 1020 *
@@ -996,16 +1032,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -996,16 +1032,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
996 return appraiseAddressService.queryInitAddress(); 1032 return appraiseAddressService.queryInitAddress();
997 } 1033 }
998 1034
999 - BuyerOrder buyerOrder = null;  
1000 - if (orderCodeIsNull){  
1001 - //4 compatible before version 6.9.3(exclude), client transfer without order code  
1002 - buyerOrder = findOrderCodeBySkup(skup);  
1003 - orderCode = buyerOrder.getOrderCode();  
1004 - LOGGER.info("in queryAppraiseAddress find buyer OrderCode By Skup , orderCode {} skup {}", orderCode, skup);  
1005 - }  
1006 - buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);  
1007 - AddressInfo buyerAddress = buyerOrderMetaService.getAddressInfo(buyerOrder.getUid(), orderCode);  
1008 - LOGGER.info("in queryAppraiseAddress get buyerAddress {} orderCode {}, skup {}", buyerAddress, orderCode, skup); 1035 +
  1036 + AddressInfo buyerAddress = findSellerAddressInfo(uid, skup);
  1037 +
  1038 + LOGGER.info("in queryAppraiseAddress get Address {} orderCode {}, skup {}", buyerAddress, orderCode, skup);
1009 1039
1010 // 根据用户id查询默认地址的省份 1040 // 根据用户id查询默认地址的省份
1011 AppraiseAddressResp resp = null; 1041 AppraiseAddressResp resp = null;
@@ -19,6 +19,7 @@ import com.yohoufo.common.utils.TimeUtils; @@ -19,6 +19,7 @@ import com.yohoufo.common.utils.TimeUtils;
19 import com.yohoufo.dal.order.*; 19 import com.yohoufo.dal.order.*;
20 import com.yohoufo.dal.order.model.*; 20 import com.yohoufo.dal.order.model.*;
21 import com.yohobuy.ufo.model.order.common.Payment; 21 import com.yohobuy.ufo.model.order.common.Payment;
  22 +import com.yohoufo.order.common.HbfqEnum;
22 import com.yohoufo.order.common.TransferCase; 23 import com.yohoufo.order.common.TransferCase;
23 import com.yohoufo.order.constants.RefundContant; 24 import com.yohoufo.order.constants.RefundContant;
24 import com.yohoufo.order.model.PayQueryBo; 25 import com.yohoufo.order.model.PayQueryBo;
@@ -237,11 +238,17 @@ public class PaymentServiceImpl implements IPaymentService { @@ -237,11 +238,17 @@ public class PaymentServiceImpl implements IPaymentService {
237 238
238 AbstractPayService payService = getPayService(request.getPayment()); 239 AbstractPayService payService = getPayService(request.getPayment());
239 240
  241 + long orderCode = orderInfo.getOrderCode();
240 String tradeNo = String.valueOf(orderInfo.getOrderCode()); 242 String tradeNo = String.valueOf(orderInfo.getOrderCode());
241 243
242 // 花呗分期的场合 用于退款的 out_trade_no = 支付时传给第三方的 out_trade_no = order_code + 花呗分期期数 244 // 花呗分期的场合 用于退款的 out_trade_no = 支付时传给第三方的 out_trade_no = order_code + 花呗分期期数
243 if (payment == Payment.ALIPAY_HBFQ){ 245 if (payment == Payment.ALIPAY_HBFQ){
244 - tradeNo = tradeNo + request.getHbfqNums(); 246 + HbfqEnum hbfqEnum = HbfqEnum.getByfqTerms(request.getHbfqNums());
  247 + if(hbfqEnum == null) {
  248 + logger.warn("fqNums from req invalid, fqNums: {}, orderCode: {}", request.getHbfqNums(), tradeNo);
  249 + throw new ServiceException(ServiceError.ORDER_FQNUM_INVALID);
  250 + }
  251 + tradeNo = tradeNo + hbfqEnum.getTradeNoPostfix();
245 } 252 }
246 253
247 PayQueryBo payQueryBo = payService.payQuery(tradeNo); 254 PayQueryBo payQueryBo = payService.payQuery(tradeNo);
@@ -251,7 +258,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -251,7 +258,7 @@ public class PaymentServiceImpl implements IPaymentService {
251 return PaymentConfirmRsp.builder().orderCode(orderInfo.getOrderCode()).isPaid(OrderConstant.N_STR).build(); 258 return PaymentConfirmRsp.builder().orderCode(orderInfo.getOrderCode()).isPaid(OrderConstant.N_STR).build();
252 } 259 }
253 260
254 - PaymentData paymentData = convertQueryPaymentData(payQueryBo); 261 + PaymentData paymentData = convertQueryPaymentData(payQueryBo, orderCode);
255 262
256 paySuccess(paymentData); 263 paySuccess(paymentData);
257 264
@@ -432,10 +439,10 @@ public class PaymentServiceImpl implements IPaymentService { @@ -432,10 +439,10 @@ public class PaymentServiceImpl implements IPaymentService {
432 } 439 }
433 440
434 441
435 - private PaymentData convertQueryPaymentData(PayQueryBo payQueryBo) { 442 + private PaymentData convertQueryPaymentData(PayQueryBo payQueryBo, long orderCode) {
436 PaymentData paymentData = new PaymentData(); 443 PaymentData paymentData = new PaymentData();
437 - paymentData.setOrderCode(String.valueOf(payQueryBo.getOrderCode()));  
438 - paymentData.setOutTradeNo(payQueryBo.getOrderCode()); 444 + paymentData.setOrderCode(String.valueOf(orderCode));
  445 + paymentData.setOutTradeNo(payQueryBo.getPayOrderCode());
439 paymentData.setTotalFee(payQueryBo.getAmount()); 446 paymentData.setTotalFee(payQueryBo.getAmount());
440 paymentData.setBankCode(payQueryBo.getBankCode()); 447 paymentData.setBankCode(payQueryBo.getBankCode());
441 paymentData.setBankName(payQueryBo.getBankName()); 448 paymentData.setBankName(payQueryBo.getBankName());
@@ -152,11 +152,12 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -152,11 +152,12 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
152 fromCache = false; 152 fromCache = false;
153 BuildNode buildNode = super.prepareBuild(orderRequest); 153 BuildNode buildNode = super.prepareBuild(orderRequest);
154 orderDetailInfo = super.buildOrderDetail(buildNode); 154 orderDetailInfo = super.buildOrderDetail(buildNode);
155 - BuyerOrder buyerOrder = buildNode.buyerOrder;  
156 SellerOrderGoods sellerOrderGoods = buildNode.sellerOrderGoods; 155 SellerOrderGoods sellerOrderGoods = buildNode.sellerOrderGoods;
157 - AddressInfo buyerAddress = buyerOrderMetaService.getHiddenAddressInfo(buyerOrder.getUid(), orderCode); 156 + // 收货地址 and 用户信息
  157 + if(Objects.nonNull(buildNode.userAddress)){
158 //卖家订单详情里才会有,买家没有 158 //卖家订单详情里才会有,买家没有
159 - orderDetailInfo.setAppraiseAddress(appraiseAddressService.findAppraiseAddress(sellerOrderGoods.getDepotNo(), buyerAddress.getAreaCode())); 159 + orderDetailInfo.setAppraiseAddress(appraiseAddressService.findAppraiseAddress(sellerOrderGoods.getDepotNo(), buildNode.userAddress.getAreaCode()));
  160 + }
160 //cache 161 //cache
161 orderCacheService.cacheOrderDetailInfo(uid, orderCode, TabType.SELL, orderDetailInfo); 162 orderCacheService.cacheOrderDetailInfo(uid, orderCode, TabType.SELL, orderDetailInfo);
162 } 163 }
@@ -134,7 +134,7 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -134,7 +134,7 @@ public class ShoppingServiceImpl implements IShoppingService {
134 134
135 PaymentResponse response = new PaymentResponse(); 135 PaymentResponse response = new PaymentResponse();
136 response.setPaymentWay(shoppingSupport.getPaymentWay()); 136 response.setPaymentWay(shoppingSupport.getPaymentWay());
137 - response.setDeliveryWay(shoppingSupport.getDeliverWay(chargeResult)); 137 + response.setDeliveryWay(shoppingSupport.getDeliverWay(chargeResult, request.getAppVersion()));
138 response.setGood(shoppingSupport.getGoodsInfo(skupGood)); 138 response.setGood(shoppingSupport.getGoodsInfo(skupGood));
139 response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult)); 139 response.setPromotionFormulaList(shoppingSupport.getPromotionFormula(chargeResult));
140 response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount())); 140 response.setAmount(MathUtils.formatStr(chargeResult.getFinalAmount()));
@@ -237,10 +237,10 @@ public class ShoppingServiceImpl implements IShoppingService { @@ -237,10 +237,10 @@ public class ShoppingServiceImpl implements IShoppingService {
237 checkSkupIsChangePrice(uid, skup); 237 checkSkupIsChangePrice(uid, skup);
238 //构建算费 238 //构建算费
239 ChargeContext chargeContext = buildChargeContext(request, skupGood); 239 ChargeContext chargeContext = buildChargeContext(request, skupGood);
240 - if (StringUtils.isNoneBlank(request.getAddressId())){ 240 + /*if (StringUtils.isNoneBlank(request.getAddressId())){
241 Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request); 241 Pair<AddressInfo, AddressInfo> addressInfoPair = getAndCheckAddressInfo(request);
242 chargeContext.setUserAddressPair(addressInfoPair); 242 chargeContext.setUserAddressPair(addressInfoPair);
243 - } 243 + }*/
244 //算费 244 //算费
245 chargeService.charge(chargeContext); 245 chargeService.charge(chargeContext);
246 //算费结果 246 //算费结果
@@ -111,7 +111,8 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -111,7 +111,8 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
111 PayQueryBo payQueryBo = new PayQueryBo(); 111 PayQueryBo payQueryBo = new PayQueryBo();
112 112
113 if ("10000".equals(queryBo.getCode())){ 113 if ("10000".equals(queryBo.getCode())){
114 - payQueryBo.setOrderCode(queryBo.getOut_trade_no()); 114 + // 订单支付时的商户号
  115 + payQueryBo.setPayOrderCode(queryBo.getOut_trade_no());
115 payQueryBo.setTradeNo(queryBo.getTrade_no()); 116 payQueryBo.setTradeNo(queryBo.getTrade_no());
116 117
117 if ("TRADE_SUCCESS".equals(queryBo.getTrade_status())) { 118 if ("TRADE_SUCCESS".equals(queryBo.getTrade_status())) {
@@ -266,36 +267,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -266,36 +267,6 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
266 } 267 }
267 268
268 269
269 - private PayQueryBo queryOpenApiConvert(String orderCode, String respText) {  
270 - PayQueryBo queryBo = new PayQueryBo();  
271 - if(StringUtils.isEmpty(respText)) {  
272 - return queryBo;  
273 - }  
274 -  
275 - JSONObject respJson = JSON.parseObject(respText);  
276 - JSONObject tradeJson = respJson.getJSONObject("alipay_trade_query_response");  
277 - if(tradeJson == null) {  
278 - logger.error("[{}] trade query failed", orderCode);  
279 - return queryBo;  
280 - }  
281 -  
282 - if(!AlipayConfig.OPENAPI_BIZ_SUCCESS.equals(tradeJson.getString("code"))) {  
283 - logger.error("[{}] trade query failed: {}", orderCode, tradeJson.getString("sub_code"));  
284 - return queryBo;  
285 - }  
286 -  
287 - if("TRADE_SUCCESS".equals(tradeJson.getString("trade_status"))) {  
288 - queryBo.setPayStatus(true);  
289 - queryBo.setOrderCode(tradeJson.getString("out_trade_no"));  
290 - queryBo.setAmount(tradeJson.getDoubleValue("total_amount"));  
291 - queryBo.setPayOrderCode(tradeJson.getString("out_trade_no"));  
292 - queryBo.setTradeNo(tradeJson.getString("trade_no"));  
293 - queryBo.setPaymentTime(tradeJson.getString("send_pay_date"));  
294 - queryBo.setCallbackTime(tradeJson.getString("send_pay_date"));  
295 - }  
296 -  
297 - return queryBo;  
298 - }  
299 270
300 271
301 /** 272 /**
@@ -452,6 +423,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -452,6 +423,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
452 423
453 // 记录分期 424 // 记录分期
454 recordOrdersPayHbfq(outTradeNo, tradeNo, uid); 425 recordOrdersPayHbfq(outTradeNo, tradeNo, uid);
  426 + tradeNo = outTradeNo;
455 } 427 }
456 428
457 429
@@ -120,7 +120,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService { @@ -120,7 +120,7 @@ public abstract class AbstractWeixinPayService extends AbstractPayService {
120 if (index >= 0) { 120 if (index >= 0) {
121 out_trade_no = out_trade_no.substring(index + WeixinPayConfig.WECHAT_TRADE_NO_PREFIX.length()); 121 out_trade_no = out_trade_no.substring(index + WeixinPayConfig.WECHAT_TRADE_NO_PREFIX.length());
122 } 122 }
123 - queryBo.setOrderCode(out_trade_no); 123 +// queryBo.setOrderCode(out_trade_no);
124 queryBo.setPayOrderCode(out_trade_no); 124 queryBo.setPayOrderCode(out_trade_no);
125 double total_fee = Double.valueOf(queryMap.get("total_fee")); 125 double total_fee = Double.valueOf(queryMap.get("total_fee"));
126 queryBo.setAmount(YHMath.mul(total_fee, 0.01)); 126 queryBo.setAmount(YHMath.mul(total_fee, 0.01));
@@ -15,6 +15,7 @@ import com.yohoufo.order.model.response.PromotionFormula; @@ -15,6 +15,7 @@ import com.yohoufo.order.model.response.PromotionFormula;
15 import com.yohoufo.order.model.response.RecommendedCouponInfo; 15 import com.yohoufo.order.model.response.RecommendedCouponInfo;
16 import com.yohoufo.order.utils.MathUtils; 16 import com.yohoufo.order.utils.MathUtils;
17 import com.yohoufo.order.utils.SellerGoodsHelper; 17 import com.yohoufo.order.utils.SellerGoodsHelper;
  18 +import org.apache.commons.lang3.StringUtils;
18 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
19 20
20 import java.math.BigDecimal; 21 import java.math.BigDecimal;
@@ -40,16 +41,32 @@ public class ShoppingSupport { @@ -40,16 +41,32 @@ public class ShoppingSupport {
40 * 配送方式 41 * 配送方式
41 * @return 42 * @return
42 */ 43 */
43 - public PaymentResponse.DeliveryWay getDeliverWay(final ChargeResult chargeResult) { 44 + public PaymentResponse.DeliveryWay getDeliverWay(final ChargeResult chargeResult, String appVersion) {
44 // 快递方式 45 // 快递方式
45 PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay(); 46 PaymentResponse.DeliveryWay deliveryWay = new PaymentResponse.DeliveryWay();
46 deliveryWay.setDeliveryWayId(chargeResult.getDeliveryWay()); 47 deliveryWay.setDeliveryWayId(chargeResult.getDeliveryWay());
47 - deliveryWay.setDeliveryWayCost(OrderConstant.MONEY_SIGN + chargeResult.getShippingAmount()); 48 +
  49 + deliveryWay.setDeliveryWayCost(MathUtils.formatCurrencyStr(chargeResult.getShippingAmount()));
48 deliveryWay.setDeliveryWayName(getDeliveryWayStr(chargeResult.getDeliveryWay())); 50 deliveryWay.setDeliveryWayName(getDeliveryWayStr(chargeResult.getDeliveryWay()));
49 return deliveryWay; 51 return deliveryWay;
50 } 52 }
51 53
52 54
  55 + String buildDeliveryWayCost(String appVersion, double shippingAmount){
  56 + if (isLowerVersion(appVersion, "6.9.3")){
  57 + return "以实际提交订单金额为准";
  58 + }else{
  59 + String currencyAmount = MathUtils.formatCurrencyStr( shippingAmount );
  60 +
  61 + return currencyAmount;
  62 + }
  63 + }
  64 +
  65 + boolean isLowerVersion(String appVersion, String comparedVersion){
  66 + return StringUtils.isNotBlank(appVersion) && appVersion.compareTo(comparedVersion) < 0;
  67 + }
  68 +
  69 +
53 private String getDeliveryWayStr(int deliveryWay) { 70 private String getDeliveryWayStr(int deliveryWay) {
54 return deliveryWay == OrderConstant.DELIVERY_WAY_STORE ? OrderConstant.DELIVERY_WAY_STORE_NAME : OrderConstant.DELIVERY_WAY_SF_NAME; 71 return deliveryWay == OrderConstant.DELIVERY_WAY_STORE ? OrderConstant.DELIVERY_WAY_STORE_NAME : OrderConstant.DELIVERY_WAY_SF_NAME;
55 } 72 }
@@ -97,7 +114,9 @@ public class ShoppingSupport { @@ -97,7 +114,9 @@ public class ShoppingSupport {
97 //运费 114 //运费
98 PromotionFormula expressFormula = new PromotionFormula(); 115 PromotionFormula expressFormula = new PromotionFormula();
99 expressFormula.setPromotion(OrderConstant.DELIVERY_DESC); 116 expressFormula.setPromotion(OrderConstant.DELIVERY_DESC);
100 - expressFormula.setPromotionAmount(OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(chargeResult.getShippingAmount())); 117 + String shipFee = OrderConstant.PLUS_SIGN + MathUtils.formatCurrencyStr(chargeResult.getShippingAmount());
  118 +
  119 + expressFormula.setPromotionAmount(shipFee);
101 120
102 formulas.add(expressFormula); 121 formulas.add(expressFormula);
103 122
1 package com.yohoufo.order.service.code; 1 package com.yohoufo.order.service.code;
2 2
3 import com.yohobuy.ufo.model.order.common.OrderCodeType; 3 import com.yohobuy.ufo.model.order.common.OrderCodeType;
  4 +import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
4 import com.yohoufo.order.service.support.codegenerator.impl.OrderCodeGeneratorImpl; 5 import com.yohoufo.order.service.support.codegenerator.impl.OrderCodeGeneratorImpl;
5 6
6 public class CodeTest { 7 public class CodeTest {
@@ -8,12 +9,15 @@ public class CodeTest { @@ -8,12 +9,15 @@ public class CodeTest {
8 9
9 public static void main(String[] args){ 10 public static void main(String[] args){
10 com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator orderCodeGenerator = new OrderCodeGeneratorImpl(); 11 com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator orderCodeGenerator = new OrderCodeGeneratorImpl();
  12 +//
  13 +// for (int i =0; i <10 ; i++){
  14 +// long result = orderCodeGenerator.generate(OrderCodeType.BUYER_TYPE);
  15 +// System.out.print(result);
  16 +// System.out.println(" 反解结果: "+ orderCodeGenerator.expId(result));
  17 +// }
11 18
12 - for (int i =0; i <10 ; i++){  
13 - long result = orderCodeGenerator.generate(OrderCodeType.BUYER_TYPE);  
14 - System.out.print(result);  
15 - System.out.println(" 反解结果: "+ orderCodeGenerator.expId(result));  
16 - } 19 + CodeMeta meta = orderCodeGenerator.expId(9926176890695l);
  20 + System.out.println(meta);
17 21
18 // System.out.println(1<<3); 22 // System.out.println(1<<3);
19 23