SERESServiceImpl.java 22 KB

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