Authored by chenchao

copy old skup status 2 new one

... ... @@ -76,4 +76,7 @@ public interface StoragePriceMapper {
BigDecimal selectInStockLeastPriceByProductId(@Param("storageId") Integer storageId);
int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
int updateOneStatusByeAnothers(@Param("oldskup") Integer oldskup, @Param("newskup") Integer newskup);
}
\ No newline at end of file
... ...
... ... @@ -232,4 +232,10 @@
where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6)
</select>
<update id="updateOneStatusByeAnothers">
update storage_price a,storage_price b set a.status = b.status where
a.skup = #{newskup,jdbcType=INTEGER} and b.skup = #{oldskup,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -201,6 +201,11 @@ public class SingleGoodsChangePriceService {
final Integer preSkup = scpr.getPreSkup(), currentSkup = scpr.getSkup();
long preOrderCode = scpr.getPreOrderCode();
try {
//sync prd copy data when goods is imperfect
SellerOrderGoods prePsog = sellerOrderGoodsMapper.selectByPrimaryKey(preSkup);
if(SellerGoodsHelper.isImperfectGoods(prePsog.getAttributes())) {
productProxyService.cloneImperfectGoods(preSkup, currentSkup);
}
logger.info("in processAfterChangePriceOrderPaid cancel pre-SellerOrder , uid {} orderCode {} preOrderCode {}",
uid, orderCode, preOrderCode);
sellerOrderCancelService.cancelSellerOrder(uid, preOrderCode);
... ... @@ -209,11 +214,7 @@ 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);
}
}
... ...
... ... @@ -9,6 +9,7 @@ import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.product.SecondhandFlawMapper;
import com.yohoufo.dal.product.SecondhandImagesMapper;
import com.yohoufo.dal.product.SecondhandInfoMapper;
import com.yohoufo.dal.product.StoragePriceMapper;
import com.yohoufo.dal.product.model.SecondhandFlaw;
import com.yohoufo.dal.product.model.SecondhandImages;
import com.yohoufo.dal.product.model.SecondhandInfo;
... ... @@ -44,6 +45,9 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
@Autowired
private ProductService productService;
@Autowired
private StoragePriceMapper storagePriceMapper;
@Override
public List<SecondhandFlaw> queryFlawListByType(Integer type) {
return secondhandFlawMapper.selectByType(type);
... ... @@ -113,6 +117,10 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
@Override
public int copySkupInfo(Integer oldSkup, Integer newSkup) {
//copy old skup status 2 new skup
//TODO 如何保证原子性,其实从整个业务场景来看也不能保证
storagePriceMapper.updateOneStatusByeAnothers(oldSkup, newSkup);
SecondhandInfo oldInfo = secondhandInfoMapper.selectBySkup(oldSkup);
if(null == oldInfo) {
return 0;
... ...