From 2991dd88bb4e3af1999ffc6812f43babf6928d80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E4=BC=91=E5=93=A5=E5=93=A56666?= Date: Mon, 15 Jun 2026 13:42:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E6=8D=A2=E8=B4=A7?= =?UTF-8?q?=E5=8D=95=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C=E5=B7=B2=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E7=9F=AD=E4=BF=A1=E6=A8=A1=E6=9D=BF=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-front/src/api/jysystem/order.js | 17 -- .../src/views/jysystem/order/index.vue | 150 ++++------ .../com/ruoyi/web/util/ExpressQueryUtils.java | 37 ++- .../src/components/DictData/index.js | 34 +-- .../src/components/DictTag/index.vue | 4 +- developer-front/src/store/modules/dict.js | 13 +- .../src/views/order/factory-order.vue | 113 ++++---- .../src/views/order/lens-order.vue | 122 ++++---- .../ruoyi/jysystem/config/SmsProperties.java | 2 +- .../controller/JySysOrderController.java | 26 -- .../JySysOrderPortalController.java | 2 +- .../jysystem/domain/JySysOrderStatusLog.java | 28 -- .../jysystem/mapper/JySysOrderMapper.java | 2 + .../mapper/JySysOrderStatusLogMapper.java | 6 - .../service/IJySysOrderPortalService.java | 2 +- .../jysystem/service/IJySysOrderService.java | 6 +- .../service/SmsNotificationService.java | 3 +- .../impl/JySysFeeSettlementServiceImpl.java | 109 +++----- .../impl/JySysOrderPortalServiceImpl.java | 2 +- .../service/impl/JySysOrderServiceImpl.java | 262 +++++++++++------- .../impl/JySysTenantMessageServiceImpl.java | 67 ++++- .../impl/SmsNotificationServiceImpl.java | 59 +++- .../mapper/jysystem/JySysOrderMapper.xml | 11 +- .../jysystem/JySysOrderStatusLogMapper.xml | 71 ++--- .../main/resources/sql/jy_sys_order_dict.sql | 2 +- ...s_order_restore_exchange_status_labels.sql | 16 ++ ...ys_order_status_log_drop_settle_status.sql | 4 + .../java/com/ruoyi/common/utils/SmsUtils.java | 33 ++- 28 files changed, 575 insertions(+), 628 deletions(-) create mode 100644 jy-system/src/main/resources/sql/jy_sys_order_restore_exchange_status_labels.sql create mode 100644 jy-system/src/main/resources/sql/jy_sys_order_status_log_drop_settle_status.sql diff --git a/admin-front/src/api/jysystem/order.js b/admin-front/src/api/jysystem/order.js index 88b3ff2..d2da5e5 100644 --- a/admin-front/src/api/jysystem/order.js +++ b/admin-front/src/api/jysystem/order.js @@ -114,23 +114,6 @@ export function rejectExchangeOrder(data) { }) } -// 拒绝换货申请订单完成 -export function completeExchangeRejectedOrder(data) { - return request({ - url: '/jysystem/order/exchangeRejectedComplete', - method: 'put', - data: data - }) -} - -// 批量将拒绝换货申请订单更新为已完成 -export function completeAllExchangeRejectedOrder() { - return request({ - url: '/jysystem/order/exchangeRejectedCompleteAll', - method: 'put' - }) -} - // 变更订单状态 export function changeOrderStatus(data) { return request({ diff --git a/admin-front/src/views/jysystem/order/index.vue b/admin-front/src/views/jysystem/order/index.vue index 88ef44e..bb11cc0 100644 --- a/admin-front/src/views/jysystem/order/index.vue +++ b/admin-front/src/views/jysystem/order/index.vue @@ -172,15 +172,6 @@ @click="handleQuickFilter('exchangeRejected')" >拒绝换货申请 - - 更新拒绝换货申请为已完成 - @@ -200,17 +191,22 @@ + + + @@ -850,21 +846,21 @@ {{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }} - {{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }} + >{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }} + {{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }} {{ formatPriceAmount(formatPriceTotal(detail, 'priceC')) }} - {{ formatPriceAmount(formatPriceTotal(detail, 'priceC')) }} + >{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')) }} + {{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')) }}
@@ -876,26 +872,6 @@ {{ formatPriceAmount(formatLogisticsLogFee(scope.row, detail)) }} - - - - - - - - - - - - @@ -1124,7 +1080,7 @@ /> 0 && detail.logisticsFee != null) { + if (!hasFee && detail.logisticsFee != null) { const legacyFee = this.parseLogisticsFeeValue(detail.logisticsFee); if (legacyFee != null) return legacyFee; } @@ -1440,24 +1421,6 @@ export default { formatDetailLogisticsFee(detail) { return this.sumDetailLogisticsFee(detail); }, - formatLogSaleSettleStatus(log) { - if (!log || log.expressNo == null || String(log.expressNo).trim() === '') { - return null; - } - if (log.saleSettleStatus != null && log.saleSettleStatus !== '') { - return log.saleSettleStatus; - } - return '0'; - }, - formatLogPurchaseSettleStatus(log) { - if (!log || log.expressNo == null || String(log.expressNo).trim() === '') { - return null; - } - if (log.purchaseSettleStatus != null && log.purchaseSettleStatus !== '') { - return log.purchaseSettleStatus; - } - return '0'; - }, formatShipDate(time) { if (!time) { return '-'; @@ -1730,13 +1693,17 @@ export default { }, canViewLogistics(row) { if (!row || row.orderStatus == null) return false; - const status = Number(row.orderStatus); - return status === Number(this.ORDER_STATUS_SHIPPED) || status === 9; + const status = String(row.orderStatus); + return status === this.ORDER_STATUS_SHIPPED + || status === this.ORDER_STATUS_EXCHANGE_LOGISTICS + || status === this.ORDER_STATUS_COMPLETED + || status === this.ORDER_STATUS_EXCHANGE_COMPLETED; }, canCompleteOrder(row) { if (!row || row.orderStatus == null) return false; const status = String(row.orderStatus); - return status === this.ORDER_STATUS_SHIPPED || status === this.ORDER_STATUS_EXCHANGE_REJECTED; + return status === this.ORDER_STATUS_SHIPPED + || status === this.ORDER_STATUS_EXCHANGE_LOGISTICS; }, handleViewLogistics(row) { if (!row || !row.id) return; @@ -1864,28 +1831,13 @@ export default { if (!row || !row.id) { return; } - const isExchangeRejected = String(row.orderStatus) === this.ORDER_STATUS_EXCHANGE_REJECTED; - const confirmMsg = isExchangeRejected - ? `确认将拒绝换货申请订单"${row.orderNo}"标记为已完成吗?` - : `确认完成订单"${row.orderNo}"吗?`; - const requestFn = isExchangeRejected - ? () => completeExchangeRejectedOrder({ orderId: row.id }) - : () => completeOrder({ orderId: row.id }); - this.$modal.confirm(confirmMsg).then(() => { - return requestFn(); + this.$modal.confirm(`确认完成订单"${row.orderNo}"吗?`).then(() => { + return completeOrder({ orderId: row.id }); }).then(() => { this.$modal.msgSuccess('操作成功'); this.getList(); }).catch(() => {}); }, - handleBatchCompleteExchangeRejected() { - this.$modal.confirm('确认将所有拒绝换货申请状态的订单更新为已完成吗?').then(() => { - return completeAllExchangeRejectedOrder(); - }).then((res) => { - this.$modal.msgSuccess((res && res.msg) || '操作成功'); - this.getList(); - }).catch(() => {}); - }, handleAgreeExchange(row) { if (!row || !row.id) { return; diff --git a/back/src/main/java/com/ruoyi/web/util/ExpressQueryUtils.java b/back/src/main/java/com/ruoyi/web/util/ExpressQueryUtils.java index 6eee186..7452a6f 100644 --- a/back/src/main/java/com/ruoyi/web/util/ExpressQueryUtils.java +++ b/back/src/main/java/com/ruoyi/web/util/ExpressQueryUtils.java @@ -55,7 +55,7 @@ public class ExpressQueryUtils { HttpHeaders headers = new HttpHeaders(); headers.set("Authorization", "APPCODE " + appCode); - headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + headers.setContentType(MediaType.parseMediaType("application/x-www-form-urlencoded; charset=UTF-8")); MultiValueMap body = new LinkedMultiValueMap<>(); body.add("expressNo", expressNo); @@ -75,21 +75,46 @@ public class ExpressQueryUtils { return result; } catch (HttpStatusCodeException e) { int status = e.getRawStatusCode(); - log.error("调用阿里云物流查询失败 expressNo={} status={}", expressNo, status, e); + String caError = e.getResponseHeaders() != null + ? e.getResponseHeaders().getFirst("X-Ca-Error-Message") : null; + log.warn("调用阿里云物流查询失败 expressNo={} status={} caError={}", expressNo, status, caError); result.put("errorCode", "HTTP_" + status); - if (status == 403) { - result.put("errorMsg", "物流查询服务授权失效(HTTP 403),请在阿里云 API 市场续费快递查询接口并更新 express.ali.app-code"); - } else { + if (status == 403) + { + result.put("errorMsg", buildExpress403Message(caError)); + } + else + { String errorBody = e.getResponseBodyAsString(); result.put("errorMsg", StringUtils.isNotEmpty(errorBody) ? errorBody : ("物流查询请求失败,HTTP状态码:" + status)); } return result; - } catch (Exception e) { + } + catch (Exception e) + { log.error("调用阿里云物流查询失败 expressNo={}", expressNo, e); result.put("errorCode", "EXCEPTION"); result.put("errorMsg", e.getMessage()); return result; } } + + private String buildExpress403Message(String caError) + { + if (StringUtils.isEmpty(caError)) + { + return "物流查询未授权(HTTP 403):请在阿里云 API 市场购买「快递物流查询」接口," + + "并使用该商品对应的 AppCode 配置 express.ali.app-code(不能与实名认证等其它 API 混用)"; + } + if (caError.contains("Quota") || caError.contains("quota") || caError.contains("exhausted")) + { + return "物流查询套餐次数已用完(HTTP 403),请在阿里云 API 市场续费快递查询接口"; + } + if (caError.contains("Unauthorized") || caError.contains("Invalid AppCode") || caError.contains("not exists")) + { + return "物流查询 AppCode 无效或未订阅该 API(HTTP 403),请更新 express.ali.app-code 为快递查询商品的 AppCode"; + } + return "物流查询未授权(HTTP 403):" + caError; + } } diff --git a/developer-front/src/components/DictData/index.js b/developer-front/src/components/DictData/index.js index 7b85d4a..ece270b 100644 --- a/developer-front/src/components/DictData/index.js +++ b/developer-front/src/components/DictData/index.js @@ -3,21 +3,6 @@ import store from '@/store' import DataDict from '@/utils/dict' import { getDicts as getDicts } from '@/api/system/dict/data' -function searchDictByKey(dict, key) { - if (key == null && key == "") { - return null - } - try { - for (let i = 0; i < dict.length; i++) { - if (dict[i].key == key) { - return dict[i].value - } - } - } catch (e) { - return null - } -} - function install() { Vue.use(DataDict, { metas: { @@ -25,19 +10,14 @@ function install() { labelField: 'dictLabel', valueField: 'dictValue', request(dictMeta) { - const storeDict = searchDictByKey(store.getters.dict, dictMeta.type) - if (storeDict) { - return new Promise(resolve => { resolve(storeDict) }) - } else { - return new Promise((resolve, reject) => { - getDicts(dictMeta.type).then(res => { - store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data }) - resolve(res.data) - }).catch(error => { - reject(error) - }) + return new Promise((resolve, reject) => { + getDicts(dictMeta.type).then(res => { + store.dispatch('dict/setDict', { key: dictMeta.type, value: res.data }) + resolve(res.data) + }).catch(error => { + reject(error) }) - } + }) }, }, }, diff --git a/developer-front/src/components/DictTag/index.vue b/developer-front/src/components/DictTag/index.vue index 6b5b230..ef09acb 100644 --- a/developer-front/src/components/DictTag/index.vue +++ b/developer-front/src/components/DictTag/index.vue @@ -1,7 +1,7 @@