SERESServiceImpl.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. package com.uas.eis.serviceImpl;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONArray;
  4. import com.alibaba.fastjson.JSONObject;
  5. import com.alibaba.fastjson.serializer.PascalNameFilter;
  6. import com.uas.eis.core.TokenManager;
  7. import com.uas.eis.core.config.SeresConfig;
  8. import com.uas.eis.core.config.SpObserver;
  9. import com.uas.eis.dao.BaseDao;
  10. import com.uas.eis.dao.SqlRowList;
  11. import com.uas.eis.entity.InventoryQueryResponse;
  12. import com.uas.eis.entity.SeresStock;
  13. import com.uas.eis.entity.SeresStockDet;
  14. import com.uas.eis.service.SERESService;
  15. import com.uas.eis.utils.*;
  16. import org.apache.http.client.methods.CloseableHttpResponse;
  17. import org.apache.http.client.methods.HttpPost;
  18. import org.apache.http.entity.StringEntity;
  19. import org.apache.http.impl.client.CloseableHttpClient;
  20. import org.apache.http.impl.client.HttpClients;
  21. import org.apache.http.util.EntityUtils;
  22. import org.slf4j.Logger;
  23. import org.slf4j.LoggerFactory;
  24. import org.springframework.beans.factory.annotation.Autowired;
  25. import org.springframework.stereotype.Service;
  26. import java.io.IOException;
  27. import java.util.*;
  28. @Service
  29. public class SERESServiceImpl implements SERESService {
  30. @Autowired
  31. private SeresConfig seresConfig;
  32. @Autowired
  33. private BaseDao baseDao;
  34. private final Logger logger = LoggerFactory.getLogger(this.getClass());
  35. // Token最大有效期 60分钟 毫秒
  36. private static final long MAX_TOKEN_VALID_MS = 60L * 60 * 1000;
  37. // 提前1分钟刷新Token(毫秒)
  38. private static final long REFRESH_ADVANCE_MS = 60L * 1000;
  39. private static final String seresTokenKey = "SERES_TOKEN" ;
  40. static final String errLogSql="insert into Seres_Stock_Alert_errlog(ID_,CODE_,DATE_,MESSAGE_,DATA_)values(?,?,sysdate,?,?)";
  41. /**
  42. * 获取有效Token,自动判断是否刷新
  43. */
  44. public synchronized String getValidToken() throws IOException {
  45. String accessToken = TokenManager.getToken(seresTokenKey,REFRESH_ADVANCE_MS);
  46. long nowMs = System.currentTimeMillis();
  47. // 无token 或 距离过期不足1分钟,重新拉取
  48. if (accessToken == null ) {
  49. SqlRowList rs = baseDao.queryForRowSet("select access_token,EXP_ from (select * from AW_ZHJK.SERES_TOKEN_LOG where EXP_>"+(nowMs+REFRESH_ADVANCE_MS)+" order by EXP_ desc) where rownum=1");
  50. if(rs.next()){
  51. String token=rs.getString("access_token");
  52. int exp=rs.getInt("exp_");
  53. logger.info("从数据库获取上次有效token {}",token);
  54. accessToken=token.toString();
  55. TokenManager.setToken(seresTokenKey,accessToken,exp);
  56. }else{
  57. logger.info("token 为空重新获取");
  58. accessToken=refreshToken();
  59. }
  60. }
  61. return accessToken;
  62. }
  63. private String refreshToken() throws IOException {
  64. String accessToken ="";
  65. String tokenUrl = seresConfig.getUrl() + "/aito/DIS/COMM_GET_JWT_TOKEN/1.0.0";
  66. String clientId=seresConfig.getClientId();
  67. String clientSecret=seresConfig.getClientSecret();
  68. long nowMs = System.currentTimeMillis();
  69. long expTs = nowMs + MAX_TOKEN_VALID_MS;
  70. // 请求体
  71. JSONObject reqBody = new JSONObject();
  72. reqBody.put("grant_type", "client_credentials");
  73. reqBody.put("client_id", clientId);
  74. reqBody.put("client_secret", clientSecret);
  75. reqBody.put("exp", expTs);
  76. // 发送POST
  77. CloseableHttpClient httpClient = HttpClients.createDefault();
  78. HttpPost httpPost = new HttpPost(tokenUrl);
  79. httpPost.setHeader("Content-Type", "application/json");
  80. StringEntity entity = new StringEntity(reqBody.toString(), "UTF-8");
  81. httpPost.setEntity(entity);
  82. logger.info("reqBody {}", JSON.toJSONString(reqBody));
  83. try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
  84. String respJson = EntityUtils.toString(response.getEntity(), "UTF-8");
  85. JSONObject respObj = JSON.parseObject(respJson);
  86. logger.info("resp {}",respObj.toString());
  87. if (!respObj.containsKey("access_token")) {
  88. throw new RuntimeException("获取Token失败,响应:" + respJson);
  89. }
  90. accessToken = respObj.getString("access_token");
  91. if(accessToken!=null && !"null".equals(accessToken)){
  92. TokenManager.setToken(seresTokenKey,accessToken,expTs);
  93. logger.info("token {}",accessToken);
  94. baseDao.execute("insert into AW_ZHJK.SERES_TOKEN_LOG(access_token,exp_) VALUES('"+accessToken+"',"+expTs+")");
  95. System.out.println("Token刷新成功,有效期:" + respObj.get("expires_in") + "秒");
  96. }
  97. } finally {
  98. httpClient.close();
  99. }
  100. return accessToken;
  101. }
  102. private Map<String, Object> querySERESInv(String token,String param) throws IOException {
  103. logger.info("querySERESInv-token {}" + token);
  104. logger.info("querySERESInv-param {}" + param);
  105. Map<String, Object> modelMap = new HashMap<String, Object>();
  106. String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
  107. String fullUrl = seresConfig.getUrl() + apiPath;
  108. logger.info("fullUrl {}",fullUrl);
  109. logger.info("Authorization {}","Bearer " + token);
  110. CloseableHttpClient httpClient = HttpClients.createDefault();
  111. HttpPost httpPost = new HttpPost(fullUrl);
  112. // 鉴权头
  113. httpPost.setHeader("Authorization", "Bearer " + token);
  114. httpPost.setHeader("Content-Type", "application/json");
  115. httpPost.setHeader("SupplierCode", seresConfig.getClientCode());
  116. Map<Object, Object> paramMap = BaseUtil.parseFormStoreToMap(param);
  117. System.out.println(paramMap.get("page"));
  118. System.out.println(paramMap.get("pageSize"));
  119. System.out.println(paramMap.get("MaterialCode"));
  120. String materialCode=(StringUtil.hasText(paramMap.get("MaterialCode")))?paramMap.get("MaterialCode").toString():"";
  121. String factoryCode=(StringUtil.hasText(paramMap.get("FactoryCode")))?paramMap.get("FactoryCode").toString():"";
  122. int page= (StringUtil.hasText(paramMap.get("page")))?Integer.parseInt(paramMap.get("page").toString()):1;
  123. int pageSize= (StringUtil.hasText(paramMap.get("pageSize")))?Integer.parseInt(paramMap.get("pageSize").toString()):500;
  124. if(pageSize>500){
  125. pageSize=500;
  126. }
  127. JSONObject reqBody = new JSONObject();
  128. //供应商编码
  129. reqBody.put("SupplierCode", seresConfig.getClientCode());
  130. //工厂编码
  131. reqBody.put("FactoryCode",factoryCode);
  132. //物料编码
  133. reqBody.put("MaterialCode", materialCode);
  134. //页码
  135. reqBody.put("Skip", page);
  136. //分页大小
  137. reqBody.put("Take", pageSize);
  138. if (reqBody != null) {
  139. StringEntity entity = new StringEntity(JSON.toJSONString(reqBody), "UTF-8");
  140. httpPost.setEntity(entity);
  141. logger.info("reqBody {}", JSON.toJSONString(reqBody));
  142. }
  143. try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
  144. String result = EntityUtils.toString(response.getEntity(), "UTF-8");
  145. logger.info("result {}",result);
  146. if(StringUtil.hasText(result)){
  147. InventoryQueryResponse queryRes=FlexJsonUtil.fromJson(result, InventoryQueryResponse.class);
  148. if(queryRes.getCode().equals("0")){//成功
  149. modelMap.put("message",queryRes.getMessage());
  150. modelMap.put("count",queryRes.getData().getTotalCount());
  151. modelMap.put("data",queryRes.getData().getList());
  152. modelMap.put("success", true);
  153. }else{
  154. modelMap.put("message",queryRes.getMessage());
  155. }
  156. }
  157. } finally {
  158. httpClient.close();
  159. return modelMap;
  160. }
  161. }
  162. @Override
  163. public Map<String, Object> getStock( String param) throws IOException {
  164. logger.info("action : getStock");
  165. String token = getValidToken();
  166. Map<String, Object> modelMap = querySERESInv(token,param);
  167. return modelMap;
  168. }
  169. @Override
  170. public Map<String, Object> getERPStock(String param){
  171. Map<String, Object> modelMap = new HashMap<String, Object>();
  172. SpObserver.putSp("AW_ZHJK");
  173. List<SeresStock> data=new ArrayList();
  174. String con="";
  175. String MaterialCode_Q="";
  176. if(StringUtil.hasText(param)){
  177. Map<Object, Object> map = BaseUtil.parseFormStoreToMap(param);
  178. if(StringUtil.hasText(map.get("MaterialCode"))){
  179. MaterialCode_Q=map.get("MaterialCode").toString();
  180. }
  181. }
  182. if(StringUtil.hasText(MaterialCode_Q)){
  183. con="MaterialCode='"+MaterialCode_Q+"'";
  184. }else{
  185. con="1=1";
  186. }
  187. SqlRowList rs = baseDao.queryForRowSet("select MaterialCode,MaterialName from ZHJK_SERES_STOCK_VIEW where "+con+" group by MaterialCode,MaterialName order by MaterialCode");
  188. int n = 1;
  189. if(rs.size()>0){
  190. while (rs.next()){
  191. SeresStock seresStock=new SeresStock();
  192. seresStock.setSerialNumber(n);
  193. n++;
  194. seresStock.setSupplierCode(seresConfig.getClientCode());
  195. seresStock.setSupplierName(seresConfig.getClientName());
  196. seresStock.setMaterialCode(rs.getString("MaterialCode"));
  197. seresStock.setMaterialName(rs.getString("MaterialName"));
  198. String prcon="MaterialCode='"+rs.getString("MaterialCode")+"'";
  199. List<SeresStockDet> det=new ArrayList();
  200. SqlRowList rs_det = baseDao.queryForRowSet("select StockCode,StockName,StockAddress,FGQualifiedStock,FGNonQualifiedStock from ZHJK_SERES_STOCK_VIEW where "+prcon+" order by StockCode");
  201. while (rs_det.next()){
  202. SeresStockDet detInfo=new SeresStockDet();
  203. detInfo.setStockCode(rs_det.getString("StockCode"));
  204. detInfo.setStockName(rs_det.getString("StockName"));
  205. detInfo.setStockAddress(rs_det.getString("StockAddress"));
  206. detInfo.setFGQualifiedStock(rs_det.getGeneralDouble("FGQualifiedStock"));
  207. detInfo.setFGNonQualifiedStock(rs_det.getGeneralDouble("FGNonQualifiedStock"));
  208. det.add(detInfo);
  209. }
  210. seresStock.setStockList(det);
  211. data.add(seresStock);
  212. }
  213. //String resp=JSONArray.toJSONString(data);
  214. String resp=JSONArray.toJSONString(data, new PascalNameFilter());
  215. System.out.println(resp);
  216. modelMap.put("code",0);
  217. modelMap.put("message","成功");
  218. modelMap.put("data",data);
  219. } else if (StringUtil.hasText(MaterialCode_Q)) {
  220. //物料号不存在
  221. modelMap.put("code",1);
  222. modelMap.put("message","物料号不存在");
  223. modelMap.put("data",data);
  224. System.out.println("物料号不存在");
  225. }else{
  226. //未配置对照关系
  227. modelMap.put("code",1);
  228. modelMap.put("message","未配置对照关系");
  229. modelMap.put("data",data);
  230. System.out.println("未配置对照关系");
  231. }
  232. return modelMap;
  233. }
  234. @Override
  235. public String getToken() throws IOException {
  236. String token=getValidToken();
  237. logger.info("当前token {}",token);
  238. return token;
  239. }
  240. @Override
  241. public Map<String, Object> saveAlert(String data) {
  242. Map<String, Object> modelMap = new HashMap<String, Object>();
  243. List<Map<Object, Object>> dets = BaseUtil.parseGridStoreToMaps(data);
  244. Object id = baseDao.getSeqId("SERES_STOCK_ALERT_SEQ");
  245. String code = baseDao.sGetMaxNumber("Seres_Stock_Alert", 2);
  246. baseDao.execute("insert into SERES_STOCK_ALERT(Sta_id,sta_code,sta_recorddate) values("+id+",'"+code+"',sysdate)");
  247. for (Map<Object, Object> det : dets) {
  248. det.put("stad_id",baseDao.getSeqId("SERES_STOCK_ALERT_DET_SEQ"));
  249. det.put("stad_staid",id);
  250. }
  251. try{
  252. List<String> gridSql = SqlUtil.getInsertSqlbyGridStore(dets, "SERES_STOCK_ALERT_DET");
  253. baseDao.execute(gridSql);
  254. baseDao.execute("update Seres_Stock_Alert set sta_dockStatus='成功' where Sta_id="+id);
  255. modelMap.put("code",0);
  256. modelMap.put("message","接收成功");
  257. modelMap.put("data","");
  258. }catch (Exception e){
  259. Object errid = baseDao.getSeqId("SERES_ERRLOG_SEQ");
  260. baseDao.execute("update Seres_Stock_Alert set sta_dockStatus='失败' where Sta_id="+id);
  261. baseDao.execute(errLogSql,
  262. new Object[]{errid,code,e.getMessage(),data});
  263. modelMap.put("code",1);
  264. modelMap.put("message","接收失败");
  265. modelMap.put("data","");
  266. }
  267. return modelMap;
  268. }
  269. @Override
  270. public Map<String, Object> test(String token) throws Exception {
  271. logger.info("action :testGetStock");
  272. logger.info("token {}",token);
  273. Map<String, Object> modelMap = new HashMap<String, Object>();
  274. String apiPath="/aito/DIS/INV_STOCK_STS/1.0.0";
  275. String fullUrl = seresConfig.getUrl() + apiPath;
  276. logger.info("fullUrl {}",fullUrl);
  277. logger.info("Authorization {}","Bearer " + token);
  278. CloseableHttpClient httpClient = HttpClients.createDefault();
  279. HttpPost httpPost = new HttpPost(fullUrl);
  280. // 鉴权头
  281. httpPost.setHeader("Authorization", "Bearer " + token);
  282. httpPost.setHeader("Content-Type", "application/json");
  283. httpPost.setHeader("SupplierCode", seresConfig.getClientCode());
  284. logger.info("SupplierCode {}", seresConfig.getClientCode());
  285. JSONObject reqBody = new JSONObject();
  286. //供应商编码
  287. reqBody.put("SupplierCode", seresConfig.getClientCode());
  288. //工厂编码
  289. reqBody.put("FactoryCode", "");
  290. //物料编码
  291. reqBody.put("MaterialCode", "");
  292. //页码
  293. reqBody.put("Skip", 1);
  294. //分页大小
  295. reqBody.put("Take", 500);
  296. if (reqBody != null) {
  297. StringEntity entity = new StringEntity(JSON.toJSONString(reqBody), "UTF-8");
  298. httpPost.setEntity(entity);
  299. logger.info("reqBody {}", JSON.toJSONString(reqBody));
  300. }
  301. try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
  302. String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
  303. logger.info("test respStr {}", respStr);
  304. return JSON.parseObject(respStr);
  305. }catch (Exception e){
  306. logger.info("Exception {}",e.getMessage());
  307. e.printStackTrace();
  308. } finally {
  309. httpClient.close();
  310. return modelMap;
  311. }
  312. }
  313. @Override
  314. public void testToken(String token) throws IOException {
  315. logger.info("testToken token {}", token);
  316. String fullUrl = "https://dis-api-test.seres.cn/aito/public/API_zsgsw/1.0.0";
  317. logger.info("testToken fullUrl {}", fullUrl);
  318. logger.info("testToken Authorization {}", "Bearer " + token);
  319. CloseableHttpClient httpClient = HttpClients.createDefault();
  320. HttpPost httpPost = new HttpPost(fullUrl);
  321. // 鉴权头
  322. httpPost.setHeader("Authorization", "Bearer " + token);
  323. httpPost.setHeader("Content-Type", "application/json");
  324. try (CloseableHttpResponse response = httpClient.execute(httpPost)) {
  325. HttpUtil.Response r= HttpUtil.Response.getResponse(response);
  326. //String respStr = EntityUtils.toString(response.getEntity(), "UTF-8");
  327. logger.info("testToken resp-code {}", r.getStatusCode());
  328. logger.info("testToken ResponseText resp {}", r.getResponseText());
  329. } catch (Exception e) {
  330. logger.info("Exception {}",e.getMessage());
  331. e.printStackTrace();
  332. } finally {
  333. httpClient.close();
  334. }
  335. }
  336. @Override
  337. public Map<String, Object> testGetStock(String token,String param) throws Exception {
  338. Map<String, Object> modelMap = querySERESInv(token,param);
  339. return modelMap;
  340. }
  341. @Override
  342. public Map<String, Object> testGetStockData(String param) throws Exception {
  343. System.out.println(param);
  344. Map<Object, Object> paramMap = BaseUtil.parseFormStoreToMap(param);
  345. System.out.println(paramMap.get("page"));
  346. System.out.println(paramMap.get("pageSize"));
  347. System.out.println(paramMap.get("MaterialCode"));
  348. Map<String, Object> modelMap = new HashMap<String, Object>();
  349. String res="{\"code\":\"0\",\"message\":\"Success\",\"data\":{\"totalCount\":8,\"list\":[{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100108-RW01\",\"MaterialName\":\"空调滤芯\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":0,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":2792,\"POITransitStock\":0,\"AvailableStock\":0,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100290-RL02\",\"MaterialName\":\"UVC光触媒杀菌模块\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":1481,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":0,\"POITransitStock\":0,\"AvailableStock\":1481,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100108-RL03\",\"MaterialName\":\"空调滤芯\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":1634,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":0,\"POITransitStock\":0,\"AvailableStock\":1634,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公��\",\"MaterialCode\":\"8100290-RL01\",\"MaterialName\":\"UVC光触媒杀菌模块\",\"RDCLOCQualifiedStock\":500,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":0,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":1356,\"POITransitStock\":0,\"AvailableStock\":500,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100290-RW01\",\"MaterialName\":\"UVC光触媒杀菌模块\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":528,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":2811,\"POITransitStock\":0,\"AvailableStock\":528,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100108-RQ01\",\"MaterialName\":\"空调滤芯\",\"RDCLOCQualifiedStock\":3787,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":0,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":528,\"POITransitStock\":0,\"AvailableStock\":3787,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"1003\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100108-RV01\",\"MaterialName\":\"空调滤芯\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":767,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":0,\"POITransitStock\":0,\"AvailableStock\":767,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"},{\"SerialNumber\":1,\"FactoryCode\":\"2290\",\"SupplierCode\":\"0000002446\",\"SupplierName\":\"深圳市英唐智慧健康科技有限公司\",\"MaterialCode\":\"8100108-RV01\",\"MaterialName\":\"空调滤芯\",\"RDCLOCQualifiedStock\":0,\"InPlantQualifiedStock\":0,\"LineSideQualifiedStock\":0,\"InPlantNonQualifiedStock\":0,\"VMIQualifiedStock\":0,\"VMINonQualifiedStock\":0,\"PendingInspectionStock\":0,\"FrozenStock\":0,\"ContainerYardStock\":0,\"PRTransitStock\":0,\"POTransitStock\":4308,\"POITransitStock\":0,\"AvailableStock\":0,\"Attribute1\":\"\",\"Attribute2\":\"\",\"Attribute3\":\"\",\"Attribute4\":\"\",\"Attribute5\":\"\"}]}}";
  350. InventoryQueryResponse queryRes=FlexJsonUtil.fromJson(res, InventoryQueryResponse.class);
  351. System.out.println(queryRes.getCode());
  352. System.out.println(FlexJsonUtil.toJson(queryRes.getData().getList()));
  353. modelMap.put("message",queryRes.getMessage());
  354. modelMap.put("count",queryRes.getData().getTotalCount());
  355. modelMap.put("data",queryRes.getData().getList());
  356. return modelMap;
  357. }
  358. }