Compare commits

..

No commits in common. "5b8a9a3ac265d7fc9a0fd087e577f7d7181d841e" and "07685dbd355b19efc4fbbece4499d6e524fbc6c2" have entirely different histories.

70 changed files with 257 additions and 888 deletions

View File

@ -1,6 +1,5 @@
package com.chint.application.commands;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.infrastructure.echo_framework.command.Command;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -12,7 +11,6 @@ public class OrderStatusChangeCommand extends Command {
private String orderNo;
private String outStatus;
private Integer orderEventType;
private OrderDetail orderDetail;
public OrderStatusChangeCommand eventType(Integer eventType) {
this.orderEventType = eventType;
@ -28,9 +26,4 @@ public class OrderStatusChangeCommand extends Command {
this.outStatus = outStatus;
return this;
}
public OrderStatusChangeCommand orderDetail(OrderDetail orderDetail) {
this.orderDetail = orderDetail;
return this;
}
}

View File

@ -1,12 +0,0 @@
package com.chint.application.dtos.trip;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class ExtendedFieldParam implements Serializable {
@JsonProperty("isExceed")
private boolean isExceed;
}

View File

@ -62,7 +62,7 @@ public class ScheduleDetail {
protected String ParentScheduleNum;
@JsonProperty("ExtendedField")
protected ExtendedFieldParam ExtendedField;
protected String ExtendedField;
@JsonProperty("QuoteGroupNum")
protected String QuoteGroupNum;
@ -114,8 +114,6 @@ public class ScheduleDetail {
@JsonProperty("RealScheduleNum")
protected String RealScheduleNum;
// Constructor, getters and setters
public static ScheduleDetailBuilder builder(){
@ -215,10 +213,10 @@ public class ScheduleDetail {
return this;
}
// public ScheduleDetailBuilder extendedField(String extendedField) {
// scheduleDetail.setExtendedField(extendedField);
// return this;
// }
public ScheduleDetailBuilder extendedField(String extendedField) {
scheduleDetail.setExtendedField(extendedField);
return this;
}
public ScheduleDetailBuilder quoteGroupNum(String quoteGroupNum) {
scheduleDetail.setQuoteGroupNum(quoteGroupNum);
@ -314,9 +312,6 @@ public class ScheduleDetail {
}
public ScheduleDetail build() {
ExtendedFieldParam extendedFieldParam = new ExtendedFieldParam();
extendedFieldParam.setExceed(false);
scheduleDetail.setExtendedField(extendedFieldParam);
return scheduleDetail;
}
}

View File

@ -5,7 +5,6 @@ import com.chint.application.dtos.DeleteLegData;
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.infrastructure.util.Result;
import io.swagger.annotations.ApiOperation;
@ -25,9 +24,6 @@ public class OrderController {
@Autowired
private OrderApplicationService orderApplicationService;
@Autowired
private OrderDetailDomainService orderDetailDomainService;
@Autowired
private OrderQuery orderQuery;
@ -73,12 +69,4 @@ public class OrderController {
orderApplicationService.deleteLegToOrder(deleteLegData);
return Result.Success(SUCCESS);
}
@Transactional
@ApiOperation("同步行程规划单的订单状态")
@PostMapping("/sync/order")
public Result<String> reloadOrderDetail(@RequestBody SyncLegData syncLegData) {
orderDetailDomainService.syncOrderDetailStatusByRouteId(syncLegData.getRouteId());
return Result.Success(SUCCESS);
}
}

View File

@ -2,7 +2,6 @@ package com.chint.application.in;
import com.chint.application.queryies.OrderQuery;
import com.chint.application.services.OrderApplicationService;
import com.chint.domain.service.SystemDomainService;
import com.chint.domain.value_object.ApprovalLegData;
import com.chint.domain.value_object.ApproveLegData;
import com.chint.infrastructure.util.Result;
@ -23,9 +22,6 @@ public class OrderPublicController {
@Autowired
private OrderApplicationService orderApplicationService;
@Autowired
private SystemDomainService systemDomainService;
@Autowired
private OrderQuery orderQuery;
@ -33,7 +29,6 @@ public class OrderPublicController {
@ApiOperation("提交审批行程规划单")
@PostMapping("/approve")
public Result<String> approveOrder(@RequestBody ApproveLegData approveLegData) {
systemDomainService.checkSystemCode(approveLegData.getSysCode());
orderApplicationService.approve(approveLegData);
return Result.Success(SUCCESS);
}
@ -54,5 +49,4 @@ public class OrderPublicController {
return Result.Success(SUCCESS);
}
}

View File

@ -21,8 +21,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/rank")
public class RankController {
@ -91,10 +89,6 @@ public class RankController {
.setProductType(String.valueOf(travelStandardsData.getProductType()))
.setPrice(travelStandardsData.getPrice())
.setCityTag(travelStandardsData.getCityTag());
List<TravelStandards> travelStandardsList = travelStandardsRepository.findByTravelStandards(travelStandards);
if (travelStandardsList.isEmpty()) {
return Result.error("该差标已经存在,不可重复添加!");
}
travelStandards = travelStandardsRepository.save(travelStandards);
return Result.Success(CommonMessageConstant.SUCCESS, travelStandards);
}

View File

@ -4,7 +4,6 @@ package com.chint.application.out;
import com.chint.application.commands.OrderCreateCommand;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.OrderException;
import com.chint.domain.service.SystemDomainService;
import com.chint.domain.service.auth.AuthenticateService;
import com.chint.domain.value_object.UserLoginParam;
import com.chint.domain.value_object.UserLoginResult;
@ -42,9 +41,6 @@ public class LoginController {
@Autowired
private UserHttpRequest userHttpRequest;
@Autowired
private SystemDomainService systemDomainService;
@Transactional
@GetMapping("/login")
public Result<UserLoginResult> login(@RequestParam("sfno") String sfno,
@ -57,8 +53,15 @@ public class LoginController {
String originalString = sfno + syscode + billcode + companycode + AuthMessageConstant.LOGIN_SECRET_KEY + timespan;
String generateSign = Digest.md5(originalString);
if (generateSign.equals(sign)) {
//创建订单先对sysCode进行检查
systemDomainService.checkSystemCode(syscode);
//公司名称转为中文转为编号
/*if (StringCheck.isFirstCharacterChinese(companycode)) {
User user = new User(Long.valueOf(sfno));
user.setUserLoginParam(new UserLoginParam());
BaseContext.setCurrentUser(user);
userHttpRequest.loadUserInfo(user);
BaseContext.removeCurrentUser();
companycode = user.getCompanyCode();
}*/
// 创建 UserLoginParam 对象
UserLoginParam userLoginParam = new UserLoginParam(sfno, syscode, billcode, companycode, timespan);

View File

@ -11,6 +11,7 @@ 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.BaseContext;
import com.chint.infrastructure.util.PageResult;
import com.chint.infrastructure.util.Result;
import com.google.gson.Gson;
@ -24,7 +25,6 @@ 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.*;
@RestController
@RequestMapping("/order")
@ -61,11 +61,6 @@ public class OrderOutController {
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 Result.Success(SUCCESS, routeOrderRes);
}
@ -86,7 +81,6 @@ public class OrderOutController {
public Result<FlightPriceData> estimateFlightPrice(@RequestBody PriceQueryData priceQueryData) {
return Result.Success(SUCCESS, orderQuery.queryFlightPrice(priceQueryData));
}
@ApiOperation("查询酒店估算价格")
@PostMapping("/estimate/hotel")
public Result<HotelPriceData> estimateHotelPrice(@RequestBody PriceQueryData priceQueryData) {
@ -94,7 +88,6 @@ public class OrderOutController {
}
@ApiOperation("根据Id查询行程规划单-元年数据")
@PostMapping("/query/tripCallback")
public Result<TripCallback> queryTripCallbackData(@RequestBody OrderQueryData queryData) {

View File

@ -17,7 +17,6 @@ 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;
@ -45,8 +44,6 @@ public class OrderApplicationService {
@Autowired
private LegFactory legFactory;
@Transactional
public RouteOrder saveOrder(OrderSaveData orderSaveData) {
RouteOrder order;
@ -145,8 +142,4 @@ public class OrderApplicationService {
Command.of(OrderApprovalCommand.class).data(data).sendToQueue();
}
@Transactional
public void reloadOrderDetail(SyncLegData syncLegData) {
}
}

View File

@ -11,10 +11,8 @@ public class ApproveOrderNo {
private String sysCode;
@ApiModelProperty("实际单号")
private String actualOrderNo;
@ApiModelProperty("入账公司编码")
@ApiModelProperty("入账公司")
private String accountCompany;
@ApiModelProperty("入账公司名称")
private String accountCompanyName;
@ApiModelProperty("申请说明")
private String instructions;
@ApiModelProperty("财务共享订单创建人")

View File

@ -9,7 +9,6 @@ import com.chint.infrastructure.constant.LegConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
@ -20,7 +19,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Slf4j
@Data
@Table("leg")
@NoArgsConstructor
@ -174,8 +173,7 @@ public class Leg {
// 检查是否已存在此类型的事件
boolean exists = eventList.stream().anyMatch(e -> e.getEventType().equals(newEventType));
if (exists) {
log.info("Event of this type already exists.");
return this;
throw new LegEventException("Event of this type already exists.");
}
// 如果列表为空且新事件不是准备事件抛出异常

View File

@ -2,6 +2,7 @@ package com.chint.domain.aggregates.order;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.value_object.enums.CurrencyType;
import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.constant.OrderConstant;
import lombok.Data;
@ -15,15 +16,12 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Data
@Table("order_detail")
public class OrderDetail {
@Id
private Long orderId; // 使用 order_id 作为主键
private Long legId; // 使用行程节点关联leg
private Long routeId;
private String orderNo;
private String supplierName;
private Integer productType; // 商品类型
@ -95,13 +93,6 @@ public class OrderDetail {
return this;
}
public OrderEvent getLastEvent() {
return this.orderEventList
.stream()
.max(Comparator.comparingLong(OrderEvent::getOrderEventId))
.orElseThrow(() -> new NotFoundException(NOT_FOUND));
}
public OrderDetail price(String price) {
this.price = price;
return this;
@ -114,7 +105,7 @@ public class OrderDetail {
case LegConstant.LEG_TYPE_HOTEL -> this.hotelOrderDetail;
case LegConstant.LEG_TYPE_TAXI -> this.carOrderDetail;
case LegConstant.LEG_TYPE_OTHER -> this.otherOrderDetail;
default -> throw new NotFoundException(NOT_FOUND);
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};
}

View File

@ -12,8 +12,6 @@ import com.chint.infrastructure.constant.RouteConstant;
import com.chint.infrastructure.constant.SupplierNameConstant;
import com.chint.infrastructure.constant.UtilConstant;
import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.echo_framework.dispatch.Properties;
import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
import com.chint.infrastructure.util.BigDecimalCalculator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@ -30,8 +28,6 @@ import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Data
@Table("route_order")
public class RouteOrder extends BaseEntity {
@ -196,8 +192,6 @@ public class RouteOrder extends BaseEntity {
return this;
}
public RouteOrder reloadStatus(OrderSaveData orderSaveData) {
// 重新加载所有Leg的状态
List<Leg> legs = this.getLegItems();
@ -346,13 +340,13 @@ public class RouteOrder extends BaseEntity {
};
}
public OrderDetail matchOrderWithLeg(OrderDetail orderDetail) {
public void matchOrderWithLeg(OrderDetail orderDetail) {
if (this.legItems.isEmpty()) {
return orderDetail;
return;
}
// 定义时间容差例如1天
long tolerance = Duration.ofDays(2).toMillis();
long tolerance = Duration.ofDays(1).toMillis();
List<Leg> potentialMatches = this.legItems.stream()
.filter(leg -> leg.getLegType().equals(orderDetail.getProductType())
@ -369,14 +363,11 @@ public class RouteOrder extends BaseEntity {
// 如果找到最佳匹配项执行相应操作
if (bestMatch != null) {
Properties properties = Command.of(LegOrderedCommand.class)
Command.of(LegOrderedCommand.class)
.legId(bestMatch.getLegId())
.orderDetailId(orderDetail.getOrderId())
.sendToQueue();
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
return (OrderDetail) byPropertyName.getValue();
}
return orderDetail;
}
private double calculateMatchScore(Leg leg, OrderDetail orderDetail, long tolerance) {

View File

@ -1,12 +0,0 @@
package com.chint.domain.aggregates.system;
import lombok.Data;
import org.springframework.data.relational.core.mapping.Table;
@Data
@Table("system_code")
public class SystemCode {
private Long id;
private String systemName;
private String systemCode;
}

View File

@ -32,8 +32,6 @@ public class User {
@Transient
private String companyCode;
@Transient
private String companyName;
@Transient
private String workStatus;
@Transient
private String manaLevel;

View File

@ -55,7 +55,6 @@ public class RouteOrderFactory implements OrderFactory {
approveOrderNo.setSysCode(loginParam.getSyscode());
approveOrderNo.setFakeOrderNo(loginParam.getBillcode());
approveOrderNo.setAccountCompany(currentUser.getCompanyCode());
approveOrderNo.setAccountCompanyName(currentUser.getCompanyName());
routeOrder.setApproveOrderNo(approveOrderNo);
routeOrder.setBookingTime(LocalDateTime.now());
return routeOrder;

View File

@ -1,45 +1,17 @@
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.LocationRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.repository.UserRepository;
import com.chint.interfaces.rest.ctrip.dto.search.hotel.HotelOrderInfoEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Optional;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_DETAIL_STATUS_SUCCESS;
@Component
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Autowired
private OrderDetailRepository orderDetailRepository;
@Autowired
private RouteRepository routeRepository;
@Autowired
private UserRepository userRepository;
@Autowired
private LocationRepository locationRepository;
public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory{
@Override
public CarOrderDetail createCarOrderDetail(Object carOrderDetailData) {
return null;
}
@Override
public TrainOrderDetail createTrainOrderDetail(Object trainOrderDetailData) {
return null;
}
@ -50,45 +22,7 @@ public class CTripOrderExtensionFactoryImpl implements OrderExtensionFactory {
@Override
public HotelOrderDetail createHotelOrderDetail(Object hotelOrderDetailData) {
HotelOrderInfoEntity hotelOrderInfoEntity = (HotelOrderInfoEntity) hotelOrderDetailData;
String orderNo = hotelOrderInfoEntity.getOrderID();
Optional<OrderDetail> byOrderNo = orderDetailRepository.findByOrderNo(orderNo);
String journeyNo = hotelOrderInfoEntity.getJourneyNo();
RouteOrder routeOrder = routeRepository.findByOrderNo(journeyNo);
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
HotelOrderDetail hotelOrderDetail = new HotelOrderDetail();
hotelOrderDetail.setOrderNo(orderNo); //订单号
hotelOrderDetail.setOverStandard(null); //是否超标
hotelOrderDetail.setOrderStatus(ORDER_DETAIL_STATUS_SUCCESS);
hotelOrderDetail.setAccountCompanyId(approveOrderNo.getAccountCompany());
hotelOrderDetail.setAccountCompanyName(approveOrderNo.getAccountCompanyName());
hotelOrderDetail.setReceiptsNum(journeyNo);
byOrderNo.flatMap(orderDetail -> routeOrder.getLegItems()
.stream()
.filter(it -> byOrderNo.get().getLegId().equals(it.getLegId()))
.findFirst()).ifPresent(it ->
hotelOrderDetail.setScheduleNum(it.getLegNo()));
Long EmployeeNo = routeOrder.getUserId();
User user = userRepository.findByUserEmployeeNo(EmployeeNo);
String cityName = hotelOrderInfoEntity.getCityName();
hotelOrderDetail.setBookingUserCode(String.valueOf(user.getEmployeeNo()));
hotelOrderDetail.setBookingName(user.getName());
hotelOrderDetail.setBookingUserPhone(user.getPhoneNumber());
hotelOrderDetail.setCreateTime(hotelOrderInfoEntity.getOrderDate());
hotelOrderDetail.setCheckInCity(cityName);
hotelOrderDetail.setHotelName(hotelOrderInfoEntity.getHotelName());
hotelOrderDetail.setContactPhone(hotelOrderInfoEntity.getTelephone());
hotelOrderDetail.setHotelAddress(locationRepository.locationPathByName(cityName)
+ hotelOrderInfoEntity.getDistrictName() + hotelOrderInfoEntity.getAddress());
hotelOrderDetail.setStarRate(hotelOrderInfoEntity.getStar());
hotelOrderDetail.setCheckInDate(hotelOrderInfoEntity.getStartTime());
hotelOrderDetail.setDepartureDate(hotelOrderInfoEntity.getEndTime());
// hotelOrderDetail.setNightCount(hotelOrderInfoEntity.);
return hotelOrderDetail;
return null;
}
@Override

View File

@ -20,6 +20,4 @@ public interface LocationRepository {
List<Location> findByName(LocationParam locationParam);
List<Location> findByName(String localName);
String locationPathByName(String localName);
}

View File

@ -14,6 +14,4 @@ public interface OrderDetailRepository {
OrderDetail save(OrderDetail orderDetail);
void deleteById(Long id);
}

View File

@ -1,13 +0,0 @@
package com.chint.domain.repository;
import com.chint.domain.aggregates.system.SystemCode;
public interface SystemCodeRepository {
SystemCode save(SystemCode systemCode);
SystemCode findBySysCode(String sysCode);
SystemCode findById(Long id);
}

View File

@ -12,6 +12,4 @@ public interface TravelStandardsRepository {
void saveAll(List<TravelStandards> travelStandardsList);
List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByTravelStandards(TravelStandards travelStandards);
}

View File

@ -1,65 +0,0 @@
package com.chint.domain.service;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.factoriy.order_detail.OrderDetailFactory;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.domain.service.order_search.OrderSearchSelector;
import com.chint.domain.service.supplier.OrderDataAdapterSelector;
import com.chint.domain.value_object.OrderLegData;
import com.chint.domain.value_object.SupplierCallbackData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import static com.chint.infrastructure.constant.OrderConstant.ORDER_EVENT_CANCEL;
@Service
public class OrderDetailDomainService {
@Autowired
private OrderDetailRepository orderDetailRepository;
@Autowired
private OrderDetailFactory orderDetailFactory;
@Autowired
private RouteRepository routeRepository;
@Autowired
private OrderSearchSelector orderSearchSelector;
@Autowired
private OrderDataAdapterSelector orderDataAdapterSelector;
public void syncOrderDetailStatus(List<OrderLegData> orderLegDataList) {
for (OrderLegData orderLegData : orderLegDataList) {
orderDetailRepository.findByOrderNo(orderLegData.getOutOrderNo()).ifPresent(
it -> {
if (!it.getLastEvent().getEventType().equals(orderLegData.getOrderStatus())) {
it.addOrderEvent(orderDetailFactory.createEvent(orderLegData.getOrderStatus(),
orderLegData.getOriginOrderStatus()));
orderDetailRepository.save(it);
}
}
);
}
}
public void syncOrderDetailStatusByRouteId(Long RouteId) {
RouteOrder routeOrder = routeRepository.queryById(RouteId);
String supplierName = routeOrder.getSupplierName();
List<OrderLegData> orderLegDataList = new ArrayList<>();
List<String> list = routeOrder.getOrderDetails().stream()
.filter(it -> it.getLastEvent().getEventType() != ORDER_EVENT_CANCEL)
.map(OrderDetail::getOrderNo).toList();
for (String orderNo : list) {
SupplierCallbackData supplierCallbackData = orderSearchSelector.of(supplierName).searchOrderDetail(orderNo);
orderDataAdapterSelector.of(supplierName).adapt(supplierCallbackData).ifPresent(orderLegDataList::add);
}
syncOrderDetailStatus(orderLegDataList);
}
}

View File

@ -24,7 +24,7 @@ import com.chint.infrastructure.echo_framework.command.Command;
import com.chint.infrastructure.util.DelayDispatch;
import com.chint.interfaces.rest.bpm.BPMParamFactory;
import com.chint.interfaces.rest.bpm.BPMRequest;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
import com.chint.interfaces.rest.user.UserHttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -104,25 +104,26 @@ public class OrderDomainService {
@ListenTo(command = "OrderStatusChangeCommand", order = 0)
public void orderDetailStatusChange(OrderStatusChangeCommand command) {
OrderDetail orderDetail = command.getOrderDetail();
String outStatus = command.getOutStatus();
Integer orderEventType = command.getOrderEventType();
OrderEvent event = orderDetailFactory.createEvent(orderEventType,
outStatus);
orderDetail.addOrderEvent(event);
orderDetailRepository.save(orderDetail);
orderDetailRepository.findByOrderNo(command.getOrderNo()).ifPresent(orderDetail -> {
String outStatus = command.getOutStatus();
Integer orderEventType = command.getOrderEventType();
OrderEvent event = orderDetailFactory.createEvent(orderEventType,
outStatus);
orderDetail.addOrderEvent(event);
orderDetailRepository.save(orderDetail);
if (orderEventType.equals(OrderConstant.ORDER_EVENT_ETA)) {
//这里如果发现事件的状态为ORDER_EVENT_ETA
//需要根据发送审批给bpm
//根据订单类型获取不同的订单扩展明细
orderDetail.getExtensionDataByProductType();
Command.of(BPMAuditCommand.class)
.orderNo(orderDetail.getOrderNo())
.productType(orderDetail.getProductType())
.extensionData(orderDetail.getExtensionDataByProductType())
.sendToQueue();
};
if (orderEventType.equals(OrderConstant.ORDER_EVENT_ETA)) {
//这里如果发现事件的状态为ORDER_EVENT_ETA
//需要根据发送审批给bpm
//根据订单类型获取不同的订单扩展明细
orderDetail.getExtensionDataByProductType();
Command.of(BPMAuditCommand.class)
.orderNo(orderDetail.getOrderNo())
.productType(orderDetail.getProductType())
.extensionData(orderDetail.getExtensionDataByProductType())
.sendToQueue();
}
});
}
@ListenTo(command = "BPMAuditCommand", order = 0)

View File

@ -1,23 +0,0 @@
package com.chint.domain.service;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.SystemCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.DataMessageConstant.SYS_CODE_ERROR;
@Service
public class SystemDomainService {
@Autowired
private SystemCodeRepository systemCodeRepository;
public boolean checkSystemCode(String sysCode) {
boolean b = systemCodeRepository.findBySysCode(sysCode) != null;
if(!b){
throw new NotFoundException(SYS_CODE_ERROR);
}
return b;
}
}

View File

@ -28,8 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
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;
@Service
@ -78,10 +76,10 @@ public class LegEventHandler implements LegEventService {
if (routeOrder.getLegItems().isEmpty()) {
throw new OrderException(CommonMessageConstant.LEG_ERROR);
}
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_PREPARE)) {
ApproveOrderNo approveOrderNo = routeOrder.getApproveOrderNo();
approveOrderNo.setActualOrderNo(data.getActualOrderNo());
// approveOrderNo.setAccountCompany(data.getAccountCompany());
approveOrderNo.setAccountCompany(data.getAccountCompany());
approveOrderNo.setInstructions(data.getInstructions());
approveOrderNo.setCreator(data.getCreator());
//这里order所有的leg触发approve事件
@ -94,10 +92,8 @@ public class LegEventHandler implements LegEventService {
routeOrder.addApprovalEvent(approvalEvent);
//保存routeOrder的状态
routeRepository.save(routeOrder);
} else if (routeOrder.getOrderStatus() > ORDER_STATUS_PREPARE) {
throw new CommandException(ORDER_STATUS_ERROR);
} else {
throw new CommandException(ORDER_STATUS_ERROR);
throw new CommandException("订单未初始化");
}
}
@ -109,7 +105,7 @@ public class LegEventHandler implements LegEventService {
if (routeOrder.getOrderStatus() > (RouteConstant.ORDER_STATUS_APPROVAL)) {
throw new CommandException("订单已同步");
}
if (routeOrder.getOrderStatus().equals(ORDER_STATUS_PREPARE)) {
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_PREPARE)) {
throw new CommandException("订单未提交审批");
}
if (routeOrder.getOrderStatus().equals(RouteConstant.ORDER_STATUS_APPROVAL)) {
@ -162,7 +158,7 @@ public class LegEventHandler implements LegEventService {
// .max(Comparator.comparing(OrderDetail::getCreateTime))
// .orElseThrow(() -> new NotFoundException(CommonMessageConstant.NOT_FOUND));
//为订单添加订单已下单事件,这里需要发出额外的命令进行处理
orderDetail = routeOrder.matchOrderWithLeg(orderDetail);
routeOrder.matchOrderWithLeg(orderDetail);
} else {
orderDetail = byOrderNo.get();
}
@ -171,7 +167,7 @@ public class LegEventHandler implements LegEventService {
@Transactional
@Override
public ResultContainer orderLeg(LegOrderedCommand command) {
public void orderLeg(LegOrderedCommand command) {
//如果筛选事件可能会是错误需要用户手动添加并修改事件 因此会进行额外出发修改下单事件
Leg leg = legRepository.findByLegId(Leg.of(command.getLegId()));
//因为orderDetail已经进行持久化保存 只需要从数据库进行查询
@ -182,7 +178,6 @@ public class LegEventHandler implements LegEventService {
orderDetail.setLegId(leg.getLegId());
legRepository.save(leg);
orderDetailRepository.save(orderDetail);
return ResultContainer.of(RESULT_ORDER_DETAIL).value(orderDetail);
}
@Transactional

View File

@ -13,7 +13,7 @@ public interface LegEventService {
void syncLeg(LegSyncCommand command);
//下单事件
ResultContainer orderLeg(LegOrderedCommand command);
void orderLeg(LegOrderedCommand command);
ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command);

View File

@ -39,14 +39,15 @@ public class LegEventServiceImpl implements LegEventService {
//下单时间要求回传需要付款的金额以及生成对于的行程订单号如果没有行程订单号根据地点和时间进行匹配
@ListenTo(command = "LegOrderedCommand", order = 0)
@Override
public ResultContainer orderLeg(LegOrderedCommand command) {
return legEventHandler.orderLeg(command);
public void orderLeg(LegOrderedCommand command) {
legEventHandler.orderLeg(command);
}
@ListenTo(command = "RouteUpdateOrderCommand", order = 0)
@Override
public ResultContainer routeUpdateOrder(RouteUpdateOrderCommand command) {
return legEventHandler.routeUpdateOrder(command);
legEventHandler.routeUpdateOrder(command);
return null;
}
@Override

View File

@ -1,22 +0,0 @@
package com.chint.domain.service.order_search;
import com.chint.domain.service.supplier.OrderDataAdapterSelector;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.interfaces.rest.ctrip.CTripOrderSearchRequest;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.SupplierNameConstant.SUPPLIER_C_TRIP;
@Service
public class CTripOrderSearchImpl implements OrderSearchRequest {
@Autowired
private CTripOrderSearchRequest cTripOrderSearchRequest;
@Override
public SupplierCallbackData searchOrderDetail(String orderNo) {
SearchOrderResponse response = cTripOrderSearchRequest.searchOrderResponseByOrderId(orderNo);
return SupplierCallbackData.of(SUPPLIER_C_TRIP).data(response);
}
}

View File

@ -1,12 +0,0 @@
package com.chint.domain.service.order_search;
import com.chint.domain.value_object.SupplierCallbackData;
import org.springframework.stereotype.Component;
@Component
public class LYOrderSearchImpl implements OrderSearchRequest{
@Override
public SupplierCallbackData searchOrderDetail(String orderNo) {
return null;
}
}

View File

@ -1,9 +0,0 @@
package com.chint.domain.service.order_search;
import com.chint.domain.value_object.SupplierCallbackData;
public interface OrderSearchRequest {
SupplierCallbackData searchOrderDetail(String orderNo);
}

View File

@ -1,28 +0,0 @@
package com.chint.domain.service.order_search;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.service.supplier.CTripOrderDataAdapter;
import com.chint.domain.service.supplier.LYOrderDataAdapter;
import com.chint.domain.service.supplier.OrderDataAdapter;
import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.constant.SupplierNameConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class OrderSearchSelector {
@Autowired
private CTripOrderSearchImpl cTripOrderSearch;
@Autowired
private LYOrderSearchImpl lyOrderSearch;
public OrderSearchRequest of(String supplierName) {
// 当找不到匹配的适配器时抛出一个异常
return switch (supplierName) {
case SupplierNameConstant.SUPPLIER_C_TRIP -> cTripOrderSearch;
case SupplierNameConstant.SUPPLIER_L_Y -> lyOrderSearch;
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
};
}
}

View File

@ -55,7 +55,6 @@ public class CTripOrderDataAdapter implements OrderDataAdapter {
Location byName = locationRepository.findByName(hotelOrderInfoEntity.getCityName()).get(0);
return builder.productType(LegConstant.LEG_TYPE_HOTEL)
.hotelOrderDetailData(hotelOrderInfoEntity)
.currencyCode(hotelOrderInfoEntity.getCurrency())
.orderTime(hotelOrderInfoEntity.getOrderDate())
.startTime(hotelOrderInfoEntity.getStartTime())

View File

@ -1,8 +1,7 @@
package com.chint.domain.service.supplier;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.value_object.SupplierCallbackData;
public interface SupplierService {
OrderDetail handleSupplierCallback(SupplierCallbackData callbackData);
void handleSupplierCallback(SupplierCallbackData callbackData);
}

View File

@ -2,11 +2,9 @@ package com.chint.domain.service.supplier;
import com.chint.application.commands.RouteUpdateOrderCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.factoriy.order_detail.OrderExtensionCreator;
import com.chint.domain.factoriy.order_detail.OrderExtensionFactory;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.value_object.OrderLegData;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.constant.LegConstant;
import com.chint.infrastructure.echo_framework.command.Command;
@ -15,9 +13,6 @@ import com.chint.infrastructure.echo_framework.dispatch.ResultContainer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.UtilConstant.RESULT_ORDER_DETAIL;
@Service
@ -33,43 +28,45 @@ public class SupplierServiceImpl implements SupplierService {
private OrderDetailRepository orderDetailRepository;
@Override
public OrderDetail handleSupplierCallback(SupplierCallbackData callbackData) {
public void handleSupplierCallback(SupplierCallbackData callbackData) {
String supplierName = callbackData.getSupplierName();
orderDataAdapterSelector
.of(supplierName)
.adapt(callbackData)
.ifPresent(data -> {
Optional<OrderLegData> data = orderDataAdapterSelector.of(supplierName).adapt(callbackData);
if (data.isPresent()) {
//获取使用RouteUpdateOrderCommand命令创建的orderDetail
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();
System.out.println(data);
//获取使用RouteUpdateOrderCommand命令创建的orderDetail
Properties properties = Command.of(RouteUpdateOrderCommand.class).data(data).sendToQueue();
ResultContainer byPropertyName = properties.findByPropertyName(RESULT_ORDER_DETAIL);
OrderDetail orderDetail = (OrderDetail) byPropertyName.getValue();
Integer productType = orderLegData.getProductType();
OrderExtensionFactory orderExtensionFactory = orderExtensionCreator
.of(supplierName);
Integer productType = data.getProductType();
OrderExtensionFactory orderExtensionFactory = orderExtensionCreator
.of(supplierName);
Object callbackDataData = callbackData.getData();
//根据产品的不同类型添加不同的扩展字段
switch (productType) {
case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData(
orderExtensionFactory.createTrainOrderDetail(orderLegData.getTrainOrderDetailData())
);
case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData(
orderExtensionFactory.createFlightOrderDetail(orderLegData.getFlightOrderDetailData())
);
case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData(
orderExtensionFactory.createHotelOrderDetail(orderLegData.getHotelOrderDetailData())
);
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
orderExtensionFactory.createCarOrderDetail(orderLegData.getCarOrderDetailData())
);
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
orderExtensionFactory.createOtherOrderDetail(orderLegData.getOtherOrderDetailData())
);
}
//对orderDetail进行保存
return orderDetailRepository.save(orderDetail);
} else {
throw new NotFoundException(NOT_FOUND);
}
//根据产品的不同类型添加不同的扩展字段
switch (productType) {
case LegConstant.LEG_TYPE_TRAIN -> orderDetail.addTrainOrderData(
orderExtensionFactory.createTrainOrderDetail(callbackDataData)
);
case LegConstant.LEG_TYPE_AIRPLANE -> orderDetail.addFlightOrderData(
orderExtensionFactory.createFlightOrderDetail(callbackDataData)
);
case LegConstant.LEG_TYPE_HOTEL -> orderDetail.addHotelOrderData(
orderExtensionFactory.createHotelOrderDetail(callbackDataData)
);
case LegConstant.LEG_TYPE_TAXI -> orderDetail.addCarOrderData(
orderExtensionFactory.createCarOrderDetail(callbackDataData)
);
case LegConstant.LEG_TYPE_OTHER -> orderDetail.addOtherOrderData(
orderExtensionFactory.createOtherOrderDetail(callbackDataData)
);
}
//对orderDetail进行保存
orderDetailRepository.save(orderDetail);
});
}
}

View File

@ -1,20 +1,13 @@
package com.chint.domain.value_object;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ApproveLegData {
@ApiModelProperty("实际财务共享订单号")
private String actualOrderNo;
@ApiModelProperty("临时财务共享订单号")
private String fakeOrderNo;
@ApiModelProperty("入账公司")
private String accountCompany;
@ApiModelProperty("系统标识")
private String sysCode;
@ApiModelProperty("出差说明")
private String instructions;
@ApiModelProperty("财务共享订单创建人")
private String creator;
}

View File

@ -47,11 +47,6 @@ public class OrderLegData {
this.destinationId = builder.destinationId;
this.originOrderStatus = builder.originOrderStatus;
this.currencyCode = builder.currencyCode;
this.carOrderDetailData = builder.carOrderDetailData;
this.trainOrderDetailData = builder.trainOrderDetailData;
this.hotelOrderDetailData = builder.hotelOrderDetailData;
this.flightOrderDetailData = builder.flightOrderDetailData;
this.otherOrderDetailData = builder.otherOrderDetailData;
}
public static Builder builder() {
@ -76,36 +71,10 @@ public class OrderLegData {
private Long destinationId;
private String currencyCode;
private Object carOrderDetailData;
private Object trainOrderDetailData;
private Object hotelOrderDetailData;
private Object flightOrderDetailData;
private Object otherOrderDetailData;
public Builder() {
}
public Builder carOrderDetailData(Object carOrderDetailData) {
this.carOrderDetailData = carOrderDetailData;
return this;
}
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;
}
public Builder currencyCode(String currencyCode) {
this.currencyCode = currencyCode;
return this;

View File

@ -2,9 +2,7 @@ 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 EXCEED_STANDARD_URL = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
public static final String EXCEED_STANDARD_TYPE_TRAIN = "火车票超标";//方法名称
public static final String EXCEED_STANDARD_TYPE_HOTEL = "酒店超标";//方法名称
public static final String EXCEED_STANDARD_TYPE_FLIGHT = "机票超标";//方法名称

View File

@ -8,6 +8,4 @@ public class DataMessageConstant {
public static final String DATA_DELETION_SUCCESS = "数据删除成功";
public static final String DATA_NOT_FOUND = "未找到数据";
public static final String DATA_INVALID = "数据不合法";
public static final String SYS_CODE_ERROR = "系统标识字段错误";
public static final String ORDER_STATUS_ERROR = "订单状态错误";
}

View File

@ -20,12 +20,4 @@ public class OrderConstant {
public static final String ORDER_EVENT_ETA_NAME = "超标";
public static final int ORDER_EVENT_UNKNOWN = -99;
public static final String ORDER_EVENT_UNKNOWN_NAME = "未知事件";
//这批字段用于
public static final String ORDER_DETAIL_STATUS_SUCCESS = "1";
public static final String ORDER_DETAIL_STATUS_HALF = "4";
public static final String ORDER_EVENT_UNKNOWN_FAIL = "3";
}

View File

@ -51,10 +51,6 @@ public class GlobalExceptionHandler {
while (rootCause instanceof InvocationTargetException && cause != null) {
rootCause = cause;
}
if(cause == null){
rootCause.printStackTrace();
return Result.error("未知错误");
}
Throwable causeCause = cause.getCause();
causeCause.printStackTrace();
return Result.error(causeCause.getMessage());

View File

@ -70,10 +70,4 @@ public class LocationRepositoryImpl implements LocationRepository {
public List<Location> findByName(String localName) {
return jdbcLocationRepository.findByLocationNameContaining(localName);
}
@Override
public String locationPathByName(String localName) {
Location byLocationName = jdbcLocationRepository.findByLocationName(localName);
return byLocationName.getLocationPathName().replace("_", "");
}
}

View File

@ -36,9 +36,4 @@ public class OrderDetailRepositoryImpl implements OrderDetailRepository {
public OrderDetail save(OrderDetail orderDetail) {
return orderDetailRepository.save(orderDetail);
}
@Override
public void deleteById(Long id) {
orderDetailRepository.deleteById(id);
}
}

View File

@ -1,32 +0,0 @@
package com.chint.infrastructure.repository;
import com.chint.domain.aggregates.system.SystemCode;
import com.chint.domain.exceptions.NotFoundException;
import com.chint.domain.repository.SystemCodeRepository;
import com.chint.infrastructure.repository.jdbc.JdbcSystemCodeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
@Repository
public class SystemCodeRepositoryImpl implements SystemCodeRepository {
@Autowired
private JdbcSystemCodeRepository jdbcSystemCodeRepository;
@Override
public SystemCode save(SystemCode systemCode) {
return jdbcSystemCodeRepository.save(systemCode);
}
@Override
public SystemCode findBySysCode(String sysCode) {
return jdbcSystemCodeRepository.findBySystemCode(sysCode);
}
@Override
public SystemCode findById(Long id) {
return jdbcSystemCodeRepository.findById(id).orElseThrow(() -> new NotFoundException(NOT_FOUND));
}
}

View File

@ -30,11 +30,4 @@ public class TravelStandardsRepositoryImpl implements TravelStandardsRepository
public List<TravelStandards> findByStandardLevel(String standardLevel) {
return jdbcTravelStandardsRepository.findByStandardLevel(standardLevel);
}
@Override
public List<TravelStandards> findByTravelStandards(TravelStandards travelStandards) {
return jdbcTravelStandardsRepository.findByProductTypeAndStandardLevelAndCityTag(
travelStandards.getProductType(), travelStandards.getStandardLevel(), travelStandards.getCityTag());
}
}

View File

@ -19,8 +19,5 @@ public interface JdbcLocationRepository extends CrudRepository<Location, Long> {
Page<Location> findAllByLevel(Integer level, Pageable pageable);
List<Location> findByFirstPinYin(String firstPinYin);
List<Location> findByLocationNameContaining(String locationName);
Location findByLocationName(String locationName);
}

View File

@ -1,12 +0,0 @@
package com.chint.infrastructure.repository.jdbc;
import com.chint.domain.aggregates.order.RouteOrder;
import com.chint.domain.aggregates.system.SystemCode;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface JdbcSystemCodeRepository extends CrudRepository<SystemCode, Long> {
SystemCode findBySystemCode(String systemCode);
}

View File

@ -11,5 +11,4 @@ import java.util.List;
public interface JdbcTravelStandardsRepository extends CrudRepository<TravelStandards, Integer> {
List<TravelStandards> findByStandardLevel(String standardLevel);
List<TravelStandards> findByProductTypeAndStandardLevelAndCityTag(String productType,String standardLevel,String cityTag);
}

View File

@ -1,7 +1,6 @@
package com.chint.interfaces.rest.base;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
@ -15,7 +14,6 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
@Slf4j
public class PostRequest {
private final Gson gson = new Gson();
private final HttpClient client = HttpClients.createDefault();
@ -23,7 +21,7 @@ public class PostRequest {
public <T> T post(String url, Object jsonRequest, Class<T> responseType) {
HttpPost post = new HttpPost(url);
String json = gson.toJson(jsonRequest);
log.info(json);
System.out.println(json);
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
String responseBody = null;
HttpEntity responseEntity = null;
@ -42,7 +40,7 @@ public class PostRequest {
HttpPost post = new HttpPost(url);
post.addHeader(headName, headValue);
String json = gson.toJson(jsonRequest);
log.info(json);
System.out.println(json);
post.setEntity(new StringEntity(json, ContentType.APPLICATION_JSON));
String responseBody = null;
HttpEntity responseEntity = null;

View File

@ -1,44 +0,0 @@
package com.chint.interfaces.rest.bpm;
import com.chint.domain.aggregates.standards.TravelStandards;
import com.chint.domain.value_object.TravelStandardsData;
import com.chint.infrastructure.constant.BPMConstant;
import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.util.Result;
import com.chint.interfaces.rest.bpm.dot.BPMBack;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
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.List;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM;
@RestController
@RequestMapping("/public/BPM")
public class BPMController {
//超标
@ApiOperation("BPM超标审批结果回传")
@PostMapping("/exceedStandard/back")
public Result<TravelStandards> exceedStandardBack(@RequestBody BPMBack bpmBack) {
//H3BPM平台
if (H3BPM.equals(bpmBack.getTag())) {
System.out.println("H3BPM");
}
System.out.println("bpmBack = " + bpmBack);
return Result.Success(CommonMessageConstant.SUCCESS);
}
//改签
@ApiOperation("BPM改签审批结果回传")
@PostMapping("/reschedule/back")
public Result<TravelStandards> rescheduleBack(@RequestBody BPMBack bpmBack) {
//获取订单号和审批结果
return Result.Success(CommonMessageConstant.SUCCESS);
}
}

View File

@ -5,8 +5,7 @@ import com.chint.domain.exceptions.NotFoundException;
import com.chint.infrastructure.constant.BPMConstant;
import com.chint.infrastructure.constant.CommonMessageConstant;
import com.chint.infrastructure.constant.SupplierNameConstant;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import org.springframework.data.repository.query.Param;
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;

View File

@ -3,17 +3,15 @@ package com.chint.interfaces.rest.bpm;
import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.dot.*;
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dot.RescheduleDto;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
import static com.chint.infrastructure.constant.BPMConstant.EXCEED_STANDARD_URL;
@Service
@ -22,9 +20,6 @@ public class BPMRequest {
@Autowired
private PostRequest httpPostRequest;
@Value("${bpm.H3BPMUrl}")
private String H3BPMUrl;
//超标申请
public BPMResponse exceedStandard(ExceedStandardDto exceedStandardDto) {
return submitWorkflow("JT_FI_CLCESQ", exceedStandardDto);
@ -45,8 +40,8 @@ public class BPMRequest {
.setUserCode(String.valueOf(user.getEmployeeNo()))//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues);
BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
System.out.println("response = " + bpmBaseResponse);
return bpmBaseResponse.getD();
BPMResponse response = httpPostRequest.post(EXCEED_STANDARD_URL, bpmRequest, BPMResponse.class);
System.out.println("response = " + response);
return response;
}
}

View File

@ -1,10 +0,0 @@
package com.chint.interfaces.rest.bpm.dot;
import lombok.Data;
@Data
public class BPMBack {
private String tag;//BPM平台H3BPM/其它
private String orderNo;//订单号
private String result;//审批结果:通过/拒绝
}

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dto;
package com.chint.interfaces.rest.bpm.dot;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -1,9 +0,0 @@
package com.chint.interfaces.rest.bpm.dot;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import lombok.Data;
@Data
public class BPMBaseResponse {
private BPMResponse d;
}

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dto;
package com.chint.interfaces.rest.bpm.dot;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dto;
package com.chint.interfaces.rest.bpm.dot;
import lombok.Data;

View File

@ -1,4 +1,4 @@
package com.chint.interfaces.rest.bpm.dto;
package com.chint.interfaces.rest.bpm.dot;
import lombok.Data;
import lombok.experimental.Accessors;

View File

@ -87,7 +87,7 @@ public class CTripEstimateRequest {
.valuationBaseInfo()
.eID(user.getEmployeeNo().toString())
.corpID(C_TRIP_CORP_ID)
.rankName(user.getStandardLevel())
// .rankName(user.getRankCode())
.done()
.valuationProductInfo()
.addFlightProductInfo(flightProductInfo)

View File

@ -95,10 +95,10 @@ public class BookingRelatedApiRequestBuilder {
return this;
}
public ValuationBaseInfoBuilder rankName(String rankName) {
baseInfo.setRankName(rankName);
return this;
}
// public ValuationBaseInfoBuilder rankName(String rankName) {
// baseInfo.setRankName(rankName);
// return this;
// }
public ValuateBudgetRequestTypeBuilder done() {
requestContent.setValuationBaseInfo(baseInfo);

View File

@ -10,7 +10,7 @@ public class ValuationBaseInfo {
// 员工ID
private String eID;
// 职级名称
private String rankName;
// private String rankName;
// Getters and setters...
}

View File

@ -1,7 +1,6 @@
package com.chint.interfaces.rest.ctrip.in;
import com.chint.application.commands.OrderStatusChangeCommand;
import com.chint.domain.aggregates.order.OrderDetail;
import com.chint.domain.service.supplier.SupplierService;
import com.chint.domain.value_object.SupplierCallbackData;
import com.chint.infrastructure.constant.OrderConstant;
@ -14,7 +13,6 @@ import com.chint.interfaces.rest.ctrip.dto.put.CTripStatusResponse;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -54,7 +52,6 @@ public class CTripNoteController {
// return new CTripNoteResponse("1", "未收到消息");
// }
@Transactional
@PostMapping("/status")
public CTripStatusResponse statusEvent(@RequestBody CTripStatusNotification cTripStatusNotification) {
String productType = cTripStatusNotification.getProductType();
@ -65,51 +62,45 @@ public class CTripNoteController {
return new CTripStatusResponse("1", "sign错误");
}
if (orderStatus != null && orderId != null) {
return handlerData(orderId, orderStatus, productType);
SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP);
SearchOrderResponse response = cTripOrderSearchRequest
.searchOrderResponseByOrderId(orderId);
supplierCallbackData.data(response);
supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderNo(orderId)
.outStatus(orderStatus);
switch (productType) {
case "FlightInternational":
case "FlightDomestic":
command.eventType(mapFlightStatus(orderStatus));
break;
case "HotelMember":
case "HotelContract":
command.eventType(mapHotelStatus(orderStatus));
break;
case "Train":
case "OverseaTrain":
command.eventType(mapTrainStatus(orderStatus));
break;
case "CarPickUpInternational":
case "CarRentalDomestic":
case "CarImmediately":
case "CarPickUpDomesticNew":
case "CarCharterDomestic":
case "BusTicket":
command.eventType(mapCarStatus(orderStatus));
break;
}
command.sendToQueue();
return new CTripStatusResponse("0", "成功收到消息");
}
return new CTripStatusResponse("1", "未收到消息");
}
public CTripStatusResponse handlerData(String orderId, String orderStatus, String productType) {
SupplierCallbackData supplierCallbackData =
SupplierCallbackData.of(SupplierNameConstant.SUPPLIER_C_TRIP);
SearchOrderResponse response = cTripOrderSearchRequest
.searchOrderResponseByOrderId(orderId);
supplierCallbackData.data(response);
OrderDetail orderDetail = supplierService.handleSupplierCallback(supplierCallbackData);
OrderStatusChangeCommand command = Command.of(OrderStatusChangeCommand.class)
.orderDetail(orderDetail)
.orderNo(orderId)
.outStatus(orderStatus);
switch (productType) {
case "FlightInternational":
case "FlightDomestic":
command.eventType(mapFlightStatus(orderStatus));
break;
case "HotelMember":
case "HotelContract":
command.eventType(mapHotelStatus(orderStatus));
break;
case "Train":
case "OverseaTrain":
command.eventType(mapTrainStatus(orderStatus));
break;
case "CarPickUpInternational":
case "CarRentalDomestic":
case "CarImmediately":
case "CarPickUpDomesticNew":
case "CarCharterDomestic":
case "BusTicket":
command.eventType(mapCarStatus(orderStatus));
break;
}
command.sendToQueue();
return new CTripStatusResponse("0", "成功收到消息");
}
public Integer mapFlightStatus(String status) {
return switch (status) {
case "Submitted" -> OrderConstant.ORDER_EVENT_PREPARE; // "已提交"映射到准备下单

View File

@ -4,20 +4,14 @@ import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.ly.dto.user.EmployeeRequest;
import com.chint.interfaces.rest.ly.dto.user.EmployeeEntity;
import com.chint.interfaces.rest.ly.dto.user.PreTravelPolicy;
import com.chint.interfaces.rest.user.UserHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.chint.interfaces.rest.ly.dto.user.UserResponse;
import java.util.ArrayList;
import java.util.List;
import static com.chint.infrastructure.constant.LYConstant.L_Y_BASE_URL;
import static com.chint.infrastructure.constant.LYConstant.L_Y_USER_PATH;
@Slf4j
@Service
public class LYUserRequest {
@ -33,7 +27,7 @@ public class LYUserRequest {
private final String userUrl = L_Y_BASE_URL + L_Y_USER_PATH;
public boolean saveCurrentUser() {
log.info("saveCurrentUser");
System.out.println("saveCurrentUser");
User currentUser = BaseContext.getCurrentUser();
userHttpRequest.loadUserInfo(currentUser);
EmployeeEntity employeeEntity = user2LYEmployee(currentUser);
@ -72,17 +66,7 @@ public class LYUserRequest {
employeeEntity.setGender(translateGender(user.getGender()));
employeeEntity.setWorkingState(translateWorkStatus(user.getWorkStatus()));
employeeEntity.setReservationType(0);
String standardLevel = user.getStandardLevel();
employeeEntity.setPositionLevelName(standardLevel);
List<PreTravelPolicy> preTravelPolicyList = List.of(
new PreTravelPolicy(standardLevel,1),
new PreTravelPolicy(standardLevel,2),
new PreTravelPolicy(standardLevel,3),
new PreTravelPolicy(standardLevel,4),
new PreTravelPolicy(standardLevel,5),
new PreTravelPolicy(standardLevel,6)
);
employeeEntity.setPreTravelPolicyList(preTravelPolicyList);
employeeEntity.setPositionLevelName(user.getStandardLevel());
return employeeEntity;
}
}

View File

@ -32,5 +32,5 @@ public class EmployeeEntity {
private Map<String, String> remarks;
private String baseCity;
// Getters and setters
}

View File

@ -1,10 +1,5 @@
package com.chint.interfaces.rest.ly.dto.user;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class PreTravelPolicy {
private String policyCode;
private int productTypeId;

View File

@ -1,9 +1,9 @@
package com.chint.interfaces.rest.user;
import com.chint.dc.api.DataCenterResult;
import com.chint.dc.api.dto.DataCenterOption;
import com.chint.dc.api.service.DataCenterService;
//import com.chint.dc.api.DataCenterResult;
//import com.chint.dc.api.dto.DataCenterOption;
//import com.chint.dc.api.service.DataCenterService;
import com.chint.domain.aggregates.standards.Ranks;
import com.chint.domain.aggregates.user.User;
@ -14,8 +14,6 @@ import com.chint.infrastructure.util.StringCheck;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.user.dto.*;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClients;
@ -23,23 +21,15 @@ import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Type;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
import static com.chint.infrastructure.constant.RankConstant.STANDARD_LEVEL_THREE;
import static com.chint.infrastructure.constant.SFConstant.OPENAI_BASE_URL;
import static com.chint.infrastructure.constant.SFConstant.USER_DATA_PATH;
@Slf4j
@Service
public class UserHttpRequestImpl implements UserHttpRequest {
private final String asSkUrl = SFConstant.AK_BASE_URL + SFConstant.GET_AK_URL + "?systemId=" + SFConstant.SYSTEM_ID;
private final String userUrl = OPENAI_BASE_URL + USER_DATA_PATH;
private final String userUrl = SFConstant.OPENAI_BASE_URL + SFConstant.USER_DATA_PATH;
private final String travelRankUrl = SFConstant.TRAVEL_RANK_BASE_URL + SFConstant.TRAVEL_RANK_PATH;
@Autowired
@ -63,8 +53,6 @@ public class UserHttpRequestImpl implements UserHttpRequest {
if (ranks != null) {
user.setStandardLevel(ranks.getStandardLevel());
// user.setStandardLevel("测试职级");
} else {
user.setStandardLevel(STANDARD_LEVEL_THREE);
}
return user;
}
@ -84,74 +72,73 @@ public class UserHttpRequestImpl implements UserHttpRequest {
}
private User loadSFInfo(User user) {
Gson gson = new Gson();
AccessKeyDTO akSkLoad = akSkLoad();
DataCenterOption option = new DataCenterOption();
option.setSk(akSkLoad.sk);
option.setAk(akSkLoad.ak);
option.setUrl(OPENAI_BASE_URL);
DataCenterService dataCenterService = new DataCenterService(option);
LinkedHashMap map = new LinkedHashMap<String, Object>();
map.put("LoginUsername", user.getEmployeeNo().toString());
map.put("start", 0);
map.put("pageSize", 99);
DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
Type type = new TypeToken<List<UserDataDTO>>() {
}.getType();
if (result.getData() != null) {
String companyCode = user.getCompanyCode();
if (companyCode == null) {
companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
}
String newCompanyCode = companyCode;
List<UserDataDTO> fromJson = gson.fromJson(result.getData().toString(), type);
if (fromJson.size() == 1) {
UserDataDTO userData = fromJson.get(0);
user.setCompanyCode(userData.getCompany());
user.setCompanyName(userData.getCompany_cn());
user.setWorkStatus(userData.getStatus());
user.setGender(userData.getGender());
user.setName(userData.getUname());
user.setPhoneNumber(userData.getMobilePhone());
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
} else {
Optional<UserDataDTO> first;
//这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
first = fromJson.stream()
.filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
.findFirst();
// Gson gson = new Gson();
// AccessKeyDTO akSkLoad = akSkLoad();
// DataCenterOption option = new DataCenterOption();
// option.setSk(akSkLoad.sk);
// option.setAk(akSkLoad.ak);
// option.setUrl(OPENAI_BASE_URL);
// DataCenterService dataCenterService = new DataCenterService(option);
// LinkedHashMap map = new LinkedHashMap<String, Object>();
// map.put("LoginUsername", user.getEmployeeNo().toString());
// map.put("start", 0);
// map.put("pageSize", 99);
// DataCenterResult result = dataCenterService.post(USER_DATA_PATH, map);
// Type type = new TypeToken<List<UserDataDTO>>() {
// }.getType();
// if (result.getData() != null) {
// String companyCode = user.getCompanyCode();
// if (companyCode == null) {
// companyCode = BaseContext.getCurrentUser().getUserLoginParam().getCompanyCode();
// }
// String newCompanyCode = companyCode;
//
// if (fromJson.size() == 1) {
// UserDataDTO userData = fromJson.get(0);
// user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender());
// user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone());
// user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel());
// } else {
// Optional<UserDataDTO> first;
//
// //这里进行判断如果是中文字段的CompanyCode需要用中文名进行匹配
// if (StringCheck.isFirstCharacterChinese(newCompanyCode)) {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany_cn().equals(newCompanyCode))
// .findFirst();
//
// } else {
// first = fromJson.stream()
// .filter(userData -> userData.getCompany().equals(newCompanyCode))
// .findFirst();
// }
// first.ifPresent(
// userData -> {
// user.setCompanyCode(userData.getCompany());
// user.setWorkStatus(userData.getStatus());
// user.setGender(userData.getGender());
// user.setName(userData.getUname());
// user.setPhoneNumber(userData.getMobilePhone());
// }
// );
// fromJson.stream()
// .filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
// .findFirst()
// .ifPresent(userData -> {
// user.setManaLevel(userData.getCust_manaLevel());
// user.setProfLevel(userData.getCust_profLevel());
// });
// }
// return user;
// } else {
// throw new RuntimeException("用户数据不存在");
// }
} else {
first = fromJson.stream()
.filter(userData -> userData.getCompany().equals(newCompanyCode))
.findFirst();
}
first.ifPresent(
userData -> {
user.setCompanyCode(userData.getCompany());
user.setWorkStatus(userData.getStatus());
user.setGender(userData.getGender());
user.setName(userData.getUname());
user.setPhoneNumber(userData.getMobilePhone());
user.setCompanyName(userData.getCompany_cn());
}
);
fromJson.stream()
.filter(userData -> userData.getUserId().equals(userData.getPersonIdExternal()))
.findFirst()
.ifPresent(userData -> {
user.setManaLevel(userData.getCust_manaLevel());
user.setProfLevel(userData.getCust_profLevel());
});
}
return user;
} else {
throw new RuntimeException("用户数据不存在");
}
// return null;
return null;
}

View File

@ -24,6 +24,3 @@ cTrip:
appKey: obk_zhengtai2024
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
requestSecret: zhengtai2024_nEbmKfOo
bpm:
H3BPMUrl: http://10.207.0.245:8012

View File

@ -1,33 +1,32 @@
server:
port: 8081
#chint:
# datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver
# host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
# # host: 10.9.56.48
# port: 3306
# database: itinerary_booking
# username: echo
# password: R3nd0mP@ssw0rd!
# url: https://gxdev03.chint.com/businesstravel/
chint:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
host: 10.10.24.44
host: rm-cn-jeo3lfy9q0006gso.rwlb.rds.aliyuncs.com
# host: 10.9.56.48
port: 6603
port: 3306
database: itinerary_booking
username: tripbook
password: W@Xgf25d&lRk*L0X#
username: echo
password: R3nd0mP@ssw0rd!
url: https://gxdev03.chint.com/businesstravel/
#chint:
# datasource:
# driver-class-name: com.mysql.cj.jdbc.Driver
# host: 10.10.24.44
# # host: 10.9.56.48
# port: 6603
# database: itinerary_booking
# username: tripbook
# password: W@Xgf25d&lRk*L0X#
# url: https://gxdev03.chint.com/businesstravel/
logging:
level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG
org.springframework.jdbc.core.StatementCreatorUtils: TRACE
root: info
cTrip:
@ -37,7 +36,4 @@ cTrip:
corpId: zhengtai2024
appKey: obk_zhengtai2024
appSecurity: fI3}FZX+zUdxPa2W!R6I2gYO
requestSecret: zhengtai2024_nEbmKfOo
bpm:
H3BPMUrl: http://10.207.0.245:8012
requestSecret: zhengtai2024_nEbmKfOo

View File

@ -16,7 +16,6 @@ import com.chint.interfaces.rest.ctrip.dto.location.CTripCountry;
import com.chint.interfaces.rest.ctrip.dto.login.CTripLoginParam;
import com.chint.interfaces.rest.ctrip.dto.login.PCResponse;
import com.chint.interfaces.rest.ctrip.dto.search.SearchOrderResponse;
import com.chint.interfaces.rest.ctrip.in.CTripNoteController;
import com.google.gson.Gson;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -51,9 +50,6 @@ public class CTripTest {
@Autowired
private SupplierService supplierService;
@Autowired
private CTripNoteController cTripNoteController;
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
//@Test
@ -153,7 +149,7 @@ public class CTripTest {
System.out.println(response);
}
// @Test
@Test
void searchAndHandlerData(){
BaseContext.setCurrentUser(user);
SupplierCallbackData supplierCallbackData =
@ -162,10 +158,4 @@ public class CTripTest {
supplierCallbackData.data(response);
supplierService.handleSupplierCallback(supplierCallbackData);
}
// @Test
void backData(){
BaseContext.setCurrentUser(user);
cTripNoteController.handlerData("30607415392","Paid","HotelContract");
}
}

View File

@ -4,23 +4,21 @@ import com.chint.domain.aggregates.user.User;
import com.chint.infrastructure.constant.LYConstant;
import com.chint.infrastructure.util.BaseContext;
import com.chint.interfaces.rest.base.PostRequest;
import com.chint.interfaces.rest.bpm.dot.*;
import com.chint.interfaces.rest.bpm.dto.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dto.BPMResponse;
import com.chint.interfaces.rest.bpm.dto.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dto.RescheduleDto;
import com.chint.interfaces.rest.ly.LYLoginRequest;
import com.chint.interfaces.rest.ly.LYPostRequest;
import com.chint.interfaces.rest.ly.LYTokenRequest;
import com.chint.interfaces.rest.ly.LYUserRequest;
import com.chint.interfaces.rest.ly.dto.applyordersync.*;
import com.chint.interfaces.rest.bpm.dot.BPMBaseRequest;
import com.chint.interfaces.rest.bpm.dot.BPMResponse;
import com.chint.interfaces.rest.bpm.dot.ExceedStandardDto;
import com.chint.interfaces.rest.bpm.dot.RescheduleDto;
import com.chint.interfaces.rest.ly.dto.commonresult.Result;
import com.chint.interfaces.rest.ly.dto.estimateprice.*;
import com.chint.interfaces.rest.ly.vo.estimateprice.TrainPriceVo;
import com.google.gson.Gson;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal;
@ -29,9 +27,6 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Map;
import static com.chint.infrastructure.constant.BPMConstant.H3BPM_EXCEED_STANDARD_URL;
@SpringBootTest
public class LYTest {
@ -51,9 +46,6 @@ public class LYTest {
@Autowired
private PostRequest httpPostRequest;
@Value("${bpm.H3BPMUrl}")
private String H3BPMUrl;
public static final String L_Y_BASE_URL = "https://api.qa.dttrip.cn/openapi";
public static final String L_Y_ORDER_PATH = "/openapi/api/TravelApplyOrder/ApplyOrderSync";
@ -73,7 +65,8 @@ public class LYTest {
private final String minPriceUrl = L_Y_BASE_URL + L_Y_HOTLE_MIN_PRICE_PATH;
private final String hotleListUrl = L_Y_BASE_URL + L_Y_HOTLE_LIST_PATH;
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx/StartWorkflowByEntityTransJson";
private final String ExceedStandardUrl = "http://10.207.0.245:8012/Portal/Webservices/ExternalStartService.asmx?op=StartWorkflowByEntityTransJson";
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
private User hxh = new User(1L, 231116009L, 1, "黄小恒", "1628870217@qq.com", "18296007063");
@ -290,13 +283,13 @@ public class LYTest {
// @Test
void loginLY() {
BaseContext.setCurrentUser(user);
System.out.println(loginRequest.login(LYConstant.L_Y_ENTRANCE_HOME, null));
System.out.println(loginRequest.login(LYConstant.L_Y_ENTRANCE_HOME,null));
}
// @Test
void loginLYPC() {
BaseContext.setCurrentUser(user);
System.out.println(loginRequest.loginPC(LYConstant.L_Y_ENTRANCE_HOME, null));
System.out.println(loginRequest.loginPC(LYConstant.L_Y_ENTRANCE_HOME,null));
}
//超标
@ -307,22 +300,20 @@ public class LYTest {
ExceedStandardDto exceedStandardDto = new ExceedStandardDto();
exceedStandardDto.setOrderType("酒店超标")//内容选项酒店超标火车票超标机票超标
.setOrderSource("携程商旅")//内容选项:携程商旅/同程商旅
.setOrderNo("001021214")//订单号
.setOrderNo("00002")//订单号
.setHotelStandard("标间")//酒店超标提供住宿标准
.setHotelName("酒店名称")//酒店超标提供酒店名称
.setHouseLayout("双人床")//酒店超标提供房型
.setSeatingStandard("")//火车票超标提供席别标准
.setCabinClass("")//机票超标提供舱等
.setExcessAmount(BigDecimal.valueOf(1000))//超标金额
.setExcessAmount(BigDecimal.valueOf(100))//超标金额
.setReason("酒店爆满订不到");//超标原因
String entityParamValues = gson.toJson(exceedStandardDto);
bpmRequest.setWorkflowCode("JT_FI_CLCESQ")//流程编码
.setUserCode("231116011")//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues);
BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
System.out.println("response = " + bpmBaseResponse);
BPMResponse response = bpmBaseResponse.getD();
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
System.out.println("response = " + response);
}
@ -348,9 +339,7 @@ public class LYTest {
.setUserCode("231116011")//sf号
.setFinishStart(true)//true会自动流转到下一审批点false:停在手工填写节点
.setEntityParamValues(entityParamValues);
BPMBaseResponse bpmBaseResponse = httpPostRequest.post(H3BPMUrl + H3BPM_EXCEED_STANDARD_URL, bpmRequest, BPMBaseResponse.class);
System.out.println("response = " + bpmBaseResponse);
BPMResponse response = bpmBaseResponse.getD();
BPMResponse response = httpPostRequest.post(ExceedStandardUrl, bpmRequest, BPMResponse.class);
System.out.println("response = " + response);
}

View File

@ -4,11 +4,9 @@ import cn.hutool.extra.pinyin.PinyinUtil;
import com.chint.domain.aggregates.order.Location;
import com.chint.domain.aggregates.user.User;
import com.chint.domain.repository.LocationRepository;
import com.chint.domain.repository.OrderDetailRepository;
import com.chint.domain.repository.RouteRepository;
import com.chint.infrastructure.util.Digest;
import com.chint.interfaces.rest.user.UserHttpRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,7 +16,6 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Slf4j
@SpringBootTest
class RouteApplicationTests {
@ -31,8 +28,6 @@ class RouteApplicationTests {
@Autowired
private RouteRepository routeRepository;
@Autowired
private OrderDetailRepository orderDetailRepository;
private User user = new User(1L, 230615020L, 1, "卢麟哲", "1033719135@qq.com", "15857193365");
@ -48,20 +43,16 @@ class RouteApplicationTests {
LocalDateTime parse = LocalDateTime.parse("2024-04-15 23:59:00", dateTimeFormatter);
System.out.println(parse);
}
// @Test
@Test
void loginSign() {
String sfno = "230615020";
String syscode = "FSSC";
String billcode = "CLSQ240225000099";
String companycode = "正泰集团股份有限公司";
String syscode = "abc";
String billcode = "CCC12321412323";
String companycode = "A30000001";
String sec = "Superdandan";
String timespan = "1708908662738";
String timespan = "12312321412312";
String s = Digest.md5(sfno + syscode + billcode + companycode + sec + timespan);
System.out.println(s);
// log.info("info");
// log.trace("trace");
// log.trace("trace");
// log.trace("trace");
}
// @Test
@ -101,16 +92,4 @@ class RouteApplicationTests {
routeRepository.deleteById(19L);
routeRepository.deleteById(19L);
}
// @Test
void deleteOrderDetail(){
orderDetailRepository.deleteById(15L);
orderDetailRepository.deleteById(18L);
orderDetailRepository.deleteById(19L);
orderDetailRepository.deleteById(20L);
orderDetailRepository.deleteById(23L);
orderDetailRepository.deleteById(26L);
orderDetailRepository.deleteById(28L);
orderDetailRepository.deleteById(31L);
orderDetailRepository.deleteById(33L);
}
}