|
|
@@ -171,20 +171,17 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public Result selectGoodsList(Long shopId, Double lng, Double lat,Integer page, Integer limit) {
|
|
|
+ public Result selectGoodsList(Long shopId, Double lng, Double lat) {
|
|
|
GoodsShop goodsShop = goodsShopDao.selectGoodsList(shopId, lng, lat);
|
|
|
//List<Goods> goodsList = goodsDao.selectGoodsClassifyList(shopId);
|
|
|
- Page<GoodsClassify> pages = new Page<>(page,limit);
|
|
|
- IPage<GoodsClassify> goodsClassifyIPage = goodsDao.selectAllClassify(pages,null, shopId);
|
|
|
-// List<GoodsClassify> goodsClassifyIPage = goodsDao.selectAllClassifyList(null, shopId);
|
|
|
+ List<GoodsClassify> goodsClassifies = goodsDao.selectAllClassifyList(null, shopId);
|
|
|
|
|
|
- List<GoodsClassify> goodsClassifies = goodsClassifyIPage.getRecords();
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
for (int i = 0; i < goodsClassifies.size(); i++) {
|
|
|
Map<String, Object> hashMap = new HashMap<>();
|
|
|
GoodsClassify goodsClassify = goodsClassifies.get(i);
|
|
|
-// List<Goods> goodsList1 = goodsDao.selectGoodsByClassify(goodsClassify.getClassifyId(), shopId);
|
|
|
- List<GoodsListVo> goodsList1 = goodsDao.selectGoodsVoByClassify(goodsClassify.getClassifyId(), shopId);
|
|
|
+ List<Goods> goodsList1 = goodsDao.selectGoodsByClassify(goodsClassify.getClassifyId(), shopId);
|
|
|
+// List<GoodsListVo> goodsList1 = goodsDao.selectGoodsVoByClassify(goodsClassify.getClassifyId(), shopId);
|
|
|
hashMap.put("classifyId", goodsClassifies.get(i).getClassifyId());
|
|
|
hashMap.put("classifyName", goodsClassify.getClassifyName());
|
|
|
hashMap.put("goodsList", goodsList1);
|
|
|
@@ -203,10 +200,6 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("goodsShop", goodsShop);
|
|
|
result.put("list", list);
|
|
|
- result.put("pages", goodsClassifyIPage.getPages());
|
|
|
- result.put("current", goodsClassifyIPage.getCurrent());
|
|
|
- result.put("size", goodsClassifyIPage.getSize());
|
|
|
- result.put("total", goodsClassifyIPage.getTotal());
|
|
|
return Result.success().put("data", result);
|
|
|
}
|
|
|
|
|
|
@@ -883,4 +876,33 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsDao, Goods> implements Go
|
|
|
return Result.success().put("data", pageUtils);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result selectGoodsClassifyList(Long shopId, Double lng, Double lat) {
|
|
|
+ GoodsShop goodsShop = goodsShopDao.selectGoodsList(shopId, lng, lat);
|
|
|
+ //List<Goods> goodsList = goodsDao.selectGoodsClassifyList(shopId);
|
|
|
+ List<GoodsClassify> goodsClassifies = goodsDao.selectAllClassifyList(null, shopId);
|
|
|
+
|
|
|
+ CommonInfo one = commonInfoService.findOne(292);
|
|
|
+ CommonInfo one1 = commonInfoService.findOne(293);
|
|
|
+ if (goodsShop.getDistance() == null) {
|
|
|
+ goodsShop.setDistance(0.00);
|
|
|
+ }
|
|
|
+ BigDecimal a = BigDecimal.valueOf(goodsShop.getDistance()).divide(new BigDecimal(one.getValue()), 2, BigDecimal.ROUND_HALF_DOWN);
|
|
|
+ if (a.doubleValue() < Double.parseDouble(one1.getValue())) {
|
|
|
+ a = new BigDecimal(one1.getValue());
|
|
|
+ }
|
|
|
+ goodsShop.setErrandTime(a.doubleValue());
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("goodsShop", goodsShop);
|
|
|
+ result.put("list", goodsClassifies);
|
|
|
+ return Result.success().put("data", result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result selectSupermarketGoodsList(Long shopId, Integer classifyId, Integer page, Integer limit) {
|
|
|
+ Page<Goods> pages = new Page<>(page, limit);
|
|
|
+ IPage<Goods> goodsIPage = goodsDao.selectSupermarketGoodsList(pages,shopId, classifyId);
|
|
|
+ return Result.success().put("data", goodsIPage);
|
|
|
+ }
|
|
|
+
|
|
|
}
|