diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index b29cf4b8e..0105b0c28 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -416,7 +416,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("该数据不存在!"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId); + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); if (!canEdit) { //没有编辑权限 throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!"); @@ -447,7 +447,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction //税款所属期 String declareMonthStr = addUpDeductionRecordParam.getDeclareMonth(); - if (declareMonthStr == "") { + if (declareMonthStr .equals("")) { throw new SalaryRunTimeException("税款所属期不能为空!"); } // 获取所有个税扣缴义务人 @@ -475,7 +475,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction .updateTime(now) .creator((long) user.getUID()) .declareMonth(declareMonth).build(); - boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == addUpDeductionRecordParam.getEmployeeId()); + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpDeductionRecordParam.getEmployeeId())); if (!employeeSameId) { throw new SalaryRunTimeException("员工信息不存在"); } @@ -559,7 +559,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction throw new SalaryRunTimeException("数据不存在或已被删除!"); } // 判断是否在个税扣缴义务人范围内 - Optional first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst(); + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); if (!first.isPresent()) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } @@ -594,7 +594,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction if (deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))) { // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); if (!canDelete) { throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index 94d770e82..ee52107f4 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -846,7 +846,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation throw new SalaryRunTimeException("该数据不存在!"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId); + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); if(!canEdit){ //没有编辑权限 throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!"); @@ -922,7 +922,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation //筛选导入人员信息可以在人力资源池中匹配到的人员信息 - boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == addUpSituationParam.getEmployeeId()); + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , addUpSituationParam.getEmployeeId())); if(!employeeSameId){ throw new SalaryRunTimeException("员工信息不存在"); } @@ -1033,7 +1033,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation throw new SalaryRunTimeException("数据不存在或已被删除!"); } // 判断是否在个税扣缴义务人范围内 - Optional first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst(); + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); if(!first.isPresent()){ throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } @@ -1069,7 +1069,7 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){ // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); if(!canDelete){ throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); } diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 6edd8bddf..1529e9966 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -567,7 +567,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction throw new SalaryRunTimeException("该数据不存在!"); } Long taxAgentId = byId.getTaxAgentId(); - boolean canEdit = taxAgentList.stream().anyMatch(t -> t.getTaxAgentId() == taxAgentId); + boolean canEdit = taxAgentList.stream().anyMatch(t -> Objects.equals(t.getTaxAgentId() , taxAgentId)); if(!canEdit){ //没有编辑权限 throw new SalaryRunTimeException("该个税扣缴义务人无权限编辑此数据!"); @@ -622,7 +622,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction .declareMonth(declareMonth).build(); //筛选导入人员信息可以在人力资源池中匹配到的人员信息 - boolean employeeSameId = employees.stream().anyMatch(e -> e.getEmployeeId() == otherDeductionParam.getEmployeeId()); + boolean employeeSameId = employees.stream().anyMatch(e -> Objects.equals(e.getEmployeeId() , otherDeductionParam.getEmployeeId())); if(!employeeSameId){ throw new SalaryRunTimeException("员工信息不存在"); } @@ -701,7 +701,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction throw new SalaryRunTimeException("数据不存在或已被删除!"); } // 判断是否在个税扣缴义务人范围内 - Optional first = taxAgentList.stream().filter(m -> m.getTaxAgentId() == byId.getTaxAgentId()).findFirst(); + Optional first = taxAgentList.stream().filter(m -> Objects.equals(m.getTaxAgentId() , byId.getTaxAgentId())).findFirst(); if(!first.isPresent()){ throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内"); } @@ -737,7 +737,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction if(deleteParam.getTaxAgentId() != null && (!deleteParam.getTaxAgentId().equals(""))){ // 设置了个税扣缴义务人 Long taxAgentId = SalaryEntityUtil.string2Long(deleteParam.getTaxAgentId()); - boolean canDelete = taxAgentIds.stream().anyMatch(t -> t == taxAgentId); + boolean canDelete = taxAgentIds.stream().anyMatch(t -> Objects.equals(t , taxAgentId)); if(!canDelete){ throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内!"); }