mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
作家专区新增稿费收入查询(订阅明细+稿费汇总)
This commit is contained in:
parent
fbfb68583f
commit
4cccea5d75
Binary file not shown.
After Width: | Height: | Size: 767 KiB |
@ -0,0 +1,62 @@
|
|||||||
|
package com.java2nb.novel.core.converter;
|
||||||
|
|
||||||
|
import org.springframework.core.convert.converter.Converter;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表单形式的全局时间类型转换器
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
*/
|
||||||
|
public class DateConverter implements Converter<String, Date> {
|
||||||
|
|
||||||
|
private static final List<String> formats = new ArrayList<>(4);
|
||||||
|
|
||||||
|
static {
|
||||||
|
formats.add("yyyy-MM");
|
||||||
|
formats.add("yyyy-MM-dd");
|
||||||
|
formats.add("yyyy-MM-dd HH:mm");
|
||||||
|
formats.add("yyyy-MM-dd HH:mm:ss");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Date convert(String source) {
|
||||||
|
String value = source.trim();
|
||||||
|
if ("".equals(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (source.matches("^\\d{4}-\\d{1,2}$")) {
|
||||||
|
return parseDate(source, formats.get(0));
|
||||||
|
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2}$")) {
|
||||||
|
return parseDate(source, formats.get(1));
|
||||||
|
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}$")) {
|
||||||
|
return parseDate(source, formats.get(2));
|
||||||
|
} else if (source.matches("^\\d{4}-\\d{1,2}-\\d{1,2} {1}\\d{1,2}:\\d{1,2}:\\d{1,2}$")) {
|
||||||
|
return parseDate(source, formats.get(3));
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Invalid boolean value '" + source + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化日期
|
||||||
|
*
|
||||||
|
* @param dateStr String 字符型日期
|
||||||
|
* @param format String 格式
|
||||||
|
* @return Date 日期
|
||||||
|
*/
|
||||||
|
private Date parseDate(String dateStr, String format) {
|
||||||
|
Date date = null;
|
||||||
|
try {
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat(format);
|
||||||
|
date = dateFormat.parse(dateStr);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
package com.java2nb.novel.core.utils;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.TimeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期工具
|
||||||
|
* @author cd
|
||||||
|
*/
|
||||||
|
public class DateUtil {
|
||||||
|
|
||||||
|
public static final String DATE_PATTERN = "yyyy-MM-dd";
|
||||||
|
public static final String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
public static final String TIME_PATTERN = "HH:mm:ss";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取昨天的日期时间
|
||||||
|
* */
|
||||||
|
public static Date getYesterday(){
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.DATE, -1);
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据日期,获取当天开始时间
|
||||||
|
* */
|
||||||
|
public static Date getDateStartTime(Date date){
|
||||||
|
Calendar calendar = new GregorianCalendar();
|
||||||
|
calendar.setTime(date);
|
||||||
|
/*
|
||||||
|
* Calendar.HOUR_OF_DAY:是指获取24小时制的小时,取值范围:0-23;
|
||||||
|
* Calendar.HOUR:是指获取12小时制的小时,取值范围:0-12,凌晨和中午都是0,不是12;
|
||||||
|
* 需要配合Calendar.AM_PM使用;
|
||||||
|
* */
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY,0);
|
||||||
|
calendar.set(Calendar.MINUTE,0);
|
||||||
|
calendar.set(Calendar.SECOND,0);
|
||||||
|
calendar.set(Calendar.MILLISECOND,0);
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据日期,获取当天结束时间
|
||||||
|
* */
|
||||||
|
public static Date getDateEndTime(Date date){
|
||||||
|
Calendar calendar = new GregorianCalendar();
|
||||||
|
calendar.setTime(date);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY,23);
|
||||||
|
calendar.set(Calendar.MINUTE,59);
|
||||||
|
calendar.set(Calendar.SECOND,59);
|
||||||
|
calendar.set(Calendar.MILLISECOND,999);
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上个月开始时间
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date getLastMonthStartTime(){
|
||||||
|
// 获取当前日期
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.YEAR, 0);
|
||||||
|
calendar.add(Calendar.MONTH, -1);
|
||||||
|
// 设置为1号,当前日期既为本月第一天
|
||||||
|
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取上个月结束时间
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date getLastMonthEndTime(){
|
||||||
|
// 获取当前日期
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
calendar.add(Calendar.YEAR, 0);
|
||||||
|
calendar.add(Calendar.MONTH, -1);
|
||||||
|
// 获取当前月最后一天
|
||||||
|
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||||
|
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
calendar.set(Calendar.MINUTE, 59);
|
||||||
|
calendar.set(Calendar.SECOND, 59);
|
||||||
|
calendar.set(Calendar.MILLISECOND, 999);
|
||||||
|
|
||||||
|
return calendar.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 格式化日期
|
||||||
|
* */
|
||||||
|
public static String formatDate(Date date,String patten){
|
||||||
|
|
||||||
|
return new SimpleDateFormat(patten).format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println(formatDate(getYesterday(),DATE_TIME_PATTERN));
|
||||||
|
System.out.println(formatDate(getDateStartTime(getYesterday()),DATE_TIME_PATTERN));
|
||||||
|
System.out.println(formatDate(getDateEndTime(getYesterday()),DATE_TIME_PATTERN));
|
||||||
|
System.out.println(formatDate(getLastMonthStartTime(),DATE_TIME_PATTERN));
|
||||||
|
System.out.println(formatDate(getLastMonthEndTime(),DATE_TIME_PATTERN));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,152 @@
|
|||||||
|
package com.java2nb.novel.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
public class AuthorIncome {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long authorId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long bookId;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy年MM月", timezone = "GMT+8")
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Date incomeMonth;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long preTaxIncome;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long afterTaxIncome;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Byte payStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Byte confirmStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private String detail;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getAuthorId() {
|
||||||
|
return authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setAuthorId(Long authorId) {
|
||||||
|
this.authorId = authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getBookId() {
|
||||||
|
return bookId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setBookId(Long bookId) {
|
||||||
|
this.bookId = bookId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Date getIncomeMonth() {
|
||||||
|
return incomeMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setIncomeMonth(Date incomeMonth) {
|
||||||
|
this.incomeMonth = incomeMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getPreTaxIncome() {
|
||||||
|
return preTaxIncome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setPreTaxIncome(Long preTaxIncome) {
|
||||||
|
this.preTaxIncome = preTaxIncome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getAfterTaxIncome() {
|
||||||
|
return afterTaxIncome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setAfterTaxIncome(Long afterTaxIncome) {
|
||||||
|
this.afterTaxIncome = afterTaxIncome;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Byte getPayStatus() {
|
||||||
|
return payStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setPayStatus(Byte payStatus) {
|
||||||
|
this.payStatus = payStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Byte getConfirmStatus() {
|
||||||
|
return confirmStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setConfirmStatus(Byte confirmStatus) {
|
||||||
|
this.confirmStatus = confirmStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public String getDetail() {
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setDetail(String detail) {
|
||||||
|
this.detail = detail == null ? null : detail.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,126 @@
|
|||||||
|
package com.java2nb.novel.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
public class AuthorIncomeDetail {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long authorId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long bookId;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Date incomeDate;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Integer incomeAccount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Integer incomeCount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Integer incomeNumber;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setUserId(Long userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getAuthorId() {
|
||||||
|
return authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setAuthorId(Long authorId) {
|
||||||
|
this.authorId = authorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getBookId() {
|
||||||
|
return bookId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setBookId(Long bookId) {
|
||||||
|
this.bookId = bookId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Date getIncomeDate() {
|
||||||
|
return incomeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setIncomeDate(Date incomeDate) {
|
||||||
|
this.incomeDate = incomeDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Integer getIncomeAccount() {
|
||||||
|
return incomeAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setIncomeAccount(Integer incomeAccount) {
|
||||||
|
this.incomeAccount = incomeAccount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Integer getIncomeCount() {
|
||||||
|
return incomeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setIncomeCount(Integer incomeCount) {
|
||||||
|
this.incomeCount = incomeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Integer getIncomeNumber() {
|
||||||
|
return incomeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setIncomeNumber(Integer incomeNumber) {
|
||||||
|
this.incomeNumber = incomeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import java.sql.JDBCType;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
import org.mybatis.dynamic.sql.SqlColumn;
|
||||||
|
import org.mybatis.dynamic.sql.SqlTable;
|
||||||
|
|
||||||
|
public final class AuthorIncomeDetailDynamicSqlSupport {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final AuthorIncomeDetail authorIncomeDetail = new AuthorIncomeDetail();
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> id = authorIncomeDetail.id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> userId = authorIncomeDetail.userId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> authorId = authorIncomeDetail.authorId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> bookId = authorIncomeDetail.bookId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Date> incomeDate = authorIncomeDetail.incomeDate;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Integer> incomeAccount = authorIncomeDetail.incomeAccount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Integer> incomeCount = authorIncomeDetail.incomeCount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Integer> incomeNumber = authorIncomeDetail.incomeNumber;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Date> createTime = authorIncomeDetail.createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final class AuthorIncomeDetail extends SqlTable {
|
||||||
|
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> authorId = column("author_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Date> incomeDate = column("income_date", JDBCType.DATE);
|
||||||
|
|
||||||
|
public final SqlColumn<Integer> incomeAccount = column("income_account", JDBCType.INTEGER);
|
||||||
|
|
||||||
|
public final SqlColumn<Integer> incomeCount = column("income_count", JDBCType.INTEGER);
|
||||||
|
|
||||||
|
public final SqlColumn<Integer> incomeNumber = column("income_number", JDBCType.INTEGER);
|
||||||
|
|
||||||
|
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||||
|
|
||||||
|
public AuthorIncomeDetail() {
|
||||||
|
super("author_income_detail");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,222 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import static com.java2nb.novel.mapper.AuthorIncomeDetailDynamicSqlSupport.*;
|
||||||
|
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||||
|
|
||||||
|
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.*;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
import org.mybatis.dynamic.sql.BasicColumn;
|
||||||
|
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||||
|
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||||
|
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AuthorIncomeDetailMapper {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
BasicColumn[] selectList = BasicColumn.columnList(id, userId, authorId, bookId, incomeDate, incomeAccount, incomeCount, incomeNumber, createTime);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
long count(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||||
|
int delete(DeleteStatementProvider deleteStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||||
|
int insert(InsertStatementProvider<AuthorIncomeDetail> insertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||||
|
int insertMultiple(MultiRowInsertStatementProvider<AuthorIncomeDetail> multipleInsertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@ResultMap("AuthorIncomeDetailResult")
|
||||||
|
Optional<AuthorIncomeDetail> selectOne(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@Results(id="AuthorIncomeDetailResult", value = {
|
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||||
|
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="author_id", property="authorId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="income_date", property="incomeDate", jdbcType=JdbcType.DATE),
|
||||||
|
@Result(column="income_account", property="incomeAccount", jdbcType=JdbcType.INTEGER),
|
||||||
|
@Result(column="income_count", property="incomeCount", jdbcType=JdbcType.INTEGER),
|
||||||
|
@Result(column="income_number", property="incomeNumber", jdbcType=JdbcType.INTEGER),
|
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||||
|
})
|
||||||
|
List<AuthorIncomeDetail> selectMany(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||||
|
int update(UpdateStatementProvider updateStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default long count(CountDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.countFrom(this::count, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int delete(DeleteDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.deleteFrom(this::delete, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int deleteByPrimaryKey(Long id_) {
|
||||||
|
return delete(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insert(AuthorIncomeDetail record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, authorIncomeDetail, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(userId).toProperty("userId")
|
||||||
|
.map(authorId).toProperty("authorId")
|
||||||
|
.map(bookId).toProperty("bookId")
|
||||||
|
.map(incomeDate).toProperty("incomeDate")
|
||||||
|
.map(incomeAccount).toProperty("incomeAccount")
|
||||||
|
.map(incomeCount).toProperty("incomeCount")
|
||||||
|
.map(incomeNumber).toProperty("incomeNumber")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertMultiple(Collection<AuthorIncomeDetail> records) {
|
||||||
|
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, authorIncomeDetail, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(userId).toProperty("userId")
|
||||||
|
.map(authorId).toProperty("authorId")
|
||||||
|
.map(bookId).toProperty("bookId")
|
||||||
|
.map(incomeDate).toProperty("incomeDate")
|
||||||
|
.map(incomeAccount).toProperty("incomeAccount")
|
||||||
|
.map(incomeCount).toProperty("incomeCount")
|
||||||
|
.map(incomeNumber).toProperty("incomeNumber")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertSelective(AuthorIncomeDetail record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, authorIncomeDetail, c ->
|
||||||
|
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||||
|
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||||
|
.map(authorId).toPropertyWhenPresent("authorId", record::getAuthorId)
|
||||||
|
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||||
|
.map(incomeDate).toPropertyWhenPresent("incomeDate", record::getIncomeDate)
|
||||||
|
.map(incomeAccount).toPropertyWhenPresent("incomeAccount", record::getIncomeAccount)
|
||||||
|
.map(incomeCount).toPropertyWhenPresent("incomeCount", record::getIncomeCount)
|
||||||
|
.map(incomeNumber).toPropertyWhenPresent("incomeNumber", record::getIncomeNumber)
|
||||||
|
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<AuthorIncomeDetail> selectOne(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectOne(this::selectOne, selectList, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<AuthorIncomeDetail> select(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectList(this::selectMany, selectList, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<AuthorIncomeDetail> selectDistinct(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<AuthorIncomeDetail> selectByPrimaryKey(Long id_) {
|
||||||
|
return selectOne(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int update(UpdateDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.update(this::update, authorIncomeDetail, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateAllColumns(AuthorIncomeDetail record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalTo(record::getId)
|
||||||
|
.set(userId).equalTo(record::getUserId)
|
||||||
|
.set(authorId).equalTo(record::getAuthorId)
|
||||||
|
.set(bookId).equalTo(record::getBookId)
|
||||||
|
.set(incomeDate).equalTo(record::getIncomeDate)
|
||||||
|
.set(incomeAccount).equalTo(record::getIncomeAccount)
|
||||||
|
.set(incomeCount).equalTo(record::getIncomeCount)
|
||||||
|
.set(incomeNumber).equalTo(record::getIncomeNumber)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateSelectiveColumns(AuthorIncomeDetail record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||||
|
.set(userId).equalToWhenPresent(record::getUserId)
|
||||||
|
.set(authorId).equalToWhenPresent(record::getAuthorId)
|
||||||
|
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
|
.set(incomeDate).equalToWhenPresent(record::getIncomeDate)
|
||||||
|
.set(incomeAccount).equalToWhenPresent(record::getIncomeAccount)
|
||||||
|
.set(incomeCount).equalToWhenPresent(record::getIncomeCount)
|
||||||
|
.set(incomeNumber).equalToWhenPresent(record::getIncomeNumber)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKey(AuthorIncomeDetail record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(userId).equalTo(record::getUserId)
|
||||||
|
.set(authorId).equalTo(record::getAuthorId)
|
||||||
|
.set(bookId).equalTo(record::getBookId)
|
||||||
|
.set(incomeDate).equalTo(record::getIncomeDate)
|
||||||
|
.set(incomeAccount).equalTo(record::getIncomeAccount)
|
||||||
|
.set(incomeCount).equalTo(record::getIncomeCount)
|
||||||
|
.set(incomeNumber).equalTo(record::getIncomeNumber)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKeySelective(AuthorIncomeDetail record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(userId).equalToWhenPresent(record::getUserId)
|
||||||
|
.set(authorId).equalToWhenPresent(record::getAuthorId)
|
||||||
|
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
|
.set(incomeDate).equalToWhenPresent(record::getIncomeDate)
|
||||||
|
.set(incomeAccount).equalToWhenPresent(record::getIncomeAccount)
|
||||||
|
.set(incomeCount).equalToWhenPresent(record::getIncomeCount)
|
||||||
|
.set(incomeNumber).equalToWhenPresent(record::getIncomeNumber)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@ResultType(value = Long.class)
|
||||||
|
Long selectStatistic(SelectStatementProvider selectStatement);
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import java.sql.JDBCType;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
import org.mybatis.dynamic.sql.SqlColumn;
|
||||||
|
import org.mybatis.dynamic.sql.SqlTable;
|
||||||
|
|
||||||
|
public final class AuthorIncomeDynamicSqlSupport {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final AuthorIncome authorIncome = new AuthorIncome();
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> id = authorIncome.id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> userId = authorIncome.userId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> authorId = authorIncome.authorId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> bookId = authorIncome.bookId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Date> incomeMonth = authorIncome.incomeMonth;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> preTaxIncome = authorIncome.preTaxIncome;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> afterTaxIncome = authorIncome.afterTaxIncome;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Byte> payStatus = authorIncome.payStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Byte> confirmStatus = authorIncome.confirmStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<String> detail = authorIncome.detail;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Date> createTime = authorIncome.createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final class AuthorIncome extends SqlTable {
|
||||||
|
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> userId = column("user_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> authorId = column("author_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> bookId = column("book_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Date> incomeMonth = column("income_month", JDBCType.DATE);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> preTaxIncome = column("pre_tax_income", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> afterTaxIncome = column("after_tax_income", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Byte> payStatus = column("pay_status", JDBCType.TINYINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Byte> confirmStatus = column("confirm_status", JDBCType.TINYINT);
|
||||||
|
|
||||||
|
public final SqlColumn<String> detail = column("detail", JDBCType.VARCHAR);
|
||||||
|
|
||||||
|
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||||
|
|
||||||
|
public AuthorIncome() {
|
||||||
|
super("author_income");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,240 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import static com.java2nb.novel.mapper.AuthorIncomeDynamicSqlSupport.*;
|
||||||
|
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||||
|
|
||||||
|
import com.java2nb.novel.entity.AuthorIncome;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
import org.apache.ibatis.annotations.DeleteProvider;
|
||||||
|
import org.apache.ibatis.annotations.InsertProvider;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Result;
|
||||||
|
import org.apache.ibatis.annotations.ResultMap;
|
||||||
|
import org.apache.ibatis.annotations.Results;
|
||||||
|
import org.apache.ibatis.annotations.SelectProvider;
|
||||||
|
import org.apache.ibatis.annotations.UpdateProvider;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
import org.mybatis.dynamic.sql.BasicColumn;
|
||||||
|
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||||
|
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||||
|
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface AuthorIncomeMapper {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
BasicColumn[] selectList = BasicColumn.columnList(id, userId, authorId, bookId, incomeMonth, preTaxIncome, afterTaxIncome, payStatus, confirmStatus, detail, createTime);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
long count(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||||
|
int delete(DeleteStatementProvider deleteStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||||
|
int insert(InsertStatementProvider<AuthorIncome> insertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||||
|
int insertMultiple(MultiRowInsertStatementProvider<AuthorIncome> multipleInsertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@ResultMap("AuthorIncomeResult")
|
||||||
|
Optional<AuthorIncome> selectOne(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@Results(id="AuthorIncomeResult", value = {
|
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||||
|
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="author_id", property="authorId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="income_month", property="incomeMonth", jdbcType=JdbcType.DATE),
|
||||||
|
@Result(column="pre_tax_income", property="preTaxIncome", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="after_tax_income", property="afterTaxIncome", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="pay_status", property="payStatus", jdbcType=JdbcType.TINYINT),
|
||||||
|
@Result(column="confirm_status", property="confirmStatus", jdbcType=JdbcType.TINYINT),
|
||||||
|
@Result(column="detail", property="detail", jdbcType=JdbcType.VARCHAR),
|
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||||
|
})
|
||||||
|
List<AuthorIncome> selectMany(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||||
|
int update(UpdateStatementProvider updateStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default long count(CountDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.countFrom(this::count, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int delete(DeleteDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.deleteFrom(this::delete, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int deleteByPrimaryKey(Long id_) {
|
||||||
|
return delete(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insert(AuthorIncome record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, authorIncome, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(userId).toProperty("userId")
|
||||||
|
.map(authorId).toProperty("authorId")
|
||||||
|
.map(bookId).toProperty("bookId")
|
||||||
|
.map(incomeMonth).toProperty("incomeMonth")
|
||||||
|
.map(preTaxIncome).toProperty("preTaxIncome")
|
||||||
|
.map(afterTaxIncome).toProperty("afterTaxIncome")
|
||||||
|
.map(payStatus).toProperty("payStatus")
|
||||||
|
.map(confirmStatus).toProperty("confirmStatus")
|
||||||
|
.map(detail).toProperty("detail")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertMultiple(Collection<AuthorIncome> records) {
|
||||||
|
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, authorIncome, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(userId).toProperty("userId")
|
||||||
|
.map(authorId).toProperty("authorId")
|
||||||
|
.map(bookId).toProperty("bookId")
|
||||||
|
.map(incomeMonth).toProperty("incomeMonth")
|
||||||
|
.map(preTaxIncome).toProperty("preTaxIncome")
|
||||||
|
.map(afterTaxIncome).toProperty("afterTaxIncome")
|
||||||
|
.map(payStatus).toProperty("payStatus")
|
||||||
|
.map(confirmStatus).toProperty("confirmStatus")
|
||||||
|
.map(detail).toProperty("detail")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertSelective(AuthorIncome record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, authorIncome, c ->
|
||||||
|
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||||
|
.map(userId).toPropertyWhenPresent("userId", record::getUserId)
|
||||||
|
.map(authorId).toPropertyWhenPresent("authorId", record::getAuthorId)
|
||||||
|
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||||
|
.map(incomeMonth).toPropertyWhenPresent("incomeMonth", record::getIncomeMonth)
|
||||||
|
.map(preTaxIncome).toPropertyWhenPresent("preTaxIncome", record::getPreTaxIncome)
|
||||||
|
.map(afterTaxIncome).toPropertyWhenPresent("afterTaxIncome", record::getAfterTaxIncome)
|
||||||
|
.map(payStatus).toPropertyWhenPresent("payStatus", record::getPayStatus)
|
||||||
|
.map(confirmStatus).toPropertyWhenPresent("confirmStatus", record::getConfirmStatus)
|
||||||
|
.map(detail).toPropertyWhenPresent("detail", record::getDetail)
|
||||||
|
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<AuthorIncome> selectOne(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectOne(this::selectOne, selectList, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<AuthorIncome> select(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectList(this::selectMany, selectList, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<AuthorIncome> selectDistinct(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<AuthorIncome> selectByPrimaryKey(Long id_) {
|
||||||
|
return selectOne(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int update(UpdateDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.update(this::update, authorIncome, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateAllColumns(AuthorIncome record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalTo(record::getId)
|
||||||
|
.set(userId).equalTo(record::getUserId)
|
||||||
|
.set(authorId).equalTo(record::getAuthorId)
|
||||||
|
.set(bookId).equalTo(record::getBookId)
|
||||||
|
.set(incomeMonth).equalTo(record::getIncomeMonth)
|
||||||
|
.set(preTaxIncome).equalTo(record::getPreTaxIncome)
|
||||||
|
.set(afterTaxIncome).equalTo(record::getAfterTaxIncome)
|
||||||
|
.set(payStatus).equalTo(record::getPayStatus)
|
||||||
|
.set(confirmStatus).equalTo(record::getConfirmStatus)
|
||||||
|
.set(detail).equalTo(record::getDetail)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateSelectiveColumns(AuthorIncome record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||||
|
.set(userId).equalToWhenPresent(record::getUserId)
|
||||||
|
.set(authorId).equalToWhenPresent(record::getAuthorId)
|
||||||
|
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
|
.set(incomeMonth).equalToWhenPresent(record::getIncomeMonth)
|
||||||
|
.set(preTaxIncome).equalToWhenPresent(record::getPreTaxIncome)
|
||||||
|
.set(afterTaxIncome).equalToWhenPresent(record::getAfterTaxIncome)
|
||||||
|
.set(payStatus).equalToWhenPresent(record::getPayStatus)
|
||||||
|
.set(confirmStatus).equalToWhenPresent(record::getConfirmStatus)
|
||||||
|
.set(detail).equalToWhenPresent(record::getDetail)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKey(AuthorIncome record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(userId).equalTo(record::getUserId)
|
||||||
|
.set(authorId).equalTo(record::getAuthorId)
|
||||||
|
.set(bookId).equalTo(record::getBookId)
|
||||||
|
.set(incomeMonth).equalTo(record::getIncomeMonth)
|
||||||
|
.set(preTaxIncome).equalTo(record::getPreTaxIncome)
|
||||||
|
.set(afterTaxIncome).equalTo(record::getAfterTaxIncome)
|
||||||
|
.set(payStatus).equalTo(record::getPayStatus)
|
||||||
|
.set(confirmStatus).equalTo(record::getConfirmStatus)
|
||||||
|
.set(detail).equalTo(record::getDetail)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKeySelective(AuthorIncome record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(userId).equalToWhenPresent(record::getUserId)
|
||||||
|
.set(authorId).equalToWhenPresent(record::getAuthorId)
|
||||||
|
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
|
.set(incomeMonth).equalToWhenPresent(record::getIncomeMonth)
|
||||||
|
.set(preTaxIncome).equalToWhenPresent(record::getPreTaxIncome)
|
||||||
|
.set(afterTaxIncome).equalToWhenPresent(record::getAfterTaxIncome)
|
||||||
|
.set(payStatus).equalToWhenPresent(record::getPayStatus)
|
||||||
|
.set(confirmStatus).equalToWhenPresent(record::getConfirmStatus)
|
||||||
|
.set(detail).equalToWhenPresent(record::getDetail)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -8,14 +8,8 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import javax.annotation.Generated;
|
import javax.annotation.Generated;
|
||||||
import org.apache.ibatis.annotations.DeleteProvider;
|
|
||||||
import org.apache.ibatis.annotations.InsertProvider;
|
import org.apache.ibatis.annotations.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Result;
|
|
||||||
import org.apache.ibatis.annotations.ResultMap;
|
|
||||||
import org.apache.ibatis.annotations.Results;
|
|
||||||
import org.apache.ibatis.annotations.SelectProvider;
|
|
||||||
import org.apache.ibatis.annotations.UpdateProvider;
|
|
||||||
import org.apache.ibatis.type.JdbcType;
|
import org.apache.ibatis.type.JdbcType;
|
||||||
import org.mybatis.dynamic.sql.BasicColumn;
|
import org.mybatis.dynamic.sql.BasicColumn;
|
||||||
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||||
@ -229,4 +223,8 @@ public interface UserMapper {
|
|||||||
.where(id, isEqualTo(record::getId))
|
.where(id, isEqualTo(record::getId))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@ResultType(value = Integer.class)
|
||||||
|
Integer selectStatistic(SelectStatementProvider selectStatement);
|
||||||
}
|
}
|
@ -44,7 +44,7 @@
|
|||||||
</javaClientGenerator>
|
</javaClientGenerator>
|
||||||
|
|
||||||
<!--生成全部表tableName设为%-->
|
<!--生成全部表tableName设为%-->
|
||||||
<table tableName="crawl_single_task"/>
|
<table tableName="author_income_detail"/>
|
||||||
|
|
||||||
<!-- 指定数据库表 -->
|
<!-- 指定数据库表 -->
|
||||||
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
|
<!--<table schema="jly" tableName="job_position" domainObjectName="JobPositionTest"/>-->
|
||||||
|
@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 11797
|
* @author 11797
|
||||||
@ -103,7 +104,7 @@ public class AuthorController extends BaseController{
|
|||||||
* 发布章节内容
|
* 发布章节内容
|
||||||
* */
|
* */
|
||||||
@PostMapping("addBookContent")
|
@PostMapping("addBookContent")
|
||||||
public ResultBean addBookContent(Long bookId,String indexName,String content,HttpServletRequest request){
|
public ResultBean addBookContent(Long bookId,String indexName,String content,Byte isVip,HttpServletRequest request){
|
||||||
//查询作家信息
|
//查询作家信息
|
||||||
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
||||||
|
|
||||||
@ -116,11 +117,40 @@ public class AuthorController extends BaseController{
|
|||||||
content = content.replaceAll("\\n","<br>")
|
content = content.replaceAll("\\n","<br>")
|
||||||
.replaceAll("\\s"," ");
|
.replaceAll("\\s"," ");
|
||||||
//发布章节内容
|
//发布章节内容
|
||||||
bookService.addBookContent(bookId,indexName,content,author.getId());
|
bookService.addBookContent(bookId,indexName,content,isVip,author.getId());
|
||||||
|
|
||||||
return ResultBean.ok();
|
return ResultBean.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家日收入统计数据分页列表查询
|
||||||
|
* */
|
||||||
|
@PostMapping("listIncomeDailyByPage")
|
||||||
|
public ResultBean listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||||
|
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||||
|
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||||
|
@RequestParam(value = "startTime",defaultValue = "2020-05-01") Date startTime,
|
||||||
|
@RequestParam(value = "endTime",defaultValue = "2030-01-01") Date endTime,
|
||||||
|
HttpServletRequest request){
|
||||||
|
|
||||||
|
return ResultBean.ok(new PageInfo<>(authorService.listIncomeDailyByPage(page,pageSize,getUserDetails(request).getId(),bookId,startTime,endTime)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家月收入统计数据分页列表查询
|
||||||
|
* */
|
||||||
|
@PostMapping("listIncomeMonthByPage")
|
||||||
|
public ResultBean listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||||
|
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||||
|
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||||
|
HttpServletRequest request){
|
||||||
|
|
||||||
|
return ResultBean.ok(new PageInfo<>(authorService.listIncomeMonthByPage(page,pageSize,getUserDetails(request).getId(),bookId)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.java2nb.novel.core.config;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家收入配置
|
||||||
|
* @author cd
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Data
|
||||||
|
@ConfigurationProperties(prefix = "author.income")
|
||||||
|
public class AuthorIncomeConfig {
|
||||||
|
|
||||||
|
private BigDecimal taxRate;
|
||||||
|
|
||||||
|
private BigDecimal shareProportion;
|
||||||
|
|
||||||
|
private BigDecimal exchangeProportion;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.java2nb.novel.core.config;
|
||||||
|
|
||||||
|
import com.java2nb.novel.core.converter.DateConverter;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.format.FormatterRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebMvcConfig extends WebMvcConfigurerAdapter {
|
||||||
|
@Override
|
||||||
|
public void addFormatters(FormatterRegistry registry) {
|
||||||
|
registry.addConverter(new DateConverter());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,142 @@
|
|||||||
|
package com.java2nb.novel.core.schedule;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.core.config.AuthorIncomeConfig;
|
||||||
|
import com.java2nb.novel.core.utils.DateUtil;
|
||||||
|
import com.java2nb.novel.entity.Author;
|
||||||
|
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||||
|
import com.java2nb.novel.entity.Book;
|
||||||
|
import com.java2nb.novel.service.AuthorService;
|
||||||
|
import com.java2nb.novel.service.BookService;
|
||||||
|
import com.java2nb.novel.service.UserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家日收入统计任务
|
||||||
|
*
|
||||||
|
* @author cd
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DailyIncomeStaSchedule {
|
||||||
|
|
||||||
|
private final AuthorService authorService;
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
private final BookService bookService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天凌晨0点统计上一天数据
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 0 * * ?")
|
||||||
|
public void statistics() {
|
||||||
|
|
||||||
|
//获取昨天的日期时间
|
||||||
|
Date yesterday = DateUtil.getYesterday();
|
||||||
|
//获取昨天的开始时间
|
||||||
|
Date startTime = DateUtil.getDateStartTime(yesterday);
|
||||||
|
//获取昨天的结束时间
|
||||||
|
Date endTime = DateUtil.getDateEndTime(yesterday);
|
||||||
|
|
||||||
|
//每次查询的作家数量
|
||||||
|
int needAuthorNumber = 10;
|
||||||
|
//查询出来的真实作家数量
|
||||||
|
int realAuthorNumber;
|
||||||
|
//每次查询最大申请时间
|
||||||
|
Date maxAuthorCreateTime = new Date();
|
||||||
|
do {
|
||||||
|
//1.查询作家列表
|
||||||
|
List<Author> authors = authorService.queryAuthorList(needAuthorNumber, maxAuthorCreateTime);
|
||||||
|
realAuthorNumber = authors.size();
|
||||||
|
for (Author author : authors) {
|
||||||
|
maxAuthorCreateTime = author.getCreateTime();
|
||||||
|
Long authorId = author.getId();
|
||||||
|
Long userId = author.getUserId();
|
||||||
|
//2.查询作家作品
|
||||||
|
List<Book> books = bookService.queryBookList(authorId);
|
||||||
|
|
||||||
|
int buyTotalMember = 0;
|
||||||
|
int buyTotalCount = 0;
|
||||||
|
int buyTotalAccount = 0;
|
||||||
|
List<Long> bookIds = new ArrayList<>(books.size());
|
||||||
|
for (Book book : books) {
|
||||||
|
|
||||||
|
Long bookId = book.getId();
|
||||||
|
|
||||||
|
//3.查询该作家作品昨日的订阅人数
|
||||||
|
int buyMember = userService.queryBuyMember(bookId, startTime, endTime);
|
||||||
|
|
||||||
|
int buyCount = 0;
|
||||||
|
|
||||||
|
int buyAccount = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (buyMember > 0) {
|
||||||
|
//4.查询该作家作品昨日的订阅次数
|
||||||
|
buyCount = userService.queryBuyCount(bookId, startTime, endTime);
|
||||||
|
//5.查询该作家作品昨日的订阅总额
|
||||||
|
buyAccount = userService.queryBuyAccount(bookId, startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//6.判断该作家作品昨日收入数据是否统计入库
|
||||||
|
boolean isStatistics = authorService.queryIsStatisticsDaily(bookId, yesterday);
|
||||||
|
if (!isStatistics) {
|
||||||
|
//7.该作家作品昨日收入数据未统计入库,分作品统计数据入库
|
||||||
|
AuthorIncomeDetail authorIncomeDetail = new AuthorIncomeDetail();
|
||||||
|
authorIncomeDetail.setAuthorId(authorId);
|
||||||
|
authorIncomeDetail.setUserId(userId);
|
||||||
|
authorIncomeDetail.setBookId(bookId);
|
||||||
|
authorIncomeDetail.setIncomeDate(yesterday);
|
||||||
|
authorIncomeDetail.setIncomeNumber(buyMember);
|
||||||
|
authorIncomeDetail.setIncomeCount(buyCount);
|
||||||
|
authorIncomeDetail.setIncomeAccount(buyAccount);
|
||||||
|
authorIncomeDetail.setCreateTime(new Date());
|
||||||
|
authorService.saveDailyIncomeSta(authorIncomeDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
buyTotalCount += buyCount;
|
||||||
|
buyTotalAccount += buyAccount;
|
||||||
|
bookIds.add(bookId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//8.判断该作家所有作品昨日收入数据是否统计入库
|
||||||
|
boolean isStatistics = authorService.queryIsStatisticsDaily(authorId,0L, yesterday);
|
||||||
|
if (!isStatistics) {
|
||||||
|
if (buyTotalCount > 0) {
|
||||||
|
//总订阅次数大于0,则订阅人数也大于0
|
||||||
|
buyTotalMember = userService.queryBuyTotalMember(bookIds, startTime, endTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
//9.作家所有作品昨日收入数据统计入库
|
||||||
|
AuthorIncomeDetail authorIncomeAllDetail = new AuthorIncomeDetail();
|
||||||
|
authorIncomeAllDetail.setAuthorId(authorId);
|
||||||
|
authorIncomeAllDetail.setUserId(userId);
|
||||||
|
authorIncomeAllDetail.setBookId(0L);
|
||||||
|
authorIncomeAllDetail.setIncomeDate(yesterday);
|
||||||
|
authorIncomeAllDetail.setIncomeNumber(buyTotalMember);
|
||||||
|
authorIncomeAllDetail.setIncomeCount(buyTotalCount);
|
||||||
|
authorIncomeAllDetail.setIncomeAccount(buyTotalAccount);
|
||||||
|
authorIncomeAllDetail.setCreateTime(new Date());
|
||||||
|
authorService.saveDailyIncomeSta(authorIncomeAllDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (needAuthorNumber == realAuthorNumber);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package com.java2nb.novel.core.schedule;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.core.config.AuthorIncomeConfig;
|
||||||
|
import com.java2nb.novel.core.utils.DateUtil;
|
||||||
|
import com.java2nb.novel.entity.*;
|
||||||
|
import com.java2nb.novel.service.AuthorService;
|
||||||
|
import com.java2nb.novel.service.BookService;
|
||||||
|
import com.java2nb.novel.service.UserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家日收入统计任务
|
||||||
|
*
|
||||||
|
* @author cd
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class MonthIncomeStaSchedule {
|
||||||
|
|
||||||
|
private final AuthorService authorService;
|
||||||
|
|
||||||
|
private final BookService bookService;
|
||||||
|
|
||||||
|
private final AuthorIncomeConfig authorIncomeConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每个月1号凌晨2点统计上个月数据
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 2 1 * ?")
|
||||||
|
public void statistics() {
|
||||||
|
|
||||||
|
//获取上个月的开始时间和结束时间
|
||||||
|
Date startTime = DateUtil.getLastMonthStartTime();
|
||||||
|
Date endTime = DateUtil.getLastMonthEndTime();
|
||||||
|
|
||||||
|
//每次查询的作家数量
|
||||||
|
int needAuthorNumber = 10;
|
||||||
|
//查询出来的真实作家数量
|
||||||
|
int realAuthorNumber;
|
||||||
|
//每次查询最大申请时间
|
||||||
|
Date maxAuthorCreateTime = new Date();
|
||||||
|
do {
|
||||||
|
//1.查询作家列表
|
||||||
|
List<Author> authors = authorService.queryAuthorList(needAuthorNumber, maxAuthorCreateTime);
|
||||||
|
realAuthorNumber = authors.size();
|
||||||
|
for (Author author : authors) {
|
||||||
|
maxAuthorCreateTime = author.getCreateTime();
|
||||||
|
Long authorId = author.getId();
|
||||||
|
Long userId = author.getUserId();
|
||||||
|
//2.查询作家作品
|
||||||
|
List<Book> books = bookService.queryBookList(authorId);
|
||||||
|
|
||||||
|
Long totalPreTaxIncome = 0L;
|
||||||
|
Long totalAfterTaxIncome = 0L;
|
||||||
|
for (Book book : books) {
|
||||||
|
|
||||||
|
Long bookId = book.getId();
|
||||||
|
|
||||||
|
|
||||||
|
//3.月收入数据未统计入库,分作品统计数据入库
|
||||||
|
Long monthIncome = authorService.queryTotalAccount(userId, bookId, startTime, endTime);
|
||||||
|
|
||||||
|
BigDecimal monthIncomeShare = new BigDecimal(monthIncome)
|
||||||
|
.multiply(authorIncomeConfig.getShareProportion());
|
||||||
|
Long preTaxIncome = monthIncomeShare
|
||||||
|
.multiply(authorIncomeConfig.getExchangeProportion())
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.longValue();
|
||||||
|
|
||||||
|
totalPreTaxIncome += preTaxIncome;
|
||||||
|
|
||||||
|
Long afterTaxIncome = monthIncomeShare
|
||||||
|
.multiply(authorIncomeConfig.getTaxRate())
|
||||||
|
.multiply(authorIncomeConfig.getExchangeProportion())
|
||||||
|
.multiply(new BigDecimal(100))
|
||||||
|
.longValue();
|
||||||
|
|
||||||
|
totalAfterTaxIncome += afterTaxIncome;
|
||||||
|
|
||||||
|
//4.查询月收入统计是否入库
|
||||||
|
if (monthIncome > 0 && !authorService.queryIsStatisticsMonth(bookId, endTime)) {
|
||||||
|
AuthorIncome authorIncome = new AuthorIncome();
|
||||||
|
authorIncome.setAuthorId(authorId);
|
||||||
|
authorIncome.setUserId(userId);
|
||||||
|
authorIncome.setBookId(bookId);
|
||||||
|
authorIncome.setPreTaxIncome(preTaxIncome);
|
||||||
|
authorIncome.setAfterTaxIncome(afterTaxIncome);
|
||||||
|
authorIncome.setIncomeMonth(endTime);
|
||||||
|
authorIncome.setCreateTime(new Date());
|
||||||
|
|
||||||
|
authorService.saveAuthorIncomeSta(authorIncome);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (totalPreTaxIncome > 0 && !authorService.queryIsStatisticsMonth(0L, endTime)) {
|
||||||
|
|
||||||
|
AuthorIncome authorIncome = new AuthorIncome();
|
||||||
|
authorIncome.setAuthorId(authorId);
|
||||||
|
authorIncome.setUserId(userId);
|
||||||
|
authorIncome.setBookId(0L);
|
||||||
|
authorIncome.setPreTaxIncome(totalPreTaxIncome);
|
||||||
|
authorIncome.setAfterTaxIncome(totalAfterTaxIncome);
|
||||||
|
authorIncome.setIncomeMonth(endTime);
|
||||||
|
authorIncome.setCreateTime(new Date());
|
||||||
|
|
||||||
|
authorService.saveAuthorIncomeSta(authorIncome);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (needAuthorNumber == realAuthorNumber);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,8 +2,11 @@ package com.java2nb.novel.service;
|
|||||||
|
|
||||||
|
|
||||||
import com.java2nb.novel.entity.Author;
|
import com.java2nb.novel.entity.Author;
|
||||||
|
import com.java2nb.novel.entity.AuthorIncome;
|
||||||
|
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||||
import com.java2nb.novel.entity.FriendLink;
|
import com.java2nb.novel.entity.FriendLink;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,4 +42,87 @@ public interface AuthorService {
|
|||||||
* @return 作家对象
|
* @return 作家对象
|
||||||
* */
|
* */
|
||||||
Author queryAuthor(Long userId);
|
Author queryAuthor(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作家列表
|
||||||
|
* @return 作家列表
|
||||||
|
* @param limit 查询条数
|
||||||
|
* @param maxAuthorCreateTime 最大申请时间
|
||||||
|
*/
|
||||||
|
List<Author> queryAuthorList(int limit, Date maxAuthorCreateTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询收入日统计是否入库
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param date 收入时间
|
||||||
|
* @return true:已入库,false:未入库
|
||||||
|
*/
|
||||||
|
boolean queryIsStatisticsDaily(Long bookId, Date date);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存日收入统计(按作品)
|
||||||
|
* @param authorIncomeDetail 收入详情
|
||||||
|
* */
|
||||||
|
void saveDailyIncomeSta(AuthorIncomeDetail authorIncomeDetail);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询月收入统计是否入库
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param incomeDate 收入时间
|
||||||
|
* @return true:已入库,false:未入库
|
||||||
|
* */
|
||||||
|
boolean queryIsStatisticsMonth(Long bookId, Date incomeDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询时间段内总订阅额
|
||||||
|
*
|
||||||
|
* @param userId
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 订阅额(屋币)
|
||||||
|
* */
|
||||||
|
Long queryTotalAccount(Long userId, Long bookId, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存月收入统计
|
||||||
|
* @param authorIncome 收入详情
|
||||||
|
* */
|
||||||
|
void saveAuthorIncomeSta(AuthorIncome authorIncome);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询收入日统计是否入库
|
||||||
|
* @param authorId 作家ID
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param date 收入时间
|
||||||
|
* @return true:已入库,false:未入库
|
||||||
|
*/
|
||||||
|
boolean queryIsStatisticsDaily(Long authorId, Long bookId, Date date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*作家日收入统计数据分页列表查询
|
||||||
|
* @param userId
|
||||||
|
* @param page 页码
|
||||||
|
* @param pageSize 分页大小
|
||||||
|
* @param bookId 小说ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 日收入统计数据列表
|
||||||
|
*/
|
||||||
|
List<AuthorIncomeDetail> listIncomeDailyByPage(int page, int pageSize, Long userId, Long bookId, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 作家月收入统计数据分页列表查询
|
||||||
|
* @param page 页码
|
||||||
|
* @param pageSize 分页大小
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param bookId 小说ID
|
||||||
|
* @return
|
||||||
|
* */
|
||||||
|
List<AuthorIncome> listIncomeMonthByPage(int page, int pageSize, Long userId, Long bookId);
|
||||||
}
|
}
|
||||||
|
@ -225,9 +225,9 @@ public interface BookService {
|
|||||||
* @param bookId 小说ID
|
* @param bookId 小说ID
|
||||||
* @param indexName 章节名
|
* @param indexName 章节名
|
||||||
* @param content 章节内容
|
* @param content 章节内容
|
||||||
* @param authorId 作者ID
|
* @param isVip 是否收费
|
||||||
* */
|
* @param authorId 作者ID */
|
||||||
void addBookContent(Long bookId, String indexName, String content, Long authorId);
|
void addBookContent(Long bookId, String indexName, String content, Byte isVip, Long authorId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -237,4 +237,11 @@ public interface BookService {
|
|||||||
* @return 书籍列表
|
* @return 书籍列表
|
||||||
* */
|
* */
|
||||||
List<Book> queryBookByUpdateTimeByPage(Date startDate, int limit);
|
List<Book> queryBookByUpdateTimeByPage(Date startDate, int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品列表
|
||||||
|
* @param authorId 作家ID
|
||||||
|
* @return 作品列表
|
||||||
|
*/
|
||||||
|
List<Book> queryBookList(Long authorId);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.java2nb.novel.vo.BookShelfVO;
|
|||||||
import com.java2nb.novel.entity.User;
|
import com.java2nb.novel.entity.User;
|
||||||
import com.java2nb.novel.vo.UserFeedbackVO;
|
import com.java2nb.novel.vo.UserFeedbackVO;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,4 +139,40 @@ public interface UserService {
|
|||||||
* @param buyRecord 购买信息
|
* @param buyRecord 购买信息
|
||||||
* */
|
* */
|
||||||
void buyBookIndex(Long userId, UserBuyRecord buyRecord);
|
void buyBookIndex(Long userId, UserBuyRecord buyRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品时间段内的订阅人数
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 订阅人数
|
||||||
|
*/
|
||||||
|
int queryBuyMember(Long bookId, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品时间段内的订阅次数
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 订阅次数
|
||||||
|
*/
|
||||||
|
int queryBuyCount(Long bookId, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作品时间段内的订阅总额(屋币)
|
||||||
|
* @param bookId 作品ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 订阅总额(屋币)
|
||||||
|
*/
|
||||||
|
int queryBuyAccount(Long bookId, Date startTime, Date endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询作者时间段内的订阅人数
|
||||||
|
* @param bookIds z作者的所有作品ID
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @param endTime 结束时间
|
||||||
|
* @return 订阅人数
|
||||||
|
*/
|
||||||
|
int queryBuyTotalMember(List<Long> bookIds, Date startTime, Date endTime);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
package com.java2nb.novel.service.impl;
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.java2nb.novel.core.cache.CacheKey;
|
import com.java2nb.novel.core.cache.CacheKey;
|
||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.core.exception.BusinessException;
|
import com.java2nb.novel.core.exception.BusinessException;
|
||||||
import com.java2nb.novel.entity.Author;
|
import com.java2nb.novel.entity.Author;
|
||||||
|
import com.java2nb.novel.entity.AuthorIncome;
|
||||||
|
import com.java2nb.novel.entity.AuthorIncomeDetail;
|
||||||
import com.java2nb.novel.entity.FriendLink;
|
import com.java2nb.novel.entity.FriendLink;
|
||||||
import com.java2nb.novel.mapper.*;
|
import com.java2nb.novel.mapper.*;
|
||||||
import com.java2nb.novel.service.AuthorService;
|
import com.java2nb.novel.service.AuthorService;
|
||||||
@ -38,6 +41,11 @@ public class AuthorServiceImpl implements AuthorService {
|
|||||||
|
|
||||||
private final AuthorCodeMapper authorCodeMapper;
|
private final AuthorCodeMapper authorCodeMapper;
|
||||||
|
|
||||||
|
private final AuthorIncomeDetailMapper authorIncomeDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
|
private final AuthorIncomeMapper authorIncomeMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean checkPenName(String penName) {
|
public Boolean checkPenName(String penName) {
|
||||||
@ -89,4 +97,108 @@ public class AuthorServiceImpl implements AuthorService {
|
|||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3)).get(0);
|
.render(RenderingStrategies.MYBATIS3)).get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Author> queryAuthorList(int needAuthorNumber, Date maxAuthorCreateTime) {
|
||||||
|
return authorMapper.selectMany(select(AuthorDynamicSqlSupport.id, AuthorDynamicSqlSupport.userId)
|
||||||
|
.from(AuthorDynamicSqlSupport.author)
|
||||||
|
.where(AuthorDynamicSqlSupport.createTime, isLessThan(maxAuthorCreateTime))
|
||||||
|
.orderBy(AuthorDynamicSqlSupport.createTime.descending())
|
||||||
|
.limit(needAuthorNumber)
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryIsStatisticsDaily(Long bookId, Date date) {
|
||||||
|
|
||||||
|
return authorIncomeDetailMapper.selectMany(select(AuthorIncomeDetailDynamicSqlSupport.id)
|
||||||
|
.from(AuthorIncomeDetailDynamicSqlSupport.authorIncomeDetail)
|
||||||
|
.where(AuthorIncomeDetailDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isEqualTo(date))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3)).size() > 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveDailyIncomeSta(AuthorIncomeDetail authorIncomeDetail) {
|
||||||
|
authorIncomeDetailMapper.insertSelective(authorIncomeDetail);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryIsStatisticsMonth(Long bookId, Date incomeDate) {
|
||||||
|
return authorIncomeMapper.selectMany(select(AuthorIncomeDynamicSqlSupport.id)
|
||||||
|
.from(AuthorIncomeDynamicSqlSupport.authorIncome)
|
||||||
|
.where(AuthorIncomeDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.and(AuthorIncomeDynamicSqlSupport.incomeMonth, isEqualTo(incomeDate))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3)).size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long queryTotalAccount(Long userId, Long bookId, Date startTime, Date endTime) {
|
||||||
|
|
||||||
|
return authorIncomeDetailMapper.selectStatistic(select(sum(AuthorIncomeDetailDynamicSqlSupport.incomeAccount))
|
||||||
|
.from(AuthorIncomeDetailDynamicSqlSupport.authorIncomeDetail)
|
||||||
|
.where(AuthorIncomeDetailDynamicSqlSupport.userId, isEqualTo(userId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isLessThanOrEqualTo(endTime))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAuthorIncomeSta(AuthorIncome authorIncome) {
|
||||||
|
authorIncomeMapper.insertSelective(authorIncome);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean queryIsStatisticsDaily(Long authorId, Long bookId, Date date) {
|
||||||
|
return authorIncomeDetailMapper.selectMany(select(AuthorIncomeDetailDynamicSqlSupport.id)
|
||||||
|
.from(AuthorIncomeDetailDynamicSqlSupport.authorIncomeDetail)
|
||||||
|
.where(AuthorIncomeDetailDynamicSqlSupport.authorId, isEqualTo(authorId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isEqualTo(date))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3)).size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthorIncomeDetail> listIncomeDailyByPage(int page, int pageSize, Long userId, Long bookId, Date startTime, Date endTime) {
|
||||||
|
PageHelper.startPage(page, pageSize);
|
||||||
|
return authorIncomeDetailMapper.selectMany(
|
||||||
|
select(AuthorIncomeDetailDynamicSqlSupport.incomeDate, AuthorIncomeDetailDynamicSqlSupport.incomeAccount
|
||||||
|
, AuthorIncomeDetailDynamicSqlSupport.incomeCount, AuthorIncomeDetailDynamicSqlSupport.incomeNumber)
|
||||||
|
.from(AuthorIncomeDetailDynamicSqlSupport.authorIncomeDetail)
|
||||||
|
.where(AuthorIncomeDetailDynamicSqlSupport.userId, isEqualTo(userId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(AuthorIncomeDetailDynamicSqlSupport.incomeDate, isLessThanOrEqualTo(endTime))
|
||||||
|
.orderBy(AuthorIncomeDetailDynamicSqlSupport.incomeDate.descending())
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AuthorIncome> listIncomeMonthByPage(int page, int pageSize, Long userId, Long bookId) {
|
||||||
|
PageHelper.startPage(page, pageSize);
|
||||||
|
return authorIncomeMapper.selectMany(select(AuthorIncomeDynamicSqlSupport.incomeMonth
|
||||||
|
, AuthorIncomeDynamicSqlSupport.preTaxIncome
|
||||||
|
, AuthorIncomeDynamicSqlSupport.afterTaxIncome
|
||||||
|
, AuthorIncomeDynamicSqlSupport.payStatus
|
||||||
|
, AuthorIncomeDynamicSqlSupport.confirmStatus)
|
||||||
|
.from(AuthorIncomeDynamicSqlSupport.authorIncome)
|
||||||
|
.where(AuthorIncomeDynamicSqlSupport.userId, isEqualTo(userId))
|
||||||
|
.and(AuthorIncomeDynamicSqlSupport.bookId, isEqualTo(bookId))
|
||||||
|
.orderBy(AuthorIncomeDynamicSqlSupport.incomeMonth.descending())
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -531,13 +531,17 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public void addBookContent(Long bookId, String indexName, String content, Long authorId) {
|
public void addBookContent(Long bookId, String indexName, String content, Byte isVip, Long authorId) {
|
||||||
|
|
||||||
Book book = queryBookDetail(bookId);
|
Book book = queryBookDetail(bookId);
|
||||||
if (!authorId.equals(book.getAuthorId())) {
|
if (!authorId.equals(book.getAuthorId())) {
|
||||||
//并不是更新自己的小说
|
//并不是更新自己的小说
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if(book.getStatus() != 1){
|
||||||
|
//小说未上架,不能设置VIP
|
||||||
|
isVip = 0;
|
||||||
|
}
|
||||||
Long lastIndexId = new IdWorker().nextId();
|
Long lastIndexId = new IdWorker().nextId();
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
int wordCount = content.length();
|
int wordCount = content.length();
|
||||||
@ -567,7 +571,7 @@ public class BookServiceImpl implements BookService {
|
|||||||
lastBookIndex.setIndexName(indexName);
|
lastBookIndex.setIndexName(indexName);
|
||||||
lastBookIndex.setIndexNum(indexNum);
|
lastBookIndex.setIndexNum(indexNum);
|
||||||
lastBookIndex.setBookId(bookId);
|
lastBookIndex.setBookId(bookId);
|
||||||
lastBookIndex.setIsVip(book.getStatus());
|
lastBookIndex.setIsVip(isVip);
|
||||||
lastBookIndex.setCreateTime(currentDate);
|
lastBookIndex.setCreateTime(currentDate);
|
||||||
lastBookIndex.setUpdateTime(currentDate);
|
lastBookIndex.setUpdateTime(currentDate);
|
||||||
bookIndexMapper.insertSelective(lastBookIndex);
|
bookIndexMapper.insertSelective(lastBookIndex);
|
||||||
@ -594,5 +598,15 @@ public class BookServiceImpl implements BookService {
|
|||||||
.render(RenderingStrategies.MYBATIS3));
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Book> queryBookList(Long authorId) {
|
||||||
|
|
||||||
|
return bookMapper.selectMany(select(id, bookName)
|
||||||
|
.from(book)
|
||||||
|
.where(BookDynamicSqlSupport.authorId,isEqualTo(authorId))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -303,6 +303,51 @@ public class UserServiceImpl implements UserService {
|
|||||||
.render(RenderingStrategies.MYBATIS3));
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryBuyMember(Long bookId, Date startTime, Date endTime) {
|
||||||
|
return userMapper.selectStatistic(select(countDistinct(UserBuyRecordDynamicSqlSupport.userId))
|
||||||
|
.from(UserBuyRecordDynamicSqlSupport.userBuyRecord)
|
||||||
|
.where(UserBuyRecordDynamicSqlSupport.bookId,isEqualTo(bookId))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isLessThanOrEqualTo(endTime))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryBuyCount(Long bookId, Date startTime, Date endTime) {
|
||||||
|
return userMapper.selectStatistic(select(count(UserBuyRecordDynamicSqlSupport.id))
|
||||||
|
.from(UserBuyRecordDynamicSqlSupport.userBuyRecord)
|
||||||
|
.where(UserBuyRecordDynamicSqlSupport.bookId,isEqualTo(bookId))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isLessThanOrEqualTo(endTime))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryBuyAccount(Long bookId, Date startTime, Date endTime) {
|
||||||
|
return userMapper.selectStatistic(select(sum(UserBuyRecordDynamicSqlSupport.buyAmount))
|
||||||
|
.from(UserBuyRecordDynamicSqlSupport.userBuyRecord)
|
||||||
|
.where(UserBuyRecordDynamicSqlSupport.bookId,isEqualTo(bookId))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isLessThanOrEqualTo(endTime))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int queryBuyTotalMember(List<Long> bookIds, Date startTime, Date endTime) {
|
||||||
|
return userMapper.selectStatistic(select(countDistinct(UserBuyRecordDynamicSqlSupport.userId))
|
||||||
|
.from(UserBuyRecordDynamicSqlSupport.userBuyRecord)
|
||||||
|
.where(UserBuyRecordDynamicSqlSupport.bookId,isIn(bookIds))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isGreaterThanOrEqualTo(startTime))
|
||||||
|
.and(UserBuyRecordDynamicSqlSupport.createTime,isLessThanOrEqualTo(endTime))
|
||||||
|
.build()
|
||||||
|
.render(RenderingStrategies.MYBATIS3));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,4 +49,11 @@ xss:
|
|||||||
urlPatterns: /book/addBookComment,/user/addFeedBack,/author/addBook,/author/addBookContent,/author/register.html
|
urlPatterns: /book/addBookComment,/user/addFeedBack,/author/addBook,/author/addBookContent,/author/register.html
|
||||||
|
|
||||||
|
|
||||||
|
author:
|
||||||
|
income:
|
||||||
|
#税率(扣税后所得比率)
|
||||||
|
tax-rate: 0.9
|
||||||
|
#分佣比例
|
||||||
|
share-proportion: 0.7
|
||||||
|
#兑换比率(人民币)
|
||||||
|
exchange-proportion: 0.01
|
||||||
|
@ -0,0 +1,227 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||||
|
<title>作家管理系统-小说精品屋</title>
|
||||||
|
<link rel="stylesheet" href="/css/base.css?v=1"/>
|
||||||
|
<link rel="stylesheet" href="/css/user.css" />
|
||||||
|
</head>
|
||||||
|
</head>
|
||||||
|
<body class="">
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
<div class="mainNav" id="mainNav">
|
||||||
|
<div class="box_center cf" style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
|
||||||
|
|
||||||
|
小说精品屋作家管理
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main box_center cf">
|
||||||
|
<div class="userBox cf">
|
||||||
|
<div class="my_l">
|
||||||
|
|
||||||
|
<ul class="log_list">
|
||||||
|
<li><a class="link_1" href="/author/index.html">小说管理</a></li>
|
||||||
|
<li><a class="link_1 on" href="/author/author_income_detail.html">稿费收入</a></li>
|
||||||
|
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
||||||
|
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="my_r">
|
||||||
|
<div class="my_bookshelf">
|
||||||
|
<div class="title cf">
|
||||||
|
<h2 class="fl ml10"><a href="/author/author_income_detail.html">订阅明细</a></h2><i class="fl ml20 mr20 font16">|</i><h2 class="fl"><a href="/author/author_income.html" class="red">稿费汇总</a></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="divData" class="updateTable">
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="goread">
|
||||||
|
月份
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
税前收入
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
税后收入
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
支付状态
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</thead>
|
||||||
|
<tbody id="bookList">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pageBox cf" id="shellPage">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--<div id="divData" class="updateTable">
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<th class="name">
|
||||||
|
爬虫源(已开启的爬虫源)
|
||||||
|
</th>
|
||||||
|
<th class="chapter">
|
||||||
|
成功爬取数量(websocket实现)
|
||||||
|
</th>
|
||||||
|
<th class="time">
|
||||||
|
目标爬取数量
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
状态(正在运行,已停止)(一次只能运行一个爬虫源)
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
操作(启动,停止)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="bookShelfList">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pageBox cf" id="shellPage">
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script src="/javascript/jquery-1.8.0.min.js" type="text/javascript"></script>
|
||||||
|
<script src="/layui/layui.all.js" type="text/javascript"></script>
|
||||||
|
<script src="/javascript/header.js" type="text/javascript"></script>
|
||||||
|
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
search(1, 10);
|
||||||
|
|
||||||
|
function search(curr, limit) {
|
||||||
|
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/author/listIncomeMonthByPage",
|
||||||
|
data: {'curr':curr,'limit':limit},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
var bookList = data.data.list;
|
||||||
|
if (bookList.length > 0) {
|
||||||
|
var bookListHtml = "";
|
||||||
|
for(var i=0;i<bookList.length;i++){
|
||||||
|
var book = bookList[i];
|
||||||
|
bookListHtml+=(" <tr class=\"book_list\" >\n" +
|
||||||
|
" <td class=\"goread\">\n" +
|
||||||
|
" "+book.incomeMonth+"</td>\n" +
|
||||||
|
" <td class=\"goread\" >"
|
||||||
|
+book.preTaxIncome/100+"</td>\n" +
|
||||||
|
" <td class=\"goread\">\n" +
|
||||||
|
" "+book.afterTaxIncome/100+"\n" +
|
||||||
|
" </td>\n" +
|
||||||
|
" <td class=\"goread\">"+(book.payStatus == 1 ? '已支付' : '待支付')+
|
||||||
|
" </td>\n" +
|
||||||
|
|
||||||
|
" </tr>");
|
||||||
|
}
|
||||||
|
$("#bookList").html(bookListHtml);
|
||||||
|
|
||||||
|
layui.use('laypage', function () {
|
||||||
|
var laypage = layui.laypage;
|
||||||
|
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'shellPage' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
, count: data.data.total //数据总数,从服务端得到,
|
||||||
|
, curr: data.data.pageNum
|
||||||
|
, limit: data.data.pageSize
|
||||||
|
, jump: function (obj, first) {
|
||||||
|
|
||||||
|
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
|
||||||
|
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
search(obj.curr, obj.limit);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateBookStatus(bookId,status) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/author/updateBookStatus",
|
||||||
|
data: {'bookId':bookId,'status':status==0?1:0},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
|
||||||
|
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
@ -0,0 +1,225 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||||
|
<title>作家管理系统-小说精品屋</title>
|
||||||
|
<link rel="stylesheet" href="/css/base.css?v=1"/>
|
||||||
|
<link rel="stylesheet" href="/css/user.css" />
|
||||||
|
</head>
|
||||||
|
</head>
|
||||||
|
<body class="">
|
||||||
|
|
||||||
|
<div class="header">
|
||||||
|
<div class="mainNav" id="mainNav">
|
||||||
|
<div class="box_center cf" style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
|
||||||
|
|
||||||
|
小说精品屋作家管理
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main box_center cf">
|
||||||
|
<div class="userBox cf">
|
||||||
|
<div class="my_l">
|
||||||
|
|
||||||
|
<ul class="log_list">
|
||||||
|
<li><a class="link_1" href="/author/index.html">小说管理</a></li>
|
||||||
|
<li><a class="link_1 on" href="/author/author_income_detail.html">稿费收入</a></li>
|
||||||
|
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
||||||
|
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="my_r">
|
||||||
|
<div class="my_bookshelf">
|
||||||
|
<div class="title cf">
|
||||||
|
<h2 class="fl ml10"><a href="/author/author_income_detail.html" class="red">订阅明细</a></h2><i class="fl ml20 mr20 font16">|</i><h2 class="fl"><a href="/author/author_income.html">稿费汇总</a></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="divData" class="updateTable">
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="goread">
|
||||||
|
日期
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
订阅总额
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
订阅次数
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
订阅人数
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="bookList">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pageBox cf" id="shellPage">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--<div id="divData" class="updateTable">
|
||||||
|
<table cellpadding="0" cellspacing="0">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
|
||||||
|
<th class="name">
|
||||||
|
爬虫源(已开启的爬虫源)
|
||||||
|
</th>
|
||||||
|
<th class="chapter">
|
||||||
|
成功爬取数量(websocket实现)
|
||||||
|
</th>
|
||||||
|
<th class="time">
|
||||||
|
目标爬取数量
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
状态(正在运行,已停止)(一次只能运行一个爬虫源)
|
||||||
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
操作(启动,停止)
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="bookShelfList">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div class="pageBox cf" id="shellPage">
|
||||||
|
</div>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
<script src="/javascript/jquery-1.8.0.min.js" type="text/javascript"></script>
|
||||||
|
<script src="/layui/layui.all.js" type="text/javascript"></script>
|
||||||
|
<script src="/javascript/header.js" type="text/javascript"></script>
|
||||||
|
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
search(1, 10);
|
||||||
|
|
||||||
|
function search(curr, limit) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/author/listIncomeDailyByPage",
|
||||||
|
data: {'curr':curr,'limit':limit},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
var bookList = data.data.list;
|
||||||
|
if (bookList.length > 0) {
|
||||||
|
var bookListHtml = "";
|
||||||
|
for(var i=0;i<bookList.length;i++){
|
||||||
|
var book = bookList[i];
|
||||||
|
bookListHtml+=(" <tr class=\"book_list\" >\n" +
|
||||||
|
" <td class=\"goread\">\n" +
|
||||||
|
" "+book.incomeDate+"</td>\n" +
|
||||||
|
" <td class=\"goread\" >"
|
||||||
|
+book.incomeAccount+"</td>\n" +
|
||||||
|
" <td class=\"goread\">\n" +
|
||||||
|
" "+book.incomeCount+"\n" +
|
||||||
|
" </td>\n" +
|
||||||
|
" <td class=\"goread\">"+book.incomeNumber+
|
||||||
|
" </td>\n" +
|
||||||
|
|
||||||
|
" </tr>");
|
||||||
|
}
|
||||||
|
$("#bookList").html(bookListHtml);
|
||||||
|
|
||||||
|
layui.use('laypage', function () {
|
||||||
|
var laypage = layui.laypage;
|
||||||
|
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'shellPage' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
, count: data.data.total //数据总数,从服务端得到,
|
||||||
|
, curr: data.data.pageNum
|
||||||
|
, limit: data.data.pageSize
|
||||||
|
, jump: function (obj, first) {
|
||||||
|
|
||||||
|
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
|
||||||
|
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
search(obj.curr, obj.limit);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateBookStatus(bookId,status) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/author/updateBookStatus",
|
||||||
|
data: {'bookId':bookId,'status':status==0?1:0},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
|
||||||
|
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
||||||
|
|
||||||
|
}else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</html>
|
@ -32,8 +32,9 @@
|
|||||||
|
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
||||||
|
<li><a class="link_1 " href="/author/author_income_detail.html">稿费收入</a></li>
|
||||||
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
||||||
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,8 +29,9 @@
|
|||||||
|
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
||||||
|
<li><a class="link_1 " href="/author/author_income_detail.html">稿费收入</a></li>
|
||||||
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
||||||
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -57,9 +58,11 @@
|
|||||||
<li><span id="LabErr"></span></li>
|
<li><span id="LabErr"></span></li>
|
||||||
<b>章节名:</b>
|
<b>章节名:</b>
|
||||||
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input" ></li>
|
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input" ></li>
|
||||||
<b>章节内容:</b>
|
<b>章节内容:</b><li id="contentLi">
|
||||||
<textarea name="bookContent" rows="30" cols="80" id="bookContent"
|
<textarea name="bookContent" rows="30" cols="80" id="bookContent"
|
||||||
class="textarea"></textarea>
|
class="textarea"></textarea></li>
|
||||||
|
|
||||||
|
|
||||||
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()" name="btnRegister" value="提交"
|
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()" name="btnRegister" value="提交"
|
||||||
id="btnRegister" class="btn_red">
|
id="btnRegister" class="btn_red">
|
||||||
|
|
||||||
@ -115,6 +118,13 @@
|
|||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
|
var bookStatus = getSearchString("bookStatus");
|
||||||
|
if(bookStatus == 1){
|
||||||
|
$("#contentLi").after("<b>是否收费:</b>\n" +
|
||||||
|
" <li><input type=\"radio\" name=\"isVip\" value=\"0\" checked >免费\n" +
|
||||||
|
" <input type=\"radio\" name=\"isVip\" value=\"1\" >收费</li><br/>");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var lock = false;
|
var lock = false;
|
||||||
function addBookContent() {
|
function addBookContent() {
|
||||||
@ -143,12 +153,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var isVip = 0;
|
||||||
|
if(bookStatus == 1){
|
||||||
|
|
||||||
|
isVip = $("input:checked[name=isVip]").val();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/author/addBookContent",
|
url: "/author/addBookContent",
|
||||||
data: {'bookId':bookId,'indexName':indexName,'content':content},
|
data: {'bookId':bookId,'indexName':indexName,'content':content,'isVip':isVip},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
<li><a class="link_1 on" href="/author/index.html">小说管理</a></li>
|
||||||
|
<li><a class="link_1 " href="/author/author_income_detail.html">稿费收入</a></li>
|
||||||
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
|
||||||
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
|
||||||
</ul>
|
</ul>
|
||||||
@ -149,7 +150,7 @@
|
|||||||
|
|
||||||
" <td class=\"goread\" id='opt"+book.id+"'>" +
|
" <td class=\"goread\" id='opt"+book.id+"'>" +
|
||||||
"<a href='javascript:updateBookStatus(\""+book.id+"\","+book.status+")'>"+(book.status==0?'上架':'下架')+" </a>" +
|
"<a href='javascript:updateBookStatus(\""+book.id+"\","+book.status+")'>"+(book.status==0?'上架':'下架')+" </a>" +
|
||||||
"<a href='/author/content_add.html?bookId="+book.id+"'>发布章节 </a>" +
|
"<a href='/author/content_add.html?bookStatus="+book.status+"&bookId="+book.id+"'>发布章节 </a>" +
|
||||||
"</td> </tr>");
|
"</td> </tr>");
|
||||||
}
|
}
|
||||||
$("#bookList").html(bookListHtml);
|
$("#bookList").html(bookListHtml);
|
||||||
|
27
sql/20201103.sql
Normal file
27
sql/20201103.sql
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
CREATE TABLE `author_income_detail` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||||
|
`author_id` bigint(20) NOT NULL COMMENT '作家ID',
|
||||||
|
`book_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '作品ID,0表示全部作品',
|
||||||
|
`income_date` date NOT NULL COMMENT '收入日期',
|
||||||
|
`income_account` int(11) NOT NULL DEFAULT '0' COMMENT '订阅总额',
|
||||||
|
`income_count` int(11) NOT NULL DEFAULT '0' COMMENT '订阅次数',
|
||||||
|
`income_number` int(11) NOT NULL DEFAULT '0' COMMENT '订阅人数',
|
||||||
|
`create_time` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='稿费收入明细统计表';
|
||||||
|
|
||||||
|
CREATE TABLE `author_income` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||||
|
`author_id` bigint(20) NOT NULL COMMENT '作家ID',
|
||||||
|
`book_id` bigint(20) NOT NULL COMMENT '作品ID',
|
||||||
|
`income_month` date NOT NULL COMMENT '收入月份',
|
||||||
|
`pre_tax_income` bigint(20) NOT NULL DEFAULT '0' COMMENT '税前收入(分)',
|
||||||
|
`after_tax_income` bigint(20) NOT NULL DEFAULT '0' COMMENT '税后收入(分)',
|
||||||
|
`pay_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '支付状态,0:待支付,1:已支付',
|
||||||
|
`confirm_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '稿费确认状态,0:待确认,1:已确认',
|
||||||
|
`detail` varchar(255) DEFAULT NULL COMMENT '详情',
|
||||||
|
`create_time` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='稿费收入统计表';
|
@ -1836,3 +1836,32 @@ UPDATE `crawl_source` SET `source_name` = '书趣阁', `crawl_rule` = '{\n \"boo
|
|||||||
INSERT INTO `friend_link` ( `link_name`, `link_url`, `sort`, `is_open`, `create_user_id`, `create_time`, `update_user_id`, `update_time`) VALUES
|
INSERT INTO `friend_link` ( `link_name`, `link_url`, `sort`, `is_open`, `create_user_id`, `create_time`, `update_user_id`, `update_time`) VALUES
|
||||||
('小羊影视', 'http://video.java2nb.com/', 11, 1, NULL, NULL, NULL, NULL),
|
('小羊影视', 'http://video.java2nb.com/', 11, 1, NULL, NULL, NULL, NULL),
|
||||||
('官方论坛', 'http://bbs.java2nb.com', 21, 1, NULL, NULL, NULL, NULL);
|
('官方论坛', 'http://bbs.java2nb.com', 21, 1, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `author_income_detail` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||||
|
`author_id` bigint(20) NOT NULL COMMENT '作家ID',
|
||||||
|
`book_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '作品ID,0表示全部作品',
|
||||||
|
`income_date` date NOT NULL COMMENT '收入日期',
|
||||||
|
`income_account` int(11) NOT NULL DEFAULT '0' COMMENT '订阅总额',
|
||||||
|
`income_count` int(11) NOT NULL DEFAULT '0' COMMENT '订阅次数',
|
||||||
|
`income_number` int(11) NOT NULL DEFAULT '0' COMMENT '订阅人数',
|
||||||
|
`create_time` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='稿费收入明细统计表';
|
||||||
|
|
||||||
|
CREATE TABLE `author_income` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
||||||
|
`author_id` bigint(20) NOT NULL COMMENT '作家ID',
|
||||||
|
`book_id` bigint(20) NOT NULL COMMENT '作品ID',
|
||||||
|
`income_month` date NOT NULL COMMENT '收入月份',
|
||||||
|
`pre_tax_income` bigint(20) NOT NULL DEFAULT '0' COMMENT '税前收入(分)',
|
||||||
|
`after_tax_income` bigint(20) NOT NULL DEFAULT '0' COMMENT '税后收入(分)',
|
||||||
|
`pay_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '支付状态,0:待支付,1:已支付',
|
||||||
|
`confirm_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '稿费确认状态,0:待确认,1:已确认',
|
||||||
|
`detail` varchar(255) DEFAULT NULL COMMENT '详情',
|
||||||
|
`create_time` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='稿费收入统计表';
|
Loading…
x
Reference in New Issue
Block a user