huminmin
昨天 569483bbc66ad0b141fe946b2c19c0de83bccba4
Merge branch 'dev_New' of http://114.132.189.42:9002/r/product-inventory-management-after into dev_New
已修改2个文件
54 ■■■■ 文件已修改
src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ruoyi/purchase/service/impl/ProductRecordServiceImpl.java
@@ -80,37 +80,55 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public AjaxResult updateRecord(ProductRecordDto productRecordDto) {
        SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecordDto.getSaleLedgerProjectId());
        ProductRecord productRecord = productRecordMapper.selectById(productRecordDto.getId());
        if (productRecord == null) return AjaxResult.error("记录不存在");
        //  更新产品台账
        SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(productRecord.getSaleLedgerProjectId());
        if (salesLedgerProduct != null) {
            salesLedgerProduct.setFutureTicketsAmount(salesLedgerProduct.getFutureTicketsAmount().add(productRecord.getTicketsAmount()).subtract(productRecordDto.getTicketsAmount()));
            salesLedgerProduct.setFutureTickets(salesLedgerProduct.getFutureTickets().add(productRecord.getTicketsNum().subtract(productRecordDto.getTicketsNum())));
            // 未来票金额 = 原未来票金额 + 旧行金额 - 新行金额
            BigDecimal futureTicketsAmount = salesLedgerProduct.getFutureTicketsAmount()
                    .add(productRecord.getTicketsAmount())
                    .subtract(productRecordDto.getTicketsAmount());
            salesLedgerProduct.setFutureTicketsAmount(futureTicketsAmount);
            // 未来票数 = 原未来票数 + 旧行数量 - 新行数量
            BigDecimal futureTickets = salesLedgerProduct.getFutureTickets()
                    .add(productRecord.getTicketsNum())
                    .subtract(productRecordDto.getTicketsNum());
            salesLedgerProduct.setFutureTickets(futureTickets);
            // 更新产品表本次数值
            salesLedgerProduct.setTicketsAmount(productRecordDto.getTicketsAmount());
            salesLedgerProduct.setTicketsNum(productRecordDto.getTicketsNum());
            salesLedgerProductMapper.updateById(salesLedgerProduct);
        }
        PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(productRecord.getPurchaseLedgerId());
        if (purchaseLedger != null) {
            purchaseLedger.setReceiptPaymentAmount(purchaseLedger.getReceiptPaymentAmount());
        }
        // 修改发票号
        //  更新来票登记
        TicketRegistration ticketRegistration = ticketRegistrationMapper.selectById(productRecord.getTicketRegistrationId());
        if(ticketRegistration != null){
        if (ticketRegistration != null) {
            // 金额 = 新金额 - 旧金额
            BigDecimal amountDiff = productRecordDto.getTicketsAmount().subtract(productRecord.getTicketsAmount());
            // 总金额 = 原总金额 + 差值
            ticketRegistration.setInvoiceAmount(ticketRegistration.getInvoiceAmount().add(amountDiff));
            // 更新发票号
            ticketRegistration.setInvoiceNumber(productRecordDto.getInvoiceNumber());
            ticketRegistration.setInvoiceAmount(productRecordDto.getTicketsAmount());
            ticketRegistrationMapper.updateById(ticketRegistration);
        }
        BeanUtils.copyProperties(productRecordDto,productRecord);
        BeanUtils.copyProperties(productRecordDto, productRecord);
        // 重新计算未来票金额(根据剩余票数 * 单价)
        productRecord.setFutureTicketsAmount(productRecord.getFutureTickets().multiply(productRecord.getTaxInclusiveUnitPrice()));
        productRecordMapper.updateById(productRecord);
        return AjaxResult.success("修改成功");
    }
     @Override
    @Override
    public ProductRecordDto getProductRecordById(ProductRecordDto productRecordDto) {
        List<ProductRecordDto> productRecordDtoList = productRecordMapper.getProductRecordById(productRecordDto);
        if(CollectionUtils.isNotEmpty(productRecordDtoList)){
        if (CollectionUtils.isNotEmpty(productRecordDtoList)) {
            ProductRecordDto productRecordDto1 = productRecordDtoList.stream()
                    .filter(item -> item.getId().equals(productRecordDto.getId()))
                    .findFirst()
@@ -121,7 +139,7 @@
                    .filter(item -> item.getProductModelId().equals(productRecordDto.getProductModelId()))
                    .map(ProductRecordDto::getTicketsNum)
                    .reduce(BigDecimal.ZERO, BigDecimal::add);
            if(productRecordDto1 != null){
            if (productRecordDto1 != null) {
                productRecordDto1.setFutureTickets(productRecordDto1.getQuantity().subtract(reduce));
                productRecordDto1.setFutureTicketsAmount(productRecordDto1.getFutureTickets().multiply(productRecordDto1.getTaxInclusiveUnitPrice()));
            }
src/main/java/com/ruoyi/staff/service/impl/PersonalAttendanceRecordsServiceImpl.java
@@ -71,6 +71,7 @@
        /*查询员工信息*/
        QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>();
        staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername());
        staffQueryWrapper.eq("staff_state", 1);//在职
        StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper);
        if (staffOnJob == null) {
            throw new BaseException("当前用户没有对应的员工信息");
@@ -107,8 +108,8 @@
        int actualHour = currentDateTime.getHour();
        int actualMinute = currentDateTime.getMinute();
        // 判断打卡时间是否晚于当前时间
        if (actualHour > standardHour || (actualHour == standardHour && actualMinute > standardMinute)) {
            throw new BaseException(String.format("打卡失败:打卡时间不能晚于下班时间(%02d:%02d)", standardHour, standardMinute));
        if (actualHour < standardHour || (actualHour == standardHour && actualMinute < standardMinute)) {
            throw new BaseException(String.format("打卡失败:打卡时间不能早于下班时间(%02d:%02d)", standardHour, standardMinute));
        }
        // 根据员工ID和当前日期查询打卡记录
        QueryWrapper<PersonalAttendanceRecords> attendanceQueryWrapper = new QueryWrapper<>();
@@ -194,6 +195,7 @@
        if (!admin) {
            QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>();
            staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername());
            staffQueryWrapper.eq("staff_state", 1);//在职
            StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper);
            if (staffOnJob == null) {
                return new Page<>(page.getCurrent(), page.getSize(), 0);
@@ -212,6 +214,7 @@
        // 首先根据用户ID查询员工信息
        QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>();
        staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername());
        staffQueryWrapper.eq("staff_state", 1);//在职
        StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper);
        if (staffOnJob == null) {
@@ -255,6 +258,7 @@
        if (!admin) {
            QueryWrapper<StaffOnJob> staffQueryWrapper = new QueryWrapper<>();
            staffQueryWrapper.eq("staff_no", SecurityUtils.getUsername());
            staffQueryWrapper.eq("staff_state", 1);//在职
            StaffOnJob staffOnJob = staffOnJobMapper.selectOne(staffQueryWrapper);
            if (staffOnJob == null) {
                throw new ServiceException("没有员工信息,无法导出考勤记录");