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/WhjlApi1211PR.java | 46 ++++++++++++++++++++-------------------------- 1 files changed, 20 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1211PR.java b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1211PR.java index 22e7470..5e38163 100644 --- a/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1211PR.java +++ b/src/main/java/com/fzzy/otherview/whhpjl/pr/WhjlApi1211PR.java @@ -18,7 +18,7 @@ import com.fzzy.api.view.repository.ApiInfoDataRep; import com.fzzy.otherview.whhpjl.WhjlConstant; import com.fzzy.otherview.whhpjl.dto.WhjlApi1211; -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; @@ -26,7 +26,6 @@ import org.springframework.data.domain.Sort; import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Component; - import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; @@ -113,8 +112,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 +125,23 @@ */ @DataResolver public void saveData(WhjlApi1211 data) { - ApiInfoData infoData = new ApiInfoData(); - infoData.setId(data.getBizId()); - infoData.setKqdm(data.getKqdm()); - infoData.setInteType(WhjlConstant.API_CATEGORY_12); - infoData.setInteId(WhjlConstant.API_CODE_1211); - infoData.setUpdateTime(new Date()); - infoData.setDataId(data.getBizId()); - infoData.setData(JSON.toJSONString(data)); - infoData.setCzbz(data.getCzbz()); - infoData.setRemarks("澶囨敞淇℃伅"); - + data.setZcmxList(JSON.toJSONString(data.getZcmx())); + ApiInfoData infoData; + List<ApiInfoData> apiInfoList = apiInfoDataRep.getDataByInteAndData(WhjlConstant.API_CODE_1211, 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_1211); + infoData.setUpdateTime(new Date()); + infoData.setDataId(data.getBizId()); + infoData.setData(JSON.toJSONString(data)); + infoData.setCzbz(Constant.CZBZ_I); + infoData.setRemarks("澶囨敞淇℃伅"); + } apiInfoDataRep.save(infoData); } @@ -154,17 +159,6 @@ return null; } - /** - * 鍒犻櫎鍚堝悓鍟嗗搧娓呭崟 - * whjlApi1211PR#delItem - * - * @param data - * @return - */ - @Expose - public String delItem(WhjlQDItem data) { - return null; - } /** * 涓婁紶 -- Gitblit v1.9.3