This commit is contained in:
parent
17e37de2b3
commit
b7070ea28c
|
|
@ -27,11 +27,11 @@ public class OnSaleProductPreOrderRespVO {
|
|||
@ExcelProperty("产品")
|
||||
private Long parentProductId;
|
||||
|
||||
private SuperiorProductConfigRespVO superiorProductConfigRespVO;
|
||||
private SuperiorProductConfigRespVO superiorProductConfigRespVO;
|
||||
|
||||
private SuperiorApiRespVO superiorApiRespVO;
|
||||
private SuperiorApiRespVO superiorApiRespVO;
|
||||
|
||||
private ApiFrom apiFrom;
|
||||
private ApiFrom apiFrom;
|
||||
|
||||
@ExcelIgnore
|
||||
@Schema(description = "产品", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,18 @@ public class OrdersRespVO {
|
|||
@ExcelProperty("产品ID")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "在售商品ID")
|
||||
@ExcelProperty("在售商品ID")
|
||||
private Long onSaleProductId;
|
||||
|
||||
@Schema(description = "上游接口ID")
|
||||
@ExcelProperty("上游接口ID")
|
||||
private Long superiorApiId;
|
||||
|
||||
@Schema(description = "产品上游接口配置ID")
|
||||
@ExcelProperty("产品上游接口配置ID")
|
||||
private Long superiorProductConfigId;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
@ExcelProperty("产品编码")
|
||||
private String productSku;
|
||||
|
|
@ -280,4 +292,4 @@ public class OrdersRespVO {
|
|||
@Schema(description = "身份证人脸")
|
||||
private String face;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 订单新增/修改 Request VO")
|
||||
|
|
@ -41,6 +39,15 @@ public class OrdersSaveReqVO {
|
|||
@Schema(description = "产品ID", example = "24383")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "在售商品ID")
|
||||
private Long onSaleProductId;
|
||||
|
||||
@Schema(description = "上游接口ID")
|
||||
private Long superiorApiId;
|
||||
|
||||
@Schema(description = "产品上游接口配置ID")
|
||||
private Long superiorProductConfigId;
|
||||
|
||||
@Schema(description = "产品编码")
|
||||
private String productSku;
|
||||
|
||||
|
|
@ -196,4 +203,4 @@ public class OrdersSaveReqVO {
|
|||
@Schema(description = "订单联系状态码")
|
||||
private Long callStatus;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.haoka.dal.dataobject.orders;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -10,6 +11,7 @@ import java.time.LocalDateTime;
|
|||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
|
|
@ -59,7 +61,7 @@ public class OrdersDO extends BaseDO {
|
|||
private Long shareId;
|
||||
/**
|
||||
* 订单来源
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_channel 对应的类}
|
||||
*/
|
||||
private String source;
|
||||
|
|
@ -71,6 +73,18 @@ public class OrdersDO extends BaseDO {
|
|||
* 产品ID
|
||||
*/
|
||||
private Long productId;
|
||||
/**
|
||||
* 在售商品ID
|
||||
*/
|
||||
private Long onSaleProductId;
|
||||
/**
|
||||
* 上游接口ID
|
||||
*/
|
||||
private Long superiorApiId;
|
||||
/**
|
||||
* 产品上游接口配置ID
|
||||
*/
|
||||
private Long superiorProductConfigId;
|
||||
/**
|
||||
* 产品编码
|
||||
*/
|
||||
|
|
@ -141,7 +155,7 @@ public class OrdersDO extends BaseDO {
|
|||
private String addressProvince;
|
||||
/**
|
||||
* 交易状态
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link TODO pay_refund_status 对应的类}
|
||||
*/
|
||||
private String refundStatus;
|
||||
|
|
@ -151,7 +165,7 @@ public class OrdersDO extends BaseDO {
|
|||
private String addressCity;
|
||||
/**
|
||||
* 激活状态
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_active_status 对应的类}
|
||||
*/
|
||||
private String activeStatus;
|
||||
|
|
@ -229,7 +243,7 @@ public class OrdersDO extends BaseDO {
|
|||
private String town;
|
||||
/**
|
||||
* 订单状态
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_status 对应的类}
|
||||
*/
|
||||
private Long status;
|
||||
|
|
@ -239,7 +253,7 @@ public class OrdersDO extends BaseDO {
|
|||
private String trackingCompany;
|
||||
/**
|
||||
* 标旗
|
||||
*
|
||||
* <p>
|
||||
* 枚举 {@link TODO haoka_order_flag 对应的类}
|
||||
*/
|
||||
private Long flag;
|
||||
|
|
@ -308,4 +322,4 @@ public class OrdersDO extends BaseDO {
|
|||
*/
|
||||
private Integer isUrgent;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,10 @@ import cn.iocoder.yudao.module.haoka.api.liantong.util.StringUtils;
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapilog.SuperiorApiLogService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -24,12 +26,14 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
|||
@Resource
|
||||
protected SuperiorApiLogService superiorApiLogService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
||||
logVO.setApiType(1);
|
||||
logVO.setHaokaOrderId(param.getId());
|
||||
logVO.setHaokaProductId(param.getProductId());
|
||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||
try {
|
||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
if (onSaleProductPreOrder == null) {
|
||||
|
|
@ -38,17 +42,15 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
|||
logVO.setErrorInfo(msg);
|
||||
return ApiDealResp.failed(msg);
|
||||
}
|
||||
logVO.setHaokaSuperiorApiId(onSaleProductPreOrder.getApiFrom().getId());
|
||||
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
|
||||
if (apiFrom == null) {
|
||||
String msg = "产品上游接口不存在";
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
if (superiorApi == null) {
|
||||
String msg = "关联上游接口不存在";
|
||||
logVO.setSuccess(false);
|
||||
logVO.setErrorInfo(msg);
|
||||
return ApiDealResp.failed(msg);
|
||||
}
|
||||
|
||||
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(onSaleProductPreOrder.getSuperiorApiRespVO().getApiFrom());
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(superiorApi.getApiFrom());
|
||||
if (apiDealStrategy == null) {
|
||||
String msg = "NoneService";
|
||||
logVO.setSuccess(false);
|
||||
|
|
@ -80,6 +82,7 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
|||
logVO.setApiType(2);
|
||||
logVO.setHaokaOrderId(param.getId());
|
||||
logVO.setHaokaProductId(param.getProductId());
|
||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||
Boolean isSupport = true;
|
||||
try {
|
||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
|
@ -89,15 +92,15 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
|||
logVO.setErrorInfo(msg);
|
||||
return ApiDealResp.failed(msg);
|
||||
}
|
||||
logVO.setHaokaSuperiorApiId(onSaleProductPreOrder.getApiFrom().getId());
|
||||
ApiFrom apiFrom = onSaleProductPreOrder.getApiFrom();
|
||||
if (apiFrom == null) {
|
||||
String msg = "产品上游接口不存在";
|
||||
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
if (superiorApi == null) {
|
||||
String msg = "关联上游接口不存在";
|
||||
logVO.setSuccess(false);
|
||||
logVO.setErrorInfo(msg);
|
||||
return ApiDealResp.failed(msg);
|
||||
}
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(onSaleProductPreOrder.getSuperiorApiRespVO().getApiFrom());
|
||||
ApiDealStrategy apiDealStrategy = this.getApiDealStrategy(superiorApi.getApiFrom());
|
||||
if (apiDealStrategy == null) {
|
||||
logVO.setSuccess(false);
|
||||
String noneService = "NoneService";
|
||||
|
|
|
|||
|
|
@ -62,4 +62,17 @@ public class OrderApiCreateParam {
|
|||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 在售商品ID
|
||||
*/
|
||||
private Long onSaleProductId;
|
||||
/**
|
||||
* 上游接口ID
|
||||
*/
|
||||
private Long superiorApiId;
|
||||
/**
|
||||
* 产品上游接口配置ID
|
||||
*/
|
||||
private Long superiorProductConfigId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,4 +27,18 @@ public class OrderApiQueryParam {
|
|||
* 实际生产号码
|
||||
*/
|
||||
private String planMobileProduced;
|
||||
|
||||
|
||||
/**
|
||||
* 在售商品ID
|
||||
*/
|
||||
private Long onSaleProductId;
|
||||
/**
|
||||
* 上游接口ID
|
||||
*/
|
||||
private Long superiorApiId;
|
||||
/**
|
||||
* 产品上游接口配置ID
|
||||
*/
|
||||
private Long superiorProductConfigId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,13 @@ import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSalePro
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapi.vo.SuperiorApiRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
|
@ -31,7 +35,10 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
|
|
@ -39,14 +46,18 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
||||
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
final SuperiorProductConfigRespVO skuConfigVO = preProduct.getSuperiorProductConfigRespVO();
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
|
||||
final GdOrderCreateRequestParam createParam = new GdOrderCreateRequestParam();
|
||||
|
||||
createParam.setUserName(param.getIdCardName());
|
||||
|
|
@ -107,8 +118,13 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
GdOrderQueryRequestParam queryParam = new GdOrderQueryRequestParam();
|
||||
|
||||
queryParam.setOrderCode(param.getSupplierOrderId());
|
||||
|
|
@ -193,11 +209,7 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@ import cn.iocoder.yudao.module.haoka.controller.admin.address.vo.AddressVo;
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.address.HaoKaAddressService;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
|
@ -34,7 +38,10 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
@Resource
|
||||
private HaoKaAddressService haoKaAddressService;
|
||||
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
private AddressVo getAddress(String code) {
|
||||
return haoKaAddressService.getAddress(code);
|
||||
|
|
@ -42,17 +49,19 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
||||
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
|
||||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
final SuperiorProductConfigRespVO skuConfigVO = preProduct.getSuperiorProductConfigRespVO();
|
||||
|
||||
|
||||
HaiNanDianXinApi.SynOrderInfoRequest createParam = new HaiNanDianXinApi.SynOrderInfoRequest();
|
||||
createParam.setOrderDate(format);
|
||||
|
|
@ -122,9 +131,16 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
try {
|
||||
HaiNanDianXinApi.QueryOrderInfoRequest queryParam = new HaiNanDianXinApi.QueryOrderInfoRequest();
|
||||
queryParam.setQueryType("1");
|
||||
|
|
|
|||
|
|
@ -10,10 +10,14 @@ import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSalePro
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapi.vo.SuperiorApiRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.address.HaoKaAddressService;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -34,6 +38,11 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
@Resource
|
||||
private HaoKaAddressService haoKaAddressService;
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
private AddressVo getAddress(String code) {
|
||||
return haoKaAddressService.getAddress(code);
|
||||
}
|
||||
|
|
@ -41,14 +50,20 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
@Override
|
||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
|
||||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
final SuperiorProductConfigRespVO skuConfigVO = preProduct.getSuperiorProductConfigRespVO();
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
// 0、占用号码 lianTongZhanHao
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
|
|
@ -203,8 +218,19 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
|
||||
try {
|
||||
HaiNanDxInfo.QueryOrderParam queryParam = new HaiNanDxInfo.QueryOrderParam();
|
||||
queryParam.setOutId(param.getId().toString());
|
||||
|
|
|
|||
|
|
@ -16,9 +16,13 @@ import cn.iocoder.yudao.module.haoka.api.liantong.util.StringUtils;
|
|||
import cn.iocoder.yudao.module.haoka.controller.admin.onsaleproduct.vo.OnSaleProductPreOrderRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorproductconfig.SuperiorProductConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.api.models.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -36,6 +40,11 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
|
@ -46,11 +55,13 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
}
|
||||
|
||||
|
||||
final SuperiorProductConfigRespVO skuConfigVO = preProduct.getSuperiorProductConfigRespVO();
|
||||
Long haokaSuperiorApiId = superiorApi.getId();
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
|
||||
|
|
@ -114,7 +125,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
KingPreOrderSyncRequest preOrder = new KingPreOrderSyncRequest();
|
||||
preOrder.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode());
|
||||
preOrder.setGoodsId(skuConfigVO.getSuperiorCode());
|
||||
preOrder.setOrderId(param.getId().toString());
|
||||
preOrder.setCertName(param.getIdCardName());
|
||||
preOrder.setCertNo(param.getIdCardNum());
|
||||
|
|
@ -173,7 +184,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
syncV2.setCityCode(numAddress.getPhoneCityCode());
|
||||
syncV2.setCreateTime(format);
|
||||
syncV2.setPhoneNum(param.getPlanMobile());
|
||||
syncV2.setGoodsId(preProduct.getSuperiorProductConfigRespVO().getSuperiorCode());
|
||||
syncV2.setGoodsId(skuConfigVO.getSuperiorCode());
|
||||
|
||||
String body = preOrderResponse.getBody();
|
||||
if (StringUtils.isNotEmpty(body)) {
|
||||
|
|
@ -181,7 +192,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
syncV2.setToken(jsonObject.getString("token"));
|
||||
}
|
||||
|
||||
if (skuConfigVO != null && StringUtils.isNotEmpty(skuConfigVO.getConfig())) {
|
||||
if (StringUtils.isNotEmpty(skuConfigVO.getConfig())) {
|
||||
String config = skuConfigVO.getConfig();
|
||||
JSONObject configs = JSON.parseObject(config);
|
||||
{
|
||||
|
|
@ -237,7 +248,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
Long haokaSuperiorApiId = preProduct.getSuperiorApiRespVO().getId();
|
||||
Long haokaSuperiorApiId = param.getSuperiorApiId();
|
||||
logVO.setHaokaSuperiorApiId(haokaSuperiorApiId);
|
||||
|
||||
return ApiDealResp.ontSupport("联通不支持查询订单接口,须参照回调接口");
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ import static cn.iocoder.yudao.module.haoka.enums.ErrorCodeConstants.*;
|
|||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implements OrdersService {
|
||||
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> implements OrdersService {
|
||||
@Resource
|
||||
private OrdersMapper ordersMapper;
|
||||
@Resource
|
||||
|
|
@ -50,14 +50,17 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implem
|
|||
// 插入
|
||||
OrdersDO orders = BeanUtils.toBean(createReqVO, OrdersDO.class);
|
||||
orders.setId(SnowflakeId.generate());
|
||||
// 注入产品生产方式
|
||||
Long productId = createReqVO.getProductId();
|
||||
Integer autoType = onSaleProductService.getOnSaleProductPreOrder(productId).getParentProduct().getAutoType();
|
||||
orders.setAutoType(autoType);
|
||||
ordersMapper.insert(orders);
|
||||
// 注入产品生产方式 记录初始产品+接口相关信息
|
||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(createReqVO.getOnSaleProductId());
|
||||
orders.setAutoType(onSaleProductPreOrder.getParentProduct().getAutoType());
|
||||
orders.setOnSaleProductId(onSaleProductPreOrder.getId());
|
||||
orders.setProducerId(onSaleProductPreOrder.getParentProduct().getId());
|
||||
orders.setSuperiorProductConfigId(onSaleProductPreOrder.getSuperiorProductConfigRespVO().getId());
|
||||
orders.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId());
|
||||
|
||||
ordersMapper.insert(orders);
|
||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
||||
BeanUtils.copyProperties(orders,param);
|
||||
BeanUtils.copyProperties(orders, param);
|
||||
apiDealStrategyService.createOrder(param);
|
||||
// 返回
|
||||
return orders.getId();
|
||||
|
|
@ -66,11 +69,22 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implem
|
|||
@Override
|
||||
public void updateOrders(OrdersSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateOrdersExists(updateReqVO.getId());
|
||||
// 更新
|
||||
OrdersDO oldOrderDo = ordersMapper.selectById(updateReqVO.getId());
|
||||
if (oldOrderDo == null) {
|
||||
throw exception(ORDERS_NOT_EXISTS);
|
||||
}
|
||||
OrdersDO updateObj = BeanUtils.toBean(updateReqVO, OrdersDO.class);
|
||||
|
||||
// 保证下面字段信息不会变化
|
||||
updateObj.setOnSaleProductId(oldOrderDo.getOnSaleProductId());
|
||||
updateObj.setProducerId(oldOrderDo.getProducerId());
|
||||
updateObj.setSuperiorProductConfigId(oldOrderDo.getSuperiorProductConfigId());
|
||||
updateObj.setSuperiorApiId(oldOrderDo.getSuperiorApiId());
|
||||
|
||||
ordersMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auditOrders(OrdersSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
|
|
@ -84,16 +98,16 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper,OrdersDO> implem
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 调用运营商产生订单
|
||||
*
|
||||
* @param ordersDO
|
||||
*/
|
||||
private void createOrder(OrdersDO ordersDO) {
|
||||
Long status = ordersDO.getStatus();
|
||||
if(ObjectUtil.equals(status,450)){
|
||||
if (ObjectUtil.equals(status, 450)) {
|
||||
// 进入审核流程且下单
|
||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
||||
BeanUtils.copyProperties(ordersDO,param);
|
||||
BeanUtils.copyProperties(ordersDO, param);
|
||||
ApiDealResp<OrderApiCreateResp> orderResponse = apiDealStrategyService.createOrder(param);
|
||||
// 是否是是上游黑名单 如果是 存本地黑名单
|
||||
Boolean isBlack = orderResponse.getIsBlack();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
-- 订单新增参数
|
||||
delete from haoka_orders;
|
||||
ALTER TABLE haoka_orders
|
||||
ADD COLUMN on_sale_product_id bigint(20) NOT NULL COMMENT '在售商品ID' AFTER auto_type,
|
||||
ADD COLUMN superior_api_id bigint(20) NOT NULL COMMENT '上游接口ID' AFTER on_sale_product_id,
|
||||
ADD COLUMN superior_product_config_id bigint(20) NOT NULL COMMENT '产品-接口配置' AFTER superior_api_id;
|
||||
Loading…
Reference in New Issue