diff --git a/src/main/java/com/chint/application/commands/OrderCreateCommand.java b/src/main/java/com/chint/application/commands/OrderCreateCommand.java index 81b57730..160b244f 100644 --- a/src/main/java/com/chint/application/commands/OrderCreateCommand.java +++ b/src/main/java/com/chint/application/commands/OrderCreateCommand.java @@ -1,5 +1,6 @@ package com.chint.application.commands; +import com.chint.domain.aggregates.user.User; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.echo_framework.command.Command; import lombok.Data; @@ -8,10 +9,10 @@ import lombok.EqualsAndHashCode; @EqualsAndHashCode(callSuper = true) @Data public class OrderCreateCommand extends Command { - private UserLoginParam loginParam; + private User user; - public OrderCreateCommand of(UserLoginParam loginParam) { - this.loginParam = loginParam; + public OrderCreateCommand of(User user) { + this.user = user; return this; } } diff --git a/src/main/java/com/chint/application/in/OrderController.java b/src/main/java/com/chint/application/in/OrderController.java index 721b8612..6bd92629 100644 --- a/src/main/java/com/chint/application/in/OrderController.java +++ b/src/main/java/com/chint/application/in/OrderController.java @@ -69,6 +69,4 @@ public class OrderController { orderApplicationService.deleteLegToOrder(deleteLegData); return Result.Success(SUCCESS); } - - } diff --git a/src/main/java/com/chint/application/out/LoginController.java b/src/main/java/com/chint/application/out/LoginController.java index 4097599d..43fd3bb2 100644 --- a/src/main/java/com/chint/application/out/LoginController.java +++ b/src/main/java/com/chint/application/out/LoginController.java @@ -60,7 +60,7 @@ public class LoginController { throw new OrderException("companycode 不能为空"); } //发送创建行程订单命令 - Command.of(OrderCreateCommand.class).of(userLoginParam).sendToQueue(); + Command.of(OrderCreateCommand.class).of(BaseContext.getCurrentUser()).sendToQueue(); } //异步执行更新用户信息到同程 diff --git a/src/main/java/com/chint/application/queryies/OrderQuery.java b/src/main/java/com/chint/application/queryies/OrderQuery.java index 6b171f38..ea82618b 100644 --- a/src/main/java/com/chint/application/queryies/OrderQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderQuery.java @@ -18,6 +18,7 @@ import com.chint.domain.value_object.*; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.PageResult; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Page; import org.springframework.stereotype.Service; import java.time.format.DateTimeFormatter; @@ -53,30 +54,75 @@ public class OrderQuery { } public PageResult pageQuery(OrderQueryData queryData) { + + //执行筛选分页查询 + List approvalStatusCodes = queryData.getApprovalStatusCodes(); + List legTypes = queryData.getLegTypes(); + if (!approvalStatusCodes.isEmpty() || !legTypes.isEmpty()) { + Integer pageNum = queryData.getPageNum(); + Integer pageSize = queryData.getPageSize(); + List routeOrders = routeRepository.findByActualOrderNoNotNull(); + if (!approvalStatusCodes.isEmpty()) { + routeOrders = routeOrders.stream() + .filter(routeOrder -> approvalStatusCodes.contains(routeOrder.getApprovalStatusCode())) + .toList(); + } + if (!legTypes.isEmpty()) { + routeOrders = routeOrders.stream() + .filter(routeOrder -> { + List list = new ArrayList<>(routeOrder.getLegItems().stream().map(Leg::getLegType).toList()); + return list.retainAll(legTypes); + }) + .toList(); + } + int total = routeOrders.size(); + List orders = routeOrders + .stream() + .skip((long) (pageNum - 1) * pageSize) + .limit(pageSize) + .map(OrderQuery::getRouteOrderPageRes) + .toList(); + return new PageResult<>(total, orders); + } + + if (queryData.getOrderNo() != null) { + Page byOrderNoFuzzy = routeRepository.findByOrderNoFuzzy(queryData); + return new PageResult<>(byOrderNoFuzzy.getTotalElements(), + byOrderNoFuzzy + .getContent() + .stream() + .map(OrderQuery::getRouteOrderPageRes) + .toList()); + } + + + //执行普通分页查询 PageResult routeOrderPageResult = routeRepository.pageQuery(queryData); routeOrderPageResult.getRecords().forEach(order -> { orderDomainService.queryLocation(order.getLegItems()); }); - User currentUser = BaseContext.getCurrentUser(); List routeOrderPageRes = routeOrderPageResult .getRecords() .stream() - .map(routeOrder -> { - RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class); - List locationRes = routeOrder.getLegItems() - .stream() - .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) - .map(LocationRes::copyFrom) - .distinct() - .toList(); - res.setLocationResList(locationRes); - res.setUserName(currentUser.getName()); - return res; - }) + .map(OrderQuery::getRouteOrderPageRes) .toList(); return new PageResult<>(routeOrderPageResult.getTotal(), routeOrderPageRes); } + private static RouteOrderPageRes getRouteOrderPageRes(RouteOrder routeOrder) { + User currentUser = BaseContext.getCurrentUser(); + RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class); + List locationRes = routeOrder.getLegItems() + .stream() + .flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation())) + .map(LocationRes::copyFrom) + .distinct() + .toList(); + res.setLocationResList(locationRes); + res.setUserName(currentUser.getName()); + return res; + } + public RouteOrder queryById(Long routeId) { RouteOrder routeOrder = routeRepository.queryById(routeId); orderDomainService.queryLocation(routeOrder.getLegItems()); 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 7fa4b451..92262780 100644 --- a/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java +++ b/src/main/java/com/chint/domain/aggregates/order/RouteOrder.java @@ -41,6 +41,8 @@ public class RouteOrder extends BaseEntity { private LocalDateTime bookingTime; private Long userId; private String supplierName; + //差标等级 + private String standardLevel; //审批订单号 @Embedded.Nullable private ApproveOrderNo approveOrderNo; 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 621e6387..19c31e62 100644 --- a/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order/RouteOrderFactory.java @@ -45,7 +45,8 @@ public class RouteOrderFactory implements OrderFactory { @Override public RouteOrder createRoute(OrderCreateCommand command) { User currentUser = BaseContext.getCurrentUser(); - UserLoginParam loginParam = command.getLoginParam(); + User user = command.getUser(); + UserLoginParam loginParam = user.getUserLoginParam(); RouteOrder routeOrder = new RouteOrder(); routeOrder.setRouteOrderNo(OrderNo.generate()); //根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号 diff --git a/src/main/java/com/chint/domain/repository/RouteRepository.java b/src/main/java/com/chint/domain/repository/RouteRepository.java index d9cf8d53..83f24a96 100644 --- a/src/main/java/com/chint/domain/repository/RouteRepository.java +++ b/src/main/java/com/chint/domain/repository/RouteRepository.java @@ -3,6 +3,9 @@ package com.chint.domain.repository; import com.chint.domain.aggregates.order.RouteOrder; import com.chint.domain.value_object.OrderQueryData; import com.chint.infrastructure.util.PageResult; +import org.springframework.data.domain.Page; + +import java.util.List; public interface RouteRepository { RouteOrder queryById(Long orderId); @@ -14,9 +17,12 @@ public interface RouteRepository { RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode); RouteOrder findByOrderNo(String orderNo); + Page findByOrderNoFuzzy(OrderQueryData orderQueryData); RouteOrder save(RouteOrder routeOrder); PageResult pageQuery(OrderQueryData orderQueryData); + + List findByActualOrderNoNotNull(); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/repository/UserRepository.java b/src/main/java/com/chint/domain/repository/UserRepository.java index 54e194a6..17a55a1c 100644 --- a/src/main/java/com/chint/domain/repository/UserRepository.java +++ b/src/main/java/com/chint/domain/repository/UserRepository.java @@ -5,6 +5,5 @@ import com.chint.domain.aggregates.user.User; public interface UserRepository { User findById(Long id); User findByUserEmployeeNo(Long employeeNo); - User save(User user); } \ No newline at end of file diff --git a/src/main/java/com/chint/domain/service/OrderDomainService.java b/src/main/java/com/chint/domain/service/OrderDomainService.java index 6a0ae1d2..acb34138 100644 --- a/src/main/java/com/chint/domain/service/OrderDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderDomainService.java @@ -18,6 +18,7 @@ import com.chint.domain.value_object.ApprovalLegData; import com.chint.domain.value_object.UserLoginParam; import com.chint.infrastructure.echo_framework.annotation.ListenTo; import com.chint.infrastructure.util.BaseContext; +import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -46,6 +47,9 @@ public class OrderDomainService { @Autowired private OrderDetailRepository orderDetailRepository; + @Autowired + private UserHttpRequest userHttpRequest; + public RouteOrder saveOrder(RouteOrder routeOrder) { return routeRepository.save(routeOrder); } @@ -60,13 +64,13 @@ public class OrderDomainService { @ListenTo(command = "OrderCreateCommand", order = 0) public RouteOrder createOrder(OrderCreateCommand command) { - UserLoginParam loginParam = command.getLoginParam(); - User byUserEmployeeNo = userRepository.findByUserEmployeeNo(Long.valueOf(loginParam.getSfno())); + User user = command.getUser(); + UserLoginParam loginParam = user.getUserLoginParam(); return Optional.ofNullable(routeRepository .findByFakeOrderNoAndSysCode(loginParam.getBillcode(), loginParam.getSyscode())) .orElseGet(() -> { - BaseContext.setCurrentUser(byUserEmployeeNo); RouteOrder order = routeOrderFactory.createRoute(command); + order.setStandardLevel(user.getStandardLevel()); ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_PREPARE); order.addApprovalEvent(approvalEvent); this.saveOrder(order); @@ -75,7 +79,6 @@ public class OrderDomainService { } - @ListenTo(command = "OrderApprovalCommand", order = 0) public void approvalOrder(OrderApprovalCommand command) { ApprovalLegData data = command.getData(); 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 b7e0841e..1af37a25 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 @@ -4,6 +4,7 @@ import com.chint.application.commands.*; import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.CommandException; +import com.chint.domain.exceptions.OrderException; import com.chint.domain.factoriy.leg_event.LegEventFactory; import com.chint.domain.factoriy.order.RouteOrderFactory; import com.chint.domain.factoriy.order_detail.OrderDetailFactory; @@ -65,7 +66,9 @@ public class LegEventHandler implements LegEventService { public void approveLeg(LegApprovalCommand command) { ApproveLegData data = command.getData(); RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus(); - + if (routeOrder.getLegItems().isEmpty()) { + throw new OrderException(LEG_ERROR); + } if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) { ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo(); approveOrderNo.setActualOrderNo(data.getActualOrderNo()); diff --git a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java index b27ffc13..2b4381e2 100644 --- a/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java +++ b/src/main/java/com/chint/domain/service/order_sync/CTripOrderSyncAdapter.java @@ -2,10 +2,9 @@ package com.chint.domain.service.order_sync; import com.chint.domain.aggregates.order.Leg; import com.chint.domain.aggregates.order.RouteOrder; -import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.CityRepository; +import com.chint.domain.repository.UserRepository; import com.chint.domain.service.OrderDomainService; -import com.chint.infrastructure.util.BaseContext; import com.chint.interfaces.rest.ctrip.CTripApprovalRequest; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalRequest; import com.chint.interfaces.rest.ctrip.dto.approval.ApprovalResult; @@ -15,6 +14,7 @@ import com.chint.interfaces.rest.ctrip.dto.approval.hotel.HotelEndorsementDetail import com.chint.interfaces.rest.ctrip.dto.approval.quick.CarQuickEndorsementDetail; import com.chint.interfaces.rest.ctrip.dto.approval.quick.RankInfo; import com.chint.interfaces.rest.ctrip.dto.approval.train.TrainEndorsementDetail; +import com.chint.interfaces.rest.user.UserHttpRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,6 +37,12 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { @Autowired private OrderDomainService orderDomainService; + @Autowired + private UserHttpRequest userHttpRequest; + + @Autowired + private UserRepository userRepository; + @Override public boolean syncSupplierOrder(RouteOrder order) { System.out.println("开始同步协程订单"); @@ -54,31 +60,32 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { } private ApprovalRequest getApprovalRequestParam(RouteOrder order) { - User currentUser = BaseContext.getCurrentUser(); - RankInfo rankInfo = RankInfo.of(currentUser.getStandardLevel()); +// RankInfo rankInfo = RankInfo.of(order.getStandardLevel()); + RankInfo rankInfo = RankInfo.of("测试职级"); + String employeeNo = String.valueOf(order.getUserId()); ApprovalRequest approvalRequestParam = ApprovalRequest - .buildApproval(order.getRouteOrderNo(), String.valueOf(currentUser.getEmployeeNo()), rankInfo); + .buildApproval(order.getRouteOrderNo(), String.valueOf(employeeNo), rankInfo); Map> collect = orderDomainService.queryLocation(order.getLegItems()) .stream().collect(Collectors.groupingBy(Leg::getLegType)); collect.forEach((k, v) -> { switch (k) { - case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v)); - case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v)); - case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v)); - case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v)); + case LEG_TYPE_TRAIN -> approvalRequestParam.withTrain(generateTrainList(v, employeeNo)); + case LEG_TYPE_HOTEL -> approvalRequestParam.withHotel(generateHotelList(v, employeeNo)); + case LEG_TYPE_AIRPLANE -> approvalRequestParam.withAir(generateFilghtList(v, employeeNo)); + case LEG_TYPE_TAXI -> approvalRequestParam.withQuickCar(generateCarList(v, employeeNo)); } }); return approvalRequestParam; } - private List generateHotelList(List legs) { + private List generateHotelList(List legs, String employeeNo) { List hotelList = new ArrayList<>(); legs.forEach(leg -> { hotelList.add( HotelEndorsementDetail.of(List.of( cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() )) - .passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .passenger(PassengerDetail.of(employeeNo)) .starTime(leg.getStartTime()) .endTime(leg.getEndTime()) ); @@ -86,7 +93,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { return hotelList; } - private List generateFilghtList(List legs) { + private List generateFilghtList(List legs, String employeeNo) { List filghtList = new ArrayList<>(); legs.forEach(leg -> { filghtList.add( @@ -95,7 +102,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { ), List.of( cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity() )) - .passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + .passenger(PassengerDetail.of(employeeNo)) .starTime(leg.getStartTime()) .endTime(leg.getEndTime()) ); @@ -103,7 +110,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { return filghtList; } - private List generateTrainList(List legs) { + private List generateTrainList(List legs, String employeeNo) { List trainList = new ArrayList<>(); legs.forEach(leg -> { trainList.add( @@ -111,7 +118,7 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() ), List.of( cityRepository.findByCityName(leg.getDestinationLocation().getLocationName()).getCity() - )).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + )).passenger(PassengerDetail.of(employeeNo)) .starTime(leg.getStartTime()) .endTime(leg.getEndTime()) ); @@ -119,13 +126,13 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync { return trainList; } - private List generateCarList(List legs) { + private List generateCarList(List legs, String employeeNo) { List carList = new ArrayList<>(); legs.forEach(leg -> { carList.add( CarQuickEndorsementDetail.of(List.of( cityRepository.findByCityName(leg.getOriginLocation().getLocationName()).getCity() - )).passenger(PassengerDetail.of(String.valueOf(BaseContext.getCurrentUser().getEmployeeNo()))) + )).passenger(PassengerDetail.of(employeeNo)) .starTime(leg.getStartTime()) .endTime(leg.getEndTime()) ); diff --git a/src/main/java/com/chint/domain/value_object/OrderQueryData.java b/src/main/java/com/chint/domain/value_object/OrderQueryData.java index bd1c6801..b4311b16 100644 --- a/src/main/java/com/chint/domain/value_object/OrderQueryData.java +++ b/src/main/java/com/chint/domain/value_object/OrderQueryData.java @@ -4,12 +4,15 @@ package com.chint.domain.value_object; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.List; + @EqualsAndHashCode(callSuper = true) @Data public class OrderQueryData extends BaseQuery { private Long routeId; - private String billcode; - private String sysCode; + private List approvalStatusCodes; + private List legTypes; + private String orderNo; } diff --git a/src/main/java/com/chint/infrastructure/constant/Constant.java b/src/main/java/com/chint/infrastructure/constant/Constant.java index 3645045b..36406dc4 100644 --- a/src/main/java/com/chint/infrastructure/constant/Constant.java +++ b/src/main/java/com/chint/infrastructure/constant/Constant.java @@ -11,6 +11,7 @@ public class Constant { public static final String INVALID_REQUEST = "无效的请求"; public static final String ACCESS_DENIED = "访问被拒绝"; public static final String SERVER_ERROR = "服务器错误"; + public static final String LEG_ERROR = "行程错误"; // 数据相关消息 public static final String DATA_ALREADY_EXISTS = "数据已存在"; diff --git a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java index ff5a0894..3f07f92a 100644 --- a/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/LocationRepositoryImpl.java @@ -34,7 +34,7 @@ public class LocationRepositoryImpl implements LocationRepository { return PageResult.totalPageNum(res.getTotalElements(), res.toList()); } if (locationParam.getLevel() != null) { - Page res = jdbcLocationRepository.findAllByLevel(locationParam.getLevel(), pageResult); + Page res = jdbcLocationRepository.findAllByLevel(Integer.valueOf(locationParam.getLevel().toString()), pageResult); return PageResult.totalPageNum(res.getTotalElements(), res.toList()); } if (locationParam.getParentLocationId() != null) { diff --git a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java index b78ec328..318e44be 100644 --- a/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/RouteRepositoryImpl.java @@ -38,8 +38,8 @@ public class RouteRepositoryImpl implements RouteRepository { } @Override - public RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo,String sysCode) { - return jdbcRouteRepository.findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(actualOrderNo,sysCode); + public RouteOrder findByActualOrderNoAndSysCode(String actualOrderNo, String sysCode) { + return jdbcRouteRepository.findByApproveOrderNo_ActualOrderNoAndApproveOrderNo_SysCode(actualOrderNo, sysCode); } @Override @@ -47,6 +47,16 @@ public class RouteRepositoryImpl implements RouteRepository { return jdbcRouteRepository.findByRouteOrderNo(orderNo); } + @Override + public Page findByOrderNoFuzzy(OrderQueryData orderQueryData) { + PageRequest sort = PageRequest + .of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort")); + User currentUser = BaseContext.getCurrentUser(); + return jdbcRouteRepository + .findByCreateUserAndRouteOrderNoContaining(currentUser.getUserId().toString() + , orderQueryData.getOrderNo(), sort); + } + @Override public RouteOrder save(RouteOrder routeOrder) { return jdbcRouteRepository.save(routeOrder); @@ -63,4 +73,10 @@ public class RouteRepositoryImpl implements RouteRepository { orders.forEach(RouteOrder::reloadStatus); return new PageResult<>(byUserId.getTotalElements(), orders); } + + @Override + public List findByActualOrderNoNotNull() { + User currentUser = BaseContext.getCurrentUser(); + return jdbcRouteRepository.findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(currentUser.getUserId().toString()); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/config/BeforeSaveCallbackImpl.java b/src/main/java/com/chint/infrastructure/repository/config/BeforeSaveCallbackImpl.java index eb503677..5cc35cf4 100644 --- a/src/main/java/com/chint/infrastructure/repository/config/BeforeSaveCallbackImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/config/BeforeSaveCallbackImpl.java @@ -20,7 +20,9 @@ public class BeforeSaveCallbackImpl implements BeforeSaveCallback { entity.setCreateUser(BaseContext.getCurrentUser().getUserId().toString()); } entity.setUpdateTime(LocalDateTime.now()); - entity.setUpdateUser(BaseContext.getCurrentUser().getUserId().toString()); + if (BaseContext.getCurrentUser() != null) { + entity.setUpdateUser(BaseContext.getCurrentUser().getUserId().toString()); + } return entity; } } \ No newline at end of file diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java index 8807195f..3ffa3e3f 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcLocationRepository.java @@ -16,7 +16,7 @@ public interface JdbcLocationRepository extends CrudRepository { Page findAllByParentLocationId(Long parentLocationId, Pageable pageable); - Page findAllByLevel(Long level, Pageable pageable); + Page findAllByLevel(Integer level, Pageable pageable); List findByFirstPinYin(String firstPinYin); List findByLocationNameContaining(String locationName); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java index a97d9c23..e029e386 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcRouteRepository.java @@ -3,10 +3,11 @@ package com.chint.infrastructure.repository.jdbc; import com.chint.domain.aggregates.order.RouteOrder; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.jdbc.repository.query.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface JdbcRouteRepository extends CrudRepository { Page findByCreateUser(String userId, Pageable pageable); @@ -21,4 +22,7 @@ public interface JdbcRouteRepository extends CrudRepository { RouteOrder findByRouteOrderNo(String routeOrderNo); + List findByCreateUserAndApproveOrderNo_ActualOrderNoNotNull(String createUser); + + Page findByCreateUserAndRouteOrderNoContaining(String createUser, String routeOrderNo, Pageable pageable); } diff --git a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java index 92bb87ee..6292a2b5 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -56,7 +56,8 @@ public class UserHttpRequestImpl implements UserHttpRequest { } Ranks ranks = rankDomainService.queryRanks(rankName, user.getCompanyCode()); if (ranks != null) { - user.setStandardLevel(ranks.getStandardLevel()); +// user.setStandardLevel(ranks.getStandardLevel()); + user.setStandardLevel("测试职级"); } return user; } @@ -92,7 +93,7 @@ public class UserHttpRequestImpl implements UserHttpRequest { }.getType(); if (result.getData() != null) { List fromJson = gson.fromJson(result.getData().toString(), type); -// UserDataDTO userDataDTO = fromJson.get(0); +// UserDataDTO userDataDTO = fromJson.get(0); String companyCode = user.getCompanyCode(); if (companyCode == null) { companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode(); diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 38b36842..41734d9b 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -34,12 +34,12 @@ class RouteApplicationTests { userHttpRequest.loadUserInfo(user); } -// @Test + @Test void loginSign() { - String sfno = "220322120"; + String sfno = "230615020"; String syscode = "FFSC"; - String billcode = ""; - String companycode = ""; + String billcode = "ABC10337191351"; + String companycode = "A30000001"; String sec = "Superdandan"; String timespan = "987654321"; String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan); @@ -76,5 +76,11 @@ class RouteApplicationTests { routeRepository.deleteById(17L); routeRepository.deleteById(18L); routeRepository.deleteById(19L); + routeRepository.deleteById(19L); + routeRepository.deleteById(19L); + routeRepository.deleteById(19L); + routeRepository.deleteById(19L); + routeRepository.deleteById(19L); + routeRepository.deleteById(19L); } }