同步最新 ERP 代码

This commit is contained in:
YunaiV 2024-02-27 16:33:01 +08:00
parent e0ac8a28cb
commit 2370ad6ff3
44 changed files with 475 additions and 111 deletions

View File

@ -220,7 +220,7 @@
![功能图](/.image/common/mall-preview.png) ![功能图](/.image/common/mall-preview.png)
演示地址:<https://doc.iocoder.cn/mall-preview/> 演示地址:<https://cloud.iocoder.cn/mall-preview/>
### 会员中心 ### 会员中心
@ -236,13 +236,13 @@
![功能图](/.image/common/erp-feature.png) ![功能图](/.image/common/erp-feature.png)
演示地址:<https://doc.iocoder.cn/erp-preview/> 演示地址:<https://cloud.iocoder.cn/erp-preview/>
### ERP 系统 ### ERP 系统
![功能图](/.image/common/crm-feature.png) ![功能图](/.image/common/crm-feature.png)
演示地址:<https://doc.iocoder.cn/crm-preview/> 演示地址:<https://cloud.iocoder.cn/crm-preview/>
## 🐨 技术栈 ## 🐨 技术栈

View File

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product; package cn.iocoder.yudao.module.erp.controller.admin.product.vo.product;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

View File

@ -1,14 +1,10 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer; package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal; import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.format.annotation.DateTimeFormat; import lombok.Data;
import java.time.LocalDateTime; import lombok.EqualsAndHashCode;
import lombok.ToString;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - ERP 客户分页 Request VO") @Schema(description = "管理后台 - ERP 客户分页 Request VO")
@Data @Data

View File

@ -1,15 +1,14 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer; package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - ERP 客户 Response VO") @Schema(description = "管理后台 - ERP 客户 Response VO")
@Data @Data

View File

@ -1,9 +1,10 @@
package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer; package cn.iocoder.yudao.module.erp.controller.admin.sale.vo.customer;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import jakarta.validation.constraints.NotEmpty;
import java.util.*; import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.*; import lombok.Data;
import java.math.BigDecimal; import java.math.BigDecimal;
@Schema(description = "管理后台 - ERP 客户新增/修改 Request VO") @Schema(description = "管理后台 - ERP 客户新增/修改 Request VO")

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

@ -12,10 +12,10 @@ import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProduc
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInPageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInRespVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.in.ErpStockInSaveReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpStockInItemDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import cn.iocoder.yudao.module.erp.service.product.ErpProductService; import cn.iocoder.yudao.module.erp.service.product.ErpProductService;
import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService; import cn.iocoder.yudao.module.erp.service.purchase.ErpSupplierService;
import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService; import cn.iocoder.yudao.module.erp.service.stock.ErpStockInService;

View File

@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.ErpWarehouseSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseRespVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.erp.controller.admin.stock.vo; package cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;

View File

@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.erp.dal.dataobject.product; package cn.iocoder.yudao.module.erp.dal.dataobject.product;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/** /**
* ERP 产品单位 DO * ERP 产品单位 DO

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.erp.dal.mysql.product; package cn.iocoder.yudao.module.erp.dal.mysql.product;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.product.ErpProductPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.erp.dal.mysql.product; package cn.iocoder.yudao.module.erp.dal.mysql.product;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.product.vo.unit.ErpProductUnitPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO; import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductUnitDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.erp.dal.mysql.purchase; package cn.iocoder.yudao.module.erp.dal.mysql.purchase;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.supplier.ErpSupplierPageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO; import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpSupplierDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

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

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.erp.dal.mysql.stock; package cn.iocoder.yudao.module.erp.dal.mysql.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -13,6 +13,6 @@ public interface RedisKeyConstants {
* KEY 格式trade_no:{prefix} * KEY 格式trade_no:{prefix}
* VALUE 数据格式编号自增 * VALUE 数据格式编号自增
*/ */
String NO = "seq_no:"; String NO = "erp:seq_no:";
} }

View File

@ -12,7 +12,7 @@ import java.time.LocalDateTime;
/** /**
* 订单序号的 Redis DAO * Erp 订单序号的 Redis DAO
* *
* @author HUIHUI * @author HUIHUI
*/ */

View File

@ -15,7 +15,8 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.ACCOUNT_NOT_ENABLE;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.ACCOUNT_NOT_EXISTS;
/** /**
* ERP 结算账户 Service 实现类 * ERP 结算账户 Service 实现类

View File

@ -16,11 +16,16 @@ import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.PRODUCT_NOT_ENABLE;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.PRODUCT_NOT_EXISTS;
/** /**
* ERP 产品 Service 实现类 * ERP 产品 Service 实现类

View File

@ -164,7 +164,7 @@ public class ErpPurchaseInServiceImpl implements ErpPurchaseInService {
throw exception(approve ? PURCHASE_IN_APPROVE_FAIL : PURCHASE_IN_PROCESS_FAIL); throw exception(approve ? PURCHASE_IN_APPROVE_FAIL : PURCHASE_IN_PROCESS_FAIL);
} }
// 1.3 校验已付款 // 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); 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); throw exception(approve ? PURCHASE_RETURN_APPROVE_FAIL : PURCHASE_RETURN_PROCESS_FAIL);
} }
// 1.3 校验已退款 // 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); throw exception(PURCHASE_RETURN_PROCESS_FAIL_EXISTS_REFUND);
} }

View File

@ -15,7 +15,8 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.SUPPLIER_NOT_ENABLE;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.SUPPLIER_NOT_EXISTS;
/** /**
* ERP 供应商 Service 实现类 * ERP 供应商 Service 实现类

View File

@ -172,7 +172,7 @@ public class ErpSaleOutServiceImpl implements ErpSaleOutService {
throw exception(approve ? SALE_OUT_APPROVE_FAIL : SALE_OUT_PROCESS_FAIL); throw exception(approve ? SALE_OUT_APPROVE_FAIL : SALE_OUT_PROCESS_FAIL);
} }
// 1.3 校验已退款 // 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); 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); throw exception(approve ? SALE_RETURN_APPROVE_FAIL : SALE_RETURN_PROCESS_FAIL);
} }
// 1.3 校验已退款 // 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); 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,7 +1,7 @@
package cn.iocoder.yudao.module.erp.service.stock; package cn.iocoder.yudao.module.erp.service.stock;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.ErpWarehouseSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;

View File

@ -4,9 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.ErpWarehouseSaveReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehouseSaveReqVO;
import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO; import cn.iocoder.yudao.module.erp.controller.admin.stock.vo.warehouse.ErpWarehousePageReqVO;
import cn.iocoder.yudao.module.erp.dal.dataobject.product.ErpProductDO;
import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO; import cn.iocoder.yudao.module.erp.dal.dataobject.stock.ErpWarehouseDO;
import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpWarehouseMapper; import cn.iocoder.yudao.module.erp.dal.mysql.stock.ErpWarehouseMapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@ -21,7 +20,8 @@ import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.WAREHOUSE_NOT_ENABLE;
import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.WAREHOUSE_NOT_EXISTS;
/** /**
* ERP 仓库 Service 实现类 * ERP 仓库 Service 实现类

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>