🐛 修复了一些已知问题
🐛 修复了一些已知问题
This commit is contained in:
commit
be772aed4c
34
pom.xml
34
pom.xml
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<lucene.version>8.0.0</lucene.version>
|
<lucene.version>8.11.1</lucene.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis.spring.boot</groupId>
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -101,7 +101,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
<version>1.2.78</version>
|
<version>1.2.79</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- shiro权限控制框架 -->
|
<!-- shiro权限控制框架 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -130,17 +130,17 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-text</artifactId>
|
<artifactId>commons-text</artifactId>
|
||||||
<version>1.8</version>
|
<version>1.9</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<version>1.14</version>
|
<version>1.15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
@ -197,12 +197,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jodd</groupId>
|
<groupId>org.jodd</groupId>
|
||||||
<artifactId>jodd-http</artifactId>
|
<artifactId>jodd-http</artifactId>
|
||||||
<version>6.0.6</version>
|
<version>6.2.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.binarywang</groupId>
|
<groupId>com.github.binarywang</groupId>
|
||||||
<artifactId>weixin-java-open</artifactId>
|
<artifactId>weixin-java-open</artifactId>
|
||||||
<version>4.0.0</version>
|
<version>4.2.5.B</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
@ -231,7 +231,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baidu.aip</groupId>
|
<groupId>com.baidu.aip</groupId>
|
||||||
<artifactId>java-sdk</artifactId>
|
<artifactId>java-sdk</artifactId>
|
||||||
<version>4.16.2</version>
|
<version>4.16.5</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@ -273,12 +273,24 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-core</artifactId>
|
<artifactId>hutool-core</artifactId>
|
||||||
<version>5.5.9</version>
|
<version>5.7.20</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-http</artifactId>
|
<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>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport {
|
|||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
|
registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**")
|
||||||
.excludePathPatterns("/api/v1/console/**", "/api/v1/article/articles/**", "/api/v1/article/detail/**"
|
.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.entity.Portfolio;
|
||||||
import com.rymcu.forest.enumerate.Module;
|
import com.rymcu.forest.enumerate.Module;
|
||||||
import com.rymcu.forest.jwt.def.JwtConstants;
|
import com.rymcu.forest.jwt.def.JwtConstants;
|
||||||
|
import com.rymcu.forest.mapper.UserMapper;
|
||||||
import com.rymcu.forest.service.ArticleService;
|
import com.rymcu.forest.service.ArticleService;
|
||||||
import com.rymcu.forest.service.PortfolioService;
|
import com.rymcu.forest.service.PortfolioService;
|
||||||
import com.rymcu.forest.util.UserUtils;
|
import com.rymcu.forest.util.UserUtils;
|
||||||
@ -52,6 +53,8 @@ public class AuthorshipAspect {
|
|||||||
private ArticleService articleService;
|
private ArticleService articleService;
|
||||||
@Resource
|
@Resource
|
||||||
private PortfolioService portfolioService;
|
private PortfolioService portfolioService;
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查用户修改信息权限
|
* 检查用户修改信息权限
|
||||||
@ -119,8 +122,15 @@ public class AuthorshipAspect {
|
|||||||
TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
|
TokenUser tokenUser = UserUtils.getTokenUser(authHeader);
|
||||||
if (Objects.nonNull(tokenUser)) {
|
if (Objects.nonNull(tokenUser)) {
|
||||||
if (!idAuthor.equals(tokenUser.getIdUser())) {
|
if (!idAuthor.equals(tokenUser.getIdUser())) {
|
||||||
|
boolean hasPermission = false;
|
||||||
|
if (Module.ARTICLE_TAG.equals(log.moduleName())) {
|
||||||
|
// 判断管理员权限
|
||||||
|
hasPermission = userMapper.hasAdminPermission(tokenUser.getAccount());
|
||||||
|
}
|
||||||
|
if (!hasPermission) {
|
||||||
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
throw new BaseApiException(ErrorCode.ACCESS_DENIED);
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,6 @@ package com.rymcu.forest.enumerate;
|
|||||||
*/
|
*/
|
||||||
public enum Module {
|
public enum Module {
|
||||||
ARTICLE,
|
ARTICLE,
|
||||||
PORTFOLIO;
|
PORTFOLIO,
|
||||||
|
ARTICLE_TAG;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,8 @@ import java.util.Arrays;
|
|||||||
public enum TransactionEnum {
|
public enum TransactionEnum {
|
||||||
ArticleSponsor("0", 20, "文章赞赏"),
|
ArticleSponsor("0", 20, "文章赞赏"),
|
||||||
Answer("1", 30, "答题奖励"),
|
Answer("1", 30, "答题奖励"),
|
||||||
CorrectAnswer("2", 50, "答题奖励");
|
CorrectAnswer("2", 50, "答题奖励"),
|
||||||
|
NewbieRewards("3", 200, "新手奖励");
|
||||||
|
|
||||||
private String dataType;
|
private String dataType;
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package com.rymcu.forest.mapper;
|
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 com.rymcu.forest.dto.admin.DashboardData;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -51,30 +54,62 @@ public interface DashboardMapper {
|
|||||||
List<DashboardData> selectLastThirtyDaysArticleData();
|
List<DashboardData> selectLastThirtyDaysArticleData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最近 30 天文章数据
|
* 获取最近 30 天用户数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectLastThirtyDaysUserData();
|
List<DashboardData> selectLastThirtyDaysUserData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最近 30 天文章数据
|
* 获取最近 30 天流量数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectLastThirtyDaysVisitData();
|
List<DashboardData> selectLastThirtyDaysVisitData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 获取历史 1 年文章数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryArticleData();
|
List<DashboardData> selectHistoryArticleData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取历史 1 年用户数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryUserData();
|
List<DashboardData> selectHistoryUserData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* 获取历史 1 年访问数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DashboardData> selectHistoryVisitData();
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean existsWithBankAccountAndFunds(@Param("bankAccount") String bankAccount, @Param("funds") String funds);
|
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;
|
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 com.rymcu.forest.dto.admin.Dashboard;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,4 +30,21 @@ public interface DashboardService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map history();
|
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
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
TransactionRecord bankTransfer(Integer idUser, TransactionEnum transactionType) 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;
|
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.Dashboard;
|
||||||
import com.rymcu.forest.dto.admin.DashboardData;
|
import com.rymcu.forest.dto.admin.DashboardData;
|
||||||
|
import com.rymcu.forest.mapper.ArticleMapper;
|
||||||
import com.rymcu.forest.mapper.DashboardMapper;
|
import com.rymcu.forest.mapper.DashboardMapper;
|
||||||
import com.rymcu.forest.service.DashboardService;
|
import com.rymcu.forest.service.DashboardService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -18,6 +23,8 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DashboardMapper dashboardMapper;
|
private DashboardMapper dashboardMapper;
|
||||||
|
@Resource
|
||||||
|
private ArticleMapper articleMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dashboard dashboard() {
|
public Dashboard dashboard() {
|
||||||
@ -33,20 +40,21 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map lastThirtyDaysData() {
|
public Map lastThirtyDaysData() {
|
||||||
Map map = new HashMap(4);
|
Map map = new HashMap(5);
|
||||||
ArrayList<String> dates = new ArrayList(30);
|
ArrayList<String> dates = new ArrayList(30);
|
||||||
ArrayList<Integer> articleData = new ArrayList(30);
|
ArrayList<Integer> articleData = new ArrayList(30);
|
||||||
ArrayList<Integer> userData = new ArrayList(30);
|
ArrayList<Integer> userData = new ArrayList(30);
|
||||||
ArrayList<Integer> visitData = new ArrayList(30);
|
ArrayList<Integer> visitData = new ArrayList(30);
|
||||||
|
ArrayList<Integer> visitIpData = new ArrayList(30);
|
||||||
List<DashboardData> articles = dashboardMapper.selectLastThirtyDaysArticleData();
|
List<DashboardData> articles = dashboardMapper.selectLastThirtyDaysArticleData();
|
||||||
List<DashboardData> users = dashboardMapper.selectLastThirtyDaysUserData();
|
List<DashboardData> users = dashboardMapper.selectLastThirtyDaysUserData();
|
||||||
List<DashboardData> visits = dashboardMapper.selectLastThirtyDaysVisitData();
|
List<DashboardData> visits = dashboardMapper.selectLastThirtyDaysVisitData();
|
||||||
|
List<DashboardData> visitIps = dashboardMapper.selectLastThirtyDaysVisitIpData();
|
||||||
LocalDate now = LocalDate.now().plusDays(1);
|
LocalDate now = LocalDate.now().plusDays(1);
|
||||||
LocalDate localDate = LocalDate.now().plusDays(-29);
|
LocalDate localDate = LocalDate.now().plusDays(-29);
|
||||||
while (now.isAfter(localDate)) {
|
while (now.isAfter(localDate)) {
|
||||||
String date = localDate.toString();
|
String date = localDate.toString();
|
||||||
dates.add(date);
|
dates.add(date);
|
||||||
|
|
||||||
articles.forEach(article -> {
|
articles.forEach(article -> {
|
||||||
if (date.equals(article.getLabel())) {
|
if (date.equals(article.getLabel())) {
|
||||||
articleData.add(article.getValue());
|
articleData.add(article.getValue());
|
||||||
@ -77,25 +85,38 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
visitData.add(0);
|
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);
|
localDate = localDate.plusDays(1);
|
||||||
}
|
}
|
||||||
map.put("dates", dates);
|
map.put("dates", dates);
|
||||||
map.put("articles", articleData);
|
map.put("articles", articleData);
|
||||||
map.put("users", userData);
|
map.put("users", userData);
|
||||||
map.put("visits", visitData);
|
map.put("visits", visitData);
|
||||||
|
map.put("visitIps", visitIpData);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map history() {
|
public Map history() {
|
||||||
Map map = new HashMap(4);
|
Map<String, Object> map = new HashMap(5);
|
||||||
ArrayList<String> dates = new ArrayList(30);
|
ArrayList<String> dates = new ArrayList(30);
|
||||||
ArrayList<Integer> articleData = new ArrayList(30);
|
ArrayList<Integer> articleData = new ArrayList(30);
|
||||||
ArrayList<Integer> userData = new ArrayList(30);
|
ArrayList<Integer> userData = new ArrayList(30);
|
||||||
ArrayList<Integer> visitData = new ArrayList(30);
|
ArrayList<Integer> visitData = new ArrayList(30);
|
||||||
|
ArrayList<Integer> visitIpData = new ArrayList(30);
|
||||||
List<DashboardData> articles = dashboardMapper.selectHistoryArticleData();
|
List<DashboardData> articles = dashboardMapper.selectHistoryArticleData();
|
||||||
List<DashboardData> users = dashboardMapper.selectHistoryUserData();
|
List<DashboardData> users = dashboardMapper.selectHistoryUserData();
|
||||||
List<DashboardData> visits = dashboardMapper.selectHistoryVisitData();
|
List<DashboardData> visits = dashboardMapper.selectHistoryVisitData();
|
||||||
|
List<DashboardData> visitIps = dashboardMapper.selectHistoryVisitIpData();
|
||||||
LocalDate now = LocalDate.now().plusMonths(1);
|
LocalDate now = LocalDate.now().plusMonths(1);
|
||||||
LocalDate localDate = LocalDate.now().plusYears(-1).plusMonths(1);
|
LocalDate localDate = LocalDate.now().plusYears(-1).plusMonths(1);
|
||||||
while (now.getYear() >= localDate.getYear()) {
|
while (now.getYear() >= localDate.getYear()) {
|
||||||
@ -133,6 +154,16 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
if (visitData.size() < dates.size()) {
|
if (visitData.size() < dates.size()) {
|
||||||
visitData.add(0);
|
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 {
|
} else {
|
||||||
String date = localDate.getYear() + "-" + (localDate.getMonthValue() < 10 ? "0" + localDate.getMonthValue() : localDate.getMonthValue());
|
String date = localDate.getYear() + "-" + (localDate.getMonthValue() < 10 ? "0" + localDate.getMonthValue() : localDate.getMonthValue());
|
||||||
@ -167,6 +198,16 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
if (visitData.size() < dates.size()) {
|
if (visitData.size() < dates.size()) {
|
||||||
visitData.add(0);
|
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);
|
localDate = localDate.plusMonths(1);
|
||||||
@ -175,6 +216,27 @@ public class DashboardServiceImpl implements DashboardService {
|
|||||||
map.put("articles", articleData);
|
map.put("articles", articleData);
|
||||||
map.put("users", userData);
|
map.put("users", userData);
|
||||||
map.put("visits", visitData);
|
map.put("visits", visitData);
|
||||||
|
map.put("visitIps", visitIpData);
|
||||||
return map;
|
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;
|
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() {
|
private String nextTransactionNo() {
|
||||||
String orderNo = "E";
|
String orderNo = "E";
|
||||||
String key = "orderId";
|
String key = "orderId";
|
||||||
|
@ -45,18 +45,11 @@ public class WxUserServiceImpl extends AbstractService<WxUser> implements WxUser
|
|||||||
}
|
}
|
||||||
|
|
||||||
private WxUser copyWxUser(WxMpUser wxMpUser, WxUser 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.setSubscribe(wxMpUser.getSubscribe());
|
||||||
wxUser.setSubscribeTime(wxMpUser.getSubscribeTime());
|
wxUser.setSubscribeTime(wxMpUser.getSubscribeTime());
|
||||||
wxUser.setUnionId(wxMpUser.getUnionId());
|
wxUser.setUnionId(wxMpUser.getUnionId());
|
||||||
wxUser.setOpenId(wxMpUser.getOpenId());
|
wxUser.setOpenId(wxMpUser.getOpenId());
|
||||||
wxUser.setLanguage(wxMpUser.getLanguage());
|
wxUser.setLanguage(wxMpUser.getLanguage());
|
||||||
wxUser.setSexDesc(wxMpUser.getSexDesc());
|
|
||||||
return wxUser;
|
return wxUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ public class UserUtils {
|
|||||||
if (user != null) {
|
if (user != null) {
|
||||||
TokenUser tokenUser = new TokenUser();
|
TokenUser tokenUser = new TokenUser();
|
||||||
BeanCopierUtil.copy(user, tokenUser);
|
BeanCopierUtil.copy(user, tokenUser);
|
||||||
|
tokenUser.setAccount(user.getEmail());
|
||||||
tokenUser.setToken(token);
|
tokenUser.setToken(token);
|
||||||
tokenUser.setWeights(userMapper.selectRoleWeightsByUser(user.getIdUser()));
|
tokenUser.setWeights(userMapper.selectRoleWeightsByUser(user.getIdUser()));
|
||||||
return tokenUser;
|
return tokenUser;
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
package com.rymcu.forest.web.api.admin;
|
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.GlobalResult;
|
||||||
import com.rymcu.forest.core.result.GlobalResultGenerator;
|
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.dto.admin.Dashboard;
|
||||||
import com.rymcu.forest.service.DashboardService;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,4 +47,43 @@ public class DashboardController {
|
|||||||
Map map = dashboardService.history();
|
Map map = dashboardService.history();
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
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")
|
@PostMapping("/update-tags")
|
||||||
@AuthorshipInterceptor(moduleName = Module.ARTICLE)
|
@AuthorshipInterceptor(moduleName = Module.ARTICLE_TAG)
|
||||||
public GlobalResult updateTags(@RequestBody Article article) throws BaseApiException, UnsupportedEncodingException {
|
public GlobalResult updateTags(@RequestBody Article article) throws BaseApiException, UnsupportedEncodingException {
|
||||||
Map map = articleService.updateTags(article.getIdArticle(), article.getArticleTags());
|
Map map = articleService.updateTags(article.getIdArticle(), article.getArticleTags());
|
||||||
return GlobalResultGenerator.genSuccessResult(map);
|
return GlobalResultGenerator.genSuccessResult(map);
|
||||||
|
@ -27,4 +27,10 @@ public class TransactionRecordController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/newbie-rewards")
|
||||||
|
public GlobalResult newbieRewards(@RequestBody TransactionRecord transactionRecord) throws Exception {
|
||||||
|
transactionRecord = transactionRecordService.newbieRewards(transactionRecord);
|
||||||
|
return GlobalResultGenerator.genSuccessResult(transactionRecord);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,6 @@ public class CommonApiController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/announcements")
|
@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);
|
PageHelper.startPage(page, rows);
|
||||||
List<ArticleDTO> list = articleService.findAnnouncements();
|
List<ArticleDTO> list = articleService.findAnnouncements();
|
||||||
@ -116,12 +115,6 @@ public class CommonApiController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(map);
|
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")
|
@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());
|
Map map = userService.forgetPassword(forgetPassword.getCode(), forgetPassword.getPassword());
|
||||||
|
@ -128,7 +128,7 @@ public class UploadController {
|
|||||||
data.put("message", "上传失败!");
|
data.put("message", "上传失败!");
|
||||||
return GlobalResultGenerator.genSuccessResult(data);
|
return GlobalResultGenerator.genSuccessResult(data);
|
||||||
}
|
}
|
||||||
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
|
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getBytes());
|
||||||
String orgName = multipartFile.getOriginalFilename();
|
String orgName = multipartFile.getOriginalFilename();
|
||||||
String fileType = FileUtils.getExtend(orgName);
|
String fileType = FileUtils.getExtend(orgName);
|
||||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||||
@ -190,8 +190,8 @@ public class UploadController {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String fileType = FileUtils.getExtend(orgName);
|
String fileType = FileUtils.getExtend(orgName);
|
||||||
try (InputStream in = multipartFile.getInputStream()) {
|
try {
|
||||||
String md5 = DigestUtils.md5DigestAsHex(in);
|
String md5 = DigestUtils.md5DigestAsHex(multipartFile.getBytes());
|
||||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
||||||
if (StringUtils.isNotEmpty(fileUrl)) {
|
if (StringUtils.isNotEmpty(fileUrl)) {
|
||||||
successMap.put(orgName, fileUrl);
|
successMap.put(orgName, fileUrl);
|
||||||
@ -281,7 +281,7 @@ public class UploadController {
|
|||||||
return GlobalResultGenerator.genSuccessResult(data);
|
return GlobalResultGenerator.genSuccessResult(data);
|
||||||
}
|
}
|
||||||
// 获取文件md5值
|
// 获取文件md5值
|
||||||
String md5 = DigestUtils.md5DigestAsHex(inputStream);
|
String md5 = DigestUtils.md5DigestAsHex(getData);
|
||||||
String fileType = "." + MimeTypeUtils.parseMimeType(conn.getContentType()).getSubtype();
|
String fileType = "." + MimeTypeUtils.parseMimeType(conn.getContentType()).getSubtype();
|
||||||
String fileUrl = forestFileService.getFileUrlByMd5(md5, tokenUser.getIdUser(), fileType);
|
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()
|
service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder()
|
||||||
.templateId("此处更换为自己的模板id")
|
.templateId("此处更换为自己的模板id")
|
||||||
.data(Lists.newArrayList(
|
.data(Lists.newArrayList(
|
||||||
new WxMaSubscribeMessage.Data("keyword1", "339208499")))
|
new WxMaSubscribeMessage.MsgData("keyword1", "339208499")))
|
||||||
.toUser(wxMessage.getFromUser())
|
.toUser(wxMessage.getFromUser())
|
||||||
.build());
|
.build());
|
||||||
return null;
|
return null;
|
||||||
|
@ -5,46 +5,155 @@
|
|||||||
<result column="label" property="label"></result>
|
<result column="label" property="label"></result>
|
||||||
<result column="value" property="value"></result>
|
<result column="value" property="value"></result>
|
||||||
</resultMap>
|
</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 id="selectUserCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_user
|
select count(*)
|
||||||
|
from forest_user
|
||||||
</select>
|
</select>
|
||||||
<select id="selectNewUserCount" resultType="java.lang.Integer">
|
<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>
|
||||||
<select id="selectArticleCount" resultType="java.lang.Integer">
|
<select id="selectArticleCount" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_article
|
select count(*)
|
||||||
|
from forest_article
|
||||||
</select>
|
</select>
|
||||||
<select id="selectNewArticleCount" resultType="java.lang.Integer">
|
<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>
|
||||||
<select id="selectCountViewNum" resultType="java.lang.Integer">
|
<select id="selectCountViewNum" resultType="java.lang.Integer">
|
||||||
select count(*) from forest_visit
|
select count(*)
|
||||||
|
from forest_visit
|
||||||
</select>
|
</select>
|
||||||
<select id="selectTodayViewNum" resultType="java.lang.Integer">
|
<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>
|
||||||
<select id="selectLastThirtyDaysArticleData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysArticleData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_article
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
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')
|
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>
|
||||||
<select id="selectLastThirtyDaysUserData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysUserData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_user
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
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')
|
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>
|
||||||
<select id="selectLastThirtyDaysVisitData" resultMap="DashboardDataResultMap">
|
<select id="selectLastThirtyDaysVisitData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label from forest_visit
|
select COUNT(*) as value, date_format(created_time, '%Y-%m-%d') as label
|
||||||
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')
|
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>
|
||||||
<select id="selectHistoryArticleData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryArticleData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_article
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
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')
|
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>
|
||||||
<select id="selectHistoryUserData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryUserData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_user
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
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')
|
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>
|
||||||
<select id="selectHistoryVisitData" resultMap="DashboardDataResultMap">
|
<select id="selectHistoryVisitData" resultMap="DashboardDataResultMap">
|
||||||
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label from forest_visit
|
select COUNT(*) as value, date_format(created_time, '%Y-%m') as label
|
||||||
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')
|
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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -12,17 +12,32 @@
|
|||||||
<result column="transaction_time" property="transactionTime"></result>
|
<result column="transaction_time" property="transactionTime"></result>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<update id="transfer">
|
<update id="transfer">
|
||||||
update forest_bank_account set account_balance = account_balance - #{money} where bank_account = #{formBankAccount};
|
update forest_bank_account
|
||||||
update forest_bank_account set account_balance = account_balance + #{money} where bank_account = #{toBankAccount};
|
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>
|
</update>
|
||||||
<select id="selectTransactionRecords" resultMap="DTOResultMap">
|
<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})
|
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
|
order by transaction_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
<select id="existsWithBankAccountAndFunds" resultType="java.lang.Boolean">
|
||||||
select ifnull((select false from forest_transaction_record where to_bank_account = #{bankAccount}
|
select ifnull((select false
|
||||||
and funds = #{funds} and transaction_time > str_to_date(date_format(sysdate(),'%Y-%m-%d'),'%Y-%m-%d') limit 1), true)
|
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>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user