private void supplementWbDeptMap(String wbSource) { logger.info("==补足 总账系统科室 与 科室类型 对照关系(" + wbDeptMapNeedAddMap.size() + "条)=="); // 取总账科室表 IBaseDAO deptDao = new DefaultBaseDAO(DepartmentObj.class); List<DepartmentObj> deptList = deptDao.searchByClause(DepartmentObj.class, null, null, 0, Integer.MAX_VALUE); Map<String, String> deptMap = new HashMap<String, String>(); for (int i = 0; i < deptList.size(); i++) { deptMap.put(deptList.get(i).getDepartment_name(), deptList.get(i).getDepartment_code()); } Object[] wbDeptMapNeedAdd = wbDeptMapNeedAddMap.values().toArray(); List<SourceDeptMapObj> sourceDeptMapList = new ArrayList<SourceDeptMapObj>(); for (int i = 0; i < wbDeptMapNeedAdd.length; i++) { GlAccvouchObj glav = (GlAccvouchObj) wbDeptMapNeedAdd[i]; SourceDeptMapObj o = new SourceDeptMapObj(); o.setSource_system(wbSource); o.setSource_dept_name(glav.getWbDeptName()); o.setDest_dept_code(deptMap.get(glav.getWbDeptName())); // 如果总账系统中有名字直接匹配的科室则直接填充对应的部门编号 if (getZzDeptId(wbSource, glav.getWbDeptName()) == null) { sourceDeptMapList.add(o); } // // if (o.getDest_dept_code() != null) // { // wbDeptMapNeedAddMap.remove(glav.getWbDeptName());// 自动补充了就删除 // } } sourceDeptMapDao.save(sourceDeptMapList); }
private void initWbDeptMap(String wbSource) { logger.info("==初始化 外部系统科室 与 总账系统科室 对照关系=="); wbDeptMap = new HashMap<String, String>(); List list = sourceDeptMapDao.searchByClause( SourceDeptMapObj.class, "source_system='" + wbSource + "'", null, 0, Integer.MAX_VALUE); for (int i = 0; i < list.size(); i++) { SourceDeptMapObj o = (SourceDeptMapObj) list.get(i); wbDeptMap.put(o.getSource_dept_name(), StringUtil.getNotEmptyStr(o.getDest_dept_code())); } }