Commit 1dd8546d authored by 王亚雷's avatar 王亚雷

Merge remote-tracking branch 'origin/feat/v20220725' into dev

parents 56e9b922 dfe3145b
package com.tanpu.fund.api; package com.tanpu.fund.api;
import com.tanpu.common.model.fund.req.IncReportDownloadTimesReq;
import com.tanpu.common.model.product.resp.Net; import com.tanpu.common.model.product.resp.Net;
import com.tanpu.common.resp.CommonResp; import com.tanpu.common.resp.CommonResp;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
...@@ -27,4 +30,12 @@ public interface ProductForPcApi { ...@@ -27,4 +30,12 @@ public interface ProductForPcApi {
@ApiOperation("增加标准会员的下载次数") @ApiOperation("增加标准会员的下载次数")
@GetMapping("/pdf/standard/add") @GetMapping("/pdf/standard/add")
CommonResp<Void> addStandardVipCount(String userId); CommonResp<Void> addStandardVipCount(String userId);
/**
* 增加报告下载次数
* @param req 请求参数
* @return 总次数
*/
@PostMapping("/inner/incReportDownloadTimes")
CommonResp<Integer> incReportDownloadTimes(@RequestBody IncReportDownloadTimesReq req);
} }
package com.tanpu.fund.controller; package com.tanpu.fund.controller;
import com.tanpu.common.auth.mapping.TanpuInterfaceLoginAuth;
import com.tanpu.common.model.fund.req.IncReportDownloadTimesReq;
import com.tanpu.common.model.product.resp.Net; import com.tanpu.common.model.product.resp.Net;
import com.tanpu.common.resp.CommonResp; import com.tanpu.common.resp.CommonResp;
import com.tanpu.fund.api.ProductForPcApi; import com.tanpu.fund.api.ProductForPcApi;
...@@ -41,4 +43,17 @@ public class ProductForPcController implements ProductForPcApi { ...@@ -41,4 +43,17 @@ public class ProductForPcController implements ProductForPcApi {
downloadPdfService.addStandardVipCount(userId); downloadPdfService.addStandardVipCount(userId);
return CommonResp.success(); return CommonResp.success();
} }
/**
* 增加报告下载次数
*
* @param req 请求参数
* @return 总次数
*/
@Override
@TanpuInterfaceLoginAuth
public CommonResp<Integer> incReportDownloadTimes(IncReportDownloadTimesReq req) {
int totalTimes = downloadPdfService.incReportDownloadTimes(req);
return CommonResp.success(totalTimes);
}
} }
...@@ -2,6 +2,8 @@ package com.tanpu.fund.mapper.generator; ...@@ -2,6 +2,8 @@ package com.tanpu.fund.mapper.generator;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.fund.entity.generator.ReportDownloadSummary; import com.tanpu.fund.entity.generator.ReportDownloadSummary;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ReportDownloadSummaryMapper extends BaseMapper<ReportDownloadSummary> { public interface ReportDownloadSummaryMapper extends BaseMapper<ReportDownloadSummary> {
} }
\ No newline at end of file
package com.tanpu.fund.service; package com.tanpu.fund.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tanpu.common.model.fund.req.IncReportDownloadTimesReq;
import com.tanpu.fund.entity.generator.ReportDownloadSummary; import com.tanpu.fund.entity.generator.ReportDownloadSummary;
import com.tanpu.fund.mapper.generator.ReportDownloadSummaryMapper; import com.tanpu.fund.mapper.generator.ReportDownloadSummaryMapper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -47,8 +49,33 @@ public class DownloadPdfService { ...@@ -47,8 +49,33 @@ public class DownloadPdfService {
entity.setStdVipLimit(entity.getStdVipLimit() + onceAddTimes); entity.setStdVipLimit(entity.getStdVipLimit() + onceAddTimes);
reportDownloadSummaryMapper.updateById(entity); reportDownloadSummaryMapper.updateById(entity);
} }
}
/**
* 增加报告下载次数
*
* @param req 请求参数
* @return 总次数
*/
@Transactional(rollbackFor = Exception.class)
public int incReportDownloadTimes(IncReportDownloadTimesReq req) {
ReportDownloadSummary record = reportDownloadSummaryMapper.selectOne(
Wrappers.<ReportDownloadSummary>lambdaQuery().eq(ReportDownloadSummary::getUserId, req.getUserId()));
if (record == null) {
reportDownloadSummaryMapper.insert(
ReportDownloadSummary.builder()
.userId(req.getUserId())
.reportTimesBuy(req.getIncTimes())
.build()
);
} else {
reportDownloadSummaryMapper.updateById(
ReportDownloadSummary.builder()
.id(record.getId())
.reportTimesBuy(record.getReportTimesBuy() + req.getIncTimes())
.build()
);
}
return record == null ? req.getIncTimes() : record.getReportTimesBuy() + req.getIncTimes();
} }
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<result column="hold_fund_report_std" jdbcType="INTEGER" property="holdFundReportStd" /> <result column="hold_fund_report_std" jdbcType="INTEGER" property="holdFundReportStd" />
<result column="free_total_limit" jdbcType="INTEGER" property="freeTotalLimit" /> <result column="free_total_limit" jdbcType="INTEGER" property="freeTotalLimit" />
<result column="std_vip_limit" jdbcType="INTEGER" property="stdVipLimit" /> <result column="std_vip_limit" jdbcType="INTEGER" property="stdVipLimit" />
<result column="report_times_buy" jdbcType="INTEGER" property="reportTimesBuy" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap> </resultMap>
...@@ -22,6 +23,6 @@ ...@@ -22,6 +23,6 @@
<!--@mbg.generated--> <!--@mbg.generated-->
id, user_id, deep_report, deep_report_std, cumulative_profit_report, cumulative_profit_report_std, id, user_id, deep_report, deep_report_std, cumulative_profit_report, cumulative_profit_report_std,
weekly_monthly_report, hold_fund_report, hold_fund_report_std, free_total_limit, weekly_monthly_report, hold_fund_report, hold_fund_report_std, free_total_limit,
std_vip_limit, create_time, update_time std_vip_limit, report_times_buy, create_time, update_time
</sql> </sql>
</mapper> </mapper>
\ No newline at end of file
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