Search in sources :

Example 1 with PanoramicRawMaterials

use of com.monitor.model.rawmaterials.PanoramicRawMaterials 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 2 with PanoramicRawMaterials

use of com.monitor.model.rawmaterials.PanoramicRawMaterials in project new-cloud by xie-summer.

the class PanoramicRawMaterialsController method list.

@GetMapping("/{date}/{page}/{size}")
public ResultCode<PageInfo> list(@PathVariable("date") String date, @PathVariable("page") Integer page, @PathVariable("size") Integer size) {
    PageHelper.startPage(page, size);
    List<PanoramicRawMaterials> list = rawMaterialsService.findAll();
    PageInfo pageInfo = new PageInfo(list);
    return ResultCode.getSuccessReturn(pageInfo);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) PanoramicRawMaterials(com.monitor.model.rawmaterials.PanoramicRawMaterials)

Aggregations

PanoramicRawMaterials (com.monitor.model.rawmaterials.PanoramicRawMaterials)2 PageInfo (com.github.pagehelper.PageInfo)1 PanoramicDailyInventorySummary (com.monitor.model.dailyinventorysummary.PanoramicDailyInventorySummary)1 PanoramicProductMaterials (com.monitor.model.productmaterials.PanoramicProductMaterials)1