|
@@ -40,7 +40,7 @@ import java.util.function.Supplier; |
|
@@ -40,7 +40,7 @@ import java.util.function.Supplier; |
40
|
* Created by chenchao on 2018/10/8.
|
40
|
* Created by chenchao on 2018/10/8.
|
41
|
*/
|
41
|
*/
|
42
|
@Service
|
42
|
@Service
|
43
|
-public class InBoxFacade {
|
43
|
+public class InBoxFacade extends BaseNoticeFacade{
|
44
|
|
44
|
|
45
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
45
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
46
|
|
46
|
|
|
@@ -74,49 +74,25 @@ public class InBoxFacade { |
|
@@ -74,49 +74,25 @@ public class InBoxFacade { |
74
|
* @param buyerUid
|
74
|
* @param buyerUid
|
75
|
*/
|
75
|
*/
|
76
|
public void buyerOrderNotPayed(int buyerUid, long orderCode) {
|
76
|
public void buyerOrderNotPayed(int buyerUid, long orderCode) {
|
77
|
- try {
|
|
|
78
|
- executorService.execute(() -> {
|
|
|
79
|
- String params = buildParams(orderCode);
|
|
|
80
|
- InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_UNPAID;
|
|
|
81
|
- InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
82
|
-
|
|
|
83
|
- //
|
|
|
84
|
- InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
85
|
- logger.info("record buyerOrderNotPayed inbox msg, buyerUid {}, orderCode {}, resp {}",
|
|
|
86
|
- buyerUid, orderCode, resp);
|
|
|
87
|
-
|
|
|
88
|
- //push
|
|
|
89
|
- SendMessageRspBo bo = ufoSendService.buyerNotPay(String.valueOf(buyerUid),String.valueOf(orderCode));
|
|
|
90
|
- logger.info("record buyerOrderNotPayed push buyer uid is {}, orderCode is {}, result is {}", buyerUid, orderCode, JSON.toJSONString(bo));
|
|
|
91
|
- });
|
|
|
92
|
- } catch (Exception e) {
|
|
|
93
|
- logger.warn("InBoxFacade buyerOrderNotPayed error inbox msg, buyerUid {}, orderCode {} ",
|
|
|
94
|
- buyerUid, orderCode, e);
|
|
|
95
|
- }
|
77
|
+ logger.info("notice buyer not paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
78
|
+ newNotice(buyerUid)
|
|
|
79
|
+ .withInBox(InboxBusinessTypeEnum.PURCHASE_UNPAID, orderCode)
|
|
|
80
|
+ .withPush(() -> ufoSendService.buyerNotPay(String.valueOf(buyerUid), String.valueOf(orderCode)))
|
|
|
81
|
+ .send();
|
96
|
}
|
82
|
}
|
97
|
|
83
|
|
98
|
/**
|
84
|
/**
|
99
|
- * 已通知卖家发货:买家支付订单
|
85
|
+ * 通知买家,已经支付成功已通知卖家发货
|
100
|
*
|
86
|
*
|
101
|
* @param buyerUid
|
87
|
* @param buyerUid
|
102
|
* @param orderCode
|
88
|
* @param orderCode
|
103
|
*/
|
89
|
*/
|
104
|
- public void buyerFinishPaid(int buyerUid, long orderCode,int deliveryHours, String unit) {
|
|
|
105
|
- try {
|
|
|
106
|
- executorService.execute(() -> {
|
|
|
107
|
- InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER;
|
90
|
+ public void buyerFinishPaid(int buyerUid, long orderCode, int deliveryHours, String unit) {
|
|
|
91
|
+ logger.info("notice buyer finish paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
108
|
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
|
92
|
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
|
109
|
- String params = buildParams(orderCode,timelimitDesc);
|
|
|
110
|
- InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
111
|
-
|
|
|
112
|
- InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
113
|
- logger.info("record buyerFinishPaid inbox msg, buyerUid {}, orderCode {}, resp {}",
|
|
|
114
|
- buyerUid, orderCode, resp);
|
|
|
115
|
- });
|
|
|
116
|
- } catch (Exception e) {
|
|
|
117
|
- logger.warn("InBoxFacade buyerFinishPaid error inbox msg, buyerUid {}, orderCode {} ",
|
|
|
118
|
- buyerUid, orderCode, e);
|
|
|
119
|
- }
|
93
|
+ newNotice(buyerUid)
|
|
|
94
|
+ .withInBox(InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER, orderCode, timelimitDesc)
|
|
|
95
|
+ .send();
|
120
|
}
|
96
|
}
|
121
|
|
97
|
|
122
|
|
98
|
|
|
@@ -126,43 +102,26 @@ public class InBoxFacade { |
|
@@ -126,43 +102,26 @@ public class InBoxFacade { |
126
|
* @param buyerUid
|
102
|
* @param buyerUid
|
127
|
* @param orderCode
|
103
|
* @param orderCode
|
128
|
*/
|
104
|
*/
|
129
|
- public void sellerDeliver2Depot(int buyerUid, long orderCode,SellerOrderGoods psog ){
|
|
|
130
|
- executorService.execute(()-> {
|
105
|
+ public void sellerDeliver2Depot(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
131
|
try {
|
106
|
try {
|
132
|
- String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
133
|
- String prdName = psog.getProductName();
|
|
|
134
|
- InboxBusinessTypeEnum ibtOfBuyer = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER;
|
|
|
135
|
- String params = buildParams(orderCode);
|
|
|
136
|
- InboxReqVO req = buildInboxReqVO(buyerUid, params, ibtOfBuyer);
|
|
|
137
|
- InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
138
|
- logger.info("record sellerDeliver2Depot inbox msg, buyerUid {}, orderCode {}, prdName {} resp {}",
|
|
|
139
|
- buyerUid, orderCode, prdName, resp);
|
107
|
+ executorService.execute(() -> {
|
140
|
|
108
|
|
141
|
- String sizeName= psog.getSizeName();
|
109
|
+ logger.info("notice buyer seller deliver 2 depot, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
110
|
+ String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
111
|
+ String prdName = psog.getProductName();
|
|
|
112
|
+ String sizeName = psog.getSizeName();
|
142
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
113
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
143
|
String productCode = product.getProductCode();
|
114
|
String productCode = product.getProductCode();
|
144
|
|
115
|
|
145
|
- //发push
|
|
|
146
|
- SendMessageRspBo bo = ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid),String.valueOf(orderCode));
|
|
|
147
|
- logger.info("record sellerDeliver2Depot push buyer uid is {}, orderCode is {}, result is {}", buyerUid, orderCode, JSON.toJSONString(bo));
|
|
|
148
|
-
|
|
|
149
|
- //sms
|
|
|
150
|
- String phone = userProxyService.getMobile(buyerUid);
|
|
|
151
|
- if (StringUtils.isBlank(phone)){
|
|
|
152
|
- logger.warn("in sellerDeliver2Depot sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
153
|
- return;
|
|
|
154
|
- }
|
|
|
155
|
- String content=getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER.getContent(),skupTypeText,prdName,sizeName,productCode,orderCode);
|
|
|
156
|
- List<String> mobileList = Arrays.asList(phone);
|
|
|
157
|
- sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
158
|
- logger.info("record sellerDeliver2Depot inbox sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
159
|
- buyerUid, orderCode, prdName, phone);
|
|
|
160
|
-
|
116
|
+ newNotice(buyerUid)
|
|
|
117
|
+ .withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER, orderCode)
|
|
|
118
|
+ .withPush(() -> ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid), String.valueOf(orderCode)))
|
|
|
119
|
+ .withSms(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER, skupTypeText, prdName, sizeName, productCode, orderCode)
|
|
|
120
|
+ .send();
|
|
|
121
|
+ });
|
161
|
} catch (Exception ex) {
|
122
|
} catch (Exception ex) {
|
162
|
- logger.warn("InBoxFacade depotDeliver2Buyer error inbox msg, buyerUid {}, orderCode {} ,prdName {}",
|
|
|
163
|
- buyerUid, orderCode,psog, ex);
|
123
|
+ logger.warn("notice buyer seller deliver 2 depot fail, buyerUid {}, orderCode {}", buyerUid, orderCode, ex);
|
164
|
}
|
124
|
}
|
165
|
- });
|
|
|
166
|
}
|
125
|
}
|
167
|
|
126
|
|
168
|
/**
|
127
|
/**
|
|
@@ -170,92 +129,49 @@ public class InBoxFacade { |
|
@@ -170,92 +129,49 @@ public class InBoxFacade { |
170
|
*
|
129
|
*
|
171
|
* @return
|
130
|
* @return
|
172
|
*/
|
131
|
*/
|
173
|
- public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
174
|
-
|
|
|
175
|
- executorService.execute(()->{
|
|
|
176
|
-
|
132
|
+ public void appraisePassAndDeliveryGoodsToBuyerNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
177
|
try {
|
133
|
try {
|
178
|
- logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} ",
|
|
|
179
|
- buyerUid, orderCode, psog, JSON.toJSONString(psog));
|
134
|
+ executorService.execute(() -> {
|
|
|
135
|
+ logger.info("notice buyer appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
180
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
136
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
181
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
137
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
182
|
- String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
|
138
|
+ String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
|
183
|
String prdName = psog.getProductName();
|
139
|
String prdName = psog.getProductName();
|
184
|
String sizeName = psog.getSizeName();
|
140
|
String sizeName = psog.getSizeName();
|
185
|
- InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
|
|
|
186
|
- String params = buildParams(orderCode);
|
|
|
187
|
- InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
188
|
-
|
|
|
189
|
- InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
190
|
- logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
|
|
|
191
|
- buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
|
|
|
192
|
|
141
|
|
193
|
- //短信
|
|
|
194
|
- String phone = userProxyService.getMobile(buyerUid);
|
|
|
195
|
- if (StringUtils.isBlank(phone)){
|
|
|
196
|
- logger.warn("in appraisePassNotice notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
197
|
- }else{
|
|
|
198
|
- List<String> mobileList = Arrays.asList(phone);
|
|
|
199
|
- String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),skupTypeText,prdName,sizeName,productCode,orderCode);
|
|
|
200
|
- sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
201
|
- logger.info("record appraisePassNotice notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
202
|
- buyerUid, orderCode,prdName, phone);
|
|
|
203
|
- }
|
142
|
+ newNotice(buyerUid)
|
|
|
143
|
+ .withInBox(InboxBusinessTypeEnum.PURCHASE_SENDED, orderCode)
|
|
|
144
|
+ .withSms(InboxBusinessTypeEnum.SMS_SEND, skupTypeText, prdName, sizeName, productCode, orderCode)
|
|
|
145
|
+ .send();
|
|
|
146
|
+ });
|
204
|
} catch (Exception e) {
|
147
|
} catch (Exception e) {
|
205
|
- logger.warn("InBoxFacade appraisePassNotice error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
206
|
- buyerUid, orderCode, psog, e);
|
148
|
+ logger.warn("notice buyer appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
|
207
|
}
|
149
|
}
|
208
|
- });
|
|
|
209
|
-
|
|
|
210
|
}
|
150
|
}
|
211
|
|
151
|
|
212
|
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
152
|
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
213
|
-
|
|
|
214
|
- executorService.execute(()->{
|
|
|
215
|
-
|
|
|
216
|
try {
|
153
|
try {
|
217
|
- logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
|
|
|
218
|
- buyerUid, orderCode, psog, JSON.toJSONString(psog));
|
154
|
+ executorService.execute(() -> {
|
|
|
155
|
+ logger.info("notice seller appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
219
|
String prdName = psog.getProductName();
|
156
|
String prdName = psog.getProductName();
|
220
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
157
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
221
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
158
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
222
|
-
|
|
|
223
|
- //seller notice
|
|
|
224
|
String sizeName = psog.getSizeName();
|
159
|
String sizeName = psog.getSizeName();
|
225
|
Integer sellerUid = psog.getUid();
|
160
|
Integer sellerUid = psog.getUid();
|
226
|
- String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
227
|
- InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;
|
|
|
228
|
- String paramsOfSeller = buildParams(skupTypeText,prdName, sizeName,productCode);
|
|
|
229
|
- InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
|
161
|
+ String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
|
230
|
|
162
|
|
231
|
- InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
|
|
|
232
|
- logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
|
|
|
233
|
- buyerUid, orderCode, prdName,sizeName, respOfSeller);
|
|
|
234
|
- String phoneOfSeller = userProxyService.getMobile(sellerUid);
|
|
|
235
|
- if (StringUtils.isBlank(phoneOfSeller)){
|
|
|
236
|
- logger.warn("in appraisePassNoticeSeller sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
237
|
- }else{
|
|
|
238
|
- List<String> mobileList = Arrays.asList(phoneOfSeller);
|
|
|
239
|
- String contentOfSeller = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS.getContent(),skupTypeText, orderCode);
|
|
|
240
|
- sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
|
|
|
241
|
- logger.info("record appraisePassNoticeSeller sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
|
|
|
242
|
- sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
|
|
|
243
|
- }
|
163
|
+ newNotice(sellerUid)
|
|
|
164
|
+ .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, prdName, sizeName, productCode)
|
|
|
165
|
+ .withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, orderCode)
|
|
|
166
|
+ .send();
|
|
|
167
|
+ });
|
244
|
|
168
|
|
245
|
} catch (Exception e) {
|
169
|
} catch (Exception e) {
|
246
|
- logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
247
|
- buyerUid, orderCode, psog, e);
|
170
|
+ logger.warn("notice seller appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
|
248
|
}
|
171
|
}
|
249
|
- });
|
|
|
250
|
|
172
|
|
251
|
}
|
173
|
}
|
252
|
- private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){
|
|
|
253
|
- return getReplacedContent(ibte.getContent(), params);
|
|
|
254
|
- }
|
|
|
255
|
|
174
|
|
256
|
- private String getReplacedContent(String content ,Object... params) {
|
|
|
257
|
- return MessageFormatter.arrayFormat(content, params).getMessage();
|
|
|
258
|
- }
|
|
|
259
|
|
175
|
|
260
|
/**
|
176
|
/**
|
261
|
* 订单生成,卖家取消售卖
|
177
|
* 订单生成,卖家取消售卖
|
|
@@ -1857,28 +1773,6 @@ public class InBoxFacade { |
|
@@ -1857,28 +1773,6 @@ public class InBoxFacade { |
1857
|
}
|
1773
|
}
|
1858
|
}
|
1774
|
}
|
1859
|
|
1775
|
|
1860
|
- public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
|
|
|
1861
|
- InboxReqVO req = new InboxReqVO();
|
|
|
1862
|
- req.setType(ibt.getType());
|
|
|
1863
|
- req.setBusinessType(ibt.getBusinessType());
|
|
|
1864
|
- //
|
|
|
1865
|
- req.setUid(uid);
|
|
|
1866
|
- req.setParams(params);
|
|
|
1867
|
- return req;
|
|
|
1868
|
- }
|
|
|
1869
|
-
|
|
|
1870
|
- public static String buildParams(Object... objects) {
|
|
|
1871
|
- if (objects == null) {
|
|
|
1872
|
- return null;
|
|
|
1873
|
- }
|
|
|
1874
|
-
|
|
|
1875
|
- if (objects.length == 1) {
|
|
|
1876
|
- return objects[0].toString();
|
|
|
1877
|
- }
|
|
|
1878
|
-
|
|
|
1879
|
- String params = StringUtils.join(objects, ",");
|
|
|
1880
|
- return params;
|
|
|
1881
|
- }
|
|
|
1882
|
|
1776
|
|
1883
|
|
1777
|
|
1884
|
} |
1778
|
} |