yys
maven
3 天以前 abe25fd4ae6f6c3c928682d5de15a0e1ed8b7654
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -3,7 +3,11 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ruoyi.approve.mapper.ApproveProcessMapper;
import com.ruoyi.approve.pojo.ApproveProcess;
import com.ruoyi.collaborativeApproval.mapper.NoticeMapper;
import com.ruoyi.collaborativeApproval.pojo.Notice;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.device.mapper.DeviceRepairMapper;
import com.ruoyi.device.pojo.DeviceRepair;
import com.ruoyi.dto.MapDto;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.home.dto.*;
@@ -129,7 +133,7 @@
        }
        LambdaQueryWrapper<SalesLedgerProduct> salesLedgerProductMapperLambdaQueryWrapperCopy = new LambdaQueryWrapper<SalesLedgerProduct>();
        salesLedgerProductMapperLambdaQueryWrapper.eq(SalesLedgerProduct::getType, 2)
        salesLedgerProductMapperLambdaQueryWrapperCopy.eq(SalesLedgerProduct::getType, 2)
                .in(SalesLedgerProduct::getSalesLedgerId, purchaseLedgers.stream().map(PurchaseLedger::getId).collect(Collectors.toList()));
        List<SalesLedgerProduct> salesLedgerProductsCopy = salesLedgerProductMapper.selectList(salesLedgerProductMapperLambdaQueryWrapperCopy);
        // 合计合同金额
@@ -137,9 +141,9 @@
                .map(PurchaseLedger::getContractAmount)
                .filter(Objects::nonNull)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        // 未开票金额
        // 未来票金额
        BigDecimal unReceiptPaymentAmount = salesLedgerProductsCopy.stream()
                .map(SalesLedgerProduct::getNoInvoiceAmount)
                .map(SalesLedgerProduct::getFutureTicketsAmount)
                .filter(Objects::nonNull)
                .reduce(BigDecimal.ZERO, BigDecimal::add);
@@ -426,4 +430,36 @@
        return statisticsReceivablePayableDto;
    }
    @Autowired
    private DeviceRepairMapper deviceRepairMapper;
    @Autowired
    private NoticeMapper noticeMapper;
    @Override
    public Map<String, Object> approveAndDeviceTodos() {
        // 审批协同待办
        Long aLong = approveProcessMapper.selectCount(new LambdaQueryWrapper<ApproveProcess>()
                .eq(ApproveProcess::getApproveUserCurrentId, SecurityUtils.getUserId())
                .eq(ApproveProcess::getApproveDelete, 0)
                .in(ApproveProcess::getApproveStatus, 0, 1, 3));
        // 设备报修待办
        Long aLong1 = deviceRepairMapper.selectCount(new LambdaQueryWrapper<DeviceRepair>()
                .eq(DeviceRepair::getStatus, 0)
                .eq(DeviceRepair::getRepairName, SecurityUtils.getLoginUser().getNickName()));
        return new HashMap<String, Object>() {{
            put("approveTodo", aLong);
            put("deviceRepairTodo", aLong1);
        }};
    }
    @Override
    public Long noticesCount() {
        // 查询未过期的通知数量:状态为发布且过期时间大于等于当前日期
        return noticeMapper.selectCount(new LambdaQueryWrapper<Notice>()
                .eq(Notice::getStatus, 1) // 1表示发布状态
                .ge(Notice::getExpirationDate, new Date())); // 过期时间大于等于当前日期
    }
}