package com.smart.business.common;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import com.smart.common.business.BaseBusiness;
import com.smart.common.constant.ConfigConstants;
import com.smart.common.proxy.Carrier;
import com.smart.dao.common.DropDownListDAO;
import com.smart.dao.factory.FactoryDAO;
import com.smart.entity.chapter.SmartCourse;
import com.smart.entity.chapter.SmartKnowledgePoint;
import com.smart.entity.chapter.SmartSection;
import com.smart.entity.common.Code;
import com.smart.entity.common.SmartCity;
import com.smart.entity.common.SmartCounty;
import com.smart.entity.common.SmartProvince;
import com.smart.entity.module.Module;
import com.smart.entity.paper.SmartExamType;
import com.smart.entity.resource.SmartSource;
import com.smart.entity.resource.SmartBookPublishingCompany;
import com.smart.entity.units.SmartClass;
import com.smart.entity.units.SmartRealGrade;
import com.smart.entity.units.SmartSchool;
public class DropDownListBusiness extends BaseBusiness {
public Map processCourseSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao()).getCourseSelection();
Map map = new HashMap();
SmartCourse course = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
course = (SmartCourse) iterator.next();
map.put(course.getCourseNo(), course.getCourseName());
}
}
map.put("--", "--");
return map;
}
public Map processSchoolSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao()).getSchoolSelection();
Map map = new HashMap();
SmartSchool enity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
enity = (SmartSchool) iterator.next();
map.put(enity.getSchoolNo(), enity.getSchoolName());
}
}
map.put("--", "--");
return map;
}
public Map processGradeSelection(Carrier vop) {
Map data = vop.getData();
String parent = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
List list = ((DropDownListDAO) this.getDao()).getGradeSelection(parent);
Map map = new HashMap();
SmartRealGrade entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartRealGrade) iterator.next();
map.put(entity.getGradeNo(), entity.getGradeName());
}
}
map.put("--", "--");
return map;
}
public Map processRefreshGradeSelection(Carrier vop) {
Map data = vop.getData();
String parent = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
List list = ((DropDownListDAO) this.getDao()).getGradeSelection(parent);
Map map = new HashMap();
SmartRealGrade entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartRealGrade) iterator.next();
map.put(entity.getGradeName(), entity.getGradeNo());
}
}
map.put("--", "--");
return map;
}
public Map processGradeAllSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao()).getGradeAllSelection();
Map map = new HashMap();
SmartRealGrade grade = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
grade = (SmartRealGrade) iterator.next();
map.put(grade.getGradeId(), grade.getGradeName());
}
}
map.put("--", "--请选择年级--");
return map;
}
public Map processCourseSelectionBy(Carrier vop) {
Map data = vop.getData();
String parent = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
if (parent.equals(""))
return null;
String gradeId = parent;
List list = ((DropDownListDAO) this.getDao())
.getCourseSelectionBy(gradeId);
Map map = new HashMap();
SmartCourse entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartCourse) iterator.next();
map.put(entity.getCourseName(), entity.getCourseNo());
}
}
map.put("--", "--");
return map;
}
public Map processBookSelectionBy(Carrier vop) {
Map data = vop.getData();
String courseNo = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
if (courseNo.equals(""))
return null;
List list = ((DropDownListDAO) this.getDao())
.getBookSelectionBy(courseNo);
Map map = new HashMap();
SmartBookPublishingCompany entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartBookPublishingCompany) iterator.next();
map.put(entity.getBookName() + "(" + entity.getCompanyName()
+ ")", entity.getBookNo());
}
return map;
}
return null;
}
public Map processKnowledgeSelectionBy(Carrier vop) {
Map data = vop.getData();
String sectionNo = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
if (sectionNo.equals("")) {
Map map1 = new HashMap();
map1.put("--", "--");
return map1;
}
List list = ((DropDownListDAO) this.getDao())
.getKnowledgeSelectionBy(sectionNo);
Map map = new HashMap();
SmartKnowledgePoint entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartKnowledgePoint) iterator.next();
map.put(entity.getKnowledgeName(), entity.getKnowledgeNo());
}
return map;
}
return null;
}
public Map processDiffcultyTypeSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao())
.getDiffcultyTypeSelection();
Map map = new HashMap();
Code code = null;
if (list != null && list.size() > 0) {
map.put("", "--");
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
code = (Code) iterator.next();
map.put(code.getCodeNo(), code.getCodeValue());
}
return map;
}
return null;
}
public Map processProblemSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao()).getProblemSelection();
Map map = new HashMap();
Code code = null;
if (list != null && list.size() > 0) {
map.put("", "--");
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
code = (Code) iterator.next();
map.put(code.getCodeNo(), code.getCodeName());
}
return map;
}
return null;
}
public Map processSectionSelectionBy(Carrier vop) {
Map data = vop.getData();
String courseNo = data.get("parent") == null ? "" : (String) data.get(
"parent").toString().trim();
List list = ((DropDownListDAO) this.getDao())
.getSectionSelectionBy(courseNo);
Map map = new HashMap();
SmartSection entity = null;
if (list != null && list.size() > 0) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
entity = (SmartSection) iterator.next();
map.put(entity.getSectionName(), entity.getSectionNo()
.toString());
}
return map;
}
return null;
}
public Map processSourceSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao()).getSourceSelection();
Map map = new HashMap();
SmartSource source = null;
if (list != null && list.size() > 0) {
map.put("--", "--请选择试题来源--");
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
source = (SmartSource) iterator.next();
map.put(source.getSourceNo(), source.getSourceName());
}
return map;
}
return null;
}
public Map processGetPaperTypeListSelection(Carrier vop) {
List list = ((DropDownListDAO) this.getDao())
.getPaperTypeListSelection();