|
@@ -368,23 +368,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
userSalaryService.saveBatch(salaryChangeList);
|
|
|
}
|
|
|
//更新该月份的日报相关的成本
|
|
|
- List<Report> reportList = reportMapper.selectSimpleTime(companyId, startStr, endStr);
|
|
|
-
|
|
|
- if (reportList.size() > 0) {
|
|
|
- List<Report> updateReportList = new ArrayList<>();
|
|
|
- for (Report r : reportList) {
|
|
|
- Optional<User> first = updateUserList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
|
|
|
- if (first.isPresent()) {
|
|
|
- BigDecimal hourCost = first.get().getCost();
|
|
|
- r.setCost(hourCost.multiply(new BigDecimal(r.getWorkingTime())));
|
|
|
- r.setCreatorId(null);
|
|
|
- r.setWorkingTime(null);
|
|
|
- updateReportList.add(r);
|
|
|
+ if (!StringUtils.isEmpty(yearMonth)) {
|
|
|
+ List<Report> reportList = reportMapper.selectSimpleTime(companyId, startStr, endStr);
|
|
|
+ if (reportList.size() > 0) {
|
|
|
+ List<Report> updateReportList = new ArrayList<>();
|
|
|
+ for (Report r : reportList) {
|
|
|
+ Optional<User> first = updateUserList.stream().filter(u -> u.getId().equals(r.getCreatorId())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ BigDecimal hourCost = first.get().getCost();
|
|
|
+ r.setCost(hourCost.multiply(new BigDecimal(r.getWorkingTime())));
|
|
|
+ r.setCreatorId(null);
|
|
|
+ r.setWorkingTime(null);
|
|
|
+ updateReportList.add(r);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //批量更新日报的成本
|
|
|
+ if (updateReportList.size() > 0) {
|
|
|
+ reportService.updateBatchById(updateReportList);
|
|
|
}
|
|
|
- }
|
|
|
- //批量更新日报的成本
|
|
|
- if (updateReportList.size() > 0) {
|
|
|
- reportService.updateBatchById(updateReportList);
|
|
|
}
|
|
|
}
|
|
|
}catch (IOException e){
|