@Test public void testListCollections() throws Exception { }
@Override public CommonResult listCollections(Integer caseId, Integer type){ JSONObject returnJson = new JSONObject(); JSONArray collectionArray = new JSONArray(); List<HashMap> collections = new ArrayList<>(); if (type == 1) collections = inspectionMapper.listCollectionInfo(caseId); else if(type == 2) collections = examinationMapper.listCollectionInfo(caseId); else if(type == 3) collections = treatmentMapper.listCollectionInfo(caseId); for(HashMap collection:collections) { JSONObject collectionJson = new JSONObject(); Long collectionIdLong = (Long)collection.get("collectionId"); Integer collectionId = new Integer(String.valueOf(collectionIdLong)); collectionJson.put("collectionId", collectionId); collectionJson.put("applicantRoleId", collection.get("applicantRoleId")); JSONArray projectArray = new JSONArray(); List<HashMap> projects = new ArrayList<>(); if (type == 1) projects = inspectionMapper.listProjectInfo(collectionId); else if(type == 2) projects = examinationMapper.listProjectInfo(collectionId); else if(type == 3) projects = treatmentMapper.listProjectInfo(collectionId); for(HashMap project:projects){ JSONObject projectJson = new JSONObject(); Integer projectId = (Integer)project.get("projectId"); projectJson.put("projectId",projectId ); projectJson.put("projectName", project.get("projectName")); projectJson.put("departmentId", project.get("departmentId")); projectJson.put("departmentName", project.get("departmentName")); projectJson.put("status", project.get("status")); projectJson.put("goal", project.get("goal")); projectJson.put("requirement", project.get("requirement")); JSONArray itemArray = new JSONArray(); if(type == 1 || type == 2) { projectJson.put("resultDescription", project.get("resultDescription")); projectJson.put("resultImage", project.get("resultImage")); projectJson.put("advice", project.get("advice")); List<HashMap> items = new ArrayList<>(); if (type == 1) items = inspectionMapper.listItems(collectionId, projectId); else if (type == 2) items = examinationMapper.listItems(collectionId, projectId); for (HashMap item : items) { JSONObject itemJson = new JSONObject(); itemJson.put("itemId", item.get("itemId")); itemJson.put("itemName", item.get("itemName")); itemJson.put("amount", item.get("amount")); itemArray.add(itemJson); } } projectJson.put("items", itemArray); projectArray.add(projectJson); } collectionJson.put("projects", projectArray); collectionArray.add(collectionJson); } returnJson.put("collections", collectionArray); return CommonResult.success(returnJson); }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult listCollections(Integer caseId, Integer type){ JSONObject returnJson = new JSONObject(); JSONArray collectionArray = new JSONArray(); List<HashMap> collections = new ArrayList<>(); if (type == 1) collections = inspectionMapper.listCollectionInfo(caseId); else if(type == 2) collections = examinationMapper.listCollectionInfo(caseId); else if(type == 3) collections = treatmentMapper.listCollectionInfo(caseId); for(HashMap collection:collections) { JSONObject collectionJson = new JSONObject(); Long collectionIdLong = (Long)collection.get("collectionId"); Integer collectionId = new Integer(String.valueOf(collectionIdLong)); collectionJson.put("collectionId", collectionId); collectionJson.put("applicantRoleId", collection.get("applicantRoleId")); JSONArray projectArray = new JSONArray(); List<HashMap> projects = new ArrayList<>(); if (type == 1) projects = inspectionMapper.listProjectInfo(collectionId); else if(type == 2) projects = examinationMapper.listProjectInfo(collectionId); else if(type == 3) projects = treatmentMapper.listProjectInfo(collectionId); for(HashMap project:projects){ JSONObject projectJson = new JSONObject(); Integer projectId = (Integer)project.get("projectId"); projectJson.put("projectId",projectId ); projectJson.put("projectName", project.get("projectName")); projectJson.put("departmentId", project.get("departmentId")); projectJson.put("departmentName", project.get("departmentName")); projectJson.put("status", project.get("status")); projectJson.put("goal", project.get("goal")); projectJson.put("requirement", project.get("requirement")); JSONArray itemArray = new JSONArray(); if(type == 1 || type == 2) { projectJson.put("resultDescription", project.get("resultDescription")); projectJson.put("resultImage", project.get("resultImage")); projectJson.put("advice", project.get("advice")); List<HashMap> items = new ArrayList<>(); if (type == 1) items = inspectionMapper.listItems(collectionId, projectId); else if (type == 2) items = examinationMapper.listItems(collectionId, projectId); for (HashMap item : items) { JSONObject itemJson = new JSONObject(); itemJson.put("itemId", item.get("itemId")); itemJson.put("itemName", item.get("itemName")); itemJson.put("amount", item.get("amount")); itemArray.add(itemJson); } } projectJson.put("items", itemArray); projectArray.add(projectJson); } collectionJson.put("projects", projectArray); collectionArray.add(collectionJson); } returnJson.put("collections", collectionArray); return CommonResult.success(returnJson); } }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult listCollections(Integer caseId, Integer type){ JSONObject returnJson = new JSONObject(); JSONArray collectionArray = new JSONArray(); List<HashMap> collections = new ArrayList<>(); if (type == 1) collections = inspectionMapper.listCollectionInfo(caseId); else if(type == 2) collections = examinationMapper.listCollectionInfo(caseId); else if(type == 3) collections = treatmentMapper.listCollectionInfo(caseId); for(HashMap collection:collections) { JSONObject collectionJson = new JSONObject(); Long collectionIdLong = (Long)collection.get("collectionId"); Integer collectionId = new Integer(String.valueOf(collectionIdLong)); collectionJson.put("collectionId", collectionId); collectionJson.put("applicantRoleId", collection.get("applicantRoleId")); JSONArray projectArray = new JSONArray(); List<HashMap> projects = new ArrayList<>(); if (type == 1) projects = inspectionMapper.listProjectInfo(collectionId); else if(type == 2) projects = examinationMapper.listProjectInfo(collectionId); else if(type == 3) projects = treatmentMapper.listProjectInfo(collectionId); for(HashMap project:projects){ JSONObject projectJson = new JSONObject(); Integer projectId = (Integer)project.get("projectId"); projectJson.put("projectId",projectId ); projectJson.put("projectName", project.get("projectName")); projectJson.put("departmentId", project.get("departmentId")); projectJson.put("departmentName", project.get("departmentName")); projectJson.put("status", project.get("status")); projectJson.put("goal", project.get("goal")); projectJson.put("requirement", project.get("requirement")); JSONArray itemArray = new JSONArray(); if(type == 1 || type == 2) { projectJson.put("resultDescription", project.get("resultDescription")); projectJson.put("resultImage", project.get("resultImage")); projectJson.put("advice", project.get("advice")); List<HashMap> items = new ArrayList<>(); if (type == 1) items = inspectionMapper.listItems(collectionId, projectId); else if (type == 2) items = examinationMapper.listItems(collectionId, projectId); for (HashMap item : items) { JSONObject itemJson = new JSONObject(); itemJson.put("itemId", item.get("itemId")); itemJson.put("itemName", item.get("itemName")); itemJson.put("amount", item.get("amount")); itemArray.add(itemJson); } } projectJson.put("items", itemArray); projectArray.add(projectJson); } collectionJson.put("projects", projectArray); collectionArray.add(collectionJson); } returnJson.put("collections", collectionArray); return CommonResult.success(returnJson); }  }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult listCollections(Integer caseId, Integer type){ JSONObject returnJson = new JSONObject(); JSONArray collectionArray = new JSONArray(); List<HashMap> collections = new ArrayList<>(); if (type == 1) collections = inspectionMapper.listCollectionInfo(caseId); else if(type == 2) collections = examinationMapper.listCollectionInfo(caseId); else if(type == 3) collections = treatmentMapper.listCollectionInfo(caseId); for(HashMap collection:collections) { JSONObject collectionJson = new JSONObject(); Long collectionIdLong = (Long)collection.get("collectionId"); Integer collectionId = new Integer(String.valueOf(collectionIdLong)); collectionJson.put("collectionId", collectionId); collectionJson.put("applicantRoleId", collection.get("applicantRoleId")); JSONArray projectArray = new JSONArray(); List<HashMap> projects = new ArrayList<>(); if (type == 1) projects = inspectionMapper.listProjectInfo(collectionId); else if(type == 2) projects = examinationMapper.listProjectInfo(collectionId); else if(type == 3) projects = treatmentMapper.listProjectInfo(collectionId); for(HashMap project:projects){ JSONObject projectJson = new JSONObject(); Integer projectId = (Integer)project.get("projectId"); projectJson.put("projectId",projectId ); projectJson.put("projectName", project.get("projectName")); projectJson.put("departmentId", project.get("departmentId")); projectJson.put("departmentName", project.get("departmentName")); projectJson.put("status", project.get("status")); projectJson.put("goal", project.get("goal")); projectJson.put("requirement", project.get("requirement")); JSONArray itemArray = new JSONArray(); if(type == 1 || type == 2) { projectJson.put("resultDescription", project.get("resultDescription")); projectJson.put("resultImage", project.get("resultImage")); projectJson.put("advice", project.get("advice")); List<HashMap> items = new ArrayList<>(); if (type == 1) items = inspectionMapper.listItems(collectionId, projectId); else if (type == 2) items = examinationMapper.listItems(collectionId, projectId); for (HashMap item : items) { JSONObject itemJson = new JSONObject(); itemJson.put("itemId", item.get("itemId")); itemJson.put("itemName", item.get("itemName")); itemJson.put("amount", item.get("amount")); itemArray.add(itemJson); } } projectJson.put("items", itemArray); projectArray.add(projectJson); } collectionJson.put("projects", projectArray); collectionArray.add(collectionJson); } returnJson.put("collections", collectionArray); return CommonResult.success(returnJson); }  @Override CommonResult listCollections(Integer caseId, Integer type); @Override CommonResult applyNewCollection(Integer collectionType); @Override CommonResult savePresentCollection(CollectionParam collectionParam); @Override CommonResult submitPresentCollection(CollectionParam collectionParam); CommonResult chooseByType(CollectionParam collectionParam, int operation); CommonResult saveInspection(CollectionParam collectionParam, int operation); CommonResult saveExamination(CollectionParam collectionParam, int operation); CommonResult saveTreatment(CollectionParam collectionParam, int operation); int insertInspectionProject(Integer collectionId, Integer projectId, ItemParam itemParam); int insertExaminationProject(Integer collectionId, Integer projectId, ItemParam itemParam); CommonResult insertTransactionLog(CollectionParam collectionParam, ProjectParam projectParam,
                                             ItemParam itemParam, Integer creatorRoleId); CommonResult cancelSubmittedCollection(Integer collectionId, Integer type); CommonResult deleteCollection(Integer collectionId, Integer type); CommonResult getProjectResult(ProjectParam projectParam); }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult listCollections(Integer caseId, Integer type){ JSONObject returnJson = new JSONObject(); JSONArray collectionArray = new JSONArray(); List<HashMap> collections = new ArrayList<>(); if (type == 1) collections = inspectionMapper.listCollectionInfo(caseId); else if(type == 2) collections = examinationMapper.listCollectionInfo(caseId); else if(type == 3) collections = treatmentMapper.listCollectionInfo(caseId); for(HashMap collection:collections) { JSONObject collectionJson = new JSONObject(); Long collectionIdLong = (Long)collection.get("collectionId"); Integer collectionId = new Integer(String.valueOf(collectionIdLong)); collectionJson.put("collectionId", collectionId); collectionJson.put("applicantRoleId", collection.get("applicantRoleId")); JSONArray projectArray = new JSONArray(); List<HashMap> projects = new ArrayList<>(); if (type == 1) projects = inspectionMapper.listProjectInfo(collectionId); else if(type == 2) projects = examinationMapper.listProjectInfo(collectionId); else if(type == 3) projects = treatmentMapper.listProjectInfo(collectionId); for(HashMap project:projects){ JSONObject projectJson = new JSONObject(); Integer projectId = (Integer)project.get("projectId"); projectJson.put("projectId",projectId ); projectJson.put("projectName", project.get("projectName")); projectJson.put("departmentId", project.get("departmentId")); projectJson.put("departmentName", project.get("departmentName")); projectJson.put("status", project.get("status")); projectJson.put("goal", project.get("goal")); projectJson.put("requirement", project.get("requirement")); JSONArray itemArray = new JSONArray(); if(type == 1 || type == 2) { projectJson.put("resultDescription", project.get("resultDescription")); projectJson.put("resultImage", project.get("resultImage")); projectJson.put("advice", project.get("advice")); List<HashMap> items = new ArrayList<>(); if (type == 1) items = inspectionMapper.listItems(collectionId, projectId); else if (type == 2) items = examinationMapper.listItems(collectionId, projectId); for (HashMap item : items) { JSONObject itemJson = new JSONObject(); itemJson.put("itemId", item.get("itemId")); itemJson.put("itemName", item.get("itemName")); itemJson.put("amount", item.get("amount")); itemArray.add(itemJson); } } projectJson.put("items", itemArray); projectArray.add(projectJson); } collectionJson.put("projects", projectArray); collectionArray.add(collectionJson); } returnJson.put("collections", collectionArray); return CommonResult.success(returnJson); }  @Override CommonResult listCollections(Integer caseId, Integer type); @Override CommonResult applyNewCollection(Integer collectionType); @Override CommonResult savePresentCollection(CollectionParam collectionParam); @Override CommonResult submitPresentCollection(CollectionParam collectionParam); CommonResult chooseByType(CollectionParam collectionParam, int operation); CommonResult saveInspection(CollectionParam collectionParam, int operation); CommonResult saveExamination(CollectionParam collectionParam, int operation); CommonResult saveTreatment(CollectionParam collectionParam, int operation); int insertInspectionProject(Integer collectionId, Integer projectId, ItemParam itemParam); int insertExaminationProject(Integer collectionId, Integer projectId, ItemParam itemParam); CommonResult insertTransactionLog(CollectionParam collectionParam, ProjectParam projectParam,
                                             ItemParam itemParam, Integer creatorRoleId); CommonResult cancelSubmittedCollection(Integer collectionId, Integer type); CommonResult deleteCollection(Integer collectionId, Integer type); CommonResult getProjectResult(ProjectParam projectParam);  }