Commit af45ef70 by ping.wu

Merge branches 'feature/20210916_积分商城扣积分流程调整_wuping' and 'qa' of…

Merge branches 'feature/20210916_积分商城扣积分流程调整_wuping' and 'qa' of http://gitlab.freemud.com/order-group-application/order-group into qa
parents 9f215686 586d0b15
......@@ -39,6 +39,7 @@ import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformIapp
import com.freemud.api.assortment.datamanager.manager.AssortmentOpenPlatformPartnerConfigManager;
import com.freemud.api.assortment.datamanager.manager.customer.AssortmentCustomerInfoManager;
import com.freemud.application.sdk.api.log.LogThreadLocal;
import com.freemud.application.sdk.api.membercenter.request.ReturnScoreRequest;
import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1;
import com.freemud.application.sdk.api.ordercenter.entities.v1.ProductBeanV1;
import com.freemud.application.sdk.api.ordercenter.enums.OrderClientType;
......@@ -224,6 +225,15 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS, pointMallListProductInfoResponse.getStatusCode())) {
return ResponseUtil.error(pointMallListProductInfoResponse.getStatusCode().toString(), "扣减库存失败");
}
//扣减积分 (失败:失败冲正活动库存)
if (points != null && points > 0) {
UseScoreRequest userScoreRequest = pointsMallOrderAdapter.convent2UseScoreRequest(partnerId, memberId, appId, orderCode, points);
CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, baseResponse.getCode())) {
createOrderFail(true, false, partnerId, memberId, orderCode, skuId, points, appId);
return ResponseUtil.error(baseResponse.getCode(), "扣减积分失败");
}
}
//全积分支付商品,订单完成
if (ExchangeTypeEnum.TYPE_1.getCode().equals(exchangeType)) {
BaseResponse response1 = orderPaySuccess(createOrderResponseDto.getResult(), points, false);
......@@ -469,20 +479,12 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
}
//确认订单或支付成功失败,冲正活动库存与积分
if (orderFail) {
UseScoreRequest userScoreRequest = new UseScoreRequest();
ReturnScoreRequest userScoreRequest = new ReturnScoreRequest();
userScoreRequest.setMemberId(memberId);
userScoreRequest.setPartnerId(partnerId);
userScoreRequest.setChangeScore(points);
userScoreRequest.setOperationType(12);
userScoreRequest.setOperationName("积分兑换");
userScoreRequest.setChangeType(1);
userScoreRequest.setOperationType(1);
userScoreRequest.setOrderId(orderCode);
userScoreRequest.setOrgCode("");
userScoreRequest.setOrgType(1);
userScoreRequest.setIdempotencyBussinessId(LogThreadLocal.getTrackingNo());
userScoreRequest.setIdempotencyBussinessType("5");
userScoreRequest.setAppId(appId);
CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
CustomerPropertyBaseResponse baseResponse = customerPropertyClient.returnScore(userScoreRequest);
}
} catch (Exception e) {
AppLogUtil.errorLog("createOrderFail_error", null, null, e);
......@@ -537,15 +539,15 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
boolean isCoupon = orderInfo.getOrderItemList().get(0).getProductType() == 1;
String appId = orderInfo.getAppId();
//扣减积分 (失败:失败冲正活动库存)
if (!isCash && points != null && points > 0) {
UseScoreRequest userScoreRequest = pointsMallOrderAdapter.convent2UseScoreRequest(partnerId, memberId, appId, orderCode, points);
CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, baseResponse.getCode())) {
createOrderFail(true, false, partnerId, memberId, orderCode, skuId, points, appId);
return ResponseUtil.error(baseResponse.getCode(), "扣减积分失败");
}
}
// //扣减积分 (失败:失败冲正活动库存)
// if (!isCash && points != null && points > 0) {
// UseScoreRequest userScoreRequest = pointsMallOrderAdapter.convent2UseScoreRequest(partnerId, memberId, appId, orderCode, points);
// CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
// if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, baseResponse.getCode())) {
// createOrderFail(true, false, partnerId, memberId, orderCode, skuId, points, appId);
// return ResponseUtil.error(baseResponse.getCode(), "扣减积分失败");
// }
// }
//订单完成 (失败:失败冲正活动库存)
OrderBaseResp updateOrderStateResp = null;
......@@ -569,19 +571,19 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
createOrderFail(false, true, partnerId, memberId, orderCode, skuId, points, appId);
return ResponseUtil.error(updateOrderStateResp.getCode(), "更新订单异常");
}
//有现金支付,扣减积分
if (isCash && CollectionUtils.isNotEmpty(orderInfo.getOrderPayItemCreateReqList())) {
List<OrderPayItemResp> collect = orderInfo.getOrderPayItemCreateReqList().stream().filter(orderPayItemResp ->
orderPayItemResp.getPayChannelType().equals(PayChannelType.POINTS.getIndex().intValue())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
points = collect.get(0).getPayAmount().intValue();
UseScoreRequest userScoreRequest = pointsMallOrderAdapter.convent2UseScoreRequest(partnerId, memberId, appId, orderCode, points);
CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, baseResponse.getCode())) {
return ResponseUtil.error(baseResponse.getCode(), "扣减积分失败");
}
}
}
// //有现金支付,扣减积分
// if (isCash && CollectionUtils.isNotEmpty(orderInfo.getOrderPayItemCreateReqList())) {
// List<OrderPayItemResp> collect = orderInfo.getOrderPayItemCreateReqList().stream().filter(orderPayItemResp ->
// orderPayItemResp.getPayChannelType().equals(PayChannelType.POINTS.getIndex().intValue())).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(collect)) {
// points = collect.get(0).getPayAmount().intValue();
// UseScoreRequest userScoreRequest = pointsMallOrderAdapter.convent2UseScoreRequest(partnerId, memberId, appId, orderCode, points);
// CustomerPropertyBaseResponse baseResponse = customerPropertyClient.useScore(userScoreRequest);
// if (!Objects.equals(ResponseCodeConstant.RESPONSE_SUCCESS_STR, baseResponse.getCode())) {
// return ResponseUtil.error(baseResponse.getCode(), "扣减积分失败");
// }
// }
// }
return ResponseUtil.success();
}
......
......@@ -2,6 +2,8 @@ package cn.freemud.service.thirdparty;
import cn.freemud.annotations.LogIgnoreFeign;
import cn.freemud.entities.dto.user.*;
import com.freemud.application.sdk.api.base.BaseResponse;
import com.freemud.application.sdk.api.membercenter.request.ReturnScoreRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -18,6 +20,15 @@ public interface CustomerPropertyClient {
@PostMapping(value = "/propertyservice/score/pay")
CustomerPropertyBaseResponse<PayScoreResponse> useScore(@RequestBody UseScoreRequest userScoreRequest);
/**
* 积分回退
* @param request
* @return
*/
@LogIgnoreFeign(logMessage = "returnScore")
@PostMapping({"/propertyservice/score/returnScore"})
CustomerPropertyBaseResponse returnScore(ReturnScoreRequest request);
@LogIgnoreFeign(logMessage="statisticalScore")
@PostMapping({"/propertyservice/score/statisticalScore"})
......
......@@ -104,4 +104,5 @@
| 1.3.65.RELEASE | 聚合层sdk异常,版本引不到,解决代码报错 | 王航航 | 2021-07-20 |
| 1.3.66.RELEASE | 基础订单sdk版本升级 | 伍平 | 2021-08-10 |
| 1.3.67.RELEASE | 新增爱马哥需求代码改动 | 周晓航 | 2021-08-23 |
| 1.3.68.RELEASE | 新增维护商品类型同步商品服务 | 周晓航 | 2021-09-03 |
\ No newline at end of file
| 1.3.68.RELEASE | 新增维护商品类型同步商品服务 | 周晓航 | 2021-09-03 |
| 1.3.69.RELEASE | 升级sdk | 伍平 | 2021-09-16 |
\ No newline at end of file
package com.freemud.application.sdk.api.ordercenter.enums.orderv1;
public enum RefundStatusV1 {
APPLY_REFUND(1, "申请退款"),
AGREE_REFUND(2, "同意退款"),
ALREADY_REFUND(3, "已退货"),
COMPLETE_REFUND(4, "退款完成"),
REFUSE_REFUND(5, "拒绝退款");
private Integer code;
private String desc;
RefundStatusV1(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static RefundStatusV1 getByCode(Integer code) {
for (RefundStatusV1 status : values()) {
if (status.getCode().equals(code)) {
return status;
}
}
return null;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
//package com.freemud.application.sdk.api.ordercenter.response;
//
//import lombok.Data;
//
//@Data
//public class OrderManagerResponse {
// /**
// * 预订单打印时间{1:提醒时打印;2:接单时打印} 默认为1
// */
// private String orderPrintConfig;
// /**
// * 订单预约时间
// */
// private Long gmtExpect;
// /**
// * 订单状态
// * 1=下单,2=待支付,3=接单,4=配送中,5=完成,6=取消,7=拒单,31=制作完成
// */
// private Integer status;
// /**
// * 订单退款状态
// * 1 申请退款 2 同意退款 3 已退货 4 退款完成 5 拒绝退款
// */
// private Integer refundStatus;
//}
package com.freemud.application.sdk.api.ordercenter.response;
import lombok.Data;
@Data
public class OrderManagerResponse {
/**
* 预订单打印时间{1:提醒时打印;2:接单时打印} 默认为1
*/
private String orderPrintConfig;
/**
* 订单预约时间
*/
private Long gmtExpect;
/**
* 订单状态
* 1=下单,2=待支付,3=接单,4=配送中,5=完成,6=取消,7=拒单,31=制作完成
*/
private Integer status;
/**
* 订单退款状态
* 1 申请退款 2 同意退款 3 已退货 4 退款完成 5 拒绝退款
*/
private Integer refundStatus;
}
package com.freemud.application.sdk.api.ordercenter.service;
import com.freemud.application.sdk.api.ordercenter.adapter.OrderCenterSdkAdapter;
import com.freemud.application.sdk.api.ordercenter.entities.v1.OrderBeanV1;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCodeResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class OrderServiceV1 {
@Autowired
private OrderSdkService orderSdkService;
@Autowired
private OrderCenterSdkAdapter orderCenterSdkAdapter;
/**
* 根据订单编号查询订单信息
* 返回 V1版本订单数据结构
*/
public OrderBeanV1 queryOrderById(String orderClient, String orderCode, String thirdOrderCode, Integer withOperationHistory, String trackingNo){
QueryByCodeResponse orderInfo = orderSdkService.getOrderInfo(orderClient, orderCode, thirdOrderCode, withOperationHistory, trackingNo);
if(orderInfo == null){
return null;
}
return orderCenterSdkAdapter.convent2NEWOrderInfo(orderInfo.getResult());
}
}
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