ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AgentApplicationController.java
@@ -79,7 +79,7 @@ VipSettingDto vipSettingDto = new VipSettingDto(); BeanUtils.copyProperties(vipSetting.getData(),vipSettingDto); agentApplication.setVipSettingDto(vipSettingDto); agentApplication.setVipId(agentApplication.getApplicationVipId()); agentApplication.setVipId(agentApplication.getVipId()); return R.ok(agentApplication); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -531,7 +531,7 @@ DangerInfoDto dangerInfoDto = new DangerInfoDto(); BeanUtils.copyProperties(data, dangerInfoDto); List<UserPoint> list1 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 1).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 9).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); List<UserPoint> list2 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 2).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); List<UserPoint> list3 = userPointService.lambdaQuery().eq(UserPoint::getAppUserId,id).eq(UserPoint::getType, 8).ge(UserPoint::getCreateTime, now.minusDays(data.getKeepBuyDay())).list(); Integer userKeepBuyPoint = 0; for (UserPoint userPoint : list1) { @@ -565,6 +565,27 @@ userChangeLog.setChangeType(0); userChangeLogService.save(userChangeLog); appUser.setVipId(appUser.getVipId() - 1); appUser.setIsDanger(0); //检查是否达标,不达标继续标红 VipSetting vipSetting = vipSettingClient.getVipSetting(appUser.getVipId()).getData(); //消费积分 List<UserPoint> list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 1).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepBuyDay() + " DAY) >= create_time")); int sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepBuyPoint()){ appUser.setIsDanger(1); } //返佣积分 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 2).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShareDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepSharePoint()){ appUser.setIsDanger(1); } //门店业绩 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 8).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShopDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepShopPoint()){ appUser.setIsDanger(1); } appUserService.updateById(appUser); return R.ok(); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/BalanceChangeRecordMapper.java
@@ -15,6 +15,9 @@ List<BalanceChangeRecord> selectBalanceChangeRecordList(@Param("changeRecord") BalanceChangeRecord balanceChangeRecord); List<BalanceChangeRecord> selectBalanceChangeRecordList1(@Param("changeRecord") BalanceChangeRecord balanceChangeRecord); IPage<BalanceChangeRecord> queryCommissionStatistics(@Param("page") Page<BalanceChangeRecord> page, @Param("changeRecord") BalanceChangeRecord changeRecord); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -967,97 +967,33 @@ public void demotionDetection() { //代理 List<AppUser> appUserList = new ArrayList<>(); VipSetting vipSetting = vipSettingClient.getVipSetting(5).getData(); List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 5).eq(AppUser::getStatus, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getIsDanger, 0)); for (AppUser appUser : list) { //消费积分 List<UserPoint> list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 1).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepBuyDay() + " DAY) >= create_time")); int sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepBuyPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //返佣积分 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 2).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShareDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepSharePoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //门店业绩 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 8).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShopDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepShopPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); } } if(appUserList.size() > 0){ this.updateBatchById(appUserList); } //总代 appUserList = new ArrayList<>(); vipSetting = vipSettingClient.getVipSetting(6).getData(); list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 6).eq(AppUser::getStatus, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getIsDanger, 0)); for (AppUser appUser : list) { //消费积分 List<UserPoint> list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 1).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepBuyDay() + " DAY) >= create_time")); int sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepBuyPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //返佣积分 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 2).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShareDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepSharePoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //门店业绩 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 8).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShopDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepShopPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); } } if(appUserList.size() > 0){ this.updateBatchById(appUserList); } //合伙人 appUserList = new ArrayList<>(); vipSetting = vipSettingClient.getVipSetting(7).getData(); list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, 7).eq(AppUser::getStatus, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getIsDanger, 0)); for (AppUser appUser : list) { //消费积分 List<UserPoint> list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 1).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepBuyDay() + " DAY) >= create_time")); int sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepBuyPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //返佣积分 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 2).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShareDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepSharePoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //门店业绩 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 8).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShopDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepShopPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); for (int i = 5; i < 8; i++) { VipSetting vipSetting = vipSettingClient.getVipSetting(i).getData(); List<AppUser> list = this.list(new LambdaQueryWrapper<AppUser>().eq(AppUser::getVipId, i).eq(AppUser::getStatus, 1).eq(AppUser::getDelFlag, 0).eq(AppUser::getIsDanger, 0)); for (AppUser appUser : list) { //消费积分 List<UserPoint> list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 1).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepBuyDay() + " DAY) >= create_time")); int sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepBuyPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //返佣积分 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 2).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShareDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepSharePoint()){ appUser.setIsDanger(1); appUserList.add(appUser); continue; } //门店业绩 list1 = userPointService.list(new LambdaQueryWrapper<UserPoint>().eq(UserPoint::getAppUserId, appUser.getId()).eq(UserPoint::getType, 8).last(" and SUBDATE(now(), INTERVAL " + vipSetting.getKeepShopDay() + " DAY) >= create_time")); sum = list1.stream().mapToInt(UserPoint::getVariablePoint).sum(); if(sum < vipSetting.getKeepShopPoint()){ appUser.setIsDanger(1); appUserList.add(appUser); } } } if(appUserList.size() > 0){ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/BalanceChangeRecordServiceImpl.java
@@ -75,18 +75,15 @@ ShopBalanceStatement shopBalanceStatement = new ShopBalanceStatement(); shopBalanceStatement.setType(1); List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList(balanceChangeRecord); List<BalanceChangeRecord> balanceChangeRecordList = this.baseMapper.selectBalanceChangeRecordList1(balanceChangeRecord); List<WalletStatisticsDetail> walletStatisticsDetailList = new ArrayList<>(); for (BalanceChangeRecord changeRecord : balanceChangeRecordList) { WalletStatisticsDetail walletStatisticsDetail = new WalletStatisticsDetail(); BeanUtils.copyBeanProp(walletStatisticsDetail, changeRecord); walletStatisticsDetailList.add(walletStatisticsDetail); } // 按时间排序(倒序) walletStatisticsDetailList.sort(Comparator.comparing(WalletStatisticsDetail::getCreateTime).reversed()); long current = page.getCurrent(); long size = page.getSize(); if (current < 1) { ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml
@@ -45,7 +45,7 @@ and t1.status = #{agentQuery.status} </if> </where> order by t1.status asc order by t1.create_time asc </select> </mapper> ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml
@@ -55,6 +55,35 @@ <select id="selectBalanceChangeRecordList" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> <include refid="balanceChangeRecordList"/> </select> <select id="selectBalanceChangeRecordList1" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> SELECT tau.`name` userName, tau.phone userPhone, tbcr.change_type, tbcr.create_time, tbcr.change_amount, tbcr.before_amount, tbcr.after_amount FROM t_balance_change_record tbcr LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id <where> <if test="changeRecord.userName != null and changeRecord.userName != ''"> and tau.name like concat('%',#{changeRecord.userName},'%') </if> <if test="changeRecord.userPhone != null and changeRecord.userPhone != ''"> and tau.phone like concat('%',#{changeRecord.userPhone},'%') </if> <if test="changeRecord.startTime != null and changeRecord.endTime != null"> and (tbcr.create_time between #{changeRecord.startTime} and #{changeRecord.endTime}) </if> <if test="changeRecord.changeType != null"> and tbcr.change_type = #{changeRecord.changeType} </if> </where> </select> <select id="queryCommissionStatistics" resultType="com.ruoyi.account.api.model.BalanceChangeRecord"> <include refid="balanceChangeRecordList"/> </select> ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -137,7 +137,9 @@ if(0 < count){ return R.fail("商品已被会员配置使用,不能删除"); } goodsService.removeById(goodsId); Goods goods = goodsService.getById(goodsId); goods.setDelFlag(1); goodsService.updateById(goods); return R.ok(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -152,12 +152,11 @@ if(sysUser.getRoleType() == 2){ share.setObjectId(sysUser.getObjectId().longValue()); } // if (sysUser.getRoleType() == 1){ // share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); // }else{ // share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); // } share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); if (sysUser.getRoleType() == 1){ share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); }else{ share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); } share.setDelFlag(0); shareService.save(share); return R.ok(); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/SeckillActivityInfoServiceImpl.java
@@ -202,8 +202,10 @@ @Transactional(rollbackFor = Exception.class) public void saveSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) { Integer goodId = seckillActivityInfo.getGoodId(); LocalDateTime startTime = seckillActivityInfo.getStartTime(); LocalDateTime endTime = seckillActivityInfo.getEndTime(); long count = this.count(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodId).eq(SeckillActivityInfo::getDelFlag, 0) .eq(SeckillActivityInfo::getIsShelves, 1).last(" and now() between start_time and end_time")); .eq(SeckillActivityInfo::getIsShelves, 1).last(" and (" + startTime + " between start_time and end_time or " + endTime + " between start_time and end_time)")); if(0 < count){ throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在"); } @@ -221,9 +223,11 @@ @Transactional(rollbackFor = Exception.class) public void updateSeckillActivityInfo(SeckillActivityInfo seckillActivityInfo) { Integer goodId = seckillActivityInfo.getGoodId(); LocalDateTime startTime = seckillActivityInfo.getStartTime(); LocalDateTime endTime = seckillActivityInfo.getEndTime(); long count = this.count(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, goodId).eq(SeckillActivityInfo::getDelFlag, 0) .eq(SeckillActivityInfo::getIsShelves, 1).last(" and now() between start_time and end_time")); if(1 < count){ .eq(SeckillActivityInfo::getIsShelves, 1).last(" and (" + startTime + " between start_time and end_time or " + endTime + " between start_time and end_time)")); if(0 < count){ throw new RuntimeException("该秒杀商品已在其他秒杀活动中存在"); } this.baseMapper.updateById(seckillActivityInfo);