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

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

parents 56e9b922 dfe3145b
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.resp.CommonResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 java.util.List;
......@@ -27,4 +30,12 @@ public interface ProductForPcApi {
@ApiOperation("增加标准会员的下载次数")
@GetMapping("/pdf/standard/add")
CommonResp<Void> addStandardVipCount(String userId);
/**
* 增加报告下载次数
* @param req 请求参数
* @return 总次数
*/
@PostMapping("/inner/incReportDownloadTimes")
CommonResp<Integer> incReportDownloadTimes(@RequestBody IncReportDownloadTimesReq req);
}
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.resp.CommonResp;
import com.tanpu.fund.api.ProductForPcApi;
......@@ -41,4 +43,17 @@ public class ProductForPcController implements ProductForPcApi {
downloadPdfService.addStandardVipCount(userId);
return CommonResp.success();
}
/**
* 增加报告下载次数
*
* @param req 请求参数
* @return 总次数
*/
@Override
@TanpuInterfaceLoginAuth
public CommonResp<Integer> incReportDownloadTimes(IncReportDownloadTimesReq req) {
int totalTimes = downloadPdfService.incReportDownloadTimes(req);
return CommonResp.success(totalTimes);
}
}
......@@ -4,313 +4,148 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
import lombok.NoArgsConstructor;
/**
* 报告下载统计
*/
@TableName(value = "report_download_summary")
@Builder
@ApiModel(value = "报告下载统计")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "report_download_summary")
public class ReportDownloadSummary {
public static final String COL_REPORT_COUNT_BUY = "report_count_buy";
/**
* id
*/
@TableId(value = "id", type = IdType.INPUT)
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id;
/**
* 用户Id
*/
@TableField(value = "user_id")
@ApiModelProperty(value = "用户Id")
private String userId;
/**
* 深度报告免费下载次数
* 深度报告-免费版-下载次数
*/
@TableField(value = "deep_report")
@ApiModelProperty(value = "深度报告-免费版-下载次数")
private Integer deepReport;
/**
* 深度报告-标准版-下载次数
*/
@TableField(value = "deep_report_std")
@ApiModelProperty(value = "深度报告-标准版-下载次数")
private Integer deepReportStd;
/**
* 累计收益报告-免费下载次数
* 累计收益报告-免费版-下载次数
*/
@TableField(value = "cumulative_profit_report")
@ApiModelProperty(value = "累计收益报告-免费版-下载次数")
private Integer cumulativeProfitReport;
/**
* 累计收益报告-标准版-下载次数
*/
@TableField(value = "cumulative_profit_report_std")
@ApiModelProperty(value = "累计收益报告-标准版-下载次数")
private Integer cumulativeProfitReportStd;
/**
* 周报/月报
*/
@TableField(value = "weekly_monthly_report")
@ApiModelProperty(value = "周报/月报")
private Integer weeklyMonthlyReport;
/**
* 持仓分析-免费版-下载次数
*/
@TableField(value = "hold_fund_report")
@ApiModelProperty(value = "持仓分析-免费版-下载次数")
private Integer holdFundReport;
/**
* 持仓分析-标准版-下载次数
*/
@TableField(value = "hold_fund_report_std")
@ApiModelProperty(value = "持仓分析-标准版-下载次数")
private Integer holdFundReportStd;
/**
* 免费版-下载次数上限
*/
@TableField(value = "free_total_limit")
@ApiModelProperty(value = "免费版-下载次数上限")
private Integer freeTotalLimit;
/**
* 标准版-下载次数上限
*/
@TableField(value = "std_vip_limit")
@ApiModelProperty(value = "标准版-下载次数上限")
private Integer stdVipLimit;
@TableField(value = "create_time")
private Date createTime;
@TableField(value = "update_time")
private Date updateTime;
/**
* 获取id
*
* @return id - id
*/
public Long getId() {
return id;
}
/**
* 设置id
*
* @param id id
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取用户Id
*
* @return user_id - 用户Id
*/
public String getUserId() {
return userId;
}
/**
* 设置用户Id
*
* @param userId 用户Id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取深度报告免费下载次数
*
* @return deep_report - 深度报告免费下载次数
*/
public Integer getDeepReport() {
return deepReport;
}
/**
* 设置深度报告免费下载次数
*
* @param deepReport 深度报告免费下载次数
*/
public void setDeepReport(Integer deepReport) {
this.deepReport = deepReport;
}
/**
* 获取深度报告-标准版-下载次数
*
* @return deep_report_std - 深度报告-标准版-下载次数
*/
public Integer getDeepReportStd() {
return deepReportStd;
}
/**
* 设置深度报告-标准版-下载次数
*
* @param deepReportStd 深度报告-标准版-下载次数
*/
public void setDeepReportStd(Integer deepReportStd) {
this.deepReportStd = deepReportStd;
}
/**
* 获取累计收益报告-免费下载次数
*
* @return cumulative_profit_report - 累计收益报告-免费下载次数
* 购买的报告次数
*/
public Integer getCumulativeProfitReport() {
return cumulativeProfitReport;
}
@TableField(value = "report_times_buy")
@ApiModelProperty(value = "购买的报告次数")
private Integer reportTimesBuy;
/**
* 设置累计收益报告-免费下载次数
*
* @param cumulativeProfitReport 累计收益报告-免费下载次数
* 创建时间
*/
public void setCumulativeProfitReport(Integer cumulativeProfitReport) {
this.cumulativeProfitReport = cumulativeProfitReport;
}
/**
* 获取累计收益报告-标准版-下载次数
*
* @return cumulative_profit_report_std - 累计收益报告-标准版-下载次数
*/
public Integer getCumulativeProfitReportStd() {
return cumulativeProfitReportStd;
}
@TableField(value = "create_time")
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 设置累计收益报告-标准版-下载次数
*
* @param cumulativeProfitReportStd 累计收益报告-标准版-下载次数
* 更新时间
*/
public void setCumulativeProfitReportStd(Integer cumulativeProfitReportStd) {
this.cumulativeProfitReportStd = cumulativeProfitReportStd;
}
@TableField(value = "update_time")
@ApiModelProperty(value = "更新时间")
private Date updateTime;
/**
* 获取周报/月报
*
* @return weekly_monthly_report - 周报/月报
*/
public Integer getWeeklyMonthlyReport() {
return weeklyMonthlyReport;
}
public static final String COL_ID = "id";
/**
* 设置周报/月报
*
* @param weeklyMonthlyReport 周报/月报
*/
public void setWeeklyMonthlyReport(Integer weeklyMonthlyReport) {
this.weeklyMonthlyReport = weeklyMonthlyReport;
}
public static final String COL_USER_ID = "user_id";
/**
* 获取持仓分析-免费版-下载次数
*
* @return hold_fund_report - 持仓分析-免费版-下载次数
*/
public Integer getHoldFundReport() {
return holdFundReport;
}
public static final String COL_DEEP_REPORT = "deep_report";
/**
* 设置持仓分析-免费版-下载次数
*
* @param holdFundReport 持仓分析-免费版-下载次数
*/
public void setHoldFundReport(Integer holdFundReport) {
this.holdFundReport = holdFundReport;
}
public static final String COL_DEEP_REPORT_STD = "deep_report_std";
/**
* 获取持仓分析-标准版-下载次数
*
* @return hold_fund_report_std - 持仓分析-标准版-下载次数
*/
public Integer getHoldFundReportStd() {
return holdFundReportStd;
}
public static final String COL_CUMULATIVE_PROFIT_REPORT = "cumulative_profit_report";
/**
* 设置持仓分析-标准版-下载次数
*
* @param holdFundReportStd 持仓分析-标准版-下载次数
*/
public void setHoldFundReportStd(Integer holdFundReportStd) {
this.holdFundReportStd = holdFundReportStd;
}
public static final String COL_CUMULATIVE_PROFIT_REPORT_STD = "cumulative_profit_report_std";
/**
* 获取免费版-下载次数上限
*
* @return free_total_limit - 免费版-下载次数上限
*/
public Integer getFreeTotalLimit() {
return freeTotalLimit;
}
public static final String COL_WEEKLY_MONTHLY_REPORT = "weekly_monthly_report";
/**
* 设置免费版-下载次数上限
*
* @param freeTotalLimit 免费版-下载次数上限
*/
public void setFreeTotalLimit(Integer freeTotalLimit) {
this.freeTotalLimit = freeTotalLimit;
}
public static final String COL_HOLD_FUND_REPORT = "hold_fund_report";
/**
* 获取标准版-下载次数上限
*
* @return std_vip_limit - 标准版-下载次数上限
*/
public Integer getStdVipLimit() {
return stdVipLimit;
}
public static final String COL_HOLD_FUND_REPORT_STD = "hold_fund_report_std";
/**
* 设置标准版-下载次数上限
*
* @param stdVipLimit 标准版-下载次数上限
*/
public void setStdVipLimit(Integer stdVipLimit) {
this.stdVipLimit = stdVipLimit;
}
public static final String COL_FREE_TOTAL_LIMIT = "free_total_limit";
/**
* @return create_time
*/
public Date getCreateTime() {
return createTime;
}
public static final String COL_STD_VIP_LIMIT = "std_vip_limit";
/**
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public static final String COL_REPORT_TIMES_BUY = "report_times_buy";
/**
* @return update_time
*/
public Date getUpdateTime() {
return updateTime;
}
public static final String COL_CREATE_TIME = "create_time";
/**
* @param updateTime
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public static final String COL_UPDATE_TIME = "update_time";
}
\ No newline at end of file
......@@ -2,6 +2,8 @@ package com.tanpu.fund.mapper.generator;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.fund.entity.generator.ReportDownloadSummary;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ReportDownloadSummaryMapper extends BaseMapper<ReportDownloadSummary> {
}
\ No newline at end of file
package com.tanpu.fund.service;
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.mapper.generator.ReportDownloadSummaryMapper;
import org.apache.commons.collections4.CollectionUtils;
......@@ -47,8 +49,33 @@ public class DownloadPdfService {
entity.setStdVipLimit(entity.getStdVipLimit() + onceAddTimes);
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 @@
<result column="hold_fund_report_std" jdbcType="INTEGER" property="holdFundReportStd" />
<result column="free_total_limit" jdbcType="INTEGER" property="freeTotalLimit" />
<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="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
......@@ -22,6 +23,6 @@
<!--@mbg.generated-->
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,
std_vip_limit, create_time, update_time
std_vip_limit, report_times_buy, create_time, update_time
</sql>
</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