Authored by chenchao

copy old skup status 2 new one

@@ -76,4 +76,7 @@ public interface StoragePriceMapper { @@ -76,4 +76,7 @@ public interface StoragePriceMapper {
76 BigDecimal selectInStockLeastPriceByProductId(@Param("storageId") Integer storageId); 76 BigDecimal selectInStockLeastPriceByProductId(@Param("storageId") Integer storageId);
77 77
78 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status); 78 int updateOneSkupHideStatus(@Param("skup") Integer skup, @Param("status") int status);
  79 +
  80 +
  81 + int updateOneStatusByeAnothers(@Param("oldskup") Integer oldskup, @Param("newskup") Integer newskup);
79 } 82 }
@@ -232,4 +232,10 @@ @@ -232,4 +232,10 @@
232 where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6) 232 where storage_id =#{storageId} and status in(1,100) and is_hide = 0 and pre_sale_flag in (5,6)
233 </select> 233 </select>
234 234
  235 +
  236 + <update id="updateOneStatusByeAnothers">
  237 + update storage_price a,storage_price b set a.status = b.status where
  238 + a.skup = #{newskup,jdbcType=INTEGER} and b.skup = #{oldskup,jdbcType=INTEGER}
  239 + </update>
  240 +
235 </mapper> 241 </mapper>
@@ -201,6 +201,11 @@ public class SingleGoodsChangePriceService { @@ -201,6 +201,11 @@ public class SingleGoodsChangePriceService {
201 final Integer preSkup = scpr.getPreSkup(), currentSkup = scpr.getSkup(); 201 final Integer preSkup = scpr.getPreSkup(), currentSkup = scpr.getSkup();
202 long preOrderCode = scpr.getPreOrderCode(); 202 long preOrderCode = scpr.getPreOrderCode();
203 try { 203 try {
  204 + //sync prd copy data when goods is imperfect
  205 + SellerOrderGoods prePsog = sellerOrderGoodsMapper.selectByPrimaryKey(preSkup);
  206 + if(SellerGoodsHelper.isImperfectGoods(prePsog.getAttributes())) {
  207 + productProxyService.cloneImperfectGoods(preSkup, currentSkup);
  208 + }
204 logger.info("in processAfterChangePriceOrderPaid cancel pre-SellerOrder , uid {} orderCode {} preOrderCode {}", 209 logger.info("in processAfterChangePriceOrderPaid cancel pre-SellerOrder , uid {} orderCode {} preOrderCode {}",
205 uid, orderCode, preOrderCode); 210 uid, orderCode, preOrderCode);
206 sellerOrderCancelService.cancelSellerOrder(uid, preOrderCode); 211 sellerOrderCancelService.cancelSellerOrder(uid, preOrderCode);
@@ -209,11 +214,7 @@ public class SingleGoodsChangePriceService { @@ -209,11 +214,7 @@ public class SingleGoodsChangePriceService {
209 uid, orderCode, preOrderCode, ex); 214 uid, orderCode, preOrderCode, ex);
210 rollBackWherPaidCallBackFail(uid, orderCode); 215 rollBackWherPaidCallBackFail(uid, orderCode);
211 }finally { 216 }finally {
212 - //sync prd copy data when goods is imperfect  
213 - SellerOrderGoods prePsog = sellerOrderGoodsMapper.selectByPrimaryKey(preSkup);  
214 - if(SellerGoodsHelper.isImperfectGoods(prePsog.getAttributes())) {  
215 - productProxyService.cloneImperfectGoods(preSkup, currentSkup);  
216 - } 217 +
217 productProxyService.cancelHiddenSkup(preSkup); 218 productProxyService.cancelHiddenSkup(preSkup);
218 } 219 }
219 } 220 }
@@ -9,6 +9,7 @@ import com.yohoufo.common.helper.ImageUrlAssist; @@ -9,6 +9,7 @@ import com.yohoufo.common.helper.ImageUrlAssist;
9 import com.yohoufo.dal.product.SecondhandFlawMapper; 9 import com.yohoufo.dal.product.SecondhandFlawMapper;
10 import com.yohoufo.dal.product.SecondhandImagesMapper; 10 import com.yohoufo.dal.product.SecondhandImagesMapper;
11 import com.yohoufo.dal.product.SecondhandInfoMapper; 11 import com.yohoufo.dal.product.SecondhandInfoMapper;
  12 +import com.yohoufo.dal.product.StoragePriceMapper;
12 import com.yohoufo.dal.product.model.SecondhandFlaw; 13 import com.yohoufo.dal.product.model.SecondhandFlaw;
13 import com.yohoufo.dal.product.model.SecondhandImages; 14 import com.yohoufo.dal.product.model.SecondhandImages;
14 import com.yohoufo.dal.product.model.SecondhandInfo; 15 import com.yohoufo.dal.product.model.SecondhandInfo;
@@ -44,6 +45,9 @@ public class SecondhandProductServiceImpl implements SecondhandProductService { @@ -44,6 +45,9 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
44 @Autowired 45 @Autowired
45 private ProductService productService; 46 private ProductService productService;
46 47
  48 + @Autowired
  49 + private StoragePriceMapper storagePriceMapper;
  50 +
47 @Override 51 @Override
48 public List<SecondhandFlaw> queryFlawListByType(Integer type) { 52 public List<SecondhandFlaw> queryFlawListByType(Integer type) {
49 return secondhandFlawMapper.selectByType(type); 53 return secondhandFlawMapper.selectByType(type);
@@ -113,6 +117,10 @@ public class SecondhandProductServiceImpl implements SecondhandProductService { @@ -113,6 +117,10 @@ public class SecondhandProductServiceImpl implements SecondhandProductService {
113 117
114 @Override 118 @Override
115 public int copySkupInfo(Integer oldSkup, Integer newSkup) { 119 public int copySkupInfo(Integer oldSkup, Integer newSkup) {
  120 + //copy old skup status 2 new skup
  121 + //TODO 如何保证原子性,其实从整个业务场景来看也不能保证
  122 + storagePriceMapper.updateOneStatusByeAnothers(oldSkup, newSkup);
  123 +
116 SecondhandInfo oldInfo = secondhandInfoMapper.selectBySkup(oldSkup); 124 SecondhandInfo oldInfo = secondhandInfoMapper.selectBySkup(oldSkup);
117 if(null == oldInfo) { 125 if(null == oldInfo) {
118 return 0; 126 return 0;