ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -40,6 +40,9 @@ @GetMapping("/appUserShop/shop/{userId}") R<List<AppUserShop>> getAppUserShop(@PathVariable("userId") Long userId); @PostMapping("/appUserShop/addAppUserShop") R<Void> addAppUserShop(@RequestBody AppUserShop appUserShop); /** * 根据用户id获取用户的祖籍列表 */ @@ -53,4 +56,5 @@ @PostMapping("/app-user/getVipCount") R<Long> getVipCount(@RequestParam("userId")Long userId, @RequestParam("vipId") Integer vipId ); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/factory/RemoteOrderGoodsFallbackFactory.java
@@ -2,6 +2,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.vo.Price; import lombok.extern.slf4j.Slf4j; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.OrderGood; @@ -46,6 +47,11 @@ public R<Void> calculationCommission(Set<String> orderIds) { return R.fail("计算佣金失败"); } @Override public R<Price> getGoodsPrice(Long appUserId, Integer goodsId, Integer shopId) { return R.fail("获取商品价格失败"); } }; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/feignClient/RemoteOrderGoodsClient.java
@@ -6,6 +6,7 @@ import com.ruoyi.order.factory.RemoteOrderGoodsFallbackFactory; import com.ruoyi.order.model.Order; import com.ruoyi.order.model.OrderGood; import com.ruoyi.order.vo.Price; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -53,4 +54,7 @@ */ @PostMapping("/commission/calculationCommission") public R<Void> calculationCommission(@RequestBody Set<String> orderIds); @GetMapping("/shopping-cart/getGoodsPrice") public R<Price> getGoodsPrice(@RequestParam("appUserId") Long appUserId, @RequestParam("goodsId") Integer goodsId, @RequestParam("shopId") Integer shopId); } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ApplyRefundPass.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ChargingOrderListInfoVO.java @@ -7,7 +7,6 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; @Data @ApiModel(value = "ChargingOrderListInfoVO对象",description = "充电时段统计列表查看详情VO") ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrder.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ConfirmOrderVo.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/ConfirmOrderVo.java @@ -1,7 +1,6 @@ package com.ruoyi.order.vo; import com.ruoyi.account.api.model.UserAddress; import com.ruoyi.account.api.vo.CouponInfoVo; import com.ruoyi.account.api.vo.PaymentUserCouponVo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/EndOfChargePageInfo.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/MyShoppingCartVo.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderVO.java
File was renamed from ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderVO.java @@ -1,11 +1,9 @@ package com.ruoyi.order.vo; import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; import java.util.List; @Data public class OrderVO { ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/Price.java
New file @@ -0,0 +1,73 @@ package com.ruoyi.order.vo; import lombok.Data; import java.math.BigDecimal; @Data public class Price { /** * 现金 */ private BigDecimal cash; /** * 积分 */ private Integer point; /** * 获取结束时间 */ private Long endTime; /** * 现金支付 */ private Boolean cashPayment; /** * 积分支付 */ private Boolean pointPayment; /** * 可获得消费积分 */ private Integer earnSpendingPoints; /** * 上级获得分佣金额 */ private BigDecimal superiorSubcommission; /** * 上级获得返佣积分 */ private Integer superiorRebatePoints; /** * 获取返佣积分上级类型(1=直推上级,2=直帮上级) */ private Integer superiorType; /** * 核销门店可获得服务费 */ private BigDecimal servuceShopCharges; /** * 核销门店可获得服务积分 */ private Integer servuceShopPoints; /** * 技师可获得服务积分 */ private Integer technicianPoints; /** * 绑定门店可获得分佣金额 */ private BigDecimal boundShopCharges; /** * 绑定门店可获得返佣积分 */ private Integer boundShopPoints; /** * 绑定门店上级门店可获得分佣金额 */ private BigDecimal boundShopSuperiorsCharges; /** * 绑定门店上级门店可获得返佣积分 */ private Integer boundShopSuperiorsPoints; } ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ReplyEvaluationVO.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/SetGoodsNumber.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/ShoppingCartPayment.java
ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/VerifiableShopVo.java
ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -96,27 +96,27 @@ @ApiModelProperty(value = "门店积分总数") @TableField("shop_all_point") private BigDecimal shopAllPoint; private Integer shopAllPoint; @ApiModelProperty(value = "门店业绩积分") @TableField("shop_point") private BigDecimal shopPoint; private Integer shopPoint; @ApiModelProperty(value = "门店返佣积分") @TableField("share_point") private BigDecimal sharePoint; private Integer sharePoint; @ApiModelProperty(value = "门店服务积分") @TableField("server_point") private BigDecimal serverPoint; private Integer serverPoint; @ApiModelProperty(value = "下级门店返佣积分") @TableField("lower_level_rebate_points") private BigDecimal lowerLevelRebatePoints; private Integer lowerLevelRebatePoints; @ApiModelProperty(value = "门店已用积分") @TableField("use_point") private BigDecimal usePoint; private Integer usePoint; @ApiModelProperty(value = "门店分佣总金额") @TableField("giveaway_all_money") @@ -163,5 +163,9 @@ @TableField("create_time") private LocalDateTime createTime; @ApiModelProperty(value = "店长姓名") @TableField(exist = false) private String managerName; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -65,10 +65,6 @@ } @ResponseBody @PostMapping("/appletLogin") @ApiOperation(value = "小程序一键登录") ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java
@@ -20,6 +20,13 @@ @Resource private AppUserShopService appUserShopService; @PostMapping("/addAppUserShop") public R<Void> add(@RequestBody AppUserShop appUserShop) { appUserShopService.save(appUserShop); return R.ok(); } @GetMapping("/shop/{userId}") public R<List<AppUserShop>> getAppUserShop(@PathVariable("userId") Long userId) { return R.ok(appUserShopService.list(new LambdaQueryWrapper<AppUserShop>() ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigInteger; import java.time.LocalDateTime; import java.util.List; ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java
@@ -2,6 +2,8 @@ import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.TableDataInfo; @@ -41,6 +43,8 @@ private GoodsShopClient goodsShopClient; @Resource private ShopClient shopClient; @Resource private AppUserClient appUserClient; @@ -136,6 +140,14 @@ } return R.ok(verifiableShopVoList); } @GetMapping("/getGoodsPrice") public R<Price> getGoodsPrice(Long appUserId, Integer goodsId, Integer shopId){ AppUser appUser = appUserClient.getAppUserById(appUserId); Price price = shoppingCartService.getPrice(appUser, goodsId, shopId); return R.ok(price); } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/RefundPassService.java
@@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.order.model.RefundPass; import com.ruoyi.order.vo.ApplyRefundPass; import org.springframework.web.bind.annotation.RequestBody; /** * <p> ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/ShoppingCartService.java
@@ -1,6 +1,7 @@ package com.ruoyi.order.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.order.model.ShoppingCart; import com.ruoyi.order.vo.*; @@ -47,4 +48,6 @@ * @return */ R shoppingCartPayment(ShoppingCartPayment shoppingCartPayment); Price getPrice(AppUser appUser, Integer goodsId, Integer shopId); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -12,7 +12,6 @@ import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.enums.OrderStatus; import com.ruoyi.order.enums.OrderType; import com.ruoyi.order.mapper.OrderGoodMapper; import com.ruoyi.order.mapper.OrderMapper; import com.ruoyi.order.model.Order; ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -27,7 +27,6 @@ import com.ruoyi.other.api.vo.GetGoodsBargainPrice; import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; import com.ruoyi.other.api.vo.GetSeckillActivityInfo; import lombok.Data; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -35,81 +34,80 @@ import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @Service public class ShoppingCartServiceImpl extends ServiceImpl<ShoppingCartMapper, ShoppingCart> implements ShoppingCartService { @Resource private TokenService tokenService; @Resource private GoodsClient goodsClient; @Resource private GoodsShopClient goodsShopClient; @Resource private AppUserClient appUserClient; @Resource private GoodsAreaClient goodsAreaClient; @Resource private GoodsVipClient goodsVipClient; @Resource private SeckillActivityInfoClient seckillActivityInfoClient; @Resource private GoodsBargainPriceClient goodsBargainPriceClient; @Resource private OrderService orderService; @Resource private OrderGoodService orderGoodService; @Resource private ShopClient shopClient; @Resource private OrderActivityInfoClient orderActivityInfoClient; @Resource private BaseSettingClient baseSettingClient; @Resource private UserAddressClient userAddressClient; @Resource private UserCouponClient userCouponClient; @Resource private SystemConfigClient systemConfigClient; @Resource private UserPointClient userPointClient; @Resource private BalanceChangeRecordClient balanceChangeRecordClient; @Resource private CommissionService commissionService; @Resource private VipSettingClient vipSettingClient; @Resource private UserChangeLogClient userChangeLogClient; /** * 获取购物车列表 * @param type @@ -132,8 +130,8 @@ List<MyShoppingCartVo> page = buildDetail(appUser, shopId, list, null); return page; } /** * 获取支付价格 * @param appUser @@ -155,8 +153,11 @@ GetGoodsBargainPrice goodsBargainPrice = new GetGoodsBargainPrice(); goodsBargainPrice.setGoodsId(goodsId); goodsBargainPrice.setVip(appUser.getVipId()); goodsBargainPrice.setShopId(shopId); GoodsBargainPriceDetail bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData(); GoodsBargainPriceDetail bargainPriceDetail = null; if (shopId != null){ goodsBargainPrice.setShopId(shopId); bargainPriceDetail = goodsBargainPriceClient.getGoodsBargainPrice(goodsBargainPrice).getData(); } if(null == bargainPriceDetail){ //没有门店特价,判断地区价格配置 GoodsArea area = new GoodsArea(); @@ -174,8 +175,8 @@ }else{ price.setCash(goodsVip.getSellingPrice()); price.setPoint(goodsVip.getIntegral()); price.setCashPayment(goodsVip.getCashPayment() == 1 ? true : false); price.setPointPayment(goodsVip.getPointPayment() == 1 ? true : false); price.setCashPayment(goodsVip.getCashPayment() == 1); price.setPointPayment(goodsVip.getPointPayment() == 1); price.setEarnSpendingPoints(goodsVip.getEarnSpendingPoints()); price.setSuperiorSubcommission(goodsVip.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsVip.getSuperiorRebatePoints()); @@ -191,8 +192,8 @@ }else{ price.setCash(goodsArea.getSellingPrice()); price.setPoint(goodsArea.getIntegral()); price.setCashPayment(goodsArea.getCashPayment() == 1 ? true : false); price.setPointPayment(goodsArea.getPointPayment() == 1 ? true : false); price.setCashPayment(goodsArea.getCashPayment() == 1); price.setPointPayment(goodsArea.getPointPayment() == 1); price.setEarnSpendingPoints(goodsArea.getEarnSpendingPoints()); price.setSuperiorSubcommission(goodsArea.getSuperiorSubcommission()); price.setSuperiorRebatePoints(goodsArea.getSuperiorRebatePoints()); @@ -208,8 +209,8 @@ }else{ price.setCash(bargainPriceDetail.getSellingPrice()); price.setPoint(bargainPriceDetail.getIntegral()); price.setCashPayment(bargainPriceDetail.getSellingPrice() != null ? true : false); price.setPointPayment(bargainPriceDetail.getIntegral() != null ? true : false); price.setCashPayment(bargainPriceDetail.getSellingPrice() != null); price.setPointPayment(bargainPriceDetail.getIntegral() != null); //门店特价,消费积分使用会员等级的消费积分 GoodsArea area = new GoodsArea(); area.setDistrictsCode(appUser.getDistrictCode()); @@ -241,8 +242,8 @@ if(goodsSeckill.getCashPayment() == 0 && goodsSeckill.getPointPayment() == 1){ price.setPoint(goodsSeckill.getIntegral()); } price.setCashPayment(goodsSeckill.getCashPayment() == 1 ? true : false); price.setPointPayment(goodsSeckill.getPointPayment() == 1 ? true : false); price.setCashPayment(goodsSeckill.getCashPayment() == 1); price.setPointPayment(goodsSeckill.getPointPayment() == 1); price.setEndTime(goodsSeckill.getEndTime()); price.setEarnSpendingPoints(goodsSeckill.getEarnSpendingPoints()); price.setSuperiorSubcommission(goodsSeckill.getSuperiorSubcommission()); @@ -258,76 +259,9 @@ } return price; } @Data class Price { /** * 现金 */ private BigDecimal cash; /** * 积分 */ private Integer point; /** * 获取结束时间 */ private Long endTime; /** * 现金支付 */ private Boolean cashPayment; /** * 积分支付 */ private Boolean pointPayment; /** * 可获得消费积分 */ private Integer earnSpendingPoints; /** * 上级获得分佣金额 */ private BigDecimal superiorSubcommission; /** * 上级获得返佣积分 */ private Integer superiorRebatePoints; /** * 获取返佣积分上级类型(1=直推上级,2=直帮上级) */ private Integer superiorType; /** * 核销门店可获得服务费 */ private BigDecimal servuceShopCharges; /** * 核销门店可获得服务积分 */ private Integer servuceShopPoints; /** * 技师可获得服务积分 */ private Integer technicianPoints; /** * 绑定门店可获得分佣金额 */ private BigDecimal boundShopCharges; /** * 绑定门店可获得返佣积分 */ private Integer boundShopPoints; /** * 绑定门店上级门店可获得分佣金额 */ private BigDecimal boundShopSuperiorsCharges; /** * 绑定门店上级门店可获得返佣积分 */ private Integer boundShopSuperiorsPoints; } @Override public Long addGoods(ShoppingCart shoppingCart) { @@ -336,8 +270,8 @@ this.save(shoppingCart); return shoppingCart.getId(); } /** * 修改购物车数量 * @param setGoodsNumber @@ -362,8 +296,8 @@ } return R.ok(); } /** * 确认购物车订单 * @param confirmOrder @@ -500,8 +434,8 @@ } return confirmOrderVo; } /** * 构建购物车商品列表 * @param appUser @@ -581,8 +515,8 @@ } return page; } /** * 购物车支付操作 * @param shoppingCartPayment @@ -619,7 +553,7 @@ } ids.add(id); } List<ShoppingCart> list = this.listByIds(ids); //构建商品明细列表 List<MyShoppingCartVo> goodsList = buildDetail(appUser, shopId, list, objects); @@ -689,7 +623,7 @@ BigDecimal discountAmount = BigDecimal.ZERO; //活动优惠金额 BigDecimal activityAmount = BigDecimal.ZERO; //减去优惠券优惠金额 CouponInfoVo couponInfoVo = null; if(null != shoppingCartPayment.getUserCouponId() && 3 != shoppingCartPayment.getPaymentType()){ @@ -732,7 +666,7 @@ paymentMoney = paymentMoney.add(cash); } } //满减 if(1 == couponInfoVo.getCouponType() && couponInfoVo.getConditionAmount().compareTo(goodsMoney) <= 0){ goodsMoney = goodsMoney.subtract(couponInfoVo.getDiscountAmount()); @@ -757,7 +691,7 @@ paymentMoney = paymentMoney.add(goodsMoney); } } //查询当前是否有订单活动 OrderActivityInfo orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData(); BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); @@ -774,7 +708,7 @@ paymentMoney = paymentMoney1; activityAmount = activityAmount.add(bigDecimal); } //可获得的消费积分 int earnPoint = 0; for (MyShoppingCartVo myShoppingCartVo : goodsList) { @@ -783,7 +717,7 @@ if(null != shoppingCartPayment.getUserAddressId()){ userAddressClient.getUserAddressById(shoppingCartPayment.getUserAddressId()).getData(); } //获取快递策略,计算快递费 BigDecimal expressFee = BigDecimal.ZERO; if(null != shoppingCartPayment.getUserAddressId()){ @@ -855,7 +789,7 @@ order.setDelFlag(0); order.setCreateTime(LocalDateTime.now()); order.setExpressPayMethod(shoppingCartPayment.getFreightPaymentType()); if(2 == shoppingCartPayment.getPaymentType()){ BigDecimal balance = appUser.getBalance(); if(balance.compareTo(paymentMoney) < 0){ @@ -869,7 +803,7 @@ return R.fail("账户余额不足"); } } orderService.save(order); //构建订单明细数据 for (MyShoppingCartVo myShoppingCartVo : goodsList) { @@ -909,15 +843,15 @@ orderGood.setBoundShopSuperiorsPoints(myShoppingCartVo.getBoundShopSuperiorsPoints()); orderGoodService.save(orderGood); } //开始构建支付数据 //现金支付 paymentMoney = paymentMoney.add(expressFee).setScale(2, RoundingMode.HALF_EVEN); if(1 == shoppingCartPayment.getPaymentType()){ //调起微信支付 TODO 待完善 } //账户余额 if(2 == shoppingCartPayment.getPaymentType()){ @@ -952,7 +886,7 @@ appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint); @@ -997,7 +931,7 @@ appUserClient.editAppUserById(appUser); //检查消费积分满足后升级会员 vipUpgrade(appUser); //构建积分流水记录 UserPoint userPoint = new UserPoint(); userPoint.setType(4); @@ -1051,7 +985,7 @@ appUser.setBalance(balance); } } appUserClient.editAppUserById(appUser); //构建余额明细变动记录 BalanceChangeRecord balanceChangeRecord = new BalanceChangeRecord(); @@ -1080,8 +1014,8 @@ } return R.ok(order.getId().toString()); } public String getNumber(Integer size){ String str = ""; for (Integer i = 0; i < size; i++) { @@ -1089,8 +1023,8 @@ } return str; } /** * 会员等级变化 * @param appUser ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java
@@ -41,9 +41,13 @@ */ @PostMapping("/getGoodsBargainPrice") public R<GoodsBargainPriceDetail> getGoodsBargainPrice(@RequestBody GetGoodsBargainPrice goodsBargainPrice){ GoodsBargainPrice one = goodsBargainPriceService.getOne(new LambdaQueryWrapper<GoodsBargainPrice>().eq(GoodsBargainPrice::getGoodsId, goodsBargainPrice.getGoodsId()) .eq(GoodsBargainPrice::getShopId, goodsBargainPrice.getShopId()).eq(GoodsBargainPrice::getAuditStatus, 1).eq(GoodsBargainPrice::getDelFlag, 0) .orderByDesc(GoodsBargainPrice::getCreateTime).last(" limit 0,1")); GoodsBargainPrice one = goodsBargainPriceService.getOne(new LambdaQueryWrapper<GoodsBargainPrice>() .eq(GoodsBargainPrice::getGoodsId, goodsBargainPrice.getGoodsId()) .eq(GoodsBargainPrice::getShopId, goodsBargainPrice.getShopId()) .eq(GoodsBargainPrice::getAuditStatus, 1) .eq(GoodsBargainPrice::getDelFlag, 0) .orderByDesc(GoodsBargainPrice::getCreateTime) .last(" limit 0,1")); if(null == one){ return R.ok(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -11,16 +11,15 @@ import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.domain.ShopScore; import com.ruoyi.other.enums.ShopStatus; import com.ruoyi.other.service.ShopScoreService; import com.ruoyi.other.service.ShopService; import com.ruoyi.other.service.TechnicianService; import com.ruoyi.other.vo.NearbyShopVO; import com.ruoyi.other.vo.ShopDetailVO; import com.ruoyi.system.api.model.LoginUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -43,8 +42,6 @@ @Api(tags = "门店") public class ShopController extends BaseController { @Resource private TechnicianService technicianService; @Resource private ShopService shopService; @Resource private AppUserClient appUserClient; @@ -55,20 +52,64 @@ @PostMapping @ApiOperation(value = "新增门店", tags = {"后台管理-门店管理-新增门店"}) @Transactional(rollbackFor = Exception.class) public R<Void> add(@RequestBody Shop shop){ shop.setShopAllPoint(0); shop.setShopPoint(0); shop.setSharePoint(0); shop.setServerPoint(0); shop.setLowerLevelRebatePoints(0); shop.setUsePoint(0); shop.setGiveawayAllMoney(BigDecimal.ZERO); shop.setGiveawayMoney(BigDecimal.ZERO); shop.setLowerLevelGiveawayMoney(BigDecimal.ZERO); shop.setServerGiveawayMoney(BigDecimal.ZERO); shop.setCanWithdrawMoney(BigDecimal.ZERO); shop.setWithdrawMoney(BigDecimal.ZERO); shop.setOrderNumber(0); shop.setServerOrderNumber(0); shop.setCustomOrderNumber(0); shopService.save(shop); LoginUser loginUserApplet = tokenService.getLoginUserApplet(); AppUserShop appUserShop = new AppUserShop(); appUserShop.setAppUserId(loginUserApplet.getUserid()); appUserShop.setShopId(shop.getId()); appUserClient.addAppUserShop(appUserShop); return R.ok(); } @PostMapping("/getDetailById") @ApiOperation(value = "门店详情", tags = {"后台管理-门店管理-门店详情"}) public R<Shop> getDetailById(@RequestParam("id") Long id){ Shop byId = shopService.getById(id); return R.ok(byId); } @DeleteMapping("/deleteShop") @ApiOperation(value = "删除门店", tags = {"后台管理-门店管理-删除门店"}) public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){ shopService.removeById(id); return R.ok(); } @PutMapping("/editShop") @ApiOperation(value = "编辑门店", tags = {"后台管理-门店管理-编辑门店"}) public R<Void> editShop(@RequestBody Shop shop){ shopService.updateById(shop); return R.ok(); } @GetMapping("/list") @ApiOperation(value = "门店列表", tags = {"后台管理-门店管理-门店列表"}) public R<List<Shop>> list(@ApiParam("页码") @RequestParam Integer PageNum,@ApiParam("每一页数据大小") Integer pageSize,Shop shop){ List<Shop> list = shopService.list(); } /** * 附近门店列表 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ShopMapper.java
@@ -1,6 +1,8 @@ package com.ruoyi.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.vo.NearbyShopVO; import com.ruoyi.other.vo.ShopDetailVO; @@ -19,6 +21,8 @@ */ public interface ShopMapper extends BaseMapper<Shop> { IPage<Shop> selectShopList(@Param("page") Page<Shop> page,@Param("shop") Shop shop); List<NearbyShopVO> selectNearbyShopList(@Param("longitude") BigDecimal longitude,@Param("latitude") BigDecimal latitude); ShopDetailVO selectShopDetail(Integer shopId); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ShopService.java
@@ -18,6 +18,8 @@ */ public interface ShopService extends IService<Shop> { List<Shop> getShopList(Shop shop); List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude); ShopDetailVO getShopDetail(Integer shopId, BigDecimal longitude, BigDecimal latitude); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.vo.Price; import com.ruoyi.other.api.domain.*; import com.ruoyi.other.enums.GoodsStatus; import com.ruoyi.other.mapper.GoodsAreaMapper; @@ -54,6 +57,8 @@ private GoodsShopMapper goodsShopMapper; @Resource private ShopMapper shopMapper; @Resource private RemoteOrderGoodsClient remoteOrderGoodsClient; @Override public List<GoodsVO> goodsList(Goods search) { @@ -63,11 +68,18 @@ .like(StringUtils.isNotEmpty(search.getName()), Goods::getName, search.getName())); List<GoodsVO> result = new ArrayList<>(); LoginUser loginUserApplet = tokenService.getLoginUserApplet(); for (Goods goods : goodsList) { GoodsVO goodsVO = new GoodsVO(); BeanUtils.copyBeanProp(goodsVO, goods); goodsVO.setGoodsId(goods.getId()); goodsVO.setGoodsName(goods.getName()); R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getId(), null); if (R.isSuccess(r)){ Price price = r.getData(); goodsVO.setSellingPrice(price.getCash()); goodsVO.setIntegral(price.getPoint()); } result.add(goodsVO); } return result; ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -1,9 +1,12 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.GeodesyUtil; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.other.api.domain.ShopScore; import com.ruoyi.other.mapper.ShopMapper; import com.ruoyi.other.api.domain.Shop; @@ -35,6 +38,15 @@ private ShopMapper shopMapper; @Resource private ShopScoreService shopScoreService; @Resource private RemoteOrderGoodsClient remoteOrderGoodsClient; @Override public List<Shop> getShopList(Shop shop) { IPage<Shop> shopIPage = shopMapper.selectShopList(null, null); return shopIPage.getRecords(); } @Override public List<NearbyShopVO> nearbyShopList(BigDecimal longitude, BigDecimal latitude) { ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -53,4 +53,31 @@ ts.longitude, ts.latitude </select> <select id="selectShopList" resultType="com.ruoyi.other.api.domain.Shop"> SELECT ts.id, ts.`name`, ts.business_date, tau.`name` managerName, ts.phone, ts.address, ts.`status` FROM `qijisheng_other`.t_shop ts LEFT JOIN `qijisheng_account`.t_app_user tau ON ts.app_user_id = tau.id <where> <if test="shop.name != null and shop.name != ''"> and ts.name like concat('%',#{shop.name},'%') </if> <if test="shop.managerName != null and shop.managerName != ''"> and tau.name like concat('%',#{shop.managerName},'%') </if> <if test="shop.phone != null and shop.phone != ''"> and ts.phone like concat('%',#{shop.phone},'%') </if> <if test="shop.status != null and shop.status != ''"> and ts.status = #{shop.status} </if> </where> </select> </mapper>