|
@@ -7,7 +7,9 @@ import com.caimei.www.mapper.BaikeDao;
|
|
import com.caimei.www.mapper.ProductDao;
|
|
import com.caimei.www.mapper.ProductDao;
|
|
import com.caimei.www.pojo.JsonModel;
|
|
import com.caimei.www.pojo.JsonModel;
|
|
import com.caimei.www.pojo.baike.*;
|
|
import com.caimei.www.pojo.baike.*;
|
|
|
|
+import com.caimei.www.pojo.page.Parameter;
|
|
import com.caimei.www.pojo.page.ProductDetail;
|
|
import com.caimei.www.pojo.page.ProductDetail;
|
|
|
|
+import com.caimei.www.pojo.page.ProductList;
|
|
import com.caimei.www.service.page.ProductService;
|
|
import com.caimei.www.service.page.ProductService;
|
|
import com.caimei.www.utils.ImageUtil;
|
|
import com.caimei.www.utils.ImageUtil;
|
|
import com.caimei.www.utils.PriceUtil;
|
|
import com.caimei.www.utils.PriceUtil;
|
|
@@ -69,14 +71,14 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getTypeClassifyJson(Integer typeSort) {
|
|
public JSONArray getTypeClassifyJson(Integer typeSort) {
|
|
- String dataUrl = coreServer+"/commodity/classify?typeSort="+typeSort+"&source=www";
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/classify?typeSort=" + typeSort + "&source=www";
|
|
try {
|
|
try {
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(classifyResult);
|
|
log.debug(classifyResult);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
return (JSONArray) classifyMap.get("data");
|
|
return (JSONArray) classifyMap.get("data");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -88,14 +90,14 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> getTypeFloorJson(Integer pageId) {
|
|
public Map<String, Object> getTypeFloorJson(Integer pageId) {
|
|
- String dataUrl = coreServer+"/commodity/classify/product?pageId="+ pageId +"&source=1";
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/classify/product?pageId=" + pageId + "&source=1";
|
|
try {
|
|
try {
|
|
String floorResult = RequestUtil.sendGet(dataUrl);
|
|
String floorResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(floorResult);
|
|
log.debug(floorResult);
|
|
Map<String, Object> floorMap = JSONObject.parseObject(floorResult, Map.class);
|
|
Map<String, Object> floorMap = JSONObject.parseObject(floorResult, Map.class);
|
|
return JSONObject.parseObject(String.valueOf(floorMap.get("data")), Map.class);
|
|
return JSONObject.parseObject(String.valueOf(floorMap.get("data")), Map.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -107,14 +109,14 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getBigTypeJson(Integer typeSort) {
|
|
public JSONArray getBigTypeJson(Integer typeSort) {
|
|
- String dataUrl = coreServer+"/commodity/type/first?typeSort="+typeSort;
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/type/first?typeSort=" + typeSort;
|
|
try {
|
|
try {
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(classifyResult);
|
|
log.debug(classifyResult);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
return (JSONArray) classifyMap.get("data");
|
|
return (JSONArray) classifyMap.get("data");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -126,14 +128,14 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getSmallTypeJson(Integer bigTypeId) {
|
|
public JSONArray getSmallTypeJson(Integer bigTypeId) {
|
|
- String dataUrl = coreServer+"/commodity/type/second?bigTypeId="+bigTypeId;
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/type/second?bigTypeId=" + bigTypeId;
|
|
try {
|
|
try {
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(classifyResult);
|
|
log.debug(classifyResult);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
return (JSONArray) classifyMap.get("data");
|
|
return (JSONArray) classifyMap.get("data");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -146,14 +148,14 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getTinyTypeJson(Integer smallTypeId) {
|
|
public JSONArray getTinyTypeJson(Integer smallTypeId) {
|
|
- String dataUrl = coreServer+"/commodity/type/third?smallTypeId="+smallTypeId;
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/type/third?smallTypeId=" + smallTypeId;
|
|
try {
|
|
try {
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
String classifyResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(classifyResult);
|
|
log.debug(classifyResult);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
return (JSONArray) classifyMap.get("data");
|
|
return (JSONArray) classifyMap.get("data");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -165,7 +167,7 @@ public class ProductServiceImpl implements ProductService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONObject getProductListJson(String params) {
|
|
public JSONObject getProductListJson(String params) {
|
|
- String dataUrl = coreServer+"/commodity/search/query/product/type"+params;
|
|
|
|
|
|
+ String dataUrl = coreServer + "/commodity/search/query/product/type" + params;
|
|
try {
|
|
try {
|
|
String productResult = RequestUtil.sendGet(dataUrl);
|
|
String productResult = RequestUtil.sendGet(dataUrl);
|
|
log.debug(productResult);
|
|
log.debug(productResult);
|
|
@@ -173,7 +175,7 @@ public class ProductServiceImpl implements ProductService {
|
|
String data = (String) productMap.get("data");
|
|
String data = (String) productMap.get("data");
|
|
return JSONObject.parseObject(data);
|
|
return JSONObject.parseObject(data);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -187,7 +189,7 @@ public class ProductServiceImpl implements ProductService {
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
Map<String, Object> classifyMap = JSONObject.parseObject(classifyResult, Map.class);
|
|
return (JSONArray) classifyMap.get("data");
|
|
return (JSONArray) classifyMap.get("data");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -201,7 +203,7 @@ public class ProductServiceImpl implements ProductService {
|
|
Map<String, Object> moreMap = JSONObject.parseObject(moreResult, Map.class);
|
|
Map<String, Object> moreMap = JSONObject.parseObject(moreResult, Map.class);
|
|
return JSONObject.parseObject(String.valueOf(moreMap.get("data")), Map.class);
|
|
return JSONObject.parseObject(String.valueOf(moreMap.get("data")), Map.class);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- log.error("try-catch:",e);
|
|
|
|
|
|
+ log.error("try-catch:", e);
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -211,6 +213,42 @@ public class ProductServiceImpl implements ProductService {
|
|
return baikeDao.getBaikeType(typeId);
|
|
return baikeDao.getBaikeType(typeId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<String> getImages(Integer productId) {
|
|
|
|
+ List<String> productDetailImages = productDao.getProductDetailImages(productId);
|
|
|
|
+ List<String> strings = new ArrayList<>();
|
|
|
|
+ if (null != productDetailImages && productDetailImages.size() > 0) {
|
|
|
|
+ productDetailImages.forEach(p -> {
|
|
|
|
+ strings.add(ImageUtil.getImageURL("product", p, 0, domain));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return strings;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Parameter> getParams(Integer productId) {
|
|
|
|
+ return productDao.getProductParameters(productId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<ProductList> getProductLists(Integer productId) {
|
|
|
|
+ //取不到userId,默认游客 商品可见度默认所有人
|
|
|
|
+ Integer recommendType = productDao.getRecommendType(productId);
|
|
|
|
+ List<ProductList> list = null;
|
|
|
|
+ if (null != recommendType && 1 == recommendType) {
|
|
|
|
+ list = productDao.getProductRecommendsById(productId);
|
|
|
|
+ } else {
|
|
|
|
+ list = productDao.getAutoProductRecommends(productId);
|
|
|
|
+ }
|
|
|
|
+ if (null != list && list.size() > 0) {
|
|
|
|
+ list.forEach(product -> {
|
|
|
|
+ // 设置 图片路径
|
|
|
|
+ product.setImage(ImageUtil.getImageURL("product", product.getImage(), 0, domain));
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public BaikeProduct getBaikeProductDetail(Integer productId) {
|
|
public BaikeProduct getBaikeProductDetail(Integer productId) {
|
|
BaikeProduct baikeProduct = baikeDao.getBaikeProductDetail(productId);
|
|
BaikeProduct baikeProduct = baikeDao.getBaikeProductDetail(productId);
|
|
@@ -241,8 +279,8 @@ public class ProductServiceImpl implements ProductService {
|
|
List<BaikeProductQuestion> questionList = baikeDao.findQuestionList(productId);
|
|
List<BaikeProductQuestion> questionList = baikeDao.findQuestionList(productId);
|
|
baikeProduct.setQuestionList(questionList);
|
|
baikeProduct.setQuestionList(questionList);
|
|
// 视频列表
|
|
// 视频列表
|
|
- List<BaikeProductFile> videoList = baikeDao.findVideoList(productId);
|
|
|
|
- baikeProduct.setVideoList(videoList);
|
|
|
|
|
|
+ /*List<BaikeProductFile> videoList = baikeDao.findVideoList(productId);
|
|
|
|
+ baikeProduct.setVideoList(videoList);*/
|
|
// 格式化时间
|
|
// 格式化时间
|
|
String marketTime = baikeProduct.getMarketTime();
|
|
String marketTime = baikeProduct.getMarketTime();
|
|
String nmpaTime = baikeProduct.getNmpaTime();
|
|
String nmpaTime = baikeProduct.getNmpaTime();
|