Commit f59603c3 by zhiheng.zhang

Merge remote-tracking branch 'origin/master'

parents 35152a4b f36736f2
package cn.freemud.entities.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayRequestDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public class SvcComPayRequestDto {
private String partnerId;
private String storeId;
}
package cn.freemud.entities.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayResoonseDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public class SvcComPayResponseDto {
private String code;
private String message;
private Result result;
@Data
@NoArgsConstructor
static public class Result {
private Boolean value;
}
}
...@@ -266,6 +266,8 @@ public class OrderServiceImpl implements Orderservice { ...@@ -266,6 +266,8 @@ public class OrderServiceImpl implements Orderservice {
@Autowired @Autowired
private AssortmentOpenPlatformIappWxappStoreManager assortmentOpenPlatformIappWxappStoreManager; private AssortmentOpenPlatformIappWxappStoreManager assortmentOpenPlatformIappWxappStoreManager;
@Autowired
private SvcComPayClient svcComPayClient;
@Override @Override
public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) { public BaseResponse checkBeforeCreateOrder(CheckBeforeCreateOrderRequestVo requestVo) {
String trackingNo = LogTreadLocal.getTrackingNo(); String trackingNo = LogTreadLocal.getTrackingNo();
...@@ -2321,11 +2323,10 @@ public class OrderServiceImpl implements Orderservice { ...@@ -2321,11 +2323,10 @@ public class OrderServiceImpl implements Orderservice {
, String storeId , String storeId
, String trackingNo) { , String trackingNo) {
boolean tigger = false;
OrderPayResponse orderPayResponse = new OrderPayResponse(); OrderPayResponse orderPayResponse = new OrderPayResponse();
tigger = true; boolean check = this.checkSvcComPay(orderBean.getCompanyId(), orderBean.getShopId());
//混合支付 //混合支付
if (tigger && StringUtils.isNotBlank(channel)) { if (check && StringUtils.isNotBlank(channel)) {
log.info("混合支付:"); log.info("混合支付:");
String partnerPayOvertime = this.getPartnerPayOvertime(orderBean.getCompanyId()); String partnerPayOvertime = this.getPartnerPayOvertime(orderBean.getCompanyId());
orderPayResponse = comPayOrder(cardCode,orderBean,paymentRequest,partnerPayOvertime,totalAmount.intValue(),channel,storeId,LogThreadLocal.getTrackingNo()); orderPayResponse = comPayOrder(cardCode,orderBean,paymentRequest,partnerPayOvertime,totalAmount.intValue(),channel,storeId,LogThreadLocal.getTrackingNo());
...@@ -3218,7 +3219,7 @@ public class OrderServiceImpl implements Orderservice { ...@@ -3218,7 +3219,7 @@ public class OrderServiceImpl implements Orderservice {
if (combPayResponse==null || !ResponseCodeConstant.PAYMENT_RESPONSE_SUCCESS.equals(combPayResponse.getCode())) { if (combPayResponse==null || !ResponseCodeConstant.PAYMENT_RESPONSE_SUCCESS.equals(combPayResponse.getCode())) {
log.info("混合支付返回信息错误,trackingNo:{} request:{} response:{}",trackingNo, JSONObject.toJSONString(combPayRequest), JSONObject.toJSONString(combPayResponse)); log.info("混合支付返回信息错误,trackingNo:{} request:{} response:{}",trackingNo, JSONObject.toJSONString(combPayRequest), JSONObject.toJSONString(combPayResponse));
orderPayResponse.setMsg(combPayResponse.getMsg()); orderPayResponse.setMsg(combPayResponse!=null ? "支付:"+combPayResponse.getMsg() :"混合支付忙不过来啦,请稍后再试");
return orderPayResponse; return orderPayResponse;
} }
Integer svcAmount = 0; Integer svcAmount = 0;
...@@ -3339,4 +3340,29 @@ public class OrderServiceImpl implements Orderservice { ...@@ -3339,4 +3340,29 @@ public class OrderServiceImpl implements Orderservice {
// // TODO: 2019/9/10 hubowen mq推送变更 // // TODO: 2019/9/10 hubowen mq推送变更
// backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus()); // backOrdersStatusChange(orderBean.getOid(), orderBean.getStatus());
//} //}
/**
* 获取混合支付是否开启
* @param partnerId
* @return
*/
private boolean checkSvcComPay(String partnerId,String storeId) {
SvcComPayRequestDto requestDto = new SvcComPayRequestDto();
requestDto.setPartnerId(partnerId);
requestDto.setStoreId(storeId);
SvcComPayResponseDto query = null;
for (int i=0;i<3;i++) {
query = svcComPayClient.query(requestDto);
if (query!=null) break;
}
log.info("order checkSvcComPay:{}",JSON.toJSONString(query));
if (query==null || !ResponseResult.SUCCESS.getCode().equals(query.getCode())) {
return false;
}
if (query.getResult()!=null && query.getResult().getValue()) {
return true;
}
else {
return false;
}
}
} }
package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.SvcComPayRequestDto;
import cn.freemud.entities.dto.SvcComPayResponseDto;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.service.thirdparty SvcClient
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@FeignClient(name="payment-center-management", url = "${saas.svc.switch.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface SvcComPayClient {
@PostMapping("/paymentmanager/partnerSetting/queryAssociationPaymentFlagPartnerSetting")
SvcComPayResponseDto query(SvcComPayRequestDto svcComPayRequestDto);
}
package cn.freemud.entities.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayRequestDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public class SvcComPayRequestDto {
private String partnerId;
private String storeId;
}
package cn.freemud.entities.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.entities.dto SvcComPayResoonseDto
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@Data
@NoArgsConstructor
public class SvcComPayResponseDto {
private String code;
private String message;
private Result result;
@Data
@NoArgsConstructor
static public class Result {
private Boolean value;
}
}
...@@ -151,6 +151,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -151,6 +151,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
private ActivityService activityService; private ActivityService activityService;
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@Autowired
private SvcComPayClient svcComPayClient;
private static final String limitCartKey = "ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_"; private static final String limitCartKey = "ecology:kgd:wxappconfig:open_platform_partner_wxapp_config:appkey_";
...@@ -1643,6 +1645,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1643,6 +1645,8 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) { if (response.getData() == null || response.getData().getData() == null || response.getData().getData().getCardSimpleInfos().size() > 1) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR); throw new ServiceException(ResponseResult.USER_SVC_CARD_ERROR);
} }
boolean check = this.checkSvcComPay(partnerId, storeId);
if (check) {
//混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付 //混合支付无需校验svc卡余额,但是配送和包装费不计算在svc卡支付
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount(); Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount(); Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
...@@ -1668,6 +1672,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -1668,6 +1672,23 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
shoppingCartGoodsResponseVo.setSvcPayAmount(amountStr); shoppingCartGoodsResponseVo.setSvcPayAmount(amountStr);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr); shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
} }
else {
//获取实际配送费
if (StringUtils.isNotBlank(receiveId) && shoppingCartGoodsResponseVo.getDiscountDeliveryAmount() != null) {
Integer deliveryAmount = shoppingCartGoodsResponseVo.getDiscountDeliveryAmount().intValue();
orderAmount += deliveryAmount;
}
Integer amount1 = response.getData().getData().getCardSimpleInfos().get(0).getAmount();
Integer vamount = response.getData().getData().getCardSimpleInfos().get(0).getVamount();
if (orderAmount > amount1 + vamount) {
throw new ServiceException(ResponseResult.USER_SVC_CARD_AMOUNT_DEFICIENCY);
}
BigDecimal bigDecimal = new BigDecimal(orderAmount);
String amountStr = bigDecimal.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString();
shoppingCartGoodsResponseVo.setTotalAmount(0L);
shoppingCartGoodsResponseVo.setSvcDiscountDesc("储值卡支付¥" + amountStr);
}
}
/** /**
* 储值卡支付查询配送费 * 储值卡支付查询配送费
...@@ -2049,4 +2070,28 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService { ...@@ -2049,4 +2070,28 @@ public class ShoppingCartNewServiceImpl implements ShoppingCartNewService {
} }
/**
* 获取混合支付是否开启
* @param partnerId
* @return
*/
private boolean checkSvcComPay(String partnerId,String storeId) {
SvcComPayRequestDto requestDto = new SvcComPayRequestDto();
requestDto.setPartnerId(partnerId);
requestDto.setStoreId(storeId);
SvcComPayResponseDto query = null;
for (int i=0;i<3;i++) {
query = svcComPayClient.query(requestDto);
if (query!=null) break;
}
if (query==null || !ResponseResult.SUCCESS.getCode().equals(query.getCode())) {
return false;
}
if (query.getResult()!=null && query.getResult().getValue()) {
return true;
}
else {
return false;
}
}
} }
package cn.freemud.service.thirdparty;
import cn.freemud.entities.dto.SvcComPayRequestDto;
import cn.freemud.entities.dto.SvcComPayResponseDto;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* All rights Reserved, Designed By www.freemud.cn
*
* @Title: cn.freemud.service.thirdparty SvcClient
* @Description: TDO 描述....
* @author: 铁牌灵魂工程师
* @date: 2020/11/27
* @Copyright: www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/
@FeignClient(name="payment-center-management", url = "${saas.svc.switch.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface SvcComPayClient {
@PostMapping("/paymentmanager/partnerSetting/queryAssociationPaymentFlagPartnerSetting")
SvcComPayResponseDto query(SvcComPayRequestDto svcComPayRequestDto);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment