fix:增加根据行程规划单查询消费明细字段

This commit is contained in:
lulz1 2024-05-21 10:13:19 +08:00
parent 5c0fc3c359
commit f3228db853
11 changed files with 91 additions and 21 deletions

View File

@ -5,10 +5,12 @@ import com.chint.application.dtos.*;
import com.chint.application.dtos.response.OrderDetailRes;
import com.chint.application.queryies.OrderDetailQuery;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
import com.chint.domain.repository.ClientRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.auth.AuthenticateService;
import com.chint.domain.value_object.RouteOrderDetail;
import com.chint.infrastructure.echo_framework.annotation.TransitionTo;
@ -78,6 +80,8 @@ public class OrderDetailController {
@Autowired
private OrderDetailExportFactory orderDetailExportFactory;
@Autowired
private UserRepository userRepository;
@ApiOperation("订单明细认证接口")
@PostMapping("/public/authentication")
@ -105,7 +109,10 @@ public class OrderDetailController {
public Result<RouteOrderDetail> queryOrderDetail(@RequestBody AuthenticationSignDto queryData) {
RouteOrder routeOrder = routeRepository
.findByActualOrderNoAndSysCode(queryData.getActualOrderNo(), queryData.getSysCode());
return Result.Success(SUCCESS, routeOrder.mapToOrderDetailVO());
RouteOrderDetail routeOrderDetail = routeOrder.mapToOrderDetailVO();
User user = userRepository.findByUserEmployeeNo(routeOrderDetail.getEmployeeNo());
routeOrderDetail.setEmployeeName(user.getName());
return Result.Success(SUCCESS, routeOrderDetail);
}
@ApiOperation("订单明细导出接口")
@ -151,7 +158,7 @@ public class OrderDetailController {
Integer pageNum = authenticationDto.getPageNum();
String orgsign = authenticationDto.getSign();
String input;
if (systemType.equals("XN_FK") || systemType.equals("AN_FK")) {
if (systemType.equals("AN_FK") || systemType.equals("XN_FK")) {
input = productType + systemType + startTime + endTime + pageSize + pageNum;
} else {
input = orderNo + productType + systemType + startTime + endTime + pageSize + pageNum;

View File

@ -13,6 +13,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.echo_framework.dispatch.Properties;
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
import com.chint.infrastructure.util.BigDecimalCalculator;
import com.chint.infrastructure.util.DateTimeUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -542,7 +543,12 @@ public class RouteOrder implements Serializable {
routeOrderDetail.setSysCode(approveOrderNo.getSysCode());
routeOrderDetail.setOrderNo(approveOrderNo.getActualOrderNo());
routeOrderDetail.setRouteOrderNo(this.getRouteOrderNo());
routeOrderDetail.setInstructions(approveOrderNo.getInstructions());
}
routeOrderDetail.setEmployeeNo(this.getUserId());
routeOrderDetail.setStartTime(DateTimeUtil.timeToStrCommon(this.getStartTime()));
routeOrderDetail.setEndTime(DateTimeUtil.timeToStrCommon(this.getEndTime()));
List<OrderDetail> orderDetails = this.getOrderDetails();

View File

@ -18,6 +18,8 @@ public interface OrderDetailRepository {
Optional<OrderDetail> findByOrderNo(String orderNo);
List<OrderDetail> findByOrderNoIn(List<String> orderNoList);
OrderDetail save(OrderDetail orderDetail);
void deleteById(Long id);

View File

@ -214,6 +214,9 @@ public class RouteRequestDomainService {
public RouteOrder getRouteOrder(String journeyNo) {
//先通过
if (journeyNo == null) {
return null;
}
RouteRequest routeRequest = routeRequestRepository.findByRouteRequestNo(journeyNo);
if (routeRequest == null) {
return routeRepository.findByOrderNo(journeyNo);

View File

@ -13,6 +13,11 @@ public class RouteOrderDetail {
private String sysCode;
private String orderNo;
private String routeOrderNo;
private String employeeNo;
private String employeeName;
private String instructions;
private String startTime;
private String endTime;
private List<HotelOrderDetail> hotelOrderDetailList;
private List<FlightOrderDetail> flightOrderDetailList;
private List<TrainOrderDetail> trainOrderDetailList;

View File

@ -50,6 +50,11 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
return Optional.ofNullable(jdbcOrderDetailRepository.findByOrderNo(orderNo));
}
@Override
public List<OrderDetail> findByOrderNoIn(List<String> orderNoList) {
return jdbcOrderDetailRepository.findByOrderNoIn(orderNoList);
}
@Override
public OrderDetail save(OrderDetail orderDetail) {
if (orderDetail.getRouteId() != null) {

View File

@ -8,6 +8,7 @@ import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
@Repository
@ -19,6 +20,8 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
List<OrderDetail> findByLegId(Long legId);
List<OrderDetail> findByOrderNoIn(Collection<String> orderNo);
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
List<OrderDetail> findByCreateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);

View File

@ -15,6 +15,7 @@ chint:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
host: 10.10.24.44
# host: 10.9.56.48
port: 6603
database: itinerary_booking
username: tripbook

View File

@ -246,7 +246,7 @@ public class CTripTest {
@Test
void search() {
BaseContext.setCurrentUser(user);
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("31519161865");
SearchOrderResponse response = orderSearchRequest.searchOrderResponseByOrderId("32086574339");
System.out.println(response);
}

View File

@ -6,7 +6,9 @@ import com.authine.cloudpivot.opensdk.CloudpivotOpenClient;
import com.authine.cloudpivot.opensdk.model.request.workflow.StartWorkflowRequest;
import com.authine.cloudpivot.opensdk.model.response.workflow.StartWorkflowResponse;
import com.chint.application.commands.RefundOrderGenerateCommand;
import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.OrderTravel;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailCarRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailFlightRecord;
import com.chint.domain.aggregates.order.order_record.ly_order_record.LyOrderDetailHotelRecord;
@ -18,10 +20,8 @@ import com.chint.domain.service.order_sync.LYOrderSyncAdapter;
import com.chint.infrastructure.constant.LYConstant;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.repository.jdbc.JdbcLyOrderDetailFlightRecord;
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;
@ -39,7 +39,6 @@ import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderRespon
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
import com.chint.interfaces.rest.ly.in.CommonController;
import com.chint.interfaces.rest.ly.tools.LYOrderUtil;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@ -57,9 +56,6 @@ import java.util.*;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
import static com.chint.infrastructure.constant.BPMConstant.YSBPM_TOKEN_URL;
import static com.chint.infrastructure.constant.FSSCConstant.*;
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_TRAIN_STATUS_SUCCESS;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
@SpringBootTest
@ -814,9 +810,9 @@ public class LYTest {
System.out.println("join = " + join);
}
// @Test
@Test
void searchFlight() {
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24032167504679321");
FlightOrderResponse flightOrderDetail = lySearchRequest.getFlightOrderDetail("DF24040869327887639");
Gson gson = new Gson();
String json = gson.toJson(flightOrderDetail);
System.out.println(json);
@ -824,7 +820,7 @@ public class LYTest {
@Test
void searchTrain() {
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24050872678451149");
TrainDetailResponse trainOrderDetail = lySearchRequest.getTrainOrderDetail("DT24041870754514251");
Gson gson = new Gson();
String json = gson.toJson(trainOrderDetail);
System.out.println(json);

View File

@ -29,6 +29,7 @@ import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
import com.chint.interfaces.rest.ctrip.dto.airport.AirportSearchResponse;
import com.chint.interfaces.rest.ctrip.dto.put.CTripNoteResponse;
import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusNotification;
import com.chint.interfaces.rest.ctrip.tools.CTripUtils;
import com.chint.interfaces.rest.data_center.org.OrgRequest;
import com.chint.interfaces.rest.data_center.user.BatchUserWorker;
import com.chint.interfaces.rest.data_center.user.UserHttpRequest;
@ -362,7 +363,7 @@ class RouteApplicationTests {
void deleteLeg() {
legRepository.deleteById(Leg.of(669L));
// legRepository.deleteById(Leg.of(507L));
}
// @Test
@ -392,12 +393,53 @@ class RouteApplicationTests {
CTripStatusNotification cTripStatusNotification = gson.fromJson(string, CTripStatusNotification.class);
cTripStatusNotifications.add(cTripStatusNotification);
}
System.out.println(cTripStatusNotifications);
List<Integer> success = new ArrayList<>();
List<Integer> failure = new ArrayList<>();
String[] needOrderNo = {
"32084225159", "32146746813", "32158752075", "32171383412", "32171512338", "32178719048",
"32184435651", "32215789350", "32219581453", "32222298409", "32224573377", "32226396102",
"32234662287", "32236304050", "32249070854", "32249772579", "32256946953", "32257117381",
"32258011903", "32258485761", "32258628404", "32258678990", "32259609786", "32259728098",
"32259781390", "32259806425", "32259824756", "32260438297", "32260601852", "32260765132",
"32260918908", "32261359069", "32262054662", "32262969529", "32263064974", "32263131986",
"32263163899", "32264006341", "32264130918", "32264561473", "32264785338", "32265546260",
"32266005429", "32266131393", "32268013049", "32268055712", "32268176915", "32268308281",
"32269115540", "32270724335", "32271011469", "32271086263", "32273877605", "32274807710",
"32275237919", "32275803493", "32276121134", "32277427136", "32277753936", "32277764902",
"32278120007", "32278129213", "32278787671", "32279091482", "32279135528", "32279550298",
"32279742078", "32279914591", "32280026153", "32280042005", "32280707540", "32281513196",
"32281736393", "32281753545", "32281800631", "32281831567", "32282235024", "32282547907",
"32282574686", "32283005299", "32283256774", "32283818445", "32284250781", "32284713828",
"32285389760", "32285680785", "32285827233", "32285895752", "32286738588", "32286848572",
"32261128581", "32289454249", "32289577730", "32290702118", "32291537835", "32291589719",
"32292443034", "32292713870", "32292957306", "32293623982", "32293658222", "32294810855",
"32295360889", "32295791259", "32296124914", "32296273961", "32296530130", "32296552044",
"32297009228", "32298292163", "32300058687", "32300097765", "32300165160", "32301184984",
"32301449163", "32301527392", "32301911881", "32302017763", "32302094571", "32302356214",
"32302398477", "32302531250", "31536497498", "32303760508", "32304027018", "32304128494",
"32304195143", "32304204941", "32304519525", "32304563178", "32304828902", "32306523636",
"32306705819", "32306742872", "32307278952", "32307743735", "32307903575", "32308615866",
"32308797484", "32308849402", "32308903835", "32309414246", "32309423691", "32309641453",
"32309984561", "32310336983", "32310353307", "32310606344", "32310886788", "32311322662",
"32311392807", "32342902938", "32343614712", "32343892746", "32344140321", "32345166666",
"32345783537", "32346370055", "32346496542", "32346541710", "32346631989", "32347053863",
"32347080012", "32347664410", "32348518682", "32350025042", "32350666398", "32350712248",
"32352701125", "32387079073", "32390632631", "32391847372", "32392700246", "32392856910",
"32393204906", "32393811821", "32394936177", "32396042544", "32397830994", "32398755780",
"32400401495", "32400777212", "32401284432", "32401356706"
};
List<String> list1 = Arrays.asList(needOrderNo);
int requestCount = 0;
List<String> alreadyPost = new ArrayList<>();
for (CTripStatusNotification cTripStatusNotification : cTripStatusNotifications) {
if(!CTripUtils.checkHotelStatus(cTripStatusNotification.getOrderStatus())) {
continue;
}
if (!list1.contains(cTripStatusNotification.getOrderId()) || alreadyPost.contains(cTripStatusNotification.getOrderId())) {
continue;
}
CTripNoteResponse post = postRequest.post("https://trip.chint.com/api/public/CTrip/status", cTripStatusNotification, CTripNoteResponse.class);
alreadyPost.add(cTripStatusNotification.getOrderId());
if (post.getErrorMessage() != null || !Objects.equals(post.getErrorCode(), "0")) {
failure.add(0);
} else {
@ -408,7 +450,7 @@ class RouteApplicationTests {
// 每发起10次请求后休息1秒
if (requestCount % 10 == 0) {
try {
Thread.sleep(10000);
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}