📖 ERP:增加 ERP 首页的统计

This commit is contained in:
YunaiV 2024-02-18 19:05:40 +08:00
parent 63f322cb17
commit 9ea7bde751
41 changed files with 464 additions and 129 deletions

View File

@ -132,4 +132,40 @@ public class LocalDateTimeUtils {
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS);
}
/**
* 获取今天的开始时间
*
* @return 今天
*/
public static LocalDateTime getToday() {
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now());
}
/**
* 获取昨天的开始时间
*
* @return 昨天
*/
public static LocalDateTime getYesterday() {
return LocalDateTimeUtil.beginOfDay(LocalDateTime.now().minusDays(1));
}
/**
* 获取本月的开始时间
*
* @return 本月
*/
public static LocalDateTime getMonth() {
return beginOfMonth(LocalDateTime.now());
}
/**
* 获取本年的开始时间
*
* @return 本年
*/
public static LocalDateTime getYear() {
return LocalDateTime.now().with(TemporalAdjusters.firstDayOfYear()).with(LocalTime.MIN);
}
}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.purchase.ErpPurchaseSummaryRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.purchase.ErpPurchaseTimeSummaryRespVO;
import cn.iocoder.yudao.module.erp.service.statistics.ErpPurchaseStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static cn.hutool.core.date.DatePattern.NORM_MONTH_PATTERN;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - ERP 采购统计")
@RestController
@RequestMapping("/erp/purchase-statistics")
@Validated
public class ErpPurchaseStatisticsController {
@Resource
private ErpPurchaseStatisticsService purchaseStatisticsService;
@GetMapping("/summary")
@Operation(summary = "获得采购统计")
@PreAuthorize("@ss.hasPermission('erp:statistics:query')")
public CommonResult<ErpPurchaseSummaryRespVO> getPurchaseSummary() {
LocalDateTime today = LocalDateTimeUtils.getToday();
LocalDateTime yesterday = LocalDateTimeUtils.getYesterday();
LocalDateTime month = LocalDateTimeUtils.getMonth();
LocalDateTime year = LocalDateTimeUtils.getYear();
ErpPurchaseSummaryRespVO summary = new ErpPurchaseSummaryRespVO()
.setTodayPrice(purchaseStatisticsService.getPurchasePrice(today, null))
.setYesterdayPrice(purchaseStatisticsService.getPurchasePrice(yesterday, today))
.setMonthPrice(purchaseStatisticsService.getPurchasePrice(month, null))
.setYearPrice(purchaseStatisticsService.getPurchasePrice(year, null));
return success(summary);
}
@GetMapping("/time-summary")
@Operation(summary = "获得采购时间段统计")
@Parameter(name = "count", description = "时间段数量", example = "6")
@PreAuthorize("@ss.hasPermission('erp:statistics:query')")
public CommonResult<List<ErpPurchaseTimeSummaryRespVO>> getPurchaseTimeSummary(
@RequestParam(value = "count", defaultValue = "6") Integer count) {
List<ErpPurchaseTimeSummaryRespVO> summaryList = new ArrayList<>();
for (int i = count - 1; i >= 0; i--) {
LocalDateTime startTime = LocalDateTimeUtils.beginOfMonth(LocalDateTime.now().minusMonths(i));
LocalDateTime endTime = LocalDateTimeUtils.endOfMonth(startTime);
summaryList.add(new ErpPurchaseTimeSummaryRespVO()
.setTime(LocalDateTimeUtil.format(startTime, NORM_MONTH_PATTERN))
.setPrice(purchaseStatisticsService.getPurchasePrice(startTime, endTime)));
}
return success(summaryList);
}
}

View File

@ -0,0 +1,11 @@
### 请求 /erp/sale-statistics/summary 接口 => 成功
GET {{baseUrl}}/erp/sale-statistics/summary
Content-Type: application/json
tenant-id: {{adminTenentId}}
Authorization: Bearer {{token}}
### 请求 /erp/sale-statistics/time-summary 接口 => 成功
GET {{baseUrl}}/erp/sale-statistics/time-summary
Content-Type: application/json
tenant-id: {{adminTenentId}}
Authorization: Bearer {{token}}

View File

@ -0,0 +1,69 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleSummaryRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale.ErpSaleTimeSummaryRespVO;
import cn.iocoder.yudao.module.erp.service.statistics.ErpSaleStatisticsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static cn.hutool.core.date.DatePattern.NORM_MONTH_PATTERN;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - ERP 销售统计")
@RestController
@RequestMapping("/erp/sale-statistics")
@Validated
public class ErpSaleStatisticsController {
@Resource
private ErpSaleStatisticsService saleStatisticsService;
@GetMapping("/summary")
@Operation(summary = "获得销售统计")
@PreAuthorize("@ss.hasPermission('erp:statistics:query')")
public CommonResult<ErpSaleSummaryRespVO> getSaleSummary() {
LocalDateTime today = LocalDateTimeUtils.getToday();
LocalDateTime yesterday = LocalDateTimeUtils.getYesterday();
LocalDateTime month = LocalDateTimeUtils.getMonth();
LocalDateTime year = LocalDateTimeUtils.getYear();
ErpSaleSummaryRespVO summary = new ErpSaleSummaryRespVO()
.setTodayPrice(saleStatisticsService.getSalePrice(today, null))
.setYesterdayPrice(saleStatisticsService.getSalePrice(yesterday, today))
.setMonthPrice(saleStatisticsService.getSalePrice(month, null))
.setYearPrice(saleStatisticsService.getSalePrice(year, null));
return success(summary);
}
@GetMapping("/time-summary")
@Operation(summary = "获得销售时间段统计")
@Parameter(name = "count", description = "时间段数量", example = "6")
@PreAuthorize("@ss.hasPermission('erp:statistics:query')")
public CommonResult<List<ErpSaleTimeSummaryRespVO>> getSaleTimeSummary(
@RequestParam(value = "count", defaultValue = "6") Integer count) {
List<ErpSaleTimeSummaryRespVO> summaryList = new ArrayList<>();
for (int i = count - 1; i >= 0; i--) {
LocalDateTime startTime = LocalDateTimeUtils.beginOfMonth(LocalDateTime.now().minusMonths(i));
LocalDateTime endTime = LocalDateTimeUtils.endOfMonth(startTime);
summaryList.add(new ErpSaleTimeSummaryRespVO()
.setTime(LocalDateTimeUtil.format(startTime, NORM_MONTH_PATTERN))
.setPrice(saleStatisticsService.getSalePrice(startTime, endTime)));
}
return success(summaryList);
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.purchase;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 采购全局统计 Response VO")
@Data
public class ErpPurchaseSummaryRespVO {
@Schema(description = "今日采购金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal todayPrice;
@Schema(description = "昨日采购金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
private BigDecimal yesterdayPrice;
@Schema(description = "本月采购金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal monthPrice;
@Schema(description = "今年采购金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "88888")
private BigDecimal yearPrice;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.purchase;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 采购某个时间段的统计 Response VO")
@Data
public class ErpPurchaseTimeSummaryRespVO {
@Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-03")
private String time;
@Schema(description = "采购金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal price;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 销售全局统计 Response VO")
@Data
public class ErpSaleSummaryRespVO {
@Schema(description = "今日销售金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal todayPrice;
@Schema(description = "昨日销售金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "888")
private BigDecimal yesterdayPrice;
@Schema(description = "本月销售金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal monthPrice;
@Schema(description = "今年销售金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "88888")
private BigDecimal yearPrice;
}

View File

@ -0,0 +1,18 @@
package cn.iocoder.yudao.module.erp.controller.admin.statistics.vo.sale;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 销售某个时间段的统计 Response VO")
@Data
public class ErpSaleTimeSummaryRespVO {
@Schema(description = "时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-03")
private String time;
@Schema(description = "销售金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private BigDecimal price;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.erp.dal.mysql.statistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 采购统计 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpPurchaseStatisticsMapper {
BigDecimal getPurchasePrice(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.erp.dal.mysql.statistics;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 销售统计 Mapper
*
* @author 芋道源码
*/
@Mapper
public interface ErpSaleStatisticsMapper {
BigDecimal getSalePrice(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
}

View File

@ -164,7 +164,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
throw exception(approve ? PURCHASE_IN_APPROVE_FAIL : PURCHASE_IN_PROCESS_FAIL);
}
// 1.3 校验已付款
if (approve && purchaseIn.getPaymentPrice().compareTo(BigDecimal.ZERO) > 0) {
if (!approve && purchaseIn.getPaymentPrice().compareTo(BigDecimal.ZERO) > 0) {
throw exception(PURCHASE_IN_PROCESS_FAIL_EXISTS_PAYMENT);
}

View File

@ -160,7 +160,7 @@ public class ErpPurchaseReturnServiceImpl implements ErpPurchaseReturnService {
throw exception(approve ? PURCHASE_RETURN_APPROVE_FAIL : PURCHASE_RETURN_PROCESS_FAIL);
}
// 1.3 校验已退款
if (approve && purchaseReturn.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) {
if (!approve && purchaseReturn.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) {
throw exception(PURCHASE_RETURN_PROCESS_FAIL_EXISTS_REFUND);
}

View File

@ -172,7 +172,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
throw exception(approve ? SALE_OUT_APPROVE_FAIL : SALE_OUT_PROCESS_FAIL);
}
// 1.3 校验已退款
if (approve && saleOut.getReceiptPrice().compareTo(BigDecimal.ZERO) > 0) {
if (!approve && saleOut.getReceiptPrice().compareTo(BigDecimal.ZERO) > 0) {
throw exception(SALE_OUT_PROCESS_FAIL_EXISTS_RECEIPT);
}

View File

@ -172,7 +172,7 @@ public class ErpSaleReturnServiceImpl implements ErpSaleReturnService {
throw exception(approve ? SALE_RETURN_APPROVE_FAIL : SALE_RETURN_PROCESS_FAIL);
}
// 1.3 校验已退款
if (approve && saleReturn.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) {
if (!approve && saleReturn.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) {
throw exception(SALE_RETURN_PROCESS_FAIL_EXISTS_REFUND);
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.service.statistics;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 采购统计 Service 接口
*
* @author 芋道源码
*/
public interface ErpPurchaseStatisticsService {
/**
* 获得采购金额
*
* 计算逻辑采购出库的金额 - 采购退货的金额
*
* @param beginTime >= 开始时间
* @param endTime < 结束时间
* @return 采购金额
*/
BigDecimal getPurchasePrice(LocalDateTime beginTime, LocalDateTime endTime);
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.erp.service.statistics;
import cn.iocoder.yudao.module.erp.dal.mysql.statistics.ErpPurchaseStatisticsMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 采购统计 Service 实现类
*
* @author 芋道源码
*/
@Service
public class ErpPurchaseStatisticsServiceImpl implements ErpPurchaseStatisticsService {
@Resource
private ErpPurchaseStatisticsMapper purchaseStatisticsMapper;
@Override
public BigDecimal getPurchasePrice(LocalDateTime beginTime, LocalDateTime endTime) {
return purchaseStatisticsMapper.getPurchasePrice(beginTime, endTime);
}
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.erp.service.statistics;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 销售统计 Service 接口
*
* @author 芋道源码
*/
public interface ErpSaleStatisticsService {
/**
* 获得销售金额
*
* 计算逻辑销售出库的金额 - 销售退货的金额
*
* @param beginTime >= 开始时间
* @param endTime < 结束时间
* @return 销售金额
*/
BigDecimal getSalePrice(LocalDateTime beginTime, LocalDateTime endTime);
}

View File

@ -0,0 +1,26 @@
package cn.iocoder.yudao.module.erp.service.statistics;
import cn.iocoder.yudao.module.erp.dal.mysql.statistics.ErpSaleStatisticsMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
* ERP 销售统计 Service 实现类
*
* @author 芋道源码
*/
@Service
public class ErpSaleStatisticsServiceImpl implements ErpSaleStatisticsService {
@Resource
private ErpSaleStatisticsMapper saleStatisticsMapper;
@Override
public BigDecimal getSalePrice(LocalDateTime beginTime, LocalDateTime endTime) {
return saleStatisticsMapper.getSalePrice(beginTime, endTime);
}
}

View File

@ -1,12 +0,0 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.finance.ErpAccountMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -1,12 +0,0 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.product.ErpProductUnitMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -1,12 +0,0 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.sale.ErpCustomerMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,23 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.statistics.ErpPurchaseStatisticsMapper">
<select id="getPurchasePrice" resultType="java.math.BigDecimal">
SELECT
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_purchase_in
WHERE in_time >= #{beginTime}
<if test="endTime != null">
AND in_time &lt; #{endTime}
</if>
AND deleted = 0) -
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_purchase_return
WHERE return_time >= #{beginTime}
<if test="endTime != null">
AND return_time &lt; #{endTime}
</if>
AND deleted = 0)
</select>
</mapper>

View File

@ -0,0 +1,23 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.statistics.ErpSaleStatisticsMapper">
<select id="getSalePrice" resultType="java.math.BigDecimal">
SELECT
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_sale_out
WHERE out_time >= #{beginTime}
<if test="endTime != null">
AND out_time &lt; #{endTime}
</if>
AND deleted = 0) -
(SELECT IFNULL(SUM(total_price), 0)
FROM erp_sale_return
WHERE return_time >= #{beginTime}
<if test="endTime != null">
AND return_time &lt; #{endTime}
</if>
AND deleted = 0)
</select>
</mapper>

View File

@ -1,12 +0,0 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpWarehouseMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -1,12 +0,0 @@
<?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="cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpSupplierMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -39,7 +39,6 @@ public class MemberStatisticsController {
@Resource
private ApiAccessLogStatisticsService apiAccessLogStatisticsService;
// TODO 芋艿已经 review
@GetMapping("/summary")
@Operation(summary = "获得会员统计(实时统计)")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")
@ -47,7 +46,6 @@ public class MemberStatisticsController {
return success(memberStatisticsService.getMemberSummary());
}
// TODO 芋艿已经 review
@GetMapping("/analyse")
@Operation(summary = "获得会员分析数据")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")
@ -76,7 +74,6 @@ public class MemberStatisticsController {
return success(MemberStatisticsConvert.INSTANCE.convert(visitUserCount, orderUserCount, payUserCount, atv, comparisonData));
}
// TODO 芋艿已经 review
@GetMapping("/area-statistics-list")
@Operation(summary = "按照省份,获得会员统计列表")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")
@ -84,7 +81,6 @@ public class MemberStatisticsController {
return success(memberStatisticsService.getMemberAreaStatisticsList());
}
// TODO 芋艿已经 review
@GetMapping("/sex-statistics-list")
@Operation(summary = "按照性别,获得会员统计列表")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")
@ -92,7 +88,6 @@ public class MemberStatisticsController {
return success(memberStatisticsService.getMemberSexStatisticsList());
}
// TODO 芋艿已经 review
@GetMapping("/terminal-statistics-list")
@Operation(summary = "按照终端,获得会员统计列表")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")
@ -100,7 +95,6 @@ public class MemberStatisticsController {
return success(memberStatisticsService.getMemberTerminalStatisticsList());
}
// TODO 芋艿已经 review
// TODO @疯狂要注意 date 的排序
@GetMapping("/user-count-comparison")
@Operation(summary = "获得用户数量对照")
@ -109,7 +103,6 @@ public class MemberStatisticsController {
return success(memberStatisticsService.getUserCountComparison());
}
// TODO 芋艿已经 review
@GetMapping("/register-count-list")
@Operation(summary = "获得会员注册数量列表")
@PreAuthorize("@ss.hasPermission('statistics:member:query')")

View File

@ -16,12 +16,10 @@ import java.time.LocalDateTime;
@SuppressWarnings("rawtypes")
public interface ApiAccessLogStatisticsMapper extends BaseMapperX {
// TODO 芋艿已经 review
Integer selectIpCountByUserTypeAndCreateTimeBetween(@Param("userType") Integer userType,
@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Integer selectUserCountByUserTypeAndCreateTimeBetween(@Param("userType") Integer userType,
@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);

View File

@ -20,20 +20,15 @@ import java.util.List;
@SuppressWarnings("rawtypes")
public interface MemberStatisticsMapper extends BaseMapperX {
// TODO @芋艿已经 review
List<MemberAreaStatisticsRespBO> selectSummaryListByAreaId();
// TODO @芋艿已经 review
List<MemberSexStatisticsRespVO> selectSummaryListBySex();
// TODO @芋艿已经 review
List<MemberTerminalStatisticsRespVO> selectSummaryListByRegisterTerminal();
// TODO @芋艿已经 review
Integer selectUserCount(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO @芋艿已经 review
/**
* 获得用户的每天注册数量列表
*

View File

@ -17,27 +17,22 @@ import java.time.LocalDateTime;
@SuppressWarnings("rawtypes")
public interface PayWalletStatisticsMapper extends BaseMapperX {
// TODO 芋艿已经 review
WalletSummaryRespBO selectRechargeSummaryByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime,
@Param("payStatus") Boolean payStatus);
// TODO 芋艿已经 review
WalletSummaryRespBO selectRechargeSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime,
@Param("refundStatus") Integer refundStatus);
// TODO 芋艿已经 review
Integer selectPriceSummaryByBizTypeAndCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime,
@Param("bizType") Integer bizType);
// TODO 芋艿已经 review
RechargeSummaryRespBO selectRechargeSummaryGroupByWalletId(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime,
@Param("payStatus") Boolean payStatus);
// TODO 芋艿已经 review
Integer selectRechargePriceSummary(@Param("payStatus") Integer payStatus);
}

View File

@ -16,11 +16,9 @@ import java.time.LocalDateTime;
@Mapper
public interface AfterSaleStatisticsMapper extends BaseMapperX<TradeStatisticsDO> {
// TODO 芋艿 review
AfterSaleSummaryRespBO selectSummaryByRefundTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Long selectCountByStatus(@Param("status") Integer status);
}

View File

@ -15,13 +15,11 @@ import java.time.LocalDateTime;
@Mapper
public interface BrokerageStatisticsMapper extends BaseMapperX<TradeStatisticsDO> {
// TODO 芋艿已经 review
Integer selectSummaryPriceByStatusAndUnfreezeTimeBetween(@Param("bizType") Integer bizType,
@Param("status") Integer status,
@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Long selectWithdrawCountByStatus(@Param("status") Integer status);
}

View File

@ -19,30 +19,23 @@ import java.util.List;
@Mapper
public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsDO> {
// TODO 芋艿已经 review
List<MemberAreaStatisticsRespBO> selectSummaryListByAreaId();
// TODO 芋艿已经 review
Integer selectCountByCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Integer selectCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Integer selectSummaryPriceByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Integer selectUserCountByCreateTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
Integer selectUserCountByPayTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 按照支付时间统计订单按天分组
*
@ -53,7 +46,6 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD
List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByDay(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 按照支付时间统计订单按月分组
*
@ -64,10 +56,8 @@ public interface TradeOrderStatisticsMapper extends BaseMapperX<TradeStatisticsD
List<TradeOrderTrendRespVO> selectListByPayTimeBetweenAndGroupByMonth(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO @芋艿已经 review
Long selectCountByStatusAndDeliveryType(@Param("status") Integer status, @Param("deliveryType") Integer deliveryType);
// TODO 芋艿已经 review
TradeOrderSummaryRespVO selectPaySummaryByStatusAndPayTimeBetween(@Param("status") Integer status,
@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);

View File

@ -25,17 +25,14 @@ public interface TradeStatisticsMapper extends BaseMapperX<TradeStatisticsDO> {
TradeTrendSummaryRespVO selectVoByTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO @芋艿已经 review
default List<TradeStatisticsDO> selectListByTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
return selectList(new LambdaQueryWrapperX<TradeStatisticsDO>()
.between(TradeStatisticsDO::getTime, beginTime, endTime));
}
// TODO @芋艿已经 review
Integer selectExpensePriceByTimeBetween(@Param("beginTime") LocalDateTime beginTime,
@Param("endTime") LocalDateTime endTime);
// TODO @芋艿已经 review
default TradeStatisticsDO selectByTimeBetween(LocalDateTime beginTime, LocalDateTime endTime) {
return selectOne(new LambdaQueryWrapperX<TradeStatisticsDO>()
.between(TradeStatisticsDO::getTime, beginTime, endTime));

View File

@ -9,7 +9,6 @@ import java.time.LocalDateTime;
*/
public interface ApiAccessLogStatisticsService {
// TODO 芋艿已经 review
/**
* 获取活跃用户数量
*
@ -20,7 +19,6 @@ public interface ApiAccessLogStatisticsService {
*/
Integer getUserCount(Integer userType, LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取访问用户数量
*

View File

@ -13,7 +13,6 @@ import java.util.List;
*/
public interface MemberStatisticsService {
// TODO 芋艿已经 review
/**
* 获取会员统计实时统计
*
@ -21,7 +20,6 @@ public interface MemberStatisticsService {
*/
MemberSummaryRespVO getMemberSummary();
// TODO 芋艿已经 review
/**
* 获取会员分析对照数据
*
@ -32,7 +30,6 @@ public interface MemberStatisticsService {
DataComparisonRespVO<MemberAnalyseDataRespVO> getMemberAnalyseComparisonData(LocalDateTime beginTime,
LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 按照省份获得会员统计列表
*
@ -40,7 +37,6 @@ public interface MemberStatisticsService {
*/
List<MemberAreaStatisticsRespVO> getMemberAreaStatisticsList();
// TODO 芋艿已经 review
/**
* 按照性别获得会员统计列表
*
@ -55,7 +51,6 @@ public interface MemberStatisticsService {
*/
List<MemberTerminalStatisticsRespVO> getMemberTerminalStatisticsList();
// TODO 芋艿已经 review
/**
* 获取用户注册数量列表
*
@ -65,7 +60,6 @@ public interface MemberStatisticsService {
*/
List<MemberRegisterCountRespVO> getMemberRegisterCountList(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获得用户数量量统计对照
*

View File

@ -12,7 +12,6 @@ import java.time.LocalDateTime;
*/
public interface PayWalletStatisticsService {
// TODO 芋艿已经 review
/**
* 获取钱包统计
*
@ -22,7 +21,6 @@ public interface PayWalletStatisticsService {
*/
WalletSummaryRespBO getWalletSummary(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取钱包充值统计
*
@ -32,7 +30,6 @@ public interface PayWalletStatisticsService {
*/
RechargeSummaryRespBO getUserRechargeSummary(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取充值金额合计
*

View File

@ -12,7 +12,6 @@ import java.time.LocalDateTime;
*/
public interface AfterSaleStatisticsService {
// TODO 芋艿已经 review
/**
* 获取售后单统计
*
@ -22,7 +21,6 @@ public interface AfterSaleStatisticsService {
*/
AfterSaleSummaryRespBO getAfterSaleSummary(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取指定状态的售后订单数量
*

View File

@ -11,7 +11,6 @@ import java.time.LocalDateTime;
*/
public interface BrokerageStatisticsService {
// TODO 芋艿已经 review
/**
* 获取已结算的佣金金额
*
@ -21,7 +20,6 @@ public interface BrokerageStatisticsService {
*/
Integer getBrokerageSettlementPriceSummary(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取指定状态的提现记录数量
*

View File

@ -24,7 +24,6 @@ public interface TradeOrderStatisticsService {
*/
TradeOrderSummaryRespBO getOrderSummary(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取地区订单统计
*
@ -32,7 +31,6 @@ public interface TradeOrderStatisticsService {
*/
List<MemberAreaStatisticsRespBO> getSummaryListByAreaId();
// TODO 芋艿已经 review
/**
* 获取下单用户数量
*
@ -42,7 +40,6 @@ public interface TradeOrderStatisticsService {
*/
Integer getOrderUserCount(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取支付用户数量
*
@ -52,7 +49,6 @@ public interface TradeOrderStatisticsService {
*/
Integer getPayUserCount(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 获取支付金额
*
@ -69,7 +65,6 @@ public interface TradeOrderStatisticsService {
*/
Long getCountByStatusAndDeliveryType(Integer status, Integer deliveryType);
// TODO 芋艿已经 review
/**
* 交易订单销售额对照
*
@ -77,7 +72,6 @@ public interface TradeOrderStatisticsService {
*/
DataComparisonRespVO<TradeOrderSummaryRespVO> getOrderComparison();
// TODO 芋艿已经 review
/**
* 获得订单量趋势统计
*

View File

@ -41,7 +41,6 @@ public interface TradeStatisticsService {
*/
List<TradeStatisticsDO> getTradeStatisticsList(LocalDateTime beginTime, LocalDateTime endTime);
// TODO 芋艿已经 review
/**
* 统计指定天数的交易数据
*
@ -49,7 +48,6 @@ public interface TradeStatisticsService {
*/
String statisticsTrade(Integer days);
// TODO 芋艿已经 review
/**
* 统计指定日期的交易数据
*
@ -58,7 +56,6 @@ public interface TradeStatisticsService {
*/
TradeSummaryRespBO getTradeSummaryByDays(int days);
// TODO 芋艿已经 review
/**
* 统计指定月份的交易数据
*

View File

@ -88,11 +88,11 @@
<!-- </dependency>-->
<!-- CRM 相关模块。默认注释,保证编译速度 -->
<!-- <dependency>-->
<!-- <groupId>cn.iocoder.boot</groupId>-->
<!-- <artifactId>yudao-module-crm-biz</artifactId>-->
<!-- <version>${revision}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-crm-biz</artifactId>
<version>${revision}</version>
</dependency>
<!-- ERP 相关模块。默认注释,保证编译速度 -->
<dependency>