reCreateOrders
This commit is contained in:
parent
2d2da30774
commit
5c79b1e934
|
@ -19,6 +19,7 @@ import cn.iocoder.yudao.module.haoka.service.api.ApiDealStrategyService;
|
||||||
import cn.iocoder.yudao.module.haoka.service.api.models.ApiDealResp;
|
import cn.iocoder.yudao.module.haoka.service.api.models.ApiDealResp;
|
||||||
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiQueryResp;
|
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiQueryResp;
|
||||||
import cn.iocoder.yudao.module.haoka.service.orders.OrdersService;
|
import cn.iocoder.yudao.module.haoka.service.orders.OrdersService;
|
||||||
|
import cn.iocoder.yudao.module.haoka.service.orders.UpstreamOrderStatusInfo;
|
||||||
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
import cn.iocoder.yudao.module.haoka.service.superiorapi.SuperiorApiService;
|
||||||
import cn.iocoder.yudao.module.haoka.service.superiorapilog.SuperiorApiLogService;
|
import cn.iocoder.yudao.module.haoka.service.superiorapilog.SuperiorApiLogService;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
@ -57,7 +58,7 @@ public class HaokaUpdateOrderSchedule {
|
||||||
private ApiLianTongService apiLianTongService;
|
private ApiLianTongService apiLianTongService;
|
||||||
|
|
||||||
|
|
||||||
@Scheduled(cron = "0 */10 * * * ?")
|
@Scheduled(cron = "0 */1 * * * ?")
|
||||||
public void updateOrder() {
|
public void updateOrder() {
|
||||||
log.info("开始-----------更新订单开始--------------------");
|
log.info("开始-----------更新订单开始--------------------");
|
||||||
tenantFrameworkService.getTenantIds().forEach((tenantId) -> {
|
tenantFrameworkService.getTenantIds().forEach((tenantId) -> {
|
||||||
|
@ -93,7 +94,7 @@ public class HaokaUpdateOrderSchedule {
|
||||||
//18 开卡失败 -460
|
//18 开卡失败 -460
|
||||||
//19 证件不合格待重传 -200
|
//19 证件不合格待重传 -200
|
||||||
//20 订单终止 0
|
//20 订单终止 0
|
||||||
pageReqVO.setStatus(Lists.newArrayList(460L,470L,500L,550L)); // 已经完成/取消/删除的订单,不需要再从上游同步,这里过滤掉
|
// pageReqVO.setStatus(Lists.newArrayList(460L,470L,500L,550L)); // 已经完成/取消/删除的订单,不需要再从上游同步,这里过滤掉
|
||||||
|
|
||||||
while ((long) pageNo * pageSize < total) {
|
while ((long) pageNo * pageSize < total) {
|
||||||
pageNo += 1;
|
pageNo += 1;
|
||||||
|
@ -102,11 +103,14 @@ public class HaokaUpdateOrderSchedule {
|
||||||
PageResult<OrdersDO> ordersPage = ordersService.getOrdersPage(pageReqVO);
|
PageResult<OrdersDO> ordersPage = ordersService.getOrdersPage(pageReqVO);
|
||||||
total = ordersPage.getTotal();
|
total = ordersPage.getTotal();
|
||||||
for (OrdersDO ordersDO : ordersPage.getList()) {
|
for (OrdersDO ordersDO : ordersPage.getList()) {
|
||||||
|
if (554892432475426816L != ordersDO.getId()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// 开始从上游同步订单状态,解析,并且更新本地订单状态
|
// 开始从上游同步订单状态,解析,并且更新本地订单状态
|
||||||
updateOrderInfo(ordersDO);
|
updateOrderInfo(ordersDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.sleep(1000*10);
|
Thread.sleep(1000 * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -133,15 +137,15 @@ public class HaokaUpdateOrderSchedule {
|
||||||
// 查询上游的订单结果
|
// 查询上游的订单结果
|
||||||
ApiDealResp<OrderApiQueryResp> resp = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
ApiDealResp<OrderApiQueryResp> resp = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
||||||
// 上游是否支持查询接口 :比如联通不支持查询接口,走消息队列
|
// 上游是否支持查询接口 :比如联通不支持查询接口,走消息队列
|
||||||
if (!resp.getIsSupport()){
|
if (!resp.getIsSupport()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 上游黑名单
|
// 上游黑名单
|
||||||
if (resp.getIsBlack()){
|
if (resp.getIsBlack()) {
|
||||||
|
|
||||||
}
|
}
|
||||||
// 查询成功?
|
// 查询成功?
|
||||||
if (!resp.getSuccess()){
|
if (!resp.getSuccess()) {
|
||||||
// 不成功原因
|
// 不成功原因
|
||||||
String msg = resp.getMsg();
|
String msg = resp.getMsg();
|
||||||
}
|
}
|
||||||
|
@ -158,39 +162,40 @@ public class HaokaUpdateOrderSchedule {
|
||||||
if (StringUtils.isNotEmpty(orderStatusCode)) {
|
if (StringUtils.isNotEmpty(orderStatusCode)) {
|
||||||
try {
|
try {
|
||||||
ordersDO.setUpstreamOrderStatus(Integer.valueOf(orderStatusCode));
|
ordersDO.setUpstreamOrderStatus(Integer.valueOf(orderStatusCode));
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 上游对订单状态的描述
|
// 上游对订单状态的描述
|
||||||
String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
||||||
if (StringUtils.isNotEmpty(orderStatusDesc)) {
|
if (StringUtils.isNotEmpty(orderStatusDesc)) {
|
||||||
ordersDO.setUpStatus(orderStatusDesc);
|
ordersDO.setUpStatus(orderStatusDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 物流信息 头都
|
|
||||||
|
Long orderId = ordersDO.getId();
|
||||||
|
Integer upstreamOrderStatus = Integer.valueOf(orderStatusCode);
|
||||||
|
String upstreamOrderStatusDescOrReason = data.getSupplierOrderStatusDesc();
|
||||||
|
|
||||||
|
UpstreamOrderStatusInfo upstreamOrderStatusInfo = new UpstreamOrderStatusInfo();
|
||||||
|
|
||||||
String trackingNumber = data.getTrackingNumber();
|
String trackingNumber = data.getTrackingNumber();
|
||||||
if (StringUtils.isNotEmpty(trackingNumber)) {
|
if (StringUtils.isNotEmpty(trackingNumber)) {
|
||||||
ordersDO.setTrackingNumber(trackingNumber);
|
upstreamOrderStatusInfo.setTrackingNumber(trackingNumber);
|
||||||
}
|
}
|
||||||
String trackingCompany = data.getTrackingCompany();
|
String trackingCompany = data.getTrackingCompany();
|
||||||
if (StringUtils.isNotEmpty(trackingCompany)) {
|
if (StringUtils.isNotEmpty(trackingCompany)) {
|
||||||
ordersDO.setTrackingCompany(trackingCompany);
|
upstreamOrderStatusInfo.setTrackingCompany(trackingCompany);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (data.isNeedUpdateProducePhoneNum()) {
|
if (data.isNeedUpdateProducePhoneNum()) {
|
||||||
ordersDO.setPlanMobileProduced(data.getSupplierPhoneNumber());
|
upstreamOrderStatusInfo.setPlanMobileProduced(data.getSupplierPhoneNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ordersService.changeUpstreamOrderStatus(orderId, upstreamOrderStatus, upstreamOrderStatusDescOrReason,
|
||||||
// todo 上游更新
|
upstreamOrderStatusInfo);
|
||||||
ordersService.updateById(ordersDO);
|
|
||||||
log.info("更新后--:{}", JSON.toJSONString(ordersDO));
|
log.info("更新后--:{}", JSON.toJSONString(ordersDO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,9 +290,9 @@ public class HaokaUpdateOrderSchedule {
|
||||||
// 上游状态 要转换为本地状态
|
// 上游状态 要转换为本地状态
|
||||||
String state = msg.getState();
|
String state = msg.getState();
|
||||||
//
|
//
|
||||||
if (StringUtils.isNotEmpty(state)){
|
if (StringUtils.isNotEmpty(state)) {
|
||||||
// E0:发货,
|
// E0:发货,
|
||||||
if ("E0".equals(state)){
|
if ("E0".equals(state)) {
|
||||||
String trackingNumber = msg.getTrackingNumber();
|
String trackingNumber = msg.getTrackingNumber();
|
||||||
ordersDO.setTrackingNumber(trackingNumber);
|
ordersDO.setTrackingNumber(trackingNumber);
|
||||||
ordersDO.setTrackingCompany("EMS");
|
ordersDO.setTrackingCompany("EMS");
|
||||||
|
@ -295,12 +300,12 @@ public class HaokaUpdateOrderSchedule {
|
||||||
// ordersService.updateById(ordersDO);
|
// ordersService.updateById(ordersDO);
|
||||||
}
|
}
|
||||||
// 1:激活
|
// 1:激活
|
||||||
if ("1".equals(state)){
|
if ("1".equals(state)) {
|
||||||
// ordersService.updateById(ordersDO);
|
// ordersService.updateById(ordersDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退单 2 4 SX AX
|
// 退单 2 4 SX AX
|
||||||
if ("2,4,SX,AX".contains(state)){
|
if ("2,4,SX,AX".contains(state)) {
|
||||||
// ordersService.updateById(ordersDO);
|
// ordersService.updateById(ordersDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,13 @@ import cn.iocoder.yudao.module.haoka.service.superiorproductconfig.SuperiorProdu
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.val;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Component(ApiFrom.HuNanDXApiDealStrategy)
|
@Component(ApiFrom.HuNanDXApiDealStrategy)
|
||||||
public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
@ -131,7 +134,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
orderParam.setServiceOrderSource(configs.getString("ApiPrefix_serviceOrderSource"));
|
orderParam.setServiceOrderSource(configs.getString("ApiPrefix_serviceOrderSource"));
|
||||||
String string1 = configs.getString("ApiPrefix_serviceOrderType");
|
String string1 = configs.getString("ApiPrefix_serviceOrderType");
|
||||||
orderParam.setServiceOrderType(string1!=null?string1:configs.getString("ApiPrefix_serviceOrderSource"));
|
orderParam.setServiceOrderType(string1 != null ? string1 : configs.getString("ApiPrefix_serviceOrderSource"));
|
||||||
|
|
||||||
// 补充其他字段,如果 configs.getString 返回 null,则填入 ""
|
// 补充其他字段,如果 configs.getString 返回 null,则填入 ""
|
||||||
|
|
||||||
|
@ -301,7 +304,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
SuperiorApiRespVO superiorApi = preProduct.getSuperiorApiRespVO();
|
SuperiorApiRespVO superiorApi = preProduct.getSuperiorApiRespVO();
|
||||||
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
final SuperiorProductConfigDO skuConfigVO = superiorProductConfigService.getById(param.getSuperiorProductConfigId());
|
||||||
if (skuConfigVO == null) {
|
if (skuConfigVO == null) {
|
||||||
return ApiDealResp.failed("商品对接上游配置不存在");
|
return ApiDealResp.failed("商品对接上游配置不存在");
|
||||||
|
@ -331,7 +334,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
JSONObject serviceOrder = data.getJSONObject("serviceOrder");
|
JSONObject serviceOrder = data.getJSONObject("serviceOrder");
|
||||||
if (serviceOrder!=null){
|
if (serviceOrder != null) {
|
||||||
// 订单状态 pending 待处理,processing 处理中,completed 处理完成,ORDER_CANCEL 业务订单作废
|
// 订单状态 pending 待处理,processing 处理中,completed 处理完成,ORDER_CANCEL 业务订单作废
|
||||||
String serviceOrderState = serviceOrder.getString("serviceOrderState");
|
String serviceOrderState = serviceOrder.getString("serviceOrderState");
|
||||||
// RM状态
|
// RM状态
|
||||||
|
@ -340,45 +343,42 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
String serviceOrderCrmStatus = serviceOrder.getString("serviceOrderCrmStatus");
|
String serviceOrderCrmStatus = serviceOrder.getString("serviceOrderCrmStatus");
|
||||||
|
|
||||||
|
|
||||||
if ("IS_COMPLETED".equals(serviceOrderCrmStatus)){
|
if ("IS_COMPLETED".equals(serviceOrderCrmStatus)) {
|
||||||
orderApiQueryResp.setOrderStatusCode("500");
|
orderApiQueryResp.setOrderStatusCode("500");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("CrmStatus IS_COMPLETED 已竣工");
|
orderApiQueryResp.setSupplierOrderStatusDesc("CrmStatus IS_COMPLETED 已竣工");
|
||||||
String serviceOrderCusAccPhone = serviceOrder.getString("serviceOrderCusAccPhone");
|
String serviceOrderCusAccPhone = serviceOrder.getString("serviceOrderCusAccPhone");
|
||||||
if (serviceOrderCusAccPhone!=null){
|
if (serviceOrderCusAccPhone != null) {
|
||||||
orderApiQueryResp.setNeedUpdateProducePhoneNum(true);
|
orderApiQueryResp.setNeedUpdateProducePhoneNum(true);
|
||||||
orderApiQueryResp.setSupplierPhoneNumber(serviceOrderCusAccPhone);
|
orderApiQueryResp.setSupplierPhoneNumber(serviceOrderCusAccPhone);
|
||||||
}
|
}
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("pending".equals(serviceOrderState)){
|
if ("pending".equals(serviceOrderState)) {
|
||||||
orderApiQueryResp.setOrderStatusCode("470");
|
orderApiQueryResp.setOrderStatusCode("470");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 pending 待处理");
|
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 pending 待处理");
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("completed".equals(serviceOrderState)){
|
if ("completed".equals(serviceOrderState)) {
|
||||||
orderApiQueryResp.setOrderStatusCode("500");
|
orderApiQueryResp.setOrderStatusCode("500");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 completed 待处理");
|
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 completed 待处理");
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("ORDER_CANCEL".equals(serviceOrderState)){
|
if ("ORDER_CANCEL".equals(serviceOrderState)) {
|
||||||
orderApiQueryResp.setOrderStatusCode("-460");
|
orderApiQueryResp.setOrderStatusCode("-460");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 IS_COMPLETED 业务订单作废");
|
orderApiQueryResp.setSupplierOrderStatusDesc("订单状态 IS_COMPLETED 业务订单作废");
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
orderApiQueryResp.setOrderStatusCode("0");
|
orderApiQueryResp.setOrderStatusCode("0");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("busOppOrder null");
|
orderApiQueryResp.setSupplierOrderStatusDesc("busOppOrder null");
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONObject busOppOrder = data.getJSONObject("busOppOrder");
|
JSONObject busOppOrder = data.getJSONObject("busOppOrder");
|
||||||
if (busOppOrder == null) {
|
if (busOppOrder == null) {
|
||||||
// return ApiDealResp.failed("busOppOrder null");
|
// return ApiDealResp.failed("busOppOrder null");
|
||||||
|
@ -390,6 +390,11 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
String tbBusOppOrderThState = busOppOrder.getString("tbBusOppOrderThState");
|
String tbBusOppOrderThState = busOppOrder.getString("tbBusOppOrderThState");
|
||||||
|
|
||||||
|
String stateReason = busOppOrder.getString("tbBusOppCancelReason");
|
||||||
|
if (stateReason==null){
|
||||||
|
stateReason = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (tbBusOppOrderThState == null) {
|
if (tbBusOppOrderThState == null) {
|
||||||
// return ApiDealResp.failed("tbBusOppOrderThState null");
|
// return ApiDealResp.failed("tbBusOppOrderThState null");
|
||||||
|
|
||||||
|
@ -398,17 +403,33 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tbBusOppOrderThState.equals("1")) {
|
|
||||||
// return ApiDealResp.failed("tbBusOppOrderThState null");
|
|
||||||
|
|
||||||
orderApiQueryResp.setOrderStatusCode("0");
|
Map<String, String> tbStateDescMap = new HashMap<>();
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + tbBusOppOrderThState + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
tbStateDescMap.put("0", "0待确认");
|
||||||
|
tbStateDescMap.put("1", "1生产");
|
||||||
|
tbStateDescMap.put("2", "2作废");
|
||||||
|
tbStateDescMap.put("3", "3同步失败");
|
||||||
|
tbStateDescMap.put("4", "4待下单");
|
||||||
|
tbStateDescMap.put("5", "5待转业务单");
|
||||||
|
tbStateDescMap.put("8", "8业务单挂起状态");
|
||||||
|
|
||||||
|
|
||||||
|
// 状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态
|
||||||
|
String supplierOrderStatusDesc = tbStateDescMap.getOrDefault(tbBusOppOrderThState,"")+stateReason;
|
||||||
|
if ("2,3,5,8".contains(tbBusOppOrderThState)) {
|
||||||
|
orderApiQueryResp.setOrderStatusCode("-460");
|
||||||
|
orderApiQueryResp.setSupplierOrderStatusDesc(supplierOrderStatusDesc);
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
orderApiQueryResp.setData(responseInfo);
|
if (!tbBusOppOrderThState.equals("1")) {
|
||||||
orderApiQueryResp.setOrderStatusCode("470");
|
orderApiQueryResp.setOrderStatusCode("470");
|
||||||
orderApiQueryResp.setSupplierOrderStatusDesc("状态为:" + tbBusOppOrderThState + ",状态说明:0待确认,1生产,2作废,3同步失败,4待下单,5待转业务单,8业务单挂起状态");
|
} else {
|
||||||
|
orderApiQueryResp.setData(responseInfo);
|
||||||
|
orderApiQueryResp.setOrderStatusCode("500");
|
||||||
|
}
|
||||||
|
orderApiQueryResp.setSupplierOrderStatusDesc(supplierOrderStatusDesc);
|
||||||
return ApiDealResp.ok(orderApiQueryResp);
|
return ApiDealResp.ok(orderApiQueryResp);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return ApiDealResp.failed(e.getMessage());
|
return ApiDealResp.failed(e.getMessage());
|
||||||
|
|
|
@ -54,6 +54,14 @@ public interface OrdersService extends IService<OrdersDO> {
|
||||||
*/
|
*/
|
||||||
PageResult<OrdersDO> getOrdersPage(OrdersPageReqVO pageReqVO);
|
PageResult<OrdersDO> getOrdersPage(OrdersPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @param upstreamOrderStatus 上游订单状态(-430 生产异常 -460 提交异常 0 开卡中470 待发货500 已发货550 已激活700)
|
||||||
|
* @param upstreamOrderStatusDescOrReason 状态描述或者原因
|
||||||
|
*/
|
||||||
|
void changeUpstreamOrderStatus(Long orderId, Integer upstreamOrderStatus,
|
||||||
|
String upstreamOrderStatusDescOrReason, UpstreamOrderStatusInfo upstreamOrderStatusInfo);
|
||||||
|
|
||||||
void auditOrdersAsync(OrdersSaveReqVO updateReqVO);
|
void auditOrdersAsync(OrdersSaveReqVO updateReqVO);
|
||||||
|
|
||||||
void auditOrders(OrdersSaveReqVO updateReqVO);
|
void auditOrders(OrdersSaveReqVO updateReqVO);
|
||||||
|
@ -84,18 +92,21 @@ public interface OrdersService extends IService<OrdersDO> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步执行
|
* 异步执行
|
||||||
|
*
|
||||||
* @param ordersDO
|
* @param ordersDO
|
||||||
*/
|
*/
|
||||||
void asyncSubmitAuditOrders(OrdersDO ordersDO);
|
void asyncSubmitAuditOrders(OrdersDO ordersDO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步执行
|
* 异步执行
|
||||||
|
*
|
||||||
* @param ordersDO
|
* @param ordersDO
|
||||||
*/
|
*/
|
||||||
void asyncAuditOrders(OrdersDO ordersDO);
|
void asyncAuditOrders(OrdersDO ordersDO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步执行
|
* 异步执行
|
||||||
|
*
|
||||||
* @param oldOrderDo
|
* @param oldOrderDo
|
||||||
* @param updateObj
|
* @param updateObj
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.haoka.service.api.models.ApiDealResp;
|
||||||
import cn.iocoder.yudao.module.haoka.service.api.ApiDealStrategyService;
|
import cn.iocoder.yudao.module.haoka.service.api.ApiDealStrategyService;
|
||||||
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiCreateParam;
|
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiCreateParam;
|
||||||
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiCreateResp;
|
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiCreateResp;
|
||||||
|
import cn.iocoder.yudao.module.haoka.service.api.models.OrderApiQueryResp;
|
||||||
import cn.iocoder.yudao.module.haoka.service.blacklist.BlackListService;
|
import cn.iocoder.yudao.module.haoka.service.blacklist.BlackListService;
|
||||||
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
import cn.iocoder.yudao.module.haoka.service.onsaleproduct.OnSaleProductService;
|
||||||
import cn.iocoder.yudao.module.haoka.service.orderCatch.DouDianOrderCatchServiceImpl;
|
import cn.iocoder.yudao.module.haoka.service.orderCatch.DouDianOrderCatchServiceImpl;
|
||||||
|
@ -30,6 +31,7 @@ import com.doudian.open.api.order_addOrderRemark.param.OrderAddOrderRemarkParam;
|
||||||
import com.doudian.open.api.order_logisticsAdd.OrderLogisticsAddResponse;
|
import com.doudian.open.api.order_logisticsAdd.OrderLogisticsAddResponse;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import lombok.val;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
@ -123,6 +125,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 在号卡系统创建订单
|
* 在号卡系统创建订单
|
||||||
|
*
|
||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -149,7 +152,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
// 已支付
|
// 已支付
|
||||||
orders.setRefundStatus(ObjectUtil.isEmpty(orders.getRefundStatus()) ? "800" : orders.getRefundStatus());
|
orders.setRefundStatus(ObjectUtil.isEmpty(orders.getRefundStatus()) ? "800" : orders.getRefundStatus());
|
||||||
// 未激活
|
// 未激活
|
||||||
orders.setActiveStatus(ObjectUtil.isEmpty(orders.getActiveStatus())? "0" : orders.getActiveStatus());
|
orders.setActiveStatus(ObjectUtil.isEmpty(orders.getActiveStatus()) ? "0" : orders.getActiveStatus());
|
||||||
log.error("系统入库订单数据:{}", JSON.toJSONString(orders));
|
log.error("系统入库订单数据:{}", JSON.toJSONString(orders));
|
||||||
ordersMapper.insert(orders);
|
ordersMapper.insert(orders);
|
||||||
|
|
||||||
|
@ -182,13 +185,14 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步判断是否自动提交审核订单
|
* 异步判断是否自动提交审核订单
|
||||||
|
*
|
||||||
* @param ordersDO
|
* @param ordersDO
|
||||||
*/
|
*/
|
||||||
@Async
|
@Async
|
||||||
public void asyncSubmitAuditOrders(OrdersDO ordersDO){
|
public void asyncSubmitAuditOrders(OrdersDO ordersDO) {
|
||||||
// 是否自动生产
|
// 是否自动生产
|
||||||
Integer autoType = ordersDO.getAutoType();
|
Integer autoType = ordersDO.getAutoType();
|
||||||
if(2 == autoType){
|
if (2 == autoType) {
|
||||||
// 自动生产 调用提交初审
|
// 自动生产 调用提交初审
|
||||||
OrdersSaveReqVO ordersSaveReqVO = new OrdersSaveReqVO();
|
OrdersSaveReqVO ordersSaveReqVO = new OrdersSaveReqVO();
|
||||||
ordersSaveReqVO.setId(ordersDO.getId());
|
ordersSaveReqVO.setId(ordersDO.getId());
|
||||||
|
@ -233,7 +237,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
logSaveReqVO.setMsgSource("0");
|
logSaveReqVO.setMsgSource("0");
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
updateObj.setStatus(-451L);
|
updateObj.setStatus(-451L);
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "提交初审:年龄限制校验不通过");
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "提交初审:年龄限制校验不通过");
|
||||||
// 初审不通过
|
// 初审不通过
|
||||||
canAudit = false;
|
canAudit = false;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +255,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
updateObj.setStatus(-451L);
|
updateObj.setStatus(-451L);
|
||||||
// 初审不通过
|
// 初审不通过
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "提交初审:身份证号码限制校验不通过");
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "提交初审:身份证号码限制校验不通过");
|
||||||
canAudit = false;
|
canAudit = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -279,7 +283,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
logSaveReqVO.setMsgSource("0");
|
logSaveReqVO.setMsgSource("0");
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
// 初审不通过
|
// 初审不通过
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "提交初审:敏感地区待审核");
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "提交初审:敏感地区待审核");
|
||||||
canAudit = false;
|
canAudit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -298,7 +302,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
logSaveReqVO.setMsgSource("0");
|
logSaveReqVO.setMsgSource("0");
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
// 初审不通过
|
// 初审不通过
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "提交初审:敏感地区待审核");
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "提交初审:敏感地区待审核");
|
||||||
canAudit = false;
|
canAudit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +311,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
// 黑名单判断
|
// 黑名单判断
|
||||||
List<BlackListDO> list = blackListService.list();
|
List<BlackListDO> list = blackListService.list();
|
||||||
boolean blacklisted = isBlacklisted(list, oldOrderDo.getAddressMobile(), idCardNum);
|
boolean blacklisted = isBlacklisted(list, oldOrderDo.getAddressMobile(), idCardNum);
|
||||||
if(blacklisted){
|
if (blacklisted) {
|
||||||
updateObj.setStatus(-451L);
|
updateObj.setStatus(-451L);
|
||||||
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
||||||
logSaveReqVO.setOrderId(updateObj.getId());
|
logSaveReqVO.setOrderId(updateObj.getId());
|
||||||
|
@ -316,7 +320,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
logSaveReqVO.setMsgSource("0");
|
logSaveReqVO.setMsgSource("0");
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
// 初审不通过
|
// 初审不通过
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "提交初审:该订单身份证号码或手机号在系统黑名单中");
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "提交初审:该订单身份证号码或手机号在系统黑名单中");
|
||||||
canAudit = false;
|
canAudit = false;
|
||||||
}
|
}
|
||||||
log.error("提交审核的订单数据:{}", JSON.toJSONString(updateObj));
|
log.error("提交审核的订单数据:{}", JSON.toJSONString(updateObj));
|
||||||
|
@ -326,7 +330,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
// 异步处理 审核成功是否自动进单
|
// 异步处理 审核成功是否自动进单
|
||||||
Integer autoType = oldOrderDo.getAutoType();
|
Integer autoType = oldOrderDo.getAutoType();
|
||||||
// 联合条件: 自动生产 && 审核通过 && 提交初审
|
// 联合条件: 自动生产 && 审核通过 && 提交初审
|
||||||
if(2 == autoType && canAudit && submit){
|
if (2 == autoType && canAudit && submit) {
|
||||||
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void afterCommit() {
|
// public void afterCommit() {
|
||||||
|
@ -340,10 +344,11 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 异步判断是否自动审核订单
|
* 异步判断是否自动审核订单
|
||||||
|
*
|
||||||
* @param ordersDO
|
* @param ordersDO
|
||||||
*/
|
*/
|
||||||
@Async
|
@Async
|
||||||
public void asyncAuditOrders(OrdersDO ordersDO){
|
public void asyncAuditOrders(OrdersDO ordersDO) {
|
||||||
// 自动生产 调用审核
|
// 自动生产 调用审核
|
||||||
OrdersSaveReqVO ordersSaveReqVO = BeanUtils.toBean(ordersDO, OrdersSaveReqVO.class);
|
OrdersSaveReqVO ordersSaveReqVO = BeanUtils.toBean(ordersDO, OrdersSaveReqVO.class);
|
||||||
ordersSaveReqVO.setStatus(450L);
|
ordersSaveReqVO.setStatus(450L);
|
||||||
|
@ -352,13 +357,14 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断手机号和身份证是否在黑名单中
|
* 判断手机号和身份证是否在黑名单中
|
||||||
|
*
|
||||||
* @param list
|
* @param list
|
||||||
* @param phoneNumber
|
* @param phoneNumber
|
||||||
* @param idcard
|
* @param idcard
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static boolean isBlacklisted(List<BlackListDO> list, String phoneNumber, String idcard) {
|
public static boolean isBlacklisted(List<BlackListDO> list, String phoneNumber, String idcard) {
|
||||||
if(CollectionUtil.isEmpty(list)){
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Set<String> phoneSet = list.stream()
|
Set<String> phoneSet = list.stream()
|
||||||
|
@ -378,7 +384,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updateOrderById(OrdersDO updateObj){
|
private void updateOrderById(OrdersDO updateObj) {
|
||||||
OrdersDO oldOrderDo = ordersMapper.selectById(updateObj.getId());
|
OrdersDO oldOrderDo = ordersMapper.selectById(updateObj.getId());
|
||||||
if (oldOrderDo == null) {
|
if (oldOrderDo == null) {
|
||||||
throw exception(ORDERS_NOT_EXISTS);
|
throw exception(ORDERS_NOT_EXISTS);
|
||||||
|
@ -390,7 +396,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
updateObj.setSuperiorApiId(oldOrderDo.getSuperiorApiId());
|
updateObj.setSuperiorApiId(oldOrderDo.getSuperiorApiId());
|
||||||
ordersMapper.updateById(updateObj);
|
ordersMapper.updateById(updateObj);
|
||||||
// 抖音订单判断备注更新
|
// 抖音订单判断备注更新
|
||||||
ordersService.syncDouDian(oldOrderDo,updateObj);
|
ordersService.syncDouDian(oldOrderDo, updateObj);
|
||||||
// 状态变化:发送短信提醒
|
// 状态变化:发送短信提醒
|
||||||
if (updateObj.getStatus() != null && updateObj.getStatus().equals(oldOrderDo.getStatus())) {
|
if (updateObj.getStatus() != null && updateObj.getStatus().equals(oldOrderDo.getStatus())) {
|
||||||
|
|
||||||
|
@ -408,17 +414,17 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
}
|
}
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
public void syncDouDian(OrdersDO oldOrderDo,OrdersDO updateObj){
|
public void syncDouDian(OrdersDO oldOrderDo, OrdersDO updateObj) {
|
||||||
// 抖音订单判断备注更新
|
// 抖音订单判断备注更新
|
||||||
if("2".equals(oldOrderDo.getSource())){
|
if ("2".equals(oldOrderDo.getSource())) {
|
||||||
String sellerMemo = oldOrderDo.getSellerMemo();
|
String sellerMemo = oldOrderDo.getSellerMemo();
|
||||||
String sellerMemo1 = updateObj.getSellerMemo();
|
String sellerMemo1 = updateObj.getSellerMemo();
|
||||||
if(StringUtils.isNotBlank(sellerMemo) && StringUtils.isNotBlank(sellerMemo1) && !sellerMemo.equals(sellerMemo1)){
|
if (StringUtils.isNotBlank(sellerMemo) && StringUtils.isNotBlank(sellerMemo1) && !sellerMemo.equals(sellerMemo1)) {
|
||||||
OrderAddOrderRemarkParam param = new OrderAddOrderRemarkParam();
|
OrderAddOrderRemarkParam param = new OrderAddOrderRemarkParam();
|
||||||
param.setOrderId(oldOrderDo.getRealSourceId());
|
param.setOrderId(oldOrderDo.getRealSourceId());
|
||||||
param.setRemark(sellerMemo1);
|
param.setRemark(sellerMemo1);
|
||||||
Long flag = updateObj.getFlag();
|
Long flag = updateObj.getFlag();
|
||||||
if(null != flag){
|
if (null != flag) {
|
||||||
param.setIsAddStar("true");
|
param.setIsAddStar("true");
|
||||||
param.setStar(String.valueOf(flag));
|
param.setStar(String.valueOf(flag));
|
||||||
}
|
}
|
||||||
|
@ -427,27 +433,27 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
}
|
}
|
||||||
// 抖音判断发货
|
// 抖音判断发货
|
||||||
String trackingNumber = updateObj.getTrackingNumber();
|
String trackingNumber = updateObj.getTrackingNumber();
|
||||||
if(StringUtils.isNotBlank(trackingNumber)){
|
if (StringUtils.isNotBlank(trackingNumber)) {
|
||||||
Long trackingCompanyId = updateObj.getTrackingCompanyId();
|
Long trackingCompanyId = updateObj.getTrackingCompanyId();
|
||||||
String otherSystemCode = LogisticsCompany.getOtherSystemCode(trackingCompanyId);
|
String otherSystemCode = LogisticsCompany.getOtherSystemCode(trackingCompanyId);
|
||||||
String otherSystemName = LogisticsCompany.getOtherSystemName(trackingCompanyId);
|
String otherSystemName = LogisticsCompany.getOtherSystemName(trackingCompanyId);
|
||||||
DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl();
|
DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl();
|
||||||
OrderLogisticsAddResponse response = douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(), otherSystemName, otherSystemCode, trackingNumber);
|
OrderLogisticsAddResponse response = douDianOrderCatchService.logisticsAdd(updateObj.getRealSourceId(), otherSystemName, otherSystemCode, trackingNumber);
|
||||||
if(response!= null){
|
if (response != null) {
|
||||||
if("10000".equals(response.getCode())){
|
if ("10000".equals(response.getCode())) {
|
||||||
// 订单发货成功
|
// 订单发货成功
|
||||||
updateObj.setStatus(550L);
|
updateObj.setStatus(550L);
|
||||||
updateObj.setUpstreamOrderStatus(550);
|
updateObj.setUpstreamOrderStatus(550);
|
||||||
updateObj.setSellerMemo(oldOrderDo+"\n"+"订单发货成功");
|
updateObj.setSellerMemo(oldOrderDo + "\n" + "订单发货成功");
|
||||||
}else {
|
} else {
|
||||||
String subMsg = response.getSubMsg();
|
String subMsg = response.getSubMsg();
|
||||||
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
||||||
logSaveReqVO.setOrderId(updateObj.getId());
|
logSaveReqVO.setOrderId(updateObj.getId());
|
||||||
logSaveReqVO.setMsg("订单发货失败:"+subMsg);
|
logSaveReqVO.setMsg("订单发货失败:" + subMsg);
|
||||||
logSaveReqVO.setMsgType("0");
|
logSaveReqVO.setMsgType("0");
|
||||||
logSaveReqVO.setMsgSource("1");
|
logSaveReqVO.setMsgSource("1");
|
||||||
log.error("订单发货失败,{}",subMsg);
|
log.error("订单发货失败,{}", subMsg);
|
||||||
updateObj.setReason(oldOrderDo.getReason() + "\n"+ "订单发货失败:"+subMsg);
|
updateObj.setReason(oldOrderDo.getReason() + "\n" + "订单发货失败:" + subMsg);
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
}
|
}
|
||||||
updateOrderById(updateObj);
|
updateOrderById(updateObj);
|
||||||
|
@ -459,8 +465,8 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
@Async
|
@Async
|
||||||
@Override
|
@Override
|
||||||
public void auditOrdersAsync(OrdersSaveReqVO updateReqVO){
|
public void auditOrdersAsync(OrdersSaveReqVO updateReqVO) {
|
||||||
auditOrders( updateReqVO);
|
auditOrders(updateReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -481,7 +487,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
updateOrderById(updateObj);
|
updateOrderById(updateObj);
|
||||||
Long status = updateObj.getStatus();
|
Long status = updateObj.getStatus();
|
||||||
// 进入审核流程
|
// 进入审核流程
|
||||||
log.error("【审核订单开始】,订单状态:{}",status);
|
log.error("【审核订单开始】,订单状态:{}", status);
|
||||||
if (status != null && status == 450L) {
|
if (status != null && status == 450L) {
|
||||||
// 450 审核通过
|
// 450 审核通过
|
||||||
if ("2".equals(String.valueOf(autoType))) {
|
if ("2".equals(String.valueOf(autoType))) {
|
||||||
|
@ -491,37 +497,37 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
logSaveReqVO.setMsg("已自动提交到上游");
|
logSaveReqVO.setMsg("已自动提交到上游");
|
||||||
logSaveReqVO.setMsgType("0");
|
logSaveReqVO.setMsgType("0");
|
||||||
logSaveReqVO.setMsgSource("1");
|
logSaveReqVO.setMsgSource("1");
|
||||||
log.error("【审核订单自动生产】,操作日志数据:{}",JSON.toJSONString(logSaveReqVO));
|
log.error("【审核订单自动生产】,操作日志数据:{}", JSON.toJSONString(logSaveReqVO));
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
log.error("【审核订单自动提交上游】,订单数据:{}",JSON.toJSONString(updateObj));
|
log.error("【审核订单自动提交上游】,订单数据:{}", JSON.toJSONString(updateObj));
|
||||||
try {
|
try {
|
||||||
createOrderToOperators(updateObj);
|
createOrderToOperators(updateObj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("【审核订单自动提交上游异常】,订单数据:{},异常信息{},异常栈信息{}",JSON.toJSONString(updateObj),e.getMessage(),e);
|
log.error("【审核订单自动提交上游异常】,订单数据:{},异常信息{},异常栈信息{}", JSON.toJSONString(updateObj), e.getMessage(), e);
|
||||||
updateObj.setStatus(-460L); // 开卡失败
|
updateObj.setStatus(-460L); // 开卡失败
|
||||||
updateObj.setReason(ordersOld.getReason() + "\n"+ "自动提交上游异常:"+e.getMessage());
|
updateObj.setReason(ordersOld.getReason() + "\n" + "自动提交上游异常:" + e.getMessage());
|
||||||
log.error("【审核订单手动生产】,订单数据:{}",JSON.toJSONString(updateObj));
|
log.error("【审核订单手动生产】,订单数据:{}", JSON.toJSONString(updateObj));
|
||||||
OrderOperateLogSaveReqVO logSaveReqVO1 = new OrderOperateLogSaveReqVO();
|
OrderOperateLogSaveReqVO logSaveReqVO1 = new OrderOperateLogSaveReqVO();
|
||||||
logSaveReqVO1.setOrderId(updateObj.getId());
|
logSaveReqVO1.setOrderId(updateObj.getId());
|
||||||
logSaveReqVO1.setMsg("自动提交上游异常:"+e.getMessage());
|
logSaveReqVO1.setMsg("自动提交上游异常:" + e.getMessage());
|
||||||
logSaveReqVO1.setMsgType("1");
|
logSaveReqVO1.setMsgType("1");
|
||||||
logSaveReqVO1.setMsgSource("0");
|
logSaveReqVO1.setMsgSource("0");
|
||||||
log.error("【审核订单手动生产】,操作日志数据:{}",JSON.toJSONString(logSaveReqVO1));
|
log.error("【审核订单手动生产】,操作日志数据:{}", JSON.toJSONString(logSaveReqVO1));
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO1);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 手动生产
|
// 手动生产
|
||||||
log.error("【审核订单手动生产】,订单数据:{}",JSON.toJSONString(updateObj));
|
log.error("【审核订单手动生产】,订单数据:{}", JSON.toJSONString(updateObj));
|
||||||
updateObj.setStatus(450L);
|
updateObj.setStatus(450L);
|
||||||
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
OrderOperateLogSaveReqVO logSaveReqVO = new OrderOperateLogSaveReqVO();
|
||||||
logSaveReqVO.setOrderId(updateObj.getId());
|
logSaveReqVO.setOrderId(updateObj.getId());
|
||||||
logSaveReqVO.setMsg("进入手动生产订单流程");
|
logSaveReqVO.setMsg("进入手动生产订单流程");
|
||||||
logSaveReqVO.setMsgType("0");
|
logSaveReqVO.setMsgType("0");
|
||||||
logSaveReqVO.setMsgSource("0");
|
logSaveReqVO.setMsgSource("0");
|
||||||
log.error("【审核订单手动生产】,操作日志数据:{}",JSON.toJSONString(logSaveReqVO));
|
log.error("【审核订单手动生产】,操作日志数据:{}", JSON.toJSONString(logSaveReqVO));
|
||||||
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
orderOperateLogService.createOrderOperateLog(logSaveReqVO);
|
||||||
}
|
}
|
||||||
log.error("【审核订单完成】,订单数据:{}",JSON.toJSONString(updateObj));
|
log.error("【审核订单完成】,订单数据:{}", JSON.toJSONString(updateObj));
|
||||||
updateOrderById(updateObj);
|
updateOrderById(updateObj);
|
||||||
}
|
}
|
||||||
// 如果是抖音订单 则需要调用抖音接口 返回审核结果
|
// 如果是抖音订单 则需要调用抖音接口 返回审核结果
|
||||||
|
@ -542,11 +548,11 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void orderRevicer(String source, String realSourceId) {
|
private static void orderRevicer(String source, String realSourceId) {
|
||||||
if("2".equals(source)){
|
if ("2".equals(source)) {
|
||||||
// if(status != null && status == 450L){
|
// if(status != null && status == 450L){
|
||||||
//审核通过
|
//审核通过
|
||||||
DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl();
|
DouDianOrderCatchServiceImpl douDianOrderCatchService = new DouDianOrderCatchServiceImpl();
|
||||||
douDianOrderCatchService.reviewOrder(0L, realSourceId);
|
douDianOrderCatchService.reviewOrder(0L, realSourceId);
|
||||||
// }
|
// }
|
||||||
// if(status != null && status == -450L){
|
// if(status != null && status == -450L){
|
||||||
// //审核不通过
|
// //审核不通过
|
||||||
|
@ -575,13 +581,14 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 强制修改订单提交状态
|
* 强制修改订单提交状态
|
||||||
|
*
|
||||||
* @param updateReqVO
|
* @param updateReqVO
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void changeStatus(OrdersSaveReqVO updateReqVO) {
|
public void changeStatus(OrdersSaveReqVO updateReqVO) {
|
||||||
OrdersDO ordersDO = validateOrdersExists(updateReqVO.getId());
|
OrdersDO ordersDO = validateOrdersExists(updateReqVO.getId());
|
||||||
Long status = updateReqVO.getStatus();
|
Long status = updateReqVO.getStatus();
|
||||||
if("1".equals(String.valueOf(status))){
|
if ("1".equals(String.valueOf(status))) {
|
||||||
// 提交成功
|
// 提交成功
|
||||||
ordersDO.setStatus(500L);
|
ordersDO.setStatus(500L);
|
||||||
ordersDO.setUpstreamOrderStatus(500);
|
ordersDO.setUpstreamOrderStatus(500);
|
||||||
|
@ -589,7 +596,7 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
String realSourceId = ordersDO.getRealSourceId();
|
String realSourceId = ordersDO.getRealSourceId();
|
||||||
// 如果是抖音订单 则需要调用抖音接口 返回审核结果 source判断了抖音
|
// 如果是抖音订单 则需要调用抖音接口 返回审核结果 source判断了抖音
|
||||||
orderRevicer(source, realSourceId);
|
orderRevicer(source, realSourceId);
|
||||||
}else {
|
} else {
|
||||||
// 提交失败
|
// 提交失败
|
||||||
ordersDO.setStatus(-460L);
|
ordersDO.setStatus(-460L);
|
||||||
ordersDO.setUpstreamOrderStatus(-460);
|
ordersDO.setUpstreamOrderStatus(-460);
|
||||||
|
@ -706,4 +713,67 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
return ordersMapper.selectPage(pageReqVO);
|
return ordersMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Long switchUpstreamOrderStatus( Integer upstreamOrderStatus){
|
||||||
|
return switch (upstreamOrderStatus) {
|
||||||
|
case -430 -> 0L;
|
||||||
|
case -460 -> 2L;
|
||||||
|
case 0 -> 3L;
|
||||||
|
case 470 -> 4L;
|
||||||
|
case 500 -> 5L;
|
||||||
|
case 700 -> 6L;
|
||||||
|
default -> {
|
||||||
|
log.error("未知上游订单状态{}", upstreamOrderStatus);
|
||||||
|
yield 0L;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param orderId 订单ID
|
||||||
|
* @param upstreamOrderStatus 上游订单状态(-430 生产异常 -460 提交异常 0 开卡中470 待发货500 已发货550 已激活700)
|
||||||
|
* @param upstreamOrderStatusDescOrReason 状态描述或者原因
|
||||||
|
*/
|
||||||
|
public void changeUpstreamOrderStatus(Long orderId,
|
||||||
|
Integer upstreamOrderStatus,
|
||||||
|
String upstreamOrderStatusDescOrReason,
|
||||||
|
UpstreamOrderStatusInfo upstreamOrderStatusInfo) {
|
||||||
|
OrdersDO ordersDO = validateOrdersExists(orderId);
|
||||||
|
if (upstreamOrderStatusDescOrReason != null) {
|
||||||
|
String oldReason = ordersDO.getReason() == null ? "" : ordersDO.getReason();
|
||||||
|
ordersDO.setReason(upstreamOrderStatusDescOrReason + ";\n" + oldReason);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Objects.equals(upstreamOrderStatus, ordersDO.getUpstreamOrderStatus())) {
|
||||||
|
log.debug("上游订单状态没变化,订单ID:{}", orderId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// (-430 生产异常 -460 提交异常 0 开卡中470 待发货500 已发货550 已激活700)
|
||||||
|
Long orderStatus = this.switchUpstreamOrderStatus(upstreamOrderStatus);
|
||||||
|
ordersDO.setStatus(orderStatus);
|
||||||
|
|
||||||
|
if (upstreamOrderStatusInfo != null) {
|
||||||
|
// 上游产生物流信息
|
||||||
|
String trackingNumber = upstreamOrderStatusInfo.getTrackingNumber();
|
||||||
|
if (trackingNumber != null) {
|
||||||
|
ordersDO.setPlanMobileProduced(trackingNumber);
|
||||||
|
}
|
||||||
|
String trackingCompany = upstreamOrderStatusInfo.getTrackingCompany();
|
||||||
|
if (trackingCompany != null) {
|
||||||
|
ordersDO.setPlanMobileProduced(trackingCompany);
|
||||||
|
}
|
||||||
|
// 上游生产号码
|
||||||
|
String planMobileProduced = upstreamOrderStatusInfo.getPlanMobileProduced();
|
||||||
|
if (planMobileProduced != null) {
|
||||||
|
ordersDO.setPlanMobileProduced(planMobileProduced);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 更新订单
|
||||||
|
this.updateOrderById(ordersDO);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package cn.iocoder.yudao.module.haoka.service.orders;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UpstreamOrderStatusInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流公司名称
|
||||||
|
*/
|
||||||
|
private String trackingCompany;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物流单号
|
||||||
|
*/
|
||||||
|
private String trackingNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产号码
|
||||||
|
*/
|
||||||
|
private String planMobileProduced;
|
||||||
|
}
|
Loading…
Reference in New Issue