From ba5ed7fe1d5efbce9b113fe7c7e5b4f85ceb36c0 Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 11 Apr 2024 14:35:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../in/RouteRequestController.java | 4 - .../application/out/LocationController.java | 4 +- .../chint/application/out/UserController.java | 19 +++- .../order/order_record/OrderCarRecord.java | 2 +- .../order/order_record/OrderFlightRecord.java | 2 +- .../order/order_record/OrderHotelRecord.java | 1 + .../order/order_record/OrderTrainRecord.java | 1 + .../aggregates/user/UserDepartmentInfo.java | 16 ++- .../CTripOrderRecordExtensionFactory.java | 103 ++++++++++++++++-- src/test/java/com/chint/CTripTest.java | 36 ++++-- .../java/com/chint/RouteApplicationTests.java | 25 ++++- 11 files changed, 172 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/chint/application/in/RouteRequestController.java b/src/main/java/com/chint/application/in/RouteRequestController.java index 5f6094ba..7ce3bc73 100644 --- a/src/main/java/com/chint/application/in/RouteRequestController.java +++ b/src/main/java/com/chint/application/in/RouteRequestController.java @@ -35,8 +35,4 @@ public class RouteRequestController { routeRequestDomainService.cancelRouteRequest(syncLegData); return Result.Success(SUCCESS); } - - - - } diff --git a/src/main/java/com/chint/application/out/LocationController.java b/src/main/java/com/chint/application/out/LocationController.java index d803ffd6..98cd0cb1 100644 --- a/src/main/java/com/chint/application/out/LocationController.java +++ b/src/main/java/com/chint/application/out/LocationController.java @@ -46,7 +46,7 @@ public class LocationController { return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam)); } - @Cacheable(value = "LocationResByFirstLetter", key = "#locationParam") + @ApiOperation("根据查询词查询地理信息") @PostMapping("/query/word") public Result> queryByFirstLetter(@RequestBody LocationParam locationParam) { @@ -67,7 +67,7 @@ public class LocationController { .toList(); } - // + // 因为地理信息表存在重复地理信息 , 对地理信息的重复内容去重 // 在每个分组中,按 locationId 对 Location 进行排序,然后取出每组的第一个元素 locations = new ArrayList<>(locations.stream() // 将 Location 对象映射为 locationPath 和 locationPathName 的组合作为 key,Location 对象本身作为 value diff --git a/src/main/java/com/chint/application/out/UserController.java b/src/main/java/com/chint/application/out/UserController.java index b51f858f..a6804ed2 100644 --- a/src/main/java/com/chint/application/out/UserController.java +++ b/src/main/java/com/chint/application/out/UserController.java @@ -3,14 +3,16 @@ package com.chint.application.out; import cn.hutool.core.bean.BeanUtil; import com.chint.application.dtos.response.UserRes; import com.chint.domain.aggregates.user.User; +import com.chint.domain.aggregates.user.UserDepartmentInfo; +import com.chint.domain.repository.UserRepository; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.user.PushUser; 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.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS; @@ -21,6 +23,9 @@ public class UserController { @Autowired private PushUser pushUser; + @Autowired + private UserRepository userRepository; + @ApiOperation("根据Id查询用户信息") @PostMapping("/query") public Result getUserByEmployeeNo() { @@ -35,4 +40,12 @@ public class UserController { pushUser.getUserSFDataFromOpenApiBatch(); return Result.Success(SUCCESS); } + + + @ApiOperation("查询用户部门信息") + @GetMapping("/public/query/dept/{employeeNo}") + public Result> getUserDeptInfoByEmployeeNo(@PathVariable String employeeNo) { + User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo); + return Result.Success(SUCCESS, byUserEmployeeNo.getUserDepartmentInfoList()); + } } diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java index 6311d637..510cd30d 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderCarRecord.java @@ -66,7 +66,7 @@ public class OrderCarRecord extends OrderBaseRecord { private String payAmount;//支付总金额 private String receiptsNumOrigin;//支付总金额 private String belongDepart; //归属部门 - + private String settleOrderFlag; public OrderCarRecord loadBelongDeport(String belongDeport ) { diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java index 4aaf4b99..f6e3718f 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderFlightRecord.java @@ -81,7 +81,7 @@ public class OrderFlightRecord extends OrderBaseRecord { private String receiptsNumOrigin;//原差旅申请单单号 private String payAmount; private String belongDepart; //归属部门 - + private String settleOrderFlag; public OrderFlightRecord loadBelongDeport(String belongDeport ) { // 行程信息 diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java index e7ad69f9..fd3aa531 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderHotelRecord.java @@ -80,6 +80,7 @@ public class OrderHotelRecord extends OrderBaseRecord { private String createTime; private String receiptsNumOrigin;//支付总金额 private String belongDepart; //归属部门 + private String settleOrderFlag; public OrderHotelRecord loadBelongDeport(String belongDeport ) { diff --git a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java index 1346caf9..83120a25 100644 --- a/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java +++ b/src/main/java/com/chint/domain/aggregates/order/order_record/OrderTrainRecord.java @@ -75,6 +75,7 @@ public class OrderTrainRecord extends OrderBaseRecord{ private String orderStatus;//订单状态 private String receiptsNumOrigin;//原差旅申请单单号 private String belongDepart; //归属部门 + private String settleOrderFlag; public OrderTrainRecord loadBelongDeport(String belongDeport ) { diff --git a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java index 092af407..14d17a02 100644 --- a/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java +++ b/src/main/java/com/chint/domain/aggregates/user/UserDepartmentInfo.java @@ -8,6 +8,7 @@ import org.springframework.data.relational.core.mapping.Table; import java.io.Serial; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -182,12 +183,17 @@ public class UserDepartmentInfo implements Serializable { userDepartmentInfo.setIfPrimary(0); } List userDepartmentInfoList = user.getUserDepartmentInfoList(); - List list = userDepartmentInfoList.stream().distinct().toList(); - user.setUserDepartmentInfoList(list); - if(userDepartmentInfoList.contains(userDepartmentInfo)){ - return userDepartmentInfo; + List result = new ArrayList<>(); + if(userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) { + List list = userDepartmentInfoList.stream().distinct().toList(); + user.setUserDepartmentInfoList(list); + if(userDepartmentInfoList.contains(userDepartmentInfo)){ + return userDepartmentInfo; + } + result.addAll(userDepartmentInfoList); } - user.addDeptInfo(userDepartmentInfo); + result.add(userDepartmentInfo); + user.setUserDepartmentInfoList(result); return userDepartmentInfo; } } diff --git a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java index d32a53a7..98e11365 100644 --- a/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java +++ b/src/main/java/com/chint/domain/factoriy/order_record/CTripOrderRecordExtensionFactory.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Optional; import static com.chint.infrastructure.constant.BelongSystemConstant.*; +import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL; import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO; @Component @@ -186,7 +187,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac carOrderDetail.getParentOrderNo(), carOrderDetail.getOriginalOrderNo()) .loadBasicOrderInfo(carOrderDetail.getOrderNo(), - carOrderDetail.getOrderStatus(), + translateCarCTripStatusToRecordStatus(cTripCarRecordBase.getDelType()), cTripCarRecord.getOrderDate()); }, () -> orderCarRecord.loadComplianceInfoNot() .loadRelatedOrderInfo(cTripCarRecordBase.getOrderId(), @@ -196,7 +197,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(cTripCarRecordBase.getOrderId()), String.valueOf(cTripCarRecordBase.getOrderId())) .loadBasicOrderInfo(String.valueOf(cTripCarRecordBase.getOrderId()), - "", + translateCarCTripStatusToRecordStatus(cTripCarRecordBase.getDelType()), cTripCarRecord.getOrderDate())); //这里添加归属部门编号 , 这里兼容测试环境 , 如果行程规划单已经有这个值 , 那么直接取, 没有的话,查找用户的部门获取 @@ -207,6 +208,23 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac userHttpRequest.belongDeport(orderCarRecord.getBookingUserCode(), orderCarRecord.getAccountCompanyName()) )); + //这里和行程规划单里面的订单明细进行对比 + byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().contains(String.valueOf( + cTripCarRecordBase.getOrderId() + ))) + .map(OrderDetail::getHotelOrderDetail) + .filter(hotelOrderDetail -> hotelOrderDetail.getOrderStatus().equals(orderCarRecord.getOrderStatus())) + .findFirst()) + .ifPresentOrElse(it -> { + if (it.getOrderAmount().equals(orderCarRecord.getOrderAmount())) { + orderCarRecord.setOrderStatus("1"); + } else { + orderCarRecord.setOrderStatus("0"); + } + }, () -> orderCarRecord.setOrderStatus("0")); + return orderCarRecord; } @@ -217,6 +235,10 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac if (inputOrderNo.contains("-")) { String[] split = inputOrderNo.split("-"); orderNo = split[1]; + if (orderNo.contains("#")) { + String[] split1 = orderNo.split("#"); + orderNo = split1[0]; + } } else { orderNo = inputOrderNo; } @@ -378,7 +400,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac FlightOrderDetail flightOrderDetail = it.getFlightOrderDetail(); orderFlightRecord.loadComplianceInfo(it) .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), - flightOrderDetail.getOrderStatus(), + translateFlightCTripStatusToRecordStatus(cTripFlightRecordBase.getOrderDetailType()), cTripFlightRecordBase.getCreateTime()) .loadRelatedOrderInfo(cTripFlightRecordBase.getOrderId(), String.valueOf(cTripFlightRecordBase.getRecordId()), @@ -394,7 +416,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(cTripFlightRecordBase.getOrderId()), String.valueOf(cTripFlightRecordBase.getOrderId())) .loadBasicOrderInfo(String.valueOf(cTripFlightRecordBase.getOrderId()), - "", + translateFlightCTripStatusToRecordStatus(cTripFlightRecordBase.getOrderDetailType()), cTripFlightRecordBase.getCreateTime())); @@ -405,6 +427,26 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac () -> orderFlightRecord.loadBelongDeport( userHttpRequest.belongDeport(orderFlightRecord.getBookingUserCode(), orderFlightRecord.getAccountCompanyName()) )); + + + //这里和行程规划单里面的订单明细进行对比 + byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().contains(String.valueOf( + cTripFlightRecordBase.getOrderId() + ))) + .map(OrderDetail::getFlightOrderDetail) + .filter(it -> it.getOrderStatus().equals(orderFlightRecord.getOrderStatus())) + .findFirst()) + .ifPresentOrElse(it -> { + if (it.getOrderAmount().equals(orderFlightRecord.getOrderAmount())) { + orderFlightRecord.setOrderStatus("1"); + } else { + orderFlightRecord.setOrderStatus("0"); + } + }, () -> orderFlightRecord.setOrderStatus("0")); + + return orderFlightRecord; } @@ -526,7 +568,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac hotelOrderDetail.getOrderNo(), hotelOrderDetail.getOrderNo()); orderHotelRecord.loadBasicOrderInfo(hotelOrderDetail.getOrderNo(), // 加载基础订单信息 - hotelOrderDetail.getOrderStatus(), + translateHotelCTripStatusToRecordStatus(cTripHotelRecordBase.getDetailType()), cTripHotelRecordBase.getCreateTime()); }, () -> orderHotelRecord.loadComplianceInfo(Optional.empty()) .loadOrderNoInfo(cTripHotelRecordBase.getOrderId(), //兼容测试环境不存在行程规划单的情况 // 加载订单关联号信息 @@ -536,7 +578,7 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(cTripHotelRecordBase.getOrderId()), String.valueOf(cTripHotelRecordBase.getOrderId())) .loadBasicOrderInfo(String.valueOf(cTripHotelRecordBase.getOrderId()), // 加载基础订单信息 - "", + translateHotelCTripStatusToRecordStatus(cTripHotelRecordBase.getDetailType()), cTripHotelRecordBase.getCreateTime())); // 加载财务信息 @@ -552,7 +594,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac "", ""); - // 加载付款 付款方式,公司付款金额, 个人付款金额 String paymentType; Double personAmount = cTripHotelRecordBase.getPersonAmount(); @@ -571,7 +612,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac String.valueOf(personAmount)); // 加载预订人和入住人信息 - if (orderHotelRecord.getOrderSource().equals("Y")) { orderHotelRecord.loadBookerAndGuestInfo( cTripHotelOrderDetail.getEmployeeID(), @@ -586,7 +626,6 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac ""); } - // 加载组织架构 orderHotelRecord.loadOrganizationalAndProjectInfo(cTripHotelOrderDetail.getDept1(), cTripHotelOrderDetail.getDept2(), @@ -600,6 +639,24 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac () -> orderHotelRecord.loadBelongDeport( userHttpRequest.belongDeport(orderHotelRecord.getBookingUserCode(), orderHotelRecord.getAccountCompanyName()) )); + + //这里和行程规划单里面的订单明细进行对比 + byOrderNo.flatMap(routeOrder -> routeOrder.getOrderDetails() + .stream() + .filter(it -> it.getOrderNo().contains(String.valueOf( + cTripHotelRecordBase.getOrderId() + ))) + .map(OrderDetail::getHotelOrderDetail) + .filter(it -> it.getOrderStatus().equals(orderHotelRecord.getOrderStatus())) + .findFirst()) + .ifPresentOrElse(it -> { + if (it.getOrderAmount().equals(orderHotelRecord.getOrderAmount())) { + orderHotelRecord.setOrderStatus("1"); + } else { + orderHotelRecord.setOrderStatus("0"); + } + }, () -> orderHotelRecord.setOrderStatus("0")); + return orderHotelRecord; } @@ -613,4 +670,32 @@ public class CTripOrderRecordExtensionFactory implements OrderRecordExtensionFac }); return userCustomCode.getCode(); } + + private String translateFlightCTripStatusToRecordStatus(String orderDetailType) { + return switch (orderDetailType) { + case "出票" -> "1"; + case "改签" -> "2"; + case "退票" -> "3"; + case "取消" -> "3"; + case "调整" -> "2"; + default -> "0"; + }; + } + + private String translateHotelCTripStatusToRecordStatus(String orderDetailType) { + return switch (orderDetailType) { + case "O" -> "1"; + case "R" -> "3"; + default -> "0"; + }; + } + + + private String translateCarCTripStatusToRecordStatus(String delType) { + return switch (delType) { + case "O" -> "1"; + case "R" -> "3"; + default -> "0"; + }; + } } diff --git a/src/test/java/com/chint/CTripTest.java b/src/test/java/com/chint/CTripTest.java index 300569fa..ff340a09 100644 --- a/src/test/java/com/chint/CTripTest.java +++ b/src/test/java/com/chint/CTripTest.java @@ -5,8 +5,11 @@ import com.chint.domain.aggregates.location.basedata.DistrictPOIInfoEntity; import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEntity; import com.chint.domain.aggregates.order.Location; import com.chint.domain.aggregates.order.RouteOrder; - +import com.chint.domain.aggregates.order.order_record.OrderHotelRecord; +import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord; import com.chint.domain.aggregates.user.User; +import com.chint.domain.factoriy.order_record.OrderRecordExtensionFactory; +import com.chint.domain.factoriy.order_record.OrderRecordFactorySelector; import com.chint.domain.repository.*; import com.chint.domain.service.order_sync.CTripOrderSyncAdapter; import com.chint.domain.service.supplier.SupplierService; @@ -117,6 +120,13 @@ public class CTripTest { @Autowired private PostRequest postRequest; + @Autowired + private CTripOrderDetailRepository cTripOrderDetailRepository; + + @Autowired + private OrderRecordFactorySelector orderRecordFactorySelector; + + @Value("${cTrip.requestSecret}") private String C_TRIP_REQUEST_SECRET; @@ -125,7 +135,7 @@ public class CTripTest { private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001"); @Test - void syncOrder(){ + void syncOrder() { RouteOrder routeOrder = routeRepository.queryById(3892L); cTripOrderSyncAdapter.syncSupplierOrder(routeOrder); } @@ -359,7 +369,7 @@ public class CTripTest { System.out.println(allPOIInfoQuery); } -// @Test + // @Test void queryDistrictByCountryId() { // CountryInfoEntity countryInfoEntity = countryInfoEntityRepository.findById(336L); QueryAllPOIInfoResponseType allPOIInfoQuery = cTripAllPOIInfoRequest.getAllPOIInfoQuery(1L); @@ -385,7 +395,7 @@ public class CTripTest { } -// @Test + // @Test void generateDistrictInLocation() { List allLeverThree = locationRepository.findAllLeverThreeAndIsInternal(); @@ -400,7 +410,7 @@ public class CTripTest { districtLocation.setLocationShortName(districtPOIInfoEntity.getDistrictName() + "D"); districtLocation.setFirstPinYin(PinyinUtil.getFirstLetter(districtPOIInfoEntity.getDistrictName())); districtLocation.setParentLocationId(location.getLocationId()); - districtLocation.setLocationPathName(location.getLocationPathName() + districtPOIInfoEntity.getDistrictName() + '_' ); + districtLocation.setLocationPathName(location.getLocationPathName() + districtPOIInfoEntity.getDistrictName() + '_'); districtLocation.setIsInternal(location.getIsInternal()); districtLocation.setIsHaveAirport(0); districtLocation.setLocationPath(location.getLocationPath()); @@ -412,7 +422,7 @@ public class CTripTest { } -// @Test + // @Test void updateDistrictInLocation() { // List all = districtInfoRepository.findAll(); // List districtCities = new ArrayList<>(); @@ -432,8 +442,6 @@ public class CTripTest { } - - private static List getDistrictPOIInfoEntities(PrefectureLevelCityInfo cityInfo) { List districtPOIInfoEntities = new ArrayList<>(); for (DistrictPOIInfo districtPOIInfo : cityInfo.getDistrictList()) { @@ -447,7 +455,7 @@ public class CTripTest { } -// @Test + // @Test void deleteByCountryId() { } @@ -558,8 +566,8 @@ public class CTripTest { } } -// @Test - void batchPush(){ + // @Test + void batchPush() { List strings = List.of( "31060889641"); @@ -583,4 +591,10 @@ public class CTripTest { } + @Test + void generateRecord(){ + CTripHotelRecord hotelRecordByRecordId = cTripOrderDetailRepository.findHotelRecordByRecordId("99127528"); + OrderRecordExtensionFactory orderRecordExtensionFactory = orderRecordFactorySelector.extensionFactoryOfSupplierName(SUPPLIER_C_TRIP); + orderRecordExtensionFactory.createHotelOrderRecord(hotelRecordByRecordId); + } } diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java index 6a6858f6..c9231cfd 100644 --- a/src/test/java/com/chint/RouteApplicationTests.java +++ b/src/test/java/com/chint/RouteApplicationTests.java @@ -263,9 +263,9 @@ class RouteApplicationTests { System.out.println(orderInfo.getOrderSerialNo()); } - // @Test + @Test void loginSign() { - String sfno = "081001001"; + String sfno = "200529132"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -278,9 +278,9 @@ class RouteApplicationTests { // log.trace("trace"); } -// @Test + @Test void loginSignProd() { - String sfno = "190801115"; + String sfno = "200529132"; String syscode = "FSSC"; String billcode = "CLSQ240225000099"; String companycode = "正泰集团股份有限公司"; @@ -1253,9 +1253,24 @@ class RouteApplicationTests { } @Test - void testSplid(){ + void testSplit(){ String str = "20240301"; System.out.println(str.substring(0, 5)); System.out.println(lastMonthStr()); } + + @Test + void testsplit2(){ + String inputOrderNo = "FSSC-CLSQ240409000001dev#NBWSAW"; + String orderNo = null; + if (inputOrderNo.contains("-")) { + String[] split = inputOrderNo.split("-"); + orderNo = split[1]; + if(orderNo.contains("#")){ + String[] split1 = orderNo.split("#"); + orderNo = split1[0]; + } + } + System.out.println(orderNo); + } } From 1b2eec230d6a7b6cc2ace8ea34e22e66161bf02c Mon Sep 17 00:00:00 2001 From: lulz1 Date: Thu, 11 Apr 2024 14:41:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E6=8E=A5=E5=8F=A3=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/chint/application/out/UserController.java | 10 +++++++++- .../interfaces/rest/user/UserHttpRequestImpl.java | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/chint/application/out/UserController.java b/src/main/java/com/chint/application/out/UserController.java index a6804ed2..0703dee8 100644 --- a/src/main/java/com/chint/application/out/UserController.java +++ b/src/main/java/com/chint/application/out/UserController.java @@ -8,6 +8,7 @@ import com.chint.domain.repository.UserRepository; import com.chint.infrastructure.util.BaseContext; import com.chint.infrastructure.util.Result; import com.chint.interfaces.rest.user.PushUser; +import com.chint.interfaces.rest.user.UserHttpRequest; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -26,6 +27,9 @@ public class UserController { @Autowired private UserRepository userRepository; + @Autowired + private UserHttpRequest userHttpRequest; + @ApiOperation("根据Id查询用户信息") @PostMapping("/query") public Result getUserByEmployeeNo() { @@ -46,6 +50,10 @@ public class UserController { @GetMapping("/public/query/dept/{employeeNo}") public Result> getUserDeptInfoByEmployeeNo(@PathVariable String employeeNo) { User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo); - return Result.Success(SUCCESS, byUserEmployeeNo.getUserDepartmentInfoList()); + List userDepartmentInfoList = byUserEmployeeNo.getUserDepartmentInfoList(); + if (userDepartmentInfoList == null || userDepartmentInfoList.isEmpty()) { + userDepartmentInfoList = userHttpRequest.loadUserDeptInfo(User.withEmployeeNo(employeeNo)).getUserDepartmentInfoList(); + } + return Result.Success(SUCCESS, userDepartmentInfoList); } } 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 82ea5b3c..fd02710d 100644 --- a/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java +++ b/src/main/java/com/chint/interfaces/rest/user/UserHttpRequestImpl.java @@ -271,6 +271,10 @@ public class UserHttpRequestImpl implements UserHttpRequest { } } } + if(user.getName() == null || user.getName().isEmpty() || user.getName().isBlank()){ + getDataFromUserSFData(user,userDataDTOList.get(0)); + } + return userRepository.save(user); }