Quellcode durchsuchen

优化年龄转换代码

java71- 张威豹 vor 3 Jahren
Ursprung
Commit
cb78e7db4c

+ 12 - 13
ruoyi-ahrs/src/main/java/com/ruoyi/ahrs/recruitplan/service/impl/RecruitPlanMainServiceImpl.java

@@ -161,15 +161,15 @@ public class RecruitPlanMainServiceImpl implements IRecruitPlanMainService {
         }
         //转换age
         recruitPlanChildList.forEach(recruitPlanChild -> {
-                    if (recruitPlanChild.getStartAge()!= null && recruitPlanChild.getStartAge().length()!= 0 && recruitPlanChild.getEndAge()!=null&& recruitPlanChild.getEndAge().length()!= 0 ){
-                        recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + recruitPlanChild.getEndAge());
-                    }
-                    if (recruitPlanChild.getStartAge()!="" && recruitPlanChild.getEndAge() == ""){
-                        recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + "65");
-                    }
-                    if (recruitPlanChild.getStartAge()== "" && recruitPlanChild.getEndAge()!= ""){
-                        recruitPlanChild.setAge("0" + "-" + recruitPlanChild.getEndAge());
-                    }
+            if (StringUtils.isNotEmpty(recruitPlanChild.getStartAge()) == true && StringUtils.isNotEmpty(recruitPlanChild.getEndAge()) == true){
+                recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + recruitPlanChild.getEndAge());
+            }
+            if (StringUtils.isNotEmpty(recruitPlanChild.getStartAge()) == true && recruitPlanChild.getEndAge().equals("")){
+                recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + "65");
+            }
+            if (recruitPlanChild.getStartAge().equals("") && StringUtils.isNotEmpty(recruitPlanChild.getEndAge()) == true  ){
+                recruitPlanChild.setAge("0" + "-" + recruitPlanChild.getEndAge());
+            }
                 }
         );
         //转换major
@@ -247,16 +247,15 @@ public class RecruitPlanMainServiceImpl implements IRecruitPlanMainService {
         //给修改招聘计划中的子计划delFlag赋值为"0''--并且进行转换age
         recruitPlanChildList.forEach(recruitPlanChild -> {
             recruitPlanChild.setDelFlag("0");
-            if (recruitPlanChild.getStartAge()!= null && recruitPlanChild.getStartAge().length()!= 0 && recruitPlanChild.getEndAge()!=null&& recruitPlanChild.getEndAge().length()!= 0 ){
+            if (StringUtils.isNotEmpty(recruitPlanChild.getStartAge()) == true && StringUtils.isNotEmpty(recruitPlanChild.getEndAge()) == true){
                 recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + recruitPlanChild.getEndAge());
             }
-            if (recruitPlanChild.getStartAge()!="" && recruitPlanChild.getEndAge() == ""){
+            if (StringUtils.isNotEmpty(recruitPlanChild.getStartAge()) == true && recruitPlanChild.getEndAge().equals("")){
                 recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + "65");
             }
-            if (recruitPlanChild.getStartAge()== "" && recruitPlanChild.getEndAge()!= ""){
+            if (recruitPlanChild.getStartAge().equals("") && StringUtils.isNotEmpty(recruitPlanChild.getEndAge()) == true  ){
                 recruitPlanChild.setAge("0" + "-" + recruitPlanChild.getEndAge());
             }
-
         });
         //转换major
         recruitPlanChildList.forEach(recruitPlanChild -> {