huminmin
5 天以前 00ffde8ff52c62f13ab62714f5997140dd4587d0
Merge branch 'dev_New_pro' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New_pro
已添加2个文件
已重命名1个文件
已修改5个文件
已删除3个文件
292 ■■■■■ 文件已修改
src/main/java/com/ruoyi/account/bean/dto/AccountDto.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/bean/dto/AccountDto2.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/bean/dto/AccountDto3.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/controller/AccountingController.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/service/AccountingService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/controller/QualityInspectController.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/account/bean/dto/AccountDto.java
ÎļþÒÑɾ³ý
src/main/java/com/ruoyi/account/bean/dto/AccountDto2.java
ÎļþÒÑɾ³ý
src/main/java/com/ruoyi/account/bean/dto/AccountDto3.java
ÎļþÒÑɾ³ý
src/main/java/com/ruoyi/account/bean/dto/AccountReportDto.java
ÎļþÃû´Ó src/main/java/com/ruoyi/account/bean/dto/ReportDateDto.java ÐÞ¸Ä
@@ -1,17 +1,16 @@
package com.ruoyi.account.bean.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
/**
 * @author :yys
 * @date : 2026/1/16 16:57
 */
@Data
public class ReportDateDto {
@Schema(name = "AccountReportDto", description = "财务报表--日期参数")
public class AccountReportDto {
    /**
     * å¼€å§‹æ—¶é—´
@@ -26,15 +25,5 @@
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private LocalDate entryDateEnd;
    /**
     * å¼€å§‹æœˆä»½
     */
    private Integer startMonth;
    /**
     * ç»“束月份
     */
    private Integer endMonth;
}
src/main/java/com/ruoyi/account/bean/vo/AccountReportVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.ruoyi.account.bean.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.math.BigDecimal;
@Data
@Schema(name = "AccountReportVo", description = "财务报表--返回参数")
public class AccountReportVo {
    @Schema(description = "总营收")
    private BigDecimal totalIncome;
    @Schema(description = "总支出")
    private BigDecimal totalExpense;
    @Schema(description = "总收入笔数")
    private Integer incomeNumber;
    @Schema(description = "总支出笔数")
    private Integer expenseNumber;
    @Schema(description = "净收入")
    private BigDecimal netRevenue;
}
src/main/java/com/ruoyi/account/controller/AccountingController.java
@@ -1,12 +1,16 @@
package com.ruoyi.account.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.service.impl.AccountingServiceImpl;
import com.ruoyi.account.bean.dto.AccountReportDto;
import com.ruoyi.account.service.AccountingService;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.ruoyi.framework.web.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import lombok.AllArgsConstructor;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -19,11 +23,11 @@
@Tag(name = "会计核算")
@RestController
@RequestMapping("/accounting")
@AllArgsConstructor
@RequiredArgsConstructor
public class AccountingController extends BaseController {
    private AccountingServiceImpl accountingService;
    private final AccountingService accountingService;
    @Operation(summary = "总计")
    @GetMapping("/total")
@@ -43,4 +47,14 @@
        return accountingService.calculateDepreciation(page,year);
    }
    /*****************************************财务报表******************************************************************************/
    @GetMapping("/accountStatementDetailsByMonth")
    @Log(title = "统计总应收+总支出+总收入笔数+总支出笔数+净收入", businessType = BusinessType.OTHER)
    @Operation(summary = "财务报表--统计总应收+总支出+总收入笔数+总支出笔数+净收入")
    public R getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
        return R.ok(accountingService.getAccountStatementDetailsByMonth(accountReportDto));
    }
}
src/main/java/com/ruoyi/account/service/AccountingService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.ruoyi.account.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.bean.dto.AccountReportDto;
import com.ruoyi.account.bean.vo.AccountReportVo;
import com.ruoyi.framework.web.domain.AjaxResult;
public interface AccountingService {
    AjaxResult total(Integer year);
    AjaxResult deviceTypeDistribution(Integer year);
    AjaxResult calculateDepreciation(Page page, Integer year);
    AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto);
}
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
@@ -3,9 +3,17 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.bean.dto.AccountReportDto;
import com.ruoyi.account.bean.dto.DeviceTypeDetail;
import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
import com.ruoyi.account.bean.vo.AccountReportVo;
import com.ruoyi.account.mapper.purchase.AccountPurchasePaymentMapper;
import com.ruoyi.account.mapper.sales.AccountSalesCollectionMapper;
import com.ruoyi.account.pojo.purchase.AccountPurchasePayment;
import com.ruoyi.account.pojo.sales.AccountSalesCollection;
import com.ruoyi.account.service.AccountingService;
import com.ruoyi.device.mapper.DeviceLedgerMapper;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.framework.web.domain.AjaxResult;
@@ -33,13 +41,17 @@
@Service
@Slf4j
@RequiredArgsConstructor
public class AccountingServiceImpl {
public class AccountingServiceImpl implements AccountingService {
    private final DeviceLedgerMapper deviceLedgerMapper;
    private final CustomStorageMapper customStorageMapper;
    private final ProcurementRecordMapper procurementRecordMapper;
    private final ProcurementRecordOutMapper procurementRecordOutMapper;
    private final AccountSalesCollectionMapper accountSalesCollectionMapper;
    private final AccountPurchasePaymentMapper accountPurchasePaymentMapper;
    @Override
    public AjaxResult total(Integer year) {
        Map<String,Object> map = new HashMap<>();
        map.put("deprAmount",0); // æŠ˜æ—§é‡‘额
@@ -233,6 +245,7 @@
        return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
    @Override
    public AjaxResult deviceTypeDistribution(Integer year) {
        // 2. ç»„装返回VO
       DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
@@ -256,6 +269,7 @@
        return AjaxResult.success(vo);
    }
    @Override
    public AjaxResult calculateDepreciation(Page page, Integer year) {
        LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
        deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
@@ -267,4 +281,24 @@
        }
        return AjaxResult.success(deviceLedgerIPage);
    }
    @Override
    public AccountReportVo getAccountStatementDetailsByMonth(AccountReportDto accountReportDto) {
        AccountReportVo accountReportVo = new AccountReportVo();
        //总营收=收款单总金额
        //总收入笔数=收款单总笔数
        List<AccountSalesCollection> accountSalesCollections = accountSalesCollectionMapper.selectList(Wrappers.<AccountSalesCollection>lambdaQuery()
                .between(AccountSalesCollection::getCollectionDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
        accountReportVo.setTotalIncome(accountSalesCollections.stream().map(AccountSalesCollection::getCollectionAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
        accountReportVo.setIncomeNumber(accountSalesCollections.size());
        //总支出=付款单总金额
        //总支出笔数=付款单总笔数
        List<AccountPurchasePayment> accountPurchasePayments = accountPurchasePaymentMapper.selectList(Wrappers.<AccountPurchasePayment>lambdaQuery()
                .between(AccountPurchasePayment::getPaymentDate, accountReportDto.getEntryDateStart(), accountReportDto.getEntryDateEnd()));
        accountReportVo.setTotalExpense(accountPurchasePayments.stream().map(AccountPurchasePayment::getPaymentAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
        accountReportVo.setExpenseNumber(accountPurchasePayments.size());
        //净利润=总营收-总支出
        accountReportVo.setNetRevenue(accountReportVo.getTotalIncome().subtract(accountReportVo.getTotalExpense()));
        return accountReportVo;
    }
}
src/main/java/com/ruoyi/quality/controller/QualityInspectController.java
@@ -14,7 +14,6 @@
import com.ruoyi.quality.service.IQualityInspectService;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -139,7 +138,7 @@
    @PostMapping("/submit")
    @Operation(summary = "提交检验")
    @Log(title = "提交检验", businessType = BusinessType.OTHER)
    public R<?> submit(@Valid @RequestBody QualityInspect qualityInspect) {
    public R<?> submit(@RequestBody QualityInspect qualityInspect) {
        return R.ok(qualityInspectService.submit(qualityInspect));
    }
src/main/java/com/ruoyi/quality/pojo/QualityInspect.java
@@ -5,7 +5,6 @@
import com.ruoyi.dto.DateQueryDto;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
@@ -34,7 +33,6 @@
     * ç±»åˆ«(0:原材料检验;1:过程检验;2:出厂检验)
     */
    @Excel(name = "类别",readConverterExp = "0=原材料检验,1=过程检验,2=出厂检验")
    @NotNull(message = "类别不能为空")
    private Integer inspectType;
    /**
@@ -74,7 +72,6 @@
    /**
     * å…³è”产品id
     */
    @NotNull(message = "产品id不能为空")
    private Long productId;
    /**
@@ -103,12 +100,10 @@
    @Excel(name = "合格数量")
    @TableField("qualified_quantity")
    @NotNull(message = "合格数量不能为空")
    private BigDecimal qualifiedQuantity;
    @Excel(name = "不合格数量")
    @TableField("unqualified_quantity")
    @NotNull(message = "不合格数量不能为空")
    private BigDecimal unqualifiedQuantity;
    /**
src/main/java/com/ruoyi/quality/service/impl/QualityInspectServiceImpl.java
@@ -10,6 +10,7 @@
import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.config.Configure;
import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.HackLoopTableRenderPolicy;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.procurementrecord.service.ProcurementRecordService;
@@ -90,24 +91,32 @@
    @Override
    public int submit(QualityInspect inspect) {
        QualityInspect qualityInspect = qualityInspectMapper.selectById(inspect.getId());
        //提交前必须判断是否合格
        if (ObjectUtils.isNull(qualityInspect.getCheckResult())) {
            throw new RuntimeException("请先判断是否合格");
            throw new ServiceException("请先判断是否合格");
        }
        if (ObjectUtils.isNull(qualityInspect.getQualifiedQuantity())) {
            throw new RuntimeException("合格数量不能为空");
            throw new ServiceException("合格数量不能为空");
        }
        if (ObjectUtils.isNull(qualityInspect.getUnqualifiedQuantity())) {
            throw new RuntimeException("不合格数量不能为空");
            throw new ServiceException("不合格数量不能为空");
        }
        // åŒºåˆ†åˆæ ¼æ•°é‡ä»¥åŠä¸åˆæ ¼å¤„理进行对应的处理
        Assert.isTrue(qualityInspect.getQuantity().compareTo(qualityInspect.getQualifiedQuantity().add(qualityInspect.getUnqualifiedQuantity())) == 0,"请检查合格数量和不合格数量,需要合格数量+不合格数量与总数保持一致");
        // å¦‚果合格数量为空,设为0
        if (qualityInspect.getQualifiedQuantity() == null) {
            qualityInspect.setQualifiedQuantity(BigDecimal.ZERO);
        }
        // å¦‚果不合格数量为空,设为0
        if (qualityInspect.getUnqualifiedQuantity() == null) {
            qualityInspect.setUnqualifiedQuantity(BigDecimal.ZERO);
        }
        // åˆæ ¼ç›´æŽ¥å…¥åº“
        if(qualityInspect.getQualifiedQuantity().compareTo(BigDecimal.ZERO) > 0){
            //合格直接入库
            // stockUtils.addStock(qualityInspect.getProductModelId(), qualityInspect.getQuantity(), StockInQualifiedRecordTypeEnum.QUALITYINSPECT_STOCK_IN.getCode(), qualityInspect.getId());
            //仅添加入库记录
            StockInventoryDto stockInventoryDto = new StockInventoryDto();
            //如果是采购质检合格入库选用CUSTOMIZATION_UNSTOCK_OUT,其余合格入库选用QUALITYINSPECT_STOCK_IN
@@ -124,6 +133,7 @@
                    qualityInspect.getProductModelId()));
            stockInventoryService.addStockInRecordOnly(stockInventoryDto);
        }
        // ä¸åˆæ ¼å¤„理
        if(qualityInspect.getUnqualifiedQuantity().compareTo(BigDecimal.ZERO) > 0){
            QualityUnqualified qualityUnqualified = new QualityUnqualified();
            BeanUtils.copyProperties(qualityInspect, qualityUnqualified);