From cd1883b692ffdbd3fd3bb662d24979e41820ccc6 Mon Sep 17 00:00:00 2001 From: phpcjl <phpcjl@gmail.com> Date: 星期四, 05 十二月 2024 14:30:22 +0800 Subject: [PATCH] 1.完成开发门店打分接口 --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java | 7 +++++++ ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 13 ++++++++----- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java | 5 ++++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java | 10 ++++++++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java | 17 ++++++++++------- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 5 +---- 6 files changed, 40 insertions(+), 17 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java index a3dd141..0902ea9 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserPointController.java @@ -1,7 +1,10 @@ package com.ruoyi.account.controller; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.UserPoint; +import com.ruoyi.account.service.AppUserService; import com.ruoyi.account.service.UserPointService; import com.ruoyi.account.vo.UserPointDetailVO; import com.ruoyi.account.vo.UserPointVO; @@ -37,6 +40,8 @@ public class UserPointController extends BaseController { @Resource private UserPointService userPointService; + @Resource + private AppUserService appUserService; /** @@ -82,6 +87,11 @@ @PostMapping("/transferPoint") @ApiOperation("转赠积分") public R<Void> transferPoint(@ApiParam("积分") BigDecimal point, @ApiParam("手机号") Long phone) { + AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getPhone, phone)); + if (null == appUser) { + return R.fail("用户不存在"); + } return R.ok(); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java index 10047c5..3057915 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java @@ -5,12 +5,13 @@ import com.ruoyi.account.vo.UserPointDetailVO; import com.ruoyi.account.vo.UserPointVO; +import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; /** * <p> - * 服务类 + * 服务类 * </p> * * @author luodangjia @@ -22,4 +23,6 @@ List<UserPointDetailVO> getUserPointDetail(Long userId, LocalDateTime startTime, LocalDateTime endTime, Integer type); + + void transferPoint(BigDecimal point, Long phone); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java index 35a79e3..cca1a66 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java @@ -84,4 +84,11 @@ } return Collections.emptyList(); } + + + @Override + public void transferPoint(BigDecimal point, Long phone) { + AppUser appUser = appUserService.getOne(new LambdaQueryWrapper<AppUser>() + .eq(AppUser::getPhone, phone)); + } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index 52e020d..779f212 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -341,11 +341,14 @@ return R.fail("修改数量不能小于等于0"); } ShoppingCart shoppingCart = this.getById(setGoodsNumber.getId()); - Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); - if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && goods.getPurchaseLimit() < setGoodsNumber.getNumber()){ - return R.fail("修改数量不能大于限购数量"); - } + if(null != shoppingCart){ + + Goods goods = goodsClient.getGoodsById(shoppingCart.getGoodsId()).getData(); + if(null != goods.getPurchaseLimit() && -1 != goods.getPurchaseLimit() && goods.getPurchaseLimit() < setGoodsNumber.getNumber()){ + return R.fail("修改数量不能大于限购数量"); + } + shoppingCart.setNumber(setGoodsNumber.getNumber()); this.updateById(shoppingCart); } @@ -397,7 +400,7 @@ confirmOrderVo.setDiscountAmount(orderMoney.subtract(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); } BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); - confirmOrderVo.setUseSimultaneously(baseSetting.getContent().equals("1") ? true : false); + confirmOrderVo.setUseSimultaneously(baseSetting.getContent().equals("1")); int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); confirmOrderVo.setEarnPoint(earnPoint); //支付金额,订单金额-订单优惠 diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java index d18e667..fabe13d 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java @@ -12,9 +12,7 @@ import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.service.TechnicianSubscribeService; import com.ruoyi.other.vo.TechnicianSubscribeVO; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; +import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -95,10 +93,15 @@ @GetMapping("/home/list") - @ApiOperation(value = "列表", notes = "列表", tags = {"小程序-个人中心-我的预约"}) - public IPage<TechnicianSubscribeVO> homelist(@ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") Integer status, - Page<TechnicianSubscribe> page) { - return technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status); + @ApiOperation(value = "列表", notes = "获取用户预约列表", tags = {"小程序-个人中心-我的预约"}) + @ApiImplicitParams({ + @ApiImplicitParam(name = "status", value = "状态 0=待服务,1=已服务,2=已取消, 4=已到期", required = true, dataType = "Integer", paramType = "query"), + @ApiImplicitParam(name = "current", value = "当前页码,从1开始", required = true, dataType = "Integer", paramType = "query"), + @ApiImplicitParam(name = "size", value = "每页显示数量,默认10", dataType = "Integer", paramType = "query") + }) + public R<IPage<TechnicianSubscribeVO>> homelist(@RequestParam(value = "status", required = false) @ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") Integer status, + @ApiParam(hidden = true) Page<TechnicianSubscribe> page) { + return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status)); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java index 980350e..de346ca 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java @@ -83,9 +83,6 @@ return shopDetailVO; } - public static void main(String[] args) { - String userLocation = String.format("%s,%s", "106.6664549", "29.4158471"); - System.out.println(userLocation); - } + } -- Gitblit v1.7.1