From 626968a7f05f0b483c1a46dbefef5f84d7a7fca0 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Wed, 28 Feb 2024 09:06:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/login/strategy/PailaLoginStrategy.java | 2 +- .../chint/domain/aggregates/order/RouteOrder.java | 2 +- .../java/com/chint/domain/aggregates/user/User.java | 12 ++++++------ .../domain/factoriy/order/RouteOrderFactory.java | 4 ++-- .../order_detail/CTripOrderExtensionFactoryImpl.java | 6 +++--- .../chint/domain/factoriy/user/UserFactoryImpl.java | 2 +- .../com/chint/domain/repository/UserRepository.java | 2 +- .../domain/service/auth/AuthenticateServiceImpl.java | 2 +- .../domain/service/leg_event/LegEventHandler.java | 2 +- .../repository/UserRepositoryImpl.java | 2 +- .../repository/jdbc/JdbcUserRepository.java | 4 ++-- src/test/java/com/chint/CTripTest.java | 2 +- src/test/java/com/chint/LYTest.java | 4 ++-- src/test/java/com/chint/RouteApplicationTests.java | 4 ++-- 14 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/chint/application/services/login/strategy/PailaLoginStrategy.java b/src/main/java/com/chint/application/services/login/strategy/PailaLoginStrategy.java index ef7c4504..40e39eee 100644 --- a/src/main/java/com/chint/application/services/login/strategy/PailaLoginStrategy.java +++ b/src/main/java/com/chint/application/services/login/strategy/PailaLoginStrategy.java @@ -91,7 +91,7 @@ public class PailaLoginStrategy implements LoginStrategy { UserDTO userDTO = JSON.parseObject(userInfoResBody, UserDTO.class); User user; if (userDTO != null) { - user = userRepository.findByUserEmployeeNo(Long.parseLong(userDTO.getUid())); + user = userRepository.findByUserEmployeeNo(userDTO.getUid()); if (user == null) { user = userFactory.create(userDTO.getUid()); userHttpRequest.loadUserInfo(user); diff --git a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java index 5c5bb9e3..eb55351e 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -45,7 +45,7 @@ public class RouteOrder extends BaseEntity { @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime bookingTime; - private Long userId; + private String userId; private String supplierName; //差标等级 private String standardLevel; diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java index bdf4f009..c652b6e8 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -20,7 +20,7 @@ import java.util.Map; public class User { @Id private Long userId; - private Long employeeNo; + private String employeeNo; private Integer employeeLevel; private String name; private String email; @@ -43,11 +43,11 @@ public class User { private UserLoginParam userLoginParam; - public User(Long employeeNo) { + public User(String employeeNo) { this.employeeNo = employeeNo; } - public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel) { + public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel) { this.userId = userId; this.employeeNo = employeeNo; this.employeeLevel = employeeLevel; @@ -58,7 +58,7 @@ public class User { this.userLoginParam = userLoginParam; } - public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber) { + public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber) { this.userId = userId; this.employeeNo = employeeNo; this.employeeLevel = employeeLevel; @@ -67,7 +67,7 @@ public class User { this.phoneNumber = phoneNumber; } - public static User withEmployeeNo(Long employeeNo) { + public static User withEmployeeNo(String employeeNo) { return new User(employeeNo); } @@ -82,7 +82,7 @@ public class User { Claim loginParam = claims.get(AuthMessageConstant.USER_LOGIN_PARAM); Claim standardLevel = claims.get(AuthMessageConstant.USER_STANDARD_LEVEL); return new User(userId.asLong(), - employeeNo.asLong(), + employeeNo.asString(), employeeLevel.asInt(), name.asString(), email.asString(), diff --git a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java index 9e2cf4e6..18aea6af 100644 --- a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java @@ -32,7 +32,7 @@ public class RouteOrderFactory implements OrderFactory { RouteOrder routeOrder = new RouteOrder(); routeOrder.setRouteOrderNo(OrderNo.generate()); //根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号 - routeOrder.setUserId(currentUser.getUserId()); + routeOrder.setUserId(currentUser.getEmployeeNo()); ApproveOrderNo approveOrderNo = new ApproveOrderNo(); approveOrderNo.setFakeOrderNo(currentUser.getUserLoginParam().getBillcode()); routeOrder.setApproveOrderNo(approveOrderNo); @@ -50,7 +50,7 @@ public class RouteOrderFactory implements OrderFactory { RouteOrder routeOrder = new RouteOrder(); routeOrder.setRouteOrderNo(OrderNo.generate()); //根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号 - routeOrder.setUserId(Long.valueOf(loginParam.getSfno())); + routeOrder.setUserId(loginParam.getSfno()); ApproveOrderNo approveOrderNo = new ApproveOrderNo(); approveOrderNo.setSysCode(loginParam.getSyscode()); approveOrderNo.setFakeOrderNo(loginParam.getBillcode()); diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java index 1e5b9176..c25b07f0 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/CTripOrderExtensionFactoryImpl.java @@ -78,9 +78,9 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { .filter(it -> first.get().getLegId().equals(it.getLegId())) .findFirst()).ifPresent(it -> flightOrderDetail.setScheduleNum(it.getLegNo())); - Long EmployeeNo = routeOrder.getUserId(); + String EmployeeNo = routeOrder.getUserId(); User user = userRepository.findByUserEmployeeNo(EmployeeNo); - flightOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo())); + flightOrderDetail.setBookingUserCode(user.getEmployeeNo()); flightOrderDetail.setBookingName(user.getName()); flightOrderDetail.setBookingUserPhone(user.getPhoneNumber()); @@ -134,7 +134,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory { .findFirst()).ifPresent(it -> hotelOrderDetail.setScheduleNum(it.getLegNo())); - Long EmployeeNo = routeOrder.getUserId(); + String EmployeeNo = routeOrder.getUserId(); User user = userRepository.findByUserEmployeeNo(EmployeeNo); String cityName = hotelOrderInfoEntity.getCityName(); hotelOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo())); diff --git a/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java index 1277f7ab..c56e4b97 100644 --- a/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/user/UserFactoryImpl.java @@ -8,7 +8,7 @@ public class UserFactoryImpl implements UserFactory { @Override public User create(String employeeNo) { User user = new User(); - user.setEmployeeNo(Long.valueOf(employeeNo)); + user.setEmployeeNo(employeeNo); return user; } } diff --git a/src/main/java/com/chint/domain/repository/UserRepository.java b/src/main/java/com/chint/domain/repository/UserRepository.java index 17a55a1c..daa981bf 100644 --- a/src/main/java/com/chint/domain/repository/UserRepository.java +++ b/src/main/java/com/chint/domain/repository/UserRepository.java @@ -4,6 +4,6 @@ import com.chint.domain.aggregates.user.User; public interface UserRepository { User findById(Long id); - User findByUserEmployeeNo(Long employeeNo); + User findByUserEmployeeNo(String employeeNo); User save(User user); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java index 78b74274..283f19d2 100644 --- a/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java +++ b/src/main/java/com/chint/domain/service/auth/AuthenticateServiceImpl.java @@ -40,7 +40,7 @@ public class AuthenticateServiceImpl implements AuthenticateService { @Override public UserLoginResult authenticateEmployeeNo(UserLoginParam userLoginParam) { - User user = userRepository.findByUserEmployeeNo(Long.parseLong(userLoginParam.getSfno())); + User user = userRepository.findByUserEmployeeNo(userLoginParam.getSfno()); if (user != null) { // 部分数据需要通过查询外部的http来获取 BaseContext.setCurrentUser(user); diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index 8965ef34..5ef1b178 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -141,7 +141,7 @@ public class LegEventHandler implements LegEventService { String orderNo = data.getSelfOrderNo(); RouteOrder routeOrder = routeRepository.findByOrderNo(orderNo); //获取行程规划单创建者作为该订单 - Long employeeNo = routeOrder.getUserId(); + String employeeNo = routeOrder.getUserId(); User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo); BaseContext.setCurrentUser(byUserEmployeeNo); OrderDetail orderDetail; diff --git a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java index 8a9c57fb..0f99c78f 100644 --- a/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/UserRepositoryImpl.java @@ -18,7 +18,7 @@ public class UserRepositoryImpl implements UserRepository { } @Override - public User findByUserEmployeeNo(Long employeeNo) { + public User findByUserEmployeeNo(String employeeNo) { return jdbcUserRepository.findByEmployeeNo(employeeNo); } 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 2d5ee6cb..a50339ee 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java @@ -5,7 +5,7 @@ import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository -public interface JdbcUserRepository extends CrudRepository { - User findByEmployeeNo(Long employeeNo); +public interface JdbcUserRepository extends CrudRepository { + User findByEmployeeNo(String employeeNo); } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index f914f849..6ece2f6a 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -54,7 +54,7 @@ public class CTripTest { @Autowired private CTripNoteController cTripNoteController; - private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365"); //@Test void locationCountry() { diff --git a/src/test/java/com/chint/LYTest.java b/src/test/java/com/chint/LYTest.java index 122254cb..ea2d55c4 100644 --- a/src/test/java/com/chint/LYTest.java +++ b/src/test/java/com/chint/LYTest.java @@ -75,8 +75,8 @@ public class LYTest { private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson"; - private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); - private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063"); + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365"); + private User hxh = new User(1L, "231116009", 1, "黄小恒", "1628870217@qq.com", "18296007063"); //机票订单最新价格校验 diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 1479abeb..f880cb16 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -38,7 +38,7 @@ class RouteApplicationTests { @Autowired private PailaLoginStrategy pailaLoginStrategy; - private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365"); + private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365"); // @Test @@ -71,7 +71,7 @@ class RouteApplicationTests { // @Test void queryUserInfo() { - User user2 = User.withEmployeeNo(180101001L); + User user2 = User.withEmployeeNo("180101001"); user2.setCompanyCode("A10000001"); User user1 = userHttpRequest.loadUserInfo(user2);