|
@@ -8,8 +8,11 @@ import com.yoho.core.transaction.annoation.TxCompensateArgs; |
|
@@ -8,8 +8,11 @@ import com.yoho.core.transaction.annoation.TxCompensateArgs; |
8
|
import com.yoho.error.exception.ServiceException;
|
8
|
import com.yoho.error.exception.ServiceException;
|
9
|
import com.yohoufo.common.ApiResponse;
|
9
|
import com.yohoufo.common.ApiResponse;
|
10
|
import com.yohoufo.common.exception.UfoServiceException;
|
10
|
import com.yohoufo.common.exception.UfoServiceException;
|
|
|
11
|
+import com.yohoufo.order.utils.LoggerUtils;
|
11
|
import lombok.Data;
|
12
|
import lombok.Data;
|
12
|
import lombok.ToString;
|
13
|
import lombok.ToString;
|
|
|
14
|
+import org.slf4j.Logger;
|
|
|
15
|
+import org.springframework.beans.factory.annotation.Autowired;
|
13
|
import org.springframework.stereotype.Component;
|
16
|
import org.springframework.stereotype.Component;
|
14
|
|
17
|
|
15
|
import java.math.BigDecimal;
|
18
|
import java.math.BigDecimal;
|
|
@@ -22,7 +25,13 @@ import java.util.Objects; |
|
@@ -22,7 +25,13 @@ import java.util.Objects; |
22
|
|
25
|
|
23
|
|
26
|
|
24
|
@Component
|
27
|
@Component
|
25
|
-public class BargainProxyService extends AbsServiceCaller implements Compensator {
|
28
|
+public class BargainProxyService implements Compensator {
|
|
|
29
|
+
|
|
|
30
|
+ private final static Logger logger = LoggerUtils.getBuyerOrderLogger();
|
|
|
31
|
+
|
|
|
32
|
+ @Autowired
|
|
|
33
|
+ private BaseServiceCaller baseServiceCaller;
|
|
|
34
|
+
|
26
|
/**
|
35
|
/**
|
27
|
* 获取用户砍价商品的最终价格
|
36
|
* 获取用户砍价商品的最终价格
|
28
|
* 所有的业务校验都在activity服务端实现,如活动时间、是否达成
|
37
|
* 所有的业务校验都在activity服务端实现,如活动时间、是否达成
|
|
@@ -33,12 +42,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
|
@@ -33,12 +42,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
33
|
*/
|
42
|
*/
|
34
|
public CutDownPriceProductOrderBo queryCutPriceProductForOrder(int uid, int cutRecordId) {
|
43
|
public CutDownPriceProductOrderBo queryCutPriceProductForOrder(int uid, int cutRecordId) {
|
35
|
logger.info("getActivityPrice by uid {},cutRecordId {}", uid, cutRecordId);
|
44
|
logger.info("getActivityPrice by uid {},cutRecordId {}", uid, cutRecordId);
|
36
|
- String url = erpGatewayUrl + "/erp/activity/cutPrice/queryCutPriceProductForOrder";
|
45
|
+ String url = baseServiceCaller.getErpGatewayUrl() + "/erp/activity/cutPrice/queryCutPriceProductForOrder";
|
37
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
46
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
38
|
requestBO.setUserId(uid);
|
47
|
requestBO.setUserId(uid);
|
39
|
requestBO.setCutRecordId(cutRecordId);
|
48
|
requestBO.setCutRecordId(cutRecordId);
|
40
|
- ApiResponse response = proxyPost("activity.queryCutPriceProductForOrder", url, requestBO);
|
|
|
41
|
- CutDownPriceProductOrderBo cutDownPriceProductOrderBo = getResultFromApiResponse(response, CutDownPriceProductOrderBo.class);
|
49
|
+ ApiResponse response = baseServiceCaller.proxyPost("activity.queryCutPriceProductForOrder", url, requestBO);
|
|
|
50
|
+ CutDownPriceProductOrderBo cutDownPriceProductOrderBo = baseServiceCaller.getResultFromApiResponse(response, CutDownPriceProductOrderBo.class);
|
42
|
if (Objects.isNull(cutDownPriceProductOrderBo)) {
|
51
|
if (Objects.isNull(cutDownPriceProductOrderBo)) {
|
43
|
logger.warn("can't getActivityPrice by uid {},cutRecordId {}", uid, cutRecordId);
|
52
|
logger.warn("can't getActivityPrice by uid {},cutRecordId {}", uid, cutRecordId);
|
44
|
throw new UfoServiceException(500, "未查询到用户砍价商品信息");
|
53
|
throw new UfoServiceException(500, "未查询到用户砍价商品信息");
|
|
@@ -59,12 +68,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
|
@@ -59,12 +68,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
59
|
public void addCutPriceUseRecord(@TxCompensateArgs("uid") int uid, @TxCompensateArgs("orderCode") long orderCode,
|
68
|
public void addCutPriceUseRecord(@TxCompensateArgs("uid") int uid, @TxCompensateArgs("orderCode") long orderCode,
|
60
|
@TxCompensateArgs("cutRecordId") int cutRecordId) throws ServiceException {
|
69
|
@TxCompensateArgs("cutRecordId") int cutRecordId) throws ServiceException {
|
61
|
logger.debug("addCutPriceUseRecord by uid {},cutRecordId {},orderCode {}", uid, cutRecordId, orderCode);
|
70
|
logger.debug("addCutPriceUseRecord by uid {},cutRecordId {},orderCode {}", uid, cutRecordId, orderCode);
|
62
|
- String url = erpGatewayUrl + "/erp/activity/cutPrice/addCutPriceUseRecord";
|
71
|
+ String url = baseServiceCaller.getErpGatewayUrl() + "/erp/activity/cutPrice/addCutPriceUseRecord";
|
63
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
72
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
64
|
requestBO.setUserId(uid);
|
73
|
requestBO.setUserId(uid);
|
65
|
requestBO.setCutRecordId(cutRecordId);
|
74
|
requestBO.setCutRecordId(cutRecordId);
|
66
|
requestBO.setOrderCode(orderCode);
|
75
|
requestBO.setOrderCode(orderCode);
|
67
|
- ApiResponse response = proxyPost("activity.addCutPriceUseRecord", url, requestBO);
|
76
|
+ ApiResponse response = baseServiceCaller.proxyPost("activity.addCutPriceUseRecord", url, requestBO);
|
68
|
logger.info("addCutPriceUseRecord(uid:{},cutRecordId:{},orderCode:{}),result is {}",
|
77
|
logger.info("addCutPriceUseRecord(uid:{},cutRecordId:{},orderCode:{}),result is {}",
|
69
|
uid, cutRecordId, orderCode, response);
|
78
|
uid, cutRecordId, orderCode, response);
|
70
|
if (response == null || response.getCode() != 200) {
|
79
|
if (response == null || response.getCode() != 200) {
|
|
@@ -86,12 +95,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
|
@@ -86,12 +95,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
86
|
*/
|
95
|
*/
|
87
|
public void cancelCutPriceUseRecord(int uid, long orderCode, int cutRecordId) throws ServiceException {
|
96
|
public void cancelCutPriceUseRecord(int uid, long orderCode, int cutRecordId) throws ServiceException {
|
88
|
logger.debug("cancelCutPriceUseRecord by uid {},orderCode {},cutRecordId {}", uid, orderCode, cutRecordId);
|
97
|
logger.debug("cancelCutPriceUseRecord by uid {},orderCode {},cutRecordId {}", uid, orderCode, cutRecordId);
|
89
|
- String url = erpGatewayUrl + "/erp/activity/cutPrice/cancelCutPriceUseRecord";
|
98
|
+ String url = baseServiceCaller.getErpGatewayUrl() + "/erp/activity/cutPrice/cancelCutPriceUseRecord";
|
90
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
99
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
91
|
requestBO.setUserId(uid);
|
100
|
requestBO.setUserId(uid);
|
92
|
requestBO.setCutRecordId(cutRecordId);
|
101
|
requestBO.setCutRecordId(cutRecordId);
|
93
|
requestBO.setOrderCode(orderCode);
|
102
|
requestBO.setOrderCode(orderCode);
|
94
|
- ApiResponse response = proxyPost("activity.cancelCutPriceUseRecord", url, requestBO);
|
103
|
+ ApiResponse response = baseServiceCaller.proxyPost("activity.cancelCutPriceUseRecord", url, requestBO);
|
95
|
logger.info("cancelCutPriceUseRecord(uid:{},cutRecordId:{},orderCode:{}),result is {}", uid, cutRecordId, orderCode, response);
|
104
|
logger.info("cancelCutPriceUseRecord(uid:{},cutRecordId:{},orderCode:{}),result is {}", uid, cutRecordId, orderCode, response);
|
96
|
if (response != null && response.getCode() == 200) {
|
105
|
if (response != null && response.getCode() == 200) {
|
97
|
logger.info("[{}] cancelCutPriceUseRecord success,cutRecordId {}", orderCode, cutRecordId);
|
106
|
logger.info("[{}] cancelCutPriceUseRecord success,cutRecordId {}", orderCode, cutRecordId);
|
|
@@ -111,12 +120,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
|
@@ -111,12 +120,12 @@ public class BargainProxyService extends AbsServiceCaller implements Compensator |
111
|
*/
|
120
|
*/
|
112
|
public void payCutPrice(int uid, long orderCode, int cutRecordId) throws ServiceException {
|
121
|
public void payCutPrice(int uid, long orderCode, int cutRecordId) throws ServiceException {
|
113
|
logger.debug("payCutPrice by uid {},orderCode {},cutRecordId {}", uid, orderCode, cutRecordId);
|
122
|
logger.debug("payCutPrice by uid {},orderCode {},cutRecordId {}", uid, orderCode, cutRecordId);
|
114
|
- String url = erpGatewayUrl + "/erp/activity/cutPrice/payCutPrice";
|
123
|
+ String url = baseServiceCaller.getErpGatewayUrl() + "/erp/activity/cutPrice/payCutPrice";
|
115
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
124
|
CutPriceHelpUserRequestBO requestBO = new CutPriceHelpUserRequestBO();
|
116
|
requestBO.setUserId(uid);
|
125
|
requestBO.setUserId(uid);
|
117
|
requestBO.setCutRecordId(cutRecordId);
|
126
|
requestBO.setCutRecordId(cutRecordId);
|
118
|
requestBO.setOrderCode(orderCode);
|
127
|
requestBO.setOrderCode(orderCode);
|
119
|
- ApiResponse response = proxyPost("activity.payCutPrice", url, requestBO);
|
128
|
+ ApiResponse response = baseServiceCaller.proxyPost("activity.payCutPrice", url, requestBO);
|
120
|
logger.info("payCutPrice(uid:{},cutRecordId:{},orderCode:{}),result is {}", uid, cutRecordId, orderCode, response);
|
129
|
logger.info("payCutPrice(uid:{},cutRecordId:{},orderCode:{}),result is {}", uid, cutRecordId, orderCode, response);
|
121
|
if (response != null && response.getCode() == 200) {
|
130
|
if (response != null && response.getCode() == 200) {
|
122
|
logger.info("[{}] payCutPrice success,cutRecordId {}", orderCode, cutRecordId);
|
131
|
logger.info("[{}] payCutPrice success,cutRecordId {}", orderCode, cutRecordId);
|