This commit is contained in:
zhangji committed 2025-09-19 14:52:06 +08:00
1 parent d199edb5ee
commit c430c5d890
5 files changed
+41 -37

No files matched your search

@@ -0,0 +1,4 @@
### 获得商品 SPU 明细
POST {{baseUrl}}/product/channel/channel-test?id=43
Authorization: Bearer {{token}}
tenant-id: {{adminTenantId}}
@@ -154,44 +154,44 @@ public class ChannelServiceImpl implements ChannelService {
ProductDeviceLogSaveReqVO deviceLog = new ProductDeviceLogSaveReqVO();
deviceLog.setDeviceId(channelDO.getDeviceId());
deviceLog.setCabinetChannel(channelDO.getCabinetChannel());
try {
// 发送请求并解析响应
ResponseEntity<DispenseResponseBo> response = restTemplate.exchange(
api_url,
HttpMethod.POST,
requestEntity,
DispenseResponseBo.class
);
// try {
// 发送请求并解析响应
ResponseEntity<DispenseResponseBo> 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
@@ -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();
@@ -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
@@ -3,8 +3,8 @@ spring:
name: yudao-server
profiles:
active: prod
# active: local
# active: prod
active: local
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。