Feat: 添加AIp策略
This commit is contained in:
parent
90e99a3654
commit
a9250ed81c
|
|
@ -18,7 +18,10 @@ public abstract class ApiConfigService {
|
|||
@Resource
|
||||
protected SuperiorApiDevConfigService superiorApiDevConfigService;
|
||||
|
||||
protected Map<String, String> getDevConfig(ApiFrom apiFrom) {
|
||||
abstract public ApiFrom getApiFrom();
|
||||
|
||||
public Map<String, String> getDevConfig() {
|
||||
ApiFrom apiFrom = getApiFrom();
|
||||
List<SuperiorApiDevConfigDO> list = superiorApiDevConfigService.list(
|
||||
new LambdaQueryWrapperX<SuperiorApiDevConfigDO>()
|
||||
.eqIfPresent(SuperiorApiDevConfigDO::getHaokaSuperiorApiId, apiFrom.getId())
|
||||
|
|
@ -27,6 +30,9 @@ public abstract class ApiConfigService {
|
|||
return list.stream().collect(Collectors.toMap(SuperiorApiDevConfigDO::getCode, SuperiorApiDevConfigDO::getValue));
|
||||
}
|
||||
|
||||
public String getConfigValue(String key) {
|
||||
return getDevConfig().get(key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,13 +6,20 @@ import lombok.Getter;
|
|||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ApiFrom {
|
||||
Unknown(0L, "未知道接口"),
|
||||
LianTong(1L, "联通Api"),
|
||||
GuangZhouDX(2L, "广州电信Api"),
|
||||
HaiNanDX(3L, "海南电信Api"),
|
||||
HuNanDX(4L, "湖南电信Api");
|
||||
Unknown(0L, "未知道接口", "Unknown"),
|
||||
LianTong(1L, "联通Api", ApiFrom.LianTongApiDealStrategy),
|
||||
GuangZhouDX(2L, "广州电信Api", ApiFrom.GuangZhouDXApiDealStrategy),
|
||||
HaiNanDX(3L, "海南电信Api", ApiFrom.HaiNanDXApiDealStrategy),
|
||||
HuNanDX(4L, "湖南电信Api", ApiFrom.HuNanDXApiDealStrategy);
|
||||
private final Long id;
|
||||
private final String name;
|
||||
private final String apiDealStrategy;
|
||||
|
||||
|
||||
public static final String LianTongApiDealStrategy = "LianTongApiDealStrategy";
|
||||
public static final String GuangZhouDXApiDealStrategy = "GuangZhouDXApiDealStrategy";
|
||||
public static final String HaiNanDXApiDealStrategy = "HaiNanDXApiDealStrategy";
|
||||
public static final String HuNanDXApiDealStrategy = "HuNanDXApiDealStrategy";
|
||||
|
||||
public static ApiFrom fromId(Long id) {
|
||||
ApiFrom[] values = values();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class ApiGuangZhouDXService extends ApiConfigService {
|
|||
|
||||
|
||||
public String createOrder(GdOrderCreateRequestParam param) {
|
||||
Map<String, String> devConfig = getDevConfig(ApiFrom.GuangZhouDX);
|
||||
Map<String, String> devConfig = getDevConfig();
|
||||
String urlPrefix = devConfig.get(Key_urlPrefix);
|
||||
String publicKey = devConfig.get(Key_publicKey);
|
||||
try {
|
||||
|
|
@ -32,7 +32,7 @@ public class ApiGuangZhouDXService extends ApiConfigService {
|
|||
|
||||
|
||||
public String queryOrder(GdOrderQueryRequestParam param) {
|
||||
Map<String, String> devConfig = getDevConfig(ApiFrom.GuangZhouDX);
|
||||
Map<String, String> devConfig = getDevConfig();
|
||||
String urlPrefix = devConfig.get(Key_urlPrefix);
|
||||
String publicKey = devConfig.get(Key_publicKey);
|
||||
try {
|
||||
|
|
@ -43,4 +43,9 @@ public class ApiGuangZhouDXService extends ApiConfigService {
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiFrom getApiFrom() {
|
||||
return ApiFrom.GuangZhouDX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class ApiHaiNanDXService extends ApiConfigService {
|
|||
public static final String Key_privateKey = "privateKey";
|
||||
|
||||
private HaiNanDianXinApi.HaiNanDianXinApiConfig getConfig() {
|
||||
Map<String, String> devConfig = this.getDevConfig(ApiFrom.HaiNanDX);
|
||||
Map<String, String> devConfig = this.getDevConfig();
|
||||
|
||||
String url = devConfig.get(Key_url);
|
||||
String appCode = devConfig.get(Key_appCode);
|
||||
|
|
@ -59,4 +59,9 @@ public class ApiHaiNanDXService extends ApiConfigService {
|
|||
synOrderInfo(HaiNanDianXinApi.SynOrderInfoRequest param) throws UnirestException {
|
||||
return HaiNanDianXinApi.synOrderInfo(this.getConfig(), param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiFrom getApiFrom() {
|
||||
return ApiFrom.HaiNanDX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class ApiHuNanDXService extends ApiConfigService {
|
|||
* @return 配置信息对象 {@link HaiNanDxInfo.ConfigInfo}
|
||||
*/
|
||||
private HaiNanDxInfo.ConfigInfo getConfig() {
|
||||
Map<String, String> devConfig = getDevConfig(ApiFrom.HuNanDX);
|
||||
Map<String, String> devConfig = getDevConfig();
|
||||
return new HaiNanDxInfo.ConfigInfo(
|
||||
devConfig.get(Key_accessToken),
|
||||
devConfig.get(Key_secret),
|
||||
|
|
@ -127,4 +127,9 @@ public class ApiHuNanDXService extends ApiConfigService {
|
|||
checkBlackList(HaiNanDxInfo.BlackListCheckParam param) throws Exception {
|
||||
return HuNanDXApi.checkBlackList(getConfig(), param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiFrom getApiFrom() {
|
||||
return ApiFrom.HuNanDX;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import java.util.Map;
|
|||
@Service
|
||||
public class ApiLianTongService extends ApiConfigService {
|
||||
|
||||
private ZopClient lianTongZopClient(ApiFrom apiFrom) {
|
||||
Map<String, String> devConfig = this.getDevConfig(apiFrom);
|
||||
public ZopClient lianTongZopClient() {
|
||||
Map<String, String> devConfig = this.getDevConfig();
|
||||
return this.lianTongZopClient(devConfig);
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
}
|
||||
|
||||
public KingNumSelectResponse lianTongSelectNumber(KingNumSelectRequest kingNumSelectRequest) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(kingNumSelectRequest);
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @return KingNumStateChangeResponse
|
||||
*/
|
||||
public KingNumStateChangeResponse lianTongZhanHao(KingNumStateChangeRequest request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @return KingPostInfoResponse
|
||||
*/
|
||||
public KingPostInfoResponse lianTongPostInfoQuery(KingPostInfoRequest request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @return KingIdentityCustV2Response
|
||||
*/
|
||||
public KingIdentityCustV2Response lianTongSubmitUserInfo(KingIdentityCustV2Request request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @return KingPreOrderSyncResponse
|
||||
*/
|
||||
public KingPreOrderSyncResponse lianTongPreOrderSync(KingPreOrderSyncRequest request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* body N JSONString V500 {\"mallOrderId\":\"369705189376\",\"orderNo\":\"7019042323299970\",\"preNumber\":\"17600271211\",\"shortUrl\":\"https://url.cn/5t6aZM\"}(shortUrl:非必返回参数,证件信息大于十六岁会返回该参数。)
|
||||
*/
|
||||
public KingOrderSyncResponse lianTongOrderSyncV2(KingOrderSyncV2Request request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
// request.setGoodsId(GOODS_ID);
|
||||
// request.setProvinceCode(PROVINCE_CODE);
|
||||
// request.setCityCode(CITY_CODE);
|
||||
|
|
@ -116,7 +116,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @param type 消息类型:3-下单消息;4-订单状态变更消息
|
||||
*/
|
||||
public KingMessageGetResponse lianTongMessageGet(String type) {
|
||||
Map<String, String> devConfig = this.getDevConfig(ApiFrom.LianTong);
|
||||
Map<String, String> devConfig = this.getDevConfig();
|
||||
String msgChannel = devConfig.get(LianTongApiUtil.KEY_msgChannel);
|
||||
|
||||
KingMessageGetRequest request = new KingMessageGetRequest();
|
||||
|
|
@ -135,7 +135,7 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
KingMessageDelRequest request = new KingMessageDelRequest();
|
||||
request.setType(type);
|
||||
request.setMsgId(megIds);
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +148,12 @@ public class ApiLianTongService extends ApiConfigService {
|
|||
* @return KingNumSelectResponse
|
||||
*/
|
||||
public KingNumSelectResponse lianTongTokenSelectNumber(KingNumTokenSelectRequest request) {
|
||||
ZopClient zopClient = this.lianTongZopClient(ApiFrom.LianTong);
|
||||
ZopClient zopClient = this.lianTongZopClient();
|
||||
return zopClient.execute(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiFrom getApiFrom() {
|
||||
return ApiFrom.LianTong;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ public class LianTongApiUtil {
|
|||
|
||||
public static final String KEY_msgChannel = "msgChannel";
|
||||
|
||||
public static final String KEY_channel = "channel";
|
||||
|
||||
public static ZopClient getClient( String reqUrl,String appCode ,String hmac,String aes){
|
||||
// String appCode = "1A2715D230724895AFB318FE8919244A";
|
||||
// String hmac = "wi/iBAuOWhfn63nEw8/yi2g1kypvdc1X7qt901z1G+uZN2JzdW0SwsxBwYDGYBDW+etr2i4V/rLpXp5yQb9BBg==";
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.address;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.address.vo.AddressVo;
|
||||
import cn.iocoder.yudao.module.haoka.service.address.HaoKaAddressService;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.ApiDealResp;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.OrderApiCreateParam;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.OrderApiCreateResp;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.strategy.LianTongApiDealStrategy;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.util.List;
|
||||
|
||||
|
|
@ -46,4 +50,14 @@ public class AddressAreaController {
|
|||
return success(haoKaAddressService.getAllAddress());
|
||||
}
|
||||
|
||||
@Autowired
|
||||
@Qualifier(ApiFrom.LianTongApiDealStrategy)
|
||||
private LianTongApiDealStrategy lianTongApiDealStrategy;
|
||||
|
||||
@Operation(summary = "联通订单全部流程接口")
|
||||
@PostMapping("/preOrder")
|
||||
public CommonResult<ApiDealResp<OrderApiCreateResp>> proOrder(@RequestBody OrderApiCreateParam param) {
|
||||
ApiDealResp<OrderApiCreateResp> order = lianTongApiDealStrategy.createOrder(param);
|
||||
return success(order);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class HaoKaProductPageReqVO extends PageParam {
|
|||
private Long haokaProductTypeId;
|
||||
|
||||
@Schema(description = "归属地")
|
||||
private Integer belongAreaCode;
|
||||
private String belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
private Long haokaProductChannelId;
|
||||
|
|
@ -76,4 +76,4 @@ public class HaoKaProductPageReqVO extends PageParam {
|
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class HaoKaProductRespVO {
|
|||
|
||||
@Schema(description = "归属地", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("归属地")
|
||||
private Integer belongAreaCode;
|
||||
private String belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
@ExcelProperty("产品渠道")
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class HaoKaProductSaveReqVO {
|
|||
|
||||
@Schema(description = "归属地", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "归属地不能为空")
|
||||
private Integer belongAreaCode;
|
||||
private String belongAreaCode;
|
||||
|
||||
@Schema(description = "产品渠道", example = "6850")
|
||||
private Long haokaProductChannelId;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class HaoKaProductDO extends BaseDO {
|
|||
/**
|
||||
* 归属地
|
||||
*/
|
||||
private Integer belongAreaCode;
|
||||
private String belongAreaCode;
|
||||
/**
|
||||
* 产品渠道
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ApiDealResp<T> {
|
||||
private Boolean success;
|
||||
private String msg;
|
||||
private T data;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class ApiDealServiceImpl implements ApiDealStrategyService {
|
||||
|
||||
@Resource
|
||||
private Map<String, ApiDealStrategy> strategyMap;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
|
||||
private ApiDealStrategy getApiDealStrategy(Long productId) {
|
||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(productId);
|
||||
if (onSaleProductPreOrder == null) {
|
||||
return null;
|
||||
}
|
||||
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
|
||||
if (apiFrom == null) {
|
||||
return null;
|
||||
}
|
||||
return this.getApiDealStrategy(apiFrom);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param) {
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
|
||||
if (apiDealStrategy == null) {
|
||||
return new ApiDealResp<>(false, "NoneService", null);
|
||||
}
|
||||
return apiDealStrategy.createOrder(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(OrderApiCreateParam param) {
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(param.getProductId());
|
||||
if (apiDealStrategy == null) {
|
||||
return new ApiDealResp<>(false, "NoneService", null);
|
||||
}
|
||||
return apiDealStrategy.queryOrder(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealStrategy getApiDealStrategy(ApiFrom apiFrom) {
|
||||
return strategyMap.get(apiFrom.getApiDealStrategy());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
public interface ApiDealStrategy {
|
||||
ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param);
|
||||
|
||||
ApiDealResp<OrderApiQueryResp > queryOrder(OrderApiCreateParam param);
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
|
||||
public interface ApiDealStrategyService extends ApiDealStrategy{
|
||||
ApiDealStrategy getApiDealStrategy(ApiFrom apiFrom);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderApiCreateParam {
|
||||
|
||||
private String outerOrderId;
|
||||
|
||||
/**
|
||||
* 订单ID AAA
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品ID AAA
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
|
||||
/**
|
||||
* 购买号码 AAA
|
||||
*/
|
||||
private String planMobile;
|
||||
|
||||
private String addressMobile;
|
||||
|
||||
/**
|
||||
* 证件姓名 AAA
|
||||
*/
|
||||
private String idCardName;
|
||||
|
||||
/**
|
||||
* 身份证号 AAA
|
||||
*/
|
||||
private String idCardNum;
|
||||
|
||||
/**
|
||||
* 地址区 AAA
|
||||
*/
|
||||
private String addressDistrict;
|
||||
|
||||
/**
|
||||
* 详细地址 AAA
|
||||
*/
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单 DO
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@TableName("haoka_orders")
|
||||
@KeySequence("haoka_orders_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderApiCreateResp extends BaseDO {
|
||||
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 生产商ID
|
||||
*/
|
||||
private Long producerId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String supplierProductName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private String supplierProductSku;
|
||||
/**
|
||||
* 外部订单编号
|
||||
*/
|
||||
private String sourceId;
|
||||
/**
|
||||
* 外部SKU
|
||||
*/
|
||||
private String sourceSku;
|
||||
/**
|
||||
* 分享ID
|
||||
*/
|
||||
private Long shareId;
|
||||
/**
|
||||
* 订单来源
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_channel 对应的类}
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 用户下单时间
|
||||
*/
|
||||
private LocalDateTime orderedAt;
|
||||
/**
|
||||
* 购买号码
|
||||
*/
|
||||
private String planMobile;
|
||||
/**
|
||||
* 生产时间
|
||||
*/
|
||||
private LocalDateTime producedAt;
|
||||
/**
|
||||
* 生产号码
|
||||
*/
|
||||
private String planMobileProduced;
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
private LocalDateTime deliveredAt;
|
||||
/**
|
||||
* 证件姓名
|
||||
*/
|
||||
private String idCardName;
|
||||
/**
|
||||
* 激活时间
|
||||
*/
|
||||
private LocalDateTime activatedAt;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCardNum;
|
||||
/**
|
||||
* 充值时间
|
||||
*/
|
||||
private LocalDateTime rechargedAt;
|
||||
/**
|
||||
* 地址省编码
|
||||
*/
|
||||
private String addressProvinceCode;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 地址市编码
|
||||
*/
|
||||
private String addressCityCode;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String amount;
|
||||
/**
|
||||
* 地址区编码
|
||||
*/
|
||||
private String addressDistrictCode;
|
||||
/**
|
||||
* 状态变更时间
|
||||
*/
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
/**
|
||||
* 地址省
|
||||
*/
|
||||
private String addressProvince;
|
||||
/**
|
||||
* 交易状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO pay_refund_status 对应的类}
|
||||
*/
|
||||
private String refundStatus;
|
||||
/**
|
||||
* 地址市
|
||||
*/
|
||||
private String addressCity;
|
||||
/**
|
||||
* 激活状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_active_status 对应的类}
|
||||
*/
|
||||
private String activeStatus;
|
||||
/**
|
||||
* 地址区
|
||||
*/
|
||||
private String addressDistrict;
|
||||
/**
|
||||
* ICCID
|
||||
*/
|
||||
private String iccid;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 外部订单编号
|
||||
*/
|
||||
private String realSourceId;
|
||||
/**
|
||||
* 收件人电话
|
||||
*/
|
||||
private String addressMobile;
|
||||
/**
|
||||
* 图片大小
|
||||
*/
|
||||
private Long picSize;
|
||||
/**
|
||||
* 收件人姓名
|
||||
*/
|
||||
private String addressName;
|
||||
/**
|
||||
* 归属地省
|
||||
*/
|
||||
private String regionP;
|
||||
/**
|
||||
* 物流公司ID
|
||||
*/
|
||||
private Long trackingCompanyId;
|
||||
/**
|
||||
* 归属地市
|
||||
*/
|
||||
private String regionC;
|
||||
/**
|
||||
* 物流单号
|
||||
*/
|
||||
private String trackingNumber;
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String merchantName;
|
||||
/**
|
||||
* 买家备注
|
||||
*/
|
||||
private String buyerMemo;
|
||||
/**
|
||||
* 上游状态
|
||||
*/
|
||||
private String upStatus;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String sellerMemo;
|
||||
/**
|
||||
* 上游订单号
|
||||
*/
|
||||
private String upstreamOrderId;
|
||||
/**
|
||||
* 生产备注
|
||||
*/
|
||||
private String producerMemo;
|
||||
/**
|
||||
* 镇/乡
|
||||
*/
|
||||
private String town;
|
||||
/**
|
||||
* 订单状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_status 对应的类}
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
private String trackingCompany;
|
||||
/**
|
||||
* 标旗
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_flag 对应的类}
|
||||
*/
|
||||
private Long flag;
|
||||
/**
|
||||
* 订单状态名称
|
||||
*/
|
||||
private String statusName;
|
||||
/**
|
||||
* 预警区域
|
||||
*/
|
||||
private String warnArea;
|
||||
/**
|
||||
* 加密收货电话
|
||||
*/
|
||||
private String encryptAddressMobile;
|
||||
/**
|
||||
* 原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 加密收货人姓名
|
||||
*/
|
||||
private String encryptAddressName;
|
||||
/**
|
||||
* 加密证件姓名
|
||||
*/
|
||||
private String encryptIdCardName;
|
||||
/**
|
||||
* 加密证件号码
|
||||
*/
|
||||
private String encryptIdCardNum;
|
||||
/**
|
||||
* 加密详细地址
|
||||
*/
|
||||
private String encryptAddress;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.*;
|
||||
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderApiQueryParam {
|
||||
|
||||
/**
|
||||
* 订单ID AAA
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 产品ID AAA
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
|
||||
/**
|
||||
* 购买号码 AAA
|
||||
*/
|
||||
private String planMobile;
|
||||
|
||||
private String addressMobile;
|
||||
|
||||
/**
|
||||
* 证件姓名 AAA
|
||||
*/
|
||||
private String idCardName;
|
||||
|
||||
/**
|
||||
* 身份证号 AAA
|
||||
*/
|
||||
private String idCardNum;
|
||||
|
||||
/**
|
||||
* 地址区 AAA
|
||||
*/
|
||||
private String addressDistrict;
|
||||
|
||||
/**
|
||||
* 详细地址 AAA
|
||||
*/
|
||||
private String address;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,277 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单 DO
|
||||
*
|
||||
* @author xiongxiong
|
||||
*/
|
||||
@TableName("haoka_orders")
|
||||
@KeySequence("haoka_orders_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderApiQueryResp extends BaseDO {
|
||||
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 生产商ID
|
||||
*/
|
||||
private Long producerId;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String supplierProductName;
|
||||
/**
|
||||
* 商品编码
|
||||
*/
|
||||
private String supplierProductSku;
|
||||
/**
|
||||
* 外部订单编号
|
||||
*/
|
||||
private String sourceId;
|
||||
/**
|
||||
* 外部SKU
|
||||
*/
|
||||
private String sourceSku;
|
||||
/**
|
||||
* 分享ID
|
||||
*/
|
||||
private Long shareId;
|
||||
/**
|
||||
* 订单来源
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_channel 对应的类}
|
||||
*/
|
||||
private String source;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
private String productSku;
|
||||
/**
|
||||
* 用户下单时间
|
||||
*/
|
||||
private LocalDateTime orderedAt;
|
||||
/**
|
||||
* 购买号码
|
||||
*/
|
||||
private String planMobile;
|
||||
/**
|
||||
* 生产时间
|
||||
*/
|
||||
private LocalDateTime producedAt;
|
||||
/**
|
||||
* 生产号码
|
||||
*/
|
||||
private String planMobileProduced;
|
||||
/**
|
||||
* 发货时间
|
||||
*/
|
||||
private LocalDateTime deliveredAt;
|
||||
/**
|
||||
* 证件姓名
|
||||
*/
|
||||
private String idCardName;
|
||||
/**
|
||||
* 激活时间
|
||||
*/
|
||||
private LocalDateTime activatedAt;
|
||||
/**
|
||||
* 身份证号
|
||||
*/
|
||||
private String idCardNum;
|
||||
/**
|
||||
* 充值时间
|
||||
*/
|
||||
private LocalDateTime rechargedAt;
|
||||
/**
|
||||
* 地址省编码
|
||||
*/
|
||||
private String addressProvinceCode;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String memo;
|
||||
/**
|
||||
* 地址市编码
|
||||
*/
|
||||
private String addressCityCode;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private String amount;
|
||||
/**
|
||||
* 地址区编码
|
||||
*/
|
||||
private String addressDistrictCode;
|
||||
/**
|
||||
* 状态变更时间
|
||||
*/
|
||||
private LocalDateTime statusUpdatedAt;
|
||||
/**
|
||||
* 地址省
|
||||
*/
|
||||
private String addressProvince;
|
||||
/**
|
||||
* 交易状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO pay_refund_status 对应的类}
|
||||
*/
|
||||
private String refundStatus;
|
||||
/**
|
||||
* 地址市
|
||||
*/
|
||||
private String addressCity;
|
||||
/**
|
||||
* 激活状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_active_status 对应的类}
|
||||
*/
|
||||
private String activeStatus;
|
||||
/**
|
||||
* 地址区
|
||||
*/
|
||||
private String addressDistrict;
|
||||
/**
|
||||
* ICCID
|
||||
*/
|
||||
private String iccid;
|
||||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 外部订单编号
|
||||
*/
|
||||
private String realSourceId;
|
||||
/**
|
||||
* 收件人电话
|
||||
*/
|
||||
private String addressMobile;
|
||||
/**
|
||||
* 图片大小
|
||||
*/
|
||||
private Long picSize;
|
||||
/**
|
||||
* 收件人姓名
|
||||
*/
|
||||
private String addressName;
|
||||
/**
|
||||
* 归属地省
|
||||
*/
|
||||
private String regionP;
|
||||
/**
|
||||
* 物流公司ID
|
||||
*/
|
||||
private Long trackingCompanyId;
|
||||
/**
|
||||
* 归属地市
|
||||
*/
|
||||
private String regionC;
|
||||
/**
|
||||
* 物流单号
|
||||
*/
|
||||
private String trackingNumber;
|
||||
/**
|
||||
* 供应商
|
||||
*/
|
||||
private String merchantName;
|
||||
/**
|
||||
* 买家备注
|
||||
*/
|
||||
private String buyerMemo;
|
||||
/**
|
||||
* 上游状态
|
||||
*/
|
||||
private String upStatus;
|
||||
/**
|
||||
* 卖家备注
|
||||
*/
|
||||
private String sellerMemo;
|
||||
/**
|
||||
* 上游订单号
|
||||
*/
|
||||
private String upstreamOrderId;
|
||||
/**
|
||||
* 生产备注
|
||||
*/
|
||||
private String producerMemo;
|
||||
/**
|
||||
* 镇/乡
|
||||
*/
|
||||
private String town;
|
||||
/**
|
||||
* 订单状态
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_status 对应的类}
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 物流公司名称
|
||||
*/
|
||||
private String trackingCompany;
|
||||
/**
|
||||
* 标旗
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_flag 对应的类}
|
||||
*/
|
||||
private Long flag;
|
||||
/**
|
||||
* 订单状态名称
|
||||
*/
|
||||
private String statusName;
|
||||
/**
|
||||
* 预警区域
|
||||
*/
|
||||
private String warnArea;
|
||||
/**
|
||||
* 加密收货电话
|
||||
*/
|
||||
private String encryptAddressMobile;
|
||||
/**
|
||||
* 原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 加密收货人姓名
|
||||
*/
|
||||
private String encryptAddressName;
|
||||
/**
|
||||
* 加密证件姓名
|
||||
*/
|
||||
private String encryptIdCardName;
|
||||
/**
|
||||
* 加密证件号码
|
||||
*/
|
||||
private String encryptIdCardNum;
|
||||
/**
|
||||
* 加密详细地址
|
||||
*/
|
||||
private String encryptAddress;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api.strategy;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiGuangZhouDXService;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiLianTongService;
|
||||
import cn.iocoder.yudao.module.haoka.api.guangdong.GdOrderCreateRequestParam;
|
||||
import cn.iocoder.yudao.module.haoka.api.guangdong.inner.GdOrderQueryRequestParam;
|
||||
import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.LianTongApiUtil;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongArea;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongAreaUtils;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingIdentityCustV2Request;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingNumStateChangeRequest;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingOrderSyncV2Request;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingPreOrderSyncRequest;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingIdentityCustV2Response;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingNumStateChangeResponse;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingPreOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import com.mashape.unirest.http.exceptions.UnirestException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Component(ApiFrom.GuangZhouDXApiDealStrategy)
|
||||
public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
||||
|
||||
@Resource
|
||||
private ApiGuangZhouDXService apiGuangZhouDXService;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param) {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
|
||||
LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
|
||||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
|
||||
|
||||
ApiDealResp<OrderApiCreateResp> result = new ApiDealResp<>();
|
||||
|
||||
GdOrderCreateRequestParam createParam = new GdOrderCreateRequestParam();
|
||||
|
||||
String order = apiGuangZhouDXService.createOrder(createParam);
|
||||
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(order);
|
||||
|
||||
result.setData(orderApiCreateResp);
|
||||
result.setSuccess(true);
|
||||
// result.setMsg(response.getRspDesc());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(OrderApiCreateParam param) {
|
||||
ApiDealResp<OrderApiQueryResp> result = new ApiDealResp<>();
|
||||
|
||||
|
||||
GdOrderQueryRequestParam queryParam = new GdOrderQueryRequestParam();
|
||||
String responseInfo = apiGuangZhouDXService.queryOrder(queryParam);
|
||||
|
||||
if (responseInfo == null) {
|
||||
result.setSuccess(false);
|
||||
// result.setMsg(responseInfo.getErrMsg());
|
||||
return result;
|
||||
}
|
||||
|
||||
OrderApiQueryResp orderApiQueryResp = new OrderApiQueryResp();
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
|
||||
result.setData(orderApiQueryResp);
|
||||
result.setSuccess(true);
|
||||
// result.setMsg(responseInfo.g());
|
||||
return result;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api.strategy;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiGuangZhouDXService;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiHaiNanDXService;
|
||||
import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi;
|
||||
import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongArea;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongAreaUtils;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import com.mashape.unirest.http.exceptions.UnirestException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Component(ApiFrom.HaiNanDXApiDealStrategy)
|
||||
public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
||||
|
||||
@Resource
|
||||
private ApiHaiNanDXService apiHaiNanDXService;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param) {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
|
||||
LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
|
||||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
|
||||
|
||||
ApiDealResp<OrderApiCreateResp> result = new ApiDealResp<>();
|
||||
// 0、占用号码 lianTongZhanHao
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
// 3、用 token提交正式订单 lianTongOrderSyncV2
|
||||
|
||||
HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest();
|
||||
try {
|
||||
HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.SynOrderInfoResponse> responseInfo = apiHaiNanDXService.synOrderInfo(createParam);
|
||||
HaiNanDianXinApi.SynOrderInfoResponse data = responseInfo.getData();
|
||||
if (data==null){
|
||||
result.setSuccess(false);
|
||||
result.setMsg(responseInfo.getErrMsg());
|
||||
return result;
|
||||
}
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(responseInfo);
|
||||
|
||||
result.setData(orderApiCreateResp);
|
||||
result.setSuccess(true);
|
||||
result.setMsg(responseInfo.getErrMsg());
|
||||
return result;
|
||||
|
||||
} catch (UnirestException e) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(OrderApiCreateParam param) {
|
||||
ApiDealResp<OrderApiQueryResp> result = new ApiDealResp<>();
|
||||
try {
|
||||
|
||||
HaiNanDianXinApi.QueryOrderInfoRequest queryParam = new HaiNanDianXinApi.QueryOrderInfoRequest();
|
||||
HaiNanDianXinApi.HaiNanResponseInfo<HaiNanDianXinApi.QueryOrderInfoResponse> responseInfo = apiHaiNanDXService.queryOrderInfo(queryParam);
|
||||
|
||||
if (responseInfo.getData() == null) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(responseInfo.getErrMsg());
|
||||
return result;
|
||||
}
|
||||
|
||||
OrderApiQueryResp orderApiQueryResp = new OrderApiQueryResp();
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
|
||||
result.setData(orderApiQueryResp);
|
||||
result.setSuccess(true);
|
||||
result.setMsg(responseInfo.getErrMsg());
|
||||
return result;
|
||||
|
||||
} catch (UnirestException e) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api.strategy;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiGuangZhouDXService;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiHuNanDXService;
|
||||
import cn.iocoder.yudao.module.haoka.api.hainandianxin.HaiNanDianXinApi;
|
||||
import cn.iocoder.yudao.module.haoka.api.hunandianxin.HaiNanDxInfo;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongArea;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongAreaUtils;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import com.mashape.unirest.http.exceptions.UnirestException;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Component(ApiFrom.HuNanDXApiDealStrategy)
|
||||
public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||
|
||||
@Resource
|
||||
private ApiHuNanDXService apiHuNanDXService;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param) {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
|
||||
LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
|
||||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
|
||||
|
||||
ApiDealResp<OrderApiCreateResp> result = new ApiDealResp<>();
|
||||
// 0、占用号码 lianTongZhanHao
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
// 3、用 token提交正式订单 lianTongOrderSyncV2
|
||||
|
||||
HaiNanDxInfo.SyncOrderParam orderParam = new HaiNanDxInfo.SyncOrderParam();
|
||||
|
||||
HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest();
|
||||
try {
|
||||
|
||||
HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.SyncOrderResp> responseInfo = apiHuNanDXService.syncOrder(orderParam);
|
||||
|
||||
if (responseInfo.getData() == null) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(responseInfo.getRes_message());
|
||||
return result;
|
||||
}
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(responseInfo);
|
||||
|
||||
result.setData(orderApiCreateResp);
|
||||
result.setSuccess(true);
|
||||
result.setMsg(responseInfo.getRes_message());
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(OrderApiCreateParam param) {
|
||||
|
||||
|
||||
ApiDealResp<OrderApiQueryResp> result = new ApiDealResp<>();
|
||||
try {
|
||||
|
||||
HaiNanDxInfo.QueryOrderParam queryParam = new HaiNanDxInfo.QueryOrderParam();
|
||||
queryParam.setOutId(param.getOuterOrderId());
|
||||
HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> responseInfo = apiHuNanDXService.queryOrder(queryParam);
|
||||
|
||||
if (responseInfo.getData() == null) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(responseInfo.getRes_message());
|
||||
return result;
|
||||
}
|
||||
|
||||
OrderApiQueryResp orderApiQueryResp = new OrderApiQueryResp();
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
|
||||
result.setData(orderApiQueryResp);
|
||||
result.setSuccess(true);
|
||||
result.setMsg(responseInfo.getRes_message());
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(e.getMessage());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,146 @@
|
|||
package cn.iocoder.yudao.module.haoka.service.api.strategy;
|
||||
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiLianTongService;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.LianTongApiUtil;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongArea;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongAreaUtils;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingIdentityCustV2Request;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingNumStateChangeRequest;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingOrderSyncV2Request;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.request.KingPreOrderSyncRequest;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingIdentityCustV2Response;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingNumStateChangeResponse;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingPreOrderSyncResponse;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Component(ApiFrom.LianTongApiDealStrategy)
|
||||
public class LianTongApiDealStrategy implements ApiDealStrategy {
|
||||
|
||||
@Resource
|
||||
private ApiLianTongService apiLianTongService;
|
||||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(OrderApiCreateParam param) {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
|
||||
LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
|
||||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
|
||||
|
||||
ApiDealResp<OrderApiCreateResp> result = new ApiDealResp<>();
|
||||
// 0、占用号码 lianTongZhanHao
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
// 3、用 token提交正式订单 lianTongOrderSyncV2
|
||||
|
||||
// 0、占用号码 lianTongZhanHao
|
||||
KingNumStateChangeRequest stateChangeRequest = new KingNumStateChangeRequest();
|
||||
stateChangeRequest.setCityCode(numAddress.getPhoneCityCode());
|
||||
stateChangeRequest.setProvinceCode(numAddress.getPhoneProvinceCode());
|
||||
stateChangeRequest.setSerialNumber(param.getPlanMobile());
|
||||
stateChangeRequest.setOccupiedFlag("S");
|
||||
stateChangeRequest.setCertCode(param.getIdCardNum());
|
||||
stateChangeRequest.setOccupiedTimeTag("S1");
|
||||
KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
|
||||
|
||||
if (!"0".equals(stateChangeResponse.getRspCode())) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(stateChangeResponse.getRspDesc());
|
||||
return result;
|
||||
}
|
||||
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
KingIdentityCustV2Request ziLiao = new KingIdentityCustV2Request();
|
||||
ziLiao.setProvince(numAddress.getPhoneProvinceCode());
|
||||
ziLiao.setCity(numAddress.getPhoneCityCode());
|
||||
ziLiao.setCertName(param.getIdCardName());
|
||||
ziLiao.setCertNum(param.getIdCardNum());
|
||||
KingIdentityCustV2Response ziLiaoResponse
|
||||
= apiLianTongService.lianTongSubmitUserInfo(ziLiao);
|
||||
String rspCode = ziLiaoResponse.getaDesc();
|
||||
|
||||
if (!"成功".equals(rspCode)) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(ziLiaoResponse.getaDesc());
|
||||
return result;
|
||||
}
|
||||
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
KingPreOrderSyncRequest preOrder = new KingPreOrderSyncRequest();
|
||||
preOrder.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode());
|
||||
preOrder.setOrderId(param.getId().toString());
|
||||
preOrder.setCertName(param.getIdCardName());
|
||||
preOrder.setCertNo(param.getIdCardNum());
|
||||
preOrder.setPostProvinceCode(receiveAddress.getProvinceCode());
|
||||
preOrder.setPostCityCode(receiveAddress.getCityCode());
|
||||
preOrder.setPostDistrictCode(receiveAddress.getDistrictCode());
|
||||
preOrder.setPostAddr(param.getAddress());
|
||||
String channel = apiLianTongService.getConfigValue(LianTongApiUtil.KEY_channel);
|
||||
preOrder.setChannel(channel);
|
||||
preOrder.setCreateTime(format);
|
||||
preOrder.setUpdateTime(format);
|
||||
preOrder.setContactNum(param.getAddressMobile());
|
||||
KingPreOrderSyncResponse preOrderResponse = apiLianTongService.lianTongPreOrderSync(preOrder);
|
||||
if (!"0000".equals(preOrderResponse.getRspCode())) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(preOrderResponse.getRspDesc());
|
||||
return result;
|
||||
}
|
||||
// String preOrderResponseBody = preOrderResponse.getBody();
|
||||
// JSONObject preOrderJSONObject = JSON.parseObject(preOrderResponseBody);
|
||||
// String orderNo = preOrderJSONObject.getString("orderNo");
|
||||
// String token = preOrderJSONObject.getString("token");
|
||||
|
||||
|
||||
// 3、用 token提交正式订单 lianTongOrderSyncV2
|
||||
KingOrderSyncV2Request syncV2 = new KingOrderSyncV2Request();
|
||||
syncV2.setProvinceCode(numAddress.getPhoneProvinceCode());
|
||||
syncV2.setCityCode(numAddress.getPhoneCityCode());
|
||||
syncV2.setCreateTime(format);
|
||||
syncV2.setPhoneNum(param.getPlanMobile());
|
||||
syncV2.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode());
|
||||
syncV2.setToken("tokentokentokentoken");
|
||||
KingOrderSyncResponse syncV2Response = apiLianTongService.lianTongOrderSyncV2(syncV2);
|
||||
if (!"0000".equals(syncV2Response.getRspCode())) {
|
||||
result.setSuccess(false);
|
||||
result.setMsg(syncV2Response.getRspDesc());
|
||||
return result;
|
||||
}
|
||||
|
||||
KingOrderSyncResponse response = apiLianTongService.lianTongOrderSyncV2(syncV2);
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(response);
|
||||
|
||||
result.setData(orderApiCreateResp);
|
||||
result.setSuccess(true);
|
||||
result.setMsg(response.getRspDesc());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(OrderApiCreateParam param) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `haoka_dev`.`haoka_product`
|
||||
MODIFY COLUMN `belong_area_code` varchar(64) NOT NULL COMMENT '归属地' AFTER `haoka_product_type_id`;
|
||||
Loading…
Reference in New Issue