Compare commits
77 Commits
c6e1cff665
...
a0626e722b
Author | SHA1 | Date |
---|---|---|
lulz1 | a0626e722b | |
dengwc | 9109b125e6 | |
dengwc | 040917c413 | |
lulz1 | e963b3d964 | |
lulz1 | d9d18e1b27 | |
huangxh3 | ab41a4abb8 | |
huangxh3 | f7538a1e11 | |
huangxh3 | d141719eec | |
lulz1 | e8413344fb | |
lulz1 | 2719803aa8 | |
wanglf3 | e35d335719 | |
lulz1 | b7425c7b80 | |
lulz1 | 786abad905 | |
lulz1 | 12f272a395 | |
lulz1 | 7ab0339152 | |
huangxh3 | 86e3b21554 | |
huangxh3 | 8e0830d588 | |
dengwc | 79dc530024 | |
dengwc | c8290fd7d9 | |
lulz1 | 42174e9bce | |
lulz1 | 914a4cd959 | |
lulz1 | 99bd01fe7b | |
lulz1 | 8aeb194824 | |
lulz1 | 1de351fa10 | |
lulz1 | 7500ba4854 | |
huangxh3 | b54129e9e0 | |
dengwc | b8c94cf1b5 | |
dengwc | 45a12474e1 | |
dengwc | 48888e5e49 | |
wanglf3 | cdad882e06 | |
lulz1 | 69a42c9b5e | |
lulz1 | bae2199a7a | |
wanglf3 | 5f6a7103f7 | |
lulz1 | faf24581d9 | |
lulz1 | e4ba73bbf1 | |
lulz1 | ee0abe3fbf | |
wanglf3 | 71a44f4588 | |
wanglf3 | e16271e519 | |
wanglf3 | 6abb2643a9 | |
lulz1 | 627ff7317c | |
lulz1 | 5e119950e1 | |
lulz1 | 824bcc98cf | |
lulz1 | 3748fe0e6e | |
lulz1 | 7674527cbb | |
lulz1 | a0ef0eef99 | |
wanglf3 | cb98f347b5 | |
lulz1 | fc6a2821d5 | |
lulz1 | e563cffe37 | |
wanglf3 | aa86243ec0 | |
wanglf3 | f264f9c7a5 | |
wanglf3 | 6b33590553 | |
dengwc | 3dca884467 | |
dengwc | af6feb405a | |
lulz1 | 838f340ebf | |
lulz1 | 1b9fff32d8 | |
lulz1 | 92fe207374 | |
lulz1 | d1acab14e5 | |
huangxh3 | 0654ee094a | |
lulz1 | 626968a7f0 | |
lulz1 | 126953bd85 | |
lulz1 | a2e9018143 | |
lulz1 | 962c1c448f | |
lulz1 | c5725e64b3 | |
lulz1 | 2fefbbeab8 | |
lulz1 | b50161853c | |
dengwc | a5892a97fa | |
lulz1 | 1e1fc1a394 | |
lulz1 | 94062b19ff | |
lulz1 | 355c61e32a | |
lulz1 | 803efc7790 | |
lulz1 | 1aa9fb2c63 | |
lulz1 | 099238dc8b | |
lulz1 | 0858c77f87 | |
huangxh3 | 7d9fe0b0e8 | |
huangxh3 | dd1a84fdba | |
lulz1 | 8083483fa9 | |
lulz1 | 65593e353f |
20
pom.xml
20
pom.xml
|
@ -50,6 +50,12 @@
|
|||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.78</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.chint.dc</groupId>
|
||||
<artifactId>common-api-sdk</artifactId>
|
||||
|
@ -75,6 +81,13 @@
|
|||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.authine.cloudpivot</groupId>
|
||||
<artifactId>cloudpivot-opensdk</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -93,4 +106,11 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<name>新正泰集团公共仓库</name>
|
||||
<url>https://newmaven.chint.com/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.application.commands;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -7,7 +8,7 @@ import lombok.Data;
|
|||
public class BPMAuditCommand extends Command {
|
||||
private String orderNo;
|
||||
private Integer productType;
|
||||
private Object extensionData;
|
||||
private OrderDetail extensionData;
|
||||
|
||||
public BPMAuditCommand orderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
|
@ -19,7 +20,7 @@ public class BPMAuditCommand extends Command {
|
|||
return this;
|
||||
}
|
||||
|
||||
public BPMAuditCommand extensionData(Object extensionData) {
|
||||
public BPMAuditCommand extensionData(OrderDetail extensionData) {
|
||||
this.extensionData = extensionData;
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.chint.application.commands;
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BPMLegChangeCommand extends Command {
|
||||
private Leg leg;
|
||||
|
||||
public BPMLegChangeCommand orderNo(Leg leg) {
|
||||
this.leg = leg;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package com.chint.application.commands;
|
||||
|
||||
import com.chint.domain.value_object.ApproveLegData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -8,17 +7,11 @@ import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL;
|
|||
|
||||
@Data
|
||||
public class LegApprovalCommand extends Command {
|
||||
private Integer LegEventType = LEG_EVENT_APPROVAL;
|
||||
private Long LegId;
|
||||
private ApproveLegData data;
|
||||
private Integer legEventType = LEG_EVENT_APPROVAL;
|
||||
private Long legId;
|
||||
|
||||
public LegApprovalCommand legId(Long LegId) {
|
||||
this.setLegId(LegId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public LegApprovalCommand data(ApproveLegData data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.chint.application.commands;
|
||||
|
||||
import com.chint.domain.value_object.ApproveLegData;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import lombok.Data;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_EVENT_APPROVAL;
|
||||
|
||||
@Data
|
||||
public class RouteApprovalCommand extends Command {
|
||||
private Integer LegEventType = LEG_EVENT_APPROVAL;
|
||||
private Long LegId;
|
||||
private ApproveLegData data;
|
||||
|
||||
public RouteApprovalCommand legId(Long LegId) {
|
||||
this.setLegId(LegId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RouteApprovalCommand data(ApproveLegData data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
|
||||
import com.chint.domain.value_object.BaseQuery;
|
||||
import com.chint.domain.value_object.LegData;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthenticationDto extends BaseQuery {
|
||||
private String clientid ;
|
||||
private String secretkey;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
|
||||
import com.chint.domain.value_object.BaseQuery;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthenticationSignDto extends BaseQuery {
|
||||
|
||||
private Integer productType; //机票1 、酒店2、火车3、打车4
|
||||
private String systemType;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
private String sign;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HotCityResponseDto {
|
||||
|
||||
private List<LocationRes> internationalCitys; //热门国际城市
|
||||
|
||||
private List<LocationRes> internalCitys; //热门国内城市
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginResponse {
|
||||
private String redirectUrl;
|
||||
private boolean success;
|
||||
|
||||
public static LoginResponse success(String redirectUrl){
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
loginResponse.setSuccess(true);
|
||||
loginResponse.setRedirectUrl(redirectUrl);
|
||||
return loginResponse;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
import com.chint.domain.value_object.BaseQuery;
|
||||
|
||||
public class OrderDetailQueryParam extends BaseQuery {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
|
||||
import com.chint.infrastructure.util.Token;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OrderSearchResult {
|
||||
private Token token;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.chint.application.dtos;
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDTO {
|
||||
|
||||
private UserData attributes;
|
||||
private String id;
|
||||
// 构造函数和其他方法(getter 和 setter)可以根据需要添加
|
||||
|
||||
// Getter 和 Setter 方法
|
||||
|
||||
@Data
|
||||
public static class UserData{
|
||||
private String user_name;
|
||||
private String mobile;
|
||||
private String account_no;
|
||||
private long token_gtime;
|
||||
private String token_expired;
|
||||
private String email;
|
||||
private String user_uid;
|
||||
}
|
||||
}
|
|
@ -4,12 +4,15 @@ package com.chint.application.dtos.response;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.LegExtensionField;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.value_object.enums.CurrencyType;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
@ -28,15 +31,27 @@ public class LegRes {
|
|||
private String amount;
|
||||
private String legTypeName;
|
||||
private String legTypeEnName;
|
||||
@ApiModelProperty("其他费用类型")
|
||||
private Integer amountType;
|
||||
@ApiModelProperty("其他费用类型名称")
|
||||
private String amountTypeName;
|
||||
@ApiModelProperty("其他费用类型英文名称")
|
||||
private String amountTypeEnName;
|
||||
@ApiModelProperty("费用说明")
|
||||
private String expenseExplanation;
|
||||
@ApiModelProperty("初始地详细")
|
||||
private String originDescription;
|
||||
@ApiModelProperty("目的地详细")
|
||||
private String destinationDescription;
|
||||
private Integer legStatus;
|
||||
|
||||
|
||||
private String legStatusName;
|
||||
|
||||
private CurrencyType currencyType;
|
||||
|
||||
private List<LocationRes> otherLocationList;
|
||||
|
||||
private List<OrderDetail> orderDetails; //这个属性不做持久化保存 ,根据下单事件进行获取
|
||||
|
||||
public static LegRes copyFrom(Leg leg) {
|
||||
|
@ -50,7 +65,20 @@ public class LegRes {
|
|||
legRes.setAmountType(legExtensionField.getAmountType());
|
||||
legRes.setAmountTypeName(legExtensionField.getAmountTypeName());
|
||||
legRes.setAmountTypeEnName(legExtensionField.getAmountTypeEnName());
|
||||
legRes.setExpenseExplanation(legExtensionField.getExpenseExplanation());
|
||||
legRes.setOriginDescription(legExtensionField.getOriginDescription());
|
||||
legRes.setDestinationDescription(legExtensionField.getDestinationDescription());
|
||||
if (legExtensionField.getLocationIds() != null) {
|
||||
List<LocationRes> locationResList = new ArrayList<>();
|
||||
List<Location> locationList = legExtensionField.getLocationList();
|
||||
for (Location location : locationList) {
|
||||
locationResList.add(LocationRes.copyFrom(location));
|
||||
}
|
||||
legRes.setOtherLocationList(locationResList);
|
||||
}
|
||||
}
|
||||
legRes.setOriginLocation(LocationRes.copyFrom(leg.getOriginLocation()));
|
||||
legRes.setDestinationLocation(LocationRes.copyFrom(leg.getDestinationLocation()));
|
||||
return legRes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,22 @@ public class LocationRes {
|
|||
@Id
|
||||
private Long locationId;
|
||||
private String locationName;
|
||||
private String continent;
|
||||
private String country;
|
||||
private String province;
|
||||
|
||||
public static LocationRes copyFrom(Location location) {
|
||||
return BeanUtil.copyProperties(location, LocationRes.class);
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
LocationRes locationRes = BeanUtil.copyProperties(location, LocationRes.class);
|
||||
String[] parts = location.getLocationPathName().split("_");
|
||||
if (parts.length != 4) {
|
||||
throw new IllegalArgumentException("Invalid loclocationation string format");
|
||||
}
|
||||
locationRes.setContinent(parts[0]);
|
||||
locationRes.setCountry(parts[1]);
|
||||
locationRes.setProvince(parts[2]);
|
||||
return locationRes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ public class RouteOrderPageRes {
|
|||
private String amount;
|
||||
private String estimateAmount;
|
||||
private Integer orderStatus;
|
||||
private Integer approvalStatusCode;
|
||||
private String approvalStatus;
|
||||
private String orderStatusName;
|
||||
private String startTime;
|
||||
|
|
|
@ -6,7 +6,7 @@ import lombok.Data;
|
|||
@Data
|
||||
public class HotelScheduleDetail extends ScheduleDetail {
|
||||
private String lastUpdateTime;
|
||||
private Integer nightCount;
|
||||
private String nightCount;
|
||||
public static HotelScheduleDetailBuilder builder(){
|
||||
return new HotelScheduleDetailBuilder();
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class HotelScheduleDetail extends ScheduleDetail {
|
|||
return this;
|
||||
}
|
||||
|
||||
public HotelScheduleDetailBuilder nightCount(Integer nightCount) {
|
||||
public HotelScheduleDetailBuilder nightCount(String nightCount) {
|
||||
hotelScheduleDetail.setNightCount(nightCount);
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,9 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
public class ScheduleDetail {
|
||||
|
||||
protected Long legId;
|
||||
|
||||
protected String serviceProvider;
|
||||
|
||||
protected String orderState;
|
||||
|
@ -114,6 +117,10 @@ public class ScheduleDetail {
|
|||
|
||||
@JsonProperty("RealScheduleNum")
|
||||
protected String RealScheduleNum;
|
||||
@JsonProperty("NightCount")
|
||||
protected String NightCount;
|
||||
@JsonProperty("RoomCount")
|
||||
protected String RoomCount;
|
||||
|
||||
|
||||
// Constructor, getters and setters
|
||||
|
@ -130,6 +137,21 @@ public class ScheduleDetail {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ScheduleDetailBuilder legId(Long legId) {
|
||||
scheduleDetail.setLegId(legId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScheduleDetailBuilder nightCount(String NightCount) {
|
||||
scheduleDetail.setNightCount(NightCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScheduleDetailBuilder roomCount(String RoomCount) {
|
||||
scheduleDetail.setRoomCount(RoomCount);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ScheduleDetailBuilder orderState(String orderState) {
|
||||
scheduleDetail.setOrderState(orderState);
|
||||
return this;
|
||||
|
|
|
@ -6,7 +6,9 @@ import com.chint.application.queryies.OrderQuery;
|
|||
import com.chint.application.services.OrderApplicationService;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.service.OrderDetailDomainService;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.domain.value_object.OrderSaveData;
|
||||
import com.chint.domain.value_object.SyncLegData;
|
||||
import com.chint.domain.value_object.UpdateLegData;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -41,7 +43,6 @@ public class OrderController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("同步行程规划单到供应商")
|
||||
@PostMapping("/sync")
|
||||
|
@ -50,6 +51,19 @@ public class OrderController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("批量同步行程规划单到供应商")
|
||||
@PostMapping("/sync/batch")
|
||||
public Result<String> syncOrderBatch(@RequestBody SyncLegData syncLegData) {
|
||||
syncLegData.getRouteIds().stream().map(routeId -> {
|
||||
SyncLegData syncLegDataItem = new SyncLegData();
|
||||
syncLegDataItem.setRouteId(routeId);
|
||||
syncLegDataItem.setSupplierName(syncLegData.getSupplierName());
|
||||
return syncLegDataItem;
|
||||
}).toList().forEach(data -> orderApplicationService.sync(data));
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("修改规划节点关联的订单")
|
||||
@PostMapping("/leg/update")
|
||||
|
@ -66,6 +80,15 @@ public class OrderController {
|
|||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("修改行程节点")
|
||||
@PostMapping("/leg/change/")
|
||||
public Result<String> changeLeg(@RequestBody AddLegData addLegData) {
|
||||
orderApplicationService.changeLeg(addLegData);
|
||||
return Result.Success(SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@ApiOperation("删除行程节点")
|
||||
@PostMapping("/leg/delete")
|
||||
|
|
|
@ -92,7 +92,7 @@ public class RankController {
|
|||
.setPrice(travelStandardsData.getPrice())
|
||||
.setCityTag(travelStandardsData.getCityTag());
|
||||
List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards);
|
||||
if (travelStandardsList.isEmpty()) {
|
||||
if (!travelStandardsList.isEmpty()) {
|
||||
return Result.error("该差标已经存在,不可重复添加!");
|
||||
}
|
||||
travelStandards = travelStandardsRepository.save(travelStandards);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.chint.application.out;
|
||||
|
||||
import com.chint.application.dtos.LoginResponse;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
import static com.chint.infrastructure.constant.FSSCConstant.FSSC_LOGIN_PATH_APPROVAL;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/fssc")
|
||||
public class FSSCController {
|
||||
|
||||
@Value("${FSSC.baseUrl}")
|
||||
private String FSSCUrl;
|
||||
|
||||
@ApiOperation("单点登录到财务共享")
|
||||
@PostMapping("/login")
|
||||
public Result<LoginResponse> loginToFSSC() {
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
String companyCode = currentUser.getCompanyCode();//公司编号
|
||||
return Result.Success(SUCCESS, LoginResponse.success(FSSCUrl + FSSC_LOGIN_PATH_APPROVAL + currentUser.getEmployeeNo()));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +1,28 @@
|
|||
package com.chint.application.out;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.application.dtos.HotCityResponseDto;
|
||||
import com.chint.application.dtos.LocationParam;
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.aggregates.standards.CityTag;
|
||||
import com.chint.domain.aggregates.standards.HotCityTag;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.service.LocationDomainService;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.infrastructure.util.StringCheck;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
|
@ -51,8 +58,43 @@ public class LocationController {
|
|||
if (locations != null && !locations.isEmpty()) {
|
||||
locationRes = locations
|
||||
.stream()
|
||||
.map(location -> BeanUtil.copyProperties(location, LocationRes.class)).toList();
|
||||
.map(LocationRes::copyFrom).toList();
|
||||
}
|
||||
return Result.Success(SUCCESS, locationRes);
|
||||
}
|
||||
|
||||
@ApiOperation("获取热门城市")
|
||||
@PostMapping("/getHotCities")
|
||||
public Result<HotCityResponseDto> getHotCities() {
|
||||
|
||||
List<String> city = HotCityTag.citys;
|
||||
|
||||
List<Location> locations = null;
|
||||
List<LocationRes> locationRes = null;
|
||||
|
||||
locations = locationRepository.findHotCitiesByCityName(city);
|
||||
if (locations != null && !locations.isEmpty()) {
|
||||
locationRes = locations
|
||||
.stream()
|
||||
.map(LocationRes::copyFrom).toList();
|
||||
}
|
||||
|
||||
|
||||
List<String> internationalCitys = HotCityTag.internationalCitys;
|
||||
List<LocationRes> internationalLocationRes = null;
|
||||
|
||||
List<Location> internationalLocations = locationRepository.findHotIntnationalCitiesByCityName(internationalCitys);
|
||||
if (internationalLocations != null && !internationalLocations.isEmpty()) {
|
||||
internationalLocationRes = internationalLocations
|
||||
.stream()
|
||||
.map(LocationRes::copyFrom).toList();
|
||||
}
|
||||
|
||||
HotCityResponseDto dto = new HotCityResponseDto();
|
||||
dto.setInternalCitys(locationRes);
|
||||
dto.setInternationalCitys(internationalLocationRes);
|
||||
|
||||
return Result.Success(SUCCESS, dto);
|
||||
|
||||
}
|
||||
}
|
|
@ -2,8 +2,11 @@ package com.chint.application.out;
|
|||
|
||||
|
||||
import com.chint.application.commands.OrderCreateCommand;
|
||||
import com.chint.application.services.login.strategy.PailaLoginStrategy;
|
||||
import com.chint.application.services.login.strategy.PailaMobileLoginStrategy;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.OrderException;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.SystemDomainService;
|
||||
import com.chint.domain.service.auth.AuthenticateService;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
|
@ -17,15 +20,17 @@ import com.chint.infrastructure.util.Result;
|
|||
import com.chint.interfaces.rest.ctrip.CTripUserSaveRequest;
|
||||
import com.chint.interfaces.rest.ly.LYUserRequest;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/public")
|
||||
public class LoginController {
|
||||
|
@ -45,6 +50,16 @@ public class LoginController {
|
|||
@Autowired
|
||||
private SystemDomainService systemDomainService;
|
||||
|
||||
@Autowired
|
||||
private PailaLoginStrategy pailaLoginStrategy;
|
||||
|
||||
@Autowired
|
||||
private PailaMobileLoginStrategy pailaMobileLoginStrategy;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@ApiOperation("财务共享登录")
|
||||
@Transactional
|
||||
@GetMapping("/login")
|
||||
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno,
|
||||
|
@ -75,17 +90,7 @@ public class LoginController {
|
|||
|
||||
//异步执行更新用户信息到同程
|
||||
User currentUser = userLoginResult.getUser();
|
||||
CompletableFuture.runAsync(() -> {
|
||||
BaseContext.setCurrentUser(currentUser);
|
||||
lyUserRequest.saveCurrentUser();
|
||||
BaseContext.removeCurrentUser();
|
||||
});
|
||||
//异步执行更新用户信息到携程
|
||||
CompletableFuture.runAsync(() -> {
|
||||
BaseContext.setCurrentUser(currentUser);
|
||||
cTripUserSaveRequest.saveUserToCTrip();
|
||||
BaseContext.removeCurrentUser();
|
||||
});
|
||||
syncUserInfoToSupplier(currentUser);
|
||||
|
||||
//清除职级信息
|
||||
userLoginResult.getUser().setProfLevel(null);
|
||||
|
@ -96,4 +101,84 @@ public class LoginController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation("商旅平台单点")
|
||||
@Transactional
|
||||
@PostMapping("/login/sso")
|
||||
public Result<UserLoginResult> loginSSO(@RequestBody UserLoginParam userLoginParam) {
|
||||
|
||||
String employeeNo = pailaLoginStrategy.login(userLoginParam.getCode());
|
||||
|
||||
userLoginParam.setSfno(employeeNo);
|
||||
UserLoginResult userLoginResult = authenticateService
|
||||
.authenticateEmployeeNo(userLoginParam);
|
||||
|
||||
//异步执行更新用户信息到同程
|
||||
User currentUser = userLoginResult.getUser();
|
||||
syncUserInfoToSupplier(currentUser);
|
||||
//清除职级信息
|
||||
userLoginResult.getUser().setProfLevel(null);
|
||||
userLoginResult.getUser().setManaLevel(null);
|
||||
return Result.Success(CommonMessageConstant.SUCCESS, userLoginResult);
|
||||
}
|
||||
|
||||
@ApiOperation("商旅平台移动端单点")
|
||||
@Transactional
|
||||
@PostMapping("/login/sso/mobile")
|
||||
public Result<UserLoginResult> loginSSOMobile(@RequestBody UserLoginParam userLoginParam) {
|
||||
|
||||
String employeeNo = pailaMobileLoginStrategy.login(userLoginParam.getCode());
|
||||
|
||||
userLoginParam.setSfno(employeeNo);
|
||||
UserLoginResult userLoginResult = authenticateService
|
||||
.authenticateEmployeeNo(userLoginParam);
|
||||
|
||||
//异步执行更新用户信息到同程
|
||||
User currentUser = userLoginResult.getUser();
|
||||
syncUserInfoToSupplier(currentUser);
|
||||
|
||||
//清除职级信息
|
||||
userLoginResult.getUser().setProfLevel(null);
|
||||
userLoginResult.getUser().setManaLevel(null);
|
||||
return Result.Success(CommonMessageConstant.SUCCESS, userLoginResult);
|
||||
}
|
||||
|
||||
private void syncUserInfoToSupplier(User user) {
|
||||
// 给定的 LocalDateTime 实例,示例中为2024年3月1日15:00
|
||||
LocalDateTime lastSyncTime = user.getSyncTime();
|
||||
|
||||
if (lastSyncTime == null) {
|
||||
asyncUser(user);
|
||||
return;
|
||||
}
|
||||
// 获取当前时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 计算当前时间与给定时间之间的持续时间
|
||||
Duration duration = Duration.between(lastSyncTime, now);
|
||||
|
||||
// 判断是否超过一天
|
||||
if (duration.toDays() >= 1) {
|
||||
asyncUser(user);
|
||||
} else {
|
||||
log.info("未超过一天,不执行同步。");
|
||||
}
|
||||
}
|
||||
|
||||
private void asyncUser(User user) {
|
||||
// 如果超过一天,执行同步代码
|
||||
CompletableFuture.runAsync(() -> {
|
||||
BaseContext.setCurrentUser(user);
|
||||
lyUserRequest.saveCurrentUser();
|
||||
BaseContext.removeCurrentUser();
|
||||
});
|
||||
//异步执行更新用户信息到携程
|
||||
CompletableFuture.runAsync(() -> {
|
||||
BaseContext.setCurrentUser(user);
|
||||
cTripUserSaveRequest.saveUserToCTrip();
|
||||
BaseContext.removeCurrentUser();
|
||||
});
|
||||
// 发送保存用户同步时间
|
||||
user.setSyncTime(LocalDateTime.now());
|
||||
userRepository.save(user);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package com.chint.application.out;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.application.dtos.*;
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.application.dtos.response.OrderDetailRes;
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.repository.ClientRepository;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.service.LocationDomainService;
|
||||
import com.chint.domain.service.auth.AuthenticateService;
|
||||
import com.chint.infrastructure.util.Digest;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.infrastructure.util.StringCheck;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/OrderDetail")
|
||||
public class OrderDetailController {
|
||||
|
||||
// @Autowired
|
||||
// private LocationRepository locationRepository;
|
||||
//
|
||||
// @Autowired
|
||||
// private LocationDomainService locationDomainService;
|
||||
|
||||
@Autowired
|
||||
private AuthenticateService authenticateService;
|
||||
|
||||
@Autowired
|
||||
private ClientRepository clientRepository;
|
||||
|
||||
@ApiOperation("订单明细认证接口")
|
||||
@PostMapping("/pubilc/authentication")
|
||||
public Result<OrderSearchResult> queryAuthentication(@RequestBody AuthenticationDto authenticationDto) {
|
||||
|
||||
OrderSearchResult orderSearchResult = null;
|
||||
try {
|
||||
orderSearchResult = authenticateService.authenticateClient(authenticationDto);
|
||||
if (orderSearchResult != null){
|
||||
return Result.Success(SUCCESS, orderSearchResult);
|
||||
}else {
|
||||
return Result.error("认证失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ApiOperation("订单明细查询接口")
|
||||
@PostMapping("/query")
|
||||
public Result query(@RequestBody AuthenticationSignDto authenticationDto) {
|
||||
|
||||
String productType = authenticationDto.getProductType().toString();
|
||||
String systemType = authenticationDto.getSystemType();
|
||||
String startTime = authenticationDto.getStartTime();
|
||||
String endTime = authenticationDto.getEndTime();
|
||||
String pageSize = authenticationDto.getPageSize().toString();
|
||||
String pageNum = authenticationDto.getPageNum().toString();
|
||||
String orgsign = authenticationDto.getSign();
|
||||
String sign = Digest.md5(productType + systemType + startTime + endTime + pageSize + pageNum);
|
||||
System.out.println(sign);
|
||||
|
||||
|
||||
if (StringUtils.isNotBlank(orgsign) && orgsign.equals(sign)) {
|
||||
return Result.Success(SUCCESS,sign);
|
||||
} else {
|
||||
return Result.error("签名错误");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("查询我的订单")
|
||||
@PostMapping("/query/page")
|
||||
public Result<OrderDetailRes> query(@RequestBody OrderDetailQueryParam orderDetailQueryParam){
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,20 +1,18 @@
|
|||
package com.chint.application.out;
|
||||
|
||||
|
||||
import com.chint.application.dtos.response.LegRes;
|
||||
import com.chint.application.dtos.response.OrderDetailRes;
|
||||
import com.chint.application.dtos.response.RouteOrderPageRes;
|
||||
import com.chint.application.dtos.response.RouteOrderRes;
|
||||
import com.chint.application.dtos.trip.TripCallback;
|
||||
import com.chint.application.queryies.OrderQuery;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.google.gson.Gson;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -24,8 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/order")
|
||||
public class OrderOutController {
|
||||
|
@ -40,9 +38,10 @@ public class OrderOutController {
|
|||
|
||||
@ApiOperation("根据临时单号和系统编码查询订单")
|
||||
@PostMapping("/query/billcode")
|
||||
public Result<RouteOrder> queryOrderByBillCodeAndSysCode(@RequestBody OrderQueryData queryData) {
|
||||
return Result.Success(SUCCESS, orderQuery.queryByBillCodeAndSysCode(queryData.getBillcode(), queryData.getSysCode())
|
||||
.reloadStatus());
|
||||
public Result<RouteOrderRes> queryOrderByBillCodeAndSysCode(@RequestBody OrderQueryData queryData) {
|
||||
RouteOrder routeOrder = orderQuery.queryByBillCodeAndSysCode(queryData.getBillcode(), queryData.getSysCode())
|
||||
.reloadStatus();
|
||||
return Result.Success(SUCCESS, orderQuery.queryRouteRes(routeOrder));
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,22 +49,7 @@ public class OrderOutController {
|
|||
@PostMapping("/query")
|
||||
public Result<RouteOrderRes> queryOrder(@RequestBody OrderQueryData queryData) {
|
||||
RouteOrder routeOrder = orderQuery.queryById(queryData.getRouteId()).reloadStatus();
|
||||
RouteOrderRes routeOrderRes = RouteOrderRes.copyFrom(routeOrder);
|
||||
List<LegRes> list = routeOrder.getLegItems().stream().map(LegRes::copyFrom).toList();
|
||||
routeOrderRes.setLegResList(list);
|
||||
List<OrderDetailRes> orderDetailResList = routeOrder
|
||||
.getOrderDetails()
|
||||
.stream()
|
||||
.map(OrderDetailRes::copyFrom)
|
||||
.toList();
|
||||
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
|
||||
routeOrderRes.setUserName(user.getName());
|
||||
routeOrderRes.setOrderDetailRes(orderDetailResList);
|
||||
routeOrderRes.setOrderDetailRes(routeOrderRes
|
||||
.getOrderDetailRes()
|
||||
.stream()
|
||||
.filter(it -> !it.getOrderStatus().equals(ORDER_EVENT_CANCEL_NAME) && !it.getOrderStatus().equals(ORDER_EVENT_PREPARE_NAME))
|
||||
.toList());
|
||||
RouteOrderRes routeOrderRes = orderQuery.queryRouteRes(routeOrder);
|
||||
return Result.Success(SUCCESS, routeOrderRes);
|
||||
}
|
||||
|
||||
|
@ -94,15 +78,21 @@ public class OrderOutController {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation("根据Id查询行程规划单-元年数据")
|
||||
@PostMapping("/query/tripCallback")
|
||||
public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) {
|
||||
TripCallback tripCallback = orderQuery.queryTripCallbackData(queryData);
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(tripCallback);
|
||||
System.out.println(json);
|
||||
log.info(json);
|
||||
return Result.Success(SUCCESS, tripCallback);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("分页查询行程规划订单")
|
||||
@PostMapping("/query/not/submit")
|
||||
public Result<List<RouteOrderPageRes>> queryNotSubmit(@RequestBody OrderQueryData queryData) {
|
||||
return Result.Success(SUCCESS, orderQuery.queryNotSubmit(queryData));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.chint.application.queryies;
|
||||
|
||||
|
||||
import com.chint.application.dtos.OrderDetailQueryParam;
|
||||
import com.chint.application.dtos.response.OrderDetailRes;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OrderDetailQuery {
|
||||
|
||||
@Autowired
|
||||
private OrderDetailRepository orderDetailRepository;
|
||||
|
||||
|
||||
public PageResult<OrderDetailRes> orderDetailPageQuery(OrderDetailQueryParam orderDetailQueryParam) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package com.chint.application.queryies;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.application.dtos.response.RouteOrderPageRes;
|
||||
import com.chint.application.dtos.response.*;
|
||||
import com.chint.application.dtos.trip.*;
|
||||
import com.chint.application.queryies.estimate.EstimatePrice;
|
||||
import com.chint.domain.aggregates.location.CityEntity;
|
||||
|
@ -14,22 +13,32 @@ import com.chint.domain.repository.CityRepository;
|
|||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.domain.service.amount_estimate.EstimateAdapter;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.constant.FSSCConstant;
|
||||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.StringCheck;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL_NAME;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_PREPARE_NAME;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_APPROVAL;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
|
||||
|
||||
@Service
|
||||
public class OrderQuery {
|
||||
|
||||
|
@ -48,6 +57,12 @@ public class OrderQuery {
|
|||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private EstimateAdapter estimateAdapter;
|
||||
|
||||
|
||||
public RouteOrder queryByOrderId(OrderQueryData queryData) {
|
||||
return routeRepository.queryById(queryData.getRouteId()).reloadStatus();
|
||||
|
@ -55,6 +70,12 @@ public class OrderQuery {
|
|||
|
||||
public PageResult<RouteOrderPageRes> pageQuery(OrderQueryData queryData) {
|
||||
|
||||
if (StringCheck.isFirstCharacterChinese(queryData.getKeyWord())) {
|
||||
queryData.setInstructions(queryData.getKeyWord());
|
||||
} else {
|
||||
queryData.setOrderNo(queryData.getKeyWord());
|
||||
}
|
||||
|
||||
//执行筛选分页查询
|
||||
List<Integer> approvalStatusCodes = queryData.getApprovalStatusCodes();
|
||||
List<Integer> legTypes = queryData.getLegTypes();
|
||||
|
@ -79,6 +100,7 @@ public class OrderQuery {
|
|||
int total = routeOrders.size();
|
||||
List<RouteOrderPageRes> orders = routeOrders
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(RouteOrder::getUpdateTime))
|
||||
.skip((long) (pageNum - 1) * pageSize)
|
||||
.limit(pageSize)
|
||||
.map(OrderQuery::getRouteOrderPageRes)
|
||||
|
@ -99,7 +121,7 @@ public class OrderQuery {
|
|||
}
|
||||
|
||||
//根据出差说明进行模糊匹配查询
|
||||
if(queryData.getInstructions() != null){
|
||||
if (queryData.getInstructions() != null) {
|
||||
Page<RouteOrder> byInstructions = routeRepository.findByInstructions(queryData);
|
||||
List<RouteOrder> content = byInstructions.getContent();
|
||||
content.forEach(RouteOrder::reloadStatus);
|
||||
|
@ -112,7 +134,6 @@ public class OrderQuery {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//执行普通分页查询
|
||||
PageResult<RouteOrder> routeOrderPageResult = routeRepository.pageQuery(queryData);
|
||||
routeOrderPageResult.getRecords().forEach(order -> {
|
||||
|
@ -129,11 +150,13 @@ public class OrderQuery {
|
|||
private static RouteOrderPageRes getRouteOrderPageRes(RouteOrder routeOrder) {
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
RouteOrderPageRes res = BeanUtil.copyProperties(routeOrder.reloadStatus(), RouteOrderPageRes.class);
|
||||
List<LocationRes> locationRes = routeOrder.getLegItems()
|
||||
List<Leg> legItems = routeOrder.getLegItems();
|
||||
List<LocationRes> locationRes = legItems
|
||||
.stream()
|
||||
.flatMap(leg -> Stream.of(leg.getOriginLocation(), leg.getDestinationLocation()))
|
||||
.map(LocationRes::copyFrom)
|
||||
.distinct()
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
res.setLocationResList(locationRes);
|
||||
res.setUserName(currentUser.getName());
|
||||
|
@ -163,7 +186,7 @@ public class OrderQuery {
|
|||
}
|
||||
|
||||
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.findByFakeOrderNoAndSysCode(queryData.getBillcode(), queryData.getSysCode())
|
||||
|
@ -171,10 +194,13 @@ public class OrderQuery {
|
|||
RouteOrder routeOrder = routeRepository.queryById(queryData.getRouteId())
|
||||
.reloadStatus();
|
||||
List<Location> locationList = new ArrayList<>();
|
||||
|
||||
User currentUser = userHttpRequest.loadUserInfo(
|
||||
userRepository.findByUserEmployeeNo(routeOrder.getUserId())
|
||||
);
|
||||
List<Leg> legItems =
|
||||
orderDomainService.queryLocation(routeOrder.getLegItems());
|
||||
|
||||
|
||||
legItems.forEach(leg -> {
|
||||
if (!locationList.contains(leg.getOriginLocation())) {
|
||||
locationList.add(leg.getOriginLocation());
|
||||
|
@ -213,22 +239,38 @@ public class OrderQuery {
|
|||
leg.reloadStatus();
|
||||
CityEntity originCity;
|
||||
CityEntity destinationCity;
|
||||
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail.builder();
|
||||
ScheduleDetail.ScheduleDetailBuilder scheduleDetailBuilder = ScheduleDetail
|
||||
.builder()
|
||||
.legId(leg.getLegId());
|
||||
if (!leg.getLegType().equals(LegConstant.LEG_TYPE_OTHER)) {
|
||||
originCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getOriginLocation().getLocationName()))
|
||||
.findFirst().get();
|
||||
destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getDestinationLocation().getLocationName()))
|
||||
.findFirst().get();
|
||||
|
||||
if (leg.getOriginLocation() != null) {
|
||||
originCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getOriginLocation().getLocationName()))
|
||||
.findFirst().get();
|
||||
scheduleDetailBuilder
|
||||
.startCity(originCity.getCityName())
|
||||
.startCityName(originCity.getCityName())
|
||||
.startCityEnName(originCity.getCityename());
|
||||
}
|
||||
|
||||
if (leg.getDestinationLocation() != null) {
|
||||
destinationCity = cityEntities.stream().filter(cityEntity -> cityEntity
|
||||
.getCityName()
|
||||
.equals(leg.getDestinationLocation().getLocationName()))
|
||||
.findFirst().get();
|
||||
scheduleDetailBuilder
|
||||
.endCityName(destinationCity.getCityName())
|
||||
.endCity(destinationCity.getCityName())
|
||||
.endCityEnName(destinationCity.getCityename());
|
||||
}
|
||||
}
|
||||
|
||||
if (leg.getLegType().equals(LEG_TYPE_HOTEL)) {
|
||||
scheduleDetailBuilder
|
||||
.startCityName(originCity.getCityName())
|
||||
.startCityEnName(originCity.getCityename())
|
||||
.endCity(destinationCity.getCityName())
|
||||
.endCityEnName(destinationCity.getCityename());
|
||||
.roomCount("1")
|
||||
.nightCount(leg.nightCount().toString());
|
||||
}
|
||||
|
||||
if (leg.getCurrencyType() != null) {
|
||||
|
@ -244,7 +286,7 @@ public class OrderQuery {
|
|||
.endDate(simpleFormatter.format(leg.getEndTime()))
|
||||
.systemStatus(FSSCConstant.TRIP_CALLBACK_RECEIPT_STATUS)
|
||||
.parentScheduleNum(leg.getLegNo())
|
||||
.amount(leg.getAmount())
|
||||
.amount(leg.queryEstimateAmount(estimateAdapter, SUPPLIER_C_TRIP).getEstimateAmount())
|
||||
.reserveCount("1")
|
||||
.quoteGroupNum("0")
|
||||
.extStatus(0)
|
||||
|
@ -276,10 +318,40 @@ public class OrderQuery {
|
|||
return switch (legType) {
|
||||
case LegConstant.LEG_TYPE_TRAIN -> FSSCConstant.TRIP_CALLBACK_TRAIN_TYPE;
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> FSSCConstant.TRIP_CALLBACK_FLIGHT_TYPE;
|
||||
case LegConstant.LEG_TYPE_HOTEL -> FSSCConstant.TRIP_CALLBACK_HOTEL_TYPE;
|
||||
case LEG_TYPE_HOTEL -> FSSCConstant.TRIP_CALLBACK_HOTEL_TYPE;
|
||||
case LegConstant.LEG_TYPE_TAXI -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;
|
||||
case LegConstant.LEG_TYPE_OTHER -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;
|
||||
default -> FSSCConstant.TRIP_CALLBACK_OTHER_TYPE;
|
||||
};
|
||||
}
|
||||
|
||||
public RouteOrderRes queryRouteRes(RouteOrder routeOrder) {
|
||||
RouteOrderRes routeOrderRes = RouteOrderRes.copyFrom(routeOrder);
|
||||
List<Leg> legItems = routeOrder.getLegItems();
|
||||
orderDomainService.queryLocation(legItems);
|
||||
List<LegRes> list = legItems.stream().map(LegRes::copyFrom).toList();
|
||||
routeOrderRes.setLegResList(list);
|
||||
List<OrderDetailRes> orderDetailResList = routeOrder
|
||||
.getOrderDetails()
|
||||
.stream()
|
||||
.map(OrderDetailRes::copyFrom)
|
||||
.toList();
|
||||
User user = userRepository.findByUserEmployeeNo(routeOrder.getUserId());
|
||||
routeOrderRes.setUserName(user.getName());
|
||||
routeOrderRes.setOrderDetailRes(orderDetailResList);
|
||||
routeOrderRes.setOrderDetailRes(routeOrderRes
|
||||
.getOrderDetailRes()
|
||||
.stream()
|
||||
.filter(it -> !it.getOrderStatus().equals(ORDER_EVENT_CANCEL_NAME) && !it.getOrderStatus().equals(ORDER_EVENT_PREPARE_NAME))
|
||||
.toList());
|
||||
return routeOrderRes;
|
||||
}
|
||||
|
||||
public List<RouteOrderPageRes> queryNotSubmit(OrderQueryData queryData) {
|
||||
List<RouteOrder> routeOrders = routeRepository.findByActualOrderNoNotNull(queryData);
|
||||
routeOrders.forEach(route -> orderDomainService.queryLocation(route.getLegItems()));
|
||||
return routeOrders.stream().filter(order -> order.reloadStatus().getOrderStatus().equals(ORDER_STATUS_APPROVAL))
|
||||
.map(OrderQuery::getRouteOrderPageRes)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,21 +5,35 @@ import com.chint.domain.aggregates.standards.TravelStandards;
|
|||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.CityRepository;
|
||||
import com.chint.domain.repository.TravelStandardsRepository;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.domain.value_object.FlightPriceData;
|
||||
import com.chint.domain.value_object.HotelPriceData;
|
||||
import com.chint.domain.value_object.PriceQueryData;
|
||||
import com.chint.domain.value_object.TrainPriceData;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.*;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.BookingRelatedApiRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.FlightProductInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.RouteInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.request.TrainProductInfo;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.response.BookingRelatedApiResponse;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.response.CTripSeatType;
|
||||
import com.chint.interfaces.rest.ctrip.dto.estimate.response.TrainValuationResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static com.chint.domain.aggregates.standards.TrainStandards.trainStandardsMap;
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_HOTEL;
|
||||
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_ONE;
|
||||
|
||||
@Component
|
||||
public class CTripEstimatePrice implements EstimatePrice {
|
||||
|
@ -60,13 +74,43 @@ public class CTripEstimatePrice implements EstimatePrice {
|
|||
String.valueOf(seatMaxPriceInfo.getMaxPrice()),
|
||||
seatCode);
|
||||
});
|
||||
|
||||
//根据差标等级获取可报销最大酒店金额
|
||||
//1.获取该用户的差标等级
|
||||
User user = BaseContext.getCurrentUser();//用户
|
||||
String standardLevel = user.getStandardLevel();//差旅等级
|
||||
String trainStandards = trainStandardsMap.get(standardLevel);//获取可报销座位
|
||||
Optional<String> optional = trainPriceData.getSeatInfoList().stream()
|
||||
.filter(seatInfo -> {
|
||||
Pattern pattern = Pattern.compile("\\b" + seatInfo.getSeatName() + "\\b");
|
||||
return pattern.matcher(trainStandards).find();//过滤符合对应座位的火车数据
|
||||
})
|
||||
.map(TrainPriceData.SeatInfo::getSeatPrice)
|
||||
.max(Comparator.comparing(BigDecimal::new));//获取最大值
|
||||
if (optional.isPresent()) {
|
||||
String maxPrice = optional.get();
|
||||
if (priceQueryData.getIfRound() != null && priceQueryData.getIfRound().equals(1)) {
|
||||
trainPriceData.setMaxPrice(String.valueOf(Integer.parseInt(maxPrice) * 2));
|
||||
} else {
|
||||
trainPriceData.setMaxPrice(maxPrice);
|
||||
}
|
||||
}
|
||||
return trainPriceData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlightPriceData queryFlightPrice(PriceQueryData priceQueryData) {
|
||||
FlightProductInfo flightProductInfo = new FlightProductInfo();
|
||||
flightProductInfo.setClassType("YCF");
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
String standardLevel = currentUser.getStandardLevel();
|
||||
|
||||
//差标价值管控 , 差标等级不是一等,只能选择经济舱
|
||||
if (standardLevel.equals(STANDARD_LEVEL_ONE)) {
|
||||
flightProductInfo.setClassType("YCF");
|
||||
} else {
|
||||
flightProductInfo.setClassType("Y");
|
||||
}
|
||||
|
||||
RouteInfo routeInfo = new RouteInfo();
|
||||
routeInfo.setArriveCityID(
|
||||
cityRepository.findByCityName(priceQueryData.getArriveCity()).getCity());
|
||||
|
@ -79,15 +123,23 @@ public class CTripEstimatePrice implements EstimatePrice {
|
|||
BookingRelatedApiResponse estimate = cTripEstimateRequest.estimate(bookingRelatedApiRequest);
|
||||
FlightPriceData flightPriceData = new FlightPriceData();
|
||||
|
||||
Optional.ofNullable(
|
||||
estimate.getData().getFlightValuationResult().getTotalPrice()
|
||||
).ifPresentOrElse(price -> {
|
||||
flightPriceData.setSuccess(true);
|
||||
flightPriceData.setMaxPrice(String.valueOf(price));
|
||||
}, () -> {
|
||||
flightPriceData.setSuccess(false);
|
||||
flightPriceData.setMaxPrice("无估算价格");
|
||||
});
|
||||
if (estimate.getStatus().getSuccess()) {
|
||||
Optional.ofNullable(
|
||||
estimate.getData().getFlightValuationResult().getTotalPrice()
|
||||
).ifPresentOrElse(price -> {
|
||||
flightPriceData.setSuccess(true);
|
||||
if (priceQueryData.getIfRound() != null && priceQueryData.getIfRound().equals(1)) {
|
||||
flightPriceData.setMaxPrice(String.valueOf(price.multiply(BigDecimal.valueOf(2))));
|
||||
} else {
|
||||
flightPriceData.setMaxPrice(String.valueOf(price));
|
||||
}
|
||||
}, () -> {
|
||||
flightPriceData.setSuccess(false);
|
||||
flightPriceData.setMaxPrice("无估算价格");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return flightPriceData;
|
||||
}
|
||||
|
||||
|
@ -109,6 +161,15 @@ public class CTripEstimatePrice implements EstimatePrice {
|
|||
HotelPriceData hotelPriceData = new HotelPriceData();
|
||||
if (!travelStandards.isEmpty()) {
|
||||
String price = travelStandards.get(0).getPrice();
|
||||
String arriveData = priceQueryData.getArriveDate();
|
||||
String departDate = priceQueryData.getDepartDate();
|
||||
if (arriveData != null) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
int count = calculateNightsBetweenDates(LocalDate.parse(departDate, formatter),
|
||||
LocalDate.parse(arriveData, formatter));
|
||||
int res = Integer.parseInt(price) * count;
|
||||
price = String.valueOf(res);
|
||||
}
|
||||
hotelPriceData.setSuccess(true);
|
||||
hotelPriceData.setMaxPrice(price);
|
||||
} else {
|
||||
|
@ -125,4 +186,11 @@ public class CTripEstimatePrice implements EstimatePrice {
|
|||
HashMap<String, String> cityMap = CityTag.cityMap;
|
||||
return cityMap.get(city) == null ? "2" : cityMap.get(city);//"2":代表其它城市
|
||||
}
|
||||
|
||||
public static int calculateNightsBetweenDates(LocalDate start, LocalDate end) {
|
||||
// 计算两个日期之间的天数差异,不包括结束日期
|
||||
long daysBetween = ChronoUnit.DAYS.between(start, end);
|
||||
// 将天数差异转换为晚上数量
|
||||
return (int) daysBetween;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,26 +9,26 @@ import com.chint.domain.exceptions.NotFoundException;
|
|||
import com.chint.domain.exceptions.OrderException;
|
||||
import com.chint.domain.factoriy.leg.LegFactory;
|
||||
import com.chint.domain.factoriy.order.OrderFactory;
|
||||
import com.chint.domain.repository.LegRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.infrastructure.constant.CommonMessageConstant;
|
||||
import com.chint.infrastructure.constant.DataMessageConstant;
|
||||
import com.chint.infrastructure.constant.LegConstant;
|
||||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
import com.chint.infrastructure.echo_framework.command.Command;
|
||||
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.ORDER_STATUS_ERROR;
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_STATUS_PREPARE;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.*;
|
||||
|
||||
@Service
|
||||
public class OrderApplicationService {
|
||||
|
@ -45,6 +45,8 @@ public class OrderApplicationService {
|
|||
@Autowired
|
||||
private LegFactory legFactory;
|
||||
|
||||
@Autowired
|
||||
private LegRepository legRepository;
|
||||
|
||||
|
||||
@Transactional
|
||||
|
@ -71,15 +73,57 @@ public class OrderApplicationService {
|
|||
RouteOrder order = Optional.ofNullable(routeRepository.queryById(addLegData.getRouteId()))
|
||||
.orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
|
||||
order.reloadStatus();
|
||||
if (!order.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
throw new OrderException(ORDER_STATUS_ERROR);
|
||||
}
|
||||
|
||||
List<Leg> legs = processLegData(addLegData.getLegData(), order);
|
||||
RouteOrder routeOrder = orderDomainService.saveOrder(order);
|
||||
legs.forEach(leg -> Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue());
|
||||
legs.forEach(leg -> {
|
||||
Command.of(LegPrepareCommand.class).legId(leg.getLegId()).sendToQueue();
|
||||
//如果订单状态已经处于审批中, 那么为这个新增的leg也提交审批状态
|
||||
if (order.getOrderStatus() >= ORDER_STATUS_APPROVAL) {
|
||||
Command.of(LegApprovalCommand.class).legId(leg.getLegId()).sendToQueue();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次
|
||||
if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Command
|
||||
.of(LegSyncCommand.class)
|
||||
.data(SyncLegData.of(routeOrder.getRouteId(), routeOrder.getSupplierName()))
|
||||
.sendToQueue();
|
||||
});
|
||||
}
|
||||
return routeOrder; // 仅在所有操作完成后保存一次
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void changeLeg(AddLegData addLegData) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
|
||||
LegData legData = addLegData.getLegData();
|
||||
Leg byLegId = Optional.ofNullable(
|
||||
legRepository.findByLegId(legData.getLegId())
|
||||
).orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
|
||||
byLegId.setStartTime(LocalDateTime.parse(legData.getStartTime(), formatter));
|
||||
byLegId.setEndTime(LocalDateTime.parse(legData.getEndTime(), formatter));
|
||||
byLegId.setOriginId(legData.getOriginId());
|
||||
byLegId.setDestinationId(legData.getDestinationId());
|
||||
legRepository.save(byLegId);
|
||||
|
||||
//异步操作-如果是当前的状态已经进行过匹配,那么就要订单同步到供应商一次
|
||||
CompletableFuture.runAsync(() -> {
|
||||
Long routeId = byLegId.getRouteId();
|
||||
RouteOrder order = Optional.ofNullable(routeRepository.queryById(routeId))
|
||||
.orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND)).reloadStatus();
|
||||
if (order.getOrderStatus() >= ORDER_STATUS_NOT_ORDERED) {
|
||||
Command
|
||||
.of(LegSyncCommand.class)
|
||||
.data(SyncLegData.of(order.getRouteId(), order.getSupplierName()))
|
||||
.sendToQueue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private List<Leg> processLegData(LegData legData, RouteOrder order) {
|
||||
List<Leg> legs = switch (legData.legType) {
|
||||
case LegConstant.LEG_TYPE_TRAIN -> legFactory.createTrainLeg(legData);
|
||||
|
@ -104,7 +148,7 @@ public class OrderApplicationService {
|
|||
|
||||
@Transactional
|
||||
public void approve(ApproveLegData approveLegData) {
|
||||
Command.of(LegApprovalCommand.class).data(approveLegData).sendToQueue();
|
||||
Command.of(RouteApprovalCommand.class).data(approveLegData).sendToQueue();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
@ -149,4 +193,10 @@ public class OrderApplicationService {
|
|||
public void reloadOrderDetail(SyncLegData syncLegData) {
|
||||
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateLegToOrder(AddLegData addLegData) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,9 @@ package com.chint.application.services;
|
|||
|
||||
import com.chint.application.dtos.SupplierLoginParam;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.ctrip.CTripLoginRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.login.H5Response;
|
||||
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
|
||||
|
@ -45,7 +47,12 @@ public class SupplierLoginService {
|
|||
}
|
||||
|
||||
private String getEmployeeNo(Long routeId) {
|
||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
return routeOrder.getUserId().toString();
|
||||
if (routeId != null) {
|
||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
return routeOrder.getUserId().toString();
|
||||
} else {
|
||||
User currentUser = BaseContext.getCurrentUser();
|
||||
return currentUser.getEmployeeNo().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.chint.application.services.login;
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Component
|
||||
public class LocalLoginStrategy implements LoginStrategy {
|
||||
|
||||
|
||||
@Override
|
||||
public Optional<String> getAccessToken(String code) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserInfo(String accessToken) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.chint.application.services.login;
|
||||
|
||||
public interface LoginService<T> {
|
||||
T login(String username, String password);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.chint.application.services.login;
|
||||
|
||||
|
||||
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.AuthException;
|
||||
import com.chint.domain.exceptions.SSOLoginException;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public interface LoginStrategy {
|
||||
Logger log = LoggerFactory.getLogger("UserService");
|
||||
|
||||
default String login(String code) {
|
||||
Optional<String> accessToken = getAccessToken(code);
|
||||
return getUserInfo(accessToken.orElseThrow(()-> new SSOLoginException("Failed to obtain access token")));
|
||||
}
|
||||
|
||||
Optional<String> getAccessToken(String code);
|
||||
|
||||
String getUserInfo(String accessToken);
|
||||
|
||||
static Optional<String> getAccessTokenMethod(HttpRequestBase request, String tokenName) {
|
||||
String responseBody = null;
|
||||
HttpClient client = HttpClients.createDefault();
|
||||
try {
|
||||
HttpResponse response = client.execute(request);
|
||||
responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
String pattern = "\"" + tokenName + "\":\"([^\"]+)\"";
|
||||
if (responseBody == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
Matcher matcher = Pattern.compile(pattern).matcher(responseBody);
|
||||
if (matcher.find()) {
|
||||
return Optional.of(matcher.group(1));
|
||||
} else {
|
||||
log.info(tokenName + " not found.");
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package com.chint.application.services.login.strategy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.chint.application.dtos.UserDTO;
|
||||
import com.chint.application.services.login.LoginStrategy;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.exceptions.SSOLoginException;
|
||||
import com.chint.domain.factoriy.user.UserFactory;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PailaLoginStrategy implements LoginStrategy {
|
||||
|
||||
@Value("${paila.base-url}")
|
||||
private String baseUrl;
|
||||
|
||||
@Value("${paila.client-id}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${paila.client-secret}")
|
||||
private String clientSecret;
|
||||
|
||||
@Value("${paila.redirect-url}")
|
||||
private String redirectUri;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private UserFactory userFactory;
|
||||
|
||||
@Override
|
||||
public Optional<String> getAccessToken(String code) {
|
||||
|
||||
log.info("开始执行登录");
|
||||
List<NameValuePair> parameters = Arrays.asList(
|
||||
new BasicNameValuePair("grant_type", "authorization_code"),
|
||||
new BasicNameValuePair("client_id", clientId),
|
||||
new BasicNameValuePair("client_secret", clientSecret),
|
||||
new BasicNameValuePair("code", code),
|
||||
new BasicNameValuePair("redirect_uri", redirectUri)
|
||||
);
|
||||
|
||||
HttpPost getMethod = postRequest("/esc-sso/oauth2.0/accessToken", parameters);
|
||||
return LoginStrategy.getAccessTokenMethod(getMethod, "access_token");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserInfo(String accessToken) {
|
||||
|
||||
|
||||
List<NameValuePair> userInfoParams = Collections.singletonList(
|
||||
new BasicNameValuePair("access_token", accessToken)
|
||||
);
|
||||
|
||||
HttpGet getMethodUserInfo = getRequest("/esc-sso/oauth2.0/profile", userInfoParams);
|
||||
|
||||
String userInfoResBody = null;
|
||||
HttpClient client = HttpClients.createDefault();
|
||||
try {
|
||||
HttpResponse userInfoRes = client.execute(getMethodUserInfo);
|
||||
userInfoResBody = EntityUtils.toString(userInfoRes.getEntity(), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
UserDTO userDTO = JSON.parseObject(userInfoResBody, UserDTO.class);
|
||||
if (userDTO == null) {
|
||||
throw new SSOLoginException(NOT_FOUND);
|
||||
}
|
||||
return userDTO.getAttributes().getAccount_no();
|
||||
}
|
||||
|
||||
private HttpGet getRequest(String path, List<NameValuePair> parameters) {
|
||||
String userInfoUrl = null;
|
||||
try {
|
||||
userInfoUrl = new URIBuilder(baseUrl).setPath(path)
|
||||
.setParameters(parameters).build().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
HttpGet request = new HttpGet(userInfoUrl);
|
||||
request.setHeader("Content-Type", "application/json");
|
||||
return request;
|
||||
}
|
||||
|
||||
private HttpPost postRequest(String path, List<NameValuePair> parameters) {
|
||||
String userInfoUrl = null;
|
||||
try {
|
||||
userInfoUrl = new URIBuilder(baseUrl).setPath(path)
|
||||
.setParameters(parameters).build().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
HttpPost request = new HttpPost(userInfoUrl);
|
||||
request.setHeader("Content-Type", "application/json");
|
||||
return request;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
package com.chint.application.services.login.strategy;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.chint.application.dtos.UserDTO;
|
||||
import com.chint.application.services.login.LoginStrategy;
|
||||
import com.chint.domain.exceptions.SSOLoginException;
|
||||
import com.chint.domain.factoriy.user.UserFactory;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PailaMobileLoginStrategy implements LoginStrategy {
|
||||
|
||||
@Value("${paila.base-url}")
|
||||
private String baseUrl;
|
||||
|
||||
@Value("${paila.client-mobile-id}")
|
||||
private String clientId;
|
||||
|
||||
@Value("${paila.client-mobile-secret}")
|
||||
private String clientSecret;
|
||||
|
||||
@Value("${paila.redirect-mobile-url}")
|
||||
private String redirectUri;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserHttpRequest userHttpRequest;
|
||||
|
||||
@Autowired
|
||||
private UserFactory userFactory;
|
||||
|
||||
@Override
|
||||
public Optional<String> getAccessToken(String code) {
|
||||
|
||||
log.info("开始执行登录");
|
||||
List<NameValuePair> parameters = Arrays.asList(
|
||||
new BasicNameValuePair("grant_type", "authorization_code"),
|
||||
new BasicNameValuePair("client_id", clientId),
|
||||
new BasicNameValuePair("client_secret", clientSecret),
|
||||
new BasicNameValuePair("code", code),
|
||||
new BasicNameValuePair("redirect_uri", redirectUri)
|
||||
);
|
||||
|
||||
HttpPost getMethod = postRequest("/esc-sso/oauth2.0/accessToken", parameters);
|
||||
return LoginStrategy.getAccessTokenMethod(getMethod, "access_token");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserInfo(String accessToken) {
|
||||
|
||||
|
||||
List<NameValuePair> userInfoParams = Collections.singletonList(
|
||||
new BasicNameValuePair("access_token", accessToken)
|
||||
);
|
||||
|
||||
HttpGet getMethodUserInfo = getRequest("/esc-sso/oauth2.0/profile", userInfoParams);
|
||||
|
||||
String userInfoResBody = null;
|
||||
HttpClient client = HttpClients.createDefault();
|
||||
try {
|
||||
HttpResponse userInfoRes = client.execute(getMethodUserInfo);
|
||||
userInfoResBody = EntityUtils.toString(userInfoRes.getEntity(), "UTF-8");
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
UserDTO userDTO = JSON.parseObject(userInfoResBody, UserDTO.class);
|
||||
if (userDTO == null) {
|
||||
throw new SSOLoginException(NOT_FOUND);
|
||||
}
|
||||
return userDTO.getAttributes().getAccount_no();
|
||||
}
|
||||
|
||||
private HttpGet getRequest(String path, List<NameValuePair> parameters) {
|
||||
String userInfoUrl = null;
|
||||
try {
|
||||
userInfoUrl = new URIBuilder(baseUrl).setPath(path)
|
||||
.setParameters(parameters).build().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
HttpGet request = new HttpGet(userInfoUrl);
|
||||
request.setHeader("Content-Type", "application/json");
|
||||
return request;
|
||||
}
|
||||
|
||||
private HttpPost postRequest(String path, List<NameValuePair> parameters) {
|
||||
String userInfoUrl = null;
|
||||
try {
|
||||
userInfoUrl = new URIBuilder(baseUrl).setPath(path)
|
||||
.setParameters(parameters).build().toString();
|
||||
} catch (URISyntaxException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
HttpPost request = new HttpPost(userInfoUrl);
|
||||
request.setHeader("Content-Type", "application/json");
|
||||
return request;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.chint.domain.aggregates.location;
|
||||
|
||||
import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
@ -19,4 +20,16 @@ public class CityEntity {
|
|||
private String province;
|
||||
private String provinceename;
|
||||
private String provinceName;
|
||||
|
||||
public static CityEntity copyFrom(FlightCitySearchResponse.DataItem dataItem) {
|
||||
CityEntity cityEntity = new CityEntity();
|
||||
cityEntity.setCity(String.valueOf(dataItem.getCityId()));
|
||||
cityEntity.setCityename(dataItem.getEName());
|
||||
cityEntity.setCityName(dataItem.getName());
|
||||
cityEntity.setCountryName(dataItem.getCountry());
|
||||
cityEntity.setCountryename(dataItem.getEName());
|
||||
cityEntity.setJianPin(dataItem.getCode());
|
||||
cityEntity.setProvinceName(dataItem.getProvince());
|
||||
return cityEntity;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.chint.domain.aggregates.order;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
/**
|
||||
* @author wanglf3
|
||||
* @date 2024-02-28
|
||||
* @vsrsion 1.0
|
||||
**/
|
||||
|
||||
@Data
|
||||
@Table("client")
|
||||
public class Client {
|
||||
private Long id;
|
||||
private String clientId;
|
||||
private String clientSecret;
|
||||
}
|
|
@ -2,6 +2,7 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
@ -10,6 +11,7 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
@Table("hotel_order_detail")
|
||||
@Accessors(chain = true)
|
||||
public class HotelOrderDetail {
|
||||
@Id
|
||||
private Long id;
|
||||
|
@ -111,18 +113,6 @@ public class HotelOrderDetail {
|
|||
@MappedCollection(idColumn = "hotel_order_detail_id", keyColumn = "hotel_order_detail_key")
|
||||
private List<HotelOrderDetailCustomer> customers;
|
||||
|
||||
// 入住人性别
|
||||
private String gender;
|
||||
|
||||
// 入住人姓名
|
||||
private String userName;
|
||||
|
||||
// 入住人code
|
||||
private String userCode;
|
||||
|
||||
// 入住人手机号
|
||||
private String phone;
|
||||
|
||||
// 入离日期内差标
|
||||
private String standardItems;
|
||||
|
||||
|
|
|
@ -2,13 +2,23 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Data
|
||||
@Table("hotel_order_detail")
|
||||
@Table("hotel_order_detail_customer")
|
||||
public class HotelOrderDetailCustomer {
|
||||
@Id
|
||||
private Long id;
|
||||
// 入住人性别
|
||||
private String gender;
|
||||
|
||||
// 入住人姓名
|
||||
private String userName;
|
||||
|
||||
// 入住人code
|
||||
private String userCode;
|
||||
|
||||
// 入住人手机号
|
||||
private String phone;
|
||||
}
|
||||
|
|
|
@ -16,10 +16,15 @@ import org.springframework.data.relational.core.mapping.Column;
|
|||
import org.springframework.data.relational.core.mapping.MappedCollection;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_OTHER;
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TAXI;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@Table("leg")
|
||||
|
@ -82,12 +87,13 @@ public class Leg {
|
|||
}
|
||||
|
||||
public Leg queryEstimateAmount(EstimateAdapter estimateAdapter, String supplierName) {
|
||||
if (this.legStatus >= (LegConstant.LEG_STATUS_NOT_ORDERED)) {
|
||||
if (!this.getLegType().equals(LEG_TYPE_OTHER) && !this.getLegType().equals(LEG_TYPE_TAXI)) {
|
||||
this.estimateAmount = estimateAdapter.of(supplierName).amountEstimate(this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Leg reloadStatus() {
|
||||
if (eventList == null || eventList.isEmpty()) {
|
||||
this.legStatus = LegConstant.LEG_STATUS_PREPARE;
|
||||
|
@ -147,8 +153,8 @@ public class Leg {
|
|||
case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_NAME;
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_NAME;
|
||||
case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_NAME;
|
||||
case LegConstant.LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME;
|
||||
case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME;
|
||||
case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_NAME;
|
||||
case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_NAME;
|
||||
default -> "未知类型";
|
||||
};
|
||||
}
|
||||
|
@ -158,8 +164,8 @@ public class Leg {
|
|||
case LegConstant.LEG_TYPE_TRAIN -> LegConstant.LEG_TYPE_TRAIN_EN_NAME;
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> LegConstant.LEG_TYPE_AIRPLANE_EN_NAME;
|
||||
case LegConstant.LEG_TYPE_HOTEL -> LegConstant.LEG_TYPE_HOTEL_EN_NAME;
|
||||
case LegConstant.LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME;
|
||||
case LegConstant.LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME;
|
||||
case LEG_TYPE_TAXI -> LegConstant.LEG_TYPE_TAXI_EN_NAME;
|
||||
case LEG_TYPE_OTHER -> LegConstant.LEG_TYPE_OTHER_EN_NAME;
|
||||
default -> "未知类型";
|
||||
};
|
||||
}
|
||||
|
@ -193,7 +199,7 @@ public class Leg {
|
|||
if (!eventList.isEmpty()) {
|
||||
LegEvent lastEvent = eventList.get(eventList.size() - 1);
|
||||
int lastEventType = lastEvent.getEventType();
|
||||
if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 1) {
|
||||
if (newEventType != lastEventType && Math.abs(newEventType - lastEventType) > 5) {
|
||||
throw new LegEventException("New event must be the same as, immediately before, or immediately after the last event type.");
|
||||
}
|
||||
}
|
||||
|
@ -208,6 +214,17 @@ public class Leg {
|
|||
.max(Integer::compareTo);
|
||||
}
|
||||
|
||||
public Integer nightCount() {
|
||||
return calculateNightsBetweenDates(LocalDate.from(this.startTime),
|
||||
LocalDate.from(this.endTime));
|
||||
}
|
||||
|
||||
public static int calculateNightsBetweenDates(LocalDate start, LocalDate end) {
|
||||
// 计算两个日期之间的天数差异,不包括结束日期
|
||||
long daysBetween = ChronoUnit.DAYS.between(start, end);
|
||||
// 将天数差异转换为晚上数量
|
||||
return (int) daysBetween;
|
||||
}
|
||||
// private Leg timeFormatter() {
|
||||
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// String string = this.startTime.toString();
|
||||
|
|
|
@ -6,6 +6,10 @@ import org.springframework.data.annotation.Id;
|
|||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Table("leg_extension_field")
|
||||
public class LegExtensionField {
|
||||
|
@ -13,6 +17,9 @@ public class LegExtensionField {
|
|||
private Long id;
|
||||
private Long legId;
|
||||
private Integer amountType;
|
||||
private String locationIds;
|
||||
@Transient
|
||||
private List<Location> locationList;
|
||||
@Transient
|
||||
private String amountTypeName;
|
||||
@Transient
|
||||
|
@ -23,6 +30,26 @@ public class LegExtensionField {
|
|||
private String estimatedAmount;
|
||||
|
||||
|
||||
public LegExtensionField addLocationIdsAsString(List<Long> locationIds) {
|
||||
this.locationIds = Arrays.toString(locationIds.toArray());
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Long> getLocationIdsAsLong() {
|
||||
// 去除字符串开头和结尾的方括号
|
||||
this.locationIds = this.locationIds.substring(1, this.locationIds.length() - 1);
|
||||
// 根据逗号分割字符串
|
||||
String[] items = this.locationIds.split(",");
|
||||
// 创建一个Long类型的列表
|
||||
List<Long> result = new ArrayList<>();
|
||||
// 将每个分割后的字符串转换为Long并添加到列表中
|
||||
for (String item : items) {
|
||||
result.add(Long.parseLong(item.trim()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public LegExtensionField reloadStatus() {
|
||||
this.amountTypeName = translateLegOtherAmountTypeToChineseName(this.amountType);
|
||||
this.amountTypeEnName = translateLegOtherAmountTypeToEnglishName(this.amountType);
|
||||
|
|
|
@ -22,6 +22,7 @@ public class Location {
|
|||
private String locationShortName;
|
||||
private String firstPinYin;
|
||||
private Long parentLocationId;
|
||||
private Integer isInternal;
|
||||
@Column("level")
|
||||
private Integer level;
|
||||
|
||||
|
|
|
@ -32,11 +32,13 @@ public class OrderDetail {
|
|||
private CurrencyType currencyType; //货币类型
|
||||
private Long destinationId;
|
||||
private Long originId;
|
||||
private String employeeNo;
|
||||
private LocalDateTime orderDate;
|
||||
private LocalDateTime startTime;
|
||||
private LocalDateTime endTime;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
// 根据需要添加构造函数、getter、setter等
|
||||
@MappedCollection(idColumn = "order_id", keyColumn = "order_key")
|
||||
private List<OrderEvent> orderEventList;
|
||||
|
@ -69,7 +71,10 @@ public class OrderDetail {
|
|||
orderDetail.setUpdateTime(LocalDateTime.now());
|
||||
return orderDetail;
|
||||
}
|
||||
|
||||
public OrderDetail employeeNo(String employeeNo) {
|
||||
this.setEmployeeNo(employeeNo);
|
||||
return this;
|
||||
}
|
||||
public OrderDetail productType(Integer productType) {
|
||||
this.setProductType(productType);
|
||||
return this;
|
||||
|
|
|
@ -45,7 +45,7 @@ public class RouteOrder extends BaseEntity {
|
|||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime bookingTime;
|
||||
private Long userId;
|
||||
private String userId;
|
||||
private String supplierName;
|
||||
//差标等级
|
||||
private String standardLevel;
|
||||
|
|
|
@ -2,11 +2,13 @@ package com.chint.domain.aggregates.order;
|
|||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@Data
|
||||
@Table("train_order_detail")
|
||||
@Accessors(chain = true)
|
||||
public class TrainOrderDetail {
|
||||
@Id
|
||||
private Long id;
|
||||
|
|
|
@ -3,14 +3,13 @@ package com.chint.domain.aggregates.standards;
|
|||
import java.util.HashMap;
|
||||
|
||||
public class CityTag {
|
||||
|
||||
public static final HashMap<String, String> cityMap;
|
||||
|
||||
static {
|
||||
cityMap = new HashMap<>();
|
||||
//直辖市
|
||||
cityMap.put("北京", "1");
|
||||
cityMap.put("上海", "1");
|
||||
cityMap.put("北京", "3");
|
||||
cityMap.put("上海", "3");
|
||||
cityMap.put("天津", "1");
|
||||
cityMap.put("重庆", "1");
|
||||
//省会城市
|
||||
|
@ -29,7 +28,7 @@ public class CityTag {
|
|||
cityMap.put("郑州", "1");
|
||||
cityMap.put("武汉", "1");
|
||||
cityMap.put("长沙", "1");
|
||||
cityMap.put("广州", "1");
|
||||
cityMap.put("广州", "3");
|
||||
cityMap.put("南宁", "1");
|
||||
cityMap.put("海口", "1");
|
||||
cityMap.put("成都", "1");
|
||||
|
@ -40,10 +39,12 @@ public class CityTag {
|
|||
cityMap.put("兰州", "1");
|
||||
cityMap.put("西宁", "1");
|
||||
cityMap.put("银川", "1");
|
||||
cityMap.put("乌鲁木齐市", "1");
|
||||
cityMap.put("乌鲁木齐", "1");
|
||||
//特别行政区
|
||||
cityMap.put("香港", "1");
|
||||
cityMap.put("澳门", "1");
|
||||
cityMap.put("深圳", "3");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.chint.domain.aggregates.standards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class HotCityTag {
|
||||
|
||||
public static final List<String> citys;
|
||||
|
||||
public static final List<String> internationalCitys;
|
||||
|
||||
static {
|
||||
citys = new ArrayList<>();
|
||||
|
||||
citys.add("上海");
|
||||
citys.add("北京");
|
||||
citys.add("广州");
|
||||
citys.add("深圳");
|
||||
citys.add("天津");
|
||||
citys.add("重庆");
|
||||
citys.add("苏州");
|
||||
citys.add("武汉");
|
||||
citys.add("成都");
|
||||
citys.add("杭州");
|
||||
citys.add("温州");
|
||||
|
||||
internationalCitys = new ArrayList<>();
|
||||
internationalCitys.add("北美洲_美国_纽约州_纽约_");
|
||||
internationalCitys.add("北美洲_美国_内华达州_拉斯维加斯_");
|
||||
internationalCitys.add("北美洲_美国_伊利诺伊州_芝加哥_");
|
||||
internationalCitys.add("北美洲_美国_华盛顿哥伦比亚特区_华盛顿_");
|
||||
internationalCitys.add("欧洲_英国_英格兰_伦敦_");
|
||||
internationalCitys.add("欧洲_德国_拜恩(巴伐利亚)_慕尼黑_");
|
||||
internationalCitys.add("欧洲_西班牙_加泰罗尼亚_巴塞罗那_");
|
||||
internationalCitys.add("欧洲_德国_柏林_柏林_");
|
||||
internationalCitys.add("北美洲_美国_纽约州_阿姆斯特丹_");
|
||||
internationalCitys.add("欧洲_法国_法兰西岛_巴黎_");
|
||||
internationalCitys.add("欧洲_西班牙_马德里_马德里_");
|
||||
internationalCitys.add("欧洲_葡萄牙_特茹河谷里斯本_里斯本_");
|
||||
internationalCitys.add("欧洲_奥地利_维也纳_维也纳_");
|
||||
internationalCitys.add("亚洲_日本_东京都_东京_");
|
||||
internationalCitys.add("欧洲_挪威_奥斯陆市_奥斯陆_");
|
||||
internationalCitys.add("北美洲_美国_加利福尼亚州_旧金山_");
|
||||
internationalCitys.add("亚洲_新加坡_新加坡_新加坡_");
|
||||
internationalCitys.add("亚洲_中国_香港_香港_");
|
||||
internationalCitys.add("亚洲_中国_澳门_澳门_");
|
||||
internationalCitys.add("亚洲_中国_台湾_台北_");
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.chint.domain.aggregates.standards;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.RankConstant.*;
|
||||
|
||||
public class TrainStandards {
|
||||
public static final HashMap<String, String> trainStandardsMap;
|
||||
|
||||
static {
|
||||
trainStandardsMap = new HashMap<>();
|
||||
String oneStandards = "商务座,一等双软,一等座,二等座,高级软卧,一等双软";
|
||||
String twoStandards = "一等座,高级软卧,一等双软,动卧,软卧,硬卧,硬座";
|
||||
String threeStandards = "一等座,一等双软,二等座,软卧,硬卧,硬座";
|
||||
String fourStandards = "二等座,二等双软,软卧,无座,硬卧,硬座";
|
||||
trainStandardsMap.put(STANDARD_LEVEL_ONE, oneStandards);
|
||||
trainStandardsMap.put(STANDARD_LEVEL_TWO, twoStandards);
|
||||
trainStandardsMap.put(STANDARD_LEVEL_THREE, threeStandards);
|
||||
trainStandardsMap.put(STANDARD_LEVEL_FOUR, fourStandards);
|
||||
}
|
||||
}
|
|
@ -24,6 +24,6 @@ public class TravelStandards {
|
|||
//差标等级
|
||||
private String standardLevel;
|
||||
//城市类别
|
||||
private String cityTag;//1:直辖市,省会,特别行政区,2:其它城市
|
||||
private String cityTag;//1:直辖市,省会,特别行政区,2:其它城市,3:北上广深
|
||||
}
|
||||
|
||||
|
|
|
@ -9,4 +9,5 @@ public class SystemCode {
|
|||
private Long id;
|
||||
private String systemName;
|
||||
private String systemCode;
|
||||
private String bpmCode;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.springframework.data.annotation.Id;
|
|||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
|
@ -20,13 +21,14 @@ import java.util.Map;
|
|||
public class User {
|
||||
@Id
|
||||
private Long userId;
|
||||
private Long employeeNo;
|
||||
private String employeeNo;
|
||||
private Integer employeeLevel;
|
||||
private String name;
|
||||
private String email;
|
||||
private String gender;
|
||||
private String phoneNumber;
|
||||
private String password;
|
||||
private LocalDateTime syncTime;
|
||||
@Transient
|
||||
private String standardLevel;
|
||||
@Transient
|
||||
|
@ -43,11 +45,11 @@ public class User {
|
|||
private UserLoginParam userLoginParam;
|
||||
|
||||
|
||||
public User(Long employeeNo) {
|
||||
public User(String employeeNo) {
|
||||
this.employeeNo = employeeNo;
|
||||
}
|
||||
|
||||
public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel) {
|
||||
public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber, UserLoginParam userLoginParam, String standardLevel, String companyCode) {
|
||||
this.userId = userId;
|
||||
this.employeeNo = employeeNo;
|
||||
this.employeeLevel = employeeLevel;
|
||||
|
@ -56,9 +58,10 @@ public class User {
|
|||
this.phoneNumber = phoneNumber;
|
||||
this.standardLevel = standardLevel;
|
||||
this.userLoginParam = userLoginParam;
|
||||
this.companyCode = companyCode;
|
||||
}
|
||||
|
||||
public User(Long userId, Long employeeNo, Integer employeeLevel, String name, String email, String phoneNumber) {
|
||||
public User(Long userId, String employeeNo, Integer employeeLevel, String name, String email, String phoneNumber) {
|
||||
this.userId = userId;
|
||||
this.employeeNo = employeeNo;
|
||||
this.employeeLevel = employeeLevel;
|
||||
|
@ -67,7 +70,7 @@ public class User {
|
|||
this.phoneNumber = phoneNumber;
|
||||
}
|
||||
|
||||
public static User withEmployeeNo(Long employeeNo) {
|
||||
public static User withEmployeeNo(String employeeNo) {
|
||||
return new User(employeeNo);
|
||||
}
|
||||
|
||||
|
@ -79,15 +82,19 @@ public class User {
|
|||
Claim employeeNo = claims.get(AuthMessageConstant.USER_EMPLOYEE_NO);
|
||||
Claim name = claims.get(AuthMessageConstant.USER_NAME);
|
||||
Claim employeeLevel = claims.get(AuthMessageConstant.USER_EMPLOYEE_LEVEL);
|
||||
// Claim rankCode = claims.get(AuthMessageConstant.USER_RANK_CODE);
|
||||
Claim companyCode = claims.get(AuthMessageConstant.USER_COMPANY_CODE);
|
||||
Claim loginParam = claims.get(AuthMessageConstant.USER_LOGIN_PARAM);
|
||||
Claim standardLevel = claims.get(AuthMessageConstant.USER_STANDARD_LEVEL);
|
||||
return new User(userId.asLong(),
|
||||
employeeNo.asLong(),
|
||||
employeeNo.asString(),
|
||||
employeeLevel.asInt(),
|
||||
name.asString(),
|
||||
email.asString(),
|
||||
phoneNumber.asString(),
|
||||
UserLoginParam.of(loginParam.asString()),
|
||||
standardLevel.asString());
|
||||
standardLevel.asString(),
|
||||
companyCode.asString());
|
||||
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ public class LegEventListener {
|
|||
|
||||
// @TransitionTo(command = "LegPrepareCommand", order = 0)
|
||||
public void onLegStatusChange(LegPrepareCommand command) {
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
leg.addEvent(legEvent);
|
||||
legRepository.save(leg);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.chint.domain.exceptions;
|
||||
|
||||
public class JwtExpiredException extends BaseException{
|
||||
public JwtExpiredException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.chint.domain.exceptions;
|
||||
|
||||
public class SSOLoginException extends BaseException{
|
||||
public SSOLoginException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
|
@ -126,6 +126,10 @@ public class RouteLegFactory implements LegFactory {
|
|||
|
||||
private static LegExtensionField getLegExtensionField(LegData data) {
|
||||
LegExtensionFieldData legExtensionFieldData = data.getLegExtensionFieldData();
|
||||
return BeanUtil.copyProperties(legExtensionFieldData, LegExtensionField.class);
|
||||
LegExtensionField legExtensionField = BeanUtil.copyProperties(legExtensionFieldData, LegExtensionField.class);
|
||||
if (legExtensionFieldData.getLocationIds() != null && !legExtensionFieldData.getLocationIds().isEmpty()) {
|
||||
legExtensionField.addLocationIdsAsString(legExtensionFieldData.getLocationIds());
|
||||
}
|
||||
return legExtensionField;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public class RouteOrderFactory implements OrderFactory {
|
|||
RouteOrder routeOrder = new RouteOrder();
|
||||
routeOrder.setRouteOrderNo(OrderNo.generate());
|
||||
//根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号
|
||||
routeOrder.setUserId(currentUser.getUserId());
|
||||
routeOrder.setUserId(currentUser.getEmployeeNo());
|
||||
ApproveOrderNo approveOrderNo = new ApproveOrderNo();
|
||||
approveOrderNo.setFakeOrderNo(currentUser.getUserLoginParam().getBillcode());
|
||||
routeOrder.setApproveOrderNo(approveOrderNo);
|
||||
|
@ -50,7 +50,7 @@ public class RouteOrderFactory implements OrderFactory {
|
|||
RouteOrder routeOrder = new RouteOrder();
|
||||
routeOrder.setRouteOrderNo(OrderNo.generate());
|
||||
//根据项目需求,需要保存假审批订单号,真审批订单号 ,创建的时候保存假审批订单号
|
||||
routeOrder.setUserId(Long.valueOf(loginParam.getSfno()));
|
||||
routeOrder.setUserId(loginParam.getSfno());
|
||||
ApproveOrderNo approveOrderNo = new ApproveOrderNo();
|
||||
approveOrderNo.setSysCode(loginParam.getSyscode());
|
||||
approveOrderNo.setFakeOrderNo(loginParam.getBillcode());
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.List;
|
|||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
|
||||
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_ETA;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.KEEP_TWO_DECIMAL_ZERO;
|
||||
|
||||
@Component
|
||||
|
@ -66,7 +67,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
|
||||
first.ifPresent(orderDetail ->
|
||||
flightOrderDetail.setOrderStatus(orderDetail.getLastEvent().mapToFlightOrderDetailStatus())
|
||||
);
|
||||
);
|
||||
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
flightOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
|
||||
|
@ -77,13 +78,14 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
.filter(it -> first.get().getLegId().equals(it.getLegId()))
|
||||
.findFirst()).ifPresent(it ->
|
||||
flightOrderDetail.setScheduleNum(it.getLegNo()));
|
||||
Long EmployeeNo = routeOrder.getUserId();
|
||||
String EmployeeNo = routeOrder.getUserId();
|
||||
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
|
||||
flightOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo()));
|
||||
flightOrderDetail.setBookingUserCode(user.getEmployeeNo());
|
||||
flightOrderDetail.setBookingName(user.getName());
|
||||
flightOrderDetail.setBookingUserPhone(user.getPhoneNumber());
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -94,10 +96,31 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
String orderNo = hotelOrderInfoEntity.getOrderID();
|
||||
Optional<OrderDetail> byOrderNo = orderDetailRepository.findByOrderNo(orderNo);
|
||||
String journeyNo = hotelOrderInfoEntity.getJourneyNo();
|
||||
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
|
||||
|
||||
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo).reloadStatus();
|
||||
|
||||
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
|
||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||
|
||||
HotelOrderDetail hotelOrderDetail;
|
||||
if (byOrderNo.isPresent()) {
|
||||
if (byOrderNo.get().getHotelOrderDetail() == null) {
|
||||
hotelOrderDetail = new HotelOrderDetail();
|
||||
} else {
|
||||
hotelOrderDetail = byOrderNo.get().getHotelOrderDetail();
|
||||
}
|
||||
} else {
|
||||
hotelOrderDetail = new HotelOrderDetail();
|
||||
}
|
||||
|
||||
if (byOrderNo.isPresent() && byOrderNo.get()
|
||||
.getLastEvent()
|
||||
.getEventType()
|
||||
.equals(ORDER_EVENT_ETA)) {
|
||||
hotelOrderDetail.setOverStandard("true");
|
||||
} else {
|
||||
hotelOrderDetail.setOverStandard("false");
|
||||
}
|
||||
|
||||
hotelOrderDetail.setOrderNo(orderNo); //订单号
|
||||
hotelOrderDetail.setOverStandard(null); //是否超标
|
||||
hotelOrderDetail.setOrderStatus(ORDER_DETAIL_STATUS_SUCCESS);
|
||||
|
@ -111,7 +134,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
.findFirst()).ifPresent(it ->
|
||||
hotelOrderDetail.setScheduleNum(it.getLegNo()));
|
||||
|
||||
Long EmployeeNo = routeOrder.getUserId();
|
||||
String EmployeeNo = routeOrder.getUserId();
|
||||
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
|
||||
String cityName = hotelOrderInfoEntity.getCityName();
|
||||
hotelOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo()));
|
||||
|
@ -126,8 +149,8 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
|||
hotelOrderDetail.setStarRate(hotelOrderInfoEntity.getStar());
|
||||
hotelOrderDetail.setCheckInDate(hotelOrderInfoEntity.getStartTime()); //入住日期
|
||||
hotelOrderDetail.setDepartureDate(hotelOrderInfoEntity.getEndTime()); //离店日期 "2022-09-10"
|
||||
hotelOrderDetail.setNightCount(hotelOrderInfoEntity.getQuantity()); //退订夜间数
|
||||
hotelOrderDetail.setRoomCount(hotelOrderInfoEntity.getQuantity()); //退订夜间数
|
||||
hotelOrderDetail.setNightCount(hotelOrderInfoEntity.getRoomDays()); //退订夜间数
|
||||
hotelOrderDetail.setRoomCount(hotelOrderInfoEntity.getRoomQuantity()); //退订夜间数
|
||||
hotelOrderDetail.setRoomTypeName(hotelOrderInfoEntity.getRoomName()); //房型
|
||||
hotelOrderDetail.setPaymentType("1"); //付款方式 0:公司统付1:个人付 2:混付
|
||||
|
||||
|
|
|
@ -1,19 +1,99 @@
|
|||
package com.chint.domain.factoriy.order_detail;
|
||||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.*;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.Resident;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightListResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{
|
||||
public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory {
|
||||
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
|
||||
return null;
|
||||
CarDetailResponse carDetailResponse = (CarDetailResponse) carOrderDetailData;
|
||||
CarOrderDetail carOrderDetail = convertCart(carDetailResponse);
|
||||
return carOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
|
||||
return null;
|
||||
TrainDetailResponse trainDetailResponse = (TrainDetailResponse) trainOrderDetailData;
|
||||
TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData();
|
||||
TrainDetailResponse.TravelData travelData = data.getTravelData();
|
||||
TrainOrderDetail trainOrderDetail = new TrainOrderDetail();
|
||||
//映射值
|
||||
/* trainOrderDetail.setOrderNo(data.getOrderNo())
|
||||
.setOverStandard(ruleViolate)
|
||||
.setParentOrderNo(null)
|
||||
.setOriginalOrderNo(originalOrderNo)
|
||||
.setOrderStatus(null)
|
||||
.setAccountCompanyId(null)
|
||||
.setAccountCompanyName(null)
|
||||
.setReceiptsNum(travelData.getTravelApplyNo())
|
||||
.setScheduleNum(null)
|
||||
.setBookingUserCode(data.getOutEmployeeId())
|
||||
.setBookingName(null)
|
||||
.setBookingUserPhone(null)
|
||||
.setCreateTime(issueTime)
|
||||
.setStartTime(departureTime)
|
||||
.setArriveTime(arrivalTime)
|
||||
.setFromStationName(data.getFromStation())
|
||||
.setToStationName(data.getToStation())
|
||||
.setTrainNo(data.getTrainNo())
|
||||
.setFromCity(departCityName)
|
||||
.setToCity(arriveCityName)
|
||||
.setRunTime(null)
|
||||
.setOrderAmount(data.getTotalAmount())
|
||||
.setPreServiceFee(servicePrice)
|
||||
.setPostServiceFee(afterSettlementServicePrice)
|
||||
.setRefundAmount(refundPrice)
|
||||
.setChangeDifference(changePriceDiff)
|
||||
.setChangeCost(serviceCharge)
|
||||
.setTickets(
|
||||
data.getPriceVarList().stream()
|
||||
.flatMap(priceVar -> priceVar.getPassengers().stream())
|
||||
.toList()
|
||||
)
|
||||
.setSeatType(data.getItems().isEmpty() ? null : data.getItems().get(0).getSeatClass())
|
||||
.setSeatName(data.getItems().isEmpty() ? null : data.getItems().get(0).getSeatNo())
|
||||
.setTicketPrice(price)
|
||||
.setRefundCost(null)
|
||||
.setRefundPrice(refundPrice)
|
||||
.setStandardItems(policyName)
|
||||
.setUserName(passengerName)
|
||||
.setUserCode(employeeCode)
|
||||
.setOverStandard(ruleViolate)
|
||||
.setPhone(null)
|
||||
// .setXXX(携程预订/同程预订)
|
||||
// .setXXX(PersonalPrice)
|
||||
// .setXXX(CompanyPrice)
|
||||
// .setXXX(null)
|
||||
// .setXXX(foulReason)//超标原因
|
||||
.setBOOK_ORG_STRUCT_1(null)
|
||||
.setBOOK_ORG_STRUCT_2(null)
|
||||
.setBOOK_ORG_STRUCT_3(null)
|
||||
.setPaymentType(payType)
|
||||
// .setXXX(null)//入住人组织架构信息3
|
||||
// .setXXX(null)//项目订单号
|
||||
// .setXXX(null)//成本中心*/
|
||||
;
|
||||
|
||||
return trainOrderDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,11 +103,218 @@ public class LYOrderExtensionFactoryImpl implements OrderExtensionFactory{
|
|||
|
||||
@Override
|
||||
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
|
||||
return null;
|
||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||
HotelDetailResponse hotelDetailResponse = (HotelDetailResponse) hotelOrderDetailData;
|
||||
HotelOrderDetail convertHotel = convertHotel(hotelDetailResponse);
|
||||
|
||||
|
||||
return convertHotel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OtherOrderDetail createOtherOrderDetail(Object otherOrderDetailData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private FlightOrderDetail convertFlight(HotelDetailResponse hotelDetailResponse) {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CarOrderDetail convertCart(CarDetailResponse carDetailResponse) {
|
||||
CarOrderDetail carOrderDetail = new CarOrderDetail();
|
||||
CarDetailResponse.Data data = carDetailResponse.getData();
|
||||
|
||||
// 设置对象的全部属性
|
||||
carOrderDetail.setOrderNo(data.getOrderSerialNo());
|
||||
// carOrderDetail.setOverStandard(); //无
|
||||
// carOrderDetail.setParentOrderNo(parentOrderNo); //无
|
||||
// carOrderDetail.setOriginalOrderNo(originalOrderNo); //无
|
||||
carOrderDetail.setOrderStatus(data.getOrderStatus());
|
||||
// carOrderDetail.setAccountCompanyId(accountCompanyId); //无
|
||||
// carOrderDetail.setAccountCompanyName(accountCompanyName); //无
|
||||
carOrderDetail.setReceiptsNum(data.getTravelData().getTravelApplyNo());
|
||||
// carOrderDetail.setScheduleNum(scheduleNum); //无
|
||||
carOrderDetail.setBookingUserCode(data.getOutEmployeeId());
|
||||
// carOrderDetail.setBookingName(bookingName); //无
|
||||
// carOrderDetail.setBookingUserPhone(bookingUserPhone);//无
|
||||
carOrderDetail.setCreateTime(data.getOrder().getCreateTime());
|
||||
carOrderDetail.setStartTime(data.getOrderExtend().getChargeTime());
|
||||
carOrderDetail.setArriveTime(data.getOrderExtend().getFinishTime());
|
||||
carOrderDetail.setFromStationName(data.getOrderExtend().getStartAddress());
|
||||
carOrderDetail.setToStationName(data.getOrderExtend().getEndAddress());
|
||||
carOrderDetail.setCarModel(data.getOrderExtend().getCarType());
|
||||
carOrderDetail.setFromCity(data.getOrderExtend().getStartCityName());
|
||||
carOrderDetail.setToCity(data.getOrderExtend().getEndCityName());
|
||||
carOrderDetail.setRunTime(data.getOrderExtend().getDuration());
|
||||
carOrderDetail.setMileage(data.getOrderExtend().getMileage());
|
||||
carOrderDetail.setOrderAmount(String.valueOf(data.getTotalAmount()));
|
||||
// carOrderDetail.setCancellationFee(cancellationFee); //无
|
||||
// carOrderDetail.setStandardItems(standardItems); //无
|
||||
carOrderDetail.setUserName(data.getOrder().getContactName());
|
||||
carOrderDetail.setUserCode(data.getOrder().getOutEmployeeId());
|
||||
carOrderDetail.setPhone(data.getOrder().getContactPhone());
|
||||
// carOrderDetail.setSupplier(supplier); //无
|
||||
carOrderDetail.setPersonalPaymentAmount(String.valueOf(data.getPersonalPrice()));
|
||||
carOrderDetail.setCompanyPaymentAmount(String.valueOf(data.getCompanyPrice()));
|
||||
// carOrderDetail.setOverStandardReason(overStandardReason); contactName
|
||||
// carOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1); //无
|
||||
// carOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2); //无
|
||||
// carOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3); //无
|
||||
// carOrderDetail.setPaymentType(String.valueOf(data.getPaymentType())); //无
|
||||
// carOrderDetail.setProjectOrderNo(projectOrderNo); //无
|
||||
// carOrderDetail.setCostCenter(costCenter); //无
|
||||
// carOrderDetail.setTollFee(tollFee); //无
|
||||
|
||||
return carOrderDetail;
|
||||
}
|
||||
|
||||
private FlightOrderDetail convertFlight(FlightListResponse flightListResponse) {
|
||||
FlightOrderDetail flightOrderDetail = new FlightOrderDetail();
|
||||
FlightListResponse.FlightOrder data = flightListResponse.getData();
|
||||
|
||||
|
||||
// flightOrderDetail.setId(id);
|
||||
flightOrderDetail.setOrderNo(data.getOriginalOrderNo());
|
||||
flightOrderDetail.setOverStandard(String.valueOf(data.getRuleViolate()));
|
||||
flightOrderDetail.setParentOrderNo(data.getParentRefOrderNo());
|
||||
flightOrderDetail.setOriginalOrderNo(data.getOriginalOrderNo());
|
||||
flightOrderDetail.setOrderStatus(String.valueOf(data.getOrderStatus()));
|
||||
|
||||
// flightOrderDetail.setAccountCompanyId(accountCompanyId);//核算企业id
|
||||
// flightOrderDetail.setAccountCompanyName(accountCompanyName);//核算企业名称
|
||||
|
||||
flightOrderDetail.setReceiptsNum(data.getTravelData().getTravelApplyNo());
|
||||
flightOrderDetail.setScheduleNum(data.getTravelOrderNo());
|
||||
flightOrderDetail.setChangedScheduleNum(data.getOriginalOrderNo());
|
||||
flightOrderDetail.setBookingUserCode(data.getOutEmployeeId());
|
||||
flightOrderDetail.setBookingName(data.getEmployeeName());
|
||||
|
||||
// flightOrderDetail.setBookingUserPhone(data.get); //预订人电话
|
||||
|
||||
flightOrderDetail.setCreateTime(data.getBookDate());
|
||||
|
||||
// flightOrderDetail.setStartTime(data.getDepar);
|
||||
|
||||
/* flightOrderDetail.setArriveTime(arriveTime);
|
||||
flightOrderDetail.setStartCityName(startCityName);
|
||||
flightOrderDetail.setStartCityCode(startCityCode);
|
||||
flightOrderDetail.setStartAirportName(startAirportName);
|
||||
flightOrderDetail.setStartAirportCode(startAirportCode);
|
||||
flightOrderDetail.setStartTerminal(startTerminal);
|
||||
flightOrderDetail.setEndCityName(endCityName);
|
||||
flightOrderDetail.setEndCityCode(endCityCode);
|
||||
flightOrderDetail.setEndAirportName(endAirportName);
|
||||
flightOrderDetail.setEndAirportCode(endAirportCode);
|
||||
flightOrderDetail.setEndTerminal(endTerminal);
|
||||
flightOrderDetail.setDistance(distance);
|
||||
flightOrderDetail.setFlightCompName(flightCompName);
|
||||
flightOrderDetail.setFlightNum(flightNum);
|
||||
flightOrderDetail.setSeatPoint(seatPoint);
|
||||
flightOrderDetail.setSeatPointName(seatPointName);*/
|
||||
flightOrderDetail.setOrderAmount(String.valueOf(data.getTotalPrice()));
|
||||
flightOrderDetail.setPreServiceFee(String.valueOf(data.getServicePrice()));
|
||||
// flightOrderDetail.setPostServiceFee(data.getA);
|
||||
// flightOrderDetail.setRefundAmount(data.getFlightOrderRefundInfo());
|
||||
// flightOrderDetail.setTickets(tickets);
|
||||
/* flightOrderDetail.setFuelTax(data.getFuel);
|
||||
flightOrderDetail.setAirportTax(airportTax);
|
||||
flightOrderDetail.setFacePrice(facePrice);
|
||||
flightOrderDetail.setChangeFee(changeFee);
|
||||
flightOrderDetail.setRefundFee(refundFee);
|
||||
flightOrderDetail.setUpFee(upFee);
|
||||
flightOrderDetail.setStandard(standard);
|
||||
flightOrderDetail.setTicketNo(ticketNo);
|
||||
flightOrderDetail.setChangedTicketNo(changedTicketNo);
|
||||
flightOrderDetail.setUserName(data.getParr);
|
||||
flightOrderDetail.setUserCode(data.getOutEmployeeId());
|
||||
flightOrderDetail.setIsOverStandard(isOverStandard);
|
||||
flightOrderDetail.setPhone(phone);
|
||||
flightOrderDetail.setPaymentType(paymentType);
|
||||
flightOrderDetail.setNotBookedLowestPriceReason(notBookedLowestPriceReason);
|
||||
flightOrderDetail.setSupplier(supplier);
|
||||
flightOrderDetail.setPersonalPaymentAmount(personalPaymentAmount);
|
||||
flightOrderDetail.setCompanyPaymentAmount(companyPaymentAmount);
|
||||
flightOrderDetail.setOverStandardReason(overStandardReason);
|
||||
flightOrderDetail.setBOOK_ORG_STRUCT_1(BOOK_ORG_STRUCT_1);
|
||||
flightOrderDetail.setBOOK_ORG_STRUCT_2(BOOK_ORG_STRUCT_2);
|
||||
flightOrderDetail.setBOOK_ORG_STRUCT_3(BOOK_ORG_STRUCT_3);
|
||||
flightOrderDetail.setInsuranceFee(insuranceFee);
|
||||
flightOrderDetail.setProjectOrderNo(projectOrderNo);
|
||||
flightOrderDetail.setCostCenter(costCenter);
|
||||
*/
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private HotelOrderDetail convertHotel(HotelDetailResponse hotelDetailResponse) {
|
||||
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
|
||||
HotelDetailResponse.Data data = hotelDetailResponse.getData();
|
||||
HotelDetailResponse.OrderInfo orderInfo = data.getOrderInfo();
|
||||
HotelDetailResponse.HotelInfo hotelInfo = data.getHotelInfo();
|
||||
List<HotelDetailResponse.Room> roomList = data.getRoomList();
|
||||
hotelOrderDetail.setOrderNo(orderInfo.getOrderSerialNo())
|
||||
.setOverStandard(String.valueOf(orderInfo.getRuleViolate()))
|
||||
.setOrderStatus(String.valueOf(orderInfo.getOrderStatus()))
|
||||
.setReceiptsNum(orderInfo.getTravelApplyNo())
|
||||
.setBookingUserCode(orderInfo.getOutEmployeeId())
|
||||
// .setBookingName(orderInfo.getEmployeeName())
|
||||
.setCreateTime("2023-04-26 13:15:17")
|
||||
.setCheckInCity(orderInfo.getCreateTime())
|
||||
.setHotelName(hotelInfo.getHotelName())
|
||||
.setContactPhone(hotelInfo.getHotelTel())
|
||||
.setHotelAddress(hotelInfo.getHotelAddress())
|
||||
.setStarRate("4")
|
||||
.setCheckInDate(hotelInfo.getCheckInDate())
|
||||
.setDepartureDate(hotelInfo.getCheckOutDate())
|
||||
.setNightCount(String.valueOf(hotelInfo.getNightNum()))
|
||||
.setRoomCount(String.valueOf(hotelInfo.getRoomNum()))
|
||||
//.setRefundRoomNightCount("0")
|
||||
.setRoomTypeName(hotelInfo.getRoomName())
|
||||
.setPaymentType(String.valueOf(orderInfo.getPaymentType()))
|
||||
.setCompanyAmount(String.valueOf(orderInfo.getCompanyPrice()))
|
||||
.setPersonalAmount(String.valueOf(orderInfo.getPersonalPrice()))
|
||||
.setCompanyRefundAmount(String.valueOf(orderInfo.getCompanyRefundPrice()))
|
||||
.setPersonalRefundAmount(String.valueOf(orderInfo.getPersonalRefundPrice()))
|
||||
.setOrderAmount(String.valueOf(orderInfo.getBusinessAmount()))
|
||||
.setPreServiceFee(String.valueOf(orderInfo.getServicePrice()))
|
||||
.setPostServiceFee(String.valueOf(orderInfo.getAfterSettlementServicePrice()))
|
||||
.setRefundAmount(String.valueOf(orderInfo.getRefundPrice()))
|
||||
.setCustomers(getCustomers(data.getResidentList()))
|
||||
.setStandardItems(data.getItems().getPolicyName())
|
||||
// .setNightRates()
|
||||
.setSupplier("Supplier XYZ")
|
||||
.setAmountFields("Amount A, Amount B")
|
||||
.setOverStandardReason(orderInfo.getFoulReason())
|
||||
.setAgreementHotel(String.valueOf(orderInfo.getProtocolType()));
|
||||
// .setBOOK_ORG_STRUCT_1("Org A")
|
||||
// .setBOOK_ORG_STRUCT_2("Org B")
|
||||
// .setBOOK_ORG_STRUCT_3("Org C")
|
||||
// .setProjectOrderNo("PROJ789")
|
||||
// .setCostCenter("COST123")
|
||||
|
||||
|
||||
return hotelOrderDetail;
|
||||
}
|
||||
|
||||
private List<HotelOrderDetailCustomer> getCustomers(List<Resident> residentList) {
|
||||
|
||||
List<HotelOrderDetailCustomer> list = residentList.stream()
|
||||
.map(resident -> {
|
||||
HotelOrderDetailCustomer customer = new HotelOrderDetailCustomer();
|
||||
customer.setId(Long.valueOf(resident.getEmployeeId()));
|
||||
customer.setUserName(resident.getName());
|
||||
User user = userRepository.findById(Long.valueOf(resident.getEmployeeId()));
|
||||
customer.setGender(user.getGender());
|
||||
customer.setUserCode(resident.getEmployeeCode());
|
||||
customer.setPhone(resident.getContactPhone());
|
||||
return customer;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ public class OrderDetailFactoryImpl implements OrderDetailFactory {
|
|||
orderDetail.setCurrencyType(CurrencyType.getByCode(orderLegData.getCurrencyCode()));
|
||||
orderDetail.setDestinationId(orderLegData.getDestinationId());
|
||||
orderDetail.setOriginId(orderLegData.getOriginId());
|
||||
orderDetail
|
||||
.price(orderLegData.getPrice())
|
||||
.productType(orderLegData.getProductType());
|
||||
return orderDetail;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ public class UserFactoryImpl implements UserFactory {
|
|||
@Override
|
||||
public User create(String employeeNo) {
|
||||
User user = new User();
|
||||
user.setEmployeeNo(Long.valueOf(employeeNo));
|
||||
user.setEmployeeNo(employeeNo);
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
import com.chint.application.dtos.AuthenticationDto;
|
||||
import com.chint.domain.aggregates.order.Client;
|
||||
|
||||
/**
|
||||
* @author wanglf3
|
||||
* @date 2024-02-28
|
||||
* @vsrsion 1.0
|
||||
**/
|
||||
|
||||
public interface ClientRepository {
|
||||
Client save(Client client);
|
||||
|
||||
Client findByClientId(String clientId);
|
||||
}
|
|
@ -14,5 +14,7 @@ public interface LegRepository {
|
|||
|
||||
void saveAll(List<Leg> legs);
|
||||
|
||||
Leg findByLegId(Leg leg);
|
||||
Leg findByLegId(Long legId);
|
||||
|
||||
|
||||
}
|
|
@ -22,4 +22,12 @@ public interface LocationRepository {
|
|||
List<Location> findByName(String localName);
|
||||
|
||||
String locationPathByName(String localName);
|
||||
|
||||
List<Location> findHotCitiesByCityName(List<String> locationNames);
|
||||
|
||||
List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames);
|
||||
|
||||
List<Location> findByNameList(List<Long> locationIds);
|
||||
|
||||
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package com.chint.domain.repository;
|
||||
|
||||
import com.chint.application.dtos.OrderDetailQueryParam;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface OrderDetailRepository {
|
||||
|
||||
Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam);
|
||||
OrderDetail findById(Long orderDetailId);
|
||||
|
||||
List<OrderDetail> findByLegId(Long legId);
|
||||
|
|
|
@ -4,6 +4,6 @@ import com.chint.domain.aggregates.user.User;
|
|||
|
||||
public interface UserRepository {
|
||||
User findById(Long id);
|
||||
User findByUserEmployeeNo(Long employeeNo);
|
||||
User findByUserEmployeeNo(String employeeNo);
|
||||
User save(User user);
|
||||
}
|
|
@ -43,4 +43,6 @@ public class LegDomainService {
|
|||
}
|
||||
return legRepository.save(leg);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_INTERNAL;
|
||||
import static com.chint.infrastructure.constant.LocationConstant.LOCATION_IS_NOT_INTERNAL;
|
||||
|
||||
@Service
|
||||
public class LocationDomainService {
|
||||
|
||||
|
@ -29,16 +32,17 @@ public class LocationDomainService {
|
|||
}
|
||||
|
||||
private List<Location> getLocationsByType(LocationParam locationParam, List<Location> queryByCityName) {
|
||||
System.out.println(queryByCityName);
|
||||
Integer cityType = locationParam.getCityType();
|
||||
return switch (cityType) {
|
||||
case LocationConstant.CITY_TYPE_DOMESTIC -> queryByCityName
|
||||
.stream()
|
||||
.filter(location -> location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH)
|
||||
.filter(location -> location.getIsInternal().equals(LOCATION_IS_INTERNAL)
|
||||
&& location.getLevel().equals(3)).toList();
|
||||
|
||||
case LocationConstant.CITY_TYPE_FOREIGN -> queryByCityName
|
||||
.stream()
|
||||
.filter(location -> !location.getLocationPath().startsWith(LocationConstant.CITY_TYPE_DOMESTIC_PATH)
|
||||
.filter(location -> location.getIsInternal().equals(LOCATION_IS_NOT_INTERNAL)
|
||||
&& location.getLevel().equals(3)).toList();
|
||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
};
|
||||
|
|
|
@ -68,6 +68,12 @@ public class OrderDomainService {
|
|||
|
||||
public List<Leg> queryLocation(List<Leg> list) {
|
||||
list.forEach(leg -> {
|
||||
LegExtensionField legExtensionField = leg.getLegExtensionField();
|
||||
if (legExtensionField != null && legExtensionField.getLocationIds() != null) {
|
||||
List<Long> locationIdsAsLong = legExtensionField.getLocationIdsAsLong();
|
||||
List<Location> byNameList = locationRepository.findByNameList(locationIdsAsLong);
|
||||
legExtensionField.setLocationList(byNameList);
|
||||
}
|
||||
leg.setOriginLocation(locationRepository.findByLocationId(leg.getOriginId()));
|
||||
leg.setDestinationLocation(locationRepository.findByLocationId(leg.getDestinationId()));
|
||||
});
|
||||
|
@ -120,14 +126,17 @@ public class OrderDomainService {
|
|||
Command.of(BPMAuditCommand.class)
|
||||
.orderNo(orderDetail.getOrderNo())
|
||||
.productType(orderDetail.getProductType())
|
||||
.extensionData(orderDetail.getExtensionDataByProductType())
|
||||
.extensionData(orderDetail)
|
||||
.sendToQueue();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ListenTo(command = "BPMAuditCommand", order = 0)
|
||||
public void toBpmAudit(BPMAuditCommand command) {
|
||||
Object data = command.getExtensionData();
|
||||
OrderDetail orderDetail = command.getExtensionData();
|
||||
Object data = orderDetail.getExtensionDataByProductType();
|
||||
RouteOrder routeOrder = routeRepository.queryById(orderDetail.getRouteId());
|
||||
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
||||
ExceedStandardDto exceedStandardDto = switch (command.getProductType()) {
|
||||
case LegConstant.LEG_TYPE_TRAIN -> bpmParamFactory.creatAuditParamByTrain((TrainOrderDetail) data);
|
||||
case LegConstant.LEG_TYPE_AIRPLANE -> bpmParamFactory.creatAuditParamByFlight((FlightOrderDetail) data);
|
||||
|
@ -136,7 +145,7 @@ public class OrderDomainService {
|
|||
case LegConstant.LEG_TYPE_OTHER -> bpmParamFactory.creatAuditParamByOther((OtherOrderDetail) data);
|
||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
};
|
||||
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto).getSuccess(),
|
||||
DelayDispatch.attemptToSend(() -> bpmRequest.exceedStandard(exceedStandardDto, sysCode).getSuccess(),
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,79 @@
|
|||
package com.chint.domain.service.amount_estimate;
|
||||
|
||||
import com.chint.application.queryies.estimate.EstimatePrice;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.service.OrderDomainService;
|
||||
import com.chint.domain.value_object.FlightPriceData;
|
||||
import com.chint.domain.value_object.HotelPriceData;
|
||||
import com.chint.domain.value_object.PriceQueryData;
|
||||
import com.chint.domain.value_object.TrainPriceData;
|
||||
import com.chint.interfaces.rest.ctrip.CTripEstimateRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||
|
||||
@Component
|
||||
public class CTripEstimate implements AmountEstimate {
|
||||
|
||||
@Autowired
|
||||
private CTripEstimateRequest cTripEstimateRequest;
|
||||
|
||||
@Autowired
|
||||
private EstimatePrice estimatePrice;
|
||||
|
||||
@Autowired
|
||||
private OrderDomainService orderDomainService;
|
||||
|
||||
|
||||
@Override
|
||||
public String amountEstimate(Leg leg) {
|
||||
|
||||
// cTripEstimateRequest.generateBaseRequest(null,)
|
||||
|
||||
return null;
|
||||
Integer legType = leg.getLegType();
|
||||
return switch (legType) {
|
||||
case LEG_TYPE_TRAIN -> queryTrainPrice(leg);
|
||||
case LEG_TYPE_AIRPLANE -> queryFlightPrice(leg);
|
||||
case LEG_TYPE_HOTEL -> queryHotelPrice(leg);
|
||||
default -> throw new IllegalStateException("Unexpected value: " + legType);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String amountEstimate(RouteOrder routeOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private String queryFlightPrice(Leg leg) {
|
||||
PriceQueryData queryData = getQueryData(leg);
|
||||
FlightPriceData flightPriceData = estimatePrice.queryFlightPrice(queryData);
|
||||
return flightPriceData.getMaxPrice();
|
||||
}
|
||||
|
||||
private String queryHotelPrice(Leg leg) {
|
||||
PriceQueryData queryData = getQueryData(leg);
|
||||
HotelPriceData hotelPriceData = estimatePrice.queryHotelPrice(queryData);
|
||||
return hotelPriceData.getMaxPrice();
|
||||
}
|
||||
|
||||
private String queryTrainPrice(Leg leg) {
|
||||
PriceQueryData queryData = getQueryData(leg);
|
||||
TrainPriceData trainPriceData = estimatePrice.queryTrainPrice(queryData);
|
||||
return trainPriceData.getMaxPrice();
|
||||
}
|
||||
|
||||
|
||||
private PriceQueryData getQueryData(Leg leg) {
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
PriceQueryData priceQueryData = new PriceQueryData();
|
||||
leg = orderDomainService.queryLocation(List.of(leg)).get(0);
|
||||
priceQueryData.setArriveCity(leg.getDestinationLocation().getLocationName());
|
||||
priceQueryData.setDepartCity(leg.getOriginLocation().getLocationName());
|
||||
priceQueryData.setDepartDate(dateTimeFormatter.format(leg.getStartTime()));
|
||||
priceQueryData.setArriveDate(dateTimeFormatter.format(leg.getEndTime()));
|
||||
return priceQueryData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package com.chint.domain.service.auth;
|
||||
|
||||
import com.chint.application.dtos.AuthenticationDto;
|
||||
import com.chint.application.dtos.OrderSearchResult;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.domain.value_object.UserLoginResult;
|
||||
|
||||
public interface AuthenticateService {
|
||||
UserLoginResult authenticateEmployeeNo(UserLoginParam userLoginParam);
|
||||
|
||||
OrderSearchResult authenticateClient(AuthenticationDto authenticationDto)throws Exception;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
package com.chint.domain.service.auth;
|
||||
|
||||
import com.chint.application.dtos.AuthenticationDto;
|
||||
import com.chint.application.dtos.OrderSearchResult;
|
||||
import com.chint.domain.aggregates.order.Client;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.AuthException;
|
||||
import com.chint.domain.factoriy.user.UserFactory;
|
||||
import com.chint.domain.repository.ClientRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.value_object.UserLoginParam;
|
||||
import com.chint.domain.value_object.UserLoginResult;
|
||||
|
@ -23,6 +28,9 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
|||
private final UserRepository userRepository;
|
||||
private final UserHttpRequest httpRequest;
|
||||
|
||||
@Autowired
|
||||
private ClientRepository clientRepository;
|
||||
|
||||
@Autowired
|
||||
private UserFactory userFactory;
|
||||
|
||||
|
@ -40,9 +48,10 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
|||
|
||||
@Override
|
||||
public UserLoginResult authenticateEmployeeNo(UserLoginParam userLoginParam) {
|
||||
User user = userRepository.findByUserEmployeeNo(Long.parseLong(userLoginParam.getSfno()));
|
||||
if (user != null) {
|
||||
User user = userRepository.findByUserEmployeeNo(userLoginParam.getSfno());
|
||||
if (user != null) {
|
||||
// 部分数据需要通过查询外部的http来获取
|
||||
BaseContext.setCurrentUser(user);
|
||||
user.setCompanyCode(userLoginParam.getCompanyCode());
|
||||
user.setUserLoginParam(userLoginParam);
|
||||
httpRequest.loadUserInfo(user);
|
||||
|
@ -73,4 +82,26 @@ public class AuthenticateServiceImpl implements AuthenticateService {
|
|||
return authenticateEmployeeNo(userLoginParam);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderSearchResult authenticateClient(AuthenticationDto authenticationDto) throws Exception{
|
||||
|
||||
Client client = clientRepository.findByClientId(authenticationDto.getClientid());
|
||||
|
||||
if (client != null){
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put(AuthMessageConstant.CLIENT_ID, client.getClientId());
|
||||
claims.put(AuthMessageConstant.CLIENT_SECRET,client.getClientSecret());
|
||||
|
||||
String jwt = JWTUtil.createJWT(AuthMessageConstant.SECRET,AuthMessageConstant.EXPIRATION_CLIENT_TIME_MS,
|
||||
AuthMessageConstant.SUBJECT,claims);
|
||||
|
||||
OrderSearchResult result = new OrderSearchResult();
|
||||
result.setToken(Token.of(jwt));
|
||||
return result;
|
||||
|
||||
}else {
|
||||
throw new AuthException(AuthMessageConstant.JWT_INVALID);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,16 +2,15 @@ package com.chint.domain.service.leg_event;
|
|||
|
||||
import com.chint.application.commands.*;
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.domain.aggregates.system.SystemCode;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.exceptions.CommandException;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.exceptions.OrderException;
|
||||
import com.chint.domain.factoriy.leg_event.LegEventFactory;
|
||||
import com.chint.domain.factoriy.order.RouteOrderFactory;
|
||||
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
|
||||
import com.chint.domain.repository.LegRepository;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.domain.repository.RouteRepository;
|
||||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.repository.*;
|
||||
import com.chint.domain.service.order_sync.SyncAdapter;
|
||||
import com.chint.domain.value_object.ApprovalLegData;
|
||||
import com.chint.domain.value_object.ApproveLegData;
|
||||
|
@ -22,12 +21,18 @@ import com.chint.infrastructure.constant.LegConstant;
|
|||
import com.chint.infrastructure.constant.RouteConstant;
|
||||
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import com.chint.interfaces.rest.bpm.BPMRequest;
|
||||
import com.chint.interfaces.rest.bpm.dto.JTH3ChangeDto;
|
||||
import com.chint.interfaces.rest.bpm.dto.XNChangeDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.BPMConstant.H3_BPM;
|
||||
import static com.chint.infrastructure.constant.BPMConstant.XNYS_BPM;
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
|
||||
import static com.chint.infrastructure.constant.DataMessageConstant.ORDER_STATUS_ERROR;
|
||||
import static com.chint.infrastructure.constant.RouteConstant.ORDER_STATUS_PREPARE;
|
||||
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
|
||||
|
@ -59,10 +64,16 @@ public class LegEventHandler implements LegEventService {
|
|||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private SystemCodeRepository systemCodeRepository;
|
||||
|
||||
@Autowired
|
||||
private BPMRequest bpmRequest;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void prepareLeg(LegPrepareCommand command) {
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
if (leg.getEventList().isEmpty()) {
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
leg.addEvent(legEvent);
|
||||
|
@ -72,7 +83,7 @@ public class LegEventHandler implements LegEventService {
|
|||
|
||||
@Transactional
|
||||
@Override
|
||||
public void approveLeg(LegApprovalCommand command) {
|
||||
public void approveRoute(RouteApprovalCommand command) {
|
||||
ApproveLegData data = command.getData();
|
||||
RouteOrder routeOrder = routeRepository.findByFakeOrderNoAndSysCode(data.getFakeOrderNo(), data.getSysCode()).reloadStatus();
|
||||
if (routeOrder.getLegItems().isEmpty()) {
|
||||
|
@ -106,13 +117,14 @@ public class LegEventHandler implements LegEventService {
|
|||
public void syncLeg(LegSyncCommand command) {
|
||||
SyncLegData data = command.getData();
|
||||
RouteOrder routeOrder = routeRepository.queryById(data.getRouteId()).reloadStatus();
|
||||
if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
|
||||
throw new CommandException("订单已同步");
|
||||
}
|
||||
// if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
|
||||
// throw new CommandException("订单已同步");
|
||||
// }
|
||||
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
|
||||
throw new CommandException("订单未提交审批");
|
||||
}
|
||||
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) {
|
||||
//这里暂时的策略是只要订单状态是大于提交审批状态 , 就可以同步
|
||||
if (routeOrder.getOrderStatus() >= RouteConstant.ORDER_STATUS_APPROVAL) {
|
||||
String supplierName = data.getSupplierName();
|
||||
routeOrder.setSupplierName(supplierName);
|
||||
//这里order所有的leg触发sync事件
|
||||
|
@ -134,6 +146,13 @@ public class LegEventHandler implements LegEventService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approveLeg(LegApprovalCommand command) {
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
leg.addEvent(legEventFactory.creatLegEvent(command.getLegEventType()));
|
||||
legRepository.save(leg);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) {
|
||||
|
@ -141,7 +160,7 @@ public class LegEventHandler implements LegEventService {
|
|||
String orderNo = data.getSelfOrderNo();
|
||||
RouteOrder routeOrder = routeRepository.findByOrderNo(orderNo);
|
||||
//获取行程规划单创建者作为该订单
|
||||
Long employeeNo = routeOrder.getUserId();
|
||||
String employeeNo = routeOrder.getUserId();
|
||||
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo);
|
||||
BaseContext.setCurrentUser(byUserEmployeeNo);
|
||||
OrderDetail orderDetail;
|
||||
|
@ -153,14 +172,10 @@ public class LegEventHandler implements LegEventService {
|
|||
if (byOrderNo.isEmpty()) {
|
||||
//否则创建新的订单添加到routeOrder
|
||||
orderDetail = orderDetailFactory.create(data)
|
||||
.price(data.getPrice()).productType(data.getProductType());
|
||||
.employeeNo(routeOrder.getUserId());
|
||||
routeOrder.addOrderDetail(orderDetail);
|
||||
routeOrder = routeRepository.save(routeOrder);
|
||||
// OrderDetail orderDetail = routeOrder
|
||||
// .getOrderDetails()
|
||||
// .stream()
|
||||
// .max(Comparator.comparing(OrderDetail::getCreateTime))
|
||||
// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
|
||||
|
||||
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理
|
||||
orderDetail = routeOrder.matchOrderWithLeg(orderDetail);
|
||||
} else {
|
||||
|
@ -173,7 +188,7 @@ public class LegEventHandler implements LegEventService {
|
|||
@Override
|
||||
public ResultContainer orderLeg(LegOrderedCommand command) {
|
||||
//如果筛选事件可能会是错误,需要用户手动添加并修改事件 , 因此会进行额外出发修改下单事件。
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
//因为orderDetail已经进行持久化保存 ,只需要从数据库进行查询
|
||||
OrderDetail orderDetail = orderDetailRepository.findById(command.getOrderDetailId());
|
||||
LegEvent legEvent = legEventFactory
|
||||
|
@ -189,7 +204,7 @@ public class LegEventHandler implements LegEventService {
|
|||
@Override
|
||||
public void payForLeg(LegPayedCommand command) {
|
||||
// PayLegData data = command.getData();
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
leg.addEvent(legEvent);
|
||||
legRepository.save(leg);
|
||||
|
@ -198,7 +213,7 @@ public class LegEventHandler implements LegEventService {
|
|||
@Transactional
|
||||
@Override
|
||||
public void finishLeg(LegFinishedCommand command) {
|
||||
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
|
||||
Leg leg = legRepository.findByLegId(command.getLegId());
|
||||
LegEvent legEvent = legEventFactory.creatLegEvent(command.getLegEventType());
|
||||
leg.addEvent(legEvent);
|
||||
legRepository.save(leg);
|
||||
|
@ -223,4 +238,30 @@ public class LegEventHandler implements LegEventService {
|
|||
routeOrder.addApprovalEvent(approvalEvent);
|
||||
routeRepository.save(routeOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushChangeLegToBpm(BPMLegChangeCommand command) {
|
||||
Leg leg = command.getLeg();
|
||||
Long routeId = leg.getRouteId();
|
||||
RouteOrder routeOrder = routeRepository.queryById(routeId);
|
||||
String sysCode = routeOrder.getApproveOrderNo().getSysCode();
|
||||
SystemCode bySysCode = systemCodeRepository.findBySysCode(sysCode);
|
||||
String bpmCode = bySysCode.getBpmCode();
|
||||
switch (bpmCode) {
|
||||
case H3_BPM -> {
|
||||
JTH3ChangeDto jth3ChangeDto = new JTH3ChangeDto();
|
||||
// jth3ChangeDto.set
|
||||
bpmRequest.change(jth3ChangeDto, sysCode);
|
||||
}
|
||||
case XNYS_BPM -> {
|
||||
XNChangeDto xnChangeDto = new XNChangeDto();
|
||||
bpmRequest.change(xnChangeDto, sysCode);
|
||||
}
|
||||
// case ANYS_BPM -> {
|
||||
// JTH3ChangeDto jth3ChangeDto = new JTH3ChangeDto();
|
||||
// bpmRequest.change(jth3ChangeDto,sysCode);
|
||||
// }
|
||||
default -> throw new NotFoundException(DATA_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,12 @@ public interface LegEventService {
|
|||
void prepareLeg(LegPrepareCommand command);
|
||||
|
||||
//审批事件要从bpm或其他平台接收到一个真实订单
|
||||
void approveLeg(LegApprovalCommand command);
|
||||
void approveRoute(RouteApprovalCommand command);
|
||||
|
||||
void syncLeg(LegSyncCommand command);
|
||||
|
||||
void approveLeg(LegApprovalCommand command);
|
||||
|
||||
//下单事件
|
||||
ResultContainer orderLeg(LegOrderedCommand command);
|
||||
|
||||
|
@ -24,4 +26,6 @@ public interface LegEventService {
|
|||
void finishLeg(LegFinishedCommand command);
|
||||
|
||||
void rejectLeg(LegRejectCommand command);
|
||||
|
||||
void pushChangeLegToBpm(BPMLegChangeCommand command);
|
||||
}
|
|
@ -23,10 +23,10 @@ public class LegEventServiceImpl implements LegEventService {
|
|||
//因为审批是针对整个订单的,因此所有订单下属的行程节点触发审批事件
|
||||
//出发审批提交事件 , 需要生成 差旅单 , 将差旅但提交到供应商 ,
|
||||
//根据command里面选择的数据来讲差旅但提交到不同的实现类当中
|
||||
@ListenTo(command = "LegApprovalCommand", order = 0)
|
||||
@ListenTo(command = "RouteApprovalCommand", order = 0)
|
||||
@Override
|
||||
public void approveLeg(LegApprovalCommand command) {
|
||||
legEventHandler.approveLeg(command);
|
||||
public void approveRoute(RouteApprovalCommand command) {
|
||||
legEventHandler.approveRoute(command);
|
||||
}
|
||||
|
||||
//这里需要获取同步类,价格routeOrder同步到供应商
|
||||
|
@ -36,6 +36,13 @@ public class LegEventServiceImpl implements LegEventService {
|
|||
legEventHandler.syncLeg(command);
|
||||
}
|
||||
|
||||
|
||||
@ListenTo(command = "LegApprovalCommand", order = 0)
|
||||
@Override
|
||||
public void approveLeg(LegApprovalCommand command) {
|
||||
legEventHandler.approveLeg(command);
|
||||
}
|
||||
|
||||
//下单时间要求回传,需要付款的金额,以及生成对于的行程订单号,如果没有行程订单号根据地点和时间进行匹配
|
||||
@ListenTo(command = "LegOrderedCommand", order = 0)
|
||||
@Override
|
||||
|
@ -59,7 +66,7 @@ public class LegEventServiceImpl implements LegEventService {
|
|||
@Override
|
||||
@ListenTo(command = "LegFinishedCommand", order = 0)
|
||||
public void finishLeg(LegFinishedCommand command) {
|
||||
|
||||
legEventHandler.finishLeg(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -67,4 +74,9 @@ public class LegEventServiceImpl implements LegEventService {
|
|||
public void rejectLeg(LegRejectCommand command) {
|
||||
legEventHandler.rejectLeg(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pushChangeLegToBpm(BPMLegChangeCommand command) {
|
||||
legEventHandler.pushChangeLegToBpm(command);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,8 @@ public class CTripOrderSyncAdapter implements SupplierOrderSync {
|
|||
}
|
||||
|
||||
private ApprovalRequest getApprovalRequestParam(RouteOrder order) {
|
||||
// RankInfo rankInfo = RankInfo.of(order.getStandardLevel());
|
||||
RankInfo rankInfo = RankInfo.of("测试职级");
|
||||
RankInfo rankInfo = RankInfo.of(order.getStandardLevel());
|
||||
// RankInfo rankInfo = RankInfo.of("测试职级");
|
||||
String employeeNo = String.valueOf(order.getUserId());
|
||||
ApprovalRequest approvalRequestParam = ApprovalRequest
|
||||
.buildApproval(order.getRouteOrderNo(), String.valueOf(employeeNo), rankInfo);
|
||||
|
|
|
@ -1,84 +1,129 @@
|
|||
package com.chint.domain.service.supplier;
|
||||
|
||||
import com.chint.domain.aggregates.order.Location;
|
||||
import com.chint.domain.repository.LocationRepository;
|
||||
import com.chint.domain.value_object.OrderLegData;
|
||||
import com.chint.domain.value_object.SupplierCallbackData;
|
||||
import com.chint.infrastructure.constant.OrderConstant;
|
||||
import com.chint.interfaces.rest.ly.dto.ResultBackHotel;
|
||||
import com.chint.interfaces.rest.ly.dto.carorderdatapushback.CarDetailResult;
|
||||
import com.chint.interfaces.rest.ly.dto.flydatapushback.FlyDetailResult;
|
||||
import com.chint.interfaces.rest.ly.dto.hotelorderdatapushbach.HotelDetailResult;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.car.CarDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.filght.FlightOrderDetail;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.hotel.HotelDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.search.response.train.TrainDetailResponse;
|
||||
import com.chint.interfaces.rest.ly.dto.trainorderdatapushback.TrainDetailResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.LegConstant.LEG_TYPE_TRAIN;
|
||||
import static com.chint.infrastructure.constant.LegConstant.*;
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_L_Y;
|
||||
|
||||
@Component
|
||||
public class LYOrderDataAdapter implements OrderDataAdapter {
|
||||
|
||||
@Autowired
|
||||
private LocationRepository locationRepository;
|
||||
|
||||
@Override
|
||||
public Optional<OrderLegData> adapt(SupplierCallbackData supplierData) {
|
||||
return switch (supplierData.getProductType()) {
|
||||
//火车
|
||||
case 0 -> trainDataProcess((TrainDetailResponse) supplierData.getData());
|
||||
case 0 -> trainDataProcess((TrainDetailResult) supplierData.getData());
|
||||
//用车
|
||||
case 1 -> carDateProcess((CarDetailResponse) supplierData.getData());
|
||||
case 1 -> carDateProcess((CarDetailResult) supplierData.getData());
|
||||
//飞机
|
||||
case 2 -> flightDataProcess((FlightOrderDetail) supplierData.getData());
|
||||
case 2 -> flightDataProcess((FlyDetailResult) supplierData.getData());
|
||||
//酒店
|
||||
case 3 -> hotelDateProcess((HotelDetailResponse) supplierData.getData());
|
||||
case 3 -> hotelDateProcess((HotelDetailResult) supplierData.getData());
|
||||
//其它为空
|
||||
default -> Optional.empty();
|
||||
};
|
||||
}
|
||||
|
||||
private Optional<OrderLegData> trainDataProcess(TrainDetailResponse trainDetailResponse) {
|
||||
TrainDetailResponse.TrainDetailData data = trainDetailResponse.getData();
|
||||
private Optional<OrderLegData> trainDataProcess(TrainDetailResult trainDetailResult) {
|
||||
TrainDetailResponse.TrainDetailData data = trainDetailResult.getTrainDetailResponse().getData();
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TRAIN)
|
||||
.outOrderNo(data.getOrderNo())
|
||||
.selfOrderNo(data.getOutOrderNo())
|
||||
.price(String.valueOf(data.getTotalAmount()))
|
||||
.actualOrderNo(data.getOutOrderNo())
|
||||
.outOrderNo(data.getOutOrderNo())
|
||||
.selfOrderNo(data.getTravelData().getTravelApplyNo())
|
||||
.trainOrderDetailData(trainDetailResult)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
private Optional<OrderLegData> hotelDateProcess(HotelDetailResponse hotelDetailResponse) {
|
||||
HotelDetailResponse.Data data = hotelDetailResponse.getData();
|
||||
private Optional<OrderLegData> hotelDateProcess(HotelDetailResult hotelDetailResult) {
|
||||
HotelDetailResponse.Data data = hotelDetailResult.getHotelDetailResponse().getData();
|
||||
ResultBackHotel.DataObject dataObject = hotelDetailResult.getDataObject();
|
||||
String cityName = data.getHotelInfo().getCityName();
|
||||
long cityId = data.getHotelInfo().getCityId();
|
||||
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TRAIN)
|
||||
.productType(LEG_TYPE_HOTEL)
|
||||
.outOrderNo(data.getOrderInfo().getOrderSerialNo())
|
||||
.price(String.valueOf(data.getOrderInfo().getTotalPrice()))
|
||||
.selfOrderNo(dataObject.getTravelData().getTravelApplyNo())
|
||||
.actualOrderNo(data.getOrderInfo().getOrderSerialNo())
|
||||
.hotelOrderDetailData(hotelDetailResult)
|
||||
.orderTime(data.getOrderInfo().getCreateTime())
|
||||
.startTime(data.getOrderInfo().getOriginalCheckInDate())
|
||||
.endTime(data.getOrderInfo().getOriginalCheckOutDate())
|
||||
.orderStatus(hotelState(data.getOrderInfo().getOrderStatusDesc()))
|
||||
.originOrderStatus(data.getOrderInfo().getOrderStatusDesc())
|
||||
.originId(cityId)
|
||||
.originName(cityName)
|
||||
.destinationId(cityId)
|
||||
.destinationName(cityName)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
public Integer hotelState(String subNotifyType) {
|
||||
return switch (subNotifyType) {
|
||||
case "确认中" -> OrderConstant.ORDER_EVENT_PAYED;//确认中
|
||||
case "待入住" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单,
|
||||
case "已退房","已入住" -> OrderConstant.ORDER_EVENT_FINISH;//已完成
|
||||
case "已取消" -> OrderConstant.ORDER_EVENT_CANCEL;//取消
|
||||
case "待提交" -> OrderConstant.ORDER_EVENT_PREPARE;//未下单
|
||||
case "待支付" -> OrderConstant.ORDER_EVENT_ORDERED;//已下单
|
||||
default -> -99;
|
||||
};
|
||||
}
|
||||
|
||||
private Optional<OrderLegData> carDateProcess(CarDetailResponse carDetailResponse) {
|
||||
CarDetailResponse.Data data = carDetailResponse.getData();
|
||||
private Optional<OrderLegData> carDateProcess(CarDetailResult carDetailResult) {
|
||||
CarDetailResponse.Data data = carDetailResult.getCarDetailResponse().getData();
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TRAIN)
|
||||
.outOrderNo(data.getOrderNo())
|
||||
.productType(LEG_TYPE_TAXI)
|
||||
.outOrderNo(data.getOrderSerialNo())
|
||||
.price(String.valueOf(data.getTotalAmount()))
|
||||
.actualOrderNo(data.getOutOrderNo())
|
||||
.selfOrderNo(data.getTravelData().getTravelApplyNo())
|
||||
.carOrderDetailData(carDetailResult)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
private Optional<OrderLegData> flightDataProcess(FlightOrderDetail flightOrderDetail) {
|
||||
FlightOrderDetail.Data data = flightOrderDetail.getData();
|
||||
private Optional<OrderLegData> flightDataProcess(FlyDetailResult flyDetailResult) {
|
||||
FlightOrderDetail.Data data = flyDetailResult.getFlightOrderDetail().getData();
|
||||
return Optional.of(
|
||||
OrderLegData.builder()
|
||||
.productType(LEG_TYPE_TRAIN)
|
||||
.productType(LEG_TYPE_AIRPLANE)
|
||||
// .orderNo(data.get())
|
||||
// .price(String.valueOf( data.getTotalAmount()))
|
||||
// .actualOrderNo(data.getOutOrderNo())
|
||||
.selfOrderNo(data.getTravelData().getTravelApplyNo())
|
||||
.flightOrderDetailData(flyDetailResult)
|
||||
.supplierName(SUPPLIER_L_Y)
|
||||
.build()
|
||||
);
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SupplierServiceImpl implements SupplierService {
|
|||
Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData);
|
||||
if (data.isPresent()) {
|
||||
//获取使用RouteUpdateOrderCommand命令创建的orderDetail
|
||||
OrderLegData orderLegData = data.get();
|
||||
OrderLegData orderLegData = data.get();
|
||||
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(orderLegData).sendToQueue();
|
||||
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
|
||||
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();
|
||||
|
|
|
@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class LegExtensionFieldData {
|
||||
@ApiModelProperty("其他费用类型")
|
||||
|
@ -16,4 +18,6 @@ public class LegExtensionFieldData {
|
|||
private String destinationDescription;
|
||||
@ApiModelProperty("预估金额")
|
||||
private String estimatedAmount;
|
||||
@ApiModelProperty("地理位置id列表")
|
||||
private List<Long> locationIds;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,10 @@ public class OrderLegData {
|
|||
private String orderTime; //下单时间
|
||||
private String startTime; //开始时间
|
||||
private String endTime; //结束时间
|
||||
private Long originId;
|
||||
private Long originId;
|
||||
private String originName;
|
||||
private Long destinationId;
|
||||
private String destinationName;
|
||||
private String currencyCode;
|
||||
|
||||
private Object carOrderDetailData;
|
||||
|
@ -31,7 +33,6 @@ public class OrderLegData {
|
|||
private Object otherOrderDetailData;
|
||||
|
||||
|
||||
|
||||
private OrderLegData(Builder builder) {
|
||||
this.actualOrderNo = builder.actualOrderNo;
|
||||
this.outOrderNo = builder.outOrderNo;
|
||||
|
@ -74,7 +75,8 @@ public class OrderLegData {
|
|||
private String endTime; //结束时间
|
||||
private Long originId;
|
||||
private Long destinationId;
|
||||
|
||||
private String originName;
|
||||
private String destinationName;
|
||||
private String currencyCode;
|
||||
private Object carOrderDetailData;
|
||||
private Object trainOrderDetailData;
|
||||
|
@ -82,6 +84,7 @@ public class OrderLegData {
|
|||
private Object flightOrderDetailData;
|
||||
private Object otherOrderDetailData;
|
||||
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
|
@ -89,18 +92,37 @@ public class OrderLegData {
|
|||
this.carOrderDetailData = carOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder originName(String originName) {
|
||||
this.originName = originName;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder destinationName(String destinationName) {
|
||||
this.destinationName = destinationName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setDestinationName(String destinationName) {
|
||||
this.destinationName = destinationName;
|
||||
}
|
||||
|
||||
public Builder trainOrderDetailData(Object trainOrderDetailData) {
|
||||
this.trainOrderDetailData = trainOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder hotelOrderDetailData(Object hotelOrderDetailData) {
|
||||
this.hotelOrderDetailData = hotelOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder flightOrderDetailData(Object flightOrderDetailData) {
|
||||
this.flightOrderDetailData = flightOrderDetailData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder otherOrderDetailData(Object otherOrderDetailData) {
|
||||
this.otherOrderDetailData = otherOrderDetailData;
|
||||
return this;
|
||||
|
@ -115,18 +137,23 @@ public class OrderLegData {
|
|||
this.orderTime = orderTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder startTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder endTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Builder originId(Long originId) {
|
||||
this.originId = originId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder destinationId(Long destinationId) {
|
||||
this.destinationId = destinationId;
|
||||
return this;
|
||||
|
|
|
@ -7,4 +7,6 @@ public class PriceQueryData {
|
|||
private String departCity;
|
||||
private String arriveCity;
|
||||
private String departDate;
|
||||
private String arriveDate;
|
||||
private Integer ifRound;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,17 @@ package com.chint.domain.value_object;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SyncLegData {
|
||||
private Long routeId;
|
||||
private List<Long> routeIds;
|
||||
private String supplierName;
|
||||
public static SyncLegData of( Long routeId,String supplierName){
|
||||
SyncLegData syncLegData = new SyncLegData();
|
||||
syncLegData.setSupplierName(supplierName);
|
||||
syncLegData.setRouteId(routeId);
|
||||
return syncLegData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class TrainPriceData {
|
|||
}
|
||||
|
||||
@Data
|
||||
private static class SeatInfo {
|
||||
public static class SeatInfo {
|
||||
private String seatName;
|
||||
private String seatPrice;
|
||||
private String seatCode;
|
||||
|
|
|
@ -21,6 +21,16 @@ public class UserLoginParam {
|
|||
|
||||
private String timespan;
|
||||
|
||||
private String code;
|
||||
|
||||
public UserLoginParam(String sfno, String syscode, String billcode, String companyCode, String timespan) {
|
||||
this.sfno = sfno;
|
||||
this.syscode = syscode;
|
||||
this.billcode = billcode;
|
||||
this.companyCode = companyCode;
|
||||
this.timespan = timespan;
|
||||
}
|
||||
|
||||
public static UserLoginParam of(String json) {
|
||||
Gson gson = new Gson();
|
||||
return gson.fromJson(json, UserLoginParam.class);
|
||||
|
|
|
@ -34,4 +34,13 @@ public class AuthMessageConstant {
|
|||
public static final String SUBJECT = "EmployeeNo";
|
||||
public static final long EXPIRATION_TIME_MS = 3600000L; // 1小时过期时间
|
||||
public static final String HEADER_TOKEN = "token";
|
||||
public static final String HEADER_TOKEN_UP_CASE = "Token";
|
||||
|
||||
public static final String CLIENT_ID = "有效的 CLIENT_id ";
|
||||
|
||||
public static final String CLIENT_SECRET = "有效的 CLIENT_SECRET";
|
||||
|
||||
public static final String HEADER_CLIENT_CASE = "Client";
|
||||
public static final long EXPIRATION_CLIENT_TIME_MS = 10800000L; // 3小时过期时间
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,19 @@ package com.chint.infrastructure.constant;
|
|||
public class BPMConstant {
|
||||
//BPM
|
||||
|
||||
public static final String H3BPM = "H3BPM";
|
||||
public static final String H3BPM_EXCEED_STANDARD_URL = "/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";
|
||||
public static final String H3_BPM = "H3BPM";
|
||||
public static final String FSSC = "FSSC";
|
||||
public static final String XN_FSSC = "XNFSSC";
|
||||
public static final String XNYS_BPM = "XNYSBPM";
|
||||
public static final String AN_FSSC = "ANFSSC";
|
||||
public static final String ANYS_BPM = "ANYSBPM";
|
||||
public static final String H3BPM_EXCEED_STANDARD_URL = "/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";//H3BPM
|
||||
public static final String XNBPM_TOKEN_URL = "/api/login/crm/ajax";//新能云枢获取token和用户id
|
||||
public static final String XNBPM_EXCEED_STANDARD_URL = "/api/openapi/v3/workflow/start";//新能云枢发起流程
|
||||
|
||||
public static final String CLIENT_ID = "xclient";//客户端id
|
||||
public static final String CLIENT_SECRET = "0a417ecce58c31b32364ce19ca8fcd15";//密钥
|
||||
|
||||
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
|
||||
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
|
||||
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称
|
||||
|
|
|
@ -27,6 +27,7 @@ public class CTripConstant {
|
|||
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_AUDIT_PATH = "/corpservice/AuditService/Audit";
|
||||
public static final String C_TRIP_FLIGHT_CITY_PATH = "/CorpOpenapi/Position/SearchFlightCityInfo";
|
||||
public static final String C_TRIP_REQUEST_SECRET = "zhengtai2024_nEbmKfOo";
|
||||
public static final String C_TRIP_AUDIT_ACTION_SUCCESS = "T";
|
||||
public static final String C_TRIP_AUDIT_ACTION_FAIL = "F";
|
||||
|
|
|
@ -5,8 +5,10 @@ public class FSSCConstant {
|
|||
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";//申请单类型
|
||||
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";//其他
|
||||
public static final String FSSC_LOGIN_PATH = "/ecs-console/api/rest/loginWeaver?loginName=";//申请单类型
|
||||
public static final String FSSC_LOGIN_PATH_APPROVAL = "/ecs-console/api/rest/pushNewOA?billDefineId=fcc76666fb1211e98e2019f4db5548fd&loginName=";//申请单类型
|
||||
}
|
||||
|
|
|
@ -5,17 +5,19 @@ public class LegConstant {
|
|||
public static final int LEG_STATUS_PREPARE = 0;
|
||||
public static final String LEG_STATUS_PREPARE_NAME = "规划中";
|
||||
public static final int LEG_STATUS_APPROVAL = 1;
|
||||
public static final String LEG_STATUS_APPROVAL_NAME = "提交审批";
|
||||
public static final String LEG_STATUS_APPROVAL_NAME = "未同步";
|
||||
public static final int LEG_STATUS_NOT_ORDERED = 2;
|
||||
public static final String LEG_STATUS_NOT_ORDERED_NAME = "未下单";
|
||||
public static final int LEG_STATUS_ORDERED = 3;
|
||||
public static final String LEG_STATUS_ORDERED_NAME = "已下单";
|
||||
public static final int LEG_STATUS_PAYED = 4;
|
||||
public static final int LEG_STATUS_PAYED = 5;
|
||||
public static final String LEG_STATUS_PAYED_NAME = "已付款";
|
||||
public static final int LEG_STATUS_FINISH = 5;
|
||||
public static final int LEG_STATUS_FINISH = 9;
|
||||
public static final String LEG_STATUS_FINISH_NAME = "已结束";
|
||||
public static final int LEG_STATUS_REJECT = -1;
|
||||
public static final String LEG_STATUS_REJECT_NAME = "审批未通过";
|
||||
|
||||
|
||||
// 规划节点运输方式
|
||||
public static final int LEG_TYPE_TRAIN = 0;
|
||||
public static final String LEG_TYPE_TRAIN_NAME = "火车";
|
||||
|
@ -27,7 +29,7 @@ public class LegConstant {
|
|||
public static final String LEG_TYPE_HOTEL_NAME = "酒店";
|
||||
public static final String LEG_TYPE_HOTEL_EN_NAME = "Hotel";
|
||||
public static final int LEG_TYPE_TAXI = 3;
|
||||
public static final String LEG_TYPE_TAXI_NAME = "出租车";
|
||||
public static final String LEG_TYPE_TAXI_NAME = "打车";
|
||||
public static final String LEG_TYPE_TAXI_EN_NAME = "Traffic";
|
||||
public static final int LEG_TYPE_OTHER = 4;
|
||||
public static final String LEG_TYPE_OTHER_NAME = "其他";
|
||||
|
@ -56,9 +58,9 @@ public class LegConstant {
|
|||
public static final String LEG_EVENT_NOT_ORDERED_NAME = "同步事件";
|
||||
public static final int LEG_EVENT_ORDERED = 3;
|
||||
public static final String LEG_EVENT_ORDERED_NAME = "下单事件";
|
||||
public static final int LEG_EVENT_PAYED = 4;
|
||||
public static final int LEG_EVENT_PAYED = 5;
|
||||
public static final String LEG_EVENT_PAYED_NAME = "付款事件";
|
||||
public static final int LEG_EVENT_FINISH = 5;
|
||||
public static final int LEG_EVENT_FINISH = 9;
|
||||
public static final String LEG_EVENT_FINISH_NAME = "结束事件";
|
||||
public static final int LEG_EVENT_REJECT = -1;
|
||||
public static final String LEG_EVENT_REJECT_NAME = "拒绝事件";
|
||||
|
|
|
@ -2,7 +2,10 @@ package com.chint.infrastructure.constant;
|
|||
|
||||
public class LocationConstant {
|
||||
// 城市类型
|
||||
public static final int CITY_TYPE_DOMESTIC = 0;//国内
|
||||
public static final int CITY_TYPE_DOMESTIC = 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 = 0;//国外
|
||||
|
||||
public static final int LOCATION_IS_INTERNAL = 1;//是国内
|
||||
public static final int LOCATION_IS_NOT_INTERNAL = 0;//是国外
|
||||
}
|
||||
|
|
|
@ -5,14 +5,14 @@ public class RouteConstant {
|
|||
public static final int ORDER_STATUS_PREPARE = 0;
|
||||
public static final String ORDER_STATUS_PREPARE_NAME = "规划中";
|
||||
public static final int ORDER_STATUS_APPROVAL = 1;
|
||||
public static final String ORDER_STATUS_APPROVAL_NAME = "提交审批";
|
||||
public static final String ORDER_STATUS_APPROVAL_NAME = "未同步";
|
||||
public static final int ORDER_STATUS_NOT_ORDERED = 2;
|
||||
public static final String ORDER_STATUS_NOT_ORDERED_NAME = "未下单";
|
||||
public static final int ORDER_STATUS_ORDERED = 3;
|
||||
public static final String ORDER_STATUS_ORDERED_NAME = "已下单";
|
||||
public static final int ORDER_STATUS_PAYED = 4;
|
||||
public static final String ORDER_STATUS_PAYED_NAME = "已付款";
|
||||
public static final int ORDER_STATUS_FINISH = 5;
|
||||
public static final int ORDER_STATUS_FINISH = 9;
|
||||
public static final String ORDER_STATUS_FINISH_NAME = "已结束";
|
||||
public static final int ORDER_STATUS_REJECT = -1;
|
||||
public static final String ORDER_STATUS_REJECT_NAME = "审批拒绝";
|
||||
|
|
|
@ -39,9 +39,18 @@ public class GlobalExceptionHandler {
|
|||
}
|
||||
|
||||
@ExceptionHandler(AuthException.class)
|
||||
public Result<String> handleDuplicateException(HttpServletRequest request, AuthException e) {
|
||||
public Result<String> handleAuthException(HttpServletRequest request, AuthException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
@ExceptionHandler(JwtExpiredException.class)
|
||||
public Result<String> handleJwtExpiredException(HttpServletRequest request, JwtExpiredException e) {
|
||||
return Result.tokenExpired(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(SSOLoginException.class)
|
||||
public Result<String> handleSSOLoginException(HttpServletRequest request, SSOLoginException e) {
|
||||
return Result.ssoLoginFail(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
public Result<String> handleException(Exception ex) {
|
||||
|
|
|
@ -1,12 +1,18 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.domain.aggregates.location.CityEntity;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.CityRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcCityRepository;
|
||||
import com.chint.interfaces.rest.ctrip.CTripFlightCitySearchRequest;
|
||||
import com.chint.interfaces.rest.ctrip.dto.city.FlightCitySearchResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
|
||||
|
||||
@Repository
|
||||
public class CityRepositoryImpl implements CityRepository {
|
||||
|
@ -14,6 +20,9 @@ public class CityRepositoryImpl implements CityRepository {
|
|||
@Autowired
|
||||
private JdbcCityRepository jdbcCityRepository;
|
||||
|
||||
@Autowired
|
||||
private CTripFlightCitySearchRequest cTripFlightCitySearchRequest;
|
||||
|
||||
@Override
|
||||
public void saveAll(List<CityEntity> cities) {
|
||||
jdbcCityRepository.save(cities.get(0));
|
||||
|
@ -22,7 +31,22 @@ public class CityRepositoryImpl implements CityRepository {
|
|||
|
||||
@Override
|
||||
public CityEntity findByCityName(String name) {
|
||||
return jdbcCityRepository.findByCityName(name);
|
||||
}
|
||||
CityEntity byCityName = jdbcCityRepository.findByCityName(name);
|
||||
if (byCityName == null) {
|
||||
Optional<FlightCitySearchResponse.DataItem> optional = Optional.ofNullable(
|
||||
cTripFlightCitySearchRequest.getFlightCity(name, 1).getData()
|
||||
.stream()
|
||||
.filter(dataItem -> dataItem.getType() == 5 || dataItem.getType() == 4)
|
||||
.toList()
|
||||
.get(0));
|
||||
if (optional.isPresent()) {
|
||||
FlightCitySearchResponse.DataItem dataItem = optional.get();
|
||||
CityEntity cityEntity = CityEntity.copyFrom(dataItem);
|
||||
jdbcCityRepository.save(cityEntity);
|
||||
return cityEntity;
|
||||
} else {
|
||||
throw new NotFoundException(NOT_FOUND);
|
||||
}
|
||||
}return byCityName;}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.application.dtos.AuthenticationDto;
|
||||
import com.chint.domain.aggregates.order.Client;
|
||||
import com.chint.domain.repository.ClientRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcClientRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author wanglf3
|
||||
* @date 2024-02-28
|
||||
* @vsrsion 1.0
|
||||
**/
|
||||
|
||||
@Repository
|
||||
public class ClientRepositoryImpl implements ClientRepository {
|
||||
|
||||
@Autowired
|
||||
private JdbcClientRepository jdbcClientRepository;
|
||||
@Override
|
||||
public Client save(Client client) {
|
||||
return jdbcClientRepository.save(client);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Client findByClientId(String clientId){
|
||||
return jdbcClientRepository.findByClientId(clientId);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -39,7 +39,7 @@ public class LegRepositoryImpl implements LegRepository {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Leg findByLegId(Leg leg) {
|
||||
return legRepository.findById(leg.getLegId()).orElseThrow(()->new NotFoundException(NOT_FOUND));
|
||||
public Leg findByLegId(Long legId) {
|
||||
return legRepository.findById(legId).orElseThrow(()->new NotFoundException(NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,12 +63,12 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
|
||||
@Override
|
||||
public List<Location> findByName(LocationParam locationParam) {
|
||||
return jdbcLocationRepository.findByLocationNameContaining(locationParam.getQueryWord());
|
||||
return jdbcLocationRepository.findByLocationPathNameContaining(locationParam.getQueryWord());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Location> findByName(String localName) {
|
||||
return jdbcLocationRepository.findByLocationNameContaining(localName);
|
||||
return jdbcLocationRepository.findByLocationPathNameContaining(localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,4 +76,32 @@ public class LocationRepositoryImpl implements LocationRepository {
|
|||
Location byLocationName = jdbcLocationRepository.findByLocationName(localName);
|
||||
return byLocationName.getLocationPathName().replace("_", "、");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Location> findByNameList(List<Long> locationIds) {
|
||||
return jdbcLocationRepository.findByLocationIdIn(locationIds);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Location> findHotCitiesByCityName(List<String> locationNames) {
|
||||
return jdbcLocationRepository.findByLocationNameInAndLocationPathContainingAndLevel(locationNames,"3106_1_",3);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames){
|
||||
List<Location> hotCities =
|
||||
jdbcLocationRepository.findByLocationPathNameInAndLevel(locationNames,3);
|
||||
return hotCities;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public List<Location> findHotIntnationalCitiesByCityName(List<String> locationNames) {
|
||||
// List<Location> hotCities =
|
||||
// jdbcLocationRepository.findByLocationPathNameAndLevel(locationNames,3);
|
||||
// return hotCities;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package com.chint.infrastructure.repository;
|
||||
|
||||
import com.chint.application.dtos.OrderDetailQueryParam;
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import com.chint.domain.exceptions.NotFoundException;
|
||||
import com.chint.domain.repository.OrderDetailRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||
import com.chint.infrastructure.util.BaseContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -17,6 +22,14 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
|
|||
@Autowired
|
||||
private JdbcOrderDetailRepository orderDetailRepository;
|
||||
|
||||
@Override
|
||||
public Page<OrderDetail> pageQuery(OrderDetailQueryParam orderDetailQueryParam) {
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(orderDetailQueryParam.getPageNum() - 1, orderDetailQueryParam.getPageSize(), Sort.by("updateTime"));
|
||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo();
|
||||
return orderDetailRepository.findByEmployeeNo(employeeNo, pageRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDetail findById(Long orderDetailId) {
|
||||
return orderDetailRepository.findById(orderDetailId).orElseThrow(() -> new NotFoundException(NOT_FOUND));
|
||||
|
|
|
@ -49,11 +49,11 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
@Override
|
||||
public Page<RouteOrder> findByOrderNoFuzzy(OrderQueryData orderQueryData) {
|
||||
PageRequest sort = PageRequest
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("updateTime"));
|
||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||
return jdbcRouteRepository
|
||||
.findByUserIdAndRouteOrderNoContainingOrApproveOrderNo_CreatorAndRouteOrderNoContaining(
|
||||
Long.valueOf(employeeNo),
|
||||
employeeNo,
|
||||
orderQueryData.getOrderNo(),
|
||||
employeeNo,
|
||||
orderQueryData.getOrderNo(),
|
||||
|
@ -63,10 +63,10 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
@Override
|
||||
public Page<RouteOrder> findByInstructions(OrderQueryData orderQueryData) {
|
||||
PageRequest sort = PageRequest
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("updateTime"));
|
||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||
return jdbcRouteRepository.findByUserIdAndApproveOrderNo_InstructionsContainingOrApproveOrderNo_CreatorAndApproveOrderNo_InstructionsContaining(
|
||||
Long.valueOf(employeeNo),
|
||||
employeeNo,
|
||||
orderQueryData.getInstructions(),
|
||||
employeeNo,
|
||||
orderQueryData.getInstructions(),
|
||||
|
@ -81,10 +81,10 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
@Override
|
||||
public PageResult<RouteOrder> pageQuery(OrderQueryData orderQueryData) {
|
||||
PageRequest sort = PageRequest
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("sort"));
|
||||
.of(orderQueryData.getPageNum() - 1, orderQueryData.getPageSize(), Sort.by("updateTime"));
|
||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||
Page<RouteOrder> byUserId = jdbcRouteRepository
|
||||
.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo, sort);
|
||||
.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(employeeNo, employeeNo, sort);
|
||||
List<RouteOrder> orders = byUserId.toList();
|
||||
orders.forEach(RouteOrder::reloadStatus);
|
||||
return new PageResult<>(byUserId.getTotalElements(), orders);
|
||||
|
@ -93,6 +93,6 @@ public class RouteRepositoryImpl implements RouteRepository {
|
|||
@Override
|
||||
public List<RouteOrder> findByActualOrderNoNotNull(OrderQueryData orderQueryData) {
|
||||
String employeeNo = BaseContext.getCurrentUser().getEmployeeNo().toString();
|
||||
return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(Long.valueOf(employeeNo), employeeNo);
|
||||
return jdbcRouteRepository.findByUserIdAndApproveOrderNo_ActualOrderNoNotNullOrApproveOrderNo_CreatorAndApproveOrderNo_ActualOrderNoNotNull(employeeNo, employeeNo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public class UserRepositoryImpl implements UserRepository {
|
|||
}
|
||||
|
||||
@Override
|
||||
public User findByUserEmployeeNo(Long employeeNo) {
|
||||
public User findByUserEmployeeNo(String employeeNo) {
|
||||
return jdbcUserRepository.findByEmployeeNo(employeeNo);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.Client;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author wanglf3
|
||||
* @date 2024-02-28
|
||||
* @vsrsion 1.0
|
||||
**/
|
||||
|
||||
@Repository
|
||||
public interface JdbcClientRepository extends CrudRepository<Client,Long> {
|
||||
|
||||
Client findByClientId(String clientId);
|
||||
}
|
|
@ -6,6 +6,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
|
@ -20,7 +21,19 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
|
|||
|
||||
List<Location> findByFirstPinYin(String firstPinYin);
|
||||
|
||||
List<Location> findByLocationNameContaining(String locationName);
|
||||
List<Location> findByLocationPathNameContaining(String locationName);
|
||||
|
||||
Location findByLocationName(String locationName);
|
||||
|
||||
List<Location> findByLocationNameIn(Collection<String> locationName);
|
||||
|
||||
|
||||
List<Location> findByLocationIdIn(Collection<Long> locationId);
|
||||
|
||||
List<Location> findByLocationNameInAndLocationPathContainingAndLevel(Collection<String> locationName,
|
||||
String locationPath,
|
||||
Integer level);
|
||||
|
||||
List<Location> findByLocationPathNameInAndLevel(Collection<String> locationPathName,Integer level);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.chint.infrastructure.repository.jdbc;
|
||||
|
||||
import com.chint.domain.aggregates.order.OrderDetail;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
@ -12,4 +14,6 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
OrderDetail findByOrderNo(String orderNo);
|
||||
|
||||
List<OrderDetail> findByLegId(Long legId);
|
||||
|
||||
Page<OrderDetail> findByEmployeeNo(String employeeNo, Pageable pageable);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue