|
@@ -34,20 +34,22 @@ public class ProductServiceImpl implements ProductService {
|
|
|
@Override
|
|
|
public ProductDetail getProductDetailById(Integer productId) {
|
|
|
ProductDetail product = productDao.getProductDetailById(productId);
|
|
|
- if(!StringUtil.isNullOrEmpty(product.getTags())){
|
|
|
- product.setTagList(product.getTags().split(","));
|
|
|
- }
|
|
|
- // 价格等级
|
|
|
- if (product.getPrice() > 50 * 5000) {
|
|
|
- product.setPriceGrade(5);
|
|
|
- } else if (product.getPrice() > 25 * 5000) {
|
|
|
- product.setPriceGrade(4);
|
|
|
- } else if (product.getPrice() > 10 * 5000) {
|
|
|
- product.setPriceGrade(3);
|
|
|
- } else if (product.getPrice() > 2.5 * 5000) {
|
|
|
- product.setPriceGrade(2);
|
|
|
- } else {
|
|
|
- product.setPriceGrade(1);
|
|
|
+ if (null != product){
|
|
|
+ if (!StringUtil.isNullOrEmpty(product.getTags())) {
|
|
|
+ product.setTagList(product.getTags().split(","));
|
|
|
+ }
|
|
|
+ // 价格等级
|
|
|
+ if (product.getPrice() > 50 * 5000) {
|
|
|
+ product.setPriceGrade(5);
|
|
|
+ } else if (product.getPrice() > 25 * 5000) {
|
|
|
+ product.setPriceGrade(4);
|
|
|
+ } else if (product.getPrice() > 10 * 5000) {
|
|
|
+ product.setPriceGrade(3);
|
|
|
+ } else if (product.getPrice() > 2.5 * 5000) {
|
|
|
+ product.setPriceGrade(2);
|
|
|
+ } else {
|
|
|
+ product.setPriceGrade(1);
|
|
|
+ }
|
|
|
}
|
|
|
return product;
|
|
|
}
|