gongchunyi
昨天 b25258e282d5a53d851a7e19132ecbc842eee7b9
src/main/java/com/ruoyi/home/service/impl/HomeServiceImpl.java
@@ -35,6 +35,7 @@
import com.ruoyi.production.mapper.ProductWorkOrderMapper;
import com.ruoyi.production.mapper.ProductionProductInputMapper;
import com.ruoyi.production.mapper.ProductionProductOutputMapper;
import com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper;
import com.ruoyi.production.pojo.ProductWorkOrder;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -128,11 +129,6 @@
    private CustomerMapper customerMapper;
    @Autowired
    private SupplierManageMapper supplierManageMapper;
    @Autowired
    private SysUserMapper sysUserMapper;
    @Autowired
    private SysUserDeptMapper sysUserDeptMapper;
    @Autowired
    private HomeMapper homeMapper;
@@ -1787,10 +1783,10 @@
    }
    @Autowired
    private com.ruoyi.production.mapper.SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
    private SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
    @Override
    public List<MapDto> productionAccountingAnalysis(Integer type) {
    public List<ProductionAccountingDto> productionAccountingAnalysis(Integer type) {
        LocalDate today = LocalDate.now();
        LocalDate startDate;
        LocalDate endDate = today;
@@ -1812,26 +1808,27 @@
                break;
        }
        String startStr = startDate.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        String endStr = endDate.atTime(LocalTime.MAX).format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        String startStr = startDate.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        List<Map<String, Object>> wagesList = salesLedgerProductionAccountingMapper.selectDailyWagesStats(startStr,
                endStr);
        String endStr = endDate.plusDays(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        List<Map<String, Object>> wagesList = salesLedgerProductionAccountingMapper.selectDailyWagesStats(startStr, endStr);
        if (CollectionUtils.isEmpty(wagesList)) {
            return new ArrayList<>();
        }
        List<MapDto> result = new ArrayList<>();
        List<ProductionAccountingDto> result = new ArrayList<>();
        for (Map<String, Object> map : wagesList) {
            MapDto dto = new MapDto();
            dto.setName((String) map.get("date"));
            BigDecimal wages = (BigDecimal) map.get("wages");
            dto.setValue(wages != null ? wages.toString() : "0");
            ProductionAccountingDto dto = new ProductionAccountingDto();
            dto.setDateStr(map.get("dateStr").toString());
            dto.setNumberOfCompleted(((BigDecimal) map.get("numberOfCompleted")).intValue());
            dto.setAmount(map.get("amount") != null ? (BigDecimal) map.get("amount") : BigDecimal.ZERO);
            dto.setPassRate(map.get("passRate") != null ? (BigDecimal) map.get("passRate") : BigDecimal.ZERO);
            result.add(dto);
        }
        result.sort(Comparator.comparing(MapDto::getName));
        result.sort(Comparator.comparing(ProductionAccountingDto::getDateStr));
        return result;
    }