完成离职人员关卡

This commit is contained in:
lulz1 2024-05-06 17:33:51 +08:00
parent df11789f6c
commit 8d83e92a85
4 changed files with 11 additions and 9 deletions

View File

@ -7,7 +7,7 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public interface JdbcUserRepository extends CrudRepository<User, String> { public interface JdbcUserRepository extends CrudRepository<User, Long> {
User findByEmployeeNo(String employeeNo); User findByEmployeeNo(String employeeNo);
List<User> findByStatus(Integer status); List<User> findByStatus(Integer status);

View File

@ -85,9 +85,11 @@ public class BatchUserWorker {
List<User> userList = userRepository.findByStatus(1); List<User> userList = userRepository.findByStatus(1);
List<User> byStatusIsNull = userRepository.findByStatusIsNull(); List<User> byStatusIsNull = userRepository.findByStatusIsNull();
userList.addAll(byStatusIsNull); userList.addAll(byStatusIsNull);
List<User> userStatusChangeList = new ArrayList<>();
for (User user : userList) { for (User user : userList) {
List<UserDataDTO> userSFDataFromOpenApi = userSFRequest.getUserSFDataFromOpenApi(user); List<UserDataDTO> userSFDataFromOpenApi = userSFRequest.getUserSFDataFromOpenApi(user);
if (userSFDataFromOpenApi == null) {
continue;
}
for (UserDataDTO userDataDTO : userSFDataFromOpenApi) { for (UserDataDTO userDataDTO : userSFDataFromOpenApi) {
user.addDeptInfo(userDataDTO); user.addDeptInfo(userDataDTO);
} }
@ -99,12 +101,12 @@ public class BatchUserWorker {
//如果这里不存在状态为A的SF数据说明他已经处于离职状态 //如果这里不存在状态为A的SF数据说明他已经处于离职状态
user.setStatus(0); user.setStatus(0);
user.loadInfoFromDept(); user.loadInfoFromDept();
log.info("开始关闭用户:{} 的商旅账户", user.getEmployeeNo());
Command.of(UserDisabledCommand.class).user(user).sendToQueue(); Command.of(UserDisabledCommand.class).user(user).sendToQueue();
userStatusChangeList.add(user); } else {
user.setStatus(1);
} }
} userRepository.save(user);
if (!userStatusChangeList.isEmpty()) {
userRepository.saveAll(userStatusChangeList);
} }
} }

View File

@ -246,7 +246,7 @@ public class CTripTest {
@Test @Test
void search() { void search() {
BaseContext.setCurrentUser(user); BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30701490985"); SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("30807150200");
System.out.println(response); System.out.println(response);
} }

View File

@ -270,7 +270,7 @@ class RouteApplicationTests {
@Test @Test
void loginSign() { void loginSign() {
String sfno = "240305077"; String sfno = "240402087";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ240225000099"; String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";
@ -285,7 +285,7 @@ class RouteApplicationTests {
@Test @Test
void loginSignProd() { void loginSignProd() {
String sfno = "220301581"; String sfno = "240402087";
String syscode = "FSSC"; String syscode = "FSSC";
String billcode = "CLSQ240225000099"; String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司"; String companycode = "正泰集团股份有限公司";