diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/channel/ChannelController.http b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/channel/ChannelController.http new file mode 100644 index 0000000..78b66bc --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/channel/ChannelController.http @@ -0,0 +1,4 @@ +### 获得商品 SPU 明细 +POST {{baseUrl}}/product/channel/channel-test?id=43 +Authorization: Bearer {{token}} +tenant-id: {{adminTenantId}} \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/channel/ChannelServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/channel/ChannelServiceImpl.java index af49cee..290abab 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/channel/ChannelServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/channel/ChannelServiceImpl.java @@ -154,44 +154,44 @@ public class ChannelServiceImpl implements ChannelService { ProductDeviceLogSaveReqVO deviceLog = new ProductDeviceLogSaveReqVO(); deviceLog.setDeviceId(channelDO.getDeviceId()); deviceLog.setCabinetChannel(channelDO.getCabinetChannel()); - try { - // 发送请求并解析响应 - ResponseEntity response = restTemplate.exchange( - api_url, - HttpMethod.POST, - requestEntity, - DispenseResponseBo.class - ); +// try { + // 发送请求并解析响应 + ResponseEntity response = restTemplate.exchange( + api_url, + HttpMethod.POST, + requestEntity, + DispenseResponseBo.class + ); - DispenseResponseBo body = response.getBody(); - if (body != null) { - System.out.println("响应结果: " + body); - if (body.getCode() == 0) { - System.out.println("出货成功!详情: " + body.getData()); - deviceLog.setDeviceStatus(body.getCode()); - deviceLog.setContent("出货成功!详情: " + body.getData()); - productDeviceLogService.createDeviceLog(deviceLog); - return CommonResult.success("出货成功!详情: " + body.getData()); - } else { - System.out.println("操作失败!原因: " + body.getMsg()); - deviceLog.setDeviceStatus(body.getCode()); - deviceLog.setContent("操作失败!原因: " + body.getMsg()); - productDeviceLogService.createDeviceLog(deviceLog); - throw exception0(1_008_015_001, "操作失败!原因: " + body.getMsg()); - } - } else { - deviceLog.setDeviceStatus(501); - deviceLog.setContent("操作失败!原因: 请求出货响应为空"); + DispenseResponseBo body = response.getBody(); + if (body != null) { + System.out.println("响应结果: " + body); + if (body.getCode() == 0) { + System.out.println("出货成功!详情: " + body.getData()); + deviceLog.setDeviceStatus(body.getCode()); + deviceLog.setContent("出货成功!详情: " + body.getData()); productDeviceLogService.createDeviceLog(deviceLog); - throw exception(CHANNEL_ERROR); + return CommonResult.success("出货成功!详情: " + body.getData()); + } else { + System.out.println("出货失败!原因: " + body.getMsg()); + deviceLog.setDeviceStatus(body.getCode()); + deviceLog.setContent("出货失败!原因: " + body.getMsg()); + productDeviceLogService.createDeviceLog(deviceLog); + throw exception0(1_008_015_001, "出货失败!原因: " + body.getMsg()); } - } catch (Exception e) { + } else { + deviceLog.setDeviceStatus(501); + deviceLog.setContent("操作失败!原因: 请求出货响应为空"); + productDeviceLogService.createDeviceLog(deviceLog); + throw exception(CHANNEL_ERROR); + } + /*} catch (Exception e) { System.err.println("请求异常: " + e.getMessage()); deviceLog.setDeviceStatus(500); deviceLog.setContent("请求异常: " + e.getMessage()); productDeviceLogService.createDeviceLog(deviceLog); throw exception0(1_008_016_001, "请求异常: " + e.getMessage()); - } + }*/ } @Override diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeDeviceOrderHandler.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeDeviceOrderHandler.java index eedecbd..2380307 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeDeviceOrderHandler.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/handler/TradeDeviceOrderHandler.java @@ -188,11 +188,11 @@ public class TradeDeviceOrderHandler implements TradeOrderHandler { deviceLogSaveReqVO.setContent("出货成功!详情: "+body.getData()); deviceLogService.createDeviceLog(deviceLogSaveReqVO); } else { - System.out.println("操作失败!原因: " + body.getMsg()); + System.out.println("出货失败!原因: " + body.getMsg()); log.error("订单--{}:[出货失败]:原因: {}",order.getNo(), body.getMsg()); deviceLogSaveReqVO.setDeviceId(deviceId); deviceLogSaveReqVO.setDeviceStatus(body.getCode()); - deviceLogSaveReqVO.setContent("[出货失败]原因: "+body.getData()); + deviceLogSaveReqVO.setContent("[出货失败]原因: "+body.getMsg()); deviceLogService.createDeviceLog(deviceLogSaveReqVO); } } @@ -242,7 +242,7 @@ public class TradeDeviceOrderHandler implements TradeOrderHandler { String TOKEN = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhcHAxIiwiaWF0IjoxNzQ5MTMzNzE5LCJleHAiOjIwNjAxNzM3MTl9.u2VUKxPxE2H8xldabMVRYSJKf6LN-XZfbcfyj1T7czI"; // 创建请求对象 - DispenseRequestBo request = new DispenseRequestBo("869667070337387", "1,17&1,18&1"); + DispenseRequestBo request = new DispenseRequestBo("869667070337387", "1,1&1"); // 设置请求头 HttpHeaders headers = new HttpHeaders(); diff --git a/yudao-server/src/main/resources/application-prod.yaml b/yudao-server/src/main/resources/application-prod.yaml index b0ca3f4..1adb404 100644 --- a/yudao-server/src/main/resources/application-prod.yaml +++ b/yudao-server/src/main/resources/application-prod.yaml @@ -45,7 +45,7 @@ spring: primary: master datasource: master: - url: jdbc:mysql://192.168.0.7:37897/xr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 + url: jdbc:mysql://192.168.0.7:3306/xr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true&rewriteBatchedStatements=true # MySQL Connector/J 8.X 连接的示例 # url: jdbc:mysql://127.0.0.1:3306/ruoyi-vue-pro?useSSL=true&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true # MySQL Connector/J 5.X 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/ruoyi-vue-pro # PostgreSQL 连接的示例 # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 @@ -63,7 +63,7 @@ spring: # password: Yudao@2024 # OpenGauss 连接的示例 slave: # 模拟从库,可根据自己需要修改 lazy: true # 开启懒加载,保证启动速度 - url: jdbc:mysql://192.168.0.7:37897/xr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://192.168.0.7:3306/xr?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&rewriteBatchedStatements=true&nullCatalogMeansCurrent=true username: xr password: zd5ecNxeXHZxkWs8 diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 1255000..d57608b 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -3,8 +3,8 @@ spring: name: yudao-server profiles: - active: prod -# active: local +# active: prod + active: local main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。