From 0d054de1e821953f16b85e52470a8e61febf8f72 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 16 May 2024 17:02:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=9D=83=E9=99=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 - .../application/commands/UserRoleCommand.java | 15 ++ .../application/dtos/response/UserRes.java | 8 +- .../application/dtos/system/RoleOrgParam.java | 15 ++ .../application/dtos/system/RoleParam.java | 4 + .../{ => system}/SystemAnnouncementDTO.java | 2 +- .../{ => system}/SystemAnnouncementVO.java | 4 +- .../dtos/system/SystemOrganizationParam.java | 8 + .../application/out/OrderOutController.java | 2 - .../application/system/SystemController.java | 32 +++- .../{out => system}/UserController.java | 37 +++- .../domain/aggregates/order/OrderDetail.java | 3 - .../aggregates/system/SystemAnnouncement.java | 4 +- .../aggregates/system/SystemOrganization.java | 6 + .../chint/domain/aggregates/user/Role.java | 56 ++++++ .../aggregates/user/RoleOrganization.java | 22 +++ .../domain/aggregates/user/RoleUser.java | 22 +++ .../chint/domain/aggregates/user/User.java | 11 ++ .../domain/repository/RoleRepository.java | 13 ++ .../domain/repository/RoleUserRepository.java | 11 ++ .../SystemOrganizationRepository.java | 7 +- .../domain/service/OrderDomainService.java | 167 +++++++++++------- .../domain/service/SystemDomainService.java | 58 +++++- .../system/SystemOrganizationVO.java | 18 ++ .../repository/RoleRepositoryImpl.java | 42 +++++ .../repository/RoleUserRepositoryImpl.java | 30 ++++ .../SystemOrganizationRepositoryImpl.java | 52 +++++- .../repository/cache/CacheRoleRepository.java | 22 +++ .../CacheSystemOrganizationRepository.java | 43 +++++ .../repository/jdbc/JdbcRoleRepository.java | 10 ++ .../jdbc/JdbcRoleUserRepository.java | 13 ++ .../JdbcSystemOrganizationRepository.java | 2 + src/test/java/com/chint/CTripTest.java | 2 +- .../java/com/chint/RouteApplicationTests.java | 8 +- 34 files changed, 650 insertions(+), 100 deletions(-) create mode 100644 src/main/java/com/chint/application/commands/UserRoleCommand.java create mode 100644 src/main/java/com/chint/application/dtos/system/RoleOrgParam.java create mode 100644 src/main/java/com/chint/application/dtos/system/RoleParam.java rename src/main/java/com/chint/application/dtos/{ => system}/SystemAnnouncementDTO.java (92%) rename src/main/java/com/chint/application/dtos/{ => system}/SystemAnnouncementVO.java (82%) create mode 100644 src/main/java/com/chint/application/dtos/system/SystemOrganizationParam.java rename src/main/java/com/chint/application/{out => system}/UserController.java (60%) create mode 100644 src/main/java/com/chint/domain/aggregates/user/Role.java create mode 100644 src/main/java/com/chint/domain/aggregates/user/RoleOrganization.java create mode 100644 src/main/java/com/chint/domain/aggregates/user/RoleUser.java create mode 100644 src/main/java/com/chint/domain/repository/RoleRepository.java create mode 100644 src/main/java/com/chint/domain/repository/RoleUserRepository.java create mode 100644 src/main/java/com/chint/domain/value_object/system/SystemOrganizationVO.java create mode 100644 src/main/java/com/chint/infrastructure/repository/RoleRepositoryImpl.java create mode 100644 src/main/java/com/chint/infrastructure/repository/RoleUserRepositoryImpl.java create mode 100644 src/main/java/com/chint/infrastructure/repository/cache/CacheRoleRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/cache/CacheSystemOrganizationRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleRepository.java create mode 100644 src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleUserRepository.java diff --git a/pom.xml b/pom.xml index e721b0ed..5334d5e7 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,6 @@ Route Route - org.springframework.boot diff --git a/src/main/java/com/chint/application/commands/UserRoleCommand.java b/src/main/java/com/chint/application/commands/UserRoleCommand.java new file mode 100644 index 00000000..adc9972e --- /dev/null +++ b/src/main/java/com/chint/application/commands/UserRoleCommand.java @@ -0,0 +1,15 @@ +package com.chint.application.commands; + +import com.chint.domain.aggregates.user.User; +import com.chint.infrastructure.echo_framework.command.Command; +import lombok.Data; + +@Data +public class UserRoleCommand extends Command { + private User user; + + public UserRoleCommand user(User user) { + this.user = user; + return this; + } +} diff --git a/src/main/java/com/chint/application/dtos/response/UserRes.java b/src/main/java/com/chint/application/dtos/response/UserRes.java index 2ec52183..d0aaba7c 100644 --- a/src/main/java/com/chint/application/dtos/response/UserRes.java +++ b/src/main/java/com/chint/application/dtos/response/UserRes.java @@ -1,8 +1,10 @@ package com.chint.application.dtos.response; +import com.chint.domain.value_object.system.SystemOrganizationVO; import lombok.Data; import org.springframework.data.annotation.Id; -import org.springframework.data.annotation.Transient; + +import java.util.List; @Data public class UserRes { @@ -15,10 +17,8 @@ public class UserRes { private String gender; private String phoneNumber; private String password; - @Transient private String rankCode; - @Transient private String companyCode; - @Transient private String workStatus; + private List roleOrgList; } diff --git a/src/main/java/com/chint/application/dtos/system/RoleOrgParam.java b/src/main/java/com/chint/application/dtos/system/RoleOrgParam.java new file mode 100644 index 00000000..bc1453ba --- /dev/null +++ b/src/main/java/com/chint/application/dtos/system/RoleOrgParam.java @@ -0,0 +1,15 @@ +package com.chint.application.dtos.system; + +import lombok.Data; + +import java.util.List; + +@Data +public class RoleOrgParam { + private Long roleId; + private String roleName; + private String roleDesc; + private Long userId; + private List orgIdList; + private List roleIdList; +} diff --git a/src/main/java/com/chint/application/dtos/system/RoleParam.java b/src/main/java/com/chint/application/dtos/system/RoleParam.java new file mode 100644 index 00000000..5c0cea33 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/system/RoleParam.java @@ -0,0 +1,4 @@ +package com.chint.application.dtos.system; + +public class RoleParam { +} diff --git a/src/main/java/com/chint/application/dtos/SystemAnnouncementDTO.java b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementDTO.java similarity index 92% rename from src/main/java/com/chint/application/dtos/SystemAnnouncementDTO.java rename to src/main/java/com/chint/application/dtos/system/SystemAnnouncementDTO.java index 7ef04f86..efe51a13 100644 --- a/src/main/java/com/chint/application/dtos/SystemAnnouncementDTO.java +++ b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementDTO.java @@ -1,4 +1,4 @@ -package com.chint.application.dtos; +package com.chint.application.dtos.system; import lombok.Data; diff --git a/src/main/java/com/chint/application/dtos/SystemAnnouncementVO.java b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java similarity index 82% rename from src/main/java/com/chint/application/dtos/SystemAnnouncementVO.java rename to src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java index b50b1054..48f0308a 100644 --- a/src/main/java/com/chint/application/dtos/SystemAnnouncementVO.java +++ b/src/main/java/com/chint/application/dtos/system/SystemAnnouncementVO.java @@ -1,7 +1,5 @@ -package com.chint.application.dtos; +package com.chint.application.dtos.system; -import cn.hutool.core.bean.BeanUtil; -import com.chint.domain.aggregates.system.SystemAnnouncement; import lombok.Data; import java.time.LocalDateTime; diff --git a/src/main/java/com/chint/application/dtos/system/SystemOrganizationParam.java b/src/main/java/com/chint/application/dtos/system/SystemOrganizationParam.java new file mode 100644 index 00000000..93feee06 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/system/SystemOrganizationParam.java @@ -0,0 +1,8 @@ +package com.chint.application.dtos.system; + +import lombok.Data; + +@Data +public class SystemOrganizationParam { + private Long id; +} diff --git a/src/main/java/com/chint/application/out/OrderOutController.java b/src/main/java/com/chint/application/out/OrderOutController.java index 64cb42c3..6ee91a30 100644 --- a/src/main/java/com/chint/application/out/OrderOutController.java +++ b/src/main/java/com/chint/application/out/OrderOutController.java @@ -133,6 +133,4 @@ public class OrderOutController { public Result> queryRoutOrderField(@RequestBody RoutOrderFieldParam param) { return Result.Success(SUCCESS, orderQuery.queryRouteOrderFiled(param)); } - - } diff --git a/src/main/java/com/chint/application/system/SystemController.java b/src/main/java/com/chint/application/system/SystemController.java index 520a7fda..7c135115 100644 --- a/src/main/java/com/chint/application/system/SystemController.java +++ b/src/main/java/com/chint/application/system/SystemController.java @@ -1,12 +1,16 @@ package com.chint.application.system; import com.chint.application.dtos.OrganizationTicketClerk; -import com.chint.application.dtos.SystemAnnouncementDTO; -import com.chint.application.dtos.SystemAnnouncementVO; +import com.chint.application.dtos.system.SystemAnnouncementDTO; +import com.chint.application.dtos.system.SystemAnnouncementVO; +import com.chint.application.dtos.system.SystemOrganizationParam; import com.chint.domain.aggregates.system.SystemAnnouncement; +import com.chint.domain.aggregates.system.SystemOrganization; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.SystemAnnouncementRepository; +import com.chint.domain.repository.SystemOrganizationRepository; import com.chint.domain.service.SystemDomainService; +import com.chint.domain.value_object.system.SystemOrganizationVO; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.data_center.org.OrgRequest; import io.swagger.annotations.ApiOperation; @@ -36,6 +40,9 @@ public class SystemController { @Autowired private SystemDomainService systemDomainService; + @Autowired + private SystemOrganizationRepository systemOrganizationRepository; + @Autowired private OrgRequest orgRequest; @@ -127,4 +134,25 @@ public class SystemController { organizationTicketClerk.getExtension()); return Result.Success(SUCCESS); } + + @ApiOperation("查询所有公司信息") + @PostMapping("/organization/all/company") + public Result> queryAllCompanyInfo() { + List systemOrganizationVOList = systemOrganizationRepository.findByOrgLevelIsNull() + .stream() + .map(SystemOrganization::mapToVO) + .toList(); + return Result.Success(SUCCESS, systemOrganizationVOList); + } + + @ApiOperation("查询子部门信息") + @PostMapping("/organization/sub/org") + public Result> querySubOrgInfo(@RequestBody SystemOrganizationParam systemOrganizationParam) { + List systemOrganizationVOList = systemOrganizationRepository + .findByParentId(systemOrganizationParam.getId()) + .stream() + .map(SystemOrganization::mapToVO) + .toList(); + return Result.Success(SUCCESS, systemOrganizationVOList); + } } diff --git a/src/main/java/com/chint/application/out/UserController.java b/src/main/java/com/chint/application/system/UserController.java similarity index 60% rename from src/main/java/com/chint/application/out/UserController.java rename to src/main/java/com/chint/application/system/UserController.java index 9972fe78..dd0c0106 100644 --- a/src/main/java/com/chint/application/out/UserController.java +++ b/src/main/java/com/chint/application/system/UserController.java @@ -1,9 +1,14 @@ -package com.chint.application.out; +package com.chint.application.system; import cn.hutool.core.bean.BeanUtil; import com.chint.application.dtos.response.UserRes; +import com.chint.application.dtos.system.RoleOrgParam; +import com.chint.domain.aggregates.user.Role; +import com.chint.domain.aggregates.user.RoleUser; import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.UserDepartmentInfo; +import com.chint.domain.repository.RoleRepository; +import com.chint.domain.repository.RoleUserRepository; import com.chint.domain.repository.UserRepository; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Result; @@ -30,13 +35,41 @@ public class UserController { @Autowired private UserHttpRequest userHttpRequest; + @Autowired + private RoleUserRepository roleUserRepository; + + @Autowired + private RoleRepository roleRepository; + @ApiOperation("根据Id查询用户信息") @PostMapping("/query") public Result getUserByEmployeeNo() { - User currentUser = BaseContext.getCurrentUser(); + User currentUser = BaseContext.getCurrentUser().loadRoleOrg(); return Result.Success(SUCCESS, BeanUtil.copyProperties(currentUser, UserRes.class)); } + @ApiOperation("根据用户ID添加角色权限") + @PostMapping("/add/role") + public Result addRoleUser(@RequestBody RoleOrgParam roleOrgParam) { + roleOrgParam.getRoleIdList().stream() + .map(it -> RoleUser.of(roleOrgParam.getUserId(), it)) + .toList() + .forEach(it -> roleUserRepository.save(it)); + return Result.Success(); + } + + + @ApiOperation("编辑角色组织权限") + @PostMapping("/edit/role") + public Result editRole(@RequestBody RoleOrgParam roleOrgParam) { + roleRepository.findById(roleOrgParam.getRoleId()) + .ifPresentOrElse( + role -> roleRepository.save(role.updateWithParam(roleOrgParam)), + () -> roleRepository.save(Role.buildWithParam(roleOrgParam) + )); + return Result.Success(); + } + @ApiOperation("根据Id查询用户信息") @PostMapping("/sync/public") diff --git a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java index d3abde33..d40826a2 100644 --- a/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java +++ b/src/main/java/com/chint/domain/aggregates/order/OrderDetail.java @@ -142,9 +142,6 @@ public class OrderDetail implements Serializable { return null; } return this.orderEventList.isEmpty() ? null : this.orderEventList.get(this.orderEventList.size() - 1); -// .stream() -// .max(Comparator.comparingLong(OrderEvent::getOrderEventId)) -// .orElseThrow(() -> new NotFoundException(NOT_FOUND)); } public Optional getETAEvent() { diff --git a/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java b/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java index 5c042def..22c2b54f 100644 --- a/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java +++ b/src/main/java/com/chint/domain/aggregates/system/SystemAnnouncement.java @@ -1,8 +1,8 @@ package com.chint.domain.aggregates.system; import cn.hutool.core.bean.BeanUtil; -import com.chint.application.dtos.SystemAnnouncementDTO; -import com.chint.application.dtos.SystemAnnouncementVO; +import com.chint.application.dtos.system.SystemAnnouncementDTO; +import com.chint.application.dtos.system.SystemAnnouncementVO; import com.chint.domain.aggregates.user.User; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.DateTimeUtil; diff --git a/src/main/java/com/chint/domain/aggregates/system/SystemOrganization.java b/src/main/java/com/chint/domain/aggregates/system/SystemOrganization.java index 8092a42b..7360e1de 100644 --- a/src/main/java/com/chint/domain/aggregates/system/SystemOrganization.java +++ b/src/main/java/com/chint/domain/aggregates/system/SystemOrganization.java @@ -1,6 +1,8 @@ package com.chint.domain.aggregates.system; +import cn.hutool.core.bean.BeanUtil; +import com.chint.domain.value_object.system.SystemOrganizationVO; import com.chint.interfaces.rest.data_center.org.OrgSfResponse; import lombok.Data; import org.springframework.data.annotation.Id; @@ -81,4 +83,8 @@ public class SystemOrganization implements Serializable { }); return this; } + + public SystemOrganizationVO mapToVO() { + return BeanUtil.copyProperties(this, SystemOrganizationVO.class); + } } diff --git a/src/main/java/com/chint/domain/aggregates/user/Role.java b/src/main/java/com/chint/domain/aggregates/user/Role.java new file mode 100644 index 00000000..95bc1924 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/Role.java @@ -0,0 +1,56 @@ +package com.chint.domain.aggregates.user; + + +import com.chint.application.dtos.system.RoleOrgParam; +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.MappedCollection; +import org.springframework.data.relational.core.mapping.Table; + +import java.util.ArrayList; +import java.util.List; + +@Data +@Table("role") +public class Role { + @Id + private Long id; + private String roleName; + private String roleDesc; + @MappedCollection(idColumn = "role_id", keyColumn = "role_key") + private List roleOrganizationList; + + public Role addRoleOrganization(RoleOrganization roleOrganization) { + if (roleOrganizationList == null) { + roleOrganizationList = new ArrayList<>(); + } + for (RoleOrganization organization : roleOrganizationList) { + if (organization.getOrgId().equals(roleOrganization.getOrgId())) { + return this; + } + } + roleOrganizationList.add(roleOrganization); + return this; + } + + public Role updateWithParam(RoleOrgParam roleOrgParam) { + roleOrgParam.getOrgIdList().stream() + .map(it -> RoleOrganization.of(roleOrgParam.getRoleId(), it)) + .toList() + .forEach(this::addRoleOrganization); + return this; + } + + public static Role buildWithParam(RoleOrgParam roleOrgParam) { + Role role = new Role(); + role.setRoleName(roleOrgParam.getRoleName()); + role.setRoleDesc(roleOrgParam.getRoleDesc()); + if(roleOrgParam.getRoleIdList() != null){ + roleOrgParam.getOrgIdList().stream() + .map(it -> RoleOrganization.of(roleOrgParam.getRoleId(), it)) + .toList() + .forEach(role::addRoleOrganization); + } + return role; + } +} \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/user/RoleOrganization.java b/src/main/java/com/chint/domain/aggregates/user/RoleOrganization.java new file mode 100644 index 00000000..26351898 --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/RoleOrganization.java @@ -0,0 +1,22 @@ +package com.chint.domain.aggregates.user; + + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + +@Data +@Table("role_organization") +public class RoleOrganization { + @Id + private Long id; + private Long roleId; + private Long orgId; + + public static RoleOrganization of(Long roleId, Long orgId) { + RoleOrganization roleOrganization = new RoleOrganization(); + roleOrganization.setRoleId(roleId); + roleOrganization.setOrgId(orgId); + return roleOrganization; + } +} \ No newline at end of file diff --git a/src/main/java/com/chint/domain/aggregates/user/RoleUser.java b/src/main/java/com/chint/domain/aggregates/user/RoleUser.java new file mode 100644 index 00000000..e859c2ac --- /dev/null +++ b/src/main/java/com/chint/domain/aggregates/user/RoleUser.java @@ -0,0 +1,22 @@ +package com.chint.domain.aggregates.user; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; + + +@Data +@Table("role_user") +public class RoleUser { + @Id + private Long id; + private Long userId; + private Long roleId; + + public static RoleUser of(Long userId, Long roleId) { + RoleUser roleUser = new RoleUser(); + roleUser.setUserId(userId); + roleUser.setRoleId(roleId); + return roleUser; + } +} \ No newline at end of file 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 94795232..10e44c27 100644 --- a/src/main/java/com/chint/domain/aggregates/user/User.java +++ b/src/main/java/com/chint/domain/aggregates/user/User.java @@ -3,11 +3,13 @@ package com.chint.domain.aggregates.user; import cn.hutool.core.bean.BeanUtil; import com.auth0.jwt.interfaces.Claim; import com.auth0.jwt.interfaces.DecodedJWT; +import com.chint.application.commands.UserRoleCommand; import com.chint.application.commands.UserSFCommand; import com.chint.domain.aggregates.system.FsscSystem; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.value_object.UserLoginParam; import com.chint.domain.value_object.UserVO; +import com.chint.domain.value_object.system.SystemOrganizationVO; import com.chint.infrastructure.constant.AuthMessageConstant; import com.chint.infrastructure.echo_framework.command.Command; import com.chint.infrastructure.util.BaseContext; @@ -76,6 +78,10 @@ public class User implements Serializable { private String workStatus; @Transient private UserLoginParam userLoginParam; + @Transient + private List roleOrgCodeList; + @Transient + private List roleOrgList; public User loadInfoFromDept() { if (this.userDepartmentInfoList == null || this.userDepartmentInfoList.isEmpty()) { @@ -383,4 +389,9 @@ public class User implements Serializable { this.setUserDepartmentInfoList(result); return this; } + + public User loadRoleOrg() { + Command.of(UserRoleCommand.class).user(this).sendToQueue(); + return this; + } } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/repository/RoleRepository.java b/src/main/java/com/chint/domain/repository/RoleRepository.java new file mode 100644 index 00000000..6f5394c5 --- /dev/null +++ b/src/main/java/com/chint/domain/repository/RoleRepository.java @@ -0,0 +1,13 @@ +package com.chint.domain.repository; + + +import com.chint.domain.aggregates.user.Role; + +import javax.swing.text.html.Option; +import java.util.Optional; + +public interface RoleRepository { + Optional findById(Long id); + + Role save(Role role); +} diff --git a/src/main/java/com/chint/domain/repository/RoleUserRepository.java b/src/main/java/com/chint/domain/repository/RoleUserRepository.java new file mode 100644 index 00000000..782e915c --- /dev/null +++ b/src/main/java/com/chint/domain/repository/RoleUserRepository.java @@ -0,0 +1,11 @@ +package com.chint.domain.repository; + +import com.chint.domain.aggregates.user.RoleUser; + +import java.util.List; + +public interface RoleUserRepository { + List findByUserId(Long userId); + + RoleUser save(RoleUser roleUser); +} diff --git a/src/main/java/com/chint/domain/repository/SystemOrganizationRepository.java b/src/main/java/com/chint/domain/repository/SystemOrganizationRepository.java index 770872ad..fee8c335 100644 --- a/src/main/java/com/chint/domain/repository/SystemOrganizationRepository.java +++ b/src/main/java/com/chint/domain/repository/SystemOrganizationRepository.java @@ -13,9 +13,14 @@ public interface SystemOrganizationRepository { List findAll(); + List findByIdIn(List ids); + + List findByOrgLevelIsNull(); + Optional findByOrgCodeContaining(String orgCode); - List findByOrgCodeList(List orgCode); + List findByOrgCodeList(List orgCode); List findByParentId(Long parentId); + } diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index 2fb7af7a..6e0590b2 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -28,12 +28,12 @@ import com.chint.interfaces.rest.ctrip.dto.search.car.OrderFee; import com.chint.interfaces.rest.ctrip.dto.search.flight.*; import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity; import com.chint.interfaces.rest.ctrip.dto.search.hotel.RefundInfo; +import com.chint.interfaces.rest.data_center.user.UserHttpRequest; import com.chint.interfaces.rest.ly.LYSearchRequest; import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderResponse; import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse; import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse; -import com.chint.interfaces.rest.data_center.user.UserHttpRequest; import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -59,12 +59,6 @@ public class OrderDomainService { @Autowired private RouteRepository routeRepository; - @Autowired - private UserRepository userRepository; - - @Autowired - private LocationRepository locationRepository; - @Autowired private RouteOrderFactory routeOrderFactory; @@ -74,18 +68,6 @@ public class OrderDomainService { @Autowired private OrderDetailRepository orderDetailRepository; - @Autowired - private UserHttpRequest userHttpRequest; - - @Autowired - private BPMParamFactory bpmParamFactory; - - @Autowired - private BPMRequest bpmRequest; - - @Autowired - private LegRepository legRepository; - @Autowired private LegEventFactory legEventFactory; @@ -98,12 +80,6 @@ public class OrderDomainService { @Autowired private LYSearchRequest lySearchRequest; - @Autowired - private JdbcOrderDetailRepository jdbcOrderDetailRepository; - - @Autowired - private JdbcLegRepository jdbcLegRepository; - @Autowired private BPMOrderDomainService bpmOrderDomainService; @@ -183,55 +159,77 @@ public class OrderDomainService { OrderDetail orderDetail = command.getOrderDetail(); String outStatus = command.getOutStatus(); Integer orderEventType = command.getOrderEventType(); - OrderEvent event = orderDetailFactory.createEvent(orderEventType, - outStatus); - if (orderEventType.equals(ORDER_EVENT_ETA) || - orderEventType.equals(ORDER_EVENT_CHANGE) || - orderEventType.equals(ORDER_EVENT_REFUND)) { + OrderEvent event = orderDetailFactory.createEvent(orderEventType, outStatus); + + if (isSpecialEventType(orderEventType)) { event.setExtension(command.getExtension()); } + orderDetail.addOrderEvent(event); + reCheckOrderETA(event, orderDetail); orderDetailRepository.save(orderDetail); - if (orderEventType.equals(ORDER_EVENT_ETA) || + if (isSpecialEventType(orderEventType)) { + handleSpecialEvent(orderDetail, command, orderEventType); + } + } + + private boolean isSpecialEventType(Integer orderEventType) { + return orderEventType.equals(ORDER_EVENT_ETA) || orderEventType.equals(ORDER_EVENT_CHANGE) || - orderEventType.equals(ORDER_EVENT_REFUND)) { - //这里如果发现事件的状态为ORDER_EVENT_ETA - //需要根据发送审批给bpm - //根据订单类型获取不同的订单扩展明细 - orderDetail.getExtensionDataByProductType(); - Command.of(BPMAuditCommand.class) - .operationType(orderEventType) - .orderNo(orderDetail.getOrderNo()) - .productType(orderDetail.getProductType()) - .extensionData(orderDetail) - .reason(command.getExtension()) - .sendToQueue(); + orderEventType.equals(ORDER_EVENT_REFUND); + } - if (orderDetail.getSupplierName().equals(SUPPLIER_C_TRIP)) { - if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_AIRPLANE)) { - cTripFlightRefundAndChangeOrder(orderDetail.getOrderNo()); - } - if (orderDetail.getProductType().equals(LEG_TYPE_HOTEL)) { - cTripHotelRefundAndChangeOrder(orderDetail.getOrderNo()); - } - if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TAXI)) { - cTripCarRefundChangeOrder(orderDetail.getOrderNo()); - } - } + private void handleSpecialEvent(OrderDetail orderDetail, OrderStatusChangeCommand command, Integer orderEventType) { + orderDetail.getExtensionDataByProductType(); + sendBPMAuditCommand(orderDetail, command, orderEventType); - if (orderDetail.getSupplierName().equals(SUPPLIER_L_Y)) { - if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TRAIN)) { - lyTrainRefundGenerate(orderDetail.getOrderNo()); - } - if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_HOTEL)) { - lyHotelRefundGenerate(orderDetail.getOrderNo()); - } - if (!orderEventType.equals(ORDER_EVENT_ETA) && orderDetail.getProductType().equals(LEG_TYPE_TAXI)) { - lyCarRefundGenerate(orderDetail.getOrderNo()); - } + String supplierName = orderDetail.getSupplierName(); + Integer productType = orderDetail.getProductType(); + + if (SUPPLIER_C_TRIP.equals(supplierName)) { + handleCTripEvents(orderDetail, orderEventType, productType); + } else if (SUPPLIER_L_Y.equals(supplierName)) { + handleLYEvents(orderDetail, orderEventType, productType); + } + } + + private void sendBPMAuditCommand(OrderDetail orderDetail, OrderStatusChangeCommand command, Integer orderEventType) { + Command.of(BPMAuditCommand.class) + .operationType(orderEventType) + .orderNo(orderDetail.getOrderNo()) + .productType(orderDetail.getProductType()) + .extensionData(orderDetail) + .reason(command.getExtension()) + .sendToQueue(); + } + + private void handleCTripEvents(OrderDetail orderDetail, Integer orderEventType, Integer productType) { + String orderNo = orderDetail.getOrderNo(); + if (ORDER_EVENT_ETA != orderEventType) { + if (LEG_TYPE_AIRPLANE == productType) { + cTripFlightRefundAndChangeOrder(orderNo); + } else if (LEG_TYPE_TAXI == productType) { + cTripCarRefundChangeOrder(orderNo); } } + if (LEG_TYPE_HOTEL == productType) { + cTripHotelRefundAndChangeOrder(orderNo); + } + } + + private void handleLYEvents(OrderDetail orderDetail, Integer orderEventType, Integer productType) { + String orderNo = orderDetail.getOrderNo(); + if (ORDER_EVENT_ETA != (orderEventType)) { + if (LEG_TYPE_TRAIN == productType) { + lyTrainRefundGenerate(orderNo); + } else if (LEG_TYPE_TAXI == productType) { + lyCarRefundGenerate(orderNo); + } + } + if (LEG_TYPE_HOTEL == productType) { + lyHotelRefundGenerate(orderNo); + } } @ListenTo(command = "BPMAuditCommand", order = 0) @@ -431,4 +429,45 @@ public class OrderDomainService { } return routeOrder; } + + + private OrderDetail reCheckOrderETA(OrderEvent orderEvent, OrderDetail orderDetail) { + if (!orderEvent.getEventType().equals(ORDER_EVENT_ETA)) { + return orderDetail; + } + Integer productType = orderDetail.getProductType(); + switch (productType) { + case LEG_TYPE_TRAIN -> { + TrainOrderDetail trainOrderDetail = orderDetail.getTrainOrderDetail(); + if (trainOrderDetail != null) { + trainOrderDetail.setOverStandard("是"); + trainOrderDetail.setOverStandardReason(orderEvent.getExtension()); + } + } + case LEG_TYPE_AIRPLANE -> { + FlightOrderDetail flightOrderDetail = orderDetail.getFlightOrderDetail(); + if (flightOrderDetail != null) { + flightOrderDetail.setOverStandard("是"); + flightOrderDetail.setOverStandardReason(orderEvent.getExtension()); + } + } + case LEG_TYPE_HOTEL -> { + HotelOrderDetail hotelOrderDetail = orderDetail.getHotelOrderDetail(); + if (hotelOrderDetail != null) { + hotelOrderDetail.setOverStandard("是"); + hotelOrderDetail.setOverStandardReason(orderEvent.getExtension()); + } + } + case LEG_TYPE_TAXI -> { + CarOrderDetail carOrderDetail = orderDetail.getCarOrderDetail(); + if (carOrderDetail != null) { + carOrderDetail.setOverStandard("是"); + carOrderDetail.setOverStandardReason(orderEvent.getExtension()); + } + } + default -> { + } + } + return orderDetail; + } } diff --git a/src/main/java/com/chint/domain/service/SystemDomainService.java b/src/main/java/com/chint/domain/service/SystemDomainService.java index d5aa3440..c4f5bf22 100644 --- a/src/main/java/com/chint/domain/service/SystemDomainService.java +++ b/src/main/java/com/chint/domain/service/SystemDomainService.java @@ -1,18 +1,22 @@ package com.chint.domain.service; +import com.chint.application.commands.UserRoleCommand; import com.chint.application.dtos.OrganizationTicketClerk; import com.chint.domain.aggregates.order.order_record.OrderBaseRecord; import com.chint.domain.aggregates.system.AccountCompany; import com.chint.domain.aggregates.system.SystemCode; import com.chint.domain.aggregates.system.SystemOrganization; import com.chint.domain.aggregates.system.SystemOrganizationExtension; +import com.chint.domain.aggregates.user.RoleOrganization; +import com.chint.domain.aggregates.user.RoleUser; +import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.NotFoundException; -import com.chint.domain.repository.AccountCompanyRepository; -import com.chint.domain.repository.SystemCodeRepository; -import com.chint.domain.repository.SystemOrganizationRepository; +import com.chint.domain.repository.*; +import com.chint.infrastructure.echo_framework.annotation.ListenTo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -33,6 +37,12 @@ public class SystemDomainService { @Autowired private SystemOrganizationRepository systemOrganizationRepository; + @Autowired + private RoleUserRepository roleUserRepository; + + @Autowired + private RoleRepository roleRepository; + public boolean checkSystemCode(String sysCode) { boolean b = systemCodeRepository.findBySysCode(sysCode) != null; if (!b) { @@ -147,4 +157,46 @@ public class SystemDomainService { .findFirst() .orElse(null); } + + @ListenTo(command = "UserRoleCommand", order = 0) + public void loadUserRole(UserRoleCommand command) { + User user = command.getUser(); + List byUserId = roleUserRepository.findByUserId(user.getUserId()); + List orgListId = byUserId.stream().flatMap(it -> + roleRepository + .findById(it.getRoleId()) + .stream() + .flatMap(role -> role.getRoleOrganizationList().stream()) + .map(RoleOrganization::getOrgId) + ).distinct().toList(); + + // 获取所有的 SystemOrganization + List rootOrganizations = systemOrganizationRepository.findByIdIn(orgListId); + + // 展开所有的 SystemOrganization + List allOrganizations = new ArrayList<>(); + rootOrganizations.forEach(rootOrg -> expandOrganizations(rootOrg, allOrganizations)); + + // 设置用户的角色组织列表 + user.setRoleOrgCodeList( + allOrganizations.stream() + .map(SystemOrganization::getOrgShortCode) + .distinct() + .toList() + ); + user.setRoleOrgList( + allOrganizations.stream() + .map(SystemOrganization::mapToVO) + .distinct() + .toList() + ); + } + + private void expandOrganizations(SystemOrganization org, List allOrganizations) { + queryChild(org); // 查询子组织 + allOrganizations.add(org); // 添加当前组织到列表 + for (SystemOrganization child : org.getChildOrganizationList()) { + expandOrganizations(child, allOrganizations); // 递归展开子组织 + } + } } diff --git a/src/main/java/com/chint/domain/value_object/system/SystemOrganizationVO.java b/src/main/java/com/chint/domain/value_object/system/SystemOrganizationVO.java new file mode 100644 index 00000000..3891e793 --- /dev/null +++ b/src/main/java/com/chint/domain/value_object/system/SystemOrganizationVO.java @@ -0,0 +1,18 @@ +package com.chint.domain.value_object.system; + +import lombok.Data; + +@Data +public class SystemOrganizationVO { + private Long id; + private String orgCode; + private String orgShortCode; + private String orgName; + private String orgEnName; + private Long parentId; + private String parentOrgCode; + private String parentOrgName; + private String parentOrgEnName; + private String costCenter; + private String orgLevel; +} diff --git a/src/main/java/com/chint/infrastructure/repository/RoleRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RoleRepositoryImpl.java new file mode 100644 index 00000000..78a05326 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/RoleRepositoryImpl.java @@ -0,0 +1,42 @@ +package com.chint.infrastructure.repository; + +import com.chint.domain.aggregates.user.Role; +import com.chint.domain.repository.RoleRepository; +import com.chint.infrastructure.repository.cache.CacheRoleRepository; +import com.chint.infrastructure.repository.jdbc.JdbcRoleRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public class RoleRepositoryImpl implements RoleRepository { + @Autowired + private JdbcRoleRepository jdbcRoleRepository; + + @Autowired + private CacheRoleRepository cacheRoleRepository; + + @Override + public Optional findById(Long id) { + if (id == null) { + return Optional.empty(); + } + Optional fromCache = cacheRoleRepository.getFromCache(id, Optional.empty()); + if (fromCache.isPresent()) { + return fromCache; + } else { + return cacheRoleRepository.getFromCache(id, jdbcRoleRepository.findById(id)); + } + } + + + @Override + public Role save(Role role) { + Long id = role.getId(); + if(id != null){ + cacheRoleRepository.evict(id); + } + return jdbcRoleRepository.save(role); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/RoleUserRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RoleUserRepositoryImpl.java new file mode 100644 index 00000000..26f4198f --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/RoleUserRepositoryImpl.java @@ -0,0 +1,30 @@ +package com.chint.infrastructure.repository; + +import com.chint.domain.aggregates.user.RoleUser; +import com.chint.domain.repository.RoleUserRepository; +import com.chint.infrastructure.repository.jdbc.JdbcRoleUserRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class RoleUserRepositoryImpl implements RoleUserRepository { + + @Autowired + private JdbcRoleUserRepository jdbcRoleUserRepository; + + @Cacheable(value = "RoleUser", key = "#userId") + @Override + public List findByUserId(Long userId) { + return jdbcRoleUserRepository.findByUserId(userId); + } + + @CacheEvict(value = "RoleUser", key = "#roleUser.userId") + @Override + public RoleUser save(RoleUser roleUser) { + return jdbcRoleUserRepository.save(roleUser); + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/SystemOrganizationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/SystemOrganizationRepositoryImpl.java index afc1a850..1bab8a9c 100644 --- a/src/main/java/com/chint/infrastructure/repository/SystemOrganizationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/SystemOrganizationRepositoryImpl.java @@ -2,6 +2,7 @@ package com.chint.infrastructure.repository; import com.chint.domain.aggregates.system.SystemOrganization; import com.chint.domain.repository.SystemOrganizationRepository; +import com.chint.infrastructure.repository.cache.CacheSystemOrganizationRepository; import com.chint.infrastructure.repository.jdbc.JdbcSystemOrganizationRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @@ -16,6 +17,9 @@ public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepos @Autowired private JdbcSystemOrganizationRepository jdbcSystemOrganizationRepository; + @Autowired + private CacheSystemOrganizationRepository cacheSystemOrganizationRepository; + @Override public void saveAll(List systemOrganizationList) { for (SystemOrganization systemOrganization : systemOrganizationList) { @@ -30,7 +34,10 @@ public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepos @Override public SystemOrganization save(SystemOrganization systemOrganization) { - return jdbcSystemOrganizationRepository.save(systemOrganization); + cacheSystemOrganizationRepository.cacheEvict(systemOrganization); // 先清理旧缓存 + jdbcSystemOrganizationRepository.save(systemOrganization); + cacheSystemOrganizationRepository.cacheEvictIdsByParentId(systemOrganization.getParentId()); + return cacheSystemOrganizationRepository.cache(systemOrganization); } @Override @@ -41,20 +48,55 @@ public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepos return systemOrganizationList; } + @Override + public List findByIdIn(List ids) { + List fromCacheByIdIn = cacheSystemOrganizationRepository.getFromCacheByIdIn(ids); + List fromCacheOrg = fromCacheByIdIn.stream().map(SystemOrganization::getId).toList(); + List list = ids.stream().filter(it -> !fromCacheOrg.contains(it)).toList(); + if (!list.isEmpty()) { + List fromDBByIdIn = jdbcSystemOrganizationRepository.findByIdIn(list); + fromDBByIdIn.forEach(it -> cacheSystemOrganizationRepository.cache(it)); // 更新缓存 + fromCacheByIdIn.addAll(fromDBByIdIn); + } + return fromCacheByIdIn; + } + + @Override + public List findByOrgLevelIsNull() { + return jdbcSystemOrganizationRepository.findByOrgLevelIsNullOrOrgLevel("").stream() + .peek(systemOrganization -> cacheSystemOrganizationRepository.cache(systemOrganization)) // 更新缓存 + .toList(); + } + @Override public Optional findByOrgCodeContaining(String orgCode) { - return jdbcSystemOrganizationRepository.findByOrgCodeContaining(orgCode).stream().findFirst(); + return jdbcSystemOrganizationRepository.findByOrgCodeContaining(orgCode).stream() + .peek(systemOrganization -> cacheSystemOrganizationRepository.cache(systemOrganization)) // 更新缓存 + .findFirst(); } @Override public List findByOrgCodeList(List orgCode) { - return jdbcSystemOrganizationRepository.findByOrgShortCodeIn(orgCode); + return jdbcSystemOrganizationRepository.findByOrgShortCodeIn(orgCode).stream() + .peek(systemOrganization -> cacheSystemOrganizationRepository.cache(systemOrganization)) // 更新缓存 + .toList(); } - @Override public List findByParentId(Long parentId) { - return jdbcSystemOrganizationRepository.findByParentId(parentId); + List idsFromCacheByParentId = cacheSystemOrganizationRepository.getIdsFromCacheByParentId(parentId, null); + List list; + if (idsFromCacheByParentId == null) { + list = jdbcSystemOrganizationRepository.findByParentId(parentId).stream() + .peek(systemOrganization -> cacheSystemOrganizationRepository.cache(systemOrganization)) // 更新缓存 + .toList(); + cacheSystemOrganizationRepository.cacheEvictIdsByParentId(parentId); + List ids = list.stream().map(SystemOrganization::getId).toList(); + cacheSystemOrganizationRepository.getIdsFromCacheByParentId(parentId, ids); + } else { + list = cacheSystemOrganizationRepository.getFromCacheByIdIn(idsFromCacheByParentId); + } + return list; } } diff --git a/src/main/java/com/chint/infrastructure/repository/cache/CacheRoleRepository.java b/src/main/java/com/chint/infrastructure/repository/cache/CacheRoleRepository.java new file mode 100644 index 00000000..0a45e671 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/cache/CacheRoleRepository.java @@ -0,0 +1,22 @@ +package com.chint.infrastructure.repository.cache; + +import com.chint.domain.aggregates.user.Role; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public class CacheRoleRepository { + + + @Cacheable(value = "Role", key = "#id") + public Optional getFromCache(Long id, Optional role) { + return role; + } + + @CacheEvict(value = "Role", key = "#id") + public void evict(Long id) { + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/cache/CacheSystemOrganizationRepository.java b/src/main/java/com/chint/infrastructure/repository/cache/CacheSystemOrganizationRepository.java new file mode 100644 index 00000000..4598417c --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/cache/CacheSystemOrganizationRepository.java @@ -0,0 +1,43 @@ +package com.chint.infrastructure.repository.cache; + + +import com.chint.domain.aggregates.system.SystemOrganization; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public class CacheSystemOrganizationRepository { + + @Autowired + private RedisTemplate redisTemplate; + + public List getFromCacheByIdIn(List ids) { + List routeOrderKeys = ids.stream().map(id -> "SystemOrganization::" + id).toList(); + return redisTemplate.opsForValue().multiGet(routeOrderKeys); + } + + @Cacheable(value = "SystemOrganization", key = "#systemOrganization.id") + public SystemOrganization cache(SystemOrganization systemOrganization) { + return systemOrganization; + } + + @CacheEvict(value = "SystemOrganization", key = "#systemOrganization.id") + public void cacheEvict(SystemOrganization systemOrganization) { + } + + @Cacheable(value = "SystemOrganization::ParentId", key = "#parentId") + // 新增方法:根据 parentId 从缓存中获取子组织的 ID 列表 + public List getIdsFromCacheByParentId(Long parentId, List ids) { + return ids; + } + + // 新增方法:根据 parentId 清除缓存中子组织的 ID 列表 + @CacheEvict(value = "SystemOrganization::ParentId", key = "#parentId") + public void cacheEvictIdsByParentId(Long parentId) { + } +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleRepository.java new file mode 100644 index 00000000..ce307fb8 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleRepository.java @@ -0,0 +1,10 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.standards.Ranks; +import com.chint.domain.aggregates.user.Role; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface JdbcRoleRepository extends CrudRepository { +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleUserRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleUserRepository.java new file mode 100644 index 00000000..177d6f04 --- /dev/null +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRoleUserRepository.java @@ -0,0 +1,13 @@ +package com.chint.infrastructure.repository.jdbc; + +import com.chint.domain.aggregates.user.RoleUser; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface JdbcRoleUserRepository extends CrudRepository { + + List findByUserId(Long userId); +} diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcSystemOrganizationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcSystemOrganizationRepository.java index 933ad7d2..1a4d2bca 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcSystemOrganizationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcSystemOrganizationRepository.java @@ -12,5 +12,7 @@ public interface JdbcSystemOrganizationRepository extends CrudRepository findByOrgCodeContaining(String orgCode); List findByOrgCode(String orgCode); List findByParentId(Long parentId); + List findByOrgLevelIsNullOrOrgLevel(String orgLevel); List findByOrgShortCodeIn(Collection orgCode); + List findByIdIn(Collection id); } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 20d7a178..997bfba5 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("31900510524"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31791272980"); System.out.println(response); } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index b5eb421f..8033b52e 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -291,7 +291,7 @@ class RouteApplicationTests { @Test void loginSign() { - String sfno = "0001018592"; + String sfno = "060726001"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -302,7 +302,7 @@ class RouteApplicationTests { @Test void loginSignProd() { - String sfno = "180605039"; + String sfno = "060726001"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -310,10 +310,6 @@ class RouteApplicationTests { String key = "ZhengTaiRoute"; String s = Digest.md5(sfno + syscode + billcode + companycode + key + timespan); System.out.println(s); -// log.info("info"); -// log.trace("trace"); -// log.trace("trace"); -// log.trace("trace"); } // @Test