Browse Source

Primary Change

jason.lu 5 years ago
parent
commit
063aabd5e8
3 changed files with 225 additions and 12 deletions
  1. 174 10
      blog/models.py
  2. 1 0
      blog/views.py
  3. 50 2
      simplegen.py

+ 174 - 10
blog/models.py

@@ -11,19 +11,183 @@ class Article(models.Model):
 		return self.title
 
 class Kecheng(object):
+	pass
 
+class StudyPlan(models.Model):
+	wid = models.TextField(u'WID', max_length=100)  ### String
+	pyfamc = models.TextField(u'培养方案名称', max_length=500)  ### String
+	njdm = models.TextField(u'年级', max_length=100)  ### String
+	dwdm = models.TextField(u'院系', max_length=100)  ### String
+	zydm = models.TextField(u'专业', max_length=100)  ### String
+	zyfxdm = models.TextField(u'专业方向', max_length=100)  ### String
+	xdlxdm = models.TextField(u'修读类型', max_length=100)  ### String
+	xqlxdm = models.TextField(u'学期类型', max_length=100)  ### String
+	xznx = models.IntegerField(u'学制')  ### int
+	xwdm = models.TextField(u'学位', max_length=100)  ### String
+	ksxndm = models.TextField(u'开始学年', max_length=100)  ### String
+	ksxqdm = models.TextField(u'开始学期', max_length=100)  ### String
+	zsyqxf = models.FloatField(u'最少要求学分')  ### double
+	pymb = models.TextField(u'培养目标', max_length=4096)  ### String
+	xdyq = models.TextField(u'培养要求', max_length=4096)  ### String
+	fats = models.TextField(u'核心知识领域', max_length=2048)  ### String
+	zgxk = models.TextField(u'主干学科', max_length=500)  ### String
+	zyzysy = models.TextField(u'主要专业实验', max_length=100)  ### String
+	zgkc = models.TextField(u'核心课程', max_length=2048)  ### String
+	pyfadm = models.TextField(u'PYFADM', max_length=100)  ### String
+	shr = models.TextField(u'SHR', max_length=100)  ### String
+	shyj = models.TextField(u'SHYJ', max_length=100)  ### String
+	xlccdm = models.TextField(u'XLCCDM', max_length=100)  ### String
+	czr = models.TextField(u'CZR', max_length=100)  ### String
+	bz = models.TextField(u'BZ', max_length=100)  ### String
+	faccdm = models.TextField(u'FACCDM', max_length=100)  ### String
+	czsj = models.DateTimeField(u'CZSJ')  ### Timestamp
+	czip = models.TextField(u'CZIP', max_length=100)  ### String
+	kzzd4 = models.TextField(u'KZZD4', max_length=100)  ### String
+	kzzd3 = models.TextField(u'KZZD3', max_length=100)  ### String
+	kzzd2 = models.TextField(u'KZZD2', max_length=100)  ### String
+	kzzd1 = models.TextField(u'KZZD1', max_length=100)  ### String
+	kzzd5 = models.TextField(u'KZZD5', max_length=100)  ### String
+	mbdm = models.TextField(u'MBDM', max_length=100)  ### String
+	shsj = models.DateTimeField(u'SHSJ')  ### Timestamp
+	sffb = models.FloatField(u'SFFB')  ### double
+	shrxm = models.TextField(u'SHRXM', max_length=100)  ### String
+	ship = models.TextField(u'SHIP', max_length=100)  ### String
+	czrxm = models.TextField(u'CZRXM', max_length=100)  ### String
+	faztdm = models.TextField(u'FAZTDM', max_length=100)  ### String
+	sldm = models.TextField(u'SLDM', max_length=100)  ### String
 
+	njdm_display = models.TextField(u'年级代码V', max_length=100)
+	ksxqdm_display = models.TextField(u'开始学期V', max_length=100)
+	ksxndm_display = models.TextField(u'开始学年V', max_length=100)
+	zyfxdm_display = models.TextField(u'专业方向代码V', max_length=100)
+	zydm_display = models.TextField(u'专业代码V', max_length=100)
+	xqlxdm_display = models.TextField(u'学期类型代码V', max_length=100)
+	xdlxdm_display = models.TextField(u'修读类型代码V', max_length=100)
+	xwdm_display = models.TextField(u'学位V', max_length=100)
+	dwdm_display = models.TextField(u'院系代码V', max_length=100)
 
-class StudyPlan(models.Model):
-	start_year = models.IntegerField(u'入学年份', max_length = 256)
-	academy = models.CharField(u'学院', max_length=100)
-	major = models.CharField(u'学院', max_length=150)
-	plan_name = models.TextField('方案名称', max_length=1024)
-	plan_school_id = models.CharField('方案学校ID', max_length=150)
-
-	xdxq = models.CharField(u'', max_length=100)
-	PYFADM = models.CharField(u'培养方案代码', max_length=150)
-	sfzgkc_display = models.CharField(u'sfzgkc', max_length=150)
+class PlanNode(models.Model):
+	wid = models.TextField(u'WID')
+	kch = models.TextField(u'课程号')
+	xdxq = models.TextField(u'修读学期')
+	pyfadm = models.TextField(u'培养方案代码')
+	sfzgkc_display = models.TextField(u'学分核心课程V')
+	xdxnxq = models.TextField(u'XDXNXQ')
+	xs = models.TextField(u'学时')
+	kcxzdm_display = models.TextField(u'课程性质代码V', "")
+	xnxq_display = models.TextField(u'XNXQ_DISPLAY')
+	kslxdm = models.TextField(u'KSLXDM')
+	jhxqdm = models.TextField(u'JHXQDM')
+	kzh = models.TextField(u'课组号')
+	tykcbs = models.TextField(u'TYKCBS')
+	bz = models.TextField(u'BZ')
+	xxkc = models.TextField(u'XXKC')
+	xnxq = models.TextField(u'XNXQ')
+	sfzgkc = models.TextField(u'SFZGKC')
+	xf = models.TextField(u'XF')
+	kslxdm_display = models.TextField(u'KSLXDM_DISPLAY')
+	jhxndm = models.TextField(u'JHXNDM')
+	cxxq = models.TextField(u'CXXQ')
+	kcm = models.TextField(u'KCM')
+	kcxzdm = models.TextField(u'KCXZDM')
+	px = models.TextField(u'PX')
+
+class Courses(models.Model):
+	kch = models.TextField(u'课程号', max_length=100)  ### String
+	kcm = models.TextField(u'课程名', max_length=100)  ### String
+	kxh = models.TextField(u'课序号', max_length=100)  ### String
+	kkdwdm = models.TextField(u'开课单位', max_length=100)  ### String
+	pkdwdm = models.TextField(u'排课单位', max_length=100)  ### String
+	xs = models.FloatField(u'学时')  ### double
+	xf = models.FloatField(u'学分')  ### double
+	skjs = models.TextField(u'上课教师', max_length=100)  ### String
+	skbj = models.TextField(u'上课班级', max_length=100)  ### String
+	ypsjdd = models.TextField(u'已排时间地点', max_length=100)  ### String
+	skzcmc = models.TextField(u'周次', max_length=100)  ### String
+	skxqjc = models.TextField(u'星期节次', max_length=100)  ### String
+	skdd = models.TextField(u'上课地点', max_length=100)  ### String
+	xxxqdm = models.TextField(u'学校校区', max_length=100)  ### String
+	by6 = models.TextField(u'备用6', max_length=100)  ### String
+	by5 = models.TextField(u'备用5', max_length=100)  ### String
+	by4 = models.TextField(u'备用4', max_length=100)  ### String
+	wid = models.TextField(u'数据的唯一标识', max_length=100)  ### String
+	by3 = models.TextField(u'备用3', max_length=100)  ### String
+	by2 = models.TextField(u'备用2', max_length=100)  ### String
+	by1 = models.TextField(u'备用1', max_length=100)  ### String
+	by7 = models.TextField(u'备用7', max_length=100)  ### String
+	by8 = models.TextField(u'备用8', max_length=100)  ### String
+	by9 = models.TextField(u'备用9', max_length=100)  ### String
+	rzlbdm = models.TextField(u'任职类别代码,有的接口需要作为数据权限过滤的依据', max_length=100)  ### String
+	orderfilter = models.TextField(u'接口被字典使用时需要使用这个字段传入排序方式,比如+PX,-WID等', max_length=100)  ### String
+	by10 = models.TextField(u'备用10', max_length=100)  ### String
+	xkrwxz = models.TextField(u'选课任务限制', max_length=100)  ### String
+	sfxyjas = models.TextField(u'是否需要教室', max_length=100)  ### String
+	kyl = models.IntegerField(u'课余量')  ### int
+	xkxzsm = models.TextField(u'选课限制说明', max_length=100)  ### String
+	xnxqdm = models.TextField(u'学年学期', max_length=100)  ### String
+	zdpkyy = models.TextField(u'自动排课原因', max_length=100)  ### String
+	nsxkrs = models.IntegerField(u'男生选课人数')  ### int
+	jaslxdm = models.TextField(u'教室类型代码', max_length=100)  ### String
+	kslxdm = models.TextField(u'考试类型', max_length=100)  ### String
+	pkpcdm = models.TextField(u'排课批次', max_length=100)  ### String
+	syxs = models.FloatField(u'实验学时')  ### double
+	xkcldm = models.TextField(u'选课策略', max_length=100)  ### String
+	sfkfxk = models.TextField(u'是否开放选课', max_length=100)  ### String
+	rwztdm = models.TextField(u'任务状态', max_length=100)  ### String
+	tskh = models.TextField(u'同时课号', max_length=100)  ### String
+	sfszpkpc = models.TextField(u'是否设置排课批次', max_length=100)  ### String
+	pbsjxx = models.TextField(u'屏蔽时间信息', max_length=100)  ### String
+	krl = models.IntegerField(u'限选人数')  ### int
+	jxfsdm = models.TextField(u'教学方式', max_length=100)  ### String
+	nsrs = models.IntegerField(u'男生人数')  ### int
+	jsxx = models.TextField(u'教师信息', max_length=100)  ### String
+	sjixs = models.FloatField(u'设计学时')  ### double
+	pkctbjdm = models.TextField(u'排课冲突标记', max_length=100)  ### String
+	sffb = models.TextField(u'是否分班', max_length=100)  ### String
+	jasdm = models.TextField(u'教室代码', max_length=100)  ### String
+	sfxzxb = models.TextField(u'是否限制性别', max_length=100)  ### String
+	px = models.IntegerField(u'排序')  ### int
+	lrdwdm = models.TextField(u'录入单位', max_length=100)  ### String
+	nvsrs = models.IntegerField(u'女生人数')  ### int
+	nvsxkrs = models.IntegerField(u'女生选课人数')  ### int
+	xkrwxzbj = models.TextField(u'选课任务限制班级', max_length=100)  ### String
+	jxbmc = models.TextField(u'教学班名称', max_length=100)  ### String
+	zxsxx = models.TextField(u'周学时信息', max_length=100)  ### String
+	zdsjxx = models.TextField(u'指定时间信息', max_length=100)  ### String
+	newpkpcdm = models.TextField(u'新排课批次代码', max_length=100)  ### String
+	xkzrs = models.IntegerField(u'选课总人数')  ### int
+	sfxzxk = models.TextField(u'是否限制选课', max_length=100)  ### String
+	sjzdfsdm = models.TextField(u'时间指定方式', max_length=100)  ### String
+	pkztdm = models.TextField(u'排课状态', max_length=100)  ### String
+	jasxqdm = models.TextField(u'教室需求', max_length=100)  ### String
+	sjxs = models.FloatField(u'上机学时')  ### double
+	xkkzh = models.TextField(u'选课课组号', max_length=100)  ### String
+	skxs = models.FloatField(u'授课学时')  ### double
+	kcxzdm = models.TextField(u'课程性质代码', max_length=100)  ### String
+	jxbid = models.TextField(u'教学班ID', max_length=100)  ### String
+	knzxs = models.FloatField(u'课内周学时')  ### double
+	ppsjxx = models.TextField(u'匹配时间信息', max_length=100)  ### String
+	jcjg = models.TextField(u'检查结果', max_length=100)  ### String
+	sfcxb = models.TextField(u'是否重修班', max_length=100)  ### String
+	sfkxq = models.TextField(u'是否跨校区', max_length=100)  ### String
+	bjdm = models.TextField(u'班级代码', max_length=100)  ### String
+	bjxx = models.TextField(u'班级信息', max_length=100)  ### String
+	kclbdm = models.TextField(u'课程类别', max_length=100)  ### String
+	sfxgxk = models.TextField(u'是否校公选课', max_length=100)  ### String
+	xgxklbdm = models.TextField(u'校公选课类别', max_length=100)  ### String
+	pksxdm = models.TextField(u'排课属性', max_length=100)  ### String
+	ypxs = models.IntegerField(u'已排学时')  ### int
+	jxldm = models.TextField(u'教学楼代码', max_length=100)  ### String
+	tlxs = models.TextField(u'讨论学时', max_length=100)  ### String
+	sfxypk = models.TextField(u'是否需要安排', max_length=100)  ### String
+	xkwzsm = models.TextField(u'备注', max_length=100)  ### String
+	tyxmdm = models.TextField(u'体育项目', max_length=100)  ### String
+	skzc = models.TextField(u'上课周次', max_length=100)  ### String
+	skxq = models.TextField(u'上课星期', max_length=100)  ### String
+	ksjc = models.TextField(u'开始节次', max_length=100)  ### String
+	jsjc = models.TextField(u'结束节次', max_length=100)  ### String
+	xflbdm = models.TextField(u'文理学分', max_length=100)  ### String
+	xkrs = models.TextField(u'选课人数', max_length=100)  ### String
 
 
 class Person(models.Model):

+ 1 - 0
blog/views.py

@@ -91,6 +91,7 @@ def getJson(request):
 		content = json.loads(f.read())
 		content['check'] = json.loads(json_data)
 		return HttpResponse(json.dumps(content))
+
 def getSchemeByKey(request):
 	key = request.GET['key']
 	result = specificScheme.objects.filter(key=key)

+ 50 - 2
simplegen.py

@@ -3,21 +3,59 @@
 
 
 ### RealGen
+import json
+import os
+
 from Config import class_meta, fangan_meta
 
 
 def gen_for_controls(meta):
     for one in meta.get("searchMeta").get("controls"):
         type = "Unknown"
+        extra = ""
         js_type = one.get("dataType")
         if js_type == "String":
             type = "Text"
+            extra = ", max_length = 100"
         if js_type == "int" or js_type == "Timestamp":
             type = "Integer"
         if js_type == "float" or js_type == "double":
             type = "Float"
-        print("%s = models.%sField('%s')  <- %s" % (str(one.get("name")).lower(), type, one.get("caption"), one.get("dataType")))
 
+        name = str(one.get("name"))
+        read_name = name
+        if one.get("caption") is not None:
+            read_name =one.get("caption")
+        print("%s = models.%sField(u'%s'%s)  ### %s" % (name.lower(), type, read_name, extra, one.get("dataType")))
+
+
+def read_meta_from_data(file_name):
+    all_names = []
+    with open(file_name, "rb") as input_file:
+        bytes_in_file = input_file.read()
+        try:
+            strme = bytes_in_file.decode("UTF-8")
+        except:
+            strme = bytes_in_file.decode("GBK")
+        local_obj = dict(json.loads(strme))
+        datas = dict(local_obj.get("datas"))
+        for model_key in datas.keys():
+            print("\nKey : %s \n" % model_key)
+            rows = datas.get(model_key).get("rows")
+            for each in rows:
+                for k,v in each.items():
+                    if isinstance(v, float):
+                        all_names.append({"name": k, "kind": "Float", "val":v})
+                    elif isinstance(v, int):
+                        all_names.append({"name": k, "kind": "Integer", "val":v})
+                    elif isinstance(v, str):
+                        all_names.append({"name": k, "kind": "Text", "extra": "String", "val": v})
+                    elif v is None:
+                        all_names.append({"name": k, "kind": "Text", "extra": "NoneType", "val":v})
+                    else:
+                        all_names.append({"name": k, "kind": "Unknown", "extra": "Unknown", "val": v})
+                return all_names
+    pass
 
 
 if __name__ == "__main__":
@@ -28,4 +66,14 @@ if __name__ == "__main__":
 
     print ("Fangan Meta:")
     print (fangan_meta)
-    gen_for_controls(fangan_meta)
+    gen_for_controls(fangan_meta)
+
+    print("\n\n\n\nfanganode.json")
+    all_names = read_meta_from_data(os.path.join(os.path.dirname(__file__), "static", "All", "0a0fa2e3b5fb43458ef1ccb8ef5e3ca7_369d8f7961404b5294c1c4f7ea15c175.json"))
+    for i in all_names:
+        print ( "%s = models.%sField(u'%s') ## %s <= %s" % (i.get("name").lower(), i.get("kind"), i.get("name"), i.get("extra"), i.get("val")))
+
+    print ("\n\n\n\nqxpyfa.json")
+    all_names = read_meta_from_data(os.path.join(os.path.dirname(__file__), "qxpyfa.json"))
+    for i in all_names:
+        print ( "%s = models.%sField(u'%s') ## %s <= %s" % (i.get("name").lower(), i.get("kind"), i.get("name"), i.get("extra"), i.get("val")))