### Question:
ProjectCollectionManagementServiceImpl implements ProjectCollectionManagementService { public CommonResult saveTreatment(CollectionParam collectionParam, int operation){ int count = 0; Integer creatorRoleId = collectionParam.getRoleId(); Integer caseId = collectionParam.getCaseId(); Integer collectionId = collectionParam.getCollectionId(); Integer applicantRoleId = collectionParam.getApplicantRoleId(); List<ProjectParam> projectParams = collectionParam.getProjects(); if(caseId == null || collectionId == null || applicantRoleId == null) return CommonResult.fail(ResultCode.E_801); if(projectParams.size() == 0){ treatmentMapper.deleteByCollectionId(collectionId); Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(0); treatment.setCaseId(caseId); treatment.setCreatorRoleId(applicantRoleId); count = treatmentMapper.insertSelective(treatment); if(count <= 0) return CommonResult.fail(ResultCode.E_802); return CommonResult.success(count); } List<Integer> existedProjectIds = treatmentMapper.listProjectIdsByCollectionId(collectionId); for(ProjectParam projectParam: projectParams) { Integer projectId = projectParam.getProjectId(); if(projectId == null) return CommonResult.fail(ResultCode.E_801); Treatment treatment = new Treatment(); treatment.setId(collectionId); treatment.setProjectId(projectId); treatment.setStatus(projectParam.getStatus()); if(existedProjectIds.contains(projectId)) { count = treatmentMapper.updateInfo(treatment); if (operation == 2) { CommonResult commonResult = insertTransactionLog(collectionParam, projectParam, null, creatorRoleId); if (commonResult.getCode() != 200) return CommonResult.fail(ResultCode.E_802); } existedProjectIds.remove(projectId); } else{ Integer departmentId = techProjectMapper.getDepartmentIdByProjectId(projectId); if (departmentId == null) return CommonResult.fail(ResultCode.E_800); treatment.setDepartmentId(departmentId); treatment.setCaseId(caseId); treatment.setCreatorRoleId(applicantRoleId); count = treatmentMapper.insertSelective(treatment); if (count <= 0) return CommonResult.fail(); if (operation == 2) { CommonResult commonResult = insertTransactionLog(collectionParam, projectParam, null, creatorRoleId); if (commonResult.getCode() != 200) return CommonResult.fail(ResultCode.E_802); } existedProjectIds.remove(projectId); } } for(Integer leftProjectId: existedProjectIds){ treatmentMapper.delete(collectionId, leftProjectId); } return CommonResult.success(count); }  @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);  }### Answer:
@Test public void testSaveTreatment() throws Exception { }