Authored by chenchao

fix

package com.yohoufo.order.controller;
import com.google.common.base.Throwables;
import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
import com.yohobuy.ufo.model.order.req.SellerOrderCancelReq;
import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.order.event.AuditFailedEvent;
... ... @@ -38,9 +40,24 @@ public class ErpSellerGoodsController {
@IgnoreSignature
@IgnoreSession
@RequestMapping("/batchImportPrds")
public void batchImportPrds(@RequestBody BatchImportPrdReq<ProductImportTranItemBo> req){
public ApiResponse batchImportPrds(@RequestBody BatchImportPrdReq<ProductImportTranItemBo> req){
logger.info("in batchImportPrds req {}", req);
importPublishExcutor.publish(req);
ApiResponse resp;
int code =200;
String msg = "成功";
try{
importPublishExcutor.publish(req);
}catch (Exception ex){
code = 500;
msg = ex.getMessage();
logger.warn("batchImportPrds fail, req {}, error {}", req, Throwables.getStackTraceAsString(ex));
}finally {
resp = new ApiResponse();
resp.setCode(code);
resp.setMessage(msg);
return resp;
}
}
@IgnoreSignature
... ...
... ... @@ -466,6 +466,10 @@ public class BuyerOrderCancelService {
OrderStatus targetOrderStatus = rgaNode.targetOrderStatus;
BigDecimal leftBuyerMoney = rgaNode.leftBuyerMoney;
refundGoodsAmount(buyerOrder, skup, targetOrderStatus, leftBuyerMoney);
//notice
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
inBoxFacade.noticeWhenBuyerBlownCustomsClearance(buyerOrder.getUid(), buyerOrder.getOrderCode(), psog);
}
@Data@Builder
... ...
package com.yohoufo.order.service.impl;
import com.yoho.core.config.ConfigReader;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.bo.SellerLevelFuncBo;
... ... @@ -26,6 +27,7 @@ import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.MailSender;
import com.yohoufo.order.utils.SellerHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
... ... @@ -75,6 +77,9 @@ public class SellerEnterApplyService {
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
@Autowired
private ConfigReader configReader;
/**
* 申请成为超级卖家
* 对于未支付的某一种身份申请做订单号替换
... ... @@ -449,12 +454,6 @@ public class SellerEnterApplyService {
//当前身份
EntrySellerType currentEST = sellerBo.getEntrySellerType();
Integer currentEnterType = currentEST.getCode();
EntrySellerType targetEST = EntrySellerType.SUPER_ENTRY;
boolean isMactchedEST = Objects.equals(currentEnterType, targetEST.getCode());
if (!isMactchedEST){
logger.warn("changeLevel4Super is not super, uid {} left in wallet {}", uid, left);
return 0;
}
//身份等级配置
Map<EntrySellerType,EntryThreshold> estMap = metaConfigService.getEntryThreshold();
EntryThreshold set = estMap.get(currentEST);
... ... @@ -476,9 +475,23 @@ public class SellerEnterApplyService {
uid, currentLevel, level, levelNeedUpgrade, isValid);
int result = 0;
if (levelNeedUpgrade && isValid) {
doUpgradeSuper(targetEST, currentLevel, level, uid);
SuperEnterStageLevel targetSESL = SuperEnterStageLevel.getSuperEnterStageLevel(level);
inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold());
doUpgradeSuper(currentEST, currentLevel, level, uid);
if (sellerBo.isNormalSuper()) {
SuperEnterStageLevel targetSESL = SuperEnterStageLevel.getSuperEnterStageLevel(level);
inBoxFacade.noticeSuperSellerDegrade(uid, targetSESL, bslfb.getWalletThreshold());
}
if (sellerBo.isLargeSettlementSuper()){
try {
MailSender.newMailSender()
.subject("UFO香港卖家结算")
.to(configReader.getString("ufo.order.seller.noticeHKSellerEmailTo", "chao.chen@yoho.cn,xiuchun.luo@yoho.cn"))
.body("您的钱包金额不足,请及时充值", "text/html;charset=utf-8")
.send();
}catch (Exception ex){
logger.info("changeLevel4Super send mail fail, uid {} left wallet {}", uid, left, ex);
}
}
}
return result;
}
... ...
... ... @@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
... ... @@ -245,9 +246,11 @@ public class SellerService {
.buildSellerWrapper();
SellerBo sellerBo = sellerWrapper.buildSellerBo();
EntrySellerType currentEST = sellerBo.getEntrySellerType();
EntrySellerType targetEST = EntrySellerType.SUPER_ENTRY;
if (!Objects.equals(targetEST, currentEST)){
logger.info("processAfterWalletChange user was {} , uid {}", currentEST , uid);
List<EntrySellerType> targetESTs = new ArrayList<>(2);
targetESTs.add(EntrySellerType.SUPER_ENTRY);
targetESTs.add(EntrySellerType.LARGE_SETTLEMENT);
if (!targetESTs.contains(currentEST)){
logger.warn("processAfterWalletChange user was {} , uid {}", currentEST , uid);
return ;
}
//left enter type is 入驻超级
... ...
... ... @@ -1518,6 +1518,7 @@ public class InBoxFacade {
String skupTypeText=SkupType.getSkupType(sog.getAttributes()).attrName();
try {
executorService.execute(()->{
//TODO split as API 2 fetch data
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
... ... @@ -1715,6 +1716,40 @@ public class InBoxFacade {
}
}
public void noticeWhenBuyerBlownCustomsClearance(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.BUYER_BLOWN_CUSTOMS_CLEARANCE;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeWhenBuyerBlownCustomsClearance to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeWhenBuyerBlownCustomsClearance sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_BUYER_BLOWN_CUSTOMS_CLEARANCE;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeWhenBuyerBlownCustomsClearance inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
});
} catch (Exception e) {
logger.warn("InBoxFacade noticeWhenBuyerBlownCustomsClearance error inbox msg, buyerUid {}, orderCode {} ,prdName {}",
buyerUid, orderCode, prdName, e);
}
}
public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
InboxReqVO req = new InboxReqVO();
req.setType(ibt.getType());
... ...
package com.yohoufo.order.service.seller;
import com.yohobuy.ufo.model.order.bo.SellerBo;
import com.yohobuy.ufo.model.order.common.SellerFuncEnum;
import com.yohobuy.ufo.model.order.req.BatchImportPrdReq;
import com.yohobuy.ufo.model.request.product.ProductImportTranItemBo;
import com.yohoufo.common.alarm.EventBusPublisher;
... ... @@ -44,6 +45,9 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S
@Autowired
private SellerService sellerService;
@Autowired
private SellerAuthCheckService sellerAuthCheckService;
private boolean checkSellerEntryType(SellerBo sellerBo){
return sellerBo.isNormalSuper() || sellerBo.isLargeSettlementSuper();
}
... ... @@ -60,6 +64,7 @@ public class ImportPublishExcutor implements PublishExcutor<BatchImportPrdReq, S
logger.warn("in ImportPublishExcutor.publish not legal super, uid {} ", uid);
return null;
}
sellerAuthCheckService.checkAuth(sellerBo, SellerFuncEnum.BATCH_PUBLISH);
//TODO check left in wallet
for(ProductImportTranItemBo importPrd : importPrds){
Integer storageId = importPrd.getStorageId();
... ...
... ... @@ -32,7 +32,8 @@ ufo.user.photoCheckLimit=3
ufo.product.addSizeSortId=40
ufo.order.buyer.allow_buy_self_sell_goods=false
ufo.order.buyer.allow_buy_self_sell_goods=true
ufo.order.seller.hkAccountSettlementAmountLimit=100
ufo.order.seller.hkAccountSettlementEmailTo=xiuchun.luo@yoho.cn
ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn
\ No newline at end of file
... ...