package com.vincent.rsf.server.api.controller; import com.vincent.rsf.server.api.controller.erp.params.DapIlcwmsCompletionRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.Map; /** * 云仓模拟接口。platform.erp.base-url 指向本服务时,Feign 会请求下列 DAP 风格路径。 */ @Slf4j @RestController @Api(value = "云仓模拟接口", tags = "云仓模拟(无真实云仓URL时使用)") public class CloudWmsMockController { private static Map dapOkEnvelope() { Map profile = new HashMap<>(); profile.put("tenantSid", 1); profile.put("userSid", "SYS"); Map response = new HashMap<>(); response.put("code", -1); response.put("success", false); response.put("message", ""); Map map = new HashMap<>(); map.put("duration", 58); map.put("statusDescription", "OK"); map.put("response", response); map.put("profile", profile); map.put("uuid", ""); map.put("status", 200); return map; } private static Map successResponseLegacy() { Map data = new HashMap<>(); data.put("result", "SUCCESS"); Map map = new HashMap<>(); map.put("code", 200); map.put("msg", ""); map.put("data", data); return map; } @ApiOperation("鼎捷-入库完成反馈(模拟)") @PostMapping(value = "/dapilc/restful/service/ilcwmsplus/IKWebService/cusInventoryCompletionReport", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockInventoryCompletion(@RequestBody DapIlcwmsCompletionRequest body) { log.info("云仓模拟-入库完成反馈,行数={}", body != null && body.getData() != null ? body.getData().size() : 0); return dapOkEnvelope(); } @ApiOperation("鼎捷-出库完成反馈(模拟)") @PostMapping(value = "/dapilc/restful/service/ilcwmsplus/IKWebService/cusOutboundCompletionReport", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockOutboundCompletion(@RequestBody DapIlcwmsCompletionRequest body) { log.info("云仓模拟-出库完成反馈,行数={}", body != null && body.getData() != null ? body.getData().size() : 0); return dapOkEnvelope(); } /** 9.2 库存调整主动上报 - 模拟(路径不变,body 为 {data:[]}) */ @ApiOperation("库存调整上报(模拟)") @PostMapping(value = "/api/report/inventoryAdjust", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockInventoryAdjust(@RequestBody DapIlcwmsCompletionRequest body) { log.info("云仓模拟-库存调整上报,行数={}", body != null && body.getData() != null ? body.getData().size() : 0); return successResponseLegacy(); } /** 物料基础信息同步 - 模拟 */ @ApiOperation("物料同步(模拟)") @PostMapping(value = "/api/mat/sync", consumes = MediaType.APPLICATION_JSON_VALUE) public Map mockMatSync(@RequestBody Object body) { log.info("云仓模拟-物料同步,body={}", body != null ? body.toString() : null); return successResponseLegacy(); } // /** 9.1 入/出库结果上报 - 模拟(旧路径,已改 DAP) */ // @PostMapping(value = "/api/report/inOutResult", consumes = MediaType.APPLICATION_JSON_VALUE) // public Map mockInOutResult(@RequestBody InOutResultReportParam body) { // return successResponseLegacy(); // } }