From 954480166aad6d24c9e9889906a0edf762f0da2a Mon Sep 17 00:00:00 2001 From: czt <czt18638530771@163.com> Date: 星期一, 10 二月 2025 16:32:56 +0800 Subject: [PATCH] 优化库存同步 --- src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1213PR.java | 32 +++++++++++++++++++------------- 1 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1213PR.java b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1213PR.java index 2375ed8..3517c37 100644 --- a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1213PR.java +++ b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1213PR.java @@ -19,6 +19,7 @@ import com.fzzy.otherview.whhpjl.WhjlConstant; import com.fzzy.otherview.whhpjl.dto.WhjlApi1213; import com.fzzy.otherview.whhpjl.dto.WhjlQDItem; +import com.fzzy.otherview.whhpjl.dto.WhjlZCMX; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; @@ -113,8 +114,8 @@ * @return */ @DataProvider - public List<WhjlQDItem> listItem(String id) { - return null; + public List<WhjlZCMX> listItem(String code) { + return JSON.parseArray(code, WhjlZCMX.class); } /** @@ -126,17 +127,22 @@ */ @DataResolver public void saveData(WhjlApi1213 data) { - ApiInfoData infoData = new ApiInfoData(); - infoData.setId(data.getBizId()); - infoData.setKqdm(data.getKqdm()); - infoData.setInteType(WhjlConstant.API_CATEGORY_12); - infoData.setInteId(WhjlConstant.API_CODE_1213); - infoData.setUpdateTime(new Date()); - infoData.setDataId(data.getBizId()); - infoData.setData(JSON.toJSONString(data)); - infoData.setCzbz(data.getCzbz()); - infoData.setRemarks("澶囨敞淇℃伅"); - + ApiInfoData infoData; + List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(WhjlConstant.API_CODE_1213, data.getBizId(), data.getKqdm()); + if (apiInfoList.size() != 0) { + infoData = apiInfoList.get(0); + infoData.setData(JSON.toJSONString(data)); + } else { + infoData = new ApiInfoData(); + infoData.setId(data.getBizId()); + infoData.setKqdm(data.getKqdm()); + infoData.setInteId(WhjlConstant.API_CODE_1213); + infoData.setUpdateTime(new Date()); + infoData.setDataId(data.getBizId()); + infoData.setData(JSON.toJSONString(data)); + infoData.setCzbz(Constant.CZBZ_I); + infoData.setRemarks("澶囨敞淇℃伅"); + } apiInfoDataRep.save(infoData); } -- Gitblit v1.9.3