Fix:湖南电信
This commit is contained in:
parent
1a8b730e71
commit
70f20834d5
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService;
|
|||
import cn.iocoder.yudao.module.haoka.api.ApiFrom;
|
||||
import cn.iocoder.yudao.module.haoka.api.ApiLianTongService;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.model.response.KingMessageGetResponse;
|
||||
import cn.iocoder.yudao.module.haoka.api.liantong.util.StringUtils;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.orders.vo.OrdersPageReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.controller.admin.superiorapilog.vo.SuperiorApiLogSaveReqVO;
|
||||
import cn.iocoder.yudao.module.haoka.dal.dataobject.orders.OrdersDO;
|
||||
|
@ -56,7 +57,7 @@ public class HaokaUpdateOrderSchedule {
|
|||
private ApiLianTongService apiLianTongService;
|
||||
|
||||
|
||||
//@Scheduled(cron = "0 */22 * * * ?")
|
||||
@Scheduled(cron = "0 */10 * * * ?")
|
||||
public void updateOrder() {
|
||||
log.info("开始-----------更新订单开始--------------------");
|
||||
tenantFrameworkService.getTenantIds().forEach((tenantId) -> {
|
||||
|
@ -130,29 +131,63 @@ public class HaokaUpdateOrderSchedule {
|
|||
private void updateOrderInfo(final OrdersDO ordersDO) {
|
||||
log.info("更新前--:{}", JSON.toJSONString(ordersDO));
|
||||
// 查询上游的订单结果
|
||||
ApiDealResp<OrderApiQueryResp> updateOrderInfo = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
||||
ApiDealResp<OrderApiQueryResp> resp = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
||||
// 上游是否支持查询接口 :比如联通不支持查询接口,走消息队列
|
||||
if (updateOrderInfo.getIsSupport()){
|
||||
if (!resp.getIsSupport()){
|
||||
return;
|
||||
}
|
||||
// 上游黑名单
|
||||
if (updateOrderInfo.getIsBlack()){
|
||||
if (resp.getIsBlack()){
|
||||
|
||||
}
|
||||
// 查询成功?
|
||||
if (!updateOrderInfo.getSuccess()){
|
||||
if (!resp.getSuccess()){
|
||||
// 不成功原因
|
||||
String msg = updateOrderInfo.getMsg();
|
||||
String msg = resp.getMsg();
|
||||
}
|
||||
|
||||
// 查询结果
|
||||
OrderApiQueryResp data = updateOrderInfo.getData();
|
||||
OrderApiQueryResp data = resp.getData();
|
||||
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 订单状态
|
||||
String orderStatusCode = data.getOrderStatusCode();
|
||||
if (StringUtils.isNotEmpty(orderStatusCode)) {
|
||||
try {
|
||||
ordersDO.setUpstreamOrderStatus(Integer.valueOf(orderStatusCode));
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
// 订单状态描述
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 上游对订单状态的描述
|
||||
String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
||||
if (StringUtils.isNotEmpty(orderStatusDesc)) {
|
||||
ordersDO.setUpStatus(orderStatusDesc);
|
||||
}
|
||||
|
||||
// 物流信息 头都
|
||||
String trackingNumber = data.getTrackingNumber();
|
||||
if (StringUtils.isNotEmpty(trackingNumber)) {
|
||||
ordersDO.setTrackingNumber(trackingNumber);
|
||||
}
|
||||
String trackingCompany = data.getTrackingCompany();
|
||||
if (StringUtils.isNotEmpty(trackingCompany)) {
|
||||
ordersDO.setTrackingCompany(trackingCompany);
|
||||
}
|
||||
|
||||
|
||||
if (data.isNeedUpdateProducePhoneNum()) {
|
||||
ordersDO.setPlanMobileProduced(data.getSupplierPhoneNumber());
|
||||
}
|
||||
|
||||
|
||||
// todo 上游更新
|
||||
ordersService.updateById(ordersDO);
|
||||
|
|
|
@ -53,4 +53,7 @@ public class OrderApiQueryResp extends BaseDO {
|
|||
*/
|
||||
private String trackingCompany;
|
||||
|
||||
private String supplierPhoneNumber;
|
||||
|
||||
private boolean needUpdateProducePhoneNum = false;
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
if (preProduct == null) {
|
||||
return ApiDealResp.failed("商品下架或者不存在");
|
||||
}
|
||||
SuperiorApiDO superiorApi = superiorApiService.getSuperiorApi(param.getSuperiorApiId());
|
||||
SuperiorApiRespVO superiorApi = preProduct.getSuperiorApiRespVO();
|
||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||
if (skuConfigVO == null) {
|
||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||
|
@ -315,20 +315,72 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
HaiNanDxInfo.ResponseInfo<HaiNanDxInfo.QueryOrderResp> responseInfo = apiHuNanDXService.queryOrder(logVO, haokaSuperiorApiId, queryParam);
|
||||
logVO.setResponse(JSON.toJSONString(responseInfo));
|
||||
OrderApiQueryResp orderApiQueryResp = new OrderApiQueryResp();
|
||||
if (responseInfo.getResult() == null) {
|
||||
JSONObject result = responseInfo.getResult();
|
||||
if (result == null) {
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc(responseInfo.getRes_message());
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
// return ApiDealResp.failed(responseInfo.getRes_message());
|
||||
}
|
||||
if (responseInfo.getResult().getJSONObject("data") == null) {
|
||||
JSONObject data = result.getJSONObject("data");
|
||||
if (data == null) {
|
||||
// return ApiDealResp.failed(responseInfo.getResult().getString("message"));
|
||||
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc(responseInfo.getResult().getString("message"));
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc(result.getString("message"));
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
if (responseInfo.getResult().getJSONObject("data").getJSONObject("busOppOrder") == null) {
|
||||
JSONObject serviceOrder = data.getJSONObject("serviceOrder");
|
||||
if (serviceOrder!=null){
|
||||
// 订单状态 pending 待处理,processing 处理中,completed 处理完成,ORDER_CANCEL 业务订单作废
|
||||
String serviceOrderState = serviceOrder.getString("serviceOrderState");
|
||||
// RM状态
|
||||
//pending:待同步;CHARGE_SUCCESS:收费成功;IS_COMPLETED:已竣工;WRITE_EXCEPTION:
|
||||
// 写卡异常;CHARGE_EXCEPTION:收费异常;WRITE_SUCCESS:写卡成功;WRITE_FAIL:写卡失败;NO_COMPLETED:未竣工,PIPEI SUCCESS集团配卡成功
|
||||
String serviceOrderCrmStatus = serviceOrder.getString("serviceOrderCrmStatus");
|
||||
|
||||
|
||||
if ("IS_COMPLETED".equals(serviceOrderCrmStatus)){
|
||||
orderApiQueryResp.setOrderStatusCode("500");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("CrmStatus IS_COMPLETED 已竣工");
|
||||
String serviceOrderCusAccPhone = serviceOrder.getString("serviceOrderCusAccPhone");
|
||||
if (serviceOrderCusAccPhone!=null){
|
||||
orderApiQueryResp.setNeedUpdateProducePhoneNum(true);
|
||||
orderApiQueryResp.setSupplierPhoneNumber(serviceOrderCusAccPhone);
|
||||
}
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
if ("pending".equals(serviceOrderState)){
|
||||
orderApiQueryResp.setOrderStatusCode("470");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 pending 待处理");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
if ("completed".equals(serviceOrderState)){
|
||||
orderApiQueryResp.setOrderStatusCode("500");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 completed 待处理");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
if ("ORDER_CANCEL".equals(serviceOrderState)){
|
||||
orderApiQueryResp.setOrderStatusCode("-460");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 IS_COMPLETED 业务订单作废");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("busOppOrder null");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
JSONObject busOppOrder = data.getJSONObject("busOppOrder");
|
||||
if (busOppOrder == null) {
|
||||
// return ApiDealResp.failed("busOppOrder null");
|
||||
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
|
@ -336,8 +388,9 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
String string = responseInfo.getResult().getJSONObject("data").getJSONObject("busOppOrder").getString("tbBusOppOrderThState");
|
||||
if (string == null) {
|
||||
String tbBusOppOrderThState = busOppOrder.getString("tbBusOppOrderThState");
|
||||
|
||||
if (tbBusOppOrderThState == null) {
|
||||
// return ApiDealResp.failed("tbBusOppOrderThState null");
|
||||
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
|
@ -345,17 +398,17 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
|||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
if (!string.equals("1")) {
|
||||
if (!tbBusOppOrderThState.equals("1")) {
|
||||
// return ApiDealResp.failed("tbBusOppOrderThState null");
|
||||
|
||||
orderApiQueryResp.setOrderStatusCode("0");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + string + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + tbBusOppOrderThState + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
}
|
||||
|
||||
orderApiQueryResp.setData(responseInfo);
|
||||
orderApiQueryResp.setOrderStatusCode("470");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + string + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + tbBusOppOrderThState + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
||||
return ApiDealResp.ok(orderApiQueryResp);
|
||||
} catch (Exception e) {
|
||||
return ApiDealResp.failed(e.getMessage());
|
||||
|
|
|
@ -28,12 +28,14 @@ import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProdu
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import lombok.val;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@Component(ApiFrom.LianTongApiDealStrategy)
|
||||
public class LianTongApiDealStrategy implements ApiDealStrategy {
|
||||
|
||||
|
@ -52,7 +54,12 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
|||
private HaoKaAddressService haoKaAddressService;
|
||||
|
||||
private LianTongArea getAddress(String code) {
|
||||
try {
|
||||
return LianTongAreaUtils.getArea(code);
|
||||
} catch (Exception e) {
|
||||
log.error("获取联通地址失败:{}--ErrL{}", code, e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue