Commit dfe3145b authored by 王亚雷's avatar 王亚雷

报告单独收费

parent 8ed8a405
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);
}
} }
...@@ -4,313 +4,148 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -4,313 +4,148 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; 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.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/** /**
* 报告下载统计 * 报告下载统计
*/ */
@TableName(value = "report_download_summary") @ApiModel(value = "报告下载统计")
@Builder
@Data @Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "report_download_summary")
public class ReportDownloadSummary { public class ReportDownloadSummary {
public static final String COL_REPORT_COUNT_BUY = "report_count_buy";
/** /**
* id * id
*/ */
@TableId(value = "id", type = IdType.INPUT) @TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "id")
private Long id; private Long id;
/** /**
* 用户Id * 用户Id
*/ */
@TableField(value = "user_id") @TableField(value = "user_id")
@ApiModelProperty(value = "用户Id")
private String userId; private String userId;
/** /**
* 深度报告免费下载次数 * 深度报告-免费版-下载次数
*/ */
@TableField(value = "deep_report") @TableField(value = "deep_report")
@ApiModelProperty(value = "深度报告-免费版-下载次数")
private Integer deepReport; private Integer deepReport;
/** /**
* 深度报告-标准版-下载次数 * 深度报告-标准版-下载次数
*/ */
@TableField(value = "deep_report_std") @TableField(value = "deep_report_std")
@ApiModelProperty(value = "深度报告-标准版-下载次数")
private Integer deepReportStd; private Integer deepReportStd;
/** /**
* 累计收益报告-免费下载次数 * 累计收益报告-免费版-下载次数
*/ */
@TableField(value = "cumulative_profit_report") @TableField(value = "cumulative_profit_report")
@ApiModelProperty(value = "累计收益报告-免费版-下载次数")
private Integer cumulativeProfitReport; private Integer cumulativeProfitReport;
/** /**
* 累计收益报告-标准版-下载次数 * 累计收益报告-标准版-下载次数
*/ */
@TableField(value = "cumulative_profit_report_std") @TableField(value = "cumulative_profit_report_std")
@ApiModelProperty(value = "累计收益报告-标准版-下载次数")
private Integer cumulativeProfitReportStd; private Integer cumulativeProfitReportStd;
/** /**
* 周报/月报 * 周报/月报
*/ */
@TableField(value = "weekly_monthly_report") @TableField(value = "weekly_monthly_report")
@ApiModelProperty(value = "周报/月报")
private Integer weeklyMonthlyReport; private Integer weeklyMonthlyReport;
/** /**
* 持仓分析-免费版-下载次数 * 持仓分析-免费版-下载次数
*/ */
@TableField(value = "hold_fund_report") @TableField(value = "hold_fund_report")
@ApiModelProperty(value = "持仓分析-免费版-下载次数")
private Integer holdFundReport; private Integer holdFundReport;
/** /**
* 持仓分析-标准版-下载次数 * 持仓分析-标准版-下载次数
*/ */
@TableField(value = "hold_fund_report_std") @TableField(value = "hold_fund_report_std")
@ApiModelProperty(value = "持仓分析-标准版-下载次数")
private Integer holdFundReportStd; private Integer holdFundReportStd;
/** /**
* 免费版-下载次数上限 * 免费版-下载次数上限
*/ */
@TableField(value = "free_total_limit") @TableField(value = "free_total_limit")
@ApiModelProperty(value = "免费版-下载次数上限")
private Integer freeTotalLimit; private Integer freeTotalLimit;
/** /**
* 标准版-下载次数上限 * 标准版-下载次数上限
*/ */
@TableField(value = "std_vip_limit") @TableField(value = "std_vip_limit")
@ApiModelProperty(value = "标准版-下载次数上限")
private Integer stdVipLimit; 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() { @TableField(value = "report_times_buy")
return cumulativeProfitReport; @ApiModelProperty(value = "购买的报告次数")
} private Integer reportTimesBuy;
/** /**
* 设置累计收益报告-免费下载次数 * 创建时间
*
* @param cumulativeProfitReport 累计收益报告-免费下载次数
*/ */
public void setCumulativeProfitReport(Integer cumulativeProfitReport) { @TableField(value = "create_time")
this.cumulativeProfitReport = cumulativeProfitReport; @ApiModelProperty(value = "创建时间")
} private Date createTime;
/**
* 获取累计收益报告-标准版-下载次数
*
* @return cumulative_profit_report_std - 累计收益报告-标准版-下载次数
*/
public Integer getCumulativeProfitReportStd() {
return cumulativeProfitReportStd;
}
/** /**
* 设置累计收益报告-标准版-下载次数 * 更新时间
*
* @param cumulativeProfitReportStd 累计收益报告-标准版-下载次数
*/ */
public void setCumulativeProfitReportStd(Integer cumulativeProfitReportStd) { @TableField(value = "update_time")
this.cumulativeProfitReportStd = cumulativeProfitReportStd; @ApiModelProperty(value = "更新时间")
} private Date updateTime;
/** public static final String COL_ID = "id";
* 获取周报/月报
*
* @return weekly_monthly_report - 周报/月报
*/
public Integer getWeeklyMonthlyReport() {
return weeklyMonthlyReport;
}
/** public static final String COL_USER_ID = "user_id";
* 设置周报/月报
*
* @param weeklyMonthlyReport 周报/月报
*/
public void setWeeklyMonthlyReport(Integer weeklyMonthlyReport) {
this.weeklyMonthlyReport = weeklyMonthlyReport;
}
/** public static final String COL_DEEP_REPORT = "deep_report";
* 获取持仓分析-免费版-下载次数
*
* @return hold_fund_report - 持仓分析-免费版-下载次数
*/
public Integer getHoldFundReport() {
return holdFundReport;
}
/** public static final String COL_DEEP_REPORT_STD = "deep_report_std";
* 设置持仓分析-免费版-下载次数
*
* @param holdFundReport 持仓分析-免费版-下载次数
*/
public void setHoldFundReport(Integer holdFundReport) {
this.holdFundReport = holdFundReport;
}
/** public static final String COL_CUMULATIVE_PROFIT_REPORT = "cumulative_profit_report";
* 获取持仓分析-标准版-下载次数
*
* @return hold_fund_report_std - 持仓分析-标准版-下载次数
*/
public Integer getHoldFundReportStd() {
return holdFundReportStd;
}
/** public static final String COL_CUMULATIVE_PROFIT_REPORT_STD = "cumulative_profit_report_std";
* 设置持仓分析-标准版-下载次数
*
* @param holdFundReportStd 持仓分析-标准版-下载次数
*/
public void setHoldFundReportStd(Integer holdFundReportStd) {
this.holdFundReportStd = holdFundReportStd;
}
/** public static final String COL_WEEKLY_MONTHLY_REPORT = "weekly_monthly_report";
* 获取免费版-下载次数上限
*
* @return free_total_limit - 免费版-下载次数上限
*/
public Integer getFreeTotalLimit() {
return freeTotalLimit;
}
/** public static final String COL_HOLD_FUND_REPORT = "hold_fund_report";
* 设置免费版-下载次数上限
*
* @param freeTotalLimit 免费版-下载次数上限
*/
public void setFreeTotalLimit(Integer freeTotalLimit) {
this.freeTotalLimit = freeTotalLimit;
}
/** public static final String COL_HOLD_FUND_REPORT_STD = "hold_fund_report_std";
* 获取标准版-下载次数上限
*
* @return std_vip_limit - 标准版-下载次数上限
*/
public Integer getStdVipLimit() {
return stdVipLimit;
}
/** public static final String COL_FREE_TOTAL_LIMIT = "free_total_limit";
* 设置标准版-下载次数上限
*
* @param stdVipLimit 标准版-下载次数上限
*/
public void setStdVipLimit(Integer stdVipLimit) {
this.stdVipLimit = stdVipLimit;
}
/** public static final String COL_STD_VIP_LIMIT = "std_vip_limit";
* @return create_time
*/
public Date getCreateTime() {
return createTime;
}
/** public static final String COL_REPORT_TIMES_BUY = "report_times_buy";
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/** public static final String COL_CREATE_TIME = "create_time";
* @return update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/** public static final String COL_UPDATE_TIME = "update_time";
* @param updateTime
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} }
\ No newline at end of file
...@@ -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