Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
dengwc 2024-04-11 15:07:47 +08:00
commit 1ce0b7a4d7
12 changed files with 184 additions and 41 deletions

View File

@ -35,8 +35,4 @@ public class RouteRequestController {
routeRequestDomainService.cancelRouteRequest(syncLegData);
return Result.Success(SUCCESS);
}
}

View File

@ -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<List<LocationRes>> queryByFirstLetter(@RequestBody LocationParam locationParam) {
@ -67,7 +67,7 @@ public class LocationController {
.toList();
}
//
// 因为地理信息表存在重复地理信息 对地理信息的重复内容去重
// 在每个分组中 locationId Location 进行排序然后取出每组的第一个元素
locations = new ArrayList<>(locations.stream()
// Location 对象映射为 locationPath locationPathName 的组合作为 keyLocation 对象本身作为 value

View File

@ -3,14 +3,17 @@ 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 com.chint.interfaces.rest.user.UserHttpRequest;
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 +24,12 @@ public class UserController {
@Autowired
private PushUser pushUser;
@Autowired
private UserRepository userRepository;
@Autowired
private UserHttpRequest userHttpRequest;
@ApiOperation("根据Id查询用户信息")
@PostMapping("/query")
public Result<UserRes> getUserByEmployeeNo() {
@ -35,4 +44,16 @@ public class UserController {
pushUser.getUserSFDataFromOpenApiBatch();
return Result.Success(SUCCESS);
}
@ApiOperation("查询用户部门信息")
@GetMapping("/public/query/dept/{employeeNo}")
public Result<List<UserDepartmentInfo>> getUserDeptInfoByEmployeeNo(@PathVariable String employeeNo) {
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo);
List<UserDepartmentInfo> userDepartmentInfoList = byUserEmployeeNo.getUserDepartmentInfoList();
if (userDepartmentInfoList == null || userDepartmentInfoList.isEmpty()) {
userDepartmentInfoList = userHttpRequest.loadUserDeptInfo(User.withEmployeeNo(employeeNo)).getUserDepartmentInfoList();
}
return Result.Success(SUCCESS, userDepartmentInfoList);
}
}

View File

@ -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
) {

View File

@ -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
) {
// 行程信息

View File

@ -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
) {

View File

@ -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
) {

View File

@ -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<UserDepartmentInfo> userDepartmentInfoList = user.getUserDepartmentInfoList();
List<UserDepartmentInfo> list = userDepartmentInfoList.stream().distinct().toList();
user.setUserDepartmentInfoList(list);
if(userDepartmentInfoList.contains(userDepartmentInfo)){
return userDepartmentInfo;
List<UserDepartmentInfo> result = new ArrayList<>();
if(userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) {
List<UserDepartmentInfo> 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;
}
}

View File

@ -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";
};
}
}

View File

@ -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);
}

View File

@ -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<Location> 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<DistrictPOIInfoEntity> all = districtInfoRepository.findAll();
// List<Location> districtCities = new ArrayList<>();
@ -432,8 +442,6 @@ public class CTripTest {
}
private static List<DistrictPOIInfoEntity> getDistrictPOIInfoEntities(PrefectureLevelCityInfo cityInfo) {
List<DistrictPOIInfoEntity> 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<String> 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);
}
}

View File

@ -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);
}
}