提交
This commit is contained in:
79
ruoyi-extend/ruoyi-business/pom.xml
Normal file
79
ruoyi-extend/ruoyi-business/pom.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-extend</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>ruoyi-business</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.belerweb</groupId>
|
||||
<artifactId>pinyin4j</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-admin-core</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-custom</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-post</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(RuoYiApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 后台系统启动成功 ლ(´ڡ`ლ)゙");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public class RuoYiServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(RuoYiApplication.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.ruoyi.dataanalysis.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.dataanalysis.model.param.CustomerChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.OrderSortParam;
|
||||
import com.ruoyi.dataanalysis.model.param.SaleChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.StoreChartsParam;
|
||||
import com.ruoyi.dataanalysis.service.DataAnalysisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* 后台——数据分析
|
||||
*
|
||||
* @author: liwenlong
|
||||
* @date: 2023-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dataAnalysis")
|
||||
public class DataAnalysisController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private DataAnalysisService dataAnalysisService;
|
||||
|
||||
private void customerFillParam(CustomerChartsParam customerChartsParam){
|
||||
//如果sort没有值,去除
|
||||
Iterator<OrderSortParam> iterator = customerChartsParam.getOrderSortParamList().iterator();
|
||||
while (iterator.hasNext()){
|
||||
OrderSortParam next = iterator.next();
|
||||
if(StringUtils.isBlank(next.getSort())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (customerChartsParam.getOrderSortParamList() == null || customerChartsParam.getOrderSortParamList().size() == 0) {
|
||||
customerChartsParam.setOrderSortParamList(new ArrayList<>());
|
||||
OrderSortParam orderSortParam = new OrderSortParam();
|
||||
orderSortParam.setColumn("payAmount");
|
||||
orderSortParam.setSort("desc");
|
||||
customerChartsParam.getOrderSortParamList().add(orderSortParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设计师排行榜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/customerCharts")
|
||||
public TableDataInfo customerCharts(@RequestBody CustomerChartsParam customerChartsParam) {
|
||||
startPage();
|
||||
customerFillParam(customerChartsParam);
|
||||
return getDataTable(dataAnalysisService.customerCharts(customerChartsParam));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设计师排行榜统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/customerChartsStatistics")
|
||||
public AjaxResult customerChartsStatistics(@RequestBody CustomerChartsParam customerChartsParam) {
|
||||
customerFillParam(customerChartsParam);
|
||||
return AjaxResult.success(dataAnalysisService.customerChartsStatistics(customerChartsParam));
|
||||
}
|
||||
|
||||
private void storeFillParam(StoreChartsParam storeChartsParam){
|
||||
//如果sort没有值,去除
|
||||
Iterator<OrderSortParam> iterator = storeChartsParam.getOrderSortParamList().iterator();
|
||||
while (iterator.hasNext()){
|
||||
OrderSortParam next = iterator.next();
|
||||
if(StringUtils.isBlank(next.getSort())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (storeChartsParam.getOrderSortParamList() == null || storeChartsParam.getOrderSortParamList().size() == 0) {
|
||||
storeChartsParam.setOrderSortParamList(new ArrayList<>());
|
||||
OrderSortParam orderSortParam = new OrderSortParam();
|
||||
orderSortParam.setColumn("hasReceivedAmount");
|
||||
orderSortParam.setSort("desc");
|
||||
storeChartsParam.getOrderSortParamList().add(orderSortParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 表现师师排行榜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/storeCharts")
|
||||
public TableDataInfo storeCharts(@RequestBody StoreChartsParam storeChartsParam) {
|
||||
startPage();
|
||||
storeFillParam(storeChartsParam);
|
||||
|
||||
return getDataTable(dataAnalysisService.storeCharts(storeChartsParam));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 表现师师排行榜统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/storeChartsStatistics")
|
||||
public AjaxResult storeChartsStatistics(@RequestBody StoreChartsParam storeChartsParam) {
|
||||
storeFillParam(storeChartsParam);
|
||||
return AjaxResult.success(dataAnalysisService.storeChartsStatistics(storeChartsParam));
|
||||
}
|
||||
|
||||
private void saleFillParam(SaleChartsParam saleChartsParam){
|
||||
//如果sort没有值,去除
|
||||
Iterator<OrderSortParam> iterator = saleChartsParam.getOrderSortParamList().iterator();
|
||||
while (iterator.hasNext()){
|
||||
OrderSortParam next = iterator.next();
|
||||
if(StringUtils.isBlank(next.getSort())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
if (saleChartsParam.getOrderSortParamList() == null || saleChartsParam.getOrderSortParamList().size() == 0) {
|
||||
saleChartsParam.setOrderSortParamList(new ArrayList<>());
|
||||
OrderSortParam orderSortParam = new OrderSortParam();
|
||||
orderSortParam.setColumn("commission");
|
||||
orderSortParam.setSort("desc");
|
||||
saleChartsParam.getOrderSortParamList().add(orderSortParam);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员排行榜
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saleCharts")
|
||||
public TableDataInfo saleCharts(@RequestBody SaleChartsParam saleChartsParam) {
|
||||
startPage();
|
||||
saleFillParam(saleChartsParam);
|
||||
|
||||
return getDataTable(dataAnalysisService.saleCharts(saleChartsParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员排行榜统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/saleChartsStatistics")
|
||||
public AjaxResult saleChartsStatistics(@RequestBody SaleChartsParam saleChartsParam) {
|
||||
saleFillParam(saleChartsParam);
|
||||
return AjaxResult.success(dataAnalysisService.saleChartsStatistics(saleChartsParam));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ruoyi.dataanalysis.mapper;
|
||||
|
||||
import com.ruoyi.dataanalysis.model.param.CustomerChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.SaleChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.StoreChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.result.CustomerChartsResult;
|
||||
import com.ruoyi.dataanalysis.model.result.SaleChartsResult;
|
||||
import com.ruoyi.dataanalysis.model.result.StoreChartsResult;
|
||||
import com.ruoyi.homepage.model.param.ChartReq;
|
||||
import com.ruoyi.homepage.model.result.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 后台数据统计 Mapper 接口
|
||||
*
|
||||
* @author 李文龙
|
||||
* @date 2022/01/13 14:19
|
||||
*/
|
||||
@Repository
|
||||
public interface DataAnalysisMapper {
|
||||
|
||||
List<CustomerChartsResult> customerCharts(@Param("param") CustomerChartsParam customerChartsParam);
|
||||
|
||||
List<StoreChartsResult> storeCharts(@Param("param")StoreChartsParam storeChartsParam);
|
||||
|
||||
List<SaleChartsResult> saleCharts(@Param("param")SaleChartsParam saleChartsParam);
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ruoyi.dataanalysis.mapper.DataAnalysisMapper">
|
||||
|
||||
<select id="customerCharts" resultType="com.ruoyi.dataanalysis.model.result.CustomerChartsResult">
|
||||
SELECT
|
||||
t.id,
|
||||
t.nickname,
|
||||
t.`name`,
|
||||
t.mobile,
|
||||
t.account,
|
||||
t.create_time,
|
||||
(
|
||||
SELECT
|
||||
IFNULL(sum(o.amount), 0)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.customer_id = t.id
|
||||
AND o.first_status = 2
|
||||
) orderAmount,
|
||||
(
|
||||
SELECT
|
||||
IFNULL(
|
||||
sum(
|
||||
CASE
|
||||
WHEN o.`status` = 4 THEN
|
||||
o.amount
|
||||
ELSE
|
||||
o.first_price
|
||||
END
|
||||
),
|
||||
0
|
||||
)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.customer_id = t.id
|
||||
AND o.first_status = 2
|
||||
) payAmount,
|
||||
(
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.customer_id = t.id
|
||||
AND o.first_status = 2
|
||||
) orderNum
|
||||
FROM
|
||||
t_customer t
|
||||
WHERE t.del_flag = 1
|
||||
<if test="param!=null and param.beginTime != null ">
|
||||
and t.create_time >= #{param.beginTime}
|
||||
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null ">
|
||||
and t.create_time < #{param.endTime}
|
||||
</if>
|
||||
<if test="param!=null and param.nickname != null and param.nickname != ''">
|
||||
and t.nickname like concat('%', #{param.nickname}, '%')
|
||||
</if>
|
||||
<if test="param!=null and param.name != null and param.name != ''">
|
||||
and t.name like concat('%', #{param.name}, '%')
|
||||
</if>
|
||||
ORDER BY
|
||||
<foreach item="orderSort" collection="param.orderSortParamList" open=" " separator="," close=" ">
|
||||
${orderSort.column} ${orderSort.sort}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="storeCharts" resultType="com.ruoyi.dataanalysis.model.result.StoreChartsResult">
|
||||
SELECT
|
||||
t.id,
|
||||
t.nickname,
|
||||
t.`name`,
|
||||
t.mobile,
|
||||
t.account,
|
||||
t.create_time,
|
||||
t.star,
|
||||
(
|
||||
SELECT
|
||||
a.id
|
||||
FROM
|
||||
t_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.result = 2
|
||||
AND a.type = 1
|
||||
AND a.del_flag = 1
|
||||
) id2,
|
||||
CONCAT(
|
||||
ifnull(
|
||||
(
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
t_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.result = 2
|
||||
AND a.type = 1
|
||||
AND a.del_flag = 1
|
||||
),
|
||||
''
|
||||
),
|
||||
ifnull(
|
||||
(
|
||||
SELECT
|
||||
2
|
||||
FROM
|
||||
t_highend_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.`status` > 3
|
||||
AND a.del_flag = 1
|
||||
),
|
||||
''
|
||||
),
|
||||
ifnull(
|
||||
(
|
||||
SELECT
|
||||
3
|
||||
FROM
|
||||
t_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.result = 2
|
||||
AND a.type = 3
|
||||
AND a.del_flag = 1
|
||||
),
|
||||
''
|
||||
)
|
||||
) authType,
|
||||
(
|
||||
SELECT
|
||||
IFNULL(sum(o.amount), 0)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.store_id = t.id
|
||||
AND o.`status` = 4
|
||||
) orderAmount,
|
||||
(
|
||||
SELECT
|
||||
IFNULL(sum(o.amount), 0)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.store_id = t.id
|
||||
AND o. STATUS = 4
|
||||
) hasReceivedAmount,
|
||||
(
|
||||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
t_order o
|
||||
WHERE
|
||||
o.store_id = t.id
|
||||
AND o.first_status = 2
|
||||
) orderNum
|
||||
FROM
|
||||
t_store t
|
||||
WHERE t.del_flag = 1
|
||||
<if test="param!=null and param.beginTime != null ">
|
||||
and t.create_time >= #{param.beginTime}
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null ">
|
||||
and t.create_time < #{param.endTime}
|
||||
</if>
|
||||
<if test="param!=null and param.nickname != null and param.nickname != ''">
|
||||
and t.nickname like concat('%', #{param.nickname}, '%')
|
||||
</if>
|
||||
<if test="param!=null and param.name != null and param.name != ''">
|
||||
and t.name like concat('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param!=null and param.authTypeList != null and param.authTypeList.size()>0">
|
||||
AND(
|
||||
<foreach item="authSin" collection="param.authTypeList" open=" " separator="OR" close=" ">
|
||||
<if test="authSin ==1">
|
||||
EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
t_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.result = 2
|
||||
AND a.type = 1
|
||||
AND a.del_flag = 1
|
||||
)
|
||||
</if>
|
||||
<if test="authSin ==2">
|
||||
EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
t_highend_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.`status` > 3
|
||||
AND a.del_flag = 1
|
||||
)
|
||||
</if>
|
||||
<if test="authSin ==3">
|
||||
EXISTS (
|
||||
SELECT
|
||||
1
|
||||
FROM
|
||||
t_auth a
|
||||
WHERE
|
||||
a.store_id = t.id
|
||||
AND a.result = 2
|
||||
AND a.type = 3
|
||||
AND a.del_flag = 1
|
||||
)
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
ORDER BY
|
||||
<foreach item="orderSort" collection="param.orderSortParamList" open=" " separator="," close=" ">
|
||||
${orderSort.column} ${orderSort.sort}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="saleCharts" resultType="com.ruoyi.dataanalysis.model.result.SaleChartsResult">
|
||||
SELECT
|
||||
t.id,
|
||||
t.nickname,
|
||||
t.mobile,
|
||||
t.create_time,
|
||||
t.income commission,
|
||||
t.invite_num customerNum
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE t.del_flag = 1
|
||||
<if test="param!=null and param.beginTime != null ">
|
||||
and t.create_time >= #{param.beginTime}
|
||||
</if>
|
||||
<if test="param!=null and param.endTime != null ">
|
||||
and t.create_time < #{param.endTime}
|
||||
</if>
|
||||
<if test="param!=null and param.nickname != null and param.nickname != ''">
|
||||
and t.nickname like concat('%', #{param.nickname}, '%')
|
||||
</if>
|
||||
ORDER BY
|
||||
<foreach item="orderSort" collection="param.orderSortParamList" open=" " separator="," close=" ">
|
||||
${orderSort.column} ${orderSort.sort}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.ruoyi.dataanalysis.model.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CustomerChartsParam {
|
||||
|
||||
//筛选字段-开始
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@TableField(exist = false)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
@TableField(exist = false)
|
||||
private Date endTime;
|
||||
//筛选字段-结束
|
||||
|
||||
//排序字段-开始
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private List<OrderSortParam> orderSortParamList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.dataanalysis.model.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderSortParam {
|
||||
|
||||
/**
|
||||
* orderAmount:订单金额
|
||||
* payAmount:付款金额
|
||||
* orderNum:订单数量
|
||||
* hasReceivedAmount:已到账金额
|
||||
* star:评分
|
||||
* customerNum:客户数量
|
||||
* commission:佣金
|
||||
*/
|
||||
private String column;
|
||||
|
||||
//asc 正序 desc 倒序
|
||||
private String sort;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.ruoyi.dataanalysis.model.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SaleChartsParam {
|
||||
|
||||
//筛选字段-开始
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@TableField(exist = false)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
@TableField(exist = false)
|
||||
private Date endTime;
|
||||
//筛选字段-结束
|
||||
|
||||
//排序字段-开始
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private List<OrderSortParam> orderSortParamList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.ruoyi.dataanalysis.model.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StoreChartsParam {
|
||||
|
||||
//筛选字段-开始
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "认证类型 1普通 2 高端 3 酷家乐,多选的话逗号分隔")
|
||||
private String authType;
|
||||
|
||||
private List<String> authTypeList;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
@TableField(exist = false)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
@TableField(exist = false)
|
||||
private Date endTime;
|
||||
//筛选字段-结束
|
||||
|
||||
//排序字段-开始
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private List<OrderSortParam> orderSortParamList;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CustomerChartsResult {
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@ApiModelProperty(value = "付款金额")
|
||||
private BigDecimal payAmount;
|
||||
|
||||
@ApiModelProperty(value = "单数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class CustomerChartsStatisticsResult {
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@ApiModelProperty(value = "单数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "付款金额")
|
||||
private BigDecimal payAmount;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SaleChartsResult {
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "佣金")
|
||||
private BigDecimal commission;
|
||||
|
||||
@ApiModelProperty(value = "客户数量")
|
||||
private Integer customerNum;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SaleChartsStatisticsResult {
|
||||
|
||||
@ApiModelProperty(value = "佣金")
|
||||
private BigDecimal commission;
|
||||
|
||||
@ApiModelProperty(value = "客户数")
|
||||
private Integer customerNum;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class StoreChartsResult {
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "昵称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "认证类型 1普通 2 高端 3 酷家乐,多选的话逗号分隔")
|
||||
private String authType;
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@ApiModelProperty(value = "已到款金额")
|
||||
private BigDecimal hasReceivedAmount;
|
||||
|
||||
@ApiModelProperty(value = "单数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "评分")
|
||||
private String star;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.ruoyi.dataanalysis.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class StoreChartsStatisticsResult {
|
||||
|
||||
@ApiModelProperty(value = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
@ApiModelProperty(value = "单数")
|
||||
private Integer orderNum;
|
||||
|
||||
@ApiModelProperty(value = "付款金额")
|
||||
private BigDecimal payAmount;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.ruoyi.dataanalysis.service;
|
||||
|
||||
|
||||
import com.ruoyi.dataanalysis.model.param.CustomerChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.SaleChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.StoreChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.result.CustomerChartsResult;
|
||||
import com.ruoyi.dataanalysis.model.result.CustomerChartsStatisticsResult;
|
||||
import com.ruoyi.dataanalysis.model.result.SaleChartsResult;
|
||||
import com.ruoyi.dataanalysis.model.result.StoreChartsResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页数据统计
|
||||
*
|
||||
* @author liwenlong
|
||||
* @date 2023-02-13
|
||||
*/
|
||||
public interface DataAnalysisService {
|
||||
|
||||
|
||||
List<CustomerChartsResult> customerCharts(CustomerChartsParam customerChartsParam);
|
||||
|
||||
List<StoreChartsResult> storeCharts(StoreChartsParam storeChartsParam);
|
||||
|
||||
List<SaleChartsResult> saleCharts(SaleChartsParam saleChartsParam);
|
||||
|
||||
CustomerChartsStatisticsResult customerChartsStatistics(CustomerChartsParam customerChartsParam);
|
||||
|
||||
Object storeChartsStatistics(StoreChartsParam storeChartsParam);
|
||||
|
||||
Object saleChartsStatistics(SaleChartsParam saleChartsParam);
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.ruoyi.dataanalysis.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.ruoyi.dataanalysis.mapper.DataAnalysisMapper;
|
||||
import com.ruoyi.dataanalysis.model.param.CustomerChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.SaleChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.param.StoreChartsParam;
|
||||
import com.ruoyi.dataanalysis.model.result.*;
|
||||
import com.ruoyi.dataanalysis.service.DataAnalysisService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 首页数据统计
|
||||
*
|
||||
* @author liwenlong
|
||||
* @date 2023-02-13
|
||||
*/
|
||||
@Service
|
||||
public class DataAnalysisServiceImpl implements DataAnalysisService {
|
||||
|
||||
@Autowired
|
||||
private DataAnalysisMapper dataAnalysisMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CustomerChartsResult> customerCharts(CustomerChartsParam customerChartsParam) {
|
||||
|
||||
List<CustomerChartsResult> customerChartsResultList = customerChartsResultList(customerChartsParam);
|
||||
return customerChartsResultList;
|
||||
}
|
||||
|
||||
private List<CustomerChartsResult> customerChartsResultList(CustomerChartsParam customerChartsParam) {
|
||||
List<CustomerChartsResult> customerChartsResultList = dataAnalysisMapper.customerCharts(customerChartsParam);
|
||||
return customerChartsResultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomerChartsStatisticsResult customerChartsStatistics(CustomerChartsParam customerChartsParam) {
|
||||
List<CustomerChartsResult> customerChartsResultList = customerChartsResultList(customerChartsParam);
|
||||
|
||||
BigDecimal orderAmount = BigDecimal.ZERO;
|
||||
BigDecimal payAmount = BigDecimal.ZERO;
|
||||
Integer orderNum = 0;
|
||||
CustomerChartsStatisticsResult customerChartsStatisticsResult = new CustomerChartsStatisticsResult();
|
||||
for (CustomerChartsResult result : customerChartsResultList) {
|
||||
orderAmount = orderAmount.add(result.getOrderAmount());
|
||||
payAmount = payAmount.add(result.getPayAmount());
|
||||
orderNum = orderNum + result.getOrderNum();
|
||||
}
|
||||
|
||||
customerChartsStatisticsResult.setOrderAmount(orderAmount);
|
||||
customerChartsStatisticsResult.setPayAmount(payAmount);
|
||||
customerChartsStatisticsResult.setOrderNum(orderNum);
|
||||
|
||||
return customerChartsStatisticsResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoreChartsResult> storeCharts(StoreChartsParam storeChartsParam) {
|
||||
List<StoreChartsResult> storeChartsResultList = storeChartsResultList(storeChartsParam);
|
||||
return storeChartsResultList;
|
||||
}
|
||||
|
||||
private List<StoreChartsResult> storeChartsResultList(StoreChartsParam storeChartsParam) {
|
||||
if (storeChartsParam != null && StrUtil.isNotBlank(storeChartsParam.getAuthType())) {
|
||||
storeChartsParam.setAuthTypeList(new ArrayList<>());
|
||||
String[] split = storeChartsParam.getAuthType().split(",");
|
||||
for (String cur : split) {
|
||||
storeChartsParam.getAuthTypeList().add(cur);
|
||||
}
|
||||
}
|
||||
List<StoreChartsResult> storeChartsResultList = dataAnalysisMapper.storeCharts(storeChartsParam);
|
||||
return storeChartsResultList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object storeChartsStatistics(StoreChartsParam storeChartsParam) {
|
||||
List<StoreChartsResult> storeChartsResultList = storeChartsResultList(storeChartsParam);
|
||||
|
||||
BigDecimal orderAmount = BigDecimal.ZERO;
|
||||
BigDecimal payAmount = BigDecimal.ZERO;
|
||||
Integer orderNum = 0;
|
||||
StoreChartsStatisticsResult storeChartsStatisticsResult = new StoreChartsStatisticsResult();
|
||||
for (StoreChartsResult result : storeChartsResultList) {
|
||||
orderAmount = orderAmount.add(result.getOrderAmount());
|
||||
payAmount = payAmount.add(result.getHasReceivedAmount());
|
||||
orderNum = orderNum + result.getOrderNum();
|
||||
}
|
||||
|
||||
storeChartsStatisticsResult.setOrderAmount(orderAmount);
|
||||
storeChartsStatisticsResult.setPayAmount(payAmount);
|
||||
storeChartsStatisticsResult.setOrderNum(orderNum);
|
||||
|
||||
return storeChartsStatisticsResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SaleChartsResult> saleCharts(SaleChartsParam saleChartsParam) {
|
||||
List<SaleChartsResult> saleChartsResultList = saleChartsResultList(saleChartsParam);
|
||||
return saleChartsResultList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Object saleChartsStatistics(SaleChartsParam saleChartsParam) {
|
||||
List<SaleChartsResult> saleChartsResultList = saleChartsResultList(saleChartsParam);
|
||||
|
||||
BigDecimal commission = BigDecimal.ZERO;
|
||||
Integer customerNum = 0;
|
||||
SaleChartsStatisticsResult saleChartsStatisticsResult = new SaleChartsStatisticsResult();
|
||||
for (SaleChartsResult result : saleChartsResultList) {
|
||||
commission = commission.add(result.getCommission());
|
||||
customerNum = customerNum + result.getCustomerNum();
|
||||
}
|
||||
|
||||
saleChartsStatisticsResult.setCustomerNum(customerNum);
|
||||
saleChartsStatisticsResult.setCommission(commission);
|
||||
|
||||
return saleChartsStatisticsResult;
|
||||
}
|
||||
|
||||
private List<SaleChartsResult> saleChartsResultList(SaleChartsParam saleChartsParam) {
|
||||
List<SaleChartsResult> saleChartsResultList = dataAnalysisMapper.saleCharts(saleChartsParam);
|
||||
return saleChartsResultList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.ruoyi.homepage.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.homepage.model.param.ChartReq;
|
||||
import com.ruoyi.homepage.model.param.RankingListReq;
|
||||
import com.ruoyi.homepage.model.result.ChartResult;
|
||||
import com.ruoyi.homepage.model.result.RankingResult;
|
||||
import com.ruoyi.homepage.model.result.StatisticsResult;
|
||||
import com.ruoyi.homepage.service.HomePageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 后台——首页数据统计
|
||||
*
|
||||
* @author: liwenlong
|
||||
* @date: 2023-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/homePage")
|
||||
public class HomePageController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private HomePageService homePageService;
|
||||
|
||||
/**
|
||||
* 后台首页统计
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/statistics")
|
||||
public AjaxResult<StatisticsResult> statistics() {
|
||||
return homePageService.statistics();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单金额统计
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/orderAmountChart")
|
||||
public AjaxResult<ChartResult> orderAmountChart(@RequestBody ChartReq req) {
|
||||
return homePageService.orderAmountChart(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单金额统计2
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/orderAmountChartNear")
|
||||
public AjaxResult<ChartResult> orderAmountChartNear(@RequestBody ChartReq req) {
|
||||
return homePageService.orderAmountChartNear(req);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分类占比统计
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/classificationProportion")
|
||||
public AjaxResult classificationProportion(@RequestBody ChartReq req) {
|
||||
return homePageService.classificationProportion(req);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新老客户数量占比
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/newOldCustomers")
|
||||
public AjaxResult newOldCustomers(@RequestBody ChartReq req) {
|
||||
return homePageService.newOldCustomers(req);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消费排行榜
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/rankingList")
|
||||
public AjaxResult<RankingResult> rankingList(@RequestBody RankingListReq req) {
|
||||
return homePageService.rankingList(req);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.homepage.mapper;
|
||||
|
||||
import com.ruoyi.homepage.model.param.ChartReq;
|
||||
import com.ruoyi.homepage.model.result.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 后台数据统计 Mapper 接口
|
||||
*
|
||||
* @author 李文龙
|
||||
* @date 2022/01/13 14:19
|
||||
*/
|
||||
@Repository
|
||||
public interface HomePageMapper {
|
||||
|
||||
List<StatisticsResult> statistics();
|
||||
|
||||
List<ChartResult> monthOrderAmountChart(@Param("month") String month);
|
||||
|
||||
List<ChartResult> yearOrderAmountChart(@Param("year") String year);
|
||||
|
||||
|
||||
List<ChartResult> monthOrderAmountChartNear();
|
||||
|
||||
List<ChartResult> yearOrderAmountChartNear();
|
||||
|
||||
List<RankingResult> rankingCustomerList();
|
||||
|
||||
List<RankingResult> rankingStoreList();
|
||||
|
||||
List<RankingResult> rankingSaleList();
|
||||
|
||||
List<ClassificationProportionResult> classificationProportion(@Param("req")ChartReq req);
|
||||
|
||||
List<NewOldCustomersResult> newOldCustomers(@Param("req")ChartReq req);
|
||||
}
|
||||
@@ -0,0 +1,560 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.ruoyi.homepage.mapper.HomePageMapper">
|
||||
|
||||
|
||||
<select id="statistics" resultType="com.ruoyi.homepage.model.result.StatisticsResult">
|
||||
SELECT
|
||||
'累计入驻设计师' position_0,
|
||||
( SELECT COUNT( 1 ) FROM t_customer t WHERE t.del_flag != 2 ) position_1,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_customer t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )) position_2,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_customer t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )) position_3
|
||||
UNION ALL
|
||||
SELECT
|
||||
'累计入驻表现师' position_0,
|
||||
( SELECT COUNT( 1 ) FROM t_store t WHERE t.del_flag != 2 ) position_1,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_store t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )) position_2,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_store t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )) position_3
|
||||
UNION ALL
|
||||
SELECT
|
||||
'累计入驻销售人员' position_0,
|
||||
( SELECT COUNT( 1 ) FROM t_sale t WHERE t.del_flag != 2 ) position_1,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )) position_2,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE
|
||||
t.del_flag != 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )) position_3
|
||||
UNION ALL
|
||||
SELECT
|
||||
'累计订单数' position_0,
|
||||
( SELECT COUNT( 1 ) FROM t_order t WHERE t.del_flag = 1 AND t.`status` >= 4 ) position_1,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_order t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` >= 4
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )) position_2,
|
||||
(
|
||||
SELECT
|
||||
COUNT( 1 )
|
||||
FROM
|
||||
t_order t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` >= 4
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )) position_3
|
||||
UNION ALL
|
||||
SELECT
|
||||
'累计订单金额' position_0,
|
||||
IFNULL(( SELECT SUM( t.amount ) FROM t_order t WHERE t.del_flag = 1 AND t.`status` >= 4 ), 0 ) + '元' position_1,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.amount )
|
||||
FROM
|
||||
t_order t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` >= 4
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )),
|
||||
0
|
||||
) position_2,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.amount )
|
||||
FROM
|
||||
t_order t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` >= 4
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )),
|
||||
0
|
||||
) position_3
|
||||
|
||||
UNION ALL
|
||||
SELECT
|
||||
'平台累计服务费' position_0,
|
||||
IFNULL(( SELECT SUM( t.service_charge ) FROM t_withdrawal_record t WHERE t.del_flag = 1 AND t.`status` = 2 ), 0 ) + '元' position_1,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.service_charge )
|
||||
FROM
|
||||
t_withdrawal_record t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` = 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )),
|
||||
0
|
||||
) position_2,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.service_charge )
|
||||
FROM
|
||||
t_withdrawal_record t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` = 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 DAY ), '%Y-%m-%d' )),
|
||||
0
|
||||
) position_3 UNION ALL
|
||||
SELECT
|
||||
'累计提现金额' position_0,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.service_charge + t.price )
|
||||
FROM
|
||||
t_withdrawal_record t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` = 2
|
||||
),
|
||||
0
|
||||
) + '元' position_1,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.service_charge + t.price )
|
||||
FROM
|
||||
t_withdrawal_record t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` = 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m' ) = DATE_FORMAT( NOW(), '%Y-%m' )),
|
||||
0
|
||||
) position_2,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.service_charge + t.price )
|
||||
FROM
|
||||
t_withdrawal_record t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
AND t.`status` = 2
|
||||
AND DATE_FORMAT( t.create_time, '%Y-%m' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 MONTH ), '%Y-%m' )),
|
||||
0
|
||||
) position_3 UNION ALL
|
||||
SELECT
|
||||
'销售员累计佣金' position_0,
|
||||
IFNULL(( SELECT SUM( t.income ) FROM t_sale t ), 0 ) + '元' position_1,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.income )
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE
|
||||
DATE_FORMAT( t.create_time, '%Y-%m' ) = DATE_FORMAT( NOW(), '%Y-%m' )),
|
||||
0
|
||||
) position_2,
|
||||
IFNULL((
|
||||
SELECT
|
||||
SUM( t.income )
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE
|
||||
DATE_FORMAT( t.create_time, '%Y-%m' ) = DATE_FORMAT( DATE_SUB( NOW(), INTERVAL 1 MONTH ), '%Y-%m' )),
|
||||
0
|
||||
) position_3
|
||||
</select>
|
||||
|
||||
<select id="monthOrderAmountChart" resultType="com.ruoyi.homepage.model.result.ChartResult">
|
||||
SELECT
|
||||
DATE_FORMAT(o.create_time, '%Y-%m-%d') unit,
|
||||
IFNULL(SUM(o.amount), 0) amount,
|
||||
sum(
|
||||
CASE
|
||||
WHEN o. STATUS = 1
|
||||
OR o. STATUS = 2
|
||||
AND o.source_user_type = 1 THEN
|
||||
IFNULL(o.first_price, 0)
|
||||
WHEN o. STATUS = 2
|
||||
AND o.source_user_type = 2 THEN
|
||||
IFNULL(o.first_price, 0)
|
||||
ELSE
|
||||
IFNULL(o.amount, 0)
|
||||
END
|
||||
) hasReceiveAmount
|
||||
FROM
|
||||
t_order o
|
||||
WHERE o.first_status = 2 AND
|
||||
DATE_FORMAT(o.create_time, '%Y-%m') = #{month}
|
||||
GROUP BY
|
||||
DATE_FORMAT(o.create_time, '%Y-%m-%d')
|
||||
ORDER BY
|
||||
DATE_FORMAT(o.create_time, '%Y-%m-%d')
|
||||
</select>
|
||||
|
||||
|
||||
<select id="yearOrderAmountChart" resultType="com.ruoyi.homepage.model.result.ChartResult">
|
||||
SELECT
|
||||
DATE_FORMAT(o.create_time, '%Y-%m') unit,
|
||||
IFNULL(SUM(o.amount), 0) amount,
|
||||
sum(
|
||||
CASE
|
||||
WHEN o. STATUS = 1
|
||||
OR o. STATUS = 2
|
||||
AND o.source_user_type = 1 THEN
|
||||
IFNULL(o.first_price, 0)
|
||||
WHEN o. STATUS = 2
|
||||
AND o.source_user_type = 2 THEN
|
||||
IFNULL(o.first_price, 0)
|
||||
ELSE
|
||||
IFNULL(o.amount, 0)
|
||||
END
|
||||
) hasReceiveAmount
|
||||
FROM
|
||||
t_order o
|
||||
WHERE o.first_status = 2 AND
|
||||
DATE_FORMAT(o.create_time, '%Y') = #{year}
|
||||
GROUP BY
|
||||
DATE_FORMAT(o.create_time, '%Y-%m')
|
||||
ORDER BY
|
||||
DATE_FORMAT(o.create_time, '%Y-%m')
|
||||
</select>
|
||||
|
||||
|
||||
<select id="monthOrderAmountChartNear" resultType="com.ruoyi.homepage.model.result.ChartResult">
|
||||
SELECT
|
||||
_unit.unit,
|
||||
IFNULL( SUM( o.amount ), 0 ) amount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DATE_FORMAT( now(), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 1 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 2 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 3 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 4 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 5 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 6 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 7 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 8 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 9 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 10 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 11 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 12 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 13 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 14 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 15 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 16 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 17 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 18 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 19 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 20 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 21 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 22 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 23 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 24 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 25 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 26 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 27 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 28 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 29 DAY ), '%Y-%m-%d' ) unit
|
||||
FROM
|
||||
DUAL
|
||||
) _unit
|
||||
LEFT JOIN t_order o ON DATE_FORMAT( o.create_time, '%Y-%m-%d' ) = _unit.unit
|
||||
AND o.first_status = 2
|
||||
GROUP BY
|
||||
_unit.unit
|
||||
ORDER BY
|
||||
STR_TO_DATE( _unit.unit, '%Y-%m-%d' ) ASC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="yearOrderAmountChartNear" resultType="com.ruoyi.homepage.model.result.ChartResult">
|
||||
SELECT
|
||||
_unit.unit,
|
||||
IFNULL( SUM( o.amount ), 0 ) amount
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
DATE_FORMAT( now(), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 1 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 2 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 3 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 4 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 5 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 6 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 7 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 8 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 9 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 10 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 11 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL UNION ALL
|
||||
SELECT
|
||||
DATE_FORMAT( date_sub( now(), INTERVAL 12 MONTH ), '%Y-%m' ) unit
|
||||
FROM
|
||||
DUAL
|
||||
) _unit
|
||||
LEFT JOIN t_order o ON DATE_FORMAT( o.create_time, '%Y-%m' ) = _unit.unit
|
||||
AND o.first_status = 2
|
||||
GROUP BY
|
||||
_unit.unit
|
||||
ORDER BY
|
||||
STR_TO_DATE( CONCAT( _unit.unit, '-01' ), '%Y-%m-%d' ) ASC
|
||||
</select>
|
||||
|
||||
<select id="rankingCustomerList" resultType="com.ruoyi.homepage.model.result.RankingResult">
|
||||
SELECT
|
||||
t.nickname,
|
||||
t.consumption_amount amount
|
||||
FROM
|
||||
t_customer t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
ORDER BY
|
||||
t.consumption_amount DESC,
|
||||
t.id
|
||||
limit 0,10
|
||||
</select>
|
||||
|
||||
<select id="rankingStoreList" resultType="com.ruoyi.homepage.model.result.RankingResult">
|
||||
SELECT
|
||||
t.nickname,
|
||||
t.income amount
|
||||
FROM
|
||||
t_store t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
ORDER BY
|
||||
t.income DESC,
|
||||
t.id
|
||||
limit 0,10
|
||||
</select>
|
||||
|
||||
<select id="rankingSaleList" resultType="com.ruoyi.homepage.model.result.RankingResult">
|
||||
SELECT
|
||||
t.nickname,
|
||||
t.income amount
|
||||
FROM
|
||||
t_sale t
|
||||
WHERE
|
||||
t.del_flag = 1
|
||||
ORDER BY
|
||||
t.income DESC,
|
||||
t.id
|
||||
limit 0,10
|
||||
</select>
|
||||
<select id="classificationProportion"
|
||||
resultType="com.ruoyi.homepage.model.result.ClassificationProportionResult">
|
||||
SELECT
|
||||
o.works_type_id,
|
||||
t2.`name` worksTypeName,
|
||||
t3.name parentWorksTypeName,
|
||||
sum(o.amount) amount
|
||||
FROM
|
||||
t_order o
|
||||
LEFT JOIN t_works_type t2 ON o.works_type_id = t2.id
|
||||
LEFT JOIN t_works_type t3 ON t2.pid = t3.id
|
||||
WHERE
|
||||
o.first_status = 2
|
||||
<if test="req.timeType!=null and req.timeType==1">
|
||||
AND DATE_FORMAT(o.create_time, '%Y-%m') = #{req.month}
|
||||
</if>
|
||||
<if test="req.timeType!=null and req.timeType==2">
|
||||
AND DATE_FORMAT(o.create_time, '%Y') = #{req.year}
|
||||
</if>
|
||||
GROUP BY
|
||||
o.works_type_id
|
||||
order by o.works_type_id
|
||||
</select>
|
||||
|
||||
<select id="newOldCustomers"
|
||||
resultType="com.ruoyi.homepage.model.result.NewOldCustomersResult">
|
||||
|
||||
SELECT DISTINCT
|
||||
o.customer_id,
|
||||
<if test="req.timeType!=null and req.timeType==1">
|
||||
CASE
|
||||
WHEN
|
||||
#{req.month} > DATE_FORMAT(t2.create_time, '%Y-%m') then 2
|
||||
ELSE
|
||||
1
|
||||
END isNewCustomer
|
||||
</if>
|
||||
<if test="req.timeType!=null and req.timeType==2">
|
||||
CASE
|
||||
WHEN
|
||||
#{req.month} > DATE_FORMAT(t2.create_time, '%Y-%m') then 2
|
||||
ELSE
|
||||
1
|
||||
END isNewCustomer
|
||||
</if>
|
||||
|
||||
FROM
|
||||
t_order o
|
||||
LEFT JOIN t_customer t2 ON o.customer_id = t2.id
|
||||
WHERE
|
||||
o.first_status = 2
|
||||
AND t2.del_flag != 2
|
||||
<if test="req.timeType!=null and req.timeType==1">
|
||||
AND DATE_FORMAT(o.create_time, '%Y-%m') = #{req.month}
|
||||
</if>
|
||||
<if test="req.timeType!=null and req.timeType==2">
|
||||
AND DATE_FORMAT(o.create_time, '%Y') = #{req.year}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.homepage.model.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author a
|
||||
* @date 2023/3/6 13:34
|
||||
*/
|
||||
@Data
|
||||
public class ChartReq {
|
||||
|
||||
@ApiModelProperty(value = "1 近一月 2 近一年")
|
||||
private Integer timeType = 1;
|
||||
|
||||
private String year; //2022/2023
|
||||
|
||||
private String month;// 2021-11/2022-12
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.ruoyi.homepage.model.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author a
|
||||
* @date 2023/10/25 17:36
|
||||
*/
|
||||
@Data
|
||||
public class RankingListReq {
|
||||
|
||||
@ApiModelProperty(value = "1设计师 2表现师 3销售佣金")
|
||||
private Integer type = 1;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ruoyi.homepage.model.result;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author a
|
||||
* @date 2023/3/6 13:38
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class ChartResult {
|
||||
|
||||
private String num;//数量
|
||||
|
||||
private String amount;//金额
|
||||
|
||||
private String hasReceiveAmount;//已到款
|
||||
|
||||
private String unit;//日期
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.homepage.model.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ClassificationProportionResult {
|
||||
|
||||
private Long worksTypeId;
|
||||
private String worksTypeName;
|
||||
private String parentWorksTypeName;
|
||||
private String amount;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.homepage.model.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class NewOldCustomersResult {
|
||||
private Long customerId;
|
||||
private Date createTime;
|
||||
private Integer isNewCustomer;//是否是新用户 1 是 2 否
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.homepage.model.result;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author a
|
||||
* @date 2023/10/26 9:10
|
||||
*/
|
||||
@Data
|
||||
public class RankingResult {
|
||||
|
||||
@ApiModelProperty(value = "排名")
|
||||
private Integer ranking;
|
||||
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "金额")
|
||||
private BigDecimal amount;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.ruoyi.homepage.model.result;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author a
|
||||
* @date 2023/10/25 17:42
|
||||
*/
|
||||
@Data
|
||||
public class StatisticsResult {
|
||||
|
||||
|
||||
private String position0;
|
||||
|
||||
private String position1;
|
||||
|
||||
private String position2;
|
||||
|
||||
private String position3;
|
||||
|
||||
private String position4;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.ruoyi.homepage.service;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.homepage.model.param.ChartReq;
|
||||
import com.ruoyi.homepage.model.param.RankingListReq;
|
||||
import com.ruoyi.homepage.model.result.ChartResult;
|
||||
|
||||
/**
|
||||
* 首页数据统计
|
||||
*
|
||||
* @author liwenlong
|
||||
* @date 2023-02-13
|
||||
*/
|
||||
public interface HomePageService {
|
||||
|
||||
|
||||
/**
|
||||
* 后台首页统计
|
||||
* @return
|
||||
*/
|
||||
AjaxResult statistics();
|
||||
|
||||
|
||||
/**
|
||||
* 订单金额统计
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
AjaxResult orderAmountChart(ChartReq req);
|
||||
|
||||
|
||||
/**
|
||||
* 消费排行榜
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
AjaxResult rankingList(RankingListReq req);
|
||||
|
||||
AjaxResult classificationProportion(ChartReq req);
|
||||
|
||||
AjaxResult newOldCustomers(ChartReq req);
|
||||
|
||||
AjaxResult<ChartResult> orderAmountChartNear(ChartReq req);
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.ruoyi.homepage.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.frequency.workstype.entity.WorksType;
|
||||
import com.ruoyi.frequency.workstype.service.WorksTypeService;
|
||||
import com.ruoyi.homepage.mapper.HomePageMapper;
|
||||
import com.ruoyi.homepage.model.param.ChartReq;
|
||||
import com.ruoyi.homepage.model.param.RankingListReq;
|
||||
import com.ruoyi.homepage.model.result.*;
|
||||
import com.ruoyi.homepage.service.HomePageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 首页数据统计
|
||||
*
|
||||
* @author liwenlong
|
||||
* @date 2023-02-13
|
||||
*/
|
||||
@Service
|
||||
public class HomePageServiceImpl implements HomePageService {
|
||||
|
||||
@Autowired
|
||||
private HomePageMapper homePageMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult statistics() {
|
||||
|
||||
List<StatisticsResult> list = homePageMapper.statistics();
|
||||
|
||||
if (list.size() > 0) {
|
||||
//求环比
|
||||
list.stream().forEach(s -> {
|
||||
|
||||
int index = list.indexOf(s);
|
||||
|
||||
BigDecimal position_2 = new BigDecimal(s.getPosition2());
|
||||
|
||||
BigDecimal position_3 = new BigDecimal(s.getPosition3());
|
||||
|
||||
if (position_2.compareTo(BigDecimal.ZERO) == 0) {
|
||||
s.setPosition4("0");
|
||||
} else if (position_3.compareTo(BigDecimal.ZERO) == 0) {
|
||||
s.setPosition4("100");
|
||||
} else {
|
||||
s.setPosition4(position_2.subtract(position_3).divide(position_3, 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||
}
|
||||
|
||||
if (index >= 4) {
|
||||
s.setPosition1(s.getPosition1() + "元");
|
||||
s.setPosition2(s.getPosition2() + "元");
|
||||
s.setPosition3(s.getPosition3() + "元");
|
||||
} else {
|
||||
s.setPosition1(new BigDecimal(s.getPosition1()).intValue() + "");
|
||||
}
|
||||
s.setPosition4(s.getPosition4() + "%");
|
||||
});
|
||||
}
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult orderAmountChartNear(ChartReq req) {
|
||||
|
||||
List<ChartResult> list = new ArrayList<>();
|
||||
//1 本月 2 近一年
|
||||
if (req.getTimeType() == 1) {
|
||||
list = homePageMapper.monthOrderAmountChartNear();
|
||||
//补全没有数据的日期
|
||||
|
||||
} else if (req.getTimeType() == 2) {
|
||||
list = homePageMapper.yearOrderAmountChartNear();
|
||||
}
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult orderAmountChart(ChartReq req) {
|
||||
|
||||
List<ChartResult> list = new ArrayList<>();
|
||||
|
||||
List<ChartResult> listNew = new ArrayList<>();
|
||||
//1 本月 2 近一年
|
||||
if (req.getTimeType() == 1) {
|
||||
list = homePageMapper.monthOrderAmountChart(req.getMonth());
|
||||
//补全没有数据的日期
|
||||
int daysInMonth = getDaysInMonth(Integer.valueOf(req.getMonth().split("-")[0]), Integer.valueOf(req.getMonth().split("-")[1]));
|
||||
Map<String, ChartResult> map = new HashMap<>();
|
||||
list.stream().forEach(x -> {
|
||||
map.put(x.getUnit(), x);
|
||||
});
|
||||
for (int i = 0; i < daysInMonth; i++) {
|
||||
String unit = req.getMonth() + "-" + (i < 9 ? "0" + (i + 1) : (i + 1));
|
||||
if (map.containsKey(unit)) {
|
||||
listNew.add(map.get(unit));
|
||||
} else {
|
||||
ChartResult chartResult = new ChartResult();
|
||||
chartResult.setUnit(unit);
|
||||
chartResult.setAmount("0");
|
||||
chartResult.setHasReceiveAmount("0");
|
||||
chartResult.setNum("0");
|
||||
listNew.add(chartResult);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (req.getTimeType() == 2) {
|
||||
list = homePageMapper.yearOrderAmountChart(req.getYear());
|
||||
//补全没有数据的日期
|
||||
int monthsInYear = getMonthsInYear(Integer.valueOf(req.getYear()));
|
||||
|
||||
Map<String, ChartResult> map = new HashMap<>();
|
||||
list.stream().forEach(x -> {
|
||||
map.put(x.getUnit(), x);
|
||||
});
|
||||
|
||||
for (int i = 0; i < monthsInYear; i++) {
|
||||
String unit = req.getYear() + "-" + (i < 9 ? "0" + (i + 1) : (i + 1));
|
||||
if (map.containsKey(unit)) {
|
||||
listNew.add(map.get(unit));
|
||||
} else {
|
||||
ChartResult chartResult = new ChartResult();
|
||||
chartResult.setUnit(unit);
|
||||
chartResult.setAmount("0");
|
||||
chartResult.setHasReceiveAmount("0");
|
||||
chartResult.setNum("0");
|
||||
listNew.add(chartResult);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return AjaxResult.success(listNew);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int year = 2022;
|
||||
int month = 11; // 11代表11月
|
||||
|
||||
int daysInMonth = getDaysInMonth(year, month);
|
||||
int monthsInYear = getMonthsInYear(2024);
|
||||
System.out.println(monthsInYear);
|
||||
|
||||
System.out.println("The number of days in " + month + "/" + year + " is: " + daysInMonth);
|
||||
}
|
||||
|
||||
public static int getDaysInMonth(int year, int month) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(year, month - 1, 1); // 月份是从0开始计算的,因此要减1
|
||||
|
||||
return calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||
}
|
||||
|
||||
public static int getMonthsInYear(int year) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(year, 0, 1); // 月份是从0开始计算的,因此要减1
|
||||
|
||||
return calendar.getActualMaximum(Calendar.MONTH) + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult rankingList(RankingListReq req) {
|
||||
|
||||
List<RankingResult> list = new ArrayList<>();
|
||||
|
||||
//1设计师 2表现师 3销售佣金
|
||||
if (req.getType() == 1) {
|
||||
list = homePageMapper.rankingCustomerList();
|
||||
} else if (req.getType() == 2) {
|
||||
list = homePageMapper.rankingStoreList();
|
||||
} else if (req.getType() == 3) {
|
||||
list = homePageMapper.rankingSaleList();
|
||||
}
|
||||
|
||||
Integer i = 1;
|
||||
//添加排名
|
||||
for (RankingResult s : list) {
|
||||
s.setRanking(i++);
|
||||
}
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private WorksTypeService worksTypeService;
|
||||
|
||||
|
||||
@Override
|
||||
public AjaxResult classificationProportion(ChartReq req) {
|
||||
//查询当前所有的二级分类
|
||||
List<WorksType> worksTypes = worksTypeService.worksTypeList();
|
||||
|
||||
List<WorksType> workTypeIdList = new ArrayList<>();
|
||||
|
||||
worksTypes.stream().forEach(worksType -> {
|
||||
List<WorksType> childList = worksType.getChildList();
|
||||
childList.stream().forEach(child -> {
|
||||
workTypeIdList.add(child);
|
||||
});
|
||||
});
|
||||
|
||||
//1 近一月 2 近一年
|
||||
List<ClassificationProportionResult> classificationProportionResultList = homePageMapper.classificationProportion(req);
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("worksTypeList", workTypeIdList);
|
||||
result.put("classificationProportionResultList", classificationProportionResultList);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult newOldCustomers(ChartReq req) {
|
||||
List<NewOldCustomersResult> newOldCustomersResultList = homePageMapper.newOldCustomers(req);
|
||||
Integer newCount = 0;
|
||||
Integer oldCount = 0;
|
||||
for (NewOldCustomersResult newOldCustomersResult : newOldCustomersResultList) {
|
||||
//用户注册时间是否大于查询的年月开始时间 1 是 2 否
|
||||
if (newOldCustomersResult.getIsNewCustomer() == 1) {
|
||||
newCount = newCount + 1;
|
||||
} else {
|
||||
oldCount = oldCount + 1;
|
||||
}
|
||||
}
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
result.put("newCount", newCount);
|
||||
result.put("oldCount", oldCount);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson.*.jar
|
||||
@@ -0,0 +1,119 @@
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 连接超时时间
|
||||
timeout: 30s
|
||||
# 密码
|
||||
password: Huitu123
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
# url: jdbc:mysql://124.223.56.113:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: ddht
|
||||
# password: ZGFSCkDHmLN62Mnt
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: true
|
||||
url: jdbc:mysql://wiz.52o.site:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ddht
|
||||
password: i5y4EacPLkWSm6sz
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
oss:
|
||||
local:
|
||||
#文件域名
|
||||
domain: http://localhost:8080
|
||||
#存储路径
|
||||
upload-file-path: D:/ruoyiVueS
|
||||
aliyun:
|
||||
#阿里云api的内或外网域名
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
#阿里云api的密钥access key id
|
||||
access-key-id:
|
||||
#阿里云api的密钥access key secret
|
||||
access-key-secret:
|
||||
#阿里云api的bucket名称
|
||||
bucket-name:
|
||||
#外部访问域名
|
||||
domain: http://xxxxx.oss-cn-beijing.aliyuncs.com
|
||||
|
||||
basepath:
|
||||
url: http://dianqi.natapp1.cc
|
||||
wecom:
|
||||
corpid: ww45fb4d72c735ee1d
|
||||
corpsecret: 5x3F-AHQMO9VwpXH9_lOUX8887sqb1fUx0-5goN6U_Y
|
||||
|
||||
# 拉卡拉测试支付参数
|
||||
lalkla:
|
||||
#拉卡拉开放平台进行配置开通
|
||||
appId: OP00002734
|
||||
#商户号
|
||||
merchantNo: 8223610899900ZC
|
||||
#商户证书序列号,和商户私钥对应
|
||||
serialNo: 018f86243d2c
|
||||
#商户私钥地址,用于请求签名
|
||||
priKeyPath: G:/lakala/OP00000003_private_key.pem
|
||||
#拉卡拉公钥证书地址,用于验签(测试证书为:lkl-apigw-v1.cer)
|
||||
lklCerPath: G:/lakala/lkl-apigw-v2.cer
|
||||
#拉卡拉支付平台证书地址2(用于拉卡拉通知验签,证书与lklCerPath)一致,测试证书为:lkl-apigw-v1.cer)
|
||||
lklNotifyCerPath: G:/lakala/lkl-apigw-v2.cer
|
||||
#拉卡拉开放平台服务地址
|
||||
serverUrl: https://s2.lakala.com
|
||||
#如果需要密文传输请申请拉卡拉SM4密钥
|
||||
sm4Key: 0I4M0kmwFrNUU8hZ9AFpfA==
|
||||
# 文件下载存储地址
|
||||
basePath: G:\download\
|
||||
# 文件下载存储地址
|
||||
filePath: G:\file\
|
||||
@@ -0,0 +1,115 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 7
|
||||
# 密码
|
||||
password: Huitu123
|
||||
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
# url: jdbc:mysql://124.223.56.113:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: ddht
|
||||
# password: ZGFSCkDHmLN62Mnt
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: true
|
||||
url: jdbc:mysql://wiz.52o.site:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ddht
|
||||
password: i5y4EacPLkWSm6sz
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
oss:
|
||||
local:
|
||||
#文件域名
|
||||
domain: http://localhost:8080
|
||||
#存储路径
|
||||
upload-file-path: D:/ruoyiVueS
|
||||
aliyun:
|
||||
#阿里云api的内或外网域名
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
#阿里云api的密钥access key id
|
||||
access-key-id:
|
||||
#阿里云api的密钥access key secret
|
||||
access-key-secret:
|
||||
#阿里云api的bucket名称
|
||||
bucket-name:
|
||||
#外部访问域名
|
||||
domain: http://xxxxx.oss-cn-beijing.aliyuncs.com
|
||||
|
||||
|
||||
basepath:
|
||||
url: http://erp.ddht.cn/huituApi
|
||||
|
||||
# 拉卡拉测试支付参数
|
||||
lalkla:
|
||||
#拉卡拉开放平台进行配置开通
|
||||
appId: OP00002734
|
||||
#商户号
|
||||
merchantNo: 8223610899900ZC
|
||||
#商户证书序列号,和商户私钥对应
|
||||
serialNo: 018f86243d2c
|
||||
#商户私钥地址,用于请求签名
|
||||
priKeyPath: /home/manage/huitu/OP00000003_private_key.pem
|
||||
#拉卡拉公钥证书地址,用于验签(测试证书为:lkl-apigw-v2.cer)
|
||||
lklCerPath: /home/manage/huitu/lkl-apigw-v2.cer
|
||||
#拉卡拉支付平台证书地址2(用于拉卡拉通知验签,证书与lklCerPath)一致,测试证书为:lkl-apigw-v2.cer)
|
||||
lklNotifyCerPath: /home/manage/huitu/lkl-apigw-v2.cer
|
||||
#拉卡拉开放平台服务地址
|
||||
serverUrl: https://s2.lakala.com
|
||||
#如果需要密文传输请申请拉卡拉SM4密钥
|
||||
sm4Key: 0I4M0kmwFrNUU8hZ9AFpfA==
|
||||
# 文件下载存储地址
|
||||
basePath: /home/manage/huitu/download/
|
||||
# 文件下载存储地址
|
||||
filePath: /home/manage/huitu/file/
|
||||
@@ -0,0 +1,117 @@
|
||||
|
||||
# 数据源配置
|
||||
spring:
|
||||
redis:
|
||||
# 地址
|
||||
host: localhost
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password: Huitu123
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
# url: jdbc:mysql://124.223.56.113:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
# username: ddht
|
||||
# password: ZGFSCkDHmLN62Mnt
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: true
|
||||
url: jdbc:mysql://wiz.52o.site:13306/ddht?useUnicode=true&allowMultiQueries=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ddht
|
||||
password: i5y4EacPLkWSm6sz
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: ruoyi
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
|
||||
oss:
|
||||
local:
|
||||
#文件域名
|
||||
domain: http://localhost:8080
|
||||
#存储路径
|
||||
upload-file-path: D:/ruoyiVueS
|
||||
aliyun:
|
||||
#阿里云api的内或外网域名
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
#阿里云api的密钥access key id
|
||||
access-key-id:
|
||||
#阿里云api的密钥access key secret
|
||||
access-key-secret:
|
||||
#阿里云api的bucket名称
|
||||
bucket-name:
|
||||
#外部访问域名
|
||||
domain: http://xxxxx.oss-cn-beijing.aliyuncs.com
|
||||
|
||||
basepath:
|
||||
url: http://8.142.155.9/huituApi
|
||||
wecom:
|
||||
corpid: ww45fb4d72c735ee1d
|
||||
corpsecret: 5x3F-AHQMO9VwpXH9_lOUX8887sqb1fUx0-5goN6U_Y
|
||||
|
||||
# 拉卡拉测试支付参数
|
||||
lalkla:
|
||||
#拉卡拉开放平台进行配置开通
|
||||
appId: OP00002734
|
||||
#商户号
|
||||
merchantNo: 8223610899900YF
|
||||
#商户证书序列号,和商户私钥对应
|
||||
serialNo: 018f86243d2c
|
||||
#商户私钥地址,用于请求签名
|
||||
priKeyPath: /home/manage/huitu/OP00000003_private_key.pem
|
||||
#拉卡拉公钥证书地址,用于验签(测试证书为:lkl-apigw-v2.cer)
|
||||
lklCerPath: /home/manage/huitu/lkl-apigw-v2.cer
|
||||
#拉卡拉支付平台证书地址2(用于拉卡拉通知验签,证书与lklCerPath)一致,测试证书为:lkl-apigw-v2.cer)
|
||||
lklNotifyCerPath: /home/manage/huitu/lkl-apigw-v2.cer
|
||||
#拉卡拉开放平台服务地址
|
||||
serverUrl: https://s2.lakala.com
|
||||
#如果需要密文传输请申请拉卡拉SM4密钥
|
||||
sm4Key: 0I4M0kmwFrNUU8hZ9AFpfA==
|
||||
# 文件下载存储地址
|
||||
basePath: /home/manage/huitu/download/
|
||||
# 文件下载存储地址
|
||||
filePath: /home/manage/huitu/file/
|
||||
271
ruoyi-extend/ruoyi-business/src/main/resources/application.yml
Normal file
271
ruoyi-extend/ruoyi-business/src/main/resources/application.yml
Normal file
@@ -0,0 +1,271 @@
|
||||
# 项目相关配置
|
||||
ruoyi:
|
||||
# 名称
|
||||
name: RuoYi-Vue-S
|
||||
# 版本
|
||||
version: 3.7.0
|
||||
# 版权年份
|
||||
copyrightYear: 2021
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
|
||||
profile: D:/ruoyi/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为8080
|
||||
port: 8888
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path:
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.ruoyi: debug
|
||||
org.springframework: warn
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
locale: zh_CN
|
||||
serialization:
|
||||
# 格式化输出
|
||||
indent_output: false
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 10MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 20MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: false
|
||||
# redis 配置
|
||||
redis:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 300
|
||||
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:/com/ruoyi/**/*.xml,classpath*:com/ruoyi/**/mapping/*.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
type-aliases-package: com.ruoyi.**.domain,com.ruoyi.entity.**
|
||||
#typeEnumsPackage: com.baomidou.springboot.entity.enums
|
||||
global-config:
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型 com.baomidou.mybatisplus.annotation.IdType";
|
||||
id-type: assign_id
|
||||
#字段策略 com.baomidou.mybatisplus.annotation.FieldStrategy"
|
||||
select-strategy: NOT_EMPTY
|
||||
insert-strategy: NOT_EMPTY
|
||||
update-strategy: NOT_EMPTY
|
||||
#逻辑删除配置(下面3个配置)
|
||||
logic-delete-value: 0
|
||||
logic-not-delete-value: 1
|
||||
configuration:
|
||||
jdbc-type-for-null: 'null'
|
||||
#数据库大写下划线转换
|
||||
map-underscore-to-camel-case: true
|
||||
cache-enabled: false
|
||||
lazy-loading-enabled: true
|
||||
multiple-result-sets-enabled: true
|
||||
log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl #开启sql日志
|
||||
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||
configuration-properties:
|
||||
dbType: mysql #设置全局属性用于控制数据库的类型
|
||||
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping:
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
#文件上传配置
|
||||
#使用的上传存储空间,local本地,aliyun:阿里云
|
||||
oss:
|
||||
client-type: local
|
||||
#默认上传目录
|
||||
base_dir: userfiles
|
||||
#允许的文件扩展名
|
||||
allowed_extension: mp4,bmp, gif, jpg, jpeg, png,doc, docx, xls, xlsx, ppt, pptx,html,htm,txt,rar, zip, gz, bz2,pdf
|
||||
#最大文件大小 50M
|
||||
max_size: 52428800
|
||||
#是否需要按照日期存放文件
|
||||
needDatePath: false
|
||||
|
||||
sms:
|
||||
#三方短信类型 1 助通短信 2 阿里短信 3 腾讯云短信
|
||||
sms_type: 3
|
||||
|
||||
#阿里短信
|
||||
access-key-id:
|
||||
access-key-secret:
|
||||
signName:
|
||||
templateCode:
|
||||
|
||||
#助通短信
|
||||
username: huitu
|
||||
password: 123456
|
||||
|
||||
# 消息推送
|
||||
push:
|
||||
# 消息推送 1 goeasy ; 2 uniapp
|
||||
push_type: 1
|
||||
#goeasy(消息推送,聊天)
|
||||
goeasy:
|
||||
appkey: BC-d4519ea15c3f4d67a0d923dc980cbdac
|
||||
regionHost: https://rest-hangzhou.goeasy.io
|
||||
secretKey: d3c00d08e684412e
|
||||
|
||||
#uniapp消息推送
|
||||
uniapp:
|
||||
appid:
|
||||
appkey:
|
||||
mastersecret:
|
||||
|
||||
nohupLog:
|
||||
size: 10MB
|
||||
baseDir: /home/manage/
|
||||
|
||||
#一键登陆解密手机号参数
|
||||
decryptPhone:
|
||||
url: https://api.verification.jpush.cn/v1/web/loginTokenVerify
|
||||
app_key: fde270559d7d5d488d58f545
|
||||
master_Key: fdb70c3d0d1a622d5b8b1cd3
|
||||
private_key: MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJYswKGroaPqET+uV4SYtUuKt628Wa3J1wXrpV1dEFqVH6PnZgOBFLvrojHZ7XQfgjHazXZkTkra6mvRNO35CS9rnTZEnYVrD9MQnirMbGsSOtCyTVNQUoqmGgWVaM2F+2XS6F+p2BzLbEHhv+YyHC65qmh8iFyDykJY4dkRYjX7AgMBAAECgYBH/GXOWY5fG1lvVCwBlI37CyCm+E1ooAMhhGa9TVoEgc0r7UUaUurUdcxG5zcK3fuz2DV7FfPtr+iFDEC5/hFnW+KV+9R0c6Y8jJKW1p0qAKNU4Icvl/rViX8dQCV0nY0Gny6JtirKzGp0O8lwuynjBWwJds5emFXCippL57HVMQJBANhq53cSarStsf88CHwyG+SRQkX962eoGx7EBFGqAbM0l26mHh0t7bWtA+Thwv+EbgP2/GqOX6TPpHRB4jiJJCkCQQCxpDtGSpIBINRvv1BvVy0Tl058xUWLFFf5tar07DRG3qo9uJR75fLjBILip7bkkclFljmtoaQ4gkP9mlAYPa2DAkB4Yr9vVSdWamjhehueOqGZe9RJ6v3QI4syigd9Bfz8Gv1B59ZIlQvuS9gmsg8u5BPu0K2I+LnrjDYHFb8pg+BBAkAyUZcIvi7FawtB7CtYnpUCK6Xr6eVdFBInhbI7Vn0oZgJLIXHN9sDqVWjN0zwXWsRslbUY3eSqrRudRozRkQcJAkA2B3glMnfjzikFpshq0eKpJj4vUXBsAAO5er73eaC7u2iPls6ABeb9+9Vr8Cqt67wspRqKdX54Xka9CPhOwRWz
|
||||
|
||||
#支付回调
|
||||
notifyurl:
|
||||
#订单首款支付
|
||||
ali-order-url: /api/pay/orderAliNotify
|
||||
wx-order-url: /api/pay/orderWxNotify
|
||||
lkl-order-url: /api/pay/orderLakalaNotify
|
||||
#订单尾款支付
|
||||
ali-secondOrder-url: /api/pay/secondOrderAliNotify
|
||||
wx-secondOrder-url: /api/pay/secondOrderWxNotify
|
||||
lkl-secondOrder-url: /api/pay/secondOrderLakalaNotify
|
||||
#充值订单支付
|
||||
ali-recharge-url: /api/pay/rechargeAliNotify
|
||||
wx-recharge-url: /api/pay/rechargeWxNotify
|
||||
lkl-recharge-url: /api/pay/rechargeLakalaNotify
|
||||
#保证金支付
|
||||
ali-bond-url: /api/pay/bondAliNotify
|
||||
wx-bond-url: /api/pay/bondWxNotify
|
||||
lkl-bond-url: /api/pay/bondLakalaNotify
|
||||
#普通认证支付
|
||||
ali-auth-url: /api/pay/authAliNotify
|
||||
wx-auth-url: /api/pay/authWxNotify
|
||||
lkl-auth-url: /api/pay/authLakalaNotify
|
||||
#高端认证支付
|
||||
ali-highend-auth-url: /api/pay/highendAuthAliNotify
|
||||
wx-highend-auth-url: /api/pay/highendAuthWxNotify
|
||||
lkl-highend-auth-url: /api/pay/highendAuthLakalaNotify
|
||||
#设计师调价支付
|
||||
ali-adjustPrice-auth-url: /api/pay/orderAdjustPricePayAliNotify
|
||||
wx-adjustPrice-auth-url: /api/pay/orderAdjustPricePayWxNotify
|
||||
lkl-adjustPrice-auth-url: /api/pay/orderAdjustPricePayLakalaNotify
|
||||
#表现师调价设计师确认支付
|
||||
ali-adjustPriceConfirm-auth-url: /api/pay/orderAdjustPriceConfirmPayAliNotify
|
||||
wx-adjustPriceConfirm-auth-url: /api/pay/orderAdjustPriceConfirmPayWxNotify
|
||||
lkl-adjustPriceConfirm-auth-url: /api/pay/orderAdjustPriceConfirmPayLakalaNotify
|
||||
|
||||
#支付宝支付参数
|
||||
alipay:
|
||||
appid:
|
||||
private-key:
|
||||
ali-public-key:
|
||||
|
||||
h5appid:
|
||||
partner:
|
||||
h5private-key:
|
||||
h5ali-public-key:
|
||||
|
||||
subject:
|
||||
sign-type: RSA2
|
||||
ali-url: https://openapi.alipay.com/gateway.do
|
||||
product-code: QUICK_MSECURITY_PAY
|
||||
|
||||
#微信支付参数
|
||||
wxpay:
|
||||
appid: wx8cba639752e95ed0
|
||||
mchid:
|
||||
paykey:
|
||||
app-secret: 1e7d48b009a5e5c9902d6e9ae1b0e8d9
|
||||
|
||||
h5appid:
|
||||
h5mchid:
|
||||
h5paykey:
|
||||
h5app-secret:
|
||||
|
||||
wxrefundfile:
|
||||
path: /home/manage/apiclient_cert.p12
|
||||
|
||||
#app名称
|
||||
app:
|
||||
name: DD画图
|
||||
|
||||
DD_drawing:
|
||||
appid: wxed96e8fe10ea8992
|
||||
secret: 5a1da24f97e49aa5762897045dd593b6
|
||||
|
||||
DD_co_creation:
|
||||
appid: wx45d9099290a6ec3d
|
||||
secret: fa6bc98943d4e0bdc3850475c320deb2
|
||||
24
ruoyi-extend/ruoyi-business/src/main/resources/banner.txt
Normal file
24
ruoyi-extend/ruoyi-business/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
Application Version: ${ruoyi.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// _ooOoo_ //
|
||||
// o8888888o //
|
||||
// 88" . "88 //
|
||||
// (| ^_^ |) //
|
||||
// O\ = /O //
|
||||
// ____/`---'\____ //
|
||||
// .' \\| |// `. //
|
||||
// / \\||| : |||// \ //
|
||||
// / _||||| -:- |||||- \ //
|
||||
// | | \\\ - /// | | //
|
||||
// | \_| ''\---/'' | | //
|
||||
// \ .-\__ `-` ___/-. / //
|
||||
// ___`. .' /--.--\ `. . ___ //
|
||||
// ."" '< `.___\_<|>_/___.' >'"". //
|
||||
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
|
||||
// \ \ `-. \_ __\ /__ _/ .-` / / //
|
||||
// ========`-.____`-.___\_____/___.-`____.-'======== //
|
||||
// `=---=' //
|
||||
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
|
||||
// 佛祖保佑 永不宕机 永无BUG //
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@@ -0,0 +1,41 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.register.success=注册成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
||||
|
||||
|
||||
|
||||
the.voting.activity.has.ended=投票活动已截止
|
||||
93
ruoyi-extend/ruoyi-business/src/main/resources/logback.xml
Normal file
93
ruoyi-extend/ruoyi-business/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/ruoyi/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.ruoyi" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
<!-- 全局参数 -->
|
||||
<settings>
|
||||
<!-- 使全局的映射器启用或禁用缓存 -->
|
||||
<setting name="cacheEnabled" value="true" />
|
||||
<!-- 允许JDBC 支持自动生成主键 -->
|
||||
<setting name="useGeneratedKeys" value="true" />
|
||||
<!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
|
||||
<setting name="defaultExecutorType" value="SIMPLE" />
|
||||
<!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="logImpl" value="SLF4J" />
|
||||
<!-- 使用驼峰命名法转换字段 -->
|
||||
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user