|
@@ -242,30 +242,22 @@ public class BizHousingFundConfirmController extends BaseController {
|
|
List<BizHousingFundConfirmDetailEmployee> employees = detail.getDetails().stream().filter(v -> v.getChangeStatus()==null||v.getChangeStatus() != 2).collect(Collectors.toList());;
|
|
List<BizHousingFundConfirmDetailEmployee> employees = detail.getDetails().stream().filter(v -> v.getChangeStatus()==null||v.getChangeStatus() != 2).collect(Collectors.toList());;
|
|
BizHousingFundConfirmDetail old = housingFundConfirmDetailService.query()
|
|
BizHousingFundConfirmDetail old = housingFundConfirmDetailService.query()
|
|
.eq("housing_fund_confirm_id", detail.getHousingFundConfirmId()).lt("concat(year,month)", detail.getYear() + detail.getMonth()).orderByDesc("concat(year, month)").last("limit 1").one();
|
|
.eq("housing_fund_confirm_id", detail.getHousingFundConfirmId()).lt("concat(year,month)", detail.getYear() + detail.getMonth()).orderByDesc("concat(year, month)").last("limit 1").one();
|
|
|
|
+ List<BizHousingFundConfirmDetailEmployee> oldEmployees;
|
|
if (old != null) {
|
|
if (old != null) {
|
|
- List<BizHousingFundConfirmDetailEmployee> oldEmployees = housingFundConfirmDetailEmployeeService.query()
|
|
|
|
|
|
+ oldEmployees = housingFundConfirmDetailEmployeeService.query()
|
|
.eq("housing_fund_confirm_detail_id", old.getId()).ne("change_status", 2).list();
|
|
.eq("housing_fund_confirm_detail_id", old.getId()).ne("change_status", 2).list();
|
|
- employees.forEach(l -> {
|
|
|
|
- // 判断是新增还是不变
|
|
|
|
- if (oldEmployees.stream().anyMatch(v -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))) {
|
|
|
|
- l.setChangeStatus(0);
|
|
|
|
- }
|
|
|
|
- if (oldEmployees.stream().noneMatch(v -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))) {
|
|
|
|
- l.setChangeStatus(1);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ oldEmployees = new ArrayList<>();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (BizHousingFundConfirmDetailEmployee employee : detail.getDetails()) {
|
|
|
|
+ if (oldEmployees.stream().noneMatch(v -> v.getPhone().equals(employee.getPhone()) && v.getEmployeeName().equals(employee.getEmployeeName()))) {
|
|
|
|
+ if (employee.getChangeStatus() == 2) {
|
|
|
|
+ employee.setDeleted(1);
|
|
|
|
+ } else {
|
|
|
|
+ employee.setChangeStatus(1);
|
|
}
|
|
}
|
|
- });
|
|
|
|
- oldEmployees.stream().filter(v -> employees.stream().noneMatch(l -> v.getPhone().equals(l.getPhone()) && v.getEmployeeName().equals(l.getEmployeeName()))).forEach(l -> {
|
|
|
|
- BizHousingFundConfirmDetailEmployee item = new BizHousingFundConfirmDetailEmployee();
|
|
|
|
- item.setChangeStatus(2);
|
|
|
|
- item.setCompanyId(detail.getCompanyId());
|
|
|
|
- item.setPhone(l.getPhone());
|
|
|
|
- item.setEmployeeName(l.getEmployeeName());
|
|
|
|
- item.setCardinalNumber(l.getCardinalNumber());
|
|
|
|
- item.setIdCardImage(l.getIdCardImage());
|
|
|
|
- item.setIdCardImageBack(l.getIdCardImageBack());
|
|
|
|
- item.setRatio(l.getRatio());
|
|
|
|
- employees.add(item);
|
|
|
|
- });
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return toAjax(housingFundConfirmDetailService.updateById(detail) && addRecord(detail.getHousingFundConfirmId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), "修改公积金人员信息"));
|
|
return toAjax(housingFundConfirmDetailService.updateById(detail) && addRecord(detail.getHousingFundConfirmId(), detail.getYear(), detail.getMonth(), SecurityUtils.getUserId(), "修改公积金人员信息"));
|
|
}
|
|
}
|