ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -111,6 +111,11 @@ } @Override public void vipDemotion(Long appUserId) { R.fail("检查会员等级降级失败:" + cause.getMessage()); } @Override public void demotionDetection() { R.fail("用户降级检测失败:" + cause.getMessage()); } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -101,6 +101,15 @@ /** * 检查会员降级 * @param appUserId */ @PostMapping("/app-user/vipDemotion") void vipDemotion(@RequestParam("appUserId") Long appUserId); /** * 用户降级检测 */ @PostMapping("/app-user/demotionDetection") ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/BalanceChangeRecord.java
@@ -91,4 +91,8 @@ @TableField(exist = false) private String shopName; @ApiModelProperty(value = "增或减标识: 1-增 2-减") @TableField(exist = false) private Integer flag; } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/UserPoint.java
@@ -38,7 +38,7 @@ private Long id; @ApiModelProperty(value = "变动类型(1-消费,2-返佣,3-拉新,4-每日分享,5-每日签到,6-使用时长, 7-注册积分, 8-门店业绩," + "9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人,14-兑换券)") "9-门店返佣,14-下级门店返佣,10-技师业绩,11-兑换商品,12-他人赠送,13-赠与他人,15-兑换券)") @TableField("type") private Integer type; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/RefundPass.java
@@ -100,5 +100,6 @@ private String expressResult; @ApiModelProperty("最新快递信息") @TableField(exist = false) private String express; } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -995,6 +995,17 @@ /** * 检查会员降级 * @param appUserId */ @PostMapping("/app-user/vipDemotion") public void vipDemotion(@RequestParam("appUserId") Long appUserId){ appUserService.vipDemotion(appUserId); } /** * 用户降级检测 */ @PostMapping("/demotionDetection") ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/UserCouponController.java
@@ -244,7 +244,7 @@ appUserService.updateById(byId); UserPoint userPoint = new UserPoint(); userPoint.setType(14); userPoint.setType(15); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(point); userPoint.setBalance(byId.getLavePoint()); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
@@ -118,6 +118,14 @@ bc.setUserName(appUser.getName()); bc.setAmount(o.getPaymentAmount()); }); BigDecimal beforeAmount = bc.getBeforeAmount(); BigDecimal afterAmount = bc.getAfterAmount(); if (beforeAmount.compareTo(afterAmount) > 0){ bc.setFlag(2); }else { bc.setFlag(1); } }); } return R.ok(list); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/AppUserService.java
@@ -94,6 +94,12 @@ */ void vipUpgrade(Long appUserId); /** * 处理用户会员降级 * @param appUserId */ void vipDemotion(Long appUserId); /** * 降级检测 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -179,7 +179,8 @@ } //查询用户是否注册,没有注册则跳转到注册页面 AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()).ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); AppUser appUser = this.getOne(new LambdaQueryWrapper<AppUser>().eq(AppUser::getPhone, mobileLogin.getPhone()) .ne(AppUser::getStatus, 3).eq(AppUser::getDelFlag, 0)); if(null == appUser){ LoginVo loginVo = new LoginVo(); loginVo.setSkipPage(2); @@ -200,8 +201,7 @@ loginUser.setUsername(appUser.getName()); Map<String, Object> tokenApplet = tokenService.createTokenApplet(loginUser); loginVo.setToken(tokenApplet.get("access_token").toString()); loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); loginVo.setFailureTime(Long.valueOf(tokenApplet.get("expires_in").toString())); appUser.setLastLoginTime(LocalDateTime.now()); this.updateById(appUser); return R.ok(loginVo); @@ -608,7 +608,85 @@ } } /** * 处理会员降级 * @param appUserId */ @Override public void vipDemotion(Long appUserId) { AppUser appUser = this.getById(appUserId); Integer vipId = appUser.getVipId(); //黄金会员 VipSetting vipSetting2 = vipSettingClient.getVipSetting(2).getData(); //消费积分满足升级 if(1 == vipSetting2.getVipLevelUpShopRole() && appUser.getShopPoint() >= vipSetting2.getVipLevelUpShop() && appUser.getVipId() > 2){ appUser.setVipId(2); this.updateById(appUser); //添加等级变化记录 UserChangeLog userChangeLog = new UserChangeLog(); userChangeLog.setDelFlag(0); userChangeLog.setCreateTime(LocalDateTime.now()); userChangeLog.setAppUserId(appUser.getId()); userChangeLog.setBeforeVipId(vipId); userChangeLog.setAfterVipId(appUser.getVipId()); userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); return; } //返佣积分满足升级 if(1 == vipSetting2.getVipLevelUpShareRole() && appUser.getSharePoint() >= vipSetting2.getVipLevelUpShare() && appUser.getVipId() > 2){ appUser.setVipId(2); this.updateById(appUser); //添加等级变化记录 UserChangeLog userChangeLog = new UserChangeLog(); userChangeLog.setDelFlag(0); userChangeLog.setCreateTime(LocalDateTime.now()); userChangeLog.setAppUserId(appUser.getId()); userChangeLog.setBeforeVipId(vipId); userChangeLog.setAfterVipId(appUser.getVipId()); userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); return; } //下级人数满足升级 Integer vipLevelUpNumRole = vipSetting2.getVipLevelUpNumRole(); Integer vipDirectNum = vipSetting2.getVipDirectNum(); Integer vipTeamNum = vipSetting2.getVipTeamNum(); if(1 == vipLevelUpNumRole && appUser.getVipId() > 2){ //查询直推用户达到X人或者团队人数达到X人后,可升级 //直推用户数 long count = this.count(new LambdaQueryWrapper<AppUser>().eq(AppUser::getDelFlag, 0).eq(AppUser::getStatus, 1).eq(AppUser::getInviteUserId, appUserId)); //团队用户数 List<AppUser> subordinate = getSubordinate(appUserId); if(vipDirectNum <= count || vipTeamNum <= subordinate.size()){ appUser.setVipId(2); this.updateById(appUser); //添加等级变化记录 UserChangeLog userChangeLog = new UserChangeLog(); userChangeLog.setDelFlag(0); userChangeLog.setCreateTime(LocalDateTime.now()); userChangeLog.setAppUserId(appUser.getId()); userChangeLog.setBeforeVipId(vipId); userChangeLog.setAfterVipId(appUser.getVipId()); userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); return; } } if(appUser.getVipId() > 2){ appUser.setVipId(1); this.updateById(appUser); //添加等级变化记录 UserChangeLog userChangeLog = new UserChangeLog(); userChangeLog.setDelFlag(0); userChangeLog.setCreateTime(LocalDateTime.now()); userChangeLog.setAppUserId(appUser.getId()); userChangeLog.setBeforeVipId(vipId); userChangeLog.setAfterVipId(appUser.getVipId()); userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); } } /** * 递归查询顶级推广人 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/RefundPassController.java
@@ -92,7 +92,7 @@ if(StringUtils.isNotEmpty(one.getExpressResult())){ MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(one.getExpressResult(), MapTrackKD100Vo.class); List<QueryKD100ListVo> data = mapTrackKD100Vo.getData(); one.setExpress(data.size() > 0 ? data.get(0).getContext() : ""); one.setExpress(null != data && data.size() > 0 ? data.get(0).getContext() : ""); } return R.ok(one); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -6,10 +6,7 @@ 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.feignClient.BalanceChangeRecordClient; import com.ruoyi.account.api.feignClient.UserCouponClient; import com.ruoyi.account.api.feignClient.UserPointClient; import com.ruoyi.account.api.feignClient.*; import com.ruoyi.account.api.model.*; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; @@ -89,9 +86,6 @@ private UserPointClient userPointClient; @Resource private PointSettingClient pointSettingClient; @Resource private OrderBalancePaymentService orderBalancePaymentService; @Resource @@ -115,6 +109,9 @@ @Resource private UserCouponClient userCouponClient; @Resource private UserChangeLogClient userChangeLogClient; @@ -205,7 +202,7 @@ if(StringUtils.isNotEmpty(order.getExpressResult())){ MapTrackKD100Vo mapTrackKD100Vo = JSON.parseObject(order.getExpressResult(), MapTrackKD100Vo.class); List<QueryKD100ListVo> data = mapTrackKD100Vo.getData(); orderDetailVO.setExpress(data.size() > 0 ? data.get(0).getContext() : ""); orderDetailVO.setExpress(null != data && data.size() > 0 ? data.get(0).getContext() : ""); } if(order.getOrderType() == 1){ @@ -286,6 +283,7 @@ if(StringUtils.isNotEmpty(technicianId) && !"null".equals(technicianId)){ order.setTechnicianId(Integer.valueOf(technicianId)); } // TODO orderMapper.updateById(order); } @@ -518,11 +516,6 @@ } appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } //构建积分流水明细 UserPoint userPoint = new UserPoint(); userPoint.setType(1); @@ -534,6 +527,12 @@ userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); //降级检测 boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUserClient.vipDemotion(appUser.getId()); } //回退优惠券状态 if(null != order.getUserCouponId()){ UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); @@ -650,11 +649,6 @@ } appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } //构建积分流水明细 UserPoint userPoint = new UserPoint(); userPoint.setType(1); @@ -666,6 +660,12 @@ userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); //降级检测 boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUserClient.vipDemotion(appUser.getId()); } //回退优惠券状态 if(null != order.getUserCouponId()){ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/enums/TechnicianStatus.java
@@ -5,7 +5,6 @@ @Getter public enum TechnicianStatus { UNSUBSCRIBE(0, "待服务"), SERVE(1, "已服务"), CANCEL(2, "已取消"), EXPIRED(3, "已到期"); private final Integer code;