From b38b8ba3a3239d8480c51f2956e941c9ff37d2c0 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Tue, 14 May 2024 10:49:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E7=A5=A8=E5=8A=A1=E5=91=98?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=8A=9F=E8=83=BD=20=EF=BC=8C=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=85=8D=E7=BD=AE=E7=9A=84=E7=A5=A8=E5=8A=A1=E5=91=98?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E8=87=AA=E5=8A=A8=E5=90=8C=E6=AD=A5=E8=B4=A6?= =?UTF-8?q?=E6=9C=9F=E7=9A=84=E7=BB=93=E7=AE=97=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/dtos/OrderRecordParam.java | 8 +++ .../application/in/OrderRecordController.java | 29 ++++++++ .../queryies/OrderDetailQuery.java | 8 +-- .../AmapOrderExtensionFactoryImpl.java | 13 ++-- .../repository/OrderCarRecordRepository.java | 3 + .../OrderFlightRecordRepository.java | 5 +- .../OrderHotelRecordRepository.java | 3 + .../OrderTrainRecordRepository.java | 1 + .../service/OrderRecordDomainService.java | 29 ++++++++ .../domain/service/SystemDomainService.java | 66 ++++++++++++++----- .../OrderCarRecordRepositoryImpl.java | 13 ++++ .../OrderFlightRecordRepositoryImpl.java | 5 ++ .../OrderHotelRecordRepositoryImpl.java | 13 ++++ .../OrderTrainRecordRepositoryImpl.java | 5 ++ .../jdbc/JdbcOrderCarRecordRepository.java | 1 + .../jdbc/JdbcOrderFlightRecordRepository.java | 1 + .../jdbc/JdbcOrderHotelRecordRepository.java | 1 + .../jdbc/JdbcOrderTrainRecordRepository.java | 1 + .../com/chint/infrastructure/util/Result.java | 6 ++ src/test/java/com/chint/CTripTest.java | 2 +- 20 files changed, 185 insertions(+), 28 deletions(-) create mode 100644 src/main/java/com/chint/application/dtos/OrderRecordParam.java create mode 100644 src/main/java/com/chint/application/in/OrderRecordController.java diff --git a/src/main/java/com/chint/application/dtos/OrderRecordParam.java b/src/main/java/com/chint/application/dtos/OrderRecordParam.java new file mode 100644 index 00000000..341fcf82 --- /dev/null +++ b/src/main/java/com/chint/application/dtos/OrderRecordParam.java @@ -0,0 +1,8 @@ +package com.chint.application.dtos; + +import lombok.Data; + +@Data +public class OrderRecordParam { + private String accountPeriod; +} diff --git a/src/main/java/com/chint/application/in/OrderRecordController.java b/src/main/java/com/chint/application/in/OrderRecordController.java new file mode 100644 index 00000000..feb0a759 --- /dev/null +++ b/src/main/java/com/chint/application/in/OrderRecordController.java @@ -0,0 +1,29 @@ +package com.chint.application.in; + +import com.chint.application.dtos.OrderRecordParam; +import com.chint.domain.service.OrderRecordDomainService; +import com.chint.infrastructure.util.Result; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; + +@RestController +@RequestMapping("/record") +public class OrderRecordController { + + @Autowired + private OrderRecordDomainService orderRecordDomainService; + + @ApiOperation("根据配置同步票务员") + @PostMapping("/reload/clerk") + public Result reloadClerk(@RequestBody OrderRecordParam orderRecordParam){ + orderRecordDomainService.reloadClerkAndSave(orderRecordParam.getAccountPeriod()); + return Result.Success(); + } + +} diff --git a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java index 8ba68619..a0e498fb 100644 --- a/src/main/java/com/chint/application/queryies/OrderDetailQuery.java +++ b/src/main/java/com/chint/application/queryies/OrderDetailQuery.java @@ -132,7 +132,7 @@ public class OrderDetailQuery { .ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName())); record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum())); }); - systemDomainService.generateRecordClerk(orderFlightRecordList); +// systemDomainService.generateRecordClerk(orderFlightRecordList); return orderFlightRecordList; } @@ -144,7 +144,7 @@ public class OrderDetailQuery { .ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName())); record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum())); }); - systemDomainService.generateRecordClerk(orderHotelRecordList); +// systemDomainService.generateRecordClerk(orderHotelRecordList); return orderHotelRecordList; } @@ -155,7 +155,7 @@ public class OrderDetailQuery { .ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName())); record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum())); }); - systemDomainService.generateRecordClerk(orderTrainRecordList); +// systemDomainService.generateRecordClerk(orderTrainRecordList); return orderTrainRecordList; } @@ -166,7 +166,7 @@ public class OrderDetailQuery { .ifPresentOrElse(record::setAccountCompanyName, () -> record.setAccountCompanyName(record.getAccountCompanyName())); record.setReceiptsNum(QueryUtil.reGetReceiptsNum(record.getReceiptsNum())); }); - systemDomainService.generateRecordClerk(orderCarRecordList); +// systemDomainService.generateRecordClerk(orderCarRecordList); return orderCarRecordList; } diff --git a/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java b/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java index 994d4fa7..7ac804db 100644 --- a/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java +++ b/src/main/java/com/chint/domain/factoriy/order_detail/AmapOrderExtensionFactoryImpl.java @@ -12,6 +12,9 @@ import com.chint.interfaces.rest.amap.request.AmapOrderDetailRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.math.BigDecimal; +import java.math.RoundingMode; + import static com.chint.infrastructure.constant.BelongSystemConstant.TRAVAL_SYS_TYPE_AMAP; import static com.chint.infrastructure.constant.FSSCConstant.FSSC_CAR_STATUS_SUCCESS; import static com.chint.interfaces.rest.amap.util.AmapStatusUtil.mapFSSCOrderStatus; @@ -75,9 +78,11 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory { carOrderDetail.setUserCode(data.getUserId()); carOrderDetail.setPhone(data.getPassengerPhone()); carOrderDetail.setBOOK_ORG_STRUCT_1(data.getDepartmentName()); - carOrderDetail.setCreateTime(data.getRequestTime()); - carOrderDetail.setOrderAmount(String.valueOf(data.getEnterpriseAmount() + data.getPersonAmount())); + + //金额 + BigDecimal amountCent = BigDecimal.valueOf(data.getEnterpriseAmount() + data.getPersonAmount()); + carOrderDetail.setOrderAmount(String.valueOf(amountCent.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP))); carOrderDetail.setCompanyPaymentAmount(String.valueOf(data.getEnterpriseAmount())); carOrderDetail.setPersonalPaymentAmount(String.valueOf(data.getPersonAmount())); @@ -97,8 +102,8 @@ public class AmapOrderExtensionFactoryImpl implements OrderExtensionFactory { carOrderDetail.setStartTime(carOrderDetail.getCreateTime()); carOrderDetail.setArriveTime(carOrderDetail.getCreateTime()); } - - carOrderDetail.setMileage(data.getMileage()); + BigDecimal bigMile = new BigDecimal(data.getMileage()); + carOrderDetail.setMileage(String.valueOf(bigMile.divide(BigDecimal.valueOf(1000), 2, RoundingMode.HALF_UP))); carOrderDetail.setRunTime(data.getDuration()); carOrderDetail.setFromStationName(data.getStartName()); carOrderDetail.setToStationName(data.getEndName()); diff --git a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java index 3a1cea4f..416c0c4e 100644 --- a/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderCarRecordRepository.java @@ -14,6 +14,9 @@ import java.util.Optional; public interface OrderCarRecordRepository { List saveAll(List orderCarRecordList); + List findAll(); + List findByAccountPeriod(String accountPeriod); + Optional findByDetailId(String detailId); List findByDetailIdIn(List detailIdList); diff --git a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java index ef357a27..f7e3435a 100644 --- a/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderFlightRecordRepository.java @@ -12,8 +12,11 @@ import java.util.Optional; public interface OrderFlightRecordRepository { List saveAll(List orderFlightRecordList); + List findByAccountPeriod(String accountPeriod); + Optional findByDetailId(String detailId); - List findByDetailIdIn(List detailId); + + List findByDetailIdIn(List detailId); PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, diff --git a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java index 8167206d..22d60e46 100644 --- a/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderHotelRecordRepository.java @@ -12,6 +12,9 @@ import java.util.Optional; public interface OrderHotelRecordRepository { List saveAll(List orderHotelRecordList); + List findAll(); + List findByAccountPeriod(String accountPeriod); + Optional findByDetailId(String detailId); List findByDetailIdIn(List detailIds); diff --git a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java index 4a19a963..38f5dd96 100644 --- a/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java +++ b/src/main/java/com/chint/domain/repository/OrderTrainRecordRepository.java @@ -17,6 +17,7 @@ public interface OrderTrainRecordRepository { Optional findByDetailId(String detailId); List findByDetailIdIn(List detailIds); + List findByAccountPeriod(String accountPeriod); PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum ,String systemType); diff --git a/src/main/java/com/chint/domain/service/OrderRecordDomainService.java b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java index 6b257d55..4f6b2ad4 100644 --- a/src/main/java/com/chint/domain/service/OrderRecordDomainService.java +++ b/src/main/java/com/chint/domain/service/OrderRecordDomainService.java @@ -1,11 +1,18 @@ package com.chint.domain.service; +import com.chint.domain.aggregates.order.order_record.OrderCarRecord; +import com.chint.domain.aggregates.order.order_record.OrderFlightRecord; +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.OrderTrainRecord; import com.chint.domain.repository.OrderCarRecordRepository; import com.chint.domain.repository.OrderFlightRecordRepository; import com.chint.domain.repository.OrderHotelRecordRepository; import com.chint.domain.repository.OrderTrainRecordRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; @Service public class OrderRecordDomainService { @@ -19,5 +26,27 @@ public class OrderRecordDomainService { @Autowired private OrderTrainRecordRepository orderTrainRecordRepository; + @Autowired + private SystemDomainService systemDomainService; + + @Transactional + public void reloadClerkAndSave(String accountPeriod) { + List orderCarRecordList = orderCarRecordRepository.findByAccountPeriod(accountPeriod); + List updatedRecords = (List) systemDomainService.generateRecordClerkAndNeedUpdate(orderCarRecordList); + orderCarRecordRepository.saveAll(updatedRecords); + + List orderHotelRecordList = orderHotelRecordRepository.findByAccountPeriod(accountPeriod); + List updatedOrderHotelRecordList = (List) systemDomainService.generateRecordClerkAndNeedUpdate(orderHotelRecordList); + orderHotelRecordRepository.saveAll(updatedOrderHotelRecordList); + + List orderFlightRecordList = orderFlightRecordRepository.findByAccountPeriod(accountPeriod); + List updatedOrderFlightRecordList = (List) systemDomainService.generateRecordClerkAndNeedUpdate(orderFlightRecordList); + orderFlightRecordRepository.saveAll(updatedOrderFlightRecordList); + + List orderTrainRecordList = orderTrainRecordRepository.findByAccountPeriod(accountPeriod); + List updatedOrderTrainRecordList = (List) systemDomainService.generateRecordClerkAndNeedUpdate(orderTrainRecordList); + orderTrainRecordRepository.saveAll(updatedOrderTrainRecordList); + } + } diff --git a/src/main/java/com/chint/domain/service/SystemDomainService.java b/src/main/java/com/chint/domain/service/SystemDomainService.java index 8ca03271..d5aa3440 100644 --- a/src/main/java/com/chint/domain/service/SystemDomainService.java +++ b/src/main/java/com/chint/domain/service/SystemDomainService.java @@ -5,6 +5,7 @@ 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.exceptions.NotFoundException; import com.chint.domain.repository.AccountCompanyRepository; import com.chint.domain.repository.SystemCodeRepository; @@ -15,6 +16,7 @@ import org.springframework.stereotype.Service; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.stream.Collectors; import static com.chint.infrastructure.constant.DataMessageConstant.SYS_CODE_ERROR; import static com.chint.infrastructure.constant.SystemConstant.ORG_CLERK_FIELD_NAME; @@ -97,24 +99,52 @@ public class SystemDomainService { public List generateRecordClerk(List recordList) { - List orgCodeList = recordList.stream() - .map(OrderBaseRecord::getBelongDepart) - .distinct() - .filter(Objects::nonNull).toList(); - List organizationList = - systemOrganizationRepository.findByOrgCodeList(orgCodeList); - recordList.forEach(record -> organizationList - .stream() - .filter(org -> org.getOrgShortCode().equals(record.getBelongDepart())) - .findFirst() - .ifPresent(org -> record.setTicketClerk( - org.getSystemOrganizationExtensionList() - .stream() - .filter(field -> field.getFieldName().equals(ORG_CLERK_FIELD_NAME)) - .findFirst() - .flatMap(field -> Optional.ofNullable(field.getFieldValue())) - .orElse(null) - ))); + List organizationList = queryOrgListByRecordList(recordList); + recordList.forEach(record -> updateRecordClerk(record, organizationList)); return recordList; } + + public List generateRecordClerkAndNeedUpdate(List recordList) { + List organizations = queryOrgListByRecordList(recordList); + // 创建需要更新的记录列表 + return recordList.stream() + .filter(record -> updateRecordClerk(record, organizations)) + .collect(Collectors.toList()); + } + + private List queryOrgListByRecordList(List recordList) { + // 获取所有独特的部门代码 + List orgCodeList = recordList.stream() + .map(OrderBaseRecord::getBelongDepart) + .filter(Objects::nonNull) + .distinct() + .collect(Collectors.toList()); + + // 获取与这些部门代码相关的组织 + return systemOrganizationRepository.findByOrgCodeList(orgCodeList); + } + + private boolean updateRecordClerk(OrderBaseRecord record, List organizations) { + // 找到与记录所属部门匹配的组织 + return organizations.stream() + .filter(org -> org.getOrgShortCode().equals(record.getBelongDepart())) + .findFirst() + .map(org -> { + String newClerk = findNewClerk(org); + String oldClerk = record.getTicketClerk(); + record.setTicketClerk(newClerk); + // 只有当旧的业务员和新的业务员不同的时候才添加到需要更新的列表 + return !Objects.equals(oldClerk, newClerk); + }) + .orElse(false); + } + + private String findNewClerk(SystemOrganization organization) { + // 从组织的扩展字段中找到新的业务员 + return organization.getSystemOrganizationExtensionList().stream() + .filter(field -> ORG_CLERK_FIELD_NAME.equals(field.getFieldName())) + .map(SystemOrganizationExtension::getFieldValue) + .findFirst() + .orElse(null); + } } diff --git a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java index 12ed86dc..451fbc58 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderCarRecordRepositoryImpl.java @@ -39,6 +39,19 @@ public class OrderCarRecordRepositoryImpl implements OrderCarRecordRepository { return res; } + @Override + public List findAll() { + List res = new ArrayList<>(); + orderCarRecordRepository.findAll() + .forEach(res::add); + return res; + } + + @Override + public List findByAccountPeriod(String accountPeriod) { + return orderCarRecordRepository.findByAccountPeriod(accountPeriod); + } + @Override public Optional findByDetailId(String detailId) { return orderCarRecordRepository.findByDetailId(detailId); diff --git a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java index 47476863..3216ab03 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderFlightRecordRepositoryImpl.java @@ -41,6 +41,11 @@ public class OrderFlightRecordRepositoryImpl implements OrderFlightRecordReposit return res; } + @Override + public List findByAccountPeriod(String accountPeriod) { + return jdbcOrderFlightRecordRepository.findByAccountPeriod(accountPeriod); + } + @Override public Optional findByDetailId(String detailId) { return jdbcOrderFlightRecordRepository.findByDetailId(detailId); diff --git a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java index 6d4faede..89a70c15 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderHotelRecordRepositoryImpl.java @@ -40,6 +40,19 @@ public class OrderHotelRecordRepositoryImpl implements OrderHotelRecordRepositor return res; } + @Override + public List findAll() { + List res = new ArrayList<>(); + jdbcOrderHotelRecordRepository.findAll() + .forEach(res::add); + return res; + } + + @Override + public List findByAccountPeriod(String accountPeriod) { + return jdbcOrderHotelRecordRepository.findByAccountPeriod(accountPeriod); + } + @Override public Optional findByDetailId(String detailId) { return jdbcOrderHotelRecordRepository.findByDetailId(detailId); diff --git a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java index 30ba4ef6..998b2007 100644 --- a/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/OrderTrainRecordRepositoryImpl.java @@ -49,6 +49,11 @@ public class OrderTrainRecordRepositoryImpl implements OrderTrainRecordRepositor return jdbcOrderTrainRecordRepository.findByDetailIdIn(detailIds); } + @Override + public List findByAccountPeriod(String accountPeriod) { + return jdbcOrderTrainRecordRepository.findByAccountPeriod(accountPeriod); + } + @Override public PageResult findByUpdateDataTime(LocalDateTime startTime, LocalDateTime endTime, Integer pageSize, Integer pageNum, String systemType) { PageRequest pageRequest = PageRequest.of(pageNum - 1, pageSize, Sort.by("update_data_time").descending()); diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java index 5655e9c5..c01add49 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderCarRecordRepository.java @@ -29,6 +29,7 @@ public interface JdbcOrderCarRecordRepository extends CrudRepository findByDetailIdIn(Collection detailId); + List findByAccountPeriod(String accountPeriod); @Query(""" diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java index 730d06ea..64c931fb 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderFlightRecordRepository.java @@ -28,6 +28,7 @@ public interface JdbcOrderFlightRecordRepository extends CrudRepository findByDetailIdIn(Collection detailId); + List findByAccountPeriod(String accountPeriod); @Query(""" select r1.* from order_flight_record r1 diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java index d20770a2..d4e138d5 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderHotelRecordRepository.java @@ -29,6 +29,7 @@ public interface JdbcOrderHotelRecordRepository extends CrudRepository findByDetailIdIn(Collection detailId); + List findByAccountPeriod(String accountPeriod); @Query(""" select r1.* from order_hotel_record r1 diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java index a58df647..89b14674 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderTrainRecordRepository.java @@ -28,6 +28,7 @@ public interface JdbcOrderTrainRecordRepository extends CrudRepository findByDetailIdIn(Collection detailId); + List findByAccountPeriod(String accountPeriod); @Query(""" select r1.* from order_train_record r1 diff --git a/src/main/java/com/chint/infrastructure/util/Result.java b/src/main/java/com/chint/infrastructure/util/Result.java index 82ea86ff..4473eb82 100644 --- a/src/main/java/com/chint/infrastructure/util/Result.java +++ b/src/main/java/com/chint/infrastructure/util/Result.java @@ -48,12 +48,18 @@ public class Result implements Serializable { return new Result(msg, RESULT_SUCCESS_CODE); } + public static Result Success() { + return new Result(SUCCESS, RESULT_SUCCESS_CODE); + } + public static Result error(String msg) { return new Result(msg, RESULT_ERROR_CODE); } + public static Result tokenExpired(String msg) { return new Result(msg, "-1"); } + public static Result ssoLoginFail(String msg) { return new Result(msg, RESULT_SSO_LOGIN_ERROR_CODE); } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 98f236b2..5b06f1f2 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("31685995618"); + SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31445559547"); System.out.println(response); }