|
|
@@ -65,26 +65,28 @@ public class CockpitStatsManage { |
|
|
|
return convertCockpitStats.convertCockpitStats(cockpitStats,regionCode,year,aps); |
|
|
|
} |
|
|
|
|
|
|
|
public void save(CockpitStatsSaveDTO save) { |
|
|
|
List<CockpitStats> cockpitStatsList = cockpitStatsService.list(Wrappers.lambdaUpdate(CockpitStats.class) |
|
|
|
.eq(Objects.nonNull(save.getRegionCode()), CockpitStats::getRegionCode, save.getRegionCode()) |
|
|
|
.eq(Objects.nonNull(save.getYear()), CockpitStats::getYear, save.getYear())); |
|
|
|
if(CollUtil.isNotEmpty(cockpitStatsList)){ |
|
|
|
for(CockpitStats cockpitStats : cockpitStatsList){ |
|
|
|
BeanUtil.copyProperties(save,cockpitStats, CopyOptions.create().ignoreNullValue()); |
|
|
|
cockpitStatsService.updateById(cockpitStats); |
|
|
|
public void save(List<CockpitStatsSaveDTO> saves) { |
|
|
|
for(CockpitStatsSaveDTO save : saves){ |
|
|
|
List<CockpitStats> cockpitStatsList = cockpitStatsService.list(Wrappers.lambdaUpdate(CockpitStats.class) |
|
|
|
.eq(Objects.nonNull(save.getRegionCode()), CockpitStats::getRegionCode, save.getRegionCode()) |
|
|
|
.eq(Objects.nonNull(save.getYear()), CockpitStats::getYear, save.getYear())); |
|
|
|
if(CollUtil.isNotEmpty(cockpitStatsList)){ |
|
|
|
for(CockpitStats cockpitStats : cockpitStatsList){ |
|
|
|
BeanUtil.copyProperties(save,cockpitStats, CopyOptions.create().ignoreNullValue()); |
|
|
|
cockpitStatsService.updateById(cockpitStats); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if(Objects.nonNull(save.getCockpitApplications())){ |
|
|
|
cockpitApplicationService.remove(Wrappers.lambdaQuery(CockpitApplication.class)); |
|
|
|
if(Objects.nonNull(save.getCockpitApplications())){ |
|
|
|
cockpitApplicationService.remove(Wrappers.lambdaQuery(CockpitApplication.class)); |
|
|
|
|
|
|
|
List<CockpitApplicationDTO> cockpitApplications = save.getCockpitApplications(); |
|
|
|
if(CollUtil.isNotEmpty(cockpitApplications)){ |
|
|
|
List<CockpitApplication> applications = cockpitApplications.stream() |
|
|
|
.map(a -> BeanUtil.copyProperties(a,CockpitApplication.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
cockpitApplicationService.saveBatch(applications); |
|
|
|
List<CockpitApplicationDTO> cockpitApplications = save.getCockpitApplications(); |
|
|
|
if(CollUtil.isNotEmpty(cockpitApplications)){ |
|
|
|
List<CockpitApplication> applications = cockpitApplications.stream() |
|
|
|
.map(a -> BeanUtil.copyProperties(a,CockpitApplication.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
cockpitApplicationService.saveBatch(applications); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|