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);
}
}
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);
}
Aggregations