添加行程规划功能接口
This commit is contained in:
parent
32ba08c300
commit
89ca5cb54f
|
@ -1,7 +1,6 @@
|
||||||
package com.chint.application.commands;
|
package com.chint.application.commands;
|
||||||
|
|
||||||
import com.chint.domain.value_object.ApproveLegData;
|
import com.chint.domain.value_object.ApprovalLegData;
|
||||||
import com.chint.domain.value_object.RejectLegData;
|
|
||||||
import com.chint.infrastructure.echo_framework.command.Command;
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -11,14 +10,14 @@ import static com.chint.infrastructure.constant.Constant.LEG_EVENT_REJECT;
|
||||||
public class LegRejectCommand extends Command {
|
public class LegRejectCommand extends Command {
|
||||||
private final Integer legEventType = LEG_EVENT_REJECT;
|
private final Integer legEventType = LEG_EVENT_REJECT;
|
||||||
private Long routeId;
|
private Long routeId;
|
||||||
private RejectLegData data;
|
private ApprovalLegData data;
|
||||||
|
|
||||||
public LegRejectCommand routeId(Long routeId) {
|
public LegRejectCommand routeId(Long routeId) {
|
||||||
this.setRouteId(routeId);
|
this.setRouteId(routeId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LegRejectCommand data(RejectLegData data) {
|
public LegRejectCommand data(ApprovalLegData data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.chint.application.commands;
|
||||||
|
|
||||||
|
import com.chint.infrastructure.echo_framework.command.Command;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.APPROVAL_EVENT_SUCCESS;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderApprovalCommand extends Command {
|
||||||
|
private String actualNo;
|
||||||
|
private Integer type = APPROVAL_EVENT_SUCCESS;
|
||||||
|
|
||||||
|
public OrderApprovalCommand actualNo(String actualNo) {
|
||||||
|
this.setActualNo(actualNo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.chint.application.dtos;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chint.domain.value_object.LegData;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AddLegData {
|
||||||
|
private Long routeId;
|
||||||
|
private LegData legData;
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.chint.application.dtos;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeleteLegData {
|
||||||
|
private Long routeId;
|
||||||
|
private String legNo;
|
||||||
|
}
|
|
@ -8,6 +8,6 @@ public class LocationParam extends BaseQuery {
|
||||||
private Long level;
|
private Long level;
|
||||||
private Long parentLocationId;
|
private Long parentLocationId;
|
||||||
private String cityName;
|
private String cityName;
|
||||||
private String firstLetter;
|
private String queryWord;
|
||||||
private Integer cityType;
|
private Integer cityType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FlightScheduleDetail extends ScheduleDetail {
|
||||||
|
private String startHM;
|
||||||
|
private String endHM;
|
||||||
|
private String departureGeoId;
|
||||||
|
private String arrivalGeoId;
|
||||||
|
|
||||||
|
public static FlightScheduleDetailBuilder builder(){
|
||||||
|
return new FlightScheduleDetailBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor, getters and setters
|
||||||
|
public static class FlightScheduleDetailBuilder extends ScheduleDetailBuilder {
|
||||||
|
private FlightScheduleDetail flightScheduleDetail = new FlightScheduleDetail();
|
||||||
|
|
||||||
|
public FlightScheduleDetailBuilder startHM(String startHM) {
|
||||||
|
flightScheduleDetail.setStartHM(startHM);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlightScheduleDetailBuilder endHM(String endHM) {
|
||||||
|
flightScheduleDetail.setEndHM(endHM);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlightScheduleDetailBuilder departureGeoId(String departureGeoId) {
|
||||||
|
flightScheduleDetail.setDepartureGeoId(departureGeoId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FlightScheduleDetailBuilder arrivalGeoId(String arrivalGeoId) {
|
||||||
|
flightScheduleDetail.setArrivalGeoId(arrivalGeoId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FlightScheduleDetail build() {
|
||||||
|
return flightScheduleDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HotelScheduleDetail extends ScheduleDetail {
|
||||||
|
private String lastUpdateTime;
|
||||||
|
private Integer nightCount;
|
||||||
|
public static HotelScheduleDetailBuilder builder(){
|
||||||
|
return new HotelScheduleDetailBuilder();
|
||||||
|
}
|
||||||
|
// Constructor, getters and setters
|
||||||
|
public static class HotelScheduleDetailBuilder extends ScheduleDetailBuilder {
|
||||||
|
private HotelScheduleDetail hotelScheduleDetail = new HotelScheduleDetail();
|
||||||
|
|
||||||
|
public HotelScheduleDetailBuilder lastUpdateTime(String lastUpdateTime) {
|
||||||
|
hotelScheduleDetail.setLastUpdateTime(lastUpdateTime);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HotelScheduleDetailBuilder nightCount(Integer nightCount) {
|
||||||
|
hotelScheduleDetail.setNightCount(nightCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HotelScheduleDetail build() {
|
||||||
|
return hotelScheduleDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OtherScheduleDetail extends ScheduleDetail {
|
||||||
|
private String amountType;
|
||||||
|
private String amountTypeEnName;
|
||||||
|
private String amountTypeCnName;
|
||||||
|
private String lastUpdateTime;
|
||||||
|
// Constructor, getters and setters
|
||||||
|
|
||||||
|
public static OtherScheduleDetailBuilder builder(){
|
||||||
|
return new OtherScheduleDetailBuilder();
|
||||||
|
}
|
||||||
|
public static class OtherScheduleDetailBuilder extends ScheduleDetailBuilder {
|
||||||
|
private OtherScheduleDetail otherScheduleDetail = new OtherScheduleDetail();
|
||||||
|
|
||||||
|
public OtherScheduleDetailBuilder amountType(String amountType) {
|
||||||
|
otherScheduleDetail.setAmountType(amountType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OtherScheduleDetailBuilder amountTypeEnName(String amountTypeEnName) {
|
||||||
|
otherScheduleDetail.setAmountTypeEnName(amountTypeEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OtherScheduleDetailBuilder amountTypeCnName(String amountTypeCnName) {
|
||||||
|
otherScheduleDetail.setAmountTypeCnName(amountTypeCnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OtherScheduleDetailBuilder lastUpdateTime(String lastUpdateTime) {
|
||||||
|
otherScheduleDetail.setLastUpdateTime(lastUpdateTime);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OtherScheduleDetail build() {
|
||||||
|
return otherScheduleDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,248 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScheduleDetail {
|
||||||
|
protected String serviceProvider;
|
||||||
|
protected String orderState;
|
||||||
|
protected String scheduleType;
|
||||||
|
protected String scheduleNum;
|
||||||
|
protected String startDate;
|
||||||
|
protected String endDate;
|
||||||
|
protected String startCityName;
|
||||||
|
protected String startCity;
|
||||||
|
protected String startCityEnName;
|
||||||
|
protected String endCityName;
|
||||||
|
protected String endCityEnName;
|
||||||
|
protected String endCity;
|
||||||
|
protected String orderId;
|
||||||
|
protected String parentOrderId;
|
||||||
|
protected String systemStatus;
|
||||||
|
protected String reserveCount;
|
||||||
|
protected String facilitatorCode;
|
||||||
|
protected String parentScheduleNum;
|
||||||
|
protected String extendedField;
|
||||||
|
protected String quoteGroupNum;
|
||||||
|
protected Integer isAddRecord;
|
||||||
|
protected String supplierOrderId;
|
||||||
|
protected String orderJson;
|
||||||
|
protected String amount;
|
||||||
|
protected List<ScheduleUserInfo> userInfoList; // Assuming UserInfo is another class you have defined
|
||||||
|
protected Integer extStatus;
|
||||||
|
protected Integer isHistoryRecord;
|
||||||
|
protected String currencyName;
|
||||||
|
protected String currency;
|
||||||
|
protected String currencyNameUS;
|
||||||
|
protected String createTime;
|
||||||
|
protected String startCountryCode;
|
||||||
|
protected String startCountryName;
|
||||||
|
protected String endCountryCode;
|
||||||
|
protected String endCountryName;
|
||||||
|
protected String realScheduleNum;
|
||||||
|
// Constructor, getters and setters
|
||||||
|
|
||||||
|
public static ScheduleDetailBuilder builder(){
|
||||||
|
return new ScheduleDetailBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ScheduleDetailBuilder {
|
||||||
|
private ScheduleDetail scheduleDetail = new ScheduleDetail();
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder serviceProvider(String serviceProvider) {
|
||||||
|
scheduleDetail.setServiceProvider(serviceProvider);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder orderState(String orderState) {
|
||||||
|
scheduleDetail.setOrderState(orderState);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder scheduleType(String scheduleType) {
|
||||||
|
scheduleDetail.setScheduleType(scheduleType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder scheduleNum(String scheduleNum) {
|
||||||
|
scheduleDetail.setScheduleNum(scheduleNum);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startDate(String startDate) {
|
||||||
|
scheduleDetail.setStartDate(startDate);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endDate(String endDate) {
|
||||||
|
scheduleDetail.setEndDate(endDate);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startCityName(String startCityName) {
|
||||||
|
scheduleDetail.setStartCityName(startCityName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startCity(String startCity) {
|
||||||
|
scheduleDetail.setStartCity(startCity);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startCityEnName(String startCityEnName) {
|
||||||
|
scheduleDetail.setStartCityEnName(startCityEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endCityName(String endCityName) {
|
||||||
|
scheduleDetail.setEndCityName(endCityName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endCityEnName(String endCityEnName) {
|
||||||
|
scheduleDetail.setEndCityEnName(endCityEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endCity(String endCity) {
|
||||||
|
scheduleDetail.setEndCity(endCity);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder orderId(String orderId) {
|
||||||
|
scheduleDetail.setOrderId(orderId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder parentOrderId(String parentOrderId) {
|
||||||
|
scheduleDetail.setParentOrderId(parentOrderId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder systemStatus(String systemStatus) {
|
||||||
|
scheduleDetail.setSystemStatus(systemStatus);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder reserveCount(String reserveCount) {
|
||||||
|
scheduleDetail.setReserveCount(reserveCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder facilitatorCode(String facilitatorCode) {
|
||||||
|
scheduleDetail.setFacilitatorCode(facilitatorCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder parentScheduleNum(String parentScheduleNum) {
|
||||||
|
scheduleDetail.setParentScheduleNum(parentScheduleNum);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder extendedField(String extendedField) {
|
||||||
|
scheduleDetail.setExtendedField(extendedField);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder quoteGroupNum(String quoteGroupNum) {
|
||||||
|
scheduleDetail.setQuoteGroupNum(quoteGroupNum);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder isAddRecord(Integer isAddRecord) {
|
||||||
|
scheduleDetail.setIsAddRecord(isAddRecord);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder supplierOrderId(String supplierOrderId) {
|
||||||
|
scheduleDetail.setSupplierOrderId(supplierOrderId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder orderJson(String orderJson) {
|
||||||
|
scheduleDetail.setOrderJson(orderJson);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder amount(String amount) {
|
||||||
|
scheduleDetail.setAmount(amount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder userInfoList(List<ScheduleUserInfo> userInfoList) {
|
||||||
|
scheduleDetail.setUserInfoList(userInfoList);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder addUserInfo(ScheduleUserInfo.ScheduleUserInfoBuilder userInfoBuilder) {
|
||||||
|
if (scheduleDetail.getUserInfoList() == null) {
|
||||||
|
scheduleDetail.setUserInfoList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
scheduleDetail.getUserInfoList().add(userInfoBuilder.build());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder extStatus(Integer extStatus) {
|
||||||
|
scheduleDetail.setExtStatus(extStatus);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder isHistoryRecord(Integer isHistoryRecord) {
|
||||||
|
scheduleDetail.setIsHistoryRecord(isHistoryRecord);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder currencyName(String currencyName) {
|
||||||
|
scheduleDetail.setCurrencyName(currencyName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder currency(String currency) {
|
||||||
|
scheduleDetail.setCurrency(currency);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder currencyNameUS(String currencyNameUS) {
|
||||||
|
scheduleDetail.setCurrencyNameUS(currencyNameUS);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder createTime(String createTime) {
|
||||||
|
scheduleDetail.setCreateTime(createTime);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startCountryCode(String startCountryCode) {
|
||||||
|
scheduleDetail.setStartCountryCode(startCountryCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder startCountryName(String startCountryName) {
|
||||||
|
scheduleDetail.setStartCountryName(startCountryName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endCountryCode(String endCountryCode) {
|
||||||
|
scheduleDetail.setEndCountryCode(endCountryCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder endCountryName(String endCountryName) {
|
||||||
|
scheduleDetail.setEndCountryName(endCountryName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetailBuilder realScheduleNum(String realScheduleNum) {
|
||||||
|
scheduleDetail.setRealScheduleNum(realScheduleNum);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDetail build() {
|
||||||
|
return scheduleDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScheduleDocument {
|
||||||
|
private String birthday;
|
||||||
|
private String chineseName;
|
||||||
|
private String country;
|
||||||
|
private String countryCode;
|
||||||
|
private String documentId;
|
||||||
|
private String documentNO;
|
||||||
|
private int documentType;
|
||||||
|
private String enCountry;
|
||||||
|
private String enIssueCountry;
|
||||||
|
private String givenName;
|
||||||
|
private String idExpire;
|
||||||
|
private String issueCountry;
|
||||||
|
private String issueCountryCode;
|
||||||
|
private String linkPhone;
|
||||||
|
private String outUserId;
|
||||||
|
private String sex; // 'M'表示男性
|
||||||
|
private String surName;
|
||||||
|
private String sysUserId;
|
||||||
|
private String tenantId;
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
public static ScheduleDocumentBuilder builder() {
|
||||||
|
return new ScheduleDocumentBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ScheduleDocumentBuilder {
|
||||||
|
private ScheduleDocument scheduleDocument = new ScheduleDocument();
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder birthday(String birthday) {
|
||||||
|
scheduleDocument.setBirthday(birthday);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder chineseName(String chineseName) {
|
||||||
|
scheduleDocument.setChineseName(chineseName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder country(String country) {
|
||||||
|
scheduleDocument.setCountry(country);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder countryCode(String countryCode) {
|
||||||
|
scheduleDocument.setCountryCode(countryCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder documentId(String documentId) {
|
||||||
|
scheduleDocument.setDocumentId(documentId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder documentNO(String documentNO) {
|
||||||
|
scheduleDocument.setDocumentNO(documentNO);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder documentType(int documentType) {
|
||||||
|
scheduleDocument.setDocumentType(documentType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder enCountry(String enCountry) {
|
||||||
|
scheduleDocument.setEnCountry(enCountry);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder enIssueCountry(String enIssueCountry) {
|
||||||
|
scheduleDocument.setEnIssueCountry(enIssueCountry);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder givenName(String givenName) {
|
||||||
|
scheduleDocument.setGivenName(givenName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder idExpire(String idExpire) {
|
||||||
|
scheduleDocument.setIdExpire(idExpire);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder issueCountry(String issueCountry) {
|
||||||
|
scheduleDocument.setIssueCountry(issueCountry);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder issueCountryCode(String issueCountryCode) {
|
||||||
|
scheduleDocument.setIssueCountryCode(issueCountryCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder linkPhone(String linkPhone) {
|
||||||
|
scheduleDocument.setLinkPhone(linkPhone);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder outUserId(String outUserId) {
|
||||||
|
scheduleDocument.setOutUserId(outUserId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder sex(String sex) {
|
||||||
|
scheduleDocument.setSex(sex);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder surName(String surName) {
|
||||||
|
scheduleDocument.setSurName(surName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder sysUserId(String sysUserId) {
|
||||||
|
scheduleDocument.setSysUserId(sysUserId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder tenantId(String tenantId) {
|
||||||
|
scheduleDocument.setTenantId(tenantId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocumentBuilder userName(String userName) {
|
||||||
|
scheduleDocument.setUserName(userName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleDocument build() {
|
||||||
|
return scheduleDocument;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,114 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScheduleUserInfo {
|
||||||
|
private String supplierId;
|
||||||
|
private String amount;
|
||||||
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
private String userMobile;
|
||||||
|
private String userNo;
|
||||||
|
private String sex; // 1表示男性
|
||||||
|
private String passengerType;
|
||||||
|
private String overproofInfo;
|
||||||
|
private String isReserve;
|
||||||
|
private List<ScheduleDocument> documentList;
|
||||||
|
private int reserveCount;
|
||||||
|
private String deptCode;
|
||||||
|
private String rankCode;
|
||||||
|
|
||||||
|
public static ScheduleUserInfoBuilder builder() {
|
||||||
|
return new ScheduleUserInfoBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ScheduleUserInfoBuilder {
|
||||||
|
private final ScheduleUserInfo scheduleUserInfo = new ScheduleUserInfo();
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder supplierId(String supplierId) {
|
||||||
|
scheduleUserInfo.setSupplierId(supplierId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder amount(String amount) {
|
||||||
|
scheduleUserInfo.setAmount(amount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder userId(String userId) {
|
||||||
|
scheduleUserInfo.setUserId(userId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder userName(String userName) {
|
||||||
|
scheduleUserInfo.setUserName(userName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder userMobile(String userMobile) {
|
||||||
|
scheduleUserInfo.setUserMobile(userMobile);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder userNo(String userNo) {
|
||||||
|
scheduleUserInfo.setUserNo(userNo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder sex(String sex) {
|
||||||
|
scheduleUserInfo.setSex(sex);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder passengerType(String passengerType) {
|
||||||
|
scheduleUserInfo.setPassengerType(passengerType);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder overproofInfo(String overproofInfo) {
|
||||||
|
scheduleUserInfo.setOverproofInfo(overproofInfo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder isReserve(String isReserve) {
|
||||||
|
scheduleUserInfo.setIsReserve(isReserve);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder reserveCount(int reserveCount) {
|
||||||
|
scheduleUserInfo.setReserveCount(reserveCount);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder deptCode(String deptCode) {
|
||||||
|
scheduleUserInfo.setDeptCode(deptCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder rankCode(String rankCode) {
|
||||||
|
scheduleUserInfo.setRankCode(rankCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder documentList(List<ScheduleDocument> documentList) {
|
||||||
|
scheduleUserInfo.setDocumentList(documentList);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfoBuilder addDocument(ScheduleDocument.ScheduleDocumentBuilder documentBuilder) {
|
||||||
|
if (scheduleUserInfo.getDocumentList() == null) {
|
||||||
|
scheduleUserInfo.setDocumentList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
scheduleUserInfo.getDocumentList().add(documentBuilder.build());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScheduleUserInfo build() {
|
||||||
|
return scheduleUserInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TrainScheduleDetail extends ScheduleDetail {
|
||||||
|
private String startStationCode;
|
||||||
|
private String endStationCode;
|
||||||
|
private String startStationName;
|
||||||
|
private String endStationName;
|
||||||
|
private String startStationEnName;
|
||||||
|
private String endStationEnName;
|
||||||
|
|
||||||
|
public static TrainScheduleDetailBuilder builder(){
|
||||||
|
return new TrainScheduleDetailBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Constructor, getters and setters
|
||||||
|
public static class TrainScheduleDetailBuilder extends ScheduleDetailBuilder {
|
||||||
|
private TrainScheduleDetail trainScheduleDetail = new TrainScheduleDetail();
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder startStationCode(String startStationCode) {
|
||||||
|
trainScheduleDetail.setStartStationCode(startStationCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder endStationCode(String endStationCode) {
|
||||||
|
trainScheduleDetail.setEndStationCode(endStationCode);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder startStationName(String startStationName) {
|
||||||
|
trainScheduleDetail.setStartStationName(startStationName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder endStationName(String endStationName) {
|
||||||
|
trainScheduleDetail.setEndStationName(endStationName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder startStationEnName(String startStationEnName) {
|
||||||
|
trainScheduleDetail.setStartStationEnName(startStationEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TrainScheduleDetailBuilder endStationEnName(String endStationEnName) {
|
||||||
|
trainScheduleDetail.setEndStationEnName(endStationEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TrainScheduleDetail build() {
|
||||||
|
return trainScheduleDetail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,4 +8,7 @@ public class TripCallback {
|
||||||
private TripCallbackData data; // Main data containing trip details
|
private TripCallbackData data; // Main data containing trip details
|
||||||
|
|
||||||
// Getters and setters...
|
// Getters and setters...
|
||||||
|
public static TripCallbackBuilder builder() {
|
||||||
|
return new TripCallbackBuilder();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,208 @@
|
||||||
|
package com.chint.application.dtos.trip;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TripCallbackBuilder {
|
||||||
|
|
||||||
|
private TripCallback tripCallback = new TripCallback();
|
||||||
|
|
||||||
|
public TripCallbackBuilder method(String method) {
|
||||||
|
tripCallback.setMethod(method);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder data() {
|
||||||
|
return new TripCallbackDataBuilder(this, tripCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallback build() {
|
||||||
|
return tripCallback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TripCallbackDataBuilder {
|
||||||
|
private TripCallbackBuilder parentBuilder;
|
||||||
|
private TripCallbackData data = new TripCallbackData();
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder(TripCallbackBuilder parentBuilder, TripCallback tripCallback) {
|
||||||
|
this.parentBuilder = parentBuilder;
|
||||||
|
tripCallback.setData(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder changeCar(String changeCar) {
|
||||||
|
data.setChangeCar(changeCar);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加更多的TripCallbackData字段的链式设置方法
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder startDate(String startDate) {
|
||||||
|
data.setStartDate(startDate);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder endDate(String endDate) {
|
||||||
|
data.setEndDate(endDate);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder receiptsNum(String receiptsNum) {
|
||||||
|
data.setReceiptsNum(receiptsNum);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder businessTripReason(String businessTripReason) {
|
||||||
|
data.setBusinessTripReason(businessTripReason);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder receiptsStatus(String receiptsStatus) {
|
||||||
|
data.setReceiptsStatus(receiptsStatus);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder createUserId(String CreateUserId) {
|
||||||
|
data.setCreateUserId(CreateUserId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder createUserName(String createUserName) {
|
||||||
|
data.setCreateUserName(createUserName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder createUserMobile(String createUserMobile) {
|
||||||
|
data.setCreateUserMobile(createUserMobile);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder compName(String compName) {
|
||||||
|
data.setCompName(compName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder compId(String compId) {
|
||||||
|
data.setCompId(compId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder createTime(String createTime) {
|
||||||
|
data.setCreateTime(createTime);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder type(String type) {
|
||||||
|
data.setType(type);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder ScheduleDetail(List<ScheduleDetail> scheduleDetails) {
|
||||||
|
data.setScheduleDetailList(scheduleDetails);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TripCallbackCityBuilder cityList() {
|
||||||
|
return new TripCallbackCityBuilder(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackBuilder done() {
|
||||||
|
return parentBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserInfoBuilder userInfo() {
|
||||||
|
return new UserInfoBuilder(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class TripCallbackCityBuilder {
|
||||||
|
private TripCallbackDataBuilder parentBuilder;
|
||||||
|
private TripCallbackCity city = new TripCallbackCity();
|
||||||
|
private List<TripCallbackCity> cityList;
|
||||||
|
|
||||||
|
public TripCallbackCityBuilder(TripCallbackDataBuilder parentBuilder, TripCallbackData data) {
|
||||||
|
this.parentBuilder = parentBuilder;
|
||||||
|
if (data.getCityList() == null) {
|
||||||
|
cityList = new ArrayList<>();
|
||||||
|
data.setCityList(cityList);
|
||||||
|
} else {
|
||||||
|
cityList = data.getCityList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackCityBuilder geoId(String geoId) {
|
||||||
|
city.setGeoId(geoId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加更多的TripCallbackCity字段的链式设置方法
|
||||||
|
public TripCallbackCityBuilder cityEnName(String cityEnName) {
|
||||||
|
city.setCityEnName(cityEnName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackCityBuilder cityName(String cityName) {
|
||||||
|
city.setCityName(cityName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public TripCallbackCityBuilder addCity() {
|
||||||
|
cityList.add(city);
|
||||||
|
city = new TripCallbackCity(); // 为下一个City准备新的实例
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder done() {
|
||||||
|
// 最后添加的City也需要被添加到列表中
|
||||||
|
if (!cityList.contains(city)) {
|
||||||
|
cityList.add(city);
|
||||||
|
}
|
||||||
|
return parentBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为TripCallbackUserInfo、TripCallbackScheduleDetail和TripCallbackDocument也实现类似的Builder类
|
||||||
|
public static class UserInfoBuilder {
|
||||||
|
private final TripCallbackDataBuilder parentBuilder;
|
||||||
|
private final TripCallbackData data;
|
||||||
|
private final TripCallbackUserInfo userInfo = new TripCallbackUserInfo();
|
||||||
|
|
||||||
|
public UserInfoBuilder(TripCallbackDataBuilder parentBuilder, TripCallbackData data) {
|
||||||
|
this.parentBuilder = parentBuilder;
|
||||||
|
this.data = data;
|
||||||
|
if (data.getUserInfoList() == null) {
|
||||||
|
data.setUserInfoList(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public UserInfoBuilder userId(String userId) {
|
||||||
|
userInfo.setUserId(userId);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ...其他UserInfo字段的设置方法...
|
||||||
|
|
||||||
|
public UserInfoBuilder userName(String userName) {
|
||||||
|
userInfo.setUserName(userName);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UserInfoBuilder addUserInfo() {
|
||||||
|
data.getUserInfoList().add(userInfo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TripCallbackDataBuilder done() {
|
||||||
|
// 确保最后一个userInfo也被添加
|
||||||
|
if (!data.getUserInfoList().contains(userInfo)) {
|
||||||
|
data.getUserInfoList().add(userInfo);
|
||||||
|
}
|
||||||
|
return parentBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// DocumentList的建造者
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ public class TripCallbackData {
|
||||||
private String receiptsNum; // Receipts number
|
private String receiptsNum; // Receipts number
|
||||||
private String businessTripReason; // Reason for the business trip
|
private String businessTripReason; // Reason for the business trip
|
||||||
private String receiptsStatus; // Status of the receipts
|
private String receiptsStatus; // Status of the receipts
|
||||||
private String createUserId; // User ID of the creator
|
private String CreateUserId; // User ID of the creator
|
||||||
private String createUserName; // Name of the creator
|
private String createUserName; // Name of the creator
|
||||||
private String createUserMobile; // Mobile number of the creator
|
private String createUserMobile; // Mobile number of the creator
|
||||||
private String compName; // Company name
|
private String compName; // Company name
|
||||||
|
@ -23,5 +23,5 @@ public class TripCallbackData {
|
||||||
// Additional fields...
|
// Additional fields...
|
||||||
private List<TripCallbackCity> cityList; // List of cities involved in the trip
|
private List<TripCallbackCity> cityList; // List of cities involved in the trip
|
||||||
private List<TripCallbackUserInfo> userInfoList; // List of user information
|
private List<TripCallbackUserInfo> userInfoList; // List of user information
|
||||||
private List<TripCallbackScheduleDetail> scheduleDetailList; // List of schedule details
|
private List<ScheduleDetail> scheduleDetailList; // List of schedule details
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,5 @@ public class TripCallbackDocument {
|
||||||
private String issueDate; // Issue date of the document
|
private String issueDate; // Issue date of the document
|
||||||
private String expiryDate; // Expiry date of the document
|
private String expiryDate; // Expiry date of the document
|
||||||
private String issuingAuthority; // Authority that issued the document
|
private String issuingAuthority; // Authority that issued the document
|
||||||
|
|
||||||
// Getters and setters...
|
// Getters and setters...
|
||||||
}
|
}
|
|
@ -1,17 +0,0 @@
|
||||||
package com.chint.application.dtos.trip;
|
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class TripCallbackScheduleDetail {
|
|
||||||
private String scheduleType; // Type of schedule, e.g., flight, hotel
|
|
||||||
private String scheduleStartDate; // Start date of the schedule
|
|
||||||
private String scheduleEndDate; // End date of the schedule
|
|
||||||
private String city; // City associated with this schedule
|
|
||||||
private String country; // Country associated with this schedule
|
|
||||||
private String detail; // Detailed information about the schedule
|
|
||||||
private TripCallbackDocument document; // Document associated with the schedule
|
|
||||||
|
|
||||||
// Getters and setters...
|
|
||||||
}
|
|
|
@ -8,8 +8,5 @@ import java.util.List;
|
||||||
public class TripCallbackUserInfo {
|
public class TripCallbackUserInfo {
|
||||||
private String userId; // Unique identifier for the user
|
private String userId; // Unique identifier for the user
|
||||||
private String userName; // Name of the user
|
private String userName; // Name of the user
|
||||||
private String userMobile; // Mobile number of the user
|
|
||||||
private List<TripCallbackDocument> documents; // List of documents associated with the user
|
|
||||||
|
|
||||||
// Getters and setters...
|
// Getters and setters...
|
||||||
}
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package com.chint.application.in;
|
package com.chint.application.in;
|
||||||
|
|
||||||
|
import com.chint.application.dtos.AddLegData;
|
||||||
|
import com.chint.application.dtos.DeleteLegData;
|
||||||
import com.chint.application.queryies.OrderQuery;
|
import com.chint.application.queryies.OrderQuery;
|
||||||
import com.chint.application.services.OrderApplicationService;
|
import com.chint.application.services.OrderApplicationService;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
|
@ -60,10 +62,36 @@ public class OrderController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@ApiOperation("审批拒绝行程规划单")
|
@ApiOperation("添加行程节点")
|
||||||
@PostMapping("/reject")
|
@PostMapping("/leg/add")
|
||||||
public Result<String> rejectOrder(@RequestBody RejectLegData rejectLegData) {
|
public Result<String> addLeg(@RequestBody AddLegData addLegData) {
|
||||||
orderApplicationService.reject(rejectLegData);
|
orderApplicationService.addLegToOrder(addLegData);
|
||||||
return Result.Success(SUCCESS);
|
return Result.Success(SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@ApiOperation("删除行程节点")
|
||||||
|
@PostMapping("/leg/delete")
|
||||||
|
public Result<String> deleteLeg(@RequestBody DeleteLegData deleteLegData) {
|
||||||
|
orderApplicationService.deleteLegToOrder(deleteLegData);
|
||||||
|
return Result.Success(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@ApiOperation("审批拒绝行程规划单")
|
||||||
|
@PostMapping("/reject")
|
||||||
|
public Result<String> rejectOrder(@RequestBody ApprovalLegData approvalLegData) {
|
||||||
|
orderApplicationService.reject(approvalLegData);
|
||||||
|
return Result.Success(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@ApiOperation("审批通过行程规划单")
|
||||||
|
@PostMapping("/success")
|
||||||
|
public Result<String> approvalOrder(@RequestBody ApprovalLegData approvalLegData) {
|
||||||
|
orderApplicationService.reject(approvalLegData);
|
||||||
|
return Result.Success(SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.chint.domain.repository.LocationRepository;
|
||||||
import com.chint.domain.service.LocationDomainService;
|
import com.chint.domain.service.LocationDomainService;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.infrastructure.util.Result;
|
import com.chint.infrastructure.util.Result;
|
||||||
|
import com.chint.infrastructure.util.StringCheck;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -33,9 +34,17 @@ public class LocationController {
|
||||||
return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam));
|
return Result.Success(SUCCESS, locationRepository.pageQuery(locationParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据首字母查询地理信息")
|
@ApiOperation("根据查询词查询地理信息")
|
||||||
@PostMapping("/query/firstLetter")
|
@PostMapping("/query/word")
|
||||||
public Result<List<Location>> queryByFirstLetter(@RequestBody LocationParam locationParam) {
|
public Result<List<Location>> queryByFirstLetter(@RequestBody LocationParam locationParam) {
|
||||||
return Result.Success(SUCCESS, locationDomainService.queryByFirstLetter(locationParam));
|
String queryWord = locationParam.getQueryWord();
|
||||||
|
List<Location> locations = null;
|
||||||
|
if (StringCheck.isFirstCharacterAlphabetic(queryWord)) {
|
||||||
|
locations = locationDomainService.queryByFirstLetter(locationParam);
|
||||||
|
}
|
||||||
|
if(StringCheck.isFirstCharacterChinese(queryWord)){
|
||||||
|
locations = locationDomainService.queryByCityName(locationParam);
|
||||||
|
}
|
||||||
|
return Result.Success(SUCCESS, locations);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.application.out;
|
package com.chint.application.out;
|
||||||
|
|
||||||
|
|
||||||
|
import com.chint.application.dtos.trip.TripCallback;
|
||||||
import com.chint.application.queryies.OrderQuery;
|
import com.chint.application.queryies.OrderQuery;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.value_object.FlightPriceData;
|
import com.chint.domain.value_object.FlightPriceData;
|
||||||
|
@ -58,4 +59,10 @@ public class OrderOutController {
|
||||||
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
|
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据Id查询行程规划单-元年数据")
|
||||||
|
@PostMapping("/query/tripCallback")
|
||||||
|
public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) {
|
||||||
|
return Result.Success(SUCCESS, orderQuery.queryTripCallbackData(queryData));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,31 @@
|
||||||
package com.chint.application.queryies;
|
package com.chint.application.queryies;
|
||||||
|
|
||||||
|
import com.chint.application.dtos.trip.*;
|
||||||
import com.chint.application.queryies.estimate.EstimatePrice;
|
import com.chint.application.queryies.estimate.EstimatePrice;
|
||||||
|
import com.chint.domain.aggregates.location.CityEntity;
|
||||||
|
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.RouteOrder;
|
||||||
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
import com.chint.domain.repository.CityRepository;
|
||||||
import com.chint.domain.repository.RouteRepository;
|
import com.chint.domain.repository.RouteRepository;
|
||||||
import com.chint.domain.service.OrderDomainService;
|
import com.chint.domain.service.OrderDomainService;
|
||||||
import com.chint.domain.value_object.FlightPriceData;
|
import com.chint.domain.value_object.FlightPriceData;
|
||||||
import com.chint.domain.value_object.OrderQueryData;
|
import com.chint.domain.value_object.OrderQueryData;
|
||||||
import com.chint.domain.value_object.PriceQueryData;
|
import com.chint.domain.value_object.PriceQueryData;
|
||||||
import com.chint.domain.value_object.TrainPriceData;
|
import com.chint.domain.value_object.TrainPriceData;
|
||||||
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OrderQuery {
|
public class OrderQuery {
|
||||||
|
|
||||||
|
@ -21,6 +35,9 @@ public class OrderQuery {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrderDomainService orderDomainService;
|
private OrderDomainService orderDomainService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CityRepository cityRepository;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EstimatePrice estimatePrice;
|
private EstimatePrice estimatePrice;
|
||||||
|
|
||||||
|
@ -53,4 +70,117 @@ public class OrderQuery {
|
||||||
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
||||||
return estimatePrice.queryFlightPrice(priceQueryData);
|
return estimatePrice.queryFlightPrice(priceQueryData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TripCallback queryTripCallbackData(OrderQueryData queryData) {
|
||||||
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
DateTimeFormatter simpleFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
RouteOrder routeOrder = routeRepository.queryById(queryData.getRouteId()).reloadStatus();
|
||||||
|
|
||||||
|
List<Location> locationList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<Leg> legItems = routeOrder.getLegItems();
|
||||||
|
|
||||||
|
legItems.forEach(leg -> {
|
||||||
|
if (!locationList.contains(leg.getOriginLocation())) {
|
||||||
|
locationList.add(leg.getOriginLocation());
|
||||||
|
}
|
||||||
|
if (!locationList.contains(leg.getDestinationLocation())) {
|
||||||
|
locationList.add(leg.getDestinationLocation());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TripCallbackBuilder.TripCallbackDataBuilder callbackDataBuilder = TripCallback.builder()
|
||||||
|
.method(TRIP_CALLBACK_METHOD_NAME)
|
||||||
|
.data()
|
||||||
|
.startDate(routeOrder.getStartTime())
|
||||||
|
.endDate(routeOrder.getEndTime())
|
||||||
|
.receiptsNum(routeOrder.getApproveOrderNo().getFakeOrderNo())
|
||||||
|
.receiptsStatus(TRIP_CALLBACK_RECEIPT_STATUS)
|
||||||
|
.createUserId(String.valueOf(currentUser.getEmployeeNo()))
|
||||||
|
.createUserName(currentUser.getName())
|
||||||
|
.createUserMobile(currentUser.getPhoneNumber())
|
||||||
|
.createTime(formatter.format(routeOrder.getCreateTime()))
|
||||||
|
.type(TRIP_CALLBACK_TYPE_APPROVE);
|
||||||
|
|
||||||
|
List<CityEntity> cityEntities = new ArrayList<>();
|
||||||
|
for (Location location : locationList) {
|
||||||
|
CityEntity city = cityRepository.findByCityName(location.getLocationName());
|
||||||
|
cityEntities.add(city);
|
||||||
|
callbackDataBuilder.cityList()
|
||||||
|
.cityName(city.getCityName())
|
||||||
|
.cityEnName(city.getCityename())
|
||||||
|
.done();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ScheduleDetail> scheduleDetails = legItems.stream()
|
||||||
|
.map(leg -> {
|
||||||
|
leg.reloadStatus();
|
||||||
|
CityEntity originCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||||
|
.getCityName()
|
||||||
|
.equals(leg.getOriginLocation().getLocationName()))
|
||||||
|
.findFirst().get();
|
||||||
|
CityEntity destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||||
|
.getCityName()
|
||||||
|
.equals(leg.getDestinationLocation().getLocationName()))
|
||||||
|
.findFirst().get();
|
||||||
|
|
||||||
|
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder();
|
||||||
|
if (leg.getCurrencyType() != null) {
|
||||||
|
scheduleDetailBuilder
|
||||||
|
.currencyName(leg.getCurrencyType().getDescription())
|
||||||
|
.currency(leg.getCurrencyType().getCode())
|
||||||
|
.currencyNameUS(leg.getCurrencyType().getAbbreviation());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return scheduleDetailBuilder
|
||||||
|
.scheduleType(translateLegType(leg.getLegType()))
|
||||||
|
.scheduleNum(leg.getLegNo())
|
||||||
|
.startDate(simpleFormatter.format(leg.getStartTime()))
|
||||||
|
.endDate(simpleFormatter.format(leg.getEndTime()))
|
||||||
|
.startCityName(originCity.getCityName())
|
||||||
|
.startCityEnName(originCity.getCityename())
|
||||||
|
.endCity(destinationCity.getCityName())
|
||||||
|
.endCityEnName(destinationCity.getCityename())
|
||||||
|
.systemStatus(TRIP_CALLBACK_RECEIPT_STATUS)
|
||||||
|
.parentScheduleNum(leg.getLegNo())
|
||||||
|
.amount(leg.getAmount())
|
||||||
|
.reserveCount("1")
|
||||||
|
.quoteGroupNum("0")
|
||||||
|
.extStatus(0)
|
||||||
|
.isHistoryRecord(0)
|
||||||
|
.createTime(formatter.format(leg.getCreateTime()))
|
||||||
|
.realScheduleNum(leg.getLegNo())
|
||||||
|
.userInfoList(List.of(
|
||||||
|
ScheduleUserInfo.builder()
|
||||||
|
.userId(String.valueOf(currentUser.getEmployeeNo()))
|
||||||
|
.userName(currentUser.getName())
|
||||||
|
.userMobile(currentUser.getPhoneNumber())
|
||||||
|
.userNo(String.valueOf(currentUser.getEmployeeNo()))
|
||||||
|
.sex(currentUser.getGender())
|
||||||
|
.passengerType("1")
|
||||||
|
.isReserve("0")
|
||||||
|
.addDocument(ScheduleDocument.builder()
|
||||||
|
.linkPhone(currentUser.getPhoneNumber())
|
||||||
|
.chineseName(currentUser.getName())
|
||||||
|
.userName(currentUser.getName()))
|
||||||
|
.build()
|
||||||
|
))
|
||||||
|
.build();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
return callbackDataBuilder.ScheduleDetail(scheduleDetails).done().build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String translateLegType(Integer legType) {
|
||||||
|
return switch (legType) {
|
||||||
|
case LEG_TYPE_TRAIN -> TRIP_CALLBACK_TRAIN_TYPE;
|
||||||
|
case LEG_TYPE_AIRPLANE -> TRIP_CALLBACK_FLIGHT_TYPE;
|
||||||
|
case LEG_TYPE_HOTEL -> TRIP_CALLBACK_HOTEL_TYPE;
|
||||||
|
case LEG_TYPE_TAXI -> TRIP_CALLBACK_OTHER_TYPE;
|
||||||
|
case LEG_TYPE_OTHER -> TRIP_CALLBACK_OTHER_TYPE;
|
||||||
|
default -> TRIP_CALLBACK_OTHER_TYPE;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.chint.application.services;
|
package com.chint.application.services;
|
||||||
|
|
||||||
import com.chint.application.commands.*;
|
import com.chint.application.commands.*;
|
||||||
|
import com.chint.application.dtos.AddLegData;
|
||||||
|
import com.chint.application.dtos.DeleteLegData;
|
||||||
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.exceptions.NotFoundException;
|
import com.chint.domain.exceptions.NotFoundException;
|
||||||
import com.chint.domain.exceptions.OrderException;
|
import com.chint.domain.exceptions.OrderException;
|
||||||
|
@ -52,6 +55,26 @@ public class OrderApplicationService {
|
||||||
return routeOrder;
|
return routeOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public RouteOrder addLegToOrder(AddLegData addLegData) {
|
||||||
|
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
||||||
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||||
|
Leg leg = legFactory.createLeg(addLegData.getLegData());
|
||||||
|
order.reloadStatus();
|
||||||
|
order.addLeg(leg);
|
||||||
|
RouteOrder routeOrder = orderDomainService.saveOrder(order);
|
||||||
|
Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue();
|
||||||
|
return routeOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public RouteOrder deleteLegToOrder(DeleteLegData deleteLegData) {
|
||||||
|
RouteOrder order = Optional.ofNullable(routeRepository.queryById(deleteLegData.getRouteId()))
|
||||||
|
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||||
|
order.deleteLeg(deleteLegData.getLegNo());
|
||||||
|
return orderDomainService.saveOrder(order);
|
||||||
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void approve(ApproveLegData approveLegData) {
|
public void approve(ApproveLegData approveLegData) {
|
||||||
Command.of(LegApprovalCommand.class).data(approveLegData).sendToQueue();
|
Command.of(LegApprovalCommand.class).data(approveLegData).sendToQueue();
|
||||||
|
@ -86,7 +109,12 @@ public class OrderApplicationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public void reject(RejectLegData data) {
|
public void reject(ApprovalLegData data) {
|
||||||
Command.of(LegRejectCommand.class).data(data).sendToQueue();
|
Command.of(LegRejectCommand.class).data(data).sendToQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void approval(ApprovalLegData data) {
|
||||||
|
Command.of(OrderApprovalCommand.class).actualNo(data.getActualOrderNo()).sendToQueue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
import org.springframework.data.relational.core.mapping.Column;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ApprovalEvent {
|
||||||
|
@Id
|
||||||
|
private Long approveEventId;
|
||||||
|
@Column("route_id")
|
||||||
|
private Long routeId;
|
||||||
|
|
||||||
|
private Integer eventType;
|
||||||
|
@Transient
|
||||||
|
private String eventName;
|
||||||
|
|
||||||
|
private LocalDateTime happenTime;
|
||||||
|
|
||||||
|
public String translateApprovalEvent(int event) {
|
||||||
|
return switch (event) {
|
||||||
|
case APPROVAL_EVENT_PREPARE -> APPROVAL_EVENT_PREPARE_NAME;
|
||||||
|
case APPROVAL_EVENT_SUCCESS -> APPROVAL_EVENT_SUCCESS_NAME;
|
||||||
|
case APPROVAL_EVENT_FAIL -> APPROVAL_EVENT_FAIL_NAME;
|
||||||
|
default -> "未知事件";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApprovalEvent reloadStatus() {
|
||||||
|
this.setEventName(translateApprovalEvent(this.eventType));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ package com.chint.domain.aggregates.order;
|
||||||
import com.chint.domain.exceptions.LegEventException;
|
import com.chint.domain.exceptions.LegEventException;
|
||||||
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
||||||
import com.chint.domain.value_object.LegData;
|
import com.chint.domain.value_object.LegData;
|
||||||
|
import com.chint.domain.value_object.enums.CurrencyType;
|
||||||
import com.chint.infrastructure.util.BigDecimalCalculator;
|
import com.chint.infrastructure.util.BigDecimalCalculator;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -14,6 +15,7 @@ import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.*;
|
import static com.chint.infrastructure.constant.Constant.*;
|
||||||
|
@ -27,6 +29,8 @@ public class Leg {
|
||||||
@Id
|
@Id
|
||||||
private Long legId;
|
private Long legId;
|
||||||
|
|
||||||
|
private String legNo;
|
||||||
|
|
||||||
private Integer legType;
|
private Integer legType;
|
||||||
|
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
@ -35,6 +39,8 @@ public class Leg {
|
||||||
|
|
||||||
private String estimateAmount;
|
private String estimateAmount;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Column("origin_id")
|
@Column("origin_id")
|
||||||
private Long originId;
|
private Long originId;
|
||||||
@Transient
|
@Transient
|
||||||
|
@ -54,6 +60,8 @@ public class Leg {
|
||||||
@Transient
|
@Transient
|
||||||
private String legStatusName;
|
private String legStatusName;
|
||||||
@Transient
|
@Transient
|
||||||
|
private CurrencyType currencyType;
|
||||||
|
@Transient
|
||||||
private List<OrderDetail> orderDetails; //这个属性不做持久化保存 ,根据下单事件进行获取
|
private List<OrderDetail> orderDetails; //这个属性不做持久化保存 ,根据下单事件进行获取
|
||||||
|
|
||||||
@MappedCollection(idColumn = "leg_id", keyColumn = "leg_key")
|
@MappedCollection(idColumn = "leg_id", keyColumn = "leg_key")
|
||||||
|
@ -101,6 +109,7 @@ public class Leg {
|
||||||
.reduce(BigDecimalCalculator::add)
|
.reduce(BigDecimalCalculator::add)
|
||||||
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
||||||
this.orderDetails = detail;
|
this.orderDetails = detail;
|
||||||
|
this.currencyType = detail.get(0).getCurrencyType();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,10 +125,11 @@ public class Leg {
|
||||||
public Leg reloadStatus(LegData legData) {
|
public Leg reloadStatus(LegData legData) {
|
||||||
this.reloadStatus();
|
this.reloadStatus();
|
||||||
if (Objects.equals(legData.getLegId(), this.getLegId()) && this.legStatus.equals(LEG_STATUS_PREPARE)) {
|
if (Objects.equals(legData.getLegId(), this.getLegId()) && this.legStatus.equals(LEG_STATUS_PREPARE)) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
this.setOriginId(legData.getOriginId());
|
this.setOriginId(legData.getOriginId());
|
||||||
this.setDestinationId(legData.getDestinationId());
|
this.setDestinationId(legData.getDestinationId());
|
||||||
this.setStartTime(legData.getStartTime());
|
this.setStartTime(LocalDateTime.parse(legData.getStartTime(), formatter));
|
||||||
this.setEndTime(legData.getEndTime());
|
this.setEndTime(LocalDateTime.parse(legData.getEndTime(), formatter));
|
||||||
this.setLegType(legData.getLegType());
|
this.setLegType(legData.getLegType());
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.chint.domain.aggregates.order;
|
package com.chint.domain.aggregates.order;
|
||||||
|
|
||||||
|
import com.chint.domain.value_object.enums.CurrencyType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.annotation.Transient;
|
import org.springframework.data.annotation.Transient;
|
||||||
|
@ -9,6 +10,7 @@ import org.springframework.data.relational.core.mapping.Table;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.Currency;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED;
|
import static com.chint.infrastructure.constant.Constant.LEG_EVENT_ORDERED;
|
||||||
|
@ -25,6 +27,7 @@ public class OrderDetail {
|
||||||
private Integer productType; // 商品类型
|
private Integer productType; // 商品类型
|
||||||
private Integer quantity; // 数量
|
private Integer quantity; // 数量
|
||||||
private String price; // 价格
|
private String price; // 价格
|
||||||
|
private CurrencyType currencyType; //货币类型
|
||||||
private Long destinationId;
|
private Long destinationId;
|
||||||
private Long originId;
|
private Long originId;
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
|
|
@ -16,8 +16,8 @@ import static com.chint.infrastructure.constant.Constant.LEG_EVENT_REJECT_NAME;
|
||||||
public class OrderEvent {
|
public class OrderEvent {
|
||||||
@Id
|
@Id
|
||||||
private Long orderEventId;
|
private Long orderEventId;
|
||||||
@Column("leg_id")
|
@Column("route_id")
|
||||||
private Long legId;
|
private Long routeId;
|
||||||
|
|
||||||
private Integer eventType;
|
private Integer eventType;
|
||||||
@Transient
|
@Transient
|
||||||
|
|
|
@ -17,6 +17,8 @@ import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||||
import org.springframework.data.relational.core.mapping.Table;
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -49,7 +51,13 @@ public class RouteOrder extends BaseEntity {
|
||||||
@Transient
|
@Transient
|
||||||
private Integer orderStatus;
|
private Integer orderStatus;
|
||||||
@Transient
|
@Transient
|
||||||
|
private String approvalStatus;
|
||||||
|
@Transient
|
||||||
private String orderStatusName;
|
private String orderStatusName;
|
||||||
|
@Transient
|
||||||
|
private String startTime;
|
||||||
|
@Transient
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
private String supplierName;
|
private String supplierName;
|
||||||
|
|
||||||
|
@ -59,6 +67,8 @@ public class RouteOrder extends BaseEntity {
|
||||||
@MappedCollection(idColumn = "route_id", keyColumn = "route_order_key")
|
@MappedCollection(idColumn = "route_id", keyColumn = "route_order_key")
|
||||||
private List<OrderDetail> orderDetails;
|
private List<OrderDetail> orderDetails;
|
||||||
|
|
||||||
|
@MappedCollection(idColumn = "route_id", keyColumn = "route_order_key")
|
||||||
|
private List<ApprovalEvent> approveEvents;
|
||||||
|
|
||||||
// public void addItemAtPosition(Leg newItem) {
|
// public void addItemAtPosition(Leg newItem) {
|
||||||
// Integer position = newItem.getSequence();
|
// Integer position = newItem.getSequence();
|
||||||
|
@ -94,11 +104,47 @@ public class RouteOrder extends BaseEntity {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RouteOrder addLeg(Leg leg) {
|
||||||
|
this.legItems.add(leg);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RouteOrder deleteLeg(String legNo) {
|
||||||
|
if (this.legItems == null || this.legItems.isEmpty()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
this.getLegItems()
|
||||||
|
.removeIf(leg -> legNo.equals(leg.getLegNo()));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public RouteOrder addOrderDetail(OrderDetail orderDetail) {
|
public RouteOrder addOrderDetail(OrderDetail orderDetail) {
|
||||||
|
if(this.orderDetails == null){
|
||||||
|
this.orderDetails = new ArrayList<>();
|
||||||
|
}
|
||||||
this.orderDetails.add(orderDetail);
|
this.orderDetails.add(orderDetail);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RouteOrder addApprovalEvent(ApprovalEvent approvalEvent) {
|
||||||
|
if(this.approveEvents == null){
|
||||||
|
this.approveEvents = new ArrayList<>();
|
||||||
|
}
|
||||||
|
this.approveEvents.add(approvalEvent);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RouteOrder reloadApprovalStatus(){
|
||||||
|
if (this.approveEvents != null && !this.approveEvents.isEmpty()) {
|
||||||
|
this.approveEvents.stream()
|
||||||
|
.max(Comparator.comparingLong(ApprovalEvent::getApproveEventId))
|
||||||
|
.ifPresent(event -> this.setApprovalStatus(event.reloadStatus().getEventName()));
|
||||||
|
} else {
|
||||||
|
this.setApprovalStatus(APPROVAL_EVENT_PREPARE_NAME);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public RouteOrder reloadStatus() {
|
public RouteOrder reloadStatus() {
|
||||||
this.getLegItems().forEach(Leg::reloadStatus);
|
this.getLegItems().forEach(Leg::reloadStatus);
|
||||||
this.estimateAmount = this.getLegItems()
|
this.estimateAmount = this.getLegItems()
|
||||||
|
@ -115,6 +161,7 @@ public class RouteOrder extends BaseEntity {
|
||||||
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
.orElse(KEEP_TWO_DECIMAL_ZERO);
|
||||||
this.updateStatus();
|
this.updateStatus();
|
||||||
this.orderStatusName = translateOrderStatus(this.orderStatus);
|
this.orderStatusName = translateOrderStatus(this.orderStatus);
|
||||||
|
reloadTime();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,4 +252,18 @@ public class RouteOrder extends BaseEntity {
|
||||||
default -> "未知状态";
|
default -> "未知状态";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RouteOrder reloadTime() {
|
||||||
|
if (this.getLegItems() != null && !this.getLegItems().isEmpty()) {
|
||||||
|
List<LocalDateTime> times = new ArrayList<>();
|
||||||
|
this.getLegItems().forEach(leg -> {
|
||||||
|
times.add(leg.getStartTime());
|
||||||
|
times.add(leg.getEndTime());
|
||||||
|
});
|
||||||
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
this.endTime = dateTimeFormatter.format(times.stream().max(LocalDateTime::compareTo).get());
|
||||||
|
this.startTime = dateTimeFormatter.format(times.stream().min(LocalDateTime::compareTo).get());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -7,4 +7,5 @@ import java.util.List;
|
||||||
|
|
||||||
public interface LegFactory {
|
public interface LegFactory {
|
||||||
List<Leg> createLegBatch(List<LegData> legData);
|
List<Leg> createLegBatch(List<LegData> legData);
|
||||||
|
Leg createLeg(LegData legData);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,12 @@ package com.chint.domain.factoriy.leg;
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.factoriy.location.LocationFactory;
|
import com.chint.domain.factoriy.location.LocationFactory;
|
||||||
import com.chint.domain.value_object.LegData;
|
import com.chint.domain.value_object.LegData;
|
||||||
|
import com.chint.infrastructure.util.OrderNo;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -19,17 +22,27 @@ public class RouteLegFactory implements LegFactory {
|
||||||
@Override
|
@Override
|
||||||
public List<Leg> createLegBatch(List<LegData> legData) {
|
public List<Leg> createLegBatch(List<LegData> legData) {
|
||||||
return legData.stream().sorted(Comparator.comparing(LegData::getStartTime))
|
return legData.stream().sorted(Comparator.comparing(LegData::getStartTime))
|
||||||
.map(data -> {
|
.map(RouteLegFactory::getLeg).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Leg createLeg(LegData data) {
|
||||||
|
return getLeg(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Leg getLeg(LegData data) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
Leg leg = new Leg();
|
Leg leg = new Leg();
|
||||||
|
leg.setLegNo(OrderNo.generateLegNo());
|
||||||
leg.setLegType(data.legType);
|
leg.setLegType(data.legType);
|
||||||
leg.setStartTime(data.getStartTime());
|
leg.setStartTime(LocalDateTime.parse(data.getStartTime(), formatter));
|
||||||
leg.setEndTime(data.getEndTime());
|
leg.setEndTime(LocalDateTime.parse(data.getEndTime(), formatter));
|
||||||
leg.setOriginId(data.getOriginId());
|
leg.setOriginId(data.getOriginId());
|
||||||
leg.setDestinationId(data.getDestinationId());
|
leg.setDestinationId(data.getDestinationId());
|
||||||
|
leg.setCreateTime(LocalDateTime.now());
|
||||||
if (data.getLegId() != null) {
|
if (data.getLegId() != null) {
|
||||||
leg.setLegId(data.getLegId());
|
leg.setLegId(data.getLegId());
|
||||||
}
|
}
|
||||||
return leg;
|
return leg;
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package com.chint.domain.factoriy.order;
|
package com.chint.domain.factoriy.order;
|
||||||
|
|
||||||
import com.chint.application.commands.OrderCreateCommand;
|
import com.chint.application.commands.OrderCreateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.value_object.OrderSaveData;
|
import com.chint.domain.value_object.OrderSaveData;
|
||||||
|
|
||||||
public interface OrderFactory {
|
public interface OrderFactory {
|
||||||
RouteOrder createOrder(OrderSaveData orderData);
|
RouteOrder createRoute(OrderSaveData orderData);
|
||||||
RouteOrder createOrder(OrderCreateCommand command);
|
RouteOrder createRoute(OrderCreateCommand command);
|
||||||
|
|
||||||
|
ApprovalEvent createApprovalEvent(Integer eventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.domain.factoriy.order;
|
package com.chint.domain.factoriy.order;
|
||||||
|
|
||||||
import com.chint.application.commands.OrderCreateCommand;
|
import com.chint.application.commands.OrderCreateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||||
import com.chint.domain.aggregates.order.ApproveOrderNo;
|
import com.chint.domain.aggregates.order.ApproveOrderNo;
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
|
@ -24,7 +25,7 @@ public class RouteOrderFactory implements OrderFactory {
|
||||||
private RouteLegFactory routeLegFactory;
|
private RouteLegFactory routeLegFactory;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder createOrder(OrderSaveData orderData) {
|
public RouteOrder createRoute(OrderSaveData orderData) {
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
List<LegData> legDataList = orderData.getLegDataList();
|
List<LegData> legDataList = orderData.getLegDataList();
|
||||||
List<Leg> leglist = routeLegFactory.createLegBatch(legDataList);
|
List<Leg> leglist = routeLegFactory.createLegBatch(legDataList);
|
||||||
|
@ -42,7 +43,7 @@ public class RouteOrderFactory implements OrderFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RouteOrder createOrder(OrderCreateCommand command) {
|
public RouteOrder createRoute(OrderCreateCommand command) {
|
||||||
UserLoginParam loginParam = command.getLoginParam();
|
UserLoginParam loginParam = command.getLoginParam();
|
||||||
RouteOrder routeOrder = new RouteOrder();
|
RouteOrder routeOrder = new RouteOrder();
|
||||||
routeOrder.setRouteOrderNo(OrderNo.generate());
|
routeOrder.setRouteOrderNo(OrderNo.generate());
|
||||||
|
@ -54,4 +55,12 @@ public class RouteOrderFactory implements OrderFactory {
|
||||||
routeOrder.setBookingTime(LocalDateTime.now());
|
routeOrder.setBookingTime(LocalDateTime.now());
|
||||||
return routeOrder;
|
return routeOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApprovalEvent createApprovalEvent(Integer eventType) {
|
||||||
|
ApprovalEvent approvalEvent = new ApprovalEvent();
|
||||||
|
approvalEvent.setEventType(eventType);
|
||||||
|
approvalEvent.setHappenTime(LocalDateTime.now());
|
||||||
|
return approvalEvent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,6 @@ public interface LocationRepository {
|
||||||
void saveAll(List<Location> locations);
|
void saveAll(List<Location> locations);
|
||||||
|
|
||||||
List<Location> findByFirstLetter(LocationParam locationParam);
|
List<Location> findByFirstLetter(LocationParam locationParam);
|
||||||
|
|
||||||
|
List<Location> findByName(LocationParam locationParam);
|
||||||
}
|
}
|
|
@ -19,18 +19,28 @@ public class LocationDomainService {
|
||||||
|
|
||||||
public List<Location> queryByFirstLetter(LocationParam locationParam) {
|
public List<Location> queryByFirstLetter(LocationParam locationParam) {
|
||||||
List<Location> byFirstPinYin = locationRepository.findByFirstLetter(locationParam);
|
List<Location> byFirstPinYin = locationRepository.findByFirstLetter(locationParam);
|
||||||
Integer cityType = locationParam.getCityType();
|
return getLocationsByType(locationParam, byFirstPinYin);
|
||||||
return switch (cityType) {
|
|
||||||
case CITY_TYPE_DOMESTIC -> byFirstPinYin
|
|
||||||
.stream()
|
|
||||||
.filter(location -> location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)).toList();
|
|
||||||
|
|
||||||
case CITY_TYPE_FOREIGN -> byFirstPinYin
|
|
||||||
.stream()
|
|
||||||
.filter(location -> !location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)).toList();
|
|
||||||
default -> throw new NotFoundException(NOT_FOUND);
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Location> queryByCityName(LocationParam locationParam) {
|
||||||
|
List<Location> queryByCityName = locationRepository.findByName(locationParam);
|
||||||
|
return getLocationsByType(locationParam, queryByCityName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Location> getLocationsByType(LocationParam locationParam, List<Location> queryByCityName) {
|
||||||
|
Integer cityType = locationParam.getCityType();
|
||||||
|
return switch (cityType) {
|
||||||
|
case CITY_TYPE_DOMESTIC -> queryByCityName
|
||||||
|
.stream()
|
||||||
|
.filter(location -> location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)
|
||||||
|
&& location.getLevel().equals(3)).toList();
|
||||||
|
|
||||||
|
case CITY_TYPE_FOREIGN -> queryByCityName
|
||||||
|
.stream()
|
||||||
|
.filter(location -> !location.getLocationPath().startsWith(CITY_TYPE_DOMESTIC_PATH)
|
||||||
|
&& location.getLevel().equals(3)).toList();
|
||||||
|
default -> throw new NotFoundException(NOT_FOUND);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.chint.domain.service;
|
package com.chint.domain.service;
|
||||||
|
|
||||||
|
import com.chint.application.commands.OrderApprovalCommand;
|
||||||
import com.chint.application.commands.OrderCreateCommand;
|
import com.chint.application.commands.OrderCreateCommand;
|
||||||
|
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||||
import com.chint.domain.aggregates.order.Leg;
|
import com.chint.domain.aggregates.order.Leg;
|
||||||
import com.chint.domain.aggregates.order.RouteOrder;
|
import com.chint.domain.aggregates.order.RouteOrder;
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
@ -17,6 +19,8 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import static com.chint.infrastructure.constant.Constant.APPROVAL_EVENT_PREPARE;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class OrderDomainService {
|
public class OrderDomainService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -49,9 +53,21 @@ public class OrderDomainService {
|
||||||
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(Long.valueOf(loginParam.getSfno()));
|
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(Long.valueOf(loginParam.getSfno()));
|
||||||
return Optional.ofNullable(routeRepository.findByFakeOrderNo(loginParam.getBillcode())).orElseGet(() -> {
|
return Optional.ofNullable(routeRepository.findByFakeOrderNo(loginParam.getBillcode())).orElseGet(() -> {
|
||||||
BaseContext.setCurrentUser(byUserEmployeeNo);
|
BaseContext.setCurrentUser(byUserEmployeeNo);
|
||||||
RouteOrder order = routeOrderFactory.createOrder(command);
|
RouteOrder order = routeOrderFactory.createRoute(command);
|
||||||
|
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(APPROVAL_EVENT_PREPARE);
|
||||||
|
order.addApprovalEvent(approvalEvent);
|
||||||
this.saveOrder(order);
|
this.saveOrder(order);
|
||||||
return order;
|
return order;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ListenTo(command = "OrderApprovalCommand", order = 0)
|
||||||
|
public void approvalOrder(OrderApprovalCommand command) {
|
||||||
|
Optional.ofNullable(routeRepository.findByActualOrderNo(command.getActualNo()))
|
||||||
|
.ifPresent(route -> {
|
||||||
|
ApprovalEvent approvalEvent = routeOrderFactory.createApprovalEvent(command.getType());
|
||||||
|
route.addApprovalEvent(approvalEvent);
|
||||||
|
this.saveOrder(route);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.chint.infrastructure.util.Json;
|
||||||
import com.chint.infrastructure.util.Token;
|
import com.chint.infrastructure.util.Token;
|
||||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -29,6 +30,9 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private Json json;
|
private Json json;
|
||||||
|
|
||||||
|
@Value("${chint.url}")
|
||||||
|
public String SYSTEM_HOME_URL;//国内
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public AuthenticateServiceImpl(UserRepository userRepository, UserHttpRequest httpRequest) {
|
public AuthenticateServiceImpl(UserRepository userRepository, UserHttpRequest httpRequest) {
|
||||||
this.userRepository = userRepository;
|
this.userRepository = userRepository;
|
||||||
|
@ -54,8 +58,8 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
||||||
claims.put(USER_LOGIN_PARAM, json.gson().toJson(userLoginParam));
|
claims.put(USER_LOGIN_PARAM, json.gson().toJson(userLoginParam));
|
||||||
String jwt = JWTUtil.createJWT(claims);
|
String jwt = JWTUtil.createJWT(claims);
|
||||||
|
|
||||||
return UserLoginResult.buildWithUser(user).loadToken(Token.of(jwt)).redirectUrl(SYSTEM_HOME_URL +
|
return UserLoginResult.buildWithUser(user).loadToken(Token.of(jwt));
|
||||||
"?token=" + Digest.aes(jwt));
|
|
||||||
} else {
|
} else {
|
||||||
User newUser = userFactory.create(userLoginParam.getSfno());
|
User newUser = userFactory.create(userLoginParam.getSfno());
|
||||||
//如果数据库不存在该用户,需要通过sf信息进行查询并保存到数据库
|
//如果数据库不存在该用户,需要通过sf信息进行查询并保存到数据库
|
||||||
|
|
|
@ -167,6 +167,7 @@ public class LegEventHandler implements LegEventService {
|
||||||
RouteOrder routeOrder = routeRepository.findByActualOrderNo(command.getData().getActualOrderNo());
|
RouteOrder routeOrder = routeRepository.findByActualOrderNo(command.getData().getActualOrderNo());
|
||||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||||
routeOrder.getLegItems().forEach(leg -> leg.addEvent(legEvent));
|
routeOrder.getLegItems().forEach(leg -> leg.addEvent(legEvent));
|
||||||
|
//为每一个行程节点添加审批拒绝时间 ,为 routeOrder 也添加审批拒绝时间
|
||||||
routeRepository.save(routeOrder);
|
routeRepository.save(routeOrder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.chint.domain.value_object;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class RejectLegData {
|
public class ApprovalLegData {
|
||||||
// private Long routeId;
|
// private Long routeId;
|
||||||
// private String fakeOrderNo;
|
// private String fakeOrderNo;
|
||||||
private String actualOrderNo;
|
private String actualOrderNo;
|
|
@ -1,5 +1,6 @@
|
||||||
package com.chint.domain.value_object;
|
package com.chint.domain.value_object;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
@ -11,9 +12,10 @@ public class LegData {
|
||||||
|
|
||||||
public final Integer legType;
|
public final Integer legType;
|
||||||
|
|
||||||
public final LocalDateTime startTime;
|
|
||||||
|
|
||||||
public final LocalDateTime endTime;
|
public final String startTime;
|
||||||
|
|
||||||
|
public final String endTime;
|
||||||
|
|
||||||
public final Long originId;
|
public final Long originId;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import lombok.Data;
|
||||||
public class UserLoginResult {
|
public class UserLoginResult {
|
||||||
private User user;
|
private User user;
|
||||||
private Token token;
|
private Token token;
|
||||||
private String redirectUrl;
|
// private String redirectUrl;
|
||||||
|
|
||||||
public UserLoginResult(User user) {
|
public UserLoginResult(User user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
|
@ -40,8 +40,8 @@ public class UserLoginResult {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserLoginResult redirectUrl(String url) {
|
// public UserLoginResult redirectUrl(String url) {
|
||||||
this.redirectUrl = url;
|
// this.redirectUrl = url;
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
}
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.chint.domain.value_object.enums;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
||||||
|
public enum CurrencyType {
|
||||||
|
RENMINBI("CNY", "RMB", "人民币"),
|
||||||
|
US_DOLLAR("USD", "USD", "美元"),
|
||||||
|
EURO("EUR", "EUR", "欧元"),
|
||||||
|
JAPANESE_YEN("JPY", "JPY", "日元"),
|
||||||
|
BRITISH_POUND("GBP", "GBP", "英镑"),
|
||||||
|
AUSTRALIAN_DOLLAR("AUD", "AUD", "澳大利亚元"),
|
||||||
|
CANADIAN_DOLLAR("CAD", "CAD", "加拿大元"),
|
||||||
|
SWISS_FRANC("CHF", "CHF", "瑞士法郎"),
|
||||||
|
SWEDISH_KRONA("SEK", "SEK", "瑞典克朗"),
|
||||||
|
NEW_ZEALAND_DOLLAR("NZD", "NZD", "新西兰元");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String abbreviation;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CurrencyType(String code, String abbreviation, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.abbreviation = abbreviation;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAbbreviation() {
|
||||||
|
return abbreviation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CurrencyType getByCode(String code) {
|
||||||
|
for (CurrencyType currency : CurrencyType.values()) {
|
||||||
|
if (currency.getCode().equalsIgnoreCase(code)) {
|
||||||
|
return currency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
package com.chint.infrastructure.constant;
|
package com.chint.infrastructure.constant;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
public class Constant {
|
public class Constant {
|
||||||
// 通用消息
|
// 通用消息
|
||||||
// 通用消息
|
// 通用消息
|
||||||
|
@ -111,6 +113,15 @@ public class Constant {
|
||||||
public static final int ORDER_EVENT_CANCEL = -1;
|
public static final int ORDER_EVENT_CANCEL = -1;
|
||||||
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
public static final String ORDER_EVENT_CANCEL_NAME = "取消";
|
||||||
|
|
||||||
|
|
||||||
|
//审批事件
|
||||||
|
public static final int APPROVAL_EVENT_PREPARE = 0;
|
||||||
|
public static final String APPROVAL_EVENT_PREPARE_NAME = "未审批";
|
||||||
|
public static final int APPROVAL_EVENT_SUCCESS = 1;
|
||||||
|
public static final String APPROVAL_EVENT_SUCCESS_NAME = "已通过";
|
||||||
|
public static final int APPROVAL_EVENT_FAIL = -1;
|
||||||
|
public static final String APPROVAL_EVENT_FAIL_NAME = "已驳回";
|
||||||
|
|
||||||
// 金额
|
// 金额
|
||||||
public static final String KEEP_TWO_DECIMAL_ZERO = "0.00";
|
public static final String KEEP_TWO_DECIMAL_ZERO = "0.00";
|
||||||
|
|
||||||
|
@ -168,10 +179,9 @@ public class Constant {
|
||||||
public static final String C_TRIP_APPROVAL_PATH = "/switchapi/approval.svc/rest/setapproval";
|
public static final String C_TRIP_APPROVAL_PATH = "/switchapi/approval.svc/rest/setapproval";
|
||||||
public static final String C_TRIP_ESTIMATE_PATH = "/bookingrelatedservice/bookingrelatedopenapi";
|
public static final String C_TRIP_ESTIMATE_PATH = "/bookingrelatedservice/bookingrelatedopenapi";
|
||||||
public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken";
|
public static final String C_TRIP_TOKEN_PATH = "/dataservice/token/getAccessToken";
|
||||||
|
|
||||||
public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login";
|
public static final String C_TRIP_AUTH_LOGIN = "/corpservice/authorize/login";
|
||||||
|
|
||||||
public static final String C_TRIP_SINGLE_LOGIN = "/m/SingleSignOn/H5SignInfo";
|
public static final String C_TRIP_SINGLE_LOGIN = "/m/SingleSignOn/H5SignInfo";
|
||||||
|
public static final String C_TRIP_REQUEST_SECRET = "zhengtai2024_nEbmKfOo";
|
||||||
|
|
||||||
|
|
||||||
//同程
|
//同程
|
||||||
|
@ -215,7 +225,17 @@ public class Constant {
|
||||||
public static final String CITY_TYPE_DOMESTIC_PATH = "3106_1_";//国内
|
public static final String CITY_TYPE_DOMESTIC_PATH = "3106_1_";//国内
|
||||||
public static final int CITY_TYPE_FOREIGN = 1;//国外
|
public static final int CITY_TYPE_FOREIGN = 1;//国外
|
||||||
|
|
||||||
|
|
||||||
//system
|
//system
|
||||||
public static final String SYSTEM_HOME_URL = "www.baidu.com";//国内
|
|
||||||
public static final String AES_SECRET = "chint";//国内
|
public static final String AES_SECRET = "chint";//国内
|
||||||
|
|
||||||
|
//元年数据回传
|
||||||
|
public static final String TRIP_CALLBACK_METHOD_NAME = "trip.callback";//方法名称
|
||||||
|
public static final String TRIP_CALLBACK_RECEIPT_STATUS = "WAIT_COMMIT";//申请单状态
|
||||||
|
public static final String TRIP_CALLBACK_TYPE_APPROVE = "o";//申请单类型
|
||||||
|
public static final String TRIP_CALLBACK_FLIGHT_TYPE = "Flight";//申请单类型
|
||||||
|
public static final String TRIP_CALLBACK_HOTEL_TYPE = "Hotel";//申请单类型
|
||||||
|
public static final String TRIP_CALLBACK_TRAIN_TYPE = "Train";//申请单类型
|
||||||
|
public static final String TRIP_CALLBACK_OTHER_TYPE = "Other";//申请单类型
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,11 @@ public class LocationRepositoryImpl implements LocationRepository {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Location> findByFirstLetter(LocationParam locationParam) {
|
public List<Location> findByFirstLetter(LocationParam locationParam) {
|
||||||
return jdbcLocationRepository.findByFirstPinYin(locationParam.getFirstLetter());
|
return jdbcLocationRepository.findByFirstPinYin(locationParam.getQueryWord());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Location> findByName(LocationParam locationParam) {
|
||||||
|
return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RouteRepositoryImpl implements RouteRepository {
|
||||||
@Override
|
@Override
|
||||||
public PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData) {
|
public PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData) {
|
||||||
PageRequest sort = PageRequest
|
PageRequest sort = PageRequest
|
||||||
.of(orderQueryData.getPageNum(), orderQueryData.getPageSize(), Sort.by("sort"));
|
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||||
User currentUser = BaseContext.getCurrentUser();
|
User currentUser = BaseContext.getCurrentUser();
|
||||||
Page<RouteOrder> byUserId = jdbcRouteRepository.findByCreateUser(currentUser.getUserId().toString(), sort);
|
Page<RouteOrder> byUserId = jdbcRouteRepository.findByCreateUser(currentUser.getUserId().toString(), sort);
|
||||||
List<RouteOrder> orders = byUserId.toList();
|
List<RouteOrder> orders = byUserId.toList();
|
||||||
|
|
|
@ -19,5 +19,8 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
||||||
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
Page<Location> findAllByLevel(Long level, Pageable pageable);
|
||||||
|
|
||||||
List<Location> findByFirstPinYin(String firstPinYin);
|
List<Location> findByFirstPinYin(String firstPinYin);
|
||||||
|
List<Location> findByLocationNameContaining(String locationName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,18 @@ public class OrderNo {
|
||||||
// 生成随机序列部分
|
// 生成随机序列部分
|
||||||
int randomPart = new Random().nextInt(9000) + 1000; // 生成1000到9999之间的随机数
|
int randomPart = new Random().nextInt(9000) + 1000; // 生成1000到9999之间的随机数
|
||||||
// 拼接最终的订单号
|
// 拼接最终的订单号
|
||||||
return datePart + randomPart;
|
return "R" + datePart + randomPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String generateLegNo() {
|
||||||
|
// 获取当前时间
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
// 格式化日期和时间部分
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMddHHmmss");
|
||||||
|
String datePart = now.format(formatter);
|
||||||
|
// 生成随机序列部分
|
||||||
|
int randomPart = new Random().nextInt(9000) + 1000; // 生成1000到9999之间的随机数
|
||||||
|
// 拼接最终的订单号
|
||||||
|
return "L" + datePart + randomPart;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.chint.infrastructure.util;
|
||||||
|
|
||||||
|
public class StringCheck {
|
||||||
|
|
||||||
|
public static boolean isFirstCharacterChinese(String str) {
|
||||||
|
if (str == null || str.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char firstChar = str.charAt(0);
|
||||||
|
return Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|
||||||
|
|| Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|
||||||
|
|| Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|
||||||
|
|| Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|
||||||
|
|| Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|
||||||
|
|| Character.UnicodeBlock.of(firstChar) == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS;
|
||||||
|
}
|
||||||
|
public static boolean isFirstCharacterAlphabetic(String str) {
|
||||||
|
if (str == null || str.isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char firstChar = str.charAt(0);
|
||||||
|
return Character.isLetter(firstChar);
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Token implements Serializable {
|
public class Token implements Serializable {
|
||||||
|
|
||||||
private String token;
|
private String token;
|
||||||
|
|
||||||
private Token(String token) {
|
private Token(String token) {
|
||||||
|
|
|
@ -31,9 +31,9 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String str = Digest.aesBack(token);
|
// String str = Digest.aesBack(token);
|
||||||
JWTUtil.verifyJWT(SECRET, str);
|
JWTUtil.verifyJWT(SECRET, token);
|
||||||
var parseJWT = JWTUtil.parseJWT(SECRET, str);
|
var parseJWT = JWTUtil.parseJWT(SECRET, token);
|
||||||
var withJwt = User.withJwt(parseJWT);
|
var withJwt = User.withJwt(parseJWT);
|
||||||
BaseContext.setCurrentUser(withJwt);
|
BaseContext.setCurrentUser(withJwt);
|
||||||
return true; // If verification succeeds, continue processing the request
|
return true; // If verification succeeds, continue processing the request
|
||||||
|
|
|
@ -10,7 +10,10 @@ chint:
|
||||||
database: itinerary_booking
|
database: itinerary_booking
|
||||||
username: tripbook
|
username: tripbook
|
||||||
password: W@Xgf25d&lRk*L0X#
|
password: W@Xgf25d&lRk*L0X#
|
||||||
|
url: https://gxdev03.chint.com/businesstravel/
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
||||||
org.springframework.jdbc.core.StatementCreatorUtils: TRACE
|
org.springframework.jdbc.core.StatementCreatorUtils: TRACE
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,5 @@ chint:
|
||||||
database: itinerary_booking
|
database: itinerary_booking
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 123456
|
||||||
|
url: https://gxdev03.chint.com/businesstravel/
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ chint:
|
||||||
database: itinerary_booking
|
database: itinerary_booking
|
||||||
username: echo
|
username: echo
|
||||||
password: R3nd0mP@ssw0rd!
|
password: R3nd0mP@ssw0rd!
|
||||||
|
url: https://gxdev03.chint.com/businesstravel/
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level:
|
level:
|
||||||
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
org.springframework.jdbc.core.JdbcTemplate: DEBUG
|
||||||
|
|
|
@ -31,11 +31,11 @@ class RouteApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void loginSign() {
|
void loginSign() {
|
||||||
String sfno = "220322120";
|
String sfno = "230615020";
|
||||||
String syscode = "abc";
|
String syscode = "abc";
|
||||||
String billcode = "12345622";
|
String billcode = "KK12321412323";
|
||||||
String sec = "Superdandan";
|
String sec = "Superdandan";
|
||||||
String timespan = "12312312312312";
|
String timespan = "12312321412312";
|
||||||
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
|
String s = Digest.md5(sfno + syscode + billcode + sec + timespan);
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue