@Test public void testApplyNewCollection() throws Exception { }
@Override public CommonResult applyNewCollection(Integer collectionType){ JSONObject returnJson = new JSONObject(); if(collectionType == null) return CommonResult.fail(ResultCode.E_801); int count; Integer collectionId; if (collectionType == 1) { collectionId = inspectionMapper.getLatestId(); if (collectionId == null) collectionId = 20000000; collectionId = collectionId + 1; Inspection inspection = new Inspection(); inspection.setId(collectionId); inspection.setProjectId(0); count = inspectionMapper.insertSelective(inspection); } else if (collectionType == 2) { collectionId = examinationMapper.getLatestId(); if (collectionId == null) collectionId = 30000000; collectionId = collectionId + 1; Examination examination = new Examination(); examination.setId(collectionId); examination.setProjectId(0); count = examinationMapper.insertSelective(examination); } else if(collectionType == 3){ collectionId = treatmentMapper.getLatestId(); if (collectionId == null) collectionId = 40000000; collectionId = collectionId + 1; Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); count = treatmentMapper.insertSelective(treatment); } else return CommonResult.fail(ResultCode.E_801); if(count <= 0) return CommonResult.fail(ResultCode.E_802); returnJson.put("collectionId", collectionId); return CommonResult.success(returnJson); }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult applyNewCollection(Integer collectionType){ JSONObject returnJson = new JSONObject(); if(collectionType == null) return CommonResult.fail(ResultCode.E_801); int count; Integer collectionId; if (collectionType == 1) { collectionId = inspectionMapper.getLatestId(); if (collectionId == null) collectionId = 20000000; collectionId = collectionId + 1; Inspection inspection = new Inspection(); inspection.setId(collectionId); inspection.setProjectId(0); count = inspectionMapper.insertSelective(inspection); } else if (collectionType == 2) { collectionId = examinationMapper.getLatestId(); if (collectionId == null) collectionId = 30000000; collectionId = collectionId + 1; Examination examination = new Examination(); examination.setId(collectionId); examination.setProjectId(0); count = examinationMapper.insertSelective(examination); } else if(collectionType == 3){ collectionId = treatmentMapper.getLatestId(); if (collectionId == null) collectionId = 40000000; collectionId = collectionId + 1; Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); count = treatmentMapper.insertSelective(treatment); } else return CommonResult.fail(ResultCode.E_801); if(count <= 0) return CommonResult.fail(ResultCode.E_802); returnJson.put("collectionId", collectionId); return CommonResult.success(returnJson); } }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult applyNewCollection(Integer collectionType){ JSONObject returnJson = new JSONObject(); if(collectionType == null) return CommonResult.fail(ResultCode.E_801); int count; Integer collectionId; if (collectionType == 1) { collectionId = inspectionMapper.getLatestId(); if (collectionId == null) collectionId = 20000000; collectionId = collectionId + 1; Inspection inspection = new Inspection(); inspection.setId(collectionId); inspection.setProjectId(0); count = inspectionMapper.insertSelective(inspection); } else if (collectionType == 2) { collectionId = examinationMapper.getLatestId(); if (collectionId == null) collectionId = 30000000; collectionId = collectionId + 1; Examination examination = new Examination(); examination.setId(collectionId); examination.setProjectId(0); count = examinationMapper.insertSelective(examination); } else if(collectionType == 3){ collectionId = treatmentMapper.getLatestId(); if (collectionId == null) collectionId = 40000000; collectionId = collectionId + 1; Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); count = treatmentMapper.insertSelective(treatment); } else return CommonResult.fail(ResultCode.E_801); if(count <= 0) return CommonResult.fail(ResultCode.E_802); returnJson.put("collectionId", collectionId); return CommonResult.success(returnJson); }  }
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { @Override public CommonResult applyNewCollection(Integer collectionType){ JSONObject returnJson = new JSONObject(); if(collectionType == null) return CommonResult.fail(ResultCode.E_801); int count; Integer collectionId; if (collectionType == 1) { collectionId = inspectionMapper.getLatestId(); if (collectionId == null) collectionId = 20000000; collectionId = collectionId + 1; Inspection inspection = new Inspection(); inspection.setId(collectionId); inspection.setProjectId(0); count = inspectionMapper.insertSelective(inspection); } else if (collectionType == 2) { collectionId = examinationMapper.getLatestId(); if (collectionId == null) collectionId = 30000000; collectionId = collectionId + 1; Examination examination = new Examination(); examination.setId(collectionId); examination.setProjectId(0); count = examinationMapper.insertSelective(examination); } else if(collectionType == 3){ collectionId = treatmentMapper.getLatestId(); if (collectionId == null) collectionId = 40000000; collectionId = collectionId + 1; Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); count = treatmentMapper.insertSelective(treatment); } else return CommonResult.fail(ResultCode.E_801); if(count <= 0) return CommonResult.fail(ResultCode.E_802); returnJson.put("collectionId", collectionId); 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 applyNewCollection(Integer collectionType){ JSONObject returnJson = new JSONObject(); if(collectionType == null) return CommonResult.fail(ResultCode.E_801); int count; Integer collectionId; if (collectionType == 1) { collectionId = inspectionMapper.getLatestId(); if (collectionId == null) collectionId = 20000000; collectionId = collectionId + 1; Inspection inspection = new Inspection(); inspection.setId(collectionId); inspection.setProjectId(0); count = inspectionMapper.insertSelective(inspection); } else if (collectionType == 2) { collectionId = examinationMapper.getLatestId(); if (collectionId == null) collectionId = 30000000; collectionId = collectionId + 1; Examination examination = new Examination(); examination.setId(collectionId); examination.setProjectId(0); count = examinationMapper.insertSelective(examination); } else if(collectionType == 3){ collectionId = treatmentMapper.getLatestId(); if (collectionId == null) collectionId = 40000000; collectionId = collectionId + 1; Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); count = treatmentMapper.insertSelective(treatment); } else return CommonResult.fail(ResultCode.E_801); if(count <= 0) return CommonResult.fail(ResultCode.E_802); returnJson.put("collectionId", collectionId); 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);  }