diff --git a/pom.xml b/pom.xml
index a7af9acc..cffee4c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -104,6 +104,12 @@
3.3.2
+
+ io.minio
+ minio
+ 8.5.6
+
+
diff --git a/src/main/java/com/chint/application/commands/SupplierCallBackErrorCommand.java b/src/main/java/com/chint/application/commands/SupplierCallBackErrorCommand.java
index 20b06ab9..28725ad2 100644
--- a/src/main/java/com/chint/application/commands/SupplierCallBackErrorCommand.java
+++ b/src/main/java/com/chint/application/commands/SupplierCallBackErrorCommand.java
@@ -6,12 +6,14 @@ import lombok.Data;
@Data
public class SupplierCallBackErrorCommand extends Command {
private Exception e;
+ private String orderNo;
private String supplierName;
private String requestBody;
- public SupplierCallBackErrorCommand info(String supplierName, String requestBody, Exception e) {
+ public SupplierCallBackErrorCommand info(String supplierName, String orderNo, String requestBody, Exception e) {
this.setSupplierName(supplierName);
this.setRequestBody(requestBody);
+ this.setOrderNo(orderNo);
this.setE(e);
return this;
}
diff --git a/src/main/java/com/chint/domain/aggregates/supplier/SupplierCallBackLog.java b/src/main/java/com/chint/domain/aggregates/supplier/SupplierCallBackLog.java
index 25cc9def..0d0cde96 100644
--- a/src/main/java/com/chint/domain/aggregates/supplier/SupplierCallBackLog.java
+++ b/src/main/java/com/chint/domain/aggregates/supplier/SupplierCallBackLog.java
@@ -3,7 +3,6 @@ package com.chint.domain.aggregates.supplier;
import lombok.Data;
import org.springframework.data.annotation.Id;
-import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;
import java.io.PrintWriter;
@@ -16,6 +15,7 @@ public class SupplierCallBackLog {
@Id
private Long id;
private String supplierName;
+ private String orderNo;
private LocalDateTime happenTime;
private String callBackJson;
@@ -35,10 +35,10 @@ public class SupplierCallBackLog {
return this;
}
- public static SupplierCallBackLog fromException(String supplierName, String requestBody, Exception e) {
+ public static SupplierCallBackLog fromException(String supplierName, String orderNo, String requestBody, Exception e) {
SupplierCallBackLog log = SupplierCallBackLog.start();
log.setSupplierName(supplierName);
-
+ log.setOrderNo(orderNo);
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String exceptionDetails = sw.toString();
diff --git a/src/main/java/com/chint/domain/aggregates/user/User.java b/src/main/java/com/chint/domain/aggregates/user/User.java
index 78ae114a..94795232 100644
--- a/src/main/java/com/chint/domain/aggregates/user/User.java
+++ b/src/main/java/com/chint/domain/aggregates/user/User.java
@@ -371,6 +371,7 @@ public class User implements Serializable {
List userDepartmentInfoList = this.getUserDepartmentInfoList();
List result = new ArrayList<>();
if (userDepartmentInfoList != null && !userDepartmentInfoList.isEmpty()) {
+ userDepartmentInfoList.removeIf(departmentInfo -> departmentInfo.getStatus() == null || departmentInfo.getUname() == null);
userDepartmentInfoList.removeIf(departmentInfo -> departmentInfo.equals(userDepartmentInfo));
List list = userDepartmentInfoList.stream().distinct().toList();
if (userDepartmentInfo.ifPrimary()) {
diff --git a/src/main/java/com/chint/domain/service/SupplierDomainService.java b/src/main/java/com/chint/domain/service/SupplierDomainService.java
index f629a1c4..85eacccf 100644
--- a/src/main/java/com/chint/domain/service/SupplierDomainService.java
+++ b/src/main/java/com/chint/domain/service/SupplierDomainService.java
@@ -62,7 +62,7 @@ public class SupplierDomainService {
@ListenTo(command = "SupplierCallBackErrorCommand", order = 0)
public void supplierCallBackError(SupplierCallBackErrorCommand command) {
SupplierCallBackLog supplierCallBackLog = SupplierCallBackLog
- .fromException(command.getSupplierName(), command.getRequestBody(), command.getE());
+ .fromException(command.getSupplierName(), command.getOrderNo(), command.getRequestBody(), command.getE());
supplierCallBackLogRepository.save(supplierCallBackLog);
}
}
diff --git a/src/main/java/com/chint/interfaces/rest/amap/in/AmapNoteController.java b/src/main/java/com/chint/interfaces/rest/amap/in/AmapNoteController.java
index f4e76d02..fd8df954 100644
--- a/src/main/java/com/chint/interfaces/rest/amap/in/AmapNoteController.java
+++ b/src/main/java/com/chint/interfaces/rest/amap/in/AmapNoteController.java
@@ -91,7 +91,7 @@ public class AmapNoteController {
} catch (Exception e) {
//如果推送异常,将异常信息保存到数据库
CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
- .info(SUPPLIER_AMAP, requestBody, e).sendToQueue());
+ .info(SUPPLIER_AMAP, data.getAmapOrderId(), requestBody, e).sendToQueue());
e.printStackTrace();
}
diff --git a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
index 180914e8..a0b0c059 100644
--- a/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
+++ b/src/main/java/com/chint/interfaces/rest/ctrip/in/CTripNoteController.java
@@ -116,7 +116,7 @@ public class CTripNoteController {
} catch (Exception e) {
//如果推送异常,将异常信息保存到数据库
CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
- .info(SUPPLIER_C_TRIP, gson.toJson(notification), e).sendToQueue());
+ .info(SUPPLIER_C_TRIP, notification.getOrderId(), gson.toJson(notification), e).sendToQueue());
e.printStackTrace();
}
i++;
diff --git a/src/main/java/com/chint/interfaces/rest/data_center/user/UserHttpRequestImpl.java b/src/main/java/com/chint/interfaces/rest/data_center/user/UserHttpRequestImpl.java
index e4aac6c0..5bd72bdc 100644
--- a/src/main/java/com/chint/interfaces/rest/data_center/user/UserHttpRequestImpl.java
+++ b/src/main/java/com/chint/interfaces/rest/data_center/user/UserHttpRequestImpl.java
@@ -18,8 +18,6 @@ import com.chint.domain.service.RankDomainService;
import com.chint.infrastructure.constant.SFConstant;
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
import com.chint.infrastructure.echo_framework.command.Command;
-import com.chint.infrastructure.util.BaseContext;
-import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.data_center.user.dto.UserDataDTO;
import lombok.extern.slf4j.Slf4j;
@@ -29,7 +27,6 @@ import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
-import java.util.function.Predicate;
import static com.chint.infrastructure.constant.CommonMessageConstant.EMPLOYEE_NO_NOT_EXIST;
import static com.chint.infrastructure.constant.RankConstant.DEFAULT_RANK_NAME;
@@ -82,7 +79,7 @@ public class UserHttpRequestImpl implements UserHttpRequest {
List userDepartmentInfoList = user
.getUserDepartmentInfoList()
.stream()
- .filter(it -> it.getStatus().equals("A"))
+ .filter(it -> "A".equals(it.getStatus()))
.toList();
for (UserDepartmentInfo userDepartmentInfo : userDepartmentInfoList) {
String companyCode = userDepartmentInfo.getCompanyCode();
@@ -161,7 +158,7 @@ public class UserHttpRequestImpl implements UserHttpRequest {
List fromJson = userSFDataFromOpenApi
.stream()
- .filter(userDataDTO -> userDataDTO.getStatus().equals("A"))
+ .filter(userDataDTO -> "A".equals(userDataDTO.getStatus()))
.toList();
diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java
index 68df41d3..46640f1f 100644
--- a/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java
+++ b/src/main/java/com/chint/interfaces/rest/ly/in/CommonController.java
@@ -4,7 +4,6 @@ package com.chint.interfaces.rest.ly.in;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.chint.application.commands.SupplierCallBackErrorCommand;
-import com.chint.domain.aggregates.order.OrderTravel;
import com.chint.domain.repository.SupplierCallBackLogRepository;
import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.echo_framework.command.Command;
@@ -22,7 +21,6 @@ import com.chint.interfaces.rest.ly.dto.strokepush.StrokePushResult;
import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeParam;
import com.chint.interfaces.rest.ly.dto.strokepush.TrainChange.TrainChangeRequest;
import com.google.gson.Gson;
-import com.google.gson.JsonSyntaxException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -35,12 +33,10 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
-import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
@Slf4j
@@ -119,25 +115,16 @@ public class CommonController {
if (null == object) {
return;
}
-
- try {
- Notification notification = gson.fromJson(String.valueOf(object), Notification.class);
- int notifyType = notification.getNotifyType();
- switch (notifyType) {
- //进行订单数据回推
- case 1 -> getOrderFlight(notification);
- case 3 -> getOrderHotel(notification);
- case 5 -> getOrderTrain(notification);
- case 6 -> getOrderCar(notification);
- default -> LYNoteResponse.success();
- }
- } catch (Exception e) {
- //如果推送异常,将异常信息保存到数据库
- CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
- .info(SUPPLIER_L_Y, String.valueOf(object), e).sendToQueue());
- e.printStackTrace();
+ Notification notification = gson.fromJson(String.valueOf(object), Notification.class);
+ int notifyType = notification.getNotifyType();
+ switch (notifyType) {
+ //进行订单数据回推
+ case 1 -> getOrderFlight(notification);
+ case 3 -> getOrderHotel(notification);
+ case 5 -> getOrderTrain(notification);
+ case 6 -> getOrderCar(notification);
+ default -> LYNoteResponse.success();
}
-
i++;
if (i > 5) {
log.info("CommonBack处理结束");
@@ -158,7 +145,14 @@ public class CommonController {
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackCar.DataObject orderCar = jsonObj.toJavaObject(ResultBackCar.DataObject.class);
String orderSerialNo = orderCar.getOrder().getOrderSerialNo();
- return lyCallBackDataHandler.carCallBackData(orderSerialNo);
+ try {
+ return lyCallBackDataHandler.carCallBackData(orderSerialNo);
+ } catch (Exception e) {
+ //如果推送异常,将异常信息保存到数据库
+ CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
+ .info(SUPPLIER_L_Y, orderSerialNo, gson.toJson(notification), e).sendToQueue());
+ e.printStackTrace();
+ }
}
return new LYNoteResponse("100", "OK");
}
@@ -174,7 +168,14 @@ public class CommonController {
if (Objects.nonNull(notifyData)) {
JSONObject jsonObj = JSON.parseObject(notifyData.toString());
ResultBackTrain orderTrain = jsonObj.toJavaObject(ResultBackTrain.class);
- return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo());
+ try {
+ return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo());
+ } catch (Exception e) {
+ //如果推送异常,将异常信息保存到数据库
+ CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
+ .info(SUPPLIER_L_Y, orderTrain.getOrderNo(), gson.toJson(notification), e).sendToQueue());
+ e.printStackTrace();
+ }
}
return new LYNoteResponse("100", "OK");
}
@@ -193,7 +194,14 @@ public class CommonController {
ResultBackHotel resultBackHotel = jsonObj.toJavaObject(ResultBackHotel.class);
ResultBackHotel.DataObject dataObject = resultBackHotel.getData();
String orderSerialNo = dataObject.getOrderInfo().getOrderSerialNo();
- return lyCallBackDataHandler.hotelCallBackData(orderSerialNo);
+ try {
+ return lyCallBackDataHandler.hotelCallBackData(orderSerialNo);
+ } catch (Exception e) {
+ //如果推送异常,将异常信息保存到数据库
+ CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
+ .info(SUPPLIER_L_Y, orderSerialNo, gson.toJson(notification), e).sendToQueue());
+ e.printStackTrace();
+ }
}
return new LYNoteResponse("100", "OK");
}
@@ -217,72 +225,19 @@ public class CommonController {
orderSerialNo = dataObject.getOrderDetails().getOrderSerialNo();
}
//正常流程
- return lyCallBackDataHandler.flightCallBackData(orderSerialNo);
+ try {
+ return lyCallBackDataHandler.flightCallBackData(orderSerialNo);
+ } catch (Exception e) {
+ //如果推送异常,将异常信息保存到数据库
+ CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
+ .info(SUPPLIER_L_Y, orderSerialNo, gson.toJson(notification), e).sendToQueue());
+ e.printStackTrace();
+ }
}
return new LYNoteResponse("100", "OK");
}
- /**
- * 50推送
- *
- * @param notification
- * @return
- */
-// public LYNoteResponse getOrderType(Notification notification) {
-// int subNotifyType = notification.getSubNotifyType();
-// Class> objClass = notification.getClass();
-// Object object = GetObjectNature.getObject(objClass, "notifyData", notification);
-// Gson gson = new Gson();
-// NotifyData common = gson.fromJson(object.toString(), NotifyData.class);
-// boolean emptyHotel = Objects.nonNull(common.getTravelBizOrderList().getHotelOrderList());
-// boolean emptyFly = Objects.nonNull(common.getTravelBizOrderList().getFlightOrderList());
-// boolean emptyCar = Objects.nonNull(common.getTravelBizOrderList().getCarOrderList());
-// boolean emptyTrain = Objects.nonNull(common.getTravelBizOrderList().getTrainOrderList());
-// if (emptyHotel) {//酒店
-// NotifyData.HotelOrder hotelOrder = common.getTravelBizOrderList().getHotelOrderList().get(0);
-// OrderTravel orderTravel = new OrderTravel();
-// orderTravel.setOrderNo(hotelOrder.getOrderInfo().getOrderSerialNo());
-// orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
-// saveOrderTravel(orderTravel);
-// String foulReason = hotelOrder.getOrderInfo().getFoulReason();//超标原因
-// return lyCallBackDataHandler.hotelCallBackData(hotelOrder.getOrderInfo().getOrderSerialNo(), hotelOrder.getOrderInfo().getRuleViolate() ? 1 : 0, foulReason);
-// } else if (emptyFly) {//机票originalOrderNo
-// NotifyData.OrderDetails flyOrder = common.getTravelBizOrderList().getFlightOrderList().get(0).getOrderDetails();
-// OrderTravel orderTravel = new OrderTravel();
-// orderTravel.setOrderNo(flyOrder.getOrderSerialNo());
-// orderTravel.setTravelNo(flyOrder.getTravelOrderNo());
-// saveOrderTravel(orderTravel);
-// int ruleViolate = flyOrder.getRuleViolate() ? 1 : 0;
-// //改签
-// if (subNotifyType == 9) {
-// changeFlight(ruleViolate, subNotifyType, flyOrder.getOrderSerialNo());
-// }
-// String foulReason = flyOrder.getFoulReason();//超标原因
-// return lyCallBackDataHandler.flightCallBackData(flyOrder.getOrderSerialNo(), flyOrder.getRuleViolate() ? 1 : 0, foulReason, subNotifyType);
-//
-// } else if (emptyTrain) {//火车票
-// NotifyData.TrainOrderList.OrderTrain orderTrain = common.getTravelBizOrderList().getTrainOrderList().get(0);
-// OrderTravel orderTravel = new OrderTravel();
-// orderTravel.setOrderNo(orderTrain.getOrderNo());
-// orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
-// saveOrderTravel(orderTravel);
-// int ruleViolate = orderTrain.getRuleViolate() ? 1 : 0;
-// if (subNotifyType == 16) {
-// changeTrain(ruleViolate, subNotifyType, orderTrain.getOrderNo());
-// }
-// String foulReason = orderTrain.getFoulReason();//超标原因
-// return lyCallBackDataHandler.trainCallBackData(orderTrain.getOrderNo(), orderTrain.getRuleViolate() ? 1 : 0, foulReason, subNotifyType);
-// } else if (emptyCar) {
-// NotifyData.CarOrderList.Order orderCar = common.getTravelBizOrderList().getCarOrderList().get(0).getOrder();
-// OrderTravel orderTravel = new OrderTravel();
-// orderTravel.setOrderNo(orderCar.getOrderSerialNo());
-// orderTravel.setTravelNo(common.getTravelBizOrder().getTravelOrderNo());
-// saveOrderTravel(orderTravel);
-// return lyCallBackDataHandler.carCallBackData(orderCar.getOrderSerialNo(), 0);
-// } else {
-// return new LYNoteResponse("100", "OK");
-// }
-// }
+
public void sendMsg(String travelApplyNo) {
StrokePushDTO strokePushDTO = new StrokePushDTO();
Param param = new Param();
@@ -292,12 +247,6 @@ public class CommonController {
strokeController.strokePush(strokePushDTO);
}
- public void saveOrderTravel(OrderTravel orderTravel) {
- List byOrderNo = travelRepository.findByOrderNo(orderTravel.getOrderNo());
- if (byOrderNo.isEmpty()) {
- travelRepository.save(orderTravel);
- }
- }
/**
* 机票确认改签接口
diff --git a/src/main/java/com/chint/interfaces/rest/ly/in/LYETAController.java b/src/main/java/com/chint/interfaces/rest/ly/in/LYETAController.java
index e4e3f744..ddba6119 100644
--- a/src/main/java/com/chint/interfaces/rest/ly/in/LYETAController.java
+++ b/src/main/java/com/chint/interfaces/rest/ly/in/LYETAController.java
@@ -120,7 +120,7 @@ public class LYETAController {
} catch (Exception e) {
//如果推送异常,将异常信息保存到数据库
CompletableFuture.runAsync(() -> Command.of(SupplierCallBackErrorCommand.class)
- .info(SUPPLIER_L_Y, gson.toJson(lyETAPush), e).sendToQueue());
+ .info(SUPPLIER_L_Y, null, gson.toJson(lyETAPush), e).sendToQueue());
e.printStackTrace();
}
return LYNoteResponse.success();
diff --git a/src/test/java/com/chint/RouteApplicationTests.java b/src/test/java/com/chint/RouteApplicationTests.java
index 3c8369fb..b5eb421f 100644
--- a/src/test/java/com/chint/RouteApplicationTests.java
+++ b/src/test/java/com/chint/RouteApplicationTests.java
@@ -302,7 +302,7 @@ class RouteApplicationTests {
@Test
void loginSignProd() {
- String sfno = "001001002";
+ String sfno = "180605039";
String syscode = "FSSC";
String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司";