Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 拼团记录,虚拟成团数有误 #720

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

fatbun
Copy link

@fatbun fatbun commented Dec 12, 2024

知识星球提的关于“拼团记录,虚拟成团(个)查询有误”的PR
WeChatb8d42c5e449aea16954fac33372f1001

@@ -240,4 +240,10 @@ public CombinationActivityDO getMatchCombinationActivityBySpuId(Long spuId) {
return combinationActivityMapper.selectBySpuIdAndStatusAndNow(spuId, CommonStatusEnum.ENABLE.getStatus());
}

@Override
public List<CombinationActivityDO> getByVirtualGroup() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

具体查询,建议放到 mapper 里。

service 不要有 dao 操作

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

// virtualGroup 为 true 的时候,查询虚拟成团的数量
List<CombinationActivityDO> activities = combinationActivityService.getByVirtualGroup();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个,是不是只查询数量?不要返回 list 去求 count

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的主要目的是查activityIds

}

List<Long> activityIds = convertList(activities, CombinationActivityDO::getId);
return combinationRecordMapper.selectCountByHeadAndStatusAndActivityIds(activityIds, status, headId);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是不用 activityIds 过滤???

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要activityIds过滤。从数据上看,虚拟成团(virtual_group)在 promotion_combination_record ,真实用户记 true。虚拟用户记 false。导致只能依靠activityIds筛选出虚拟成团的数据。

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是不是不拿 activityIds 过滤,直接通过 “真实用户记 true。虚拟用户记 false”,也可以呀?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有个疑问:在拼团活动支持虚拟成团的情况下,一个队伍(全是真实用户),一个队伍(存在虚拟用户),那么在统计页面【拼团记录——虚拟成团(个)】预期是2 还是1?

@YunaiV
Copy link
Owner

YunaiV commented Dec 28, 2024

我想了一下,是不是应该在

@GetMapping("/get-summary")
    @Operation(summary = "获得拼团记录的概要信息", description = "用于拼团记录页面展示")
    @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')")
    public CommonResult<CombinationRecordSummaryVO> getCombinationRecordSummary() {
        CombinationRecordSummaryVO summaryVO = new CombinationRecordSummaryVO();
        summaryVO.setUserCount(combinationRecordService.getCombinationUserCount()); // 获取拼团用户参与数量
        summaryVO.setSuccessCount(combinationRecordService.getCombinationRecordCount( // 获取成团记录
                CombinationRecordStatusEnum.SUCCESS.getStatus(), null, CombinationRecordDO.HEAD_ID_GROUP));
        summaryVO.setVirtualGroupCount(combinationRecordService.getCombinationRecordCount(// 获取虚拟成团记录
                null, Boolean.TRUE, CombinationRecordDO.HEAD_ID_GROUP));
        return success(summaryVO);
    }

summaryVO.setVirtualGroupCount(combinationRecordService.getCombinationRecordCount(// 获取虚拟成团记录
                null, Boolean.TRUE, CombinationRecordDO.HEAD_ID_GROUP));

改成

summaryVO.setVirtualGroupCount(combinationRecordService.getCombinationRecordCount(// 获取虚拟成团记录
                null, Boolean.TRUE, null));

更合理噢?就是不限制 headId

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants