Merge remote-tracking branch 'origin/master'
| | |
| | | private Integer vipId; |
| | | |
| | | @ApiModelProperty(value = "指定购买后升级商品的json快照") |
| | | @TableField("good_id") |
| | | private Integer goodId; |
| | | @TableField("good_json") |
| | | private String good_json; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public R<GoodsVip> getGoodsVip(Integer vip) { |
| | | public R<GoodsVip> getGoodsVip(Integer goodsId, Integer vip) { |
| | | return R.fail("获取会员价格配置失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/goods-vip/getGoodsVip") |
| | | R<GoodsVip> getGoodsVip(@RequestParam("vip") Integer vip); |
| | | R<GoodsVip> getGoodsVip(@RequestParam("goodsId") Integer goodsId, @RequestParam("vip") Integer vip); |
| | | } |
| | |
| | | import com.ruoyi.other.api.factory.PointSettingClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | @FeignClient(contextId = "PointSettingClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = PointSettingClientFallbackFactory.class) |
| | | public interface PointSettingClient { |
| | | |
| | | @GetMapping("/point-setting/getPointSetting") |
| | | @PostMapping("/point-setting/getPointSetting") |
| | | R<PointSetting> getPointSetting(@RequestParam("id") Integer id); |
| | | } |
| | |
| | | import com.ruoyi.other.api.factory.VipGoodClientFallbackFactory; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | |
| | | @FeignClient(contextId = "VipGoodClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = VipGoodClientFallbackFactory.class) |
| | | public interface VipGoodClient { |
| | | |
| | | @GetMapping("/vip-good/getVipGoodsByVipId") |
| | | @PostMapping("/vip-good/getVipGoodsByVipId") |
| | | R<List<VipGood>> getVipGoodsByVipId(@RequestParam("vipId") Integer vipId); |
| | | |
| | | @GetMapping("/vip-setting/getVipSettingById") |
| | | @PostMapping("/vip-setting/getVipSettingById1") |
| | | R<VipSetting> getVipSettingById(@RequestParam("id") Integer id); |
| | | } |
| | |
| | | package com.ruoyi.account.controller; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.account.service.VipCenterService; |
| | | import com.ruoyi.account.service.VipSettingService; |
| | |
| | | if (vipGoodList != null && !vipGoodList.isEmpty()) { |
| | | List<String> goodsNames = new ArrayList<>(); |
| | | vipGoodList.forEach(vipGood -> { |
| | | Integer goodId = vipGood.getGoodId(); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(goodId); |
| | | if (R.isError(goodsR)) { |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); |
| | | goodsNames.add(goods.getName()); |
| | | }); |
| | | level.setGoodsNames(goodsNames); |
| | |
| | | private Map<Integer, R<GoodsVip>> getGoodsVips(List<Integer> vipIds) { |
| | | Map<Integer, R<GoodsVip>> result = new HashMap<>(); |
| | | for (Integer vipId : vipIds) { |
| | | R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(vipId); |
| | | R<GoodsVip> goodsVipR = goodsVipClient.getGoodsVip(null, vipId); |
| | | result.put(vipId, goodsVipR); |
| | | } |
| | | return result; |
| | |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS.optional; |
| | | import static sun.plugin.util.ProgressMonitor.get; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | code += Double.valueOf(Math.random() * 10).intValue(); |
| | | } |
| | | SMSUtil.sendSms("[\"" + code + "\"]", smsCode.getPhone(), "8824121211029", "39533d100b2b4aee8ed198aa49fe99dd"); |
| | | redisService.setCacheObject(smsCode.getPhone(), code, 300L, TimeUnit.SECONDS); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | Region region = regionClient.getRegionBiCode(citycode).getData(); |
| | | appUser.setDistrict(region.getName()); |
| | | appUser.setDistrictCode(citycode); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 3) + "00").getData(); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 4) + "00").getData(); |
| | | appUser.setCity(region.getName()); |
| | | appUser.setCityCode(region.getCode()); |
| | | region = regionClient.getRegionBiCode(citycode.substring(0, 2) + "0000").getData(); |
| | |
| | | } |
| | | |
| | | public AppUser getTopAppUser(List<AppUser> list, Long id){ |
| | | AppUser appUser = list.stream().filter(s -> s.getId().equals(id)).findFirst().get(); |
| | | if(null == appUser.getInviteUserId()){ |
| | | Optional<AppUser> first = list.stream().filter(s -> s.getId().equals(id)).findFirst(); |
| | | AppUser appUser = null; |
| | | if(first.isPresent()){ |
| | | appUser = first.get(); |
| | | }else{ |
| | | return this.getById(1); |
| | | } |
| | | if( null == appUser.getInviteUserId()){ |
| | | return appUser; |
| | | } |
| | | return getTopAppUser(list, appUser.getInviteUserId()); |
| | |
| | | public List<AppUser> getSubordinate(List<AppUser> list, List<Long> ids, List<AppUser> result){ |
| | | List<Long> idss = new ArrayList<>(); |
| | | for (Long id : ids) { |
| | | List<AppUser> collect = list.stream().filter(s -> s.getInviteUserId().equals(id)).collect(Collectors.toList()); |
| | | List<AppUser> collect = list.stream().filter(s -> null != s.getInviteUserId() && s.getInviteUserId().equals(id)).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return result; |
| | | }else{ |
| | |
| | | //使用地图获取省市区数据 |
| | | String citycode = TencentMapUtil.inverseGeographicalAnalysis(nearbyReferrer.getLongitude(), nearbyReferrer.getLatitude(), false); |
| | | if(null != citycode){ |
| | | String cityCode = citycode.substring(0, 3) + "00"; |
| | | String cityCode = citycode.substring(0, 4) + "00"; |
| | | List<NearbyReferrerVo> list = this.baseMapper.getNearbyReferrer(cityCode, nearbyReferrer); |
| | | return list; |
| | | } |
| | |
| | | package com.ruoyi.account.service.impl; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.account.api.model.AppUser; |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | Integer goodId = vipGood.getGoodId(); |
| | | R<Goods> goodsR = goodsClient.getGoodsById(goodId); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | R<Goods> goodsR = goodsClient.getGoodsById(vipGood.getGoodId()); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | |
| | | Goods goods = goodsR.getData(); |
| | | Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | |
| | | List<VipGood> vipGoods = vipGoodsByVipId.getData(); |
| | | if (CollectionUtil.isNotEmpty(vipGoods)){ |
| | | for (VipGood vipGood : vipGoods) { |
| | | R<Goods> goodsR = goodsClient.getGoodsById(vipGood.getGoodId()); |
| | | if (R.isError(goodsR)){ |
| | | throw new ServiceException("商品信息获取失败"); |
| | | } |
| | | Goods goods = goodsR.getData(); |
| | | Goods goods = JSON.parseObject(vipGood.getGood_json(), Goods.class); |
| | | R<List<Order>> orderListByUserIdAndGoodsId = remoteOrderGoodsClient.getOrderListByUserIdAndGoodsId(userId, goods.getId()); |
| | | if (R.isSuccess(orderListByUserIdAndGoodsId)){ |
| | | List<Order> orderList = orderListByUserIdAndGoodsId.getData(); |
| | |
| | | GoodsArea goodsArea = goodsAreaClient.getGoodsArea(area).getData(); |
| | | if(null == goodsArea){ |
| | | //没有地区价格,则使用会员价格 |
| | | GoodsVip goodsVip = goodsVipClient.getGoodsVip(appUser.getVipId()).getData(); |
| | | GoodsVip goodsVip = goodsVipClient.getGoodsVip(goodsId, appUser.getVipId()).getData(); |
| | | if(null == goodsVip){ |
| | | //没有配置价格,直接使用原始基础价格 |
| | | return null; |
| | |
| | | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/addGoodsBargainPrice/{id}") |
| | | @PostMapping("/addGoodsBargainPrice") |
| | | @ApiOperation(value = "保存商品特殊售价", tags = {"门店后台-商品管理"}) |
| | | public R addGoodsBargainPrice(@RequestBody AddGoodsBargainPriceVo vo){ |
| | | return goodsBargainPriceService.addGoodsBargainPrice(vo); |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/getGoodsVip") |
| | | public R<GoodsVip> getGoodsVip(@RequestParam("vip") Integer vip){ |
| | | GoodsVip one = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>().eq(GoodsVip::getVip, vip)); |
| | | public R<GoodsVip> getGoodsVip(@RequestParam("goodsId") Integer goodsId, @RequestParam("vip") Integer vip){ |
| | | GoodsVip one = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>().eq(GoodsVip::getGoodsId, goodsId).eq(GoodsVip::getVip, vip)); |
| | | return R.ok(one); |
| | | } |
| | | |
| | |
| | | @Resource |
| | | private PointSettingService pointSettingService; |
| | | |
| | | |
| | | @PostMapping("/getPointSetting") |
| | | public R<PointSetting> getPointSetting(@RequestParam("id") Integer id) { |
| | | PointSetting pointSetting = pointSettingService.getById(id); |
| | | return R.ok(pointSetting); |
| | | } |
| | | |
| | | @GetMapping("/getBaseSetting") |
| | | public R<PointSetting> getBaseSetting(@RequestParam Integer id) { |
| | | PointSetting pointSetting = pointSettingService.getById(id); |
| | |
| | | import com.ruoyi.common.core.web.controller.BaseController; |
| | | import com.ruoyi.other.api.domain.VipGood; |
| | | import com.ruoyi.other.service.VipGoodService; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | |
| | | @Resource |
| | | private VipGoodService vipGoodService; |
| | | |
| | | @GetMapping("getVipGoodsByVipId") |
| | | @PostMapping("getVipGoodsByVipId") |
| | | public R<List<VipGood>> getVipGoodsByVipId(@RequestParam("vipId") Integer vipId){ |
| | | return R.ok(vipGoodService.list(new LambdaQueryWrapper<VipGood>() |
| | | .eq(VipGood::getVipId, vipId))); |
| | |
| | | } |
| | | |
| | | |
| | | @PostMapping("getVipSettingById1") |
| | | public R<VipSetting> getVipSettingById1(@RequestParam("id") Integer id) { |
| | | return R.ok(vipSettingService.getById(id)); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询会员配置 |
| | | * @param id |
| | |
| | | bargainPrice.setDelFlag(0); |
| | | bargainPrice.setCreateTime(LocalDateTime.now()); |
| | | bargainPrice.setCreateUserId(userid); |
| | | this.updateById(bargainPrice); |
| | | this.save(bargainPrice); |
| | | //添加明细 |
| | | List<GoodsBargainPriceDetail> list = vo.getList(); |
| | | for (GoodsBargainPriceDetail goodsBargainPriceDetail : list) { |
| | |
| | | goodsVO.setGoodsId(goods.getId()); |
| | | goodsVO.setGoodsName(goods.getName()); |
| | | R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getId(), null); |
| | | if (R.isSuccess(r)){ |
| | | if (null != r.getData()){ |
| | | Price price = r.getData(); |
| | | goodsVO.setSellingPrice(price.getCash()); |
| | | goodsVO.setIntegral(price.getPoint()); |
| | |
| | | |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | BigDecimal sellingPrice; |
| | | Integer integral; |
| | | BigDecimal sellingPrice = BigDecimal.ZERO; |
| | | Integer integral = 0; |
| | | |
| | | GoodsArea goodsArea = goodsAreaMapper.selectOne(new LambdaQueryWrapper<GoodsArea>() |
| | | .eq(GoodsArea::getGoodsId, goodsId) |
| | |
| | | GoodsVip goodsVip = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>() |
| | | .eq(GoodsVip::getVip, vipSetting.getId()) |
| | | .eq(GoodsVip::getGoodsId, goodsId)); |
| | | |
| | | sellingPrice = goodsVip.getSellingPrice(); |
| | | integral = goodsVip.getIntegral(); |
| | | if(null != goodsVip){ |
| | | sellingPrice = goodsVip.getSellingPrice(); |
| | | integral = goodsVip.getIntegral(); |
| | | } |
| | | } |
| | | |
| | | Goods goods = this.getById(goodsId); |
| | |
| | | |
| | | @Override |
| | | public List<SeckillActivityVO> listSeckillActivity(Goods goods) { |
| | | LoginUser loginUserApplet = tokenService.getLoginUser(); |
| | | LoginUser loginUserApplet = tokenService.getLoginUserApplet(); |
| | | AppUser appUser = appUserClient.getAppUserById(loginUserApplet.getUserid()); |
| | | goods.setVipId(appUser.getVipId()); |
| | | return seckillActivityInfoMapper.listSeckillActivity(goods); |