Authored by Lixiaodi

bug修改

@@ -11,11 +11,13 @@ import java.util.function.BinaryOperator; @@ -11,11 +11,13 @@ import java.util.function.BinaryOperator;
11 import java.util.function.Function; 11 import java.util.function.Function;
12 import java.util.stream.Collectors; 12 import java.util.stream.Collectors;
13 13
  14 +import com.yoho.core.dal.datasource.annotation.Database;
14 import org.apache.commons.lang3.StringUtils; 15 import org.apache.commons.lang3.StringUtils;
15 import org.slf4j.Logger; 16 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 17 import org.slf4j.LoggerFactory;
17 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
  20 +import org.springframework.transaction.annotation.Transactional;
19 import org.springframework.util.CollectionUtils; 21 import org.springframework.util.CollectionUtils;
20 22
21 import com.yoho.core.common.helpers.ImagesHelper; 23 import com.yoho.core.common.helpers.ImagesHelper;
@@ -254,18 +256,10 @@ public class ProductServiceImpl implements ProductService{ @@ -254,18 +256,10 @@ public class ProductServiceImpl implements ProductService{
254 throw new ServiceException(400, "商品(skup)不存在:" + skup); 256 throw new ServiceException(400, "商品(skup)不存在:" + skup);
255 } 257 }
256 258
257 - if (sp.getStatus() == null) {  
258 - throw new ServiceException(400, "商品(skup)状态异常:" + sp.getStatus());  
259 - }  
260 - if(status == 4) {  
261 - if (sp.getStatus() == 0) {  
262 - throw new ServiceException(400, "商品(skup)状态异常:" + sp.getStatus());  
263 - }  
264 - } else {  
265 - if (sp.getStatus() != 0) { 259 + int expectedStatus = (status == 4) ? 1 : 0;
  260 + if (sp.getStatus() == null || sp.getStatus() != expectedStatus) {
266 throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus()); 261 throw new ServiceException(400, "商品(skup)状态已变更:" + sp.getStatus());
267 } 262 }
268 - }  
269 263
270 // 使其可售 264 // 使其可售
271 if (status == 1) { 265 if (status == 1) {