From 03331f46c05015df9debef834e752b2f9d13f9e0 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期四, 05 十二月 2024 15:19:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/UserPointServiceImpl.java | 7 ++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java | 4 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/RecommendDto.java | 7 ++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/UserPointService.java | 5 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java | 21 ++++--- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java | 5 - ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java | 6 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java | 3 + 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/controller/UserPointController.java | 13 ++++ ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java | 14 ++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 46 +++++++++++++++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java | 6 + ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml | 3 14 files changed, 128 insertions(+), 25 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java index 4914aad..47ea3b0 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java @@ -12,6 +12,7 @@ import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; /** * <p> @@ -100,6 +101,18 @@ @ApiModelProperty(value = "绑定门店名称") @TableField(exist = false) private String shopName; + @ApiModelProperty(value = "绑定门店封面") + @TableField(exist = false) + private String shopCover; + @ApiModelProperty(value = "绑定门店地址") + @TableField(exist = false) + private String shopAddress; + @ApiModelProperty(value = "上级人员信息") + @TableField(exist = false) + private AppUser topUser; + @ApiModelProperty(value = "下级人员列表") + @TableField(exist = false) + private List<AppUser> bottomUsers; @ApiModelProperty(value = "合伙人积分数") @TableField("part_point") @@ -220,4 +233,5 @@ + } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 2a58d42..e3c1045 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -8,6 +8,7 @@ import com.ruoyi.account.service.UserCancellationLogService; import com.ruoyi.account.service.UserCouponService; import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.other.api.domain.Shop; import com.ruoyi.other.api.feignClient.StoreClient; @@ -176,6 +177,51 @@ + @ResponseBody + @PostMapping("/recommend") + @ApiOperation(value = "推广中心", tags = {"小程序-推广中心"}) + public R<AppUser> recommend(){ + Long userId = tokenService.getLoginUserApplet().getUserid(); + //获取绑定门店 + AppUser user = appUserService.getById(userId); + if (user.getShopId()!=null){ + R<Shop> storeById = storeClient.getStoreById(user.getShopId()); + if (storeById.getData()!=null){ + user.setShopName(storeById.getData().getName()); + user.setShopCover(storeById.getData().getHomePicture()); + user.setShopAddress(storeById.getData().getAddress()); + } + } + + //获取绑定上级 + if (user.getInviteUserId()!=null) { + AppUser byId = appUserService.getById(user.getInviteUserId()); + user.setTopUser(byId); + } + //获取绑定下级列表 + List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, user.getInviteUserId()).list(); + for (AppUser appUser : list) { + Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getTopInviteId, 1).count(); + Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getTopInviteId, userId).count(); + Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getTopInviteId, userId).count(); + Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getTopInviteId, userId).count(); + Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getTopInviteId, userId).count(); + Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getTopInviteId, userId).count(); + Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getTopInviteId, userId).count(); + appUser.setCount1(count1); + appUser.setCount2(count2); + appUser.setCount3(count3); + appUser.setCount4(count4); + appUser.setCount5(count5); + appUser.setCount6(count6); + appUser.setCount7(count7); + } + user.setBottomUsers(list); + + return R.ok(user); + } + + @GetMapping("/index") @ApiOperation(value = "个人中心首页", tags = {"小程序-个人中心首页"}) 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..75fef0e 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,14 @@ @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/dto/RecommendDto.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/RecommendDto.java new file mode 100644 index 0000000..fd117a2 --- /dev/null +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/RecommendDto.java @@ -0,0 +1,7 @@ +package com.ruoyi.account.dto; + +import lombok.Data; + +@Data +public class RecommendDto { +} 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 dbb718c..b5cf7dd 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 4143b59..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 @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.TableDataInfo; @@ -10,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; @@ -93,12 +93,15 @@ @GetMapping("/home/list") - @ApiOperation(value = "列表", notes = "列表", tags = {"小程序-个人中心-我的预约"}) - public TableDataInfo<TechnicianSubscribeVO> homelist(@ApiParam(value = "状态 0=待服务,1=已服务,2=已取消 4 已到期") Integer status) { - startPage(); - List<TechnicianSubscribeVO> list = technicianSubscribeService - .getTechnicianSubscribeByUser(SecurityUtils.getUserId(), status); - return getDataTable(list); + @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/mapper/TechnicianSubscribeMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java index b3a3294..4da34ad 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.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.TechnicianSubscribe; import com.ruoyi.other.vo.TechnicianSubscribeVO; import org.apache.ibatis.annotations.Param; @@ -24,6 +26,6 @@ */ public List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(@Param("userId") Long userId, @Param("shopId") Long shopId); - public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(@Param("userId") Long userId, - @Param("status") Integer status); + IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(@Param("page") Page<TechnicianSubscribe> page, @Param("userId") Long userId, + @Param("status") Integer status); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java index d3796aa..73e8cfc 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/TechnicianSubscribeService.java @@ -1,5 +1,7 @@ package com.ruoyi.other.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.vo.TechnicianSubscribeVO; @@ -21,7 +23,7 @@ */ List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long userId, Long shopId); - List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status); + IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status); void subscribe(TechnicianSubscribe technicianSubscribe, Long technicianId); } 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); - } + } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java index c49b8ab..4acbbe7 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java @@ -1,5 +1,7 @@ package com.ruoyi.other.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.other.api.domain.TechnicianSubscribe; @@ -34,8 +36,8 @@ return technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(userId, shopId); } @Override - public List<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Long userId, Integer status) { - return technicianSubscribeMapper.getTechnicianSubscribeByUser(userId, status); + public IPage<TechnicianSubscribeVO> getTechnicianSubscribeByUser(Page<TechnicianSubscribe> page, Long userId, Integer status) { + return technicianSubscribeMapper.getTechnicianSubscribeByUser(page, userId, status); } @Override diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java index 1ec6886..416c846 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/TechnicianSubscribeVO.java @@ -10,6 +10,9 @@ @ApiModel(value="技师预约对象", description="") public class TechnicianSubscribeVO { + @ApiModelProperty(value = "预约id") + private Long id; + /** * 门店名称 */ diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml index 568c57a..891f3be 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml @@ -26,6 +26,7 @@ <select id="getTechnicianSubscribeByUser" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO"> SELECT * from ( SELECT + tts.id, tts.user_address, ts.`name` shopName, ts.address shopAddress, @@ -33,7 +34,7 @@ tts.subscribe_time, tts.service_mode, CASE - WHEN tts.subscribe_time lt; NOW() THEN 4 + WHEN tts.subscribe_time <![CDATA[<]]> NOW() THEN 4 ELSE tts.status END AS status FROM -- Gitblit v1.7.1