5 天以前 0d7d874912d0147376826b55667a1deb6547ed91
src/main/java/com/ruoyi/account/service/impl/AccountingServiceImpl.java
@@ -4,23 +4,21 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.account.dto.DeviceTypeDetail;
import com.ruoyi.account.dto.DeviceTypeDistributionVO;
import com.ruoyi.account.bean.dto.DeviceTypeDetail;
import com.ruoyi.account.bean.dto.DeviceTypeDistributionVO;
import com.ruoyi.account.mapper.BorrowInfoMapper;
import com.ruoyi.account.pojo.BorrowInfo;
import com.ruoyi.device.mapper.DeviceLedgerMapper;
import com.ruoyi.device.pojo.DeviceLedger;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.domain.R;
import com.ruoyi.procurementrecord.mapper.CustomStorageMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordMapper;
import com.ruoyi.procurementrecord.mapper.ProcurementRecordOutMapper;
import com.ruoyi.procurementrecord.pojo.CustomStorage;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordOut;
import com.ruoyi.procurementrecord.pojo.ProcurementRecordStorage;
import com.ruoyi.procurementrecord.service.impl.ProcurementRecordOutServiceImpl;
import com.ruoyi.procurementrecord.service.impl.ProcurementRecordServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@@ -36,24 +34,16 @@
 */
@Service
@Slf4j
@RequiredArgsConstructor
public class AccountingServiceImpl {
    @Autowired
    private DeviceLedgerMapper deviceLedgerMapper;
    private final DeviceLedgerMapper deviceLedgerMapper;
    private final BorrowInfoMapper borrowInfoMapper;
    private final CustomStorageMapper customStorageMapper;
    private final ProcurementRecordMapper procurementRecordMapper;
    private final ProcurementRecordOutMapper procurementRecordOutMapper;
    @Autowired
    private BorrowInfoMapper borrowInfoMapper;
    @Autowired
    private CustomStorageMapper customStorageMapper;
    @Autowired
    private ProcurementRecordMapper procurementRecordMapper;
    @Autowired
    private ProcurementRecordOutMapper procurementRecordOutMapper;
    public AjaxResult total(Integer year) {
    public R<?> total(Integer year) {
        Map<String,Object> map = new HashMap<>();
        map.put("deprAmount",0); // 折旧金额
        map.put("deviceTotal",0); // 设备总数
@@ -160,7 +150,7 @@
            });
        }
        map.put("inventoryValue",procurementRecordTotal.add(customStorageTotal));
        return AjaxResult.success( map);
        return R.ok(map);
    }
    /**
@@ -255,7 +245,7 @@
        return totalDepreciation.setScale(2, BigDecimal.ROUND_HALF_UP);
    }
    public AjaxResult deviceTypeDistribution(Integer year) {
    public R<?> deviceTypeDistribution(Integer year) {
        // 2. 组装返回VO
       DeviceTypeDistributionVO vo = new DeviceTypeDistributionVO();
       List<DeviceTypeDetail> details = deviceLedgerMapper.getDeviceTypeDistributionByYear( year);
@@ -275,10 +265,10 @@
                   .collect(Collectors.toList()));
           vo.setTotalCount(vo.getCategories().size());
       }
        return AjaxResult.success(vo);
        return R.ok(vo);
    }
    public AjaxResult calculateDepreciation(Page page, Integer year) {
    public R<?> calculateDepreciation(Page page, Integer year) {
        LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
        deviceLedgerLambdaQueryWrapper.like(DeviceLedger::getCreateTime,year)
                .eq(DeviceLedger::getIsDepr,1);
@@ -287,6 +277,6 @@
            record.setDeprAmount(calculatePreciseDepreciation(record));
            record.setNetValue(record.getTaxIncludingPriceTotal().subtract(record.getDeprAmount()));
        }
        return AjaxResult.success(deviceLedgerIPage);
        return R.ok(deviceLedgerIPage);
    }
}