From 8d83e92a854ee0c07a934e19b99e96a518ec2552 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Mon, 6 May 2024 17:33:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=A6=BB=E8=81=8C=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=85=B3=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/jdbc/JdbcUserRepository.java | 2 +- .../chint/interfaces/rest/user/BatchUserWorker.java | 12 +++++++----- src/test/java/com/chint/CTripTest.java | 2 +- src/test/java/com/chint/RouteApplicationTests.java | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) 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 = "正泰集团股份有限公司";