diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java index b04780fa..8bca63ad 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java @@ -7,7 +7,7 @@ import org.springframework.stereotype.Repository; import java.util.List; @Repository -public interface JdbcUserRepository extends CrudRepository { +public interface JdbcUserRepository extends CrudRepository { User findByEmployeeNo(String employeeNo); List findByStatus(Integer status); diff --git a/src/main/java/com/chint/interfaces/rest/user/BatchUserWorker.java b/src/main/java/com/chint/interfaces/rest/user/BatchUserWorker.java index f5ef29b2..2e65fbe0 100644 --- a/src/main/java/com/chint/interfaces/rest/user/BatchUserWorker.java +++ b/src/main/java/com/chint/interfaces/rest/user/BatchUserWorker.java @@ -85,9 +85,11 @@ public class BatchUserWorker { List userList = userRepository.findByStatus(1); List byStatusIsNull = userRepository.findByStatusIsNull(); userList.addAll(byStatusIsNull); - List userStatusChangeList = new ArrayList<>(); for (User user : userList) { List userSFDataFromOpenApi = userSFRequest.getUserSFDataFromOpenApi(user); + if (userSFDataFromOpenApi == null) { + continue; + } for (UserDataDTO userDataDTO : userSFDataFromOpenApi) { user.addDeptInfo(userDataDTO); } @@ -99,12 +101,12 @@ public class BatchUserWorker { //如果这里不存在状态为A的SF数据,说明他已经处于离职状态 user.setStatus(0); user.loadInfoFromDept(); + log.info("开始关闭用户:{} 的商旅账户", user.getEmployeeNo()); Command.of(UserDisabledCommand.class).user(user).sendToQueue(); - userStatusChangeList.add(user); + } else { + user.setStatus(1); } - } - if (!userStatusChangeList.isEmpty()) { - userRepository.saveAll(userStatusChangeList); + userRepository.save(user); } } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 1419966e..056324c3 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -246,7 +246,7 @@ public class CTripTest { @Test void search() { BaseContext.setCurrentUser(user); - SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30701490985"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30807150200"); System.out.println(response); } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 547d86be..ca48058a 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -270,7 +270,7 @@ class RouteApplicationTests { @Test void loginSign() { - String sfno = "240305077"; + String sfno = "240402087"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -285,7 +285,7 @@ class RouteApplicationTests { @Test void loginSignProd() { - String sfno = "220301581"; + String sfno = "240402087"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司";