From d37ac1b495dd070e37209527bbedc1ce0730951a Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期三, 01 一月 2025 15:16:41 +0800 Subject: [PATCH] 修改bug --- ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java | 42 ++++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java | 7 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java | 41 +++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java | 7 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java | 31 ++- ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/BalanceQuery.java | 4 ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java | 5 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml | 14 + ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUser.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java | 5 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java | 5 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/UserChangeQuery.java | 9 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java | 30 +++- ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml | 13 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java | 14 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 15 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 15 +- ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/SeckillActivityInfoMapper.java | 2 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java | 2 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 18 +- ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml | 8 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserChangeLogMapper.xml | 13 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java | 14 + ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java | 3 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java | 63 ++++---- 28 files changed, 267 insertions(+), 127 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 88b9f9e..527f3c2 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 @@ -227,6 +227,10 @@ @ApiModelProperty(value = "可用积分") @TableField("available_point") private Integer availablePoint; + + @ApiModelProperty(value = "可转增积分") + @TableField("transferable_point") + private Integer transferablePoint; @ApiModelProperty(value = "是否可更换推广人(0=否,1=是)") @TableField("change_promoter") diff --git a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java index a9e902d..df0aada 100644 --- a/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java +++ b/ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Goods.java @@ -1,6 +1,7 @@ package com.ruoyi.other.api.domain; import com.baomidou.mybatisplus.annotation.*; +import com.ruoyi.common.core.web.page.BasePage; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -23,7 +24,7 @@ @EqualsAndHashCode(callSuper = false) @TableName("t_goods") @ApiModel(value="Goods对象", description="") -public class Goods implements Serializable { +public class Goods extends BasePage implements Serializable { private static final long serialVersionUID = 1L; @@ -103,7 +104,7 @@ @TableField("sale_num") private Integer saleNum; - @ApiModelProperty(value = "商品权限 逗号分隔(0=全部,1=游客,2=普通会员,3=黄金会员,4=钻石会员,5=准代理,6=代理,7=总代,8=合伙人)") + @ApiModelProperty(value = "商品权限 逗号分隔(-1=全部,0=游客,1=普通会员,2=黄金会员,3=钻石会员,4=准代理,5=代理,6=总代,7=合伙人)") @TableField("commodity_authority") private String commodityAuthority; diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java index 1a162d4..fbb1d61 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/BasePage.java @@ -1,5 +1,6 @@ package com.ruoyi.common.core.web.page; +import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -15,11 +16,13 @@ * 分页参数,当前页码 */ @ApiModelProperty(value = "分页参数,当前页码") + @TableField(exist = false) private Integer pageCurr = 1; /** * 分页参数,每页数量 */ @ApiModelProperty(value = "分页参数,每页数量,默认为10") + @TableField(exist = false) private Integer pageSize = 10; public Integer getPageCurr() { 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 34a31bc..8168bf8 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 @@ -290,13 +290,13 @@ user.setShopName(storeById.getData().getName()); } } - 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(); + Long count1 = appUserService.lambdaQuery().eq(AppUser::getVipId, 1).eq(AppUser::getInviteUserId, userId).count(); + Long count2 = appUserService.lambdaQuery().eq(AppUser::getVipId, 2).eq(AppUser::getInviteUserId, userId).count(); + Long count3 = appUserService.lambdaQuery().eq(AppUser::getVipId, 3).eq(AppUser::getInviteUserId, userId).count(); + Long count4 = appUserService.lambdaQuery().eq(AppUser::getVipId, 4).eq(AppUser::getInviteUserId, userId).count(); + Long count5 = appUserService.lambdaQuery().eq(AppUser::getVipId, 5).eq(AppUser::getInviteUserId, userId).count(); + Long count6 = appUserService.lambdaQuery().eq(AppUser::getVipId, 6).eq(AppUser::getInviteUserId, userId).count(); + Long count7 = appUserService.lambdaQuery().eq(AppUser::getVipId, 7).eq(AppUser::getInviteUserId, userId).count(); user.setCount1(count1); user.setCount2(count2); user.setCount3(count3); @@ -554,13 +554,15 @@ //推广人 if (byId.getInviteUserId() != null) { AppUser byId1 = appUserService.getById(byId.getInviteUserId()); - byId.setInviteUserName(byId1.getInviteUserName()); + byId.setInviteUserName(byId1.getName()); } //最后下单时间 R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id); if (lastOrder.getData() != null) { byId.setLastOrderTime(lastOrder.getData().getCreateTime()); } + List<AppUser> list = appUserService.lambdaQuery().eq(AppUser::getInviteUserId, id).list(); + byId.setBottomUsers(list); //消费总金额 return R.ok(byId); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java index 9281143..2ded011 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShareController.java @@ -63,14 +63,17 @@ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); if(null != pointSetting){ Integer everySharePoint = pointSetting.getEverySharePoint(); - Integer everySharePoint1 = everySharePoint; + Integer everySharePoint1 = 0; if(1 == pointSetting.getWorkPointOpen()){ - everySharePoint1 = new BigDecimal(everySharePoint1).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); + everySharePoint1 = new BigDecimal(everySharePoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); } Integer lavePoint = appUser.getLavePoint(); appUser.setTotalPoint(appUser.getTotalPoint() + everySharePoint); appUser.setLavePoint(appUser.getLavePoint() + everySharePoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + everySharePoint1); + if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + everySharePoint1); + } appUser.setTotalSharePoint(appUser.getTotalSharePoint() + everySharePoint); appUserService.updateById(appUser); //添加积分变动记录 diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java index 70c79b6..2b2891c 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserSignRecordController.java @@ -71,14 +71,17 @@ userSignRecord.setPoint(pointSetting.getSignPoint()); int signPoint = pointSetting.getSignPoint(); if(signPoint > 0){ - int signPoint1 = signPoint; + int signPoint1 = 0; if(1 == pointSetting.getWorkPointOpen()){ - signPoint1 = new BigDecimal(signPoint1).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); + signPoint1 = new BigDecimal(signPoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); } Integer lavePoint = appUser.getLavePoint(); appUser.setTotalPoint(appUser.getTotalPoint() + signPoint); appUser.setLavePoint(appUser.getLavePoint() + signPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + signPoint1); + if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + signPoint1); + } appUser.setTotalSignPoint(appUser.getTotalSignPoint() + signPoint); appUserService.updateById(appUser); diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/BalanceQuery.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/BalanceQuery.java index f102104..e29348b 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/BalanceQuery.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/BalanceQuery.java @@ -8,10 +8,10 @@ @Data public class BalanceQuery { @ApiModelProperty("用户名称") - private String name; + private String userName; @ApiModelProperty("电话") - private String phone; + private String userPhone; @ApiModelProperty("类型:1充值2提现3红包4分佣5商城购物") private Integer changeType; diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/UserChangeQuery.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/UserChangeQuery.java index b828314..ecc3a61 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/UserChangeQuery.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/UserChangeQuery.java @@ -5,21 +5,22 @@ import lombok.Data; import java.time.LocalDate; +import java.time.LocalDateTime; @Data public class UserChangeQuery { @ApiModelProperty("用户名称") - private String name; + private String userName; @ApiModelProperty("电话") - private String phone; + private String userPhone; @ApiModelProperty(value = "变更类型 0降级1升级") @TableField("change_type") private Integer changeType; - private LocalDate localDate1; - private LocalDate localDate2; + private LocalDateTime localDate1; + private LocalDateTime localDate2; private Integer pageNum; private Integer pageSize; diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java index aeeceef..afae1bf 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java @@ -312,7 +312,7 @@ appUser.setTotalDistributionAmount(BigDecimal.ZERO); appUser.setBalance(BigDecimal.ZERO); //新用户才能奖励积分,老用户注销重新注册没有 - AppUser old = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).eq(AppUser::getDelFlag, 0)); + long old = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, registerAccount.getPhone()).eq(AppUser::getDelFlag, 0)); R<PointSetting> pointSettingR = pointSettingClient.getPointSetting(1); if (R.isError(pointSettingR)){ throw new RuntimeException("获取积分设置失败"); @@ -322,14 +322,17 @@ throw new RuntimeException("积分设置不存在"); } Integer regisPoint = pointSetting.getRegisPoint(); - if(null == old){ - Integer regisPoint1 = regisPoint; + if(0 == old){ + Integer regisPoint1 = 0; //计算可用积分比例 if(1 == pointSetting.getGetRegisPointOpen()){ - regisPoint1 = new BigDecimal(regisPoint1).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); + regisPoint1 = new BigDecimal(regisPoint).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); } appUser.setLavePoint(regisPoint); appUser.setAvailablePoint(regisPoint1); + if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ + appUser.setTransferablePoint(regisPoint1); + } appUser.setTotalRegisterPoint(regisPoint); appUser.setTotalPoint(regisPoint); } @@ -352,7 +355,7 @@ } this.save(appUser); //增加积分变动记录 - if(null == old && regisPoint > 0){ + if(0 == old && regisPoint > 0){ //构建积分流水记录 UserPoint userPoint = new UserPoint(); userPoint.setType(7); @@ -368,12 +371,15 @@ //拉新分佣 if(null != appUser2){ Integer newPoint = pointSetting.getNewPoint(); - Integer newPoint1 = newPoint; + Integer newPoint1 = 0; if(1 == pointSetting.getGetRegisPointOpen()){ - newPoint1 = new BigDecimal(newPoint1).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); + newPoint1 = new BigDecimal(newPoint).multiply(pointSetting.getGetRegisPoint().divide(new BigDecimal(100))).intValue(); } appUser2.setLavePoint(appUser2.getLavePoint() + newPoint); appUser2.setAvailablePoint(appUser2.getAvailablePoint() + newPoint1); + if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ + appUser2.setTransferablePoint(appUser2.getTransferablePoint() + newPoint1); + } appUser2.setTotalInvitePoint(appUser2.getTotalInvitePoint() + newPoint); appUser2.setTotalPoint(appUser2.getTotalPoint() + newPoint); this.updateById(appUser2); @@ -394,6 +400,9 @@ AppUser appUser3 = this.getById(appUser2.getInviteUserId()); appUser3.setLavePoint(appUser3.getLavePoint() + newPoint); appUser3.setAvailablePoint(appUser3.getAvailablePoint() + newPoint1); + if(null != pointSetting && 1 == pointSetting.getGetRegisPointGift()){ + appUser3.setTransferablePoint(appUser3.getTransferablePoint() + newPoint1); + } appUser3.setTotalInvitePoint(appUser3.getTotalInvitePoint() + newPoint); appUser3.setTotalPoint(appUser3.getTotalPoint() + newPoint); this.updateById(appUser3); @@ -688,14 +697,17 @@ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); if(null != pointSetting){ int hourPoint = pointSetting.getHourPoint().intValue(); - int hourPoint1 = hourPoint; + int hourPoint1 = 0; if(1 == pointSetting.getWorkPointOpen()){ - hourPoint1 = new BigDecimal(hourPoint1).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); + hourPoint1 = new BigDecimal(hourPoint).multiply(pointSetting.getWorkPoint().divide(new BigDecimal(100))).intValue(); } Integer lavePoint = appUser.getLavePoint(); appUser.setTotalPoint(appUser.getTotalPoint() + hourPoint); appUser.setLavePoint(appUser.getLavePoint() + hourPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + hourPoint1); + if(null != pointSetting && 1 == pointSetting.getWorkPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + hourPoint1); + } appUser.setTotalHourPoint(appUser.getTotalHourPoint() + hourPoint); this.updateById(appUser); //添加积分变动记录 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 4bfdf8b..b5da79d 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 @@ -7,11 +7,11 @@ from t_balance_change_record t1 left join t_app_user t2 on t1.app_user_id = t2.id <where> - <if test="agentQuery.name != null and agentQuery.name != ''"> - and t2.name like concat('%',#{agentQuery.name},'%') + <if test="agentQuery.userName != null and agentQuery.userName != ''"> + and t2.name like concat('%',#{agentQuery.userName},'%') </if> - <if test="agentQuery.phone != null and agentQuery.phone != ''"> - and t2.phone like concat('%',#{agentQuery.phone},'%') + <if test="agentQuery.userPhone != null and agentQuery.userPhone != ''"> + and t2.phone like concat('%',#{agentQuery.userPhone},'%') </if> <if test="agentQuery.changeType != null"> and t1.change_type = #{agentQuery.changeType} diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserChangeLogMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserChangeLogMapper.xml index a3e0623..744c79e 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserChangeLogMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/UserChangeLogMapper.xml @@ -22,19 +22,20 @@ from t_user_change_log t1 LEFT JOIN t_app_user t2 on t1.app_user_id = t2.id <where> - <if test="userChangeLog.name !=null and userChangeLog.name !=''"> - and t2.name like concat('%',#{userChangeLog.name},'%') + <if test="userChangeLog.userName !=null and userChangeLog.userName !=''"> + and t2.name like concat('%',#{userChangeLog.userName},'%') </if> - <if test="userChangeLog.phone !=null and userChangeLog.phone !=''"> - and t2.phone like concat('%',#{userChangeLog.phone},'%') + <if test="userChangeLog.userPhone !=null and userChangeLog.userPhone !=''"> + and t2.phone like concat('%',#{userChangeLog.userPhone},'%') </if> <if test="userChangeLog.changeType !=null"> - and t1.change_type = #{userChangeLog.phone.changeType} + and t1.change_type = #{userChangeLog.changeType} </if> <if test="userChangeLog.localDate1 !=null"> - and DATE(t1.create_time) between #{userChangeLog.localDate1} and #{userChangeLog.localDate2} + and t1.create_time between #{userChangeLog.localDate1} and #{userChangeLog.localDate2} </if> </where> + order by t1.create_time desc </select> </mapper> diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java index b9be064..25e73ec 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/ShoppingCartController.java @@ -130,7 +130,7 @@ if (CollectionUtil.isNotEmpty(goodsShops)){ for (GoodsShop goodsShop : goodsShops) { R<Shop> shopR = shopClient.getShopById(goodsShop.getShopId()); - if (R.isSuccess(shopR)){ + if (R.isSuccess(shopR) && null != shopR.getData()){ VerifiableShopVo verifiableShopVo = new VerifiableShopVo(); verifiableShopVo.setId(shopR.getData().getId()); verifiableShopVo.setName(shopR.getData().getName()); diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java index f63d39d..89e3779 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/CommissionServiceImpl.java @@ -149,14 +149,17 @@ } if(ztsj_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = ztsj_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getSharePointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getSharePoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(ztsj_point).multiply(pointSetting.getSharePoint().divide(new BigDecimal(100))).intValue(); } inviteUser.setSharePoint(inviteUser.getSharePoint() + ztsj_point); inviteUser.setLavePoint(inviteUser.getLavePoint() + ztsj_point); inviteUser.setAvailablePoint(inviteUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getSharePointGift()){ + inviteUser.setTransferablePoint(inviteUser.getTransferablePoint() + earnPoint1); + } inviteUser.setTotalPoint(inviteUser.getTotalPoint() + ztsj_point); } appUserClient.editAppUserById(inviteUser); @@ -201,14 +204,17 @@ } if(zbsj_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = zbsj_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getSharePointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getSharePoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(zbsj_point).multiply(pointSetting.getSharePoint().divide(new BigDecimal(100))).intValue(); } superiorLeader.setSharePoint(superiorLeader.getSharePoint() + zbsj_point); superiorLeader.setLavePoint(superiorLeader.getLavePoint() + zbsj_point); superiorLeader.setAvailablePoint(superiorLeader.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getSharePointGift()){ + superiorLeader.setTransferablePoint(superiorLeader.getTransferablePoint() + earnPoint1); + } superiorLeader.setTotalPoint(superiorLeader.getTotalPoint() + zbsj_point); } appUserClient.editAppUserById(superiorLeader); @@ -263,13 +269,16 @@ } if(hxmd_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = hxmd_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getShopPointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getShopPoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(hxmd_point).multiply(pointSetting.getShopPoint().divide(new BigDecimal(100))).intValue(); } shopAppUser.setLavePoint(shopAppUser.getLavePoint() + hxmd_point); shopAppUser.setAvailablePoint(shopAppUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getShopPointGift()){ + shopAppUser.setTransferablePoint(shopAppUser.getTransferablePoint() + earnPoint1); + } shopAppUser.setTotalPoint(shopAppUser.getTotalPoint() + hxmd_point); shopAppUser.setShopAchievementPoint(shopAppUser.getShopAchievementPoint() + hxmd_point); //门店返佣 @@ -345,13 +354,16 @@ Integer lavePoint = technicianAppUser.getLavePoint(); if(js_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = js_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getPersonPointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getPersonPoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(js_point).multiply(pointSetting.getPersonPoint().divide(new BigDecimal(100))).intValue(); } technicianAppUser.setLavePoint(technicianAppUser.getLavePoint() + js_point); technicianAppUser.setAvailablePoint(technicianAppUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getPersonPointGift()){ + technicianAppUser.setTransferablePoint(technicianAppUser.getTransferablePoint() + earnPoint1); + } technicianAppUser.setTotalPoint(technicianAppUser.getTotalPoint() + js_point); technicianAppUser.setTotalPerformancePoint(technicianAppUser.getTotalPerformancePoint() + js_point); } @@ -396,13 +408,16 @@ } if(bdmd_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = bdmd_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getShopSharePointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(bdmd_point).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue(); } bdShopAppUser.setLavePoint(bdShopAppUser.getLavePoint() + bdmd_point); bdShopAppUser.setAvailablePoint(bdShopAppUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getShopSharePointGift()){ + bdShopAppUser.setTransferablePoint(bdShopAppUser.getTransferablePoint() + earnPoint1); + } bdShopAppUser.setTotalPoint(bdShopAppUser.getTotalPoint() + bdmd_point); bdShopAppUser.setShopSharePoint(bdShopAppUser.getShopSharePoint() + bdmd_point); //门店返佣 @@ -493,13 +508,16 @@ } if(bdmdsj_point > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = bdmdsj_point; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getShopSharePointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(bdmdsj_point).multiply(pointSetting.getShopSharePoint().divide(new BigDecimal(100))).intValue(); } sjShopAppUser.setLavePoint(sjShopAppUser.getLavePoint() + bdmdsj_point); sjShopAppUser.setAvailablePoint(sjShopAppUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getShopSharePointGift()){ + sjShopAppUser.setTransferablePoint(sjShopAppUser.getTransferablePoint() + earnPoint1); + } sjShopAppUser.setTotalPoint(sjShopAppUser.getTotalPoint() + bdmdsj_point); sjShopAppUser.setLowerLevelSharePoint(sjShopAppUser.getLowerLevelSharePoint() + bdmdsj_point); //门店返佣 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 4b8acc7..49c7347 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 @@ -617,7 +617,6 @@ orderMoney = orderMoney.add(myShoppingCartVo.getCash().multiply(new BigDecimal(myShoppingCartVo.getNumber()))); } }else{ - orderPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getPoint).sum(); for (MyShoppingCartVo myShoppingCartVo : goodsList) { orderPoint += (myShoppingCartVo.getPoint() * myShoppingCartVo.getNumber()); } @@ -911,14 +910,17 @@ //构建积分流水记录 if(earnPoint > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = earnPoint; + int earnPoint1 = 0; if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); + } UserPoint userPoint = new UserPoint(); userPoint.setType(1); @@ -959,10 +961,10 @@ if(3 == shoppingCartPayment.getPaymentType()){ Integer lavePoint = appUser.getLavePoint(); PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); - int earnPoint1 = earnPoint; + int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ - earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); + earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } //扣减订单支付积分 appUser.setLavePoint(appUser.getLavePoint() - orderPoint); @@ -971,6 +973,9 @@ appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); + if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ + appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); + } appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setLastShopTime(LocalDateTime.now()); appUserClient.editAppUserById(appUser); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java index 901f61f..3cc2ec4 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java @@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.VipSetting; @@ -130,9 +132,8 @@ */ @GetMapping("/goodsList") @ApiOperation(value = "热门商品列表", tags = {"小程序-商城-首页", "小程序-首页"}) - public R<TableDataInfo> goodsList(Goods goods){ - startPage(); - return R.ok(getDataTable(goodsService.goodsList(goods))); + public R<PageInfo<GoodsVO>> goodsList(Goods goods){ + return R.ok(goodsService.goodsList(goods)); } @@ -141,9 +142,10 @@ */ @GetMapping("/getGoodsListByShopId") @ApiOperation(value = "商品购买列表", tags = {"小程序-首页-门店详情"}) - public R<TableDataInfo> getGoodsListByShopId(@ApiParam("门店id") @RequestParam Integer shopId) { - startPage(); - return R.ok(getDataTable(goodsService.getGoodsListByShopId(shopId))); + public R<PageInfo<Goods>> getGoodsListByShopId(@ApiParam("门店id") Integer shopId, Integer pageCurr, Integer pageSize) { + PageInfo<Goods> pageInfo = new PageInfo(pageCurr, pageSize); + List<Goods> goodsList = goodsService.getGoodsListByShopId(pageInfo, shopId); + return R.ok(pageInfo.setRecords(goodsList)); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java index b1374df..8ff1004 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java @@ -50,9 +50,11 @@ List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).list(); for (GoodsEvaluate goodsEvaluate : list) { AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); - goodsEvaluate.setUserName(appUserById.getName()); - goodsEvaluate.setAvatar(appUserById.getAvatar()); - goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); + if(null != appUserById){ + goodsEvaluate.setUserName(appUserById.getName()); + goodsEvaluate.setAvatar(appUserById.getAvatar()); + goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); + } } return R.ok(list); } @@ -120,13 +122,12 @@ private void buildDetail(GoodsEvaluate item) { AppUser appUser = appUserClient.getAppUserById(item.getAppUserId()); - if (appUser == null){ - throw new RuntimeException("获取用户信息失败"); + if (appUser != null){ + item.setPhone(appUser.getPhone()); + item.setUserName(appUser.getName()); } Goods goods = goodsService.getById(item.getGoodsId()); item.setGoodsName(goods.getName()); - item.setPhone(appUser.getPhone()); - item.setUserName(appUser.getName()); } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java index 934a792..77a8e72 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsShopController.java @@ -6,8 +6,10 @@ import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.api.domain.GoodsShop; import com.ruoyi.other.api.vo.GetGoodsShopByGoodsIds; +import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.GoodsShopService; import com.ruoyi.other.vo.ShopGoodsList; import com.ruoyi.other.vo.ShopGoodsListVo; @@ -31,6 +33,9 @@ @Resource private GoodsShopService goodsShopService; + + @Resource + private GoodsService goodsService; /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java index ba2e315..2a308cd 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/GoodsMapper.java @@ -2,7 +2,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.Goods; +import com.ruoyi.other.vo.GoodsVO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -16,7 +18,17 @@ * @since 2024-11-20 */ public interface GoodsMapper extends BaseMapper<Goods> { - List<Goods> selectListByShopId(@Param("shopId") Integer shopId,@Param("vip") Integer vip); + List<Goods> selectListByShopId(PageInfo<Goods> pageInfo, @Param("shopId") Integer shopId,@Param("vip") Integer vip); IPage<Goods> selectManageGoodsList(@Param("page") IPage<Goods> page, @Param("goods") Goods goods); + + + /** + * 获取商品列表 + * @param pageInfo + * @param goodsCategoryId + * @param name + * @return + */ + List<GoodsVO> goodsList(PageInfo<GoodsVO> pageInfo, @Param("goodsCategoryId") Integer goodsCategoryId, @Param("name") String name); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/SeckillActivityInfoMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/SeckillActivityInfoMapper.java index 0317834..3d90654 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/SeckillActivityInfoMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/SeckillActivityInfoMapper.java @@ -25,5 +25,5 @@ IPage<SeckillActivityVO> querySeckillActivity(@Param("page") Page<SeckillActivityVO> page,@Param("goods") Goods goods); - SeckillActivityDetailVO selectDetail(Integer seckillActivityId); + SeckillActivityDetailVO selectDetail(@Param("seckillActivityId") Integer seckillActivityId, @Param("vip") Integer vip); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java index db2c9b8..4d7accd 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/GoodsService.java @@ -3,6 +3,7 @@ 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.common.core.web.page.PageInfo; import com.ruoyi.other.api.domain.Goods; import com.ruoyi.other.vo.GoodsVO; @@ -18,11 +19,11 @@ */ public interface GoodsService extends IService<Goods> { - List<GoodsVO> goodsList(Goods goods); + PageInfo<GoodsVO> goodsList(Goods goods); GoodsVO goodsDetail(Long goodsId); - List<Goods> getGoodsListByShopId(Integer shopId); + List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId); void addGoods(Goods goods); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java index 4a11ead..90916e8 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -9,6 +10,7 @@ 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.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; import com.ruoyi.order.vo.Price; @@ -28,10 +30,7 @@ import javax.annotation.Resource; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -71,29 +70,19 @@ private RemoteOrderGoodsClient remoteOrderGoodsClient; @Override - public List<GoodsVO> goodsList(Goods search) { - List<Goods> goodsList = this.list(new LambdaQueryWrapper<Goods>() - .eq(Goods::getStatus, GoodsStatus.UP.getCode()) - .eq(Goods::getDelFlag, 0) - .eq(Objects.nonNull(search.getGoodsCategoryId()), Goods::getGoodsCategoryId, search.getGoodsCategoryId()) - .like(StringUtils.isNotEmpty(search.getName()), Goods::getName, search.getName())); - - List<GoodsVO> result = new ArrayList<>(); + public PageInfo<GoodsVO> goodsList(Goods search) { + PageInfo<GoodsVO> pageInfo = new PageInfo(search.getPageCurr(), search.getPageSize()); + List<GoodsVO> list = this.baseMapper.goodsList(pageInfo, search.getGoodsCategoryId(), search.getName()); 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); + for (GoodsVO goods : list) { + R<Price> r = remoteOrderGoodsClient.getGoodsPrice(loginUserApplet.getUserid(), goods.getGoodsId(), null); if (null != r.getData()){ Price price = r.getData(); - goodsVO.setSellingPrice(price.getCash()); - goodsVO.setIntegral(price.getPoint()); + goods.setSellingPrice(price.getCash()); + goods.setIntegral(price.getPoint()); } - result.add(goodsVO); } - return result; + return pageInfo.setRecords(list); } @Override @@ -136,29 +125,35 @@ goodsVO.setSellingPrice(sellingPrice); goodsVO.setIntegral(integral); - if(goods.getAppointStore() == 2){ + if(goods.getType() == 1){ + if(goods.getAppointStore() == 2){ + List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() + .in(Shop::getDelFlag, 0)); + goodsVO.setShopList(shopList); + }else{ + List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() + .eq(GoodsShop::getGoodsId, goodsId)); + if (!CollectionUtils.isEmpty(goodsShopList)){ + List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); + List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() + .in(Shop::getId, shopIds)); + goodsVO.setShopList(shopList); + } + } + }else{ List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() .in(Shop::getDelFlag, 0)); goodsVO.setShopList(shopList); - }else{ - List<GoodsShop> goodsShopList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() - .eq(GoodsShop::getGoodsId, goodsId)); - if (!CollectionUtils.isEmpty(goodsShopList)){ - List<Integer> shopIds = goodsShopList.stream().map(GoodsShop::getShopId).collect(Collectors.toList()); - List<Shop> shopList = shopMapper.selectList(new LambdaQueryWrapper<Shop>() - .in(Shop::getId, shopIds)); - goodsVO.setShopList(shopList); - } } return goodsVO; } @Override - public List<Goods> getGoodsListByShopId(Integer shopId) { + public List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId) { LoginUser loginUserApplet = tokenService.getLoginUserApplet(); VipSetting vipSetting = vipSettingService.getVipSettingByUserId(loginUserApplet.getUserid()); - return goodsMapper.selectListByShopId(shopId, vipSetting.getId()); + return goodsMapper.selectListByShopId(pageInfo, shopId, vipSetting.getId()); } @Override diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java index 1c132a4..eca535e 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java @@ -1,6 +1,7 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; @@ -10,6 +11,7 @@ import com.ruoyi.other.mapper.SeckillActivityInfoMapper; import com.ruoyi.other.mapper.ShopMapper; import com.ruoyi.other.service.GoodsSeckillService; +import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.SeckillActivityInfoService; import com.ruoyi.other.vo.SeckillActivityDetailVO; import com.ruoyi.other.vo.SeckillActivityVO; @@ -18,6 +20,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -43,6 +46,8 @@ private AppUserClient appUserClient; @Resource private GoodsSeckillService goodsSeckillService; + @Resource + private GoodsService goodsService; @Override public List<SeckillActivityVO> listSeckillActivity(Goods goods) { @@ -54,19 +59,23 @@ @Override public SeckillActivityDetailVO detail(Integer seckillActivityId) { - SeckillActivityDetailVO seckillActivityDetailVO = seckillActivityInfoMapper.selectDetail(seckillActivityId); + Long userid = tokenService.getLoginUserApplet().getUserid(); + AppUser appUser = appUserClient.getAppUserById(userid); + SeckillActivityDetailVO seckillActivityDetailVO = seckillActivityInfoMapper.selectDetail(seckillActivityId, appUser.getVipId()); Integer goodsId = seckillActivityDetailVO.getGoodsId(); - List<Integer> shopIdList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() - .eq(GoodsShop::getGoodsId, goodsId)).stream().map(GoodsShop::getShopId).collect(Collectors.toList()); - - List<String> shopNames = shopMapper.selectObjs(new LambdaQueryWrapper<Shop>() - .select(Shop::getName) - .in(Shop::getId, shopIdList)) - .stream() - .map(Object::toString) - .collect(Collectors.toList()); - seckillActivityDetailVO.setShopList(shopNames); + Goods goods = goodsService.getById(goodsId); + List<Shop> shops; + if(goods.getAppointStore() == 1){ + List<Integer> shopIdList = goodsShopMapper.selectList(new LambdaQueryWrapper<GoodsShop>() + .eq(GoodsShop::getGoodsId, goodsId)).stream().map(GoodsShop::getShopId).collect(Collectors.toList()); + shops = shopMapper.selectObjs(new LambdaQueryWrapper<Shop>() + .select(Shop::getName) + .in(shopIdList.size() > 0, Shop::getId, shopIdList)); + }else{ + shops = shopMapper.selectList(new LambdaUpdateWrapper<Shop>().eq(Shop::getDelFlag, 0)); + } + seckillActivityDetailVO.setShopList(shops); return seckillActivityDetailVO; } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java index f9e435f..230aa4a 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopPointServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.other.service.impl; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.other.api.domain.ShopPoint; @@ -9,6 +10,10 @@ import com.ruoyi.other.vo.ShopPointStatistics; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -45,6 +50,42 @@ IPage<ShopPoint> shopPointIPage = this.baseMapper.queryShpointPage(page, shopPoint); shopPointStatistics.setShopPointIPage(shopPointIPage); + LocalDateTime startTime = shopPoint.getStartTime(); + LocalDateTime endTime = shopPoint.getEndTime(); + if(null != startTime){ + List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>().eq(ShopPoint::getShopId, shopPoint.getShopId()) + .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); + List<String> date = new ArrayList<>(); + List<Map<String, Integer>> data = new ArrayList<>(); + String format = "MM.dd"; + while (true){ + if(startTime.isAfter(endTime)){ + break; + } + date.add(startTime.format(DateTimeFormatter.ofPattern(format))); + Map<String, Integer> map = new HashMap<>(); + //返佣积分 + LocalDateTime finalStartTime = startTime; + List<ShopPoint> collect = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 2).collect(Collectors.toList()); + map.put("fyjf", collect.stream().mapToInt(ShopPoint::getVariablePoint).sum()); + + //服务积分 + List<ShopPoint> collect1 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 4).collect(Collectors.toList()); + map.put("fwjf", collect1.stream().mapToInt(ShopPoint::getVariablePoint).sum()); + //绑定下级门店返佣积分 + List<ShopPoint> collect2 = list.stream().filter(s -> s.getCreateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + .equals(finalStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) && s.getType() == 3).collect(Collectors.toList()); + map.put("xjmdfyjf", collect2.stream().mapToInt(ShopPoint::getVariablePoint).sum()); + data.add(map); + startTime = startTime.plusDays(1); + } + Map<String, Object> brokenLine = new HashMap<>(); + brokenLine.put("date", date); + brokenLine.put("data", data); + shopPointStatistics.setBrokenLine(brokenLine); + } return shopPointStatistics; } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java index 252210e..a7870b6 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/SeckillActivityDetailVO.java @@ -1,5 +1,6 @@ package com.ruoyi.other.vo; +import com.ruoyi.other.api.domain.Shop; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -19,7 +20,7 @@ private LocalDateTime endTime; @ApiModelProperty(value = "可用门店") - private List<String> shopList; + private List<Shop> shopList; @ApiModelProperty(value = "商品详情") private String detail; diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java index 79f8376..9d34224 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopPointStatistics.java @@ -7,6 +7,7 @@ import lombok.Data; import java.util.List; +import java.util.Map; @Data @ApiModel("门店积分统计") @@ -37,4 +38,7 @@ private Integer subShopCommissionPoint; private IPage<ShopPoint> shopPointIPage; + + @ApiModelProperty("折线图数据") + private Map<String, Object> brokenLine; } diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml index 59d9526..4422b65 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/CouponInfoMapper.xml @@ -24,7 +24,8 @@ tci.send_type, tci.need_point, tci.person_type, - tci.person_ids + tci.person_ids, + tci.shelf_status FROM t_coupon_info tci <where> diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml index ab151b1..5ca5a61 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/GoodsMapper.xml @@ -18,7 +18,7 @@ LEFT JOIN t_goods tg ON tg.id = tgs.goods_id where ts.id = #{shopId} and ts.del_flag = 0 <if test="vip != null"> - and FIND_IN_SET(#{vip}, commodity_authority) > 0 + and FIND_IN_SET(#{vip}, tg.commodity_authority) > 0 </if> ORDER BY tg.sale_num DESC </select> @@ -59,4 +59,15 @@ </where> order by tg.sort desc </select> + + + <select id="goodsList" resultType="com.ruoyi.other.vo.GoodsVO"> + select *, id as goodsId, name as goodsName from t_goods where status = 2 and del_flag = 0 + <if test="null != goodsCategoryId"> + and goods_category_id = #{goodsCategoryId} + </if> + <if test="null != name and '' != name"> + and name like CONCAT('%', #{name}, '%') + </if> + </select> </mapper> \ No newline at end of file diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml index 28c96b4..cbbd719 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml @@ -16,8 +16,8 @@ FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id - LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id - WHERE tsai.end_time >= NOW() AND tsai.del_flag = 0 + LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vipId} + WHERE tsai.is_shelves = 1 AND tsai.del_flag = 0 <if test="name != null and name != ''"> AND tg.`name` LIKE concat('%',#{goodsName},'%') </if> @@ -25,12 +25,16 @@ AND tg.goods_category_id = #{goodsCategoryId} </if> <if test="vipId != null"> - AND find_in_set(#{vipId},tgs.vip) > 0 + AND tgs.vip in (0, -1, #{vipId}) + </if> + <if test="vipId == null"> + AND tgs.vip in (0, -1) </if> </select> <select id="selectDetail" resultType="com.ruoyi.other.vo.SeckillActivityDetailVO"> SELECT tsai.id, + tsai.good_id as goodsId, tg.`name`, tg.introduction, tg.home_page_picture, @@ -39,12 +43,12 @@ tg.sale_num, tsai.start_time, tg.detail_picture, - tsal.end_time, + tsai.end_time, tg.detail FROM t_seckill_activity_info tsai LEFT JOIN t_goods tg ON tsai.good_id = tg.id - LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id + LEFT JOIN t_goods_seckill tgs ON tgs.seckill_activity_info_id = tsai.id and tgs.vip = #{vip} WHERE tsai.id = #{seckillActivityId} AND tsai.del_flag = 0 </select> <select id="querySeckillActivity" resultType="com.ruoyi.other.vo.SeckillActivityVO"> -- Gitblit v1.7.1