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

This commit is contained in:
dengwc 2024-03-29 10:23:15 +08:00
commit 63552f2727
5 changed files with 106 additions and 32 deletions

View File

@ -95,6 +95,9 @@ public class FSSCController {
reDirectUrl = postRequest.getReDirectUrl(generateUrlPathFromDataBase(dataBaseUrl, employeeNo));
}
if (sysCode.getSystemCodeUrl().getRedirectType() == 2) {
reDirectUrl = dataBaseUrl;
}
return reDirectUrl;
}

View File

@ -42,10 +42,9 @@ import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_FINISH_NAME;
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_CODE;
import static com.chint.infrastructure.constant.RankConstant.ZTZW_COMPANY_NAME;
import static com.chint.infrastructure.constant.RouteConstant.*;
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service
@ -161,15 +160,26 @@ public class LegEventHandler implements LegEventService {
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
String supplierName = data.getSupplierName();
routeOrder.setSupplierName(supplierName);
List<Leg> legItems = routeOrder.getLegItems();
//这里增加一个判断 如果这个订单的行程为空那么就返回给用户提示
if (legItems == null || legItems.isEmpty()) {
throw new CommandException("订单的行程不能为空");
}
List<Leg> needSyncLegs = legItems.stream().filter(it -> !it.getLegType().equals(LEG_TYPE_OTHER)).toList();
if (needSyncLegs.isEmpty()) {
throw new CommandException("有所选的行程规划单不存在需要同步的行程");
}
//这里order所有的leg触发sync事件
routeOrder.getLegItems().forEach(leg -> leg.getEventList().add(
legItems.forEach(leg -> leg.getEventList().add(
legEventFactory.creatLegEvent(command.getLegEventType())
));
//保存routeOrder的状态
routeRepository.save(routeOrder).reloadStatus();
routeOrder.setLegItems(
routeOrder
.getLegItems()
legItems
.stream()
.filter(leg -> !leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER))
.toList()
@ -245,8 +255,8 @@ public class LegEventHandler implements LegEventService {
LegEvent legEvent = legEventFactory
.creatLegEvent(command.getLegEventType());
leg.addEvent(legEvent);
} else if(orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)){
} else if (orderStatus.equals(ORDER_EVENT_REFUND_NAME) ||
orderStatus.equals(ORDER_EVENT_CANCEL_NAME)) {
//如果是退款状态那么就创建加入未下单事件
LegEvent legEvent = legEventFactory
.creatLegEvent(LEG_EVENT_NOT_ORDERED);

View File

@ -5,15 +5,15 @@ 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.ctrip.CtripCarOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripFlightOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripHotelOrderDetail;
import com.chint.domain.aggregates.order.ctrip.CtripTrainOrderDetail;
import com.chint.domain.aggregates.order.order_record.OrderFlightRecord;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.*;
import com.chint.domain.service.order_sync.CTripOrderSyncAdapter;
import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.repository.CTripOrderDetailImpl;
import com.chint.infrastructure.repository.OrderFlightRecordRepositoryImpl;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
@ -124,6 +124,12 @@ public class CTripTest {
@Value("${cTrip.requestSecret}")
private String C_TRIP_REQUEST_SECRET;
@Autowired
private OrderFlightRecordRepository orderFlightRecordRepository;
@Autowired
private CTripOrderDetailImpl cTripOrderDetail;
private User user = new User(1L, "230615020", 1, "卢麟哲", "1033719135@qq.com", "15857193365", "A30000001");
@ -236,10 +242,10 @@ public class CTripTest {
System.out.println(gson.toJson(estimate));
}
@Test
// @Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31108053999");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31288249965");
System.out.println(response);
}
@ -488,7 +494,7 @@ public class CTripTest {
OrderFlightResponse.FlightOrderSettlementBaseInfo orderSettlementBaseInfo =
flightOrderSettlementInfo.getOrderSettlementBaseInfo();
if (orderSettlementBaseInfo != null) {
CtripFlightOrderDetail ctripFlightOrderDetail = new CtripFlightOrderDetail();
CTripFlightRecordBase ctripFlightOrderDetail = new CTripFlightRecordBase();
ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(orderSettlementBaseInfo);
ctripOrderDetailRepository.save(ctripFlightOrderDetail);
}
@ -510,7 +516,7 @@ public class CTripTest {
OrderTrainResponse.CorpTrainSettlementDetail trainSettlementDetail =
corpTrainSettlementInfo.getTrainSettlementDetail();
if (trainSettlementDetail != null) {
CtripTrainOrderDetail ctripTrainOrderDetail = new CtripTrainOrderDetail();
CTripTrainRecordBase ctripTrainOrderDetail = new CTripTrainRecordBase();
ctripTrainOrderDetail = ctripTrainOrderDetail.changeInfo(trainSettlementDetail);
ctripOrderDetailRepository.save(ctripTrainOrderDetail);
}
@ -531,7 +537,7 @@ public class CTripTest {
OrderHotelResponse.LstHotelSettlementDetail hotelSettlementDetail = LstHotelSettlementDetail.get(0);
OrderHotelResponse.SettlementDetail settlementDetail = hotelSettlementDetail.getSettlementDetail();
if (settlementDetail != null) {
CtripHotelOrderDetail ctripFlightOrderDetail = new CtripHotelOrderDetail();
CTripHotelRecordBase ctripFlightOrderDetail = new CTripHotelRecordBase();
ctripFlightOrderDetail = ctripFlightOrderDetail.changeInfo(settlementDetail);
ctripOrderDetailRepository.save(ctripFlightOrderDetail);
}
@ -553,7 +559,7 @@ public class CTripTest {
OrderCarResponse.CarOrderSettlementDetail carOrderSettlementDetail = carSettlementDetailList.get(0);
OrderCarResponse.CarOrderSettlementBaseInfo settlementBaseInfo = carOrderSettlementDetail.getSettlementBaseInfo();
if (settlementBaseInfo != null) {
CtripCarOrderDetail ctripCarOrderDetail = new CtripCarOrderDetail();
CTripCarRecordBase ctripCarOrderDetail = new CTripCarRecordBase();
ctripCarOrderDetail = ctripCarOrderDetail.changeInfo(settlementBaseInfo);
ctripOrderDetailRepository.save(ctripCarOrderDetail);
}
@ -586,4 +592,25 @@ public class CTripTest {
}
// @Test
void findRecord(){
CTripFlightRecord byId = cTripOrderDetail.findFlightRecordById(14513L);
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
// @Test
void findHotelRecord(){
CTripHotelRecord byId = cTripOrderDetail.findHotelRecordByRecordId("97211839");
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
// @Test
void findCarRecord(){
CTripCarRecord byId = cTripOrderDetail.findCarRecordByRecordId("50597248");
Gson gson = new Gson();
System.out.println(gson.toJson(byId));
}
}

View File

@ -18,6 +18,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
import com.chint.infrastructure.repository.jdbc.JdbcOrderTravelRepository;
import com.chint.infrastructure.util.BaseContext;
import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.BPMRequest;
import com.chint.interfaces.rest.bpm.XNBPM.ClientFactory;
@ -886,7 +887,7 @@ public class LYTest {
// @Test
void sendMsg() {
commonController.sendMsg("T24032167509127504");
commonController.sendMsg("T24032868351668790");
}
@ -920,14 +921,14 @@ public class LYTest {
}
// @Test
@Test
void syncToSupplierOne(){
RouteOrder routeOrder = routeRepository.queryById(665L);
lyOrderSyncAdapter.syncSupplierOrder(routeOrder);
}
// @Test
@Test
void queryHotelCustom(){
OrderDetail byId = orderDetailRepository.findById(2569L);
HotelOrderDetailDto hotelOrderDetailDto = HotelOrderDetailDto.copyFrom(byId.getHotelOrderDetail());

View File

@ -11,11 +11,15 @@ import com.chint.domain.aggregates.location.basedata.PrefectureLevelCityInfoEnti
import com.chint.domain.aggregates.order.Leg;
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.order_record.ctrip_order_record.CTripHotelRecord;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.*;
import com.chint.domain.service.JTCompanyDomainService;
import com.chint.domain.service.OrderDomainService;
import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
import com.chint.domain.value_object.RanksData;
import com.chint.infrastructure.repository.CTripOrderDetailImpl;
import com.chint.infrastructure.util.DateTimeUtil;
import com.chint.infrastructure.util.Digest;
import com.chint.infrastructure.util.PinyinUtil;
import com.chint.interfaces.rest.base.PostRequest;
@ -138,6 +142,12 @@ class RouteApplicationTests {
@Autowired
private RankController rankController;
@Autowired
private CTripOrderDetailImpl cTripOrderDetail;
@Autowired
private OrderDomainService orderDomainService;
void test3() {
FlyOkDTO freightDTO = new FlyOkDTO();
ParamFly param = new ParamFly();
@ -156,7 +166,7 @@ class RouteApplicationTests {
System.out.println(postRequest.getReDirectUrl("http://10.10.100.129:8089" + "/MobileOA/api/FsscSSO?loginUser=230615020&data=%2F%23%2Fexpenseclaim%3FbillDefineId%3Dfcc76666fb1211e98e2019f4db5548fd%26scene%3DWRITE%26isNew%3Dtrue%26goback%3Dfalse"));
}
@Test
// @Test
void syncUserTo() {
User user = new User();
user.setCompanyCode("A10000001");
@ -267,7 +277,7 @@ class RouteApplicationTests {
// log.trace("trace");
}
@Test
// @Test
void loginSignProd() {
String sfno = "231201060";
String syscode = "FSSC";
@ -312,7 +322,7 @@ class RouteApplicationTests {
routeRepository.deleteById(875L);
}
@Test
// @Test
void deleteOrderDetail() {
orderDetailRepository.deleteById(2609L);
}
@ -1000,7 +1010,7 @@ class RouteApplicationTests {
pushUser.getUserSFDataFromOpenApiBatch();
}
@Test
// @Test
void deleteByOrderId() {
orderDetailRepository.deleteById(1647L);
orderDetailRepository.deleteById(1648L);
@ -1046,7 +1056,7 @@ class RouteApplicationTests {
locationRepository.saveAll(allLevelThreeAndFour);
}
@Test
// @Test
void generateIfAirport() {
List<Location> airportLocation = new ArrayList<>();
AirportSearchResponse response = cTripAirportRequest.getAirport();
@ -1092,7 +1102,7 @@ class RouteApplicationTests {
locationRepository.saveAll(airportLocation);
}
@Test
// @Test
void updateCounty() {
List<Location> byLocationType = locationRepository.findByLocationType(5);
for (Location location : byLocationType) {
@ -1103,7 +1113,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
@Test
// @Test
void updateAirportPath() {
List<Location> byLocationType = locationRepository.findByLocationType(7);
for (Location location : byLocationType) {
@ -1113,7 +1123,7 @@ class RouteApplicationTests {
locationRepository.saveAll(byLocationType);
}
@Test
// @Test
void generateLocationType() {
List<Location> all = locationRepository.findAll();
all.forEach(it -> {
@ -1183,12 +1193,18 @@ class RouteApplicationTests {
cTripStatusNotification.setStatusIDs(null);
}
@Test
// YB_STANDARD_LEVEL_ONE m2.p2及以下
// YB_STANDARD_LEVEL_TWO m3-m4 p3-p4
// YB_STANDARD_LEVEL_THREE m5-m7 p5-p7
// YB_STANDARD_LEVEL_FOUR m8.p8及以上
//浙江正泰仪器仪表有限责任公司 A10160001
// @Test
void addRanks() {
RanksData ranksData = new RanksData();
ranksData.setIndustry("浙江正泰物联技术有限公司");
ranksData.setCompanyCode("A70000059");
ranksData.setIndustry("浙江正泰仪器仪表有限责任公司");
ranksData.setCompanyCode("A10160001");
for (int i = 1; i < 13; i++) {
if (i <= 2) {
ranksData.setLevel(4);
@ -1209,10 +1225,27 @@ class RouteApplicationTests {
}
@Test
// @Test
void testQueryCity() {
Location location = locationRepository.findById(373L);
Location cityLocation = lyOrderSyncAdapter.getCityLocation(location);
System.out.println(cityLocation);
}
// @Test
void testTimeFor(){
LocalDateTime localDateTime = DateTimeUtil.strToTimeMM("2024-03-04 00:23:26.727");
System.out.println(localDateTime);
}
// @Test
void testFindOrderRecord(){
CTripHotelRecord hotelRecordByRecordId = cTripOrderDetail.findHotelRecordByRecordId("98494942");
System.out.println(hotelRecordByRecordId);
}
// @Test
void testInBlackList(){
orderDomainService.checkCompanyNameIfBlack("乐清正泰电器销售有限公司");
}
}