Search in sources :

Example 6 with PanoramicDailyInventorySummary

use of com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary in project new-cloud by xie-summer.

the class PanoramicDailyInventorySummaryServiceImpl method saveOrUpdateRecord.

private void saveOrUpdateRecord(String date, List<PanoramicDailyInventorySummary> records, List<PanoramicDailyInventorySummary> curRecords, List<PanoramicDailyInventorySummary> summaryList) {
    if (null != records && records.size() > 0) {
        records.forEach(e -> {
            setRecordValue(date, e);
            e.setId(null);
            curRecords.add(e);
        });
    } else {
        List<PanoramicRawMaterials> rawMaterialsList = rawMaterialsService.listSummaryCategory();
        if (null != rawMaterialsList && rawMaterialsList.size() > 0) {
            rawMaterialsList.forEach((PanoramicRawMaterials e) -> {
                Double value = rawMaterialsService.summaryByCodeAndDate(e.getCode(), date);
                value = value < 0 ? 0 : value;
                PanoramicDailyInventorySummary record = getPanoramicDailyInventorySummary(value, 1);
                record.setCode(e.getCode());
                record.setName(e.getName());
                curRecords.add(record);
            });
        }
        List<PanoramicProductMaterials> categoryList = productMaterialsService.listRealTimeProductSummaryCategoryTask();
        if (null != categoryList && categoryList.size() > 0) {
            categoryList.forEach((PanoramicProductMaterials e) -> {
                Double value = productMaterialsService.summaryByCodeAndDate(e.getCode(), date);
                value = value < 0 ? 0 : value;
                PanoramicDailyInventorySummary record = getPanoramicDailyInventorySummary(value, 2);
                record.setCode(e.getCode());
                record.setName(e.getName());
                curRecords.add(record);
            });
        }
    }
    if (null == summaryList || summaryList.size() == 0) {
        dailyInventorySummaryMapper.insertList(curRecords);
    } else {
        dailyInventorySummaryMapper.updateBatch(curRecords);
    }
}
Also used : PanoramicDailyInventorySummary(com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary) PanoramicRawMaterials(com.monitor.model.rawmaterials.PanoramicRawMaterials) PanoramicProductMaterials(com.monitor.model.productmaterials.PanoramicProductMaterials)

Example 7 with PanoramicDailyInventorySummary

use of com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary in project new-cloud by xie-summer.

the class PanoramicDailyInventorySummaryServiceImpl method listByDateAndCode.

@Override
public List<PanoramicDailyInventorySummary> listByDateAndCode(String date, List<String> codeList) {
    List<PanoramicDailyInventorySummary> records = Lists.newArrayList();
    codeList.forEach((String e) -> {
        PanoramicDailyInventorySummary dailyInventorySummary = this.queryByDateAndCode(e, date);
        records.add(dailyInventorySummary);
    });
    return records;
}
Also used : PanoramicDailyInventorySummary(com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary)

Aggregations

PanoramicDailyInventorySummary (com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary)7 Transactional (org.springframework.transaction.annotation.Transactional)4 Condition (tk.mybatis.mapper.entity.Condition)2 PanoramicMaterialThresholdConfiguration (com.monitor.model.materialthresholdconfiguration.PanoramicMaterialThresholdConfiguration)1 PanoramicProductMaterials (com.monitor.model.productmaterials.PanoramicProductMaterials)1 PanoramicRawMaterials (com.monitor.model.rawmaterials.PanoramicRawMaterials)1 PanoramicRealTimeConsumptionGather (com.monitor.model.realtimeconsumptiongather.PanoramicRealTimeConsumptionGather)1