| | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.order.feignClient.OrderClient; |
| | | import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; |
| | | import com.ruoyi.order.vo.Price; |
| | | import com.ruoyi.other.api.domain.*; |
| | |
| | | import com.ruoyi.other.mapper.GoodsShopMapper; |
| | | import com.ruoyi.other.mapper.ShopMapper; |
| | | import com.ruoyi.other.service.*; |
| | | import com.ruoyi.other.util.GeodesyUtil; |
| | | import com.ruoyi.other.vo.GoodsVO; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import org.jetbrains.annotations.NotNull; |
| | |
| | | private GoodsBargainPriceService goodsBargainPriceService; |
| | | @Resource |
| | | private GoodsBargainPriceDetailService goodsBargainPriceDetailService; |
| | | @Resource |
| | | private OrderClient orderClient; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName(), vipId); |
| | | for (GoodsVO goods : list) { |
| | | Price price = getPrice(vipId, goods.getGoodsId(), 1, null, provinceCode, cityCode, districtCode); |
| | | Price price = getPrice(vipId, goods.getGoodsId(), null, 1, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | goods.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | goods.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | goods.setSellingPrice(price.getCash()); |
| | | goods.setIntegral(price.getPoint()); |
| | | } |
| | | Integer data = orderClient.getGoodsSaleNum(goods.getGoodsId(), 1).getData(); |
| | | goods.setSaleNum(data); |
| | | } |
| | | return pageInfo.setRecords(list); |
| | | } |
| | | |
| | | @Override |
| | | public GoodsVO goodsDetail(Long goodsId) { |
| | | public GoodsVO goodsDetail(Long goodsId, String longitude, String latitude) { |
| | | if (goodsId == null || goodsId <= 0) { |
| | | throw new NullPointerException("商品ID不能为空"); |
| | | } |
| | |
| | | BeanUtils.copyBeanProp(goodsVO, goods); |
| | | goodsVO.setGoodsId(goods.getId()); |
| | | goodsVO.setGoodsName(goods.getName()); |
| | | Price price = getPrice(vipId, goods.getId(), 1, null, provinceCode, cityCode, districtCode); |
| | | Price price = getPrice(vipId, goods.getId(), null, 1, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | goodsVO.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | goodsVO.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | goodsVO.setSellingPrice(price.getCash()); |
| | | goodsVO.setIntegral(price.getPoint()); |
| | | } |
| | |
| | | .in(Shop::getDelFlag, 0)); |
| | | goodsVO.setShopList(shopList); |
| | | } |
| | | if(StringUtils.isNotEmpty(longitude) && StringUtils.isNotEmpty(latitude)){ |
| | | List<Shop> shopList = goodsVO.getShopList(); |
| | | for (Shop shop : shopList) { |
| | | Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84"); |
| | | shop.setDistance(wgs84); |
| | | } |
| | | shopList.sort(new Comparator<Shop>() { |
| | | @Override |
| | | public int compare(Shop o1, Shop o2) { |
| | | return o1.getDistance().compareTo(o2.getDistance()); |
| | | } |
| | | }); |
| | | goodsVO.setShopList(shopList); |
| | | } |
| | | Integer integer = orderClient.getGoodsSaleNum(goods.getId(), 1).getData(); |
| | | goodsVO.setSaleNum(integer); |
| | | return goodsVO; |
| | | } |
| | | |
| | |
| | | } |
| | | List<Goods> goods = goodsMapper.selectListByShopId(pageInfo, shopId, vipId); |
| | | for (Goods good : goods) { |
| | | Price price = getPrice(vipId, good.getId(), 1, shopId, provinceCode, cityCode, districtCode); |
| | | Price price = getPrice(vipId, good.getId(), shopId, 1, provinceCode, cityCode, districtCode); |
| | | if(null != price){ |
| | | good.setCashPayment(price.getCashPayment() ? 1 : 0); |
| | | good.setPointPayment(price.getPointPayment() ? 1 : 0); |
| | | good.setSellingPrice(price.getCash()); |
| | | good.setIntegral(price.getPoint()); |
| | | } |
| | | Integer data = orderClient.getGoodsSaleNum(good.getId(), 1).getData(); |
| | | good.setSaleNum(data); |
| | | } |
| | | return goods; |
| | | } |
| | |
| | | if (!CollectionUtils.isEmpty(goodsAreaList)){ |
| | | for (GoodsArea goodsArea : goodsAreaList) { |
| | | List<GoodsArea> goodsAreaList1 = goodsArea.getGoodsAreaList(); |
| | | List<GoodsArea> goodsAreaList2 = new ArrayList<>(); |
| | | for (GoodsArea area : goodsAreaList1) { |
| | | area.setId(null); |
| | | area.setGoodsId(id); |
| | |
| | | area.setProvinceCode(goodsArea.getProvinceCode()); |
| | | area.setCityCode(goodsArea.getCityCode()); |
| | | area.setDistrictsCode(goodsArea.getDistrictsCode()); |
| | | if(null != area.getSellingPrice() && null != area.getIntegral()){ |
| | | goodsAreaList2.add(area); |
| | | } |
| | | } |
| | | goodsAreaService.saveBatch(goodsAreaList1); |
| | | goodsAreaService.saveBatch(goodsAreaList2); |
| | | } |
| | | } |
| | | } |