🐛 修复了一些已知问题
🐛 修复了一些已知问题
This commit is contained in:
commit
be772aed4c
34
pom.xml
34
pom.xml
@ -17,7 +17,7 @@
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<lucene.version>8.0.0</lucene.version>
|
||||
<lucene.version>8.11.1</lucene.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -43,7 +43,7 @@
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.2.0</version>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -101,7 +101,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.78</version>
|
||||
<version>1.2.79</version>
|
||||
</dependency>
|
||||
<!-- shiro权限控制框架 -->
|
||||
<dependency>
|
||||
@ -130,17 +130,17 @@
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.7</version>
|
||||
<version>2.11.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-text</artifactId>
|
||||
<version>1.8</version>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.14</version>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
@ -197,12 +197,12 @@
|
||||
<dependency>
|
||||
<groupId>org.jodd</groupId>
|
||||
<artifactId>jodd-http</artifactId>
|
||||
<version>6.0.6</version>
|
||||
<version>6.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-open</artifactId>
|
||||
<version>4.0.0</version>
|
||||
<version>4.2.5.B</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
@ -231,7 +231,7 @@
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.16.2</version>
|
||||
<version>4.16.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@ -273,12 +273,24 @@
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>5.5.9</version>
|
||||
<version>5.7.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.5.9</version>
|
||||
<version>5.7.20</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.warrenstrange</groupId>
|
||||
<artifactId>googleauth</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
|
||||
.excludePathPatterns("/api/v1/console/**", "/api/v1/article/articles/**", "/api/v1/article/detail/**"
|
||||
, "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**", "/api/v1/lucene/**");
|
||||
, "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**", "/api/v1/lucene/**", "/api/v1/open-data/**");
|
||||
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import com.rymcu.forest.entity.Article;
|
||||
import com.rymcu.forest.entity.Portfolio;
|
||||
import com.rymcu.forest.enumerate.Module;
|
||||
import com.rymcu.forest.jwt.def.JwtConstants;
|
||||
import com.rymcu.forest.mapper.UserMapper;
|
||||
import com.rymcu.forest.service.ArticleService;
|
||||
import com.rymcu.forest.service.PortfolioService;
|
||||
import com.rymcu.forest.util.UserUtils;
|
||||
@ -52,6 +53,8 @@ public class AuthorshipAspect {
|
||||
private ArticleService articleService;
|
||||
@Resource
|
||||
private PortfolioService portfolioService;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 检查用户修改信息权限
|
||||
@ -119,7 +122,14 @@ public class AuthorshipAspect {
|
||||
TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
|
||||
if (Objects.nonNull(tokenUser)) {
|
||||
if (!idAuthor.equals(tokenUser.getIdUser())) {
|
||||
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
||||
boolean hasPermission = false;
|
||||
if (Module.ARTICLE_TAG.equals(log.moduleName())) {
|
||||
// 判断管理员权限
|
||||
hasPermission = userMapper.hasAdminPermission(tokenUser.getAccount());
|
||||
}
|
||||
if (!hasPermission) {
|
||||
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
||||
|
@ -8,5 +8,6 @@ package com.rymcu.forest.enumerate;
|
||||
*/
|
||||
public enum Module {
|
||||
ARTICLE,
|
||||
PORTFOLIO;
|
||||
PORTFOLIO,
|
||||
ARTICLE_TAG;
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ import java.util.Arrays;
|
||||
public enum TransactionEnum {
|
||||
ArticleSponsor("0", 20, "文章赞赏"),
|
||||
Answer("1", 30, "答题奖励"),
|
||||
CorrectAnswer("2", 50, "答题奖励");
|
||||
CorrectAnswer("2", 50, "答题奖励"),
|
||||
NewbieRewards("3", 200, "新手奖励");
|
||||
|
||||
private String dataType;
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.rymcu.forest.mapper;
|
||||
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.BankAccountDTO;
|
||||
import com.rymcu.forest.dto.UserInfoDTO;
|
||||
import com.rymcu.forest.dto.admin.DashboardData;
|
||||
|
||||
import java.util.List;
|
||||
@ -51,30 +54,62 @@ public interface DashboardMapper {
|
||||
List<DashboardData> selectLastThirtyDaysArticleData();
|
||||
|
||||
/**
|
||||
* 获取最近 30 天文章数据
|
||||
* 获取最近 30 天用户数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectLastThirtyDaysUserData();
|
||||
|
||||
/**
|
||||
* 获取最近 30 天文章数据
|
||||
* 获取最近 30 天流量数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectLastThirtyDaysVisitData();
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取历史 1 年文章数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectHistoryArticleData();
|
||||
|
||||
/**
|
||||
* 获取历史 1 年用户数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectHistoryUserData();
|
||||
|
||||
/**
|
||||
* 获取历史 1 年访问数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectHistoryVisitData();
|
||||
|
||||
/**
|
||||
* 获取新增用户列表
|
||||
* @return
|
||||
*/
|
||||
List<UserInfoDTO> selectNewUsers();
|
||||
|
||||
/**
|
||||
* 获取新增银行账号列表
|
||||
* @return
|
||||
*/
|
||||
List<BankAccountDTO> selectNewBankAccounts();
|
||||
|
||||
/**
|
||||
* 获取新增文章列表
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> selectNewArticles();
|
||||
|
||||
/**
|
||||
* 获取最近 30 天访客数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectLastThirtyDaysVisitIpData();
|
||||
|
||||
/**
|
||||
* 获取历史 1 年访客数据
|
||||
* @return
|
||||
*/
|
||||
List<DashboardData> selectHistoryVisitIpData();
|
||||
}
|
||||
|
@ -37,4 +37,11 @@ public interface TransactionRecordMapper extends Mapper<TransactionRecord> {
|
||||
* @return
|
||||
*/
|
||||
Boolean existsWithBankAccountAndFunds(@Param("bankAccount") String bankAccount, @Param("funds") String funds);
|
||||
|
||||
/**
|
||||
* 查询是否已发放
|
||||
* @param bankAccount
|
||||
* @return
|
||||
*/
|
||||
Boolean existsWithNewbieRewards(@Param("bankAccount") String bankAccount);
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package com.rymcu.forest.service;
|
||||
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.BankAccountDTO;
|
||||
import com.rymcu.forest.dto.UserInfoDTO;
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -26,4 +30,21 @@ public interface DashboardService {
|
||||
* @return
|
||||
*/
|
||||
Map history();
|
||||
|
||||
/**
|
||||
* 获取新增用户列表
|
||||
* @return
|
||||
*/
|
||||
List<UserInfoDTO> newUsers();
|
||||
|
||||
/**获取新增银行账号列表
|
||||
* @return
|
||||
*/
|
||||
List<BankAccountDTO> newBankAccounts();
|
||||
|
||||
/**
|
||||
* 获取新增文章列表
|
||||
* @return
|
||||
*/
|
||||
List<ArticleDTO> newArticles();
|
||||
}
|
||||
|
26
src/main/java/com/rymcu/forest/service/OpenDataService.java
Normal file
26
src/main/java/com/rymcu/forest/service/OpenDataService.java
Normal file
@ -0,0 +1,26 @@
|
||||
package com.rymcu.forest.service;
|
||||
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/14 13:51.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.service
|
||||
*/
|
||||
public interface OpenDataService {
|
||||
/**
|
||||
* 获取最近 30 天开放数据
|
||||
* @return
|
||||
*/
|
||||
Map lastThirtyDaysData();
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* @return
|
||||
*/
|
||||
Dashboard dashboard();
|
||||
}
|
@ -46,4 +46,12 @@ public interface TransactionRecordService extends Service<TransactionRecord> {
|
||||
* @throws Exception
|
||||
*/
|
||||
TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) throws Exception;
|
||||
|
||||
/**
|
||||
* 发放新手奖励
|
||||
* @param transactionRecord
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
TransactionRecord newbieRewards(TransactionRecord transactionRecord) throws Exception;
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
package com.rymcu.forest.service.impl;
|
||||
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.ArticleTagDTO;
|
||||
import com.rymcu.forest.dto.BankAccountDTO;
|
||||
import com.rymcu.forest.dto.UserInfoDTO;
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
import com.rymcu.forest.dto.admin.DashboardData;
|
||||
import com.rymcu.forest.mapper.ArticleMapper;
|
||||
import com.rymcu.forest.mapper.DashboardMapper;
|
||||
import com.rymcu.forest.service.DashboardService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -18,6 +23,8 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
|
||||
@Resource
|
||||
private DashboardMapper dashboardMapper;
|
||||
@Resource
|
||||
private ArticleMapper articleMapper;
|
||||
|
||||
@Override
|
||||
public Dashboard dashboard() {
|
||||
@ -33,21 +40,22 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
|
||||
@Override
|
||||
public Map lastThirtyDaysData() {
|
||||
Map map = new HashMap(4);
|
||||
Map map = new HashMap(5);
|
||||
ArrayList<String> dates = new ArrayList(30);
|
||||
ArrayList<Integer> articleData = new ArrayList(30);
|
||||
ArrayList<Integer> userData = new ArrayList(30);
|
||||
ArrayList<Integer> visitData = new ArrayList(30);
|
||||
ArrayList<Integer> visitIpData = new ArrayList(30);
|
||||
List<DashboardData> articles = dashboardMapper.selectLastThirtyDaysArticleData();
|
||||
List<DashboardData> users = dashboardMapper.selectLastThirtyDaysUserData();
|
||||
List<DashboardData> visits = dashboardMapper.selectLastThirtyDaysVisitData();
|
||||
List<DashboardData> visitIps = dashboardMapper.selectLastThirtyDaysVisitIpData();
|
||||
LocalDate now = LocalDate.now().plusDays(1);
|
||||
LocalDate localDate = LocalDate.now().plusDays(-29);
|
||||
while (now.isAfter(localDate)) {
|
||||
String date = localDate.toString();
|
||||
dates.add(date);
|
||||
|
||||
articles.forEach(article->{
|
||||
articles.forEach(article -> {
|
||||
if (date.equals(article.getLabel())) {
|
||||
articleData.add(article.getValue());
|
||||
return;
|
||||
@ -57,7 +65,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
articleData.add(0);
|
||||
}
|
||||
|
||||
users.forEach(user->{
|
||||
users.forEach(user -> {
|
||||
if (date.equals(user.getLabel())) {
|
||||
userData.add(user.getValue());
|
||||
return;
|
||||
@ -67,7 +75,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
userData.add(0);
|
||||
}
|
||||
|
||||
visits.forEach(visit->{
|
||||
visits.forEach(visit -> {
|
||||
if (date.equals(visit.getLabel())) {
|
||||
visitData.add(visit.getValue());
|
||||
return;
|
||||
@ -77,34 +85,47 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
visitData.add(0);
|
||||
}
|
||||
|
||||
visitIps.forEach(visitIp -> {
|
||||
if (date.equals(visitIp.getLabel())) {
|
||||
visitIpData.add(visitIp.getValue());
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (visitIpData.size() < dates.size()) {
|
||||
visitIpData.add(0);
|
||||
}
|
||||
|
||||
localDate = localDate.plusDays(1);
|
||||
}
|
||||
map.put("dates", dates);
|
||||
map.put("articles", articleData);
|
||||
map.put("users", userData);
|
||||
map.put("visits", visitData);
|
||||
map.put("visitIps", visitIpData);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map history() {
|
||||
Map map = new HashMap(4);
|
||||
Map<String, Object> map = new HashMap(5);
|
||||
ArrayList<String> dates = new ArrayList(30);
|
||||
ArrayList<Integer> articleData = new ArrayList(30);
|
||||
ArrayList<Integer> userData = new ArrayList(30);
|
||||
ArrayList<Integer> visitData = new ArrayList(30);
|
||||
ArrayList<Integer> visitIpData = new ArrayList(30);
|
||||
List<DashboardData> articles = dashboardMapper.selectHistoryArticleData();
|
||||
List<DashboardData> users = dashboardMapper.selectHistoryUserData();
|
||||
List<DashboardData> visits = dashboardMapper.selectHistoryVisitData();
|
||||
List<DashboardData> visitIps = dashboardMapper.selectHistoryVisitIpData();
|
||||
LocalDate now = LocalDate.now().plusMonths(1);
|
||||
LocalDate localDate = LocalDate.now().plusYears(-1).plusMonths(1);
|
||||
while (now.getYear() >= localDate.getYear()) {
|
||||
if (now.getYear() == localDate.getYear()) {
|
||||
if (now.getMonthValue() > localDate.getMonthValue()){
|
||||
if (now.getMonthValue() > localDate.getMonthValue()) {
|
||||
String date = localDate.getYear() + "-" + (localDate.getMonthValue() < 10 ? "0" + localDate.getMonthValue() : localDate.getMonthValue());
|
||||
dates.add(date);
|
||||
|
||||
articles.forEach(article->{
|
||||
articles.forEach(article -> {
|
||||
if (date.equals(article.getLabel())) {
|
||||
articleData.add(article.getValue());
|
||||
return;
|
||||
@ -114,7 +135,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
articleData.add(0);
|
||||
}
|
||||
|
||||
users.forEach(user->{
|
||||
users.forEach(user -> {
|
||||
if (date.equals(user.getLabel())) {
|
||||
userData.add(user.getValue());
|
||||
return;
|
||||
@ -124,7 +145,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
userData.add(0);
|
||||
}
|
||||
|
||||
visits.forEach(visit->{
|
||||
visits.forEach(visit -> {
|
||||
if (date.equals(visit.getLabel())) {
|
||||
visitData.add(visit.getValue());
|
||||
return;
|
||||
@ -133,12 +154,22 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
if (visitData.size() < dates.size()) {
|
||||
visitData.add(0);
|
||||
}
|
||||
|
||||
visitIps.forEach(visitIp -> {
|
||||
if (date.equals(visitIp.getLabel())) {
|
||||
visitIpData.add(visitIp.getValue());
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (visitIpData.size() < dates.size()) {
|
||||
visitIpData.add(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String date = localDate.getYear() + "-" + (localDate.getMonthValue() < 10 ? "0" + localDate.getMonthValue() : localDate.getMonthValue());
|
||||
dates.add(date);
|
||||
|
||||
articles.forEach(article->{
|
||||
articles.forEach(article -> {
|
||||
if (date.equals(article.getLabel())) {
|
||||
articleData.add(article.getValue());
|
||||
return;
|
||||
@ -148,7 +179,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
articleData.add(0);
|
||||
}
|
||||
|
||||
users.forEach(user->{
|
||||
users.forEach(user -> {
|
||||
if (date.equals(user.getLabel())) {
|
||||
userData.add(user.getValue());
|
||||
return;
|
||||
@ -158,7 +189,7 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
userData.add(0);
|
||||
}
|
||||
|
||||
visits.forEach(visit->{
|
||||
visits.forEach(visit -> {
|
||||
if (date.equals(visit.getLabel())) {
|
||||
visitData.add(visit.getValue());
|
||||
return;
|
||||
@ -167,6 +198,16 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
if (visitData.size() < dates.size()) {
|
||||
visitData.add(0);
|
||||
}
|
||||
|
||||
visitIps.forEach(visitIp -> {
|
||||
if (date.equals(visitIp.getLabel())) {
|
||||
visitIpData.add(visitIp.getValue());
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (visitIpData.size() < dates.size()) {
|
||||
visitIpData.add(0);
|
||||
}
|
||||
}
|
||||
|
||||
localDate = localDate.plusMonths(1);
|
||||
@ -175,6 +216,27 @@ public class DashboardServiceImpl implements DashboardService {
|
||||
map.put("articles", articleData);
|
||||
map.put("users", userData);
|
||||
map.put("visits", visitData);
|
||||
map.put("visitIps", visitIpData);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserInfoDTO> newUsers() {
|
||||
return dashboardMapper.selectNewUsers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BankAccountDTO> newBankAccounts() {
|
||||
return dashboardMapper.selectNewBankAccounts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArticleDTO> newArticles() {
|
||||
List<ArticleDTO> list = dashboardMapper.selectNewArticles();
|
||||
list.forEach(article -> {
|
||||
List<ArticleTagDTO> tags = articleMapper.selectTags(article.getIdArticle());
|
||||
article.setTags(tags);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
package com.rymcu.forest.service.impl;
|
||||
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
import com.rymcu.forest.dto.admin.DashboardData;
|
||||
import com.rymcu.forest.mapper.DashboardMapper;
|
||||
import com.rymcu.forest.service.OpenDataService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/14 13:51.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.service.impl
|
||||
*/
|
||||
@Service
|
||||
public class OpenDataServiceImpl implements OpenDataService {
|
||||
|
||||
@Resource
|
||||
private DashboardMapper dashboardMapper;
|
||||
|
||||
@Override
|
||||
public Map lastThirtyDaysData() {
|
||||
Map map = new HashMap(5);
|
||||
ArrayList<String> dates = new ArrayList(30);
|
||||
ArrayList<Integer> visitData = new ArrayList(30);
|
||||
ArrayList<Integer> visitIpData = new ArrayList(30);
|
||||
List<DashboardData> visits = dashboardMapper.selectLastThirtyDaysVisitData();
|
||||
List<DashboardData> visitIps = dashboardMapper.selectLastThirtyDaysVisitIpData();
|
||||
LocalDate now = LocalDate.now().plusDays(1);
|
||||
LocalDate localDate = LocalDate.now().plusDays(-29);
|
||||
while (now.isAfter(localDate)) {
|
||||
String date = localDate.toString();
|
||||
dates.add(date);
|
||||
|
||||
visits.forEach(visit -> {
|
||||
if (date.equals(visit.getLabel())) {
|
||||
visitData.add(visit.getValue());
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (visitData.size() < dates.size()) {
|
||||
visitData.add(0);
|
||||
}
|
||||
|
||||
visitIps.forEach(visitIp -> {
|
||||
if (date.equals(visitIp.getLabel())) {
|
||||
visitIpData.add(visitIp.getValue());
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (visitIpData.size() < dates.size()) {
|
||||
visitIpData.add(0);
|
||||
}
|
||||
|
||||
localDate = localDate.plusDays(1);
|
||||
}
|
||||
map.put("dates", dates);
|
||||
map.put("visits", visitData);
|
||||
map.put("visitIps", visitIpData);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dashboard dashboard() {
|
||||
Dashboard dashboard = new Dashboard();
|
||||
dashboard.setCountUserNum(dashboardMapper.selectUserCount());
|
||||
dashboard.setCountArticleNum(dashboardMapper.selectArticleCount());
|
||||
return dashboard;
|
||||
}
|
||||
}
|
@ -106,6 +106,20 @@ public class TransactionRecordServiceImpl extends AbstractService<TransactionRec
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransactionRecord newbieRewards(TransactionRecord transactionRecord) throws Exception {
|
||||
// 判断是否重复发放
|
||||
Boolean result = transactionRecordMapper.existsWithNewbieRewards(transactionRecord.getToBankAccount());
|
||||
if (result) {
|
||||
return transactionRecord;
|
||||
}
|
||||
BankAccount formBankAccount = bankAccountService.findSystemBankAccount();
|
||||
transactionRecord.setFormBankAccount(formBankAccount.getBankAccount());
|
||||
transactionRecord.setMoney(new BigDecimal(TransactionEnum.NewbieRewards.getMoney()));
|
||||
transactionRecord.setFunds(TransactionEnum.NewbieRewards.getDescription());
|
||||
return transfer(transactionRecord);
|
||||
}
|
||||
|
||||
private String nextTransactionNo() {
|
||||
String orderNo = "E";
|
||||
String key = "orderId";
|
||||
|
@ -45,18 +45,11 @@ public class WxUserServiceImpl extends AbstractService<WxUser> implements WxUser
|
||||
}
|
||||
|
||||
private WxUser copyWxUser(WxMpUser wxMpUser, WxUser wxUser) {
|
||||
wxUser.setNickname(wxMpUser.getNickname());
|
||||
wxUser.setHeadImgUrl(wxMpUser.getHeadImgUrl());
|
||||
wxUser.setCountry(wxMpUser.getCountry());
|
||||
wxUser.setProvince(wxMpUser.getProvince());
|
||||
wxUser.setCity(wxMpUser.getCity());
|
||||
wxUser.setSex(wxMpUser.getSex());
|
||||
wxUser.setSubscribe(wxMpUser.getSubscribe());
|
||||
wxUser.setSubscribeTime(wxMpUser.getSubscribeTime());
|
||||
wxUser.setUnionId(wxMpUser.getUnionId());
|
||||
wxUser.setOpenId(wxMpUser.getOpenId());
|
||||
wxUser.setLanguage(wxMpUser.getLanguage());
|
||||
wxUser.setSexDesc(wxMpUser.getSexDesc());
|
||||
return wxUser;
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,7 @@ public class UserUtils {
|
||||
if (user != null) {
|
||||
TokenUser tokenUser = new TokenUser();
|
||||
BeanCopierUtil.copy(user, tokenUser);
|
||||
tokenUser.setAccount(user.getEmail());
|
||||
tokenUser.setToken(token);
|
||||
tokenUser.setWeights(userMapper.selectRoleWeightsByUser(user.getIdUser()));
|
||||
return tokenUser;
|
||||
|
@ -1,14 +1,23 @@
|
||||
package com.rymcu.forest.web.api.admin;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rymcu.forest.core.result.GlobalResult;
|
||||
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.forest.dto.ArticleDTO;
|
||||
import com.rymcu.forest.dto.BankAccountDTO;
|
||||
import com.rymcu.forest.dto.UserInfoDTO;
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
import com.rymcu.forest.service.DashboardService;
|
||||
import com.rymcu.forest.util.Utils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -38,4 +47,43 @@ public class DashboardController {
|
||||
Map map = dashboardService.history();
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/new-users")
|
||||
public GlobalResult newUsers(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<UserInfoDTO> list = dashboardService.newUsers();
|
||||
PageInfo<UserInfoDTO> pageInfo = new PageInfo<>(list);
|
||||
Map<String, Object> map = new HashMap<String, Object>(2);
|
||||
map.put("users", pageInfo.getList());
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/new-bank-accounts")
|
||||
public GlobalResult newBankAccounts(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<BankAccountDTO> list = dashboardService.newBankAccounts();
|
||||
PageInfo<BankAccountDTO> pageInfo = new PageInfo(list);
|
||||
Map map = new HashMap(2);
|
||||
map.put("bankAccounts", pageInfo.getList());
|
||||
Map pagination = new HashMap(4);
|
||||
pagination.put("pageSize", pageInfo.getPageSize());
|
||||
pagination.put("total", pageInfo.getTotal());
|
||||
pagination.put("currentPage", pageInfo.getPageNum());
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/new-articles")
|
||||
public GlobalResult newArticles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = dashboardService.newArticles();
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo<>(list);
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("articles", pageInfo.getList());
|
||||
Map pagination = Utils.getPagination(pageInfo);
|
||||
map.put("pagination", pagination);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class ArticleController {
|
||||
}
|
||||
|
||||
@PostMapping("/update-tags")
|
||||
@AuthorshipInterceptor(moduleName = Module.ARTICLE)
|
||||
@AuthorshipInterceptor(moduleName = Module.ARTICLE_TAG)
|
||||
public GlobalResult updateTags(@RequestBody Article article) throws BaseApiException, UnsupportedEncodingException {
|
||||
Map map = articleService.updateTags(article.getIdArticle(), article.getArticleTags());
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
|
@ -27,4 +27,10 @@ public class TransactionRecordController {
|
||||
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||
}
|
||||
|
||||
@PostMapping("/newbie-rewards")
|
||||
public GlobalResult newbieRewards(@RequestBody TransactionRecord transactionRecord) throws Exception {
|
||||
transactionRecord = transactionRecordService.newbieRewards(transactionRecord);
|
||||
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ public class CommonApiController {
|
||||
map.put("message", GlobalResultMessage.SEND_SUCCESS.getMessage());
|
||||
User user = userService.findByAccount(email);
|
||||
if (user != null) {
|
||||
map.put("message","该邮箱已被注册!");
|
||||
map.put("message", "该邮箱已被注册!");
|
||||
} else {
|
||||
Integer result = javaMailService.sendEmailCode(email);
|
||||
if(result == 0){
|
||||
if (result == 0) {
|
||||
map.put("message", GlobalResultMessage.SEND_FAIL.getMessage());
|
||||
}
|
||||
}
|
||||
@ -61,35 +61,35 @@ public class CommonApiController {
|
||||
User user = userService.findByAccount(email);
|
||||
if (user != null) {
|
||||
Integer result = javaMailService.sendForgetPasswordEmail(email);
|
||||
if(result == 0){
|
||||
if (result == 0) {
|
||||
map.put("message", GlobalResultMessage.SEND_FAIL.getMessage());
|
||||
}
|
||||
} else {
|
||||
map.put("message","该邮箱未注册!");
|
||||
map.put("message", "该邮箱未注册!");
|
||||
}
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
public GlobalResult<Map> register(@RequestBody UserRegisterInfoDTO registerInfo){
|
||||
public GlobalResult<Map> register(@RequestBody UserRegisterInfoDTO registerInfo) {
|
||||
Map map = userService.register(registerInfo.getEmail(), registerInfo.getPassword(), registerInfo.getCode());
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@PostMapping("/login")
|
||||
public GlobalResult<Map> login(@RequestBody User user){
|
||||
public GlobalResult<Map> login(@RequestBody User user) {
|
||||
Map map = userService.login(user.getAccount(), user.getPassword());
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/heartbeat")
|
||||
public GlobalResult heartbeat(){
|
||||
public GlobalResult heartbeat() {
|
||||
return GlobalResultGenerator.genSuccessResult("heartbeat");
|
||||
}
|
||||
|
||||
@GetMapping("/articles")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map> articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, ArticleSearchDTO searchDTO){
|
||||
public GlobalResult<Map> articles(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "10") Integer rows, ArticleSearchDTO searchDTO) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findArticles(searchDTO);
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);
|
||||
@ -98,8 +98,7 @@ public class CommonApiController {
|
||||
}
|
||||
|
||||
@GetMapping("/announcements")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map> announcements(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "5") Integer rows){
|
||||
public GlobalResult<Map> announcements(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "5") Integer rows) {
|
||||
PageHelper.startPage(page, rows);
|
||||
List<ArticleDTO> list = articleService.findAnnouncements();
|
||||
PageInfo<ArticleDTO> pageInfo = new PageInfo(list);
|
||||
@ -109,29 +108,23 @@ public class CommonApiController {
|
||||
|
||||
@GetMapping("/article/{id}")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map<String, Object>> article(@PathVariable Integer id){
|
||||
ArticleDTO articleDTO = articleService.findArticleDTOById(id,1);
|
||||
public GlobalResult<Map<String, Object>> article(@PathVariable Integer id) {
|
||||
ArticleDTO articleDTO = articleService.findArticleDTOById(id, 1);
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put("article", articleDTO);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/token/{token}")
|
||||
public GlobalResult<TokenUser> token(@PathVariable String token){
|
||||
TokenUser tokenUser = UserUtils.getTokenUser(token);
|
||||
return GlobalResultGenerator.genSuccessResult(tokenUser);
|
||||
}
|
||||
|
||||
@PatchMapping("/forget-password")
|
||||
public GlobalResult<Map> forgetPassword(@RequestBody ForgetPasswordDTO forgetPassword){
|
||||
public GlobalResult<Map> forgetPassword(@RequestBody ForgetPasswordDTO forgetPassword) {
|
||||
Map map = userService.forgetPassword(forgetPassword.getCode(), forgetPassword.getPassword());
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
@GetMapping("/portfolio/{id}")
|
||||
@VisitLogger
|
||||
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id){
|
||||
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id,1);
|
||||
public GlobalResult<Map<String, Object>> portfolio(@PathVariable Integer id) {
|
||||
PortfolioDTO portfolioDTO = portfolioService.findPortfolioDTOById(id, 1);
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put("portfolio", portfolioDTO);
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
|
@ -128,7 +128,7 @@ public class UploadController {
|
||||
data.put("message", "上传失败!");
|
||||
return GlobalResultGenerator.genSuccessResult(data);
|
||||
}
|
||||
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
|
||||
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getBytes());
|
||||
String orgName = multipartFile.getOriginalFilename();
|
||||
String fileType = FileUtils.getExtend(orgName);
|
||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||
@ -190,8 +190,8 @@ public class UploadController {
|
||||
continue;
|
||||
}
|
||||
String fileType = FileUtils.getExtend(orgName);
|
||||
try (InputStream in = multipartFile.getInputStream()) {
|
||||
String md5 = DigestUtils.md5DigestAsHex(in);
|
||||
try {
|
||||
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getBytes());
|
||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||
if (StringUtils.isNotEmpty(fileUrl)) {
|
||||
successMap.put(orgName, fileUrl);
|
||||
@ -281,7 +281,7 @@ public class UploadController {
|
||||
return GlobalResultGenerator.genSuccessResult(data);
|
||||
}
|
||||
// 获取文件md5值
|
||||
String md5 = DigestUtils.md5DigestAsHex(inputStream);
|
||||
String md5 = DigestUtils.md5DigestAsHex(getData);
|
||||
String fileType = "." + MimeTypeUtils.parseMimeType(conn.getContentType()).getSubtype();
|
||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
package com.rymcu.forest.web.api.open;
|
||||
|
||||
import com.rymcu.forest.core.result.GlobalResult;
|
||||
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
||||
import com.rymcu.forest.dto.admin.Dashboard;
|
||||
import com.rymcu.forest.service.OpenDataService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/14 13:49.
|
||||
*
|
||||
* @author ronger
|
||||
* @email ronger-x@outlook.com
|
||||
* @packageName com.rymcu.forest.web.api.open
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/open-data")
|
||||
public class OpenDataController {
|
||||
|
||||
@Resource
|
||||
private OpenDataService openDataService;
|
||||
|
||||
@GetMapping("/dashboard")
|
||||
public GlobalResult dashboard() {
|
||||
Dashboard dashboard = openDataService.dashboard();
|
||||
return GlobalResultGenerator.genSuccessResult(dashboard);
|
||||
}
|
||||
|
||||
@GetMapping("/last-thirty-days")
|
||||
public GlobalResult LastThirtyDaysData() {
|
||||
Map map = openDataService.lastThirtyDaysData();
|
||||
return GlobalResultGenerator.genSuccessResult(map);
|
||||
}
|
||||
|
||||
}
|
@ -92,7 +92,7 @@ public class WxMaConfiguration {
|
||||
service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder()
|
||||
.templateId("此处更换为自己的模板id")
|
||||
.data(Lists.newArrayList(
|
||||
new WxMaSubscribeMessage.Data("keyword1", "339208499")))
|
||||
new WxMaSubscribeMessage.MsgData("keyword1", "339208499")))
|
||||
.toUser(wxMessage.getFromUser())
|
||||
.build());
|
||||
return null;
|
||||
|
@ -5,46 +5,155 @@
|
||||
<result column="label" property="label"></result>
|
||||
<result column="value" property="value"></result>
|
||||
</resultMap>
|
||||
<resultMap id="UserInfoResultMapper" type="com.rymcu.forest.dto.UserInfoDTO">
|
||||
<result column="id" property="idUser"/>
|
||||
<result column="account" property="account"/>
|
||||
<result column="nickname" property="nickname"/>
|
||||
<result column="sex" property="sex"/>
|
||||
<result column="avatar_type" property="avatarType"/>
|
||||
<result column="avatar_url" property="avatarUrl"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="phone" property="phone"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="last_login_time" property="lastLoginTime"/>
|
||||
<result column="last_online_time" property="lastOnlineTime"/>
|
||||
<result column="created_time" property="createdTime"/>
|
||||
<result column="signature" property="signature"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BankAccountResultMap" type="com.rymcu.forest.dto.BankAccountDTO">
|
||||
<result column="id" property="idBankAccount"></result>
|
||||
<result column="id_bank" property="idBank"></result>
|
||||
<result column="bank_name" property="bankName"></result>
|
||||
<result column="bank_account" property="bankAccount"></result>
|
||||
<result column="account_balance" property="accountBalance"></result>
|
||||
<result column="account_owner" property="accountOwner"></result>
|
||||
<result column="account_owner_name" property="accountOwnerName"></result>
|
||||
<result column="created_time" property="createdTime"></result>
|
||||
</resultMap>
|
||||
<resultMap id="ArticleResultMap" type="com.rymcu.forest.dto.ArticleDTO">
|
||||
<result column="id" property="idArticle"></result>
|
||||
<result column="article_title" property="articleTitle"></result>
|
||||
<result column="article_permalink" property="articlePermalink"></result>
|
||||
<result column="created_time" property="updatedTime"></result>
|
||||
<result column="article_perfect" property="articlePerfect"></result>
|
||||
<result column="article_status" property="articleStatus"></result>
|
||||
<result column="article_tags" property="articleTags"></result>
|
||||
</resultMap>
|
||||
<select id="selectUserCount" resultType="java.lang.Integer">
|
||||
select count(*) from forest_user
|
||||
select count(*)
|
||||
from forest_user
|
||||
</select>
|
||||
<select id="selectNewUserCount" resultType="java.lang.Integer">
|
||||
select count(*) from forest_user where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d')
|
||||
select count(*)
|
||||
from forest_user
|
||||
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
</select>
|
||||
<select id="selectArticleCount" resultType="java.lang.Integer">
|
||||
select count(*) from forest_article
|
||||
select count(*)
|
||||
from forest_article
|
||||
</select>
|
||||
<select id="selectNewArticleCount" resultType="java.lang.Integer">
|
||||
select count(*) from forest_article where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0
|
||||
select count(*)
|
||||
from forest_article
|
||||
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
and article_status = 0
|
||||
</select>
|
||||
<select id="selectCountViewNum" resultType="java.lang.Integer">
|
||||
select count(*) from forest_visit
|
||||
select count(*)
|
||||
from forest_visit
|
||||
</select>
|
||||
<select id="selectTodayViewNum" resultType="java.lang.Integer">
|
||||
select count(*) from forest_visit where created_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d')
|
||||
select count(*)
|
||||
from forest_visit
|
||||
where created_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
</select>
|
||||
<select id="selectLastThirtyDaysArticleData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_article
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0 GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||
from forest_article
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
and article_status = 0
|
||||
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
</select>
|
||||
<select id="selectLastThirtyDaysUserData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_user
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||
from forest_user
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
</select>
|
||||
<select id="selectLastThirtyDaysVisitData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_visit
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 30 day),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||
from forest_visit
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m-%d')
|
||||
</select>
|
||||
<select id="selectHistoryArticleData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_article
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') and article_status = 0 GROUP BY date_format(created_time, '%Y-%m')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||
from forest_article
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
and article_status = 0
|
||||
GROUP BY date_format(created_time, '%Y-%m')
|
||||
</select>
|
||||
<select id="selectHistoryUserData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_user
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||
from forest_user
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m')
|
||||
</select>
|
||||
<select id="selectHistoryVisitData" resultMap="DashboardDataResultMap">
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_visit
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(),interval + 1 year),'%Y-%m-%d'),'%Y-%m-%d') GROUP BY date_format(created_time, '%Y-%m')
|
||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||
from forest_visit
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m')
|
||||
</select>
|
||||
<select id="selectNewUsers" resultMap="UserInfoResultMapper">
|
||||
select id, nickname, avatar_url, account, created_time
|
||||
from forest_user
|
||||
where created_time > str_to_date(date_format(date_sub(sysdate(), interval + 7 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
order by created_time desc
|
||||
</select>
|
||||
<select id="selectNewBankAccounts" resultMap="BankAccountResultMap">
|
||||
select fu.nickname as account_owner_name, fba.bank_account, fba.account_balance
|
||||
from forest_bank_account fba
|
||||
join forest_user fu on fba.account_owner = fu.id
|
||||
where fba.created_time >
|
||||
str_to_date(date_format(date_sub(sysdate(), interval + 7 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
order by fba.created_time desc
|
||||
</select>
|
||||
<select id="selectNewArticles" resultMap="ArticleResultMap">
|
||||
select art.id,
|
||||
art.article_title,
|
||||
art.article_tags,
|
||||
art.article_permalink,
|
||||
art.article_perfect,
|
||||
art.article_status,
|
||||
art.created_time
|
||||
from forest_article art
|
||||
where article_status = 0
|
||||
and art.created_time >
|
||||
str_to_date(date_format(date_sub(sysdate(), interval + 7 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
order by art.created_time desc
|
||||
</select>
|
||||
<select id="selectLastThirtyDaysVisitIpData" resultMap="DashboardDataResultMap">
|
||||
select count(t.label) as value, t.label
|
||||
from (
|
||||
select distinct visit_ip as ip, date_format(created_time, '%Y-%m-%d') as label
|
||||
from forest_visit
|
||||
where created_time >
|
||||
str_to_date(date_format(date_sub(sysdate(), interval + 30 day), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m-%d'), visit_ip
|
||||
) t
|
||||
group by t.label
|
||||
</select>
|
||||
<select id="selectHistoryVisitIpData" resultMap="DashboardDataResultMap">
|
||||
select count(t.label) as value, t.label
|
||||
from (
|
||||
select distinct visit_ip as ip, date_format(created_time, '%Y-%m') as label
|
||||
from forest_visit
|
||||
where created_time >
|
||||
str_to_date(date_format(date_sub(sysdate(), interval + 1 year), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
GROUP BY date_format(created_time, '%Y-%m'), visit_ip
|
||||
) t
|
||||
group by t.label
|
||||
</select>
|
||||
</mapper>
|
@ -12,17 +12,32 @@
|
||||
<result column="transaction_time" property="transactionTime"></result>
|
||||
</resultMap>
|
||||
<update id="transfer">
|
||||
update forest_bank_account set account_balance = account_balance - #{money} where bank_account = #{formBankAccount};
|
||||
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
||||
update forest_bank_account
|
||||
set account_balance = account_balance - #{money}
|
||||
where bank_account = #{formBankAccount};
|
||||
update forest_bank_account
|
||||
set account_balance = account_balance + #{money}
|
||||
where bank_account = #{toBankAccount};
|
||||
</update>
|
||||
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
||||
select * from forest_transaction_record ftr
|
||||
select *
|
||||
from forest_transaction_record ftr
|
||||
where (form_bank_account = #{bankAccount} or to_bank_account = #{bankAccount})
|
||||
and transaction_time between str_to_date(#{startDate}, '%Y-%m-%d') and str_to_date(#{endDate}, '%Y-%m-%d') + interval 1 day
|
||||
and transaction_time between str_to_date(#{startDate}, '%Y-%m-%d') and str_to_date(#{endDate}, '%Y-%m-%d') + interval 1 day
|
||||
order by transaction_time desc
|
||||
</select>
|
||||
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
||||
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
||||
and funds = #{funds} and transaction_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') limit 1), true)
|
||||
select ifnull((select false
|
||||
from forest_transaction_record
|
||||
where to_bank_account = #{bankAccount}
|
||||
and funds = #{funds}
|
||||
and transaction_time > str_to_date(date_format(sysdate(), '%Y-%m-%d'), '%Y-%m-%d')
|
||||
limit 1), true)
|
||||
</select>
|
||||
<select id="existsWithNewbieRewards" resultType="java.lang.Boolean">
|
||||
select ifnull((select true
|
||||
from forest_transaction_record
|
||||
where to_bank_account = #{bankAccount} and funds = '新手奖励'
|
||||
limit 1), false)
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user