Authored by chenchao

clone old skup imperfect info

... ... @@ -116,6 +116,7 @@ public class SellerOrderPaymentService extends AbstractOrderPaymentService {
prdName = sellerOrderGoods.getProductName();
sizeName = sellerOrderGoods.getSizeName();
productId = sellerOrderGoods.getProductId();
//async
SkupStatus skupStatus = SkupStatus.CAN_SELL;
sellerGoodsStatusFlowService.pushStatusFlowEvent(sellerOrderGoods.getId(), skupStatus.getCode());
... ...
... ... @@ -63,6 +63,8 @@ public class ProductProxyService extends AbsProxyService{
*/
private static final String IMPERFECT_CREATE_API = "ufo.secondhand.save";
private static final String UFO_SECONDHAND_COPYINFO= "ufo.secondhand.copyInfo";
public boolean subtractStorage(Integer productId, Integer skup){
ApiResponse resp = ufoServiceCaller.call(SUBTRACT_STORAGE, productId, skup);
... ... @@ -439,4 +441,17 @@ public class ProductProxyService extends AbsProxyService{
logger.info("finish {} -> req {}", method, req);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
public boolean cloneImperfectGoods(Integer preSkup, Integer currentSkup){
final String method = UFO_SECONDHAND_COPYINFO;
logger.info("begin in {} preSkup {} currentSkup {}", method, preSkup, currentSkup);
ApiResponse resp = null;
try {
resp = ufoServiceCaller.call(method, preSkup, currentSkup);
}catch (Exception ex){
logger.warn("in {} call fail preSkup {} currentSkup {}", method, preSkup, currentSkup, ex);
}
logger.info("finish {} -> preSkup {} currentSkup {}", method, preSkup, currentSkup);
return (null == resp || null == resp.getData())? false : (boolean)resp.getData();
}
}
... ...
... ... @@ -10,6 +10,7 @@ import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.OrdersPrePayMapper;
import com.yohoufo.dal.order.SellerChangePriceRecordMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.OrdersPrePay;
import com.yohoufo.dal.order.model.SellerChangePriceRecord;
import com.yohoufo.dal.order.model.SellerOrder;
... ... @@ -22,6 +23,7 @@ import com.yohoufo.order.service.impl.SellerOrderCancelService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.ResourcesProxyService;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -82,6 +84,9 @@ public class SingleGoodsChangePriceService {
@Autowired
private ResourcesProxyService resourcesProxyService;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
/**
* compute Change Price4 NES(Not Entry Seller)
... ... @@ -189,12 +194,12 @@ public class SingleGoodsChangePriceService {
return;
}
if(sellerChangePriceRecordService.recordSuccess(scpr.getOrderCode(), ChangePriceStatus.WAITING_DEAL)==0){
return;
}
final Integer preSkup = scpr.getPreSkup(), currentSkup = scpr.getSkup();
long preOrderCode = scpr.getPreOrderCode();
Integer preSkup = scpr.getPreSkup();
try {
logger.info("in processAfterChangePriceOrderPaid cancel pre-SellerOrder , uid {} orderCode {} preOrderCode {}",
uid, orderCode, preOrderCode);
... ... @@ -204,6 +209,11 @@ public class SingleGoodsChangePriceService {
uid, orderCode, preOrderCode, ex);
rollBackWherPaidCallBackFail(uid, orderCode);
}finally {
//sync prd copy data when goods is imperfect
SellerOrderGoods prePsog = sellerOrderGoodsMapper.selectByPrimaryKey(preSkup);
if(SellerGoodsHelper.isImperfectGoods(prePsog.getAttributes())) {
productProxyService.cloneImperfectGoods(preSkup, currentSkup);
}
productProxyService.cancelHiddenSkup(preSkup);
}
}
... ...
... ... @@ -20,6 +20,12 @@ public final class SellerGoodsHelper {
&& (SkupType.FLAW.equals(skupType) || SkupType.SECOND_HAND.equals(skupType));
}
public static boolean isImperfectGoods(Integer skupTypeCode){
return skupTypeCode!=null
&& (SkupType.FLAW.getCode() == skupTypeCode.intValue()
|| SkupType.SECOND_HAND.getCode() == skupTypeCode.intValue());
}
public static String buildGoodsFlag(SkupType skupType){
String attrName = skupType.attrName();
... ...