9 changed files with 238 additions and 24 deletions
-
90src/main/java/com/gaotao/modules/api/entity/SRes.java
-
53src/main/java/com/gaotao/modules/api/entity/SResT.java
-
43src/main/java/com/gaotao/modules/api/entity/WcsResponseStatusCodeEnum.java
-
6src/main/java/com/gaotao/modules/api/service/WcsApiService.java
-
18src/main/java/com/gaotao/modules/api/service/impl/WcsApiServiceImpl.java
-
10src/main/java/com/gaotao/modules/automatedWarehouse/entity/WmsTransportTask.java
-
2src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java
-
30src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsIntegrationServiceImpl.java
-
10src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml
@ -0,0 +1,90 @@ |
|||
package com.gaotao.modules.api.entity; |
|||
|
|||
public class SRes { |
|||
/** |
|||
* 返回状态码 |
|||
*/ |
|||
private WcsResponseStatusCodeEnum resCode; |
|||
|
|||
/** |
|||
* 返回描述信息 |
|||
*/ |
|||
private String resMsg; |
|||
|
|||
/** |
|||
* 备用字段 |
|||
*/ |
|||
private String memo1; |
|||
|
|||
/** |
|||
* 备用字段 |
|||
*/ |
|||
private String memo2; |
|||
|
|||
/** |
|||
* 备用字段 |
|||
*/ |
|||
private String memo3; |
|||
|
|||
// -------------------- 构造函数 -------------------- |
|||
|
|||
public SRes() {} |
|||
|
|||
public SRes(WcsResponseStatusCodeEnum resCode, String resMsg) { |
|||
this.resCode = resCode; |
|||
this.resMsg = resMsg; |
|||
} |
|||
|
|||
// -------------------- Getter & Setter -------------------- |
|||
|
|||
public WcsResponseStatusCodeEnum getResCode() { |
|||
return resCode; |
|||
} |
|||
|
|||
public void setResCode(WcsResponseStatusCodeEnum resCode) { |
|||
this.resCode = resCode; |
|||
} |
|||
|
|||
public String getResMsg() { |
|||
return resMsg; |
|||
} |
|||
|
|||
public void setResMsg(String resMsg) { |
|||
this.resMsg = resMsg; |
|||
} |
|||
|
|||
public String getMemo1() { |
|||
return memo1; |
|||
} |
|||
|
|||
public void setMemo1(String memo1) { |
|||
this.memo1 = memo1; |
|||
} |
|||
|
|||
public String getMemo2() { |
|||
return memo2; |
|||
} |
|||
|
|||
public void setMemo2(String memo2) { |
|||
this.memo2 = memo2; |
|||
} |
|||
|
|||
public String getMemo3() { |
|||
return memo3; |
|||
} |
|||
|
|||
public void setMemo3(String memo3) { |
|||
this.memo3 = memo3; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "SRes{" + |
|||
"resCode=" + resCode + |
|||
", resMsg='" + resMsg + '\'' + |
|||
", memo1='" + memo1 + '\'' + |
|||
", memo2='" + memo2 + '\'' + |
|||
", memo3='" + memo3 + '\'' + |
|||
'}'; |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.gaotao.modules.api.entity; |
|||
|
|||
import java.util.List; |
|||
|
|||
public class SResT<T> extends SRes{ |
|||
/** |
|||
* 数据实体 |
|||
*/ |
|||
private T resData; |
|||
|
|||
/** |
|||
* 数据实体列表 |
|||
*/ |
|||
private List<T> resDataList; |
|||
|
|||
// -------------------- 构造函数 -------------------- |
|||
|
|||
public SResT() {} |
|||
|
|||
public SResT(T resData) { |
|||
this.resData = resData; |
|||
} |
|||
|
|||
public SResT(List<T> resDataList) { |
|||
this.resDataList = resDataList; |
|||
} |
|||
|
|||
// -------------------- Getter & Setter -------------------- |
|||
|
|||
public T getResData() { |
|||
return resData; |
|||
} |
|||
|
|||
public void setResData(T resData) { |
|||
this.resData = resData; |
|||
} |
|||
|
|||
public List<T> getResDataList() { |
|||
return resDataList; |
|||
} |
|||
|
|||
public void setResDataList(List<T> resDataList) { |
|||
this.resDataList = resDataList; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "SResT{" + |
|||
"resData=" + resData + |
|||
", resDataList=" + resDataList + |
|||
"} " + super.toString(); |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package com.gaotao.modules.api.entity; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonValue; |
|||
|
|||
public enum WcsResponseStatusCodeEnum { |
|||
SUCCESS(200, "成功"), |
|||
FAIL(206, "失败"); |
|||
|
|||
private final int code; |
|||
private final String description; |
|||
|
|||
WcsResponseStatusCodeEnum(int code, String description) { |
|||
this.code = code; |
|||
this.description = description; |
|||
} |
|||
|
|||
@JsonValue // 序列化时输出 code |
|||
public int getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getDescription() { |
|||
return description; |
|||
} |
|||
|
|||
// 根据 code 获取枚举(可选) |
|||
public static WcsResponseStatusCodeEnum fromCode(int code) { |
|||
for (WcsResponseStatusCodeEnum status : WcsResponseStatusCodeEnum.values()) { |
|||
if (status.code == code) { |
|||
return status; |
|||
} |
|||
} |
|||
throw new IllegalArgumentException("Unknown status code: " + code); |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return "ResponseStatusCodeEnum{" + |
|||
"code=" + code + |
|||
", description='" + description + '\'' + |
|||
'}'; |
|||
} |
|||
} |
|||
@ -1,4 +1,10 @@ |
|||
package com.gaotao.modules.api.service; |
|||
|
|||
import com.gaotao.modules.automatedWarehouse.entity.WmsTransportTask; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface WcsApiService { |
|||
|
|||
void pushAgvTaskApi(List<WmsTransportTask> inList); |
|||
} |
|||
@ -1,11 +1,29 @@ |
|||
package com.gaotao.modules.api.service.impl; |
|||
|
|||
import com.gaotao.modules.api.service.WcsApiService; |
|||
import com.gaotao.modules.automatedWarehouse.entity.WmsTransportTask; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
public class WcsApiServiceImpl implements WcsApiService { |
|||
|
|||
@Override |
|||
public void pushAgvTaskApi(List<WmsTransportTask> inList){ |
|||
log.info("开始推送AGV任务"); |
|||
} |
|||
|
|||
|
|||
public void demo(){ |
|||
// 接收 JSON 响应:{ "resCode": 200, "resMsg": "成功", "resDataList": [ {...}, {...} ] } |
|||
// SResT<User> response = restTemplate.getForObject("/api/users", new ParameterizedTypeReference<SResT<User>>() {}); |
|||
// |
|||
// if (response.getResCode() == ResponseStatusCodeEnum.SUCCESS) { |
|||
// List<User> users = response.getResDataList(); |
|||
// // 处理数据 |
|||
// } |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue