From a682c14659d5ca670aa2ccce0db14ddcc9238302 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 14 一月 2025 11:55:49 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 7 +++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java | 1 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java | 14 ++++-- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java | 18 +++++---- ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml | 4 + ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java | 35 +++++++++++++++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java | 28 +++++++++----- 8 files changed, 84 insertions(+), 24 deletions(-) diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java index 8958c81..553522d 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java @@ -14,7 +14,9 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.bean.BeanUtils; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.other.api.domain.BaseSetting; import com.ruoyi.other.api.domain.VipSetting; +import com.ruoyi.other.api.feignClient.BaseSettingClient; import com.ruoyi.other.api.feignClient.VipSettingClient; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; @@ -37,6 +39,8 @@ private AgentApplicationService agentApplicationService; @Resource private AppUserService appUserService; + @Resource + private BaseSettingClient baseSettingClient; @PostMapping("/apply") @ApiOperation(value = "会员申请", tags = {"会员中心-小程序"}) @@ -95,9 +99,40 @@ //变更会员等级 byId1.setVipId(byId.getApplicationVipId()); appUserService.updateById(byId1); + + // 当用户为合伙人时,计算合伙人积分和培育积分 + Integer vipId = byId1.getVipId(); + if (vipId == 7){ + // 当前用户计算合伙人积分 + R<VipSetting> vipSetting = vipSettingClient.getVipSetting(vipId); + setPoint(vipSetting, byId1, byId1.getShopPoint(), byId1.getSharePoint()); + // 上级计算培育积分 + Long inviteUserId = byId1.getInviteUserId(); + AppUser byId2 = appUserService.getById(inviteUserId); + if (byId2 != null){ + setPoint(vipSetting, byId2, byId1.getShopPoint(), byId1.getSharePoint()); + } + } return R.ok(byId); } + private void setPoint(R<VipSetting> vipSetting, AppUser appUser, Integer shopPoint, Integer sharePoint) { + VipSetting vipSettingData = vipSetting.getData(); + Integer vipLevelUpShopRole = vipSettingData.getVipLevelUpShopRole(); + if (vipLevelUpShopRole == 1){ + Integer vipLevelUpShop = vipSettingData.getVipLevelUpShop(); + Integer vipLevelUpShare = vipSettingData.getVipLevelUpShare(); + if (shopPoint >=vipLevelUpShop && sharePoint >= vipLevelUpShare) { + R<BaseSetting> baseSetting = baseSettingClient.getBaseSetting(1); + BaseSetting data = baseSetting.getData(); + if (data != null){ + appUser.setPartPoint(Integer.parseInt(data.getContent())); + appUserService.updateById(appUser); + } + } + } + } + } 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 bdc22ca..25f0f98 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 @@ -524,6 +524,7 @@ AppUser byId = appUserService.lambdaQuery() .eq(AppUser::getPhone, phone) .eq(AppUser::getDelFlag,0) + .eq(AppUser::getStatus,1) .one(); if (byId == null) { return R.fail("搜索失败,手机号错误。"); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java index 06f5dd9..0bca4b0 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java @@ -132,26 +132,34 @@ @ApiOperation(value = "已领取列表", tags = {"管理后台-优惠劵"}) public R<Page<UserCoupon>> list1(@RequestParam Integer pageNum, @RequestParam Integer pageSize, + String userName, @ApiParam("1未使用2已使用3已过期") Integer status, String phone, Integer id) { - List<Long> appUserIds = null; - if (!StringUtils.isEmpty(phone)){ - List<AppUser> appUserList = appUserService.list(new LambdaQueryWrapper<AppUser>() - .like(AppUser::getPhone, phone)); - if (!CollectionUtils.isEmpty(appUserList)){ - appUserIds = appUserList.stream().map(AppUser::getId).collect(Collectors.toList()); - }else { - return R.ok(Page.of(pageNum, pageSize)); - } + LambdaQueryWrapper<AppUser> queryWrapper = new LambdaQueryWrapper<>(); + + if (!StringUtils.isEmpty(phone)) { + queryWrapper.like(AppUser::getPhone, phone); } + if (!StringUtils.isEmpty(userName)) { + queryWrapper.like(AppUser::getName, userName); + } + + List<AppUser> appUserList = appUserService.list(queryWrapper); + + if (CollectionUtils.isEmpty(appUserList)) { + return R.ok(Page.of(pageNum, pageSize)); + } + + List<Long> appUserIds = appUserList.stream().map(AppUser::getId).distinct().collect(Collectors.toList()); + Page<UserCoupon> page = userCouponService.lambdaQuery() .isNull(status!=null&&(status==1||status==3),UserCoupon::getUseTime) .isNotNull(status!=null&&status==2,UserCoupon::getUseTime) .eq(UserCoupon::getCouponId, id) - .in(appUserIds != null,UserCoupon::getAppUserId, appUserIds) + .in(!CollectionUtils.isEmpty(appUserIds),UserCoupon::getAppUserId, appUserIds) .lt(status!=null&&status==3,UserCoupon::getEndTime, LocalDateTime.now()).page(Page.of(pageNum-1, pageSize)); for (UserCoupon record : page.getRecords()) { record.setIdStr(record.getId().toString()); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java index 45c2c5c..0198cd8 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java @@ -54,14 +54,16 @@ // 过滤商城购物 List<BalanceChangeRecord> collect = balanceChangeRecordIPage.getRecords().stream().filter(e -> e.getChangeType() != 5).collect(Collectors.toList()); for (BalanceChangeRecord changeRecord : collect) { - BigDecimal subtract = changeRecord.getBeforeAmount().subtract(changeRecord.getAfterAmount()); - if (subtract.compareTo(BigDecimal.ZERO)>0){ - // 减少 - changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount()); - }else if (subtract.compareTo(BigDecimal.ZERO)<0){ - changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount()); - }else{ - changeRecord.setChangeAmountString("¥"+changeRecord.getChangeAmount()); + if (changeRecord.getBeforeAmount()!=null && changeRecord.getAfterAmount()!=null){ + BigDecimal subtract = changeRecord.getBeforeAmount().subtract(changeRecord.getAfterAmount()); + if (subtract.compareTo(BigDecimal.ZERO)>0){ + // 减少 + changeRecord.setChangeAmountString("-¥"+changeRecord.getChangeAmount()); + }else if (subtract.compareTo(BigDecimal.ZERO)<0){ + changeRecord.setChangeAmountString("+¥"+changeRecord.getChangeAmount()); + }else{ + changeRecord.setChangeAmountString("¥"+changeRecord.getChangeAmount()); + } } } balanceChangeRecordIPage.setRecords(collect); diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml index bd800b9..9af80f7 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml @@ -29,7 +29,9 @@ tau.phone userPhone, tbcr.change_type, tbcr.create_time, - tbcr.change_amount + tbcr.change_amount, + tbcr.beforeAmount, + tbcr.afterAmount FROM t_balance_change_record tbcr LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index ded5565..6e38450 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -209,6 +209,13 @@ orderDetailVO.setShopId(shop.getId()); orderDetailVO.setTechnicianName(technician.getName()); orderDetailVO.setTechnicianId(technician.getId()); + if(order.getOrderType() == 1){ + List<TechnicianSubscribe> data = technicianSubscribeClient.getTechnicianSubscribeList(order.getId()).getData(); + if(data.size() > 0){ + Long id = data.get(0).getId(); + orderDetailVO.setTechnicianSubscribeId(id.toString()); + } + } return orderDetailVO; } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java index bcb49ce..5efbbb1 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsBargainPriceServiceImpl.java @@ -94,6 +94,7 @@ //添加明细 List<GoodsBargainPriceDetail> list = vo.getList(); for (GoodsBargainPriceDetail goodsBargainPriceDetail : list) { + goodsBargainPriceDetail.setId(null); goodsBargainPriceDetail.setGoodsBargainPriceId(bargainPrice.getId()); } goodsBargainPriceDetailService.saveBatch(list); 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 3fd7867..3bc5b95 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 @@ -98,12 +98,16 @@ @Override public void switchingTechnician(TechnicianSubscribe technicianSubscribe) { - TechnicianSubscribe subscribe = this.getById(technicianSubscribe.getId()); - if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){ - throw new RuntimeException("不能切换相同的技师"); + List<TechnicianSubscribe> list = this.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, technicianSubscribe.getOrderId()) + .eq(TechnicianSubscribe::getDelFlag, 0).eq(TechnicianSubscribe::getStatus, 0)); + for (TechnicianSubscribe subscribe : list) { + if(subscribe.getTechnicianId().equals(technicianSubscribe.getTechnicianId())){ + throw new RuntimeException("不能切换相同的技师"); + } + subscribe.setTechnicianId(technicianSubscribe.getTechnicianId()); + this.updateById(subscribe); } - subscribe.setTechnicianId(technicianSubscribe.getTechnicianId()); - this.updateById(subscribe); + } /** -- Gitblit v1.7.1