添加高德同步代码
This commit is contained in:
parent
fc811fc9fb
commit
f6b2ffd1ee
|
@ -0,0 +1,26 @@
|
|||
package com.chint.domain.service.order_sync;
|
||||
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.domain.aggregates.order.RouteRequest;
|
||||
|
||||
public class AmapOrderSyncAdapter implements SupplierOrderSync{
|
||||
@Override
|
||||
public boolean syncSupplierOrder(RouteOrder order) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean syncRouteRequest(RouteRequest routeRequest) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelSyncSupplierOrder(RouteOrder order) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelRouteRequest(RouteRequest routeRequest) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -7,9 +7,7 @@ import com.chint.domain.factoriy.order.RouteOrderFactory;
|
|||
|
||||
public interface SupplierOrderSync {
|
||||
boolean syncSupplierOrder(RouteOrder order);
|
||||
|
||||
boolean syncRouteRequest(RouteRequest routeRequest);
|
||||
|
||||
boolean cancelSyncSupplierOrder(RouteOrder order);
|
||||
boolean cancelRouteRequest(RouteRequest routeRequest);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.chint.infrastructure.constant.SupplierNameConstant;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.chint.infrastructure.constant.SupplierNameConstant.*;
|
||||
|
||||
@Component
|
||||
public class SyncAdapter {
|
||||
|
||||
|
@ -17,8 +19,9 @@ public class SyncAdapter {
|
|||
|
||||
public SupplierOrderSync of(String supplierName) {
|
||||
return switch (supplierName) {
|
||||
case SupplierNameConstant.SUPPLIER_C_TRIP -> cTripOrderSyncAdapter;
|
||||
case SupplierNameConstant.SUPPLIER_L_Y -> lyOrderSyncAdapter;
|
||||
case SUPPLIER_C_TRIP -> cTripOrderSyncAdapter;
|
||||
case SUPPLIER_L_Y -> lyOrderSyncAdapter;
|
||||
case SUPPLIER_AMAP -> lyOrderSyncAdapter;
|
||||
default -> throw new NotFoundException(CommonMessageConstant.NOT_FOUND);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -14,6 +14,10 @@ public class AmapConstant {
|
|||
public static final String FINISHED_ORDER_URL = "/ws/car/open/enterprise/bill/detail/list";//企业完单数据分页查询
|
||||
public static final String CANCEL_AN_ORDER_URL = "/ws/car/open/enterprise/cancelOrder";//取消订单
|
||||
|
||||
//订单详情地址,查询城市信息
|
||||
public static final String AMAP_LOCATION_PATH = "/ws/boss/enterprise/openapi/city/query";//取消订单
|
||||
|
||||
|
||||
//登录路径
|
||||
public static final String AMAP_LOGIN_PATH = "/node";
|
||||
}
|
||||
|
|
|
@ -5,8 +5,14 @@ public class SupplierNameConstant {
|
|||
public static final String SUPPLIER_C_TRIP_CN_NAME = "携程";
|
||||
public static final String SUPPLIER_C_TRIP_EXTENSION_NAME = "携程预定";
|
||||
public static final String SUPPLIER_C_TRIP_BPM_NAME = "携程商旅";
|
||||
|
||||
public static final String SUPPLIER_L_Y = "LY";
|
||||
public static final String SUPPLIER_L_Y_CN_NAME = "同程";
|
||||
public static final String SUPPLIER_L_Y_EXTENSION_NAME = "同程预定";
|
||||
public static final String SUPPLIER_L_Y_BPM_NAME = "同程商旅";
|
||||
|
||||
public static final String SUPPLIER_AMAP = "Amap";
|
||||
public static final String SUPPLIER_AMAP_CN_NAME = "高德";
|
||||
public static final String SUPPLIER_AMAP_EXTENSION_NAME = "高德预定";
|
||||
public static final String SUPPLIER_AMAP_BPM_NAME = "高德商旅";
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.chint.interfaces.rest.amap;
|
||||
|
||||
import com.chint.interfaces.rest.amap.request.AmapRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AmapLocationRequest {
|
||||
|
||||
@Autowired
|
||||
private AmapRequest amapRequest;
|
||||
|
||||
@Value("${amap.baseUrl}")
|
||||
private String BaseUrl;
|
||||
|
||||
|
||||
// public
|
||||
}
|
|
@ -1,21 +1,27 @@
|
|||
package com.chint.interfaces.rest.amap;
|
||||
|
||||
import com.chint.application.commands.UserLoginCommand;
|
||||
import com.chint.domain.aggregates.user.User;
|
||||
import com.chint.domain.repository.UserNameRepository;
|
||||
import com.chint.infrastructure.echo_framework.annotation.ListenTo;
|
||||
import com.chint.interfaces.rest.amap.dto.UserQueryResponse;
|
||||
import com.chint.interfaces.rest.amap.request.AmapRequest;
|
||||
import com.chint.interfaces.rest.user.UserHttpRequest;
|
||||
import com.chint.interfaces.rest.user.UserSync;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import static com.chint.infrastructure.constant.AmapConstant.*;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class AmapUserRequest {
|
||||
public class AmapUserRequest implements UserSync {
|
||||
|
||||
@Autowired
|
||||
private AmapRequest amapRequest;
|
||||
|
@ -59,6 +65,21 @@ public class AmapUserRequest {
|
|||
return amapRequest.post(updateUserUrl, baseRequestParam, BaseResponse.class);
|
||||
}
|
||||
|
||||
|
||||
@ListenTo(command = "UserLoginCommand",order = 3)
|
||||
@Override
|
||||
public User syncUserInfoToSupplier(UserLoginCommand command) {
|
||||
User user = command.getUser();
|
||||
// 如果超过一天,执行同步代码
|
||||
if (user.checkSyncTime()) {
|
||||
log.info("开始往高德同步用户信息");
|
||||
CompletableFuture.runAsync(() -> syncUser(command.getUser()));
|
||||
} else {
|
||||
log.info("未超过一天,不执行高德同步");
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class UserParam extends BaseRequestParam {
|
||||
private String userId; // 用户Id
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
package com.chint.interfaces.rest.amap.dto.location;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LocationRequestParam {
|
||||
private String keywords;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.chint.interfaces.rest.amap.dto.location;
|
||||
|
||||
public class LocationResponse {
|
||||
}
|
Loading…
Reference in New Issue