Index: ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsManagerImpl.java =================================================================== diff -u -r22257 -r22261 --- ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsManagerImpl.java (.../ExpensiveGoodsManagerImpl.java) (revision 22257) +++ ssts-expensivegoods/src/main/java/com/forgon/disinfectsystem/expensiveGoods/service/ExpensiveGoodsManagerImpl.java (.../ExpensiveGoodsManagerImpl.java) (revision 22261) @@ -125,7 +125,7 @@ private RegistrationCertificationManager registrationCertificationManager; - private ExpensiveGoodsAuthorizationManager expensiveGoodsAuthorizationManagerTarget; +// private ExpensiveGoodsAuthorizationManager expensiveGoodsAuthorizationManagerTarget; private ExpensiveGoodsSupplierManager expensiveGoodsSupplierManager; @@ -171,10 +171,10 @@ this.dateQueryAdapter = dateQueryAdapter; } - public void setExpensiveGoodsAuthorizationManagerTarget( - ExpensiveGoodsAuthorizationManager expensiveGoodsAuthorizationManagerTarget) { - this.expensiveGoodsAuthorizationManagerTarget = expensiveGoodsAuthorizationManagerTarget; - } +// public void setExpensiveGoodsAuthorizationManagerTarget( +// ExpensiveGoodsAuthorizationManager expensiveGoodsAuthorizationManagerTarget) { +// this.expensiveGoodsAuthorizationManagerTarget = expensiveGoodsAuthorizationManagerTarget; +// } public void setExpensiveGoodsSupplierManager( ExpensiveGoodsSupplierManager expensiveGoodsSupplierManager) { @@ -2430,78 +2430,79 @@ @Override public JSONArray getSupplyChainInfo(String id,String supplierId) { - if(!DatabaseUtil.isPoIdValid(id) || !DatabaseUtil.isPoIdValid(supplierId)){ - return null; - } - JSONArray jsonArray = new JSONArray(); - List list = expensiveGoodsAuthorizationManagerTarget.getExpensiveGoodsAuthorizationsByExpensiveGoodsId(id); - if(list != null){ - JSONObject jsonObject = null; - Iterator it = null; - Map map = new HashMap(); - it = list.iterator(); - - //找到生产厂家,并把它的授权对象(只有一个)的id值与level值放入map中,供后面使用 - //同时生成要返回给前端的jsonOjbect - //把该授权记录从list中移除 - while(it.hasNext()){ - ExpensiveGoodsAuthorization expensiveGoodsAuthorization = it.next(); - if(supplierId.equals(expensiveGoodsAuthorization.getAuthorizerCompanyId().toString())){ - jsonObject = new JSONObject(); - jsonObject.put("supplierName",expensiveGoodsAuthorization.getAuthorizedCompanyName()); - jsonObject.put("authorizerCompany",expensiveGoodsAuthorization.getAuthorizerCompanyName()); - jsonObject.put("validityTime",expensiveGoodsAuthorization.getValidityTime().toString()); - jsonObject.put("level", 1); - map.put(expensiveGoodsAuthorization.getAuthorizedCompanyId(), 1); - ExpensiveGoodsSupplier expensiveGoodsSupplier = expensiveGoodsSupplierManager.getSupplierById(expensiveGoodsAuthorization.getAuthorizedCompanyId().toString()); - if(expensiveGoodsSupplier != null){ - jsonObject.put("businessCertificate",expensiveGoodsSupplier.getBusinessCertificate()); - jsonObject.put("businessValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); - jsonObject.put("businessLicense",expensiveGoodsSupplier.getBusinessLicense()); - jsonObject.put("licenseValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); - } - it.remove(); - jsonArray.add(jsonObject); - break; - } - } - if(map.isEmpty()){ //没有找到生产厂家 - return null; - } - - - while(!list.isEmpty()){ - int startLength = list.size(); - it = list.iterator(); - while(it.hasNext()){ - ExpensiveGoodsAuthorization expensiveGoodsAuthorization = it.next(); - Long key = expensiveGoodsAuthorization.getAuthorizerCompanyId(); - if(map.containsKey(key)){ //找到了自己的授权方 - jsonObject = new JSONObject(); - jsonObject.put("supplierName",expensiveGoodsAuthorization.getAuthorizedCompanyName()); - jsonObject.put("authorizerCompany",expensiveGoodsAuthorization.getAuthorizerCompanyName()); - jsonObject.put("validityTime",expensiveGoodsAuthorization.getValidityTime().toString()); - Integer value = map.get(key); - jsonObject.put("level", value+1); - map.put(expensiveGoodsAuthorization.getAuthorizedCompanyId(), value+1); - ExpensiveGoodsSupplier expensiveGoodsSupplier = expensiveGoodsSupplierManager.getSupplierById(expensiveGoodsAuthorization.getAuthorizedCompanyId().toString()); - if(expensiveGoodsSupplier != null){ - jsonObject.put("businessCertificate",expensiveGoodsSupplier.getBusinessCertificate()); - jsonObject.put("businessValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); - jsonObject.put("businessLicense",expensiveGoodsSupplier.getBusinessLicense()); - jsonObject.put("licenseValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); - } - it.remove(); - jsonArray.add(jsonObject); - } - } - int endLength = list.size(); - if(startLength == endLength){ - break; - } - } - } - return jsonArray; +// if(!DatabaseUtil.isPoIdValid(id) || !DatabaseUtil.isPoIdValid(supplierId)){ +// return null; +// } +// JSONArray jsonArray = new JSONArray(); +// List list = expensiveGoodsAuthorizationManagerTarget.getExpensiveGoodsAuthorizationsByExpensiveGoodsId(id); +// if(list != null){ +// JSONObject jsonObject = null; +// Iterator it = null; +// Map map = new HashMap(); +// it = list.iterator(); +// +// //找到生产厂家,并把它的授权对象(只有一个)的id值与level值放入map中,供后面使用 +// //同时生成要返回给前端的jsonOjbect +// //把该授权记录从list中移除 +// while(it.hasNext()){ +// ExpensiveGoodsAuthorization expensiveGoodsAuthorization = it.next(); +// if(supplierId.equals(expensiveGoodsAuthorization.getAuthorizerCompanyId().toString())){ +// jsonObject = new JSONObject(); +// jsonObject.put("supplierName",expensiveGoodsAuthorization.getAuthorizedCompanyName()); +// jsonObject.put("authorizerCompany",expensiveGoodsAuthorization.getAuthorizerCompanyName()); +// jsonObject.put("validityTime",expensiveGoodsAuthorization.getValidityTime().toString()); +// jsonObject.put("level", 1); +// map.put(expensiveGoodsAuthorization.getAuthorizedCompanyId(), 1); +// ExpensiveGoodsSupplier expensiveGoodsSupplier = expensiveGoodsSupplierManager.getSupplierById(expensiveGoodsAuthorization.getAuthorizedCompanyId().toString()); +// if(expensiveGoodsSupplier != null){ +// jsonObject.put("businessCertificate",expensiveGoodsSupplier.getBusinessCertificate()); +// jsonObject.put("businessValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); +// jsonObject.put("businessLicense",expensiveGoodsSupplier.getBusinessLicense()); +// jsonObject.put("licenseValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); +// } +// it.remove(); +// jsonArray.add(jsonObject); +// break; +// } +// } +// if(map.isEmpty()){ //没有找到生产厂家 +// return null; +// } +// +// +// while(!list.isEmpty()){ +// int startLength = list.size(); +// it = list.iterator(); +// while(it.hasNext()){ +// ExpensiveGoodsAuthorization expensiveGoodsAuthorization = it.next(); +// Long key = expensiveGoodsAuthorization.getAuthorizerCompanyId(); +// if(map.containsKey(key)){ //找到了自己的授权方 +// jsonObject = new JSONObject(); +// jsonObject.put("supplierName",expensiveGoodsAuthorization.getAuthorizedCompanyName()); +// jsonObject.put("authorizerCompany",expensiveGoodsAuthorization.getAuthorizerCompanyName()); +// jsonObject.put("validityTime",expensiveGoodsAuthorization.getValidityTime().toString()); +// Integer value = map.get(key); +// jsonObject.put("level", value+1); +// map.put(expensiveGoodsAuthorization.getAuthorizedCompanyId(), value+1); +// ExpensiveGoodsSupplier expensiveGoodsSupplier = expensiveGoodsSupplierManager.getSupplierById(expensiveGoodsAuthorization.getAuthorizedCompanyId().toString()); +// if(expensiveGoodsSupplier != null){ +// jsonObject.put("businessCertificate",expensiveGoodsSupplier.getBusinessCertificate()); +// jsonObject.put("businessValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); +// jsonObject.put("businessLicense",expensiveGoodsSupplier.getBusinessLicense()); +// jsonObject.put("licenseValidityTime",expensiveGoodsSupplier.getBusinessValidityTime().toString()); +// } +// it.remove(); +// jsonArray.add(jsonObject); +// } +// } +// int endLength = list.size(); +// if(startLength == endLength){ +// break; +// } +// } +// } +// return jsonArray; + return null; } }