Commit 0d450443 authored by 刘基明's avatar 刘基明

pdf 下载

parent bf232fba
...@@ -20,4 +20,11 @@ public interface ProductForPcApi { ...@@ -20,4 +20,11 @@ public interface ProductForPcApi {
@GetMapping("/get/privatefund/newnet") @GetMapping("/get/privatefund/newnet")
CommonResp<List<Net>> getPrivatefundNewnet(@RequestParam("list") List<String> list); CommonResp<List<Net>> getPrivatefundNewnet(@RequestParam("list") List<String> list);
@ApiOperation("清空标准会员的下载次数")
@GetMapping("/pdf/standard/empty")
CommonResp<Void> emptyStandardVipCount(String userId);
@ApiOperation("增加标准会员的下载次数")
@GetMapping("/pdf/standard/add")
CommonResp<Void> addStandardVipCount(String userId);
} }
...@@ -3,6 +3,7 @@ package com.tanpu.fund.controller; ...@@ -3,6 +3,7 @@ package com.tanpu.fund.controller;
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;
import com.tanpu.fund.service.DownloadPdfService;
import com.tanpu.fund.service.ProductForPcService; import com.tanpu.fund.service.ProductForPcService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -16,6 +17,9 @@ public class ProductForPcController implements ProductForPcApi { ...@@ -16,6 +17,9 @@ public class ProductForPcController implements ProductForPcApi {
@Resource @Resource
private ProductForPcService productForPcService; private ProductForPcService productForPcService;
@Resource
private DownloadPdfService downloadPdfService;
@Override @Override
public CommonResp<List<Net>> getFundNewnet(List<String> list) { public CommonResp<List<Net>> getFundNewnet(List<String> list) {
return CommonResp.success(productForPcService.getFundNewnet(list)); return CommonResp.success(productForPcService.getFundNewnet(list));
...@@ -25,4 +29,16 @@ public class ProductForPcController implements ProductForPcApi { ...@@ -25,4 +29,16 @@ public class ProductForPcController implements ProductForPcApi {
public CommonResp<List<Net>> getPrivatefundNewnet(List<String> list) { public CommonResp<List<Net>> getPrivatefundNewnet(List<String> list) {
return CommonResp.success(productForPcService.getPrivatefundNewnet(list)); return CommonResp.success(productForPcService.getPrivatefundNewnet(list));
} }
@Override
public CommonResp<Void> emptyStandardVipCount(String userId) {
downloadPdfService.emptyStandardVipCount(userId);
return CommonResp.success();
}
@Override
public CommonResp<Void> addStandardVipCount(String userId) {
downloadPdfService.addStandardVipCount(userId);
return CommonResp.success();
}
} }
package com.tanpu.fund.entity.generator;
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 lombok.Builder;
import lombok.Data;
import java.util.Date;
/**
* 报告下载统计
*/
@TableName(value = "report_download_summary")
@Builder
@Data
public class ReportDownloadSummary {
/**
* id
*/
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 用户Id
*/
@TableField(value = "user_id")
private String userId;
/**
* 深度报告免费下载次数
*/
@TableField(value = "deep_report")
private Integer deepReport;
/**
* 深度报告-标准版-下载次数
*/
@TableField(value = "deep_report_std")
private Integer deepReportStd;
/**
* 累计收益报告-免费下载次数
*/
@TableField(value = "cumulative_profit_report")
private Integer cumulativeProfitReport;
/**
* 累计收益报告-标准版-下载次数
*/
@TableField(value = "cumulative_profit_report_std")
private Integer cumulativeProfitReportStd;
/**
* 周报/月报
*/
@TableField(value = "weekly_monthly_report")
private Integer weeklyMonthlyReport;
/**
* 持仓分析-免费版-下载次数
*/
@TableField(value = "hold_fund_report")
private Integer holdFundReport;
/**
* 持仓分析-标准版-下载次数
*/
@TableField(value = "hold_fund_report_std")
private Integer holdFundReportStd;
/**
* 免费版-下载次数上限
*/
@TableField(value = "free_total_limit")
private Integer freeTotalLimit;
/**
* 标准版-下载次数上限
*/
@TableField(value = "std_vip_limit")
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;
}
/**
* 设置累计收益报告-免费下载次数
*
* @param cumulativeProfitReport 累计收益报告-免费下载次数
*/
public void setCumulativeProfitReport(Integer cumulativeProfitReport) {
this.cumulativeProfitReport = cumulativeProfitReport;
}
/**
* 获取累计收益报告-标准版-下载次数
*
* @return cumulative_profit_report_std - 累计收益报告-标准版-下载次数
*/
public Integer getCumulativeProfitReportStd() {
return cumulativeProfitReportStd;
}
/**
* 设置累计收益报告-标准版-下载次数
*
* @param cumulativeProfitReportStd 累计收益报告-标准版-下载次数
*/
public void setCumulativeProfitReportStd(Integer cumulativeProfitReportStd) {
this.cumulativeProfitReportStd = cumulativeProfitReportStd;
}
/**
* 获取周报/月报
*
* @return weekly_monthly_report - 周报/月报
*/
public Integer getWeeklyMonthlyReport() {
return weeklyMonthlyReport;
}
/**
* 设置周报/月报
*
* @param weeklyMonthlyReport 周报/月报
*/
public void setWeeklyMonthlyReport(Integer weeklyMonthlyReport) {
this.weeklyMonthlyReport = weeklyMonthlyReport;
}
/**
* 获取持仓分析-免费版-下载次数
*
* @return hold_fund_report - 持仓分析-免费版-下载次数
*/
public Integer getHoldFundReport() {
return holdFundReport;
}
/**
* 设置持仓分析-免费版-下载次数
*
* @param holdFundReport 持仓分析-免费版-下载次数
*/
public void setHoldFundReport(Integer holdFundReport) {
this.holdFundReport = holdFundReport;
}
/**
* 获取持仓分析-标准版-下载次数
*
* @return hold_fund_report_std - 持仓分析-标准版-下载次数
*/
public Integer getHoldFundReportStd() {
return holdFundReportStd;
}
/**
* 设置持仓分析-标准版-下载次数
*
* @param holdFundReportStd 持仓分析-标准版-下载次数
*/
public void setHoldFundReportStd(Integer holdFundReportStd) {
this.holdFundReportStd = holdFundReportStd;
}
/**
* 获取免费版-下载次数上限
*
* @return free_total_limit - 免费版-下载次数上限
*/
public Integer getFreeTotalLimit() {
return freeTotalLimit;
}
/**
* 设置免费版-下载次数上限
*
* @param freeTotalLimit 免费版-下载次数上限
*/
public void setFreeTotalLimit(Integer freeTotalLimit) {
this.freeTotalLimit = freeTotalLimit;
}
/**
* 获取标准版-下载次数上限
*
* @return std_vip_limit - 标准版-下载次数上限
*/
public Integer getStdVipLimit() {
return stdVipLimit;
}
/**
* 设置标准版-下载次数上限
*
* @param stdVipLimit 标准版-下载次数上限
*/
public void setStdVipLimit(Integer stdVipLimit) {
this.stdVipLimit = stdVipLimit;
}
/**
* @return create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* @return update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* @param updateTime
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.tanpu.fund.mapper.generator;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanpu.fund.entity.generator.ReportDownloadSummary;
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.tanpu.fund.entity.generator.ReportDownloadSummary;
import com.tanpu.fund.mapper.generator.ReportDownloadSummaryMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class DownloadPdfService {
private ReportDownloadSummaryMapper reportDownloadSummaryMapper;
private static final Integer onceAddTimes = 200;
@Transactional(rollbackFor = Exception.class)
public void emptyStandardVipCount(String userId) {
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(new LambdaQueryWrapper<ReportDownloadSummary>().eq(ReportDownloadSummary::getUserId, userId));
if (CollectionUtils.isEmpty(reportDownloadSummaries)){
ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(0).build();
reportDownloadSummaryMapper.insert(entity);
}else {
ReportDownloadSummary entity = reportDownloadSummaries.get(0);
entity.setStdVipLimit(0);
reportDownloadSummaryMapper.updateById(entity);
}
}
@Transactional(rollbackFor = Exception.class)
public void addStandardVipCount(String userId) {
List<ReportDownloadSummary> reportDownloadSummaries = reportDownloadSummaryMapper.selectList(new LambdaQueryWrapper<ReportDownloadSummary>().eq(ReportDownloadSummary::getUserId, userId));
if (CollectionUtils.isEmpty(reportDownloadSummaries)){
ReportDownloadSummary entity = ReportDownloadSummary.builder().userId(userId).stdVipLimit(onceAddTimes).build();
reportDownloadSummaryMapper.insert(entity);
}else {
ReportDownloadSummary entity = reportDownloadSummaries.get(0);
entity.setStdVipLimit(entity.getStdVipLimit() + onceAddTimes);
reportDownloadSummaryMapper.updateById(entity);
}
}
}
...@@ -10,11 +10,24 @@ management.endpoints.web.base-path = /myhealth ...@@ -10,11 +10,24 @@ management.endpoints.web.base-path = /myhealth
management.endpoint.health.enabled=true management.endpoint.health.enabled=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
spring.datasource.url=jdbc:mysql://tamper.mysql.polardb.rds.aliyuncs.com:3306/tamp_fund?autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false #spring.datasource.url=jdbc:mysql://tamper.mysql.polardb.rds.aliyuncs.com:3306/tamp_fund?autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
spring.datasource.username=tamp #spring.datasource.username=tamp
#spring.datasource.password= @imeng123
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://rm-uf6r22t3d798q4kmk.mysql.rds.aliyuncs.com:3306/tamp_fund?autoReconnect=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&useSSL=false
spring.datasource.username=tamp_admin
spring.datasource.password= @imeng123 spring.datasource.password= @imeng123
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# 阿里云智能媒体管理
tanpu.aliyun.imm.access-key-id = LTAIAKEzVydP0Q9P
tanpu.aliyun.imm.access-key-secret = 59V9ke9txaIFzWxHFKTb1eoOOpmKpJ
tanpu.aliyun.imm.region-id = cn-shanghai
tanpu.aliyun.imm.endpoint = imm.${tanpu.aliyun.imm.region-id}.aliyuncs.com
tanpu.aliyun.imm.project = doc-preview-test
tanpu.aliyun.imm.limit-preview-page = 3
company.oss.prefix = https://tamp-pro.oss-cn-shanghai.aliyuncs.com/ company.oss.prefix = https://tamp-pro.oss-cn-shanghai.aliyuncs.com/
#mybatis #mybatis
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tanpu.fund.mapper.generator.ReportDownloadSummaryMapper">
<resultMap id="BaseResultMap" type="com.tanpu.fund.entity.generator.ReportDownloadSummary">
<!--@mbg.generated-->
<!--@Table report_download_summary-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="deep_report" jdbcType="INTEGER" property="deepReport" />
<result column="deep_report_std" jdbcType="INTEGER" property="deepReportStd" />
<result column="cumulative_profit_report" jdbcType="INTEGER" property="cumulativeProfitReport" />
<result column="cumulative_profit_report_std" jdbcType="INTEGER" property="cumulativeProfitReportStd" />
<result column="weekly_monthly_report" jdbcType="INTEGER" property="weeklyMonthlyReport" />
<result column="hold_fund_report" jdbcType="INTEGER" property="holdFundReport" />
<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="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@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
</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