Authored by qinchao

发消息

@@ -441,7 +441,9 @@ public class AppraiseService { @@ -441,7 +441,9 @@ public class AppraiseService {
441 441
442 //记录操作记录 442 //记录操作记录
443 orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_PASS); 443 orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_PASS);
444 - //TODO 发消息 444 + //TODO 发消息 瑕疵接收,只给卖家发消息
  445 + Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
  446 + inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
445 }else{ 447 }else{
446 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改 448 throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
447 } 449 }
@@ -1182,8 +1184,9 @@ public class AppraiseService { @@ -1182,8 +1184,9 @@ public class AppraiseService {
1182 LOGGER.info("in judgeCenterPass record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid); 1184 LOGGER.info("in judgeCenterPass record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
1183 orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode()); 1185 orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
1184 1186
1185 - //TODO 鉴定通过,等待发货,消息  
1186 - //inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods); 1187 + //TODO 鉴定通过,
  1188 + Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
  1189 + inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
1187 }catch (Exception ex){ 1190 }catch (Exception ex){
1188 LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex); 1191 LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
1189 String content = "后台鉴定通过商品,订单"+ orderCode + "退还保证金失败"; 1192 String content = "后台鉴定通过商品,订单"+ orderCode + "退还保证金失败";
@@ -1346,7 +1349,8 @@ public class AppraiseService { @@ -1346,7 +1349,8 @@ public class AppraiseService {
1346 1349
1347 //平台已发货给买家 1350 //平台已发货给买家
1348 Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null); 1351 Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
1349 - inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods,product); 1352 + inBoxFacade.appraisePassNoticeBuyer(buyerUid, orderCode, sellerOrderGoods,product);
  1353 + inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
1350 }catch (Exception ex){ 1354 }catch (Exception ex){
1351 LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex); 1355 LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
1352 String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败"; 1356 String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败";
@@ -183,7 +183,7 @@ public class InBoxFacade { @@ -183,7 +183,7 @@ public class InBoxFacade {
183 * 183 *
184 * @return 184 * @return
185 */ 185 */
186 - public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) { 186 + public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
187 187
188 executorService.execute(()->{ 188 executorService.execute(()->{
189 189
@@ -191,6 +191,7 @@ public class InBoxFacade { @@ -191,6 +191,7 @@ public class InBoxFacade {
191 logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}", 191 logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
192 buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product)); 192 buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
193 String prdName = psog.getProductName(); 193 String prdName = psog.getProductName();
  194 + String sizeName = psog.getSizeName();
194 String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse(""); 195 String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
195 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED; 196 InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
196 String params = buildParams(orderCode); 197 String params = buildParams(orderCode);
@@ -200,27 +201,6 @@ public class InBoxFacade { @@ -200,27 +201,6 @@ public class InBoxFacade {
200 logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}", 201 logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
201 buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp); 202 buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
202 203
203 - //seller notice  
204 - String sizeName = psog.getSizeName();  
205 - Integer sellerUid = psog.getUid();  
206 - InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;  
207 - String paramsOfSeller = buildParams(prdName, sizeName);  
208 - InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);  
209 -  
210 - InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);  
211 - logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",  
212 - buyerUid, orderCode, prdName,sizeName, respOfSeller);  
213 - String phoneOfSeller = userProxyService.getMobile(sellerUid);  
214 - if (StringUtils.isBlank(phoneOfSeller)){  
215 - logger.warn("in appraisePassNotice sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);  
216 - }else{  
217 - List<String> mobileList = Arrays.asList(phoneOfSeller);  
218 - String contentOfSeller = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS.getContent(), orderCode);  
219 - sendSmsService.smsSendByMobile(contentOfSeller, mobileList);  
220 - logger.info("record appraisePassNotice sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",  
221 - sellerUid, orderCode, prdName, sizeName, phoneOfSeller);  
222 - }  
223 -  
224 //短信 204 //短信
225 String phone = userProxyService.getMobile(buyerUid); 205 String phone = userProxyService.getMobile(buyerUid);
226 if (StringUtils.isBlank(phone)){ 206 if (StringUtils.isBlank(phone)){
@@ -239,6 +219,45 @@ public class InBoxFacade { @@ -239,6 +219,45 @@ public class InBoxFacade {
239 }); 219 });
240 220
241 } 221 }
  222 +
  223 + public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
  224 +
  225 + executorService.execute(()->{
  226 +
  227 + try {
  228 + logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
  229 + buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
  230 + String prdName = psog.getProductName();
  231 + String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
  232 +
  233 + //seller notice
  234 + String sizeName = psog.getSizeName();
  235 + Integer sellerUid = psog.getUid();
  236 + InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;
  237 + String paramsOfSeller = buildParams(prdName, sizeName);
  238 + InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
  239 +
  240 + InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
  241 + logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
  242 + buyerUid, orderCode, prdName,sizeName, respOfSeller);
  243 + String phoneOfSeller = userProxyService.getMobile(sellerUid);
  244 + if (StringUtils.isBlank(phoneOfSeller)){
  245 + logger.warn("in appraisePassNoticeSeller sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
  246 + }else{
  247 + List<String> mobileList = Arrays.asList(phoneOfSeller);
  248 + String contentOfSeller = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS.getContent(), orderCode);
  249 + sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
  250 + logger.info("record appraisePassNoticeSeller sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
  251 + sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
  252 + }
  253 +
  254 + } catch (Exception e) {
  255 + logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
  256 + buyerUid, orderCode, psog, e);
  257 + }
  258 + });
  259 +
  260 + }
242 private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){ 261 private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){
243 return getReplacedContent(ibte.getContent(), params); 262 return getReplacedContent(ibte.getContent(), params);
244 } 263 }