广州电信
This commit is contained in:
parent
778f7d2111
commit
86b3442354
|
|
@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||
import cn.iocoder.yudao.module.haoka.dal.dataobject.superiorapi.SuperiorApiDevConfigDO;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiDevConfigService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapilog.SuperiorApiLogService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public class KingNumSelectRequest implements ZopRequest<KingNumSelectResponse> {
|
|||
*/
|
||||
@FieldValidate(notNull = true, fixLen = 1, matches = "^\\d{1}$")
|
||||
private String searchCategory;
|
||||
|
||||
/**
|
||||
* 尾号查询 02: 匹配最后四位
|
||||
*/
|
||||
|
|
@ -60,6 +61,7 @@ public class KingNumSelectRequest implements ZopRequest<KingNumSelectResponse> {
|
|||
* 尾号查询关键字:2-4位数字(和searchType配对出现,searchType有值的话,searchValue不可为空)
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 支持10 ,100 默认为100
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import java.util.List;
|
|||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@PermitAll
|
||||
@Tag(name = "API---上游接口---联通-集团")
|
||||
@RestController
|
||||
@RequestMapping("/haoka/api/lian-tong")
|
||||
|
|
@ -36,6 +37,8 @@ public class HaokaApiLianTongController {
|
|||
return success(zopResponse);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
|
||||
@PostMapping("/zhan-hao")
|
||||
@Operation(summary = "联通占号接口")
|
||||
public CommonResult<KingNumStateChangeResponse> lianTongZhanHao(@RequestBody KingNumStateChangeRequest request) {
|
||||
|
|
@ -43,6 +46,7 @@ public class HaokaApiLianTongController {
|
|||
return success(response);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/submit-user-info")
|
||||
@Operation(summary = "联通资料提交接口")
|
||||
public CommonResult<KingIdentityCustV2Response> lianTongSubmitUserInfo(@RequestBody KingIdentityCustV2Request request) {
|
||||
|
|
@ -86,6 +90,7 @@ public class HaokaApiLianTongController {
|
|||
return success(response);
|
||||
}
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/token-select-number")
|
||||
@Operation(summary = "联通token选号接口")
|
||||
public CommonResult<KingNumSelectResponse> lianTongTokenSelectNumber(@RequestBody KingNumTokenSelectRequest request) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
|||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.HaoKaProductRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapi.vo.SuperiorApiRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
|
|
@ -28,6 +29,8 @@ public class OnSaleProductPreOrderRespVO {
|
|||
|
||||
private SuperiorProductConfigRespVO superiorProductConfigRespVO;
|
||||
|
||||
private SuperiorApiRespVO superiorApiRespVO;
|
||||
|
||||
private ApiFrom apiFrom;
|
||||
|
||||
@ExcelIgnore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.haoka.controller.admin.orders;
|
||||
|
||||
import jakarta.annotation.security.PermitAll;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
|
@ -38,9 +39,10 @@ public class OrdersController {
|
|||
@Resource
|
||||
private OrdersService ordersService;
|
||||
|
||||
@PermitAll
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建订单")
|
||||
@PreAuthorize("@ss.hasPermission('haoka:orders:create')")
|
||||
//@PreAuthorize("@ss.hasPermission('haoka:orders:create')")
|
||||
public CommonResult<Long> createOrders(@Valid @RequestBody OrdersSaveReqVO createReqVO) {
|
||||
return success(ordersService.createOrders(createReqVO));
|
||||
}
|
||||
|
|
@ -92,4 +94,4 @@ public class OrdersController {
|
|||
BeanUtils.toBean(list, OrdersRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ public class OrderApiCreateResp extends BaseDO {
|
|||
|
||||
private Object data;
|
||||
|
||||
private String supplierOrderId;
|
||||
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,16 +6,24 @@ 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.liantong.area.LianTongArea;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.area.LianTongAreaUtils;
|
||||
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.service.api.*;
|
||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import cn.iocoder.yudao.module.haoka.utils.SnowflakeId;
|
||||
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.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component(ApiFrom.GuangZhouDXApiDealStrategy)
|
||||
public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
||||
|
|
@ -26,6 +34,10 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
|||
@Resource
|
||||
private OnSaleProductService onSaleProductService;
|
||||
|
||||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
}
|
||||
|
|
@ -33,49 +45,74 @@ 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("商品下架或者不存在");
|
||||
}
|
||||
final SuperiorProductConfigRespVO skuConfigVO = preProduct.getSuperiorProductConfigRespVO();
|
||||
final GdOrderCreateRequestParam createParam = new GdOrderCreateRequestParam();
|
||||
|
||||
String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
createParam.setUserName(param.getIdCardName());
|
||||
createParam.setUserIDNumber(param.getIdCardNum());
|
||||
|
||||
final GdOrderCreateRequestParam.OrderProduct orderProduct = new GdOrderCreateRequestParam.OrderProduct();
|
||||
createParam.setOrderProduct(orderProduct);
|
||||
|
||||
LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
final GdOrderCreateRequestParam.DeliveryInfo deliveryInfo = new GdOrderCreateRequestParam.DeliveryInfo();
|
||||
createParam.setDeliveryInfo(deliveryInfo);
|
||||
final LianTongArea receiveAddress = getAddress(param.getAddressDistrict());
|
||||
deliveryInfo.setProvince(receiveAddress.getProvinceName());
|
||||
deliveryInfo.setCity(receiveAddress.getCityName());
|
||||
deliveryInfo.setDistrict(receiveAddress.getDistrictName());
|
||||
deliveryInfo.setDetailedAddress(LianTongAreaUtils.format(param.getAddressDistrict()) + param.getAddress());
|
||||
deliveryInfo.setContactPhone(param.getAddressMobile());
|
||||
|
||||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
final GdOrderCreateRequestParam.LiftingInfo liftingInfo = new GdOrderCreateRequestParam.LiftingInfo();
|
||||
createParam.setLiftingInfo(liftingInfo);
|
||||
|
||||
if (skuConfigVO != null && StringUtils.isNotEmpty(skuConfigVO.getConfig())) {
|
||||
String config = skuConfigVO.getConfig();
|
||||
JSONObject configs = JSON.parseObject(config);
|
||||
if (configs.containsKey("ApiPrefix_DeliveryProductproductType")
|
||||
&& configs.containsKey("ApiPrefix_DeliveryProductproductQuantity")
|
||||
&& configs.containsKey("ApiPrefix_DeliveryProductproductName")) {
|
||||
List<GdOrderCreateRequestParam.DeliveryInfo.DeliveryProduct> deliveryProduct = new ArrayList<>();
|
||||
GdOrderCreateRequestParam.DeliveryInfo.DeliveryProduct e = new GdOrderCreateRequestParam.DeliveryInfo.DeliveryProduct();
|
||||
e.setProductType(configs.getString("ApiPrefix_DeliveryProductproductType"));
|
||||
e.setProductQuantity(configs.getString("ApiPrefix_DeliveryProductproductQuantity"));
|
||||
e.setProductName(configs.getString("ApiPrefix_DeliveryProductproductName"));
|
||||
deliveryProduct.add(e);
|
||||
deliveryInfo.setDeliveryProduct(deliveryProduct);
|
||||
}
|
||||
orderProduct.setProductName(configs.getString("ApiPrefix_productName"));
|
||||
createParam.setInterfaceOrderAccount(configs.getString("ApiPrefix_interfaceOrderAccount"));
|
||||
createParam.setHandlingType(configs.getString("ApiPrefix_handlingType"));
|
||||
createParam.setBusinessType(configs.getString("ApiPrefix_businessType"));
|
||||
createParam.setAgentAccount(configs.getString("ApiPrefix_agentAccount"));
|
||||
liftingInfo.setLiftingStaffNumber(configs.getString("ApiPrefix_liftingStaffNumber"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
GdOrderCreateRequestParam createParam = new GdOrderCreateRequestParam();
|
||||
|
||||
|
||||
logVO.setId(SnowflakeId.generate());
|
||||
logVO.setHaokaOrderId(param.getId());
|
||||
logVO.setHaokaProductId(preProduct.getId());
|
||||
|
||||
String order = apiGuangZhouDXService.createOrder(logVO, createParam);
|
||||
|
||||
String supplierOrderId = apiGuangZhouDXService.createOrder(logVO, createParam);
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
orderApiCreateResp.setData(order);
|
||||
|
||||
orderApiCreateResp.setSupplierOrderId(supplierOrderId);
|
||||
orderApiCreateResp.setData(supplierOrderId);
|
||||
|
||||
return ApiDealResp.ok(orderApiCreateResp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) throws Exception {
|
||||
|
||||
GdOrderQueryRequestParam queryParam = new GdOrderQueryRequestParam();
|
||||
String responseInfo = apiGuangZhouDXService.queryOrder(logVO,queryParam);
|
||||
String responseInfo = apiGuangZhouDXService.queryOrder(logVO, queryParam);
|
||||
|
||||
if (responseInfo == null) {
|
||||
logVO.setSuccess(false);
|
||||
logVO.setInnerNote("接口没有返回信息");
|
||||
return ApiDealResp.failed("responseInfo is null");
|
||||
}
|
||||
|
||||
OrderApiQueryResp orderApiQueryResp = new OrderApiQueryResp();
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,21 +52,21 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
LianTongArea numAddress = getAddress(preProduct.getParentProduct().getBelongAreaCode());
|
||||
|
||||
|
||||
// 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");
|
||||
|
||||
logVO.setParam(JSON.toJSONString(stateChangeRequest));
|
||||
KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
|
||||
logVO.setResponse(JSON.toJSONString(stateChangeResponse));
|
||||
if (!"0".equals(stateChangeResponse.getRspCode())) {
|
||||
return ApiDealResp.failed(stateChangeResponse.getRspDesc());
|
||||
}
|
||||
// // 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");
|
||||
//
|
||||
// logVO.setParam(JSON.toJSONString(stateChangeRequest));
|
||||
// KingNumStateChangeResponse stateChangeResponse = apiLianTongService.lianTongZhanHao(stateChangeRequest);
|
||||
// logVO.setResponse(JSON.toJSONString(stateChangeResponse));
|
||||
// if (!"0".equals(stateChangeResponse.getRspCode())) {
|
||||
// return ApiDealResp.failed(stateChangeResponse.getRspDesc());
|
||||
// }
|
||||
|
||||
// 1、提交资料 lianTongSubmitUserInfo
|
||||
KingIdentityCustV2Request ziLiao = new KingIdentityCustV2Request();
|
||||
|
|
@ -83,7 +83,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
String rspCode = ziLiaoResponse.getaDesc();
|
||||
|
||||
if (!"成功".equals(rspCode)) {
|
||||
return ApiDealResp.failed(stateChangeResponse.getRspDesc());
|
||||
return ApiDealResp.failed(ziLiaoResponse.getRspDesc());
|
||||
}
|
||||
|
||||
// 2、提交预订单 得到token lianTongPreOrderSync
|
||||
|
|
@ -109,7 +109,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
logVO.setResponse(JSON.toJSONString(preOrderResponse));
|
||||
|
||||
if (!"0000".equals(preOrderResponse.getRspCode())) {
|
||||
return ApiDealResp.failed(stateChangeResponse.getRspDesc());
|
||||
return ApiDealResp.failed(preOrderResponse.getRspDesc());
|
||||
}
|
||||
// String preOrderResponseBody = preOrderResponse.getBody();
|
||||
// JSONObject preOrderJSONObject = JSON.parseObject(preOrderResponseBody);
|
||||
|
|
@ -131,7 +131,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
KingOrderSyncResponse response = apiLianTongService.lianTongOrderSyncV2(syncV2);
|
||||
logVO.setResponse(JSON.toJSONString(response));
|
||||
if (!"0000".equals(response.getRspCode())) {
|
||||
return ApiDealResp.failed(stateChangeResponse.getRspDesc());
|
||||
return ApiDealResp.failed(response.getRspDesc());
|
||||
}
|
||||
|
||||
OrderApiCreateResp orderApiCreateResp = new OrderApiCreateResp();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,14 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.HaoKaProductRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.product.vo.HaoKaProductSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapi.vo.SuperiorApiRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorproductconfig.vo.SuperiorProductConfigRespVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.product.HaoKaProductDO;
|
||||
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.enums.LogRecordConstants;
|
||||
import cn.iocoder.yudao.module.haoka.service.product.HaoKaProductService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||
import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProductConfigService;
|
||||
import cn.iocoder.yudao.module.haoka.utils.SnowflakeId;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
|
|
@ -50,6 +53,9 @@ public class OnSaleProductServiceImpl implements OnSaleProductService {
|
|||
@Resource
|
||||
private SuperiorProductConfigService superiorProductConfigService;
|
||||
|
||||
@Resource
|
||||
private SuperiorApiService superiorApiService;
|
||||
|
||||
@Override
|
||||
@LogRecord(type = LogRecordConstants.HAOKA_SALE_PRODUCT,
|
||||
subType = LogRecordConstants.HAOKA_UPDATE,
|
||||
|
|
@ -120,12 +126,19 @@ public class OnSaleProductServiceImpl implements OnSaleProductService {
|
|||
|
||||
List<SuperiorProductConfigDO> list = superiorProductConfigService.list(new LambdaQueryWrapperX<SuperiorProductConfigDO>()
|
||||
.eqIfPresent(SuperiorProductConfigDO::getHaokaProductId, bean.getParentProductId()));
|
||||
|
||||
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
SuperiorProductConfigDO first = list.get(0);
|
||||
Long haokaSuperiorApiId = first.getHaokaSuperiorApiId();
|
||||
ApiFrom apiFrom = ApiFrom.fromId(haokaSuperiorApiId);
|
||||
bean.setApiFrom(apiFrom);
|
||||
bean.setSuperiorProductConfigRespVO(BeanUtils.toBean(first, SuperiorProductConfigRespVO.class));
|
||||
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(first.getHaokaSuperiorApiId());
|
||||
|
||||
bean.setSuperiorApiRespVO(BeanUtils.toBean(superiorApi, SuperiorApiRespVO.class));
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue