Commit 543d2a6d authored by 刘基明's avatar 刘基明

Merge branch 'v3.2.0_download_pdf' into 'dev'

pdf 下载

See merge request !11
parents 16bbc09e 31f3dc33
...@@ -7,18 +7,21 @@ import org.apache.commons.collections4.CollectionUtils; ...@@ -7,18 +7,21 @@ import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
@Service @Service
public class DownloadPdfService { public class DownloadPdfService {
@Resource
private ReportDownloadSummaryMapper reportDownloadSummaryMapper; private ReportDownloadSummaryMapper reportDownloadSummaryMapper;
private static final Integer onceAddTimes = 200; private static final Integer onceAddTimes = 200;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void emptyStandardVipCount(String userId) { public void emptyStandardVipCount(String userId) {
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(new LambdaQueryWrapper<ReportDownloadSummary>().eq(ReportDownloadSummary::getUserId, userId)); LambdaQueryWrapper<ReportDownloadSummary> qw = new LambdaQueryWrapper<>();
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(qw.eq(ReportDownloadSummary::getUserId, userId));
if (CollectionUtils.isEmpty(reportDownloadSummaries)){ if (CollectionUtils.isEmpty(reportDownloadSummaries)){
ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(0).build(); ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(0).build();
reportDownloadSummaryMapper.insert(entity); reportDownloadSummaryMapper.insert(entity);
...@@ -31,7 +34,8 @@ public class DownloadPdfService { ...@@ -31,7 +34,8 @@ public class DownloadPdfService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addStandardVipCount(String userId) { public void addStandardVipCount(String userId) {
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(new LambdaQueryWrapper<ReportDownloadSummary>().eq(ReportDownloadSummary::getUserId, userId)); LambdaQueryWrapper<ReportDownloadSummary> qw = new LambdaQueryWrapper<>();
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(qw.eq(ReportDownloadSummary::getUserId, userId));
if (CollectionUtils.isEmpty(reportDownloadSummaries)){ if (CollectionUtils.isEmpty(reportDownloadSummaries)){
ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(onceAddTimes).build(); ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(onceAddTimes).build();
reportDownloadSummaryMapper.insert(entity); reportDownloadSummaryMapper.insert(entity);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment