|
|
@@ -11,6 +11,7 @@ import com.xjrsoft.module.base.entity.BaseCourseSubject;
|
|
|
import com.xjrsoft.module.base.entity.BaseGrade;
|
|
|
import com.xjrsoft.module.base.entity.BaseLabel;
|
|
|
import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
+import com.xjrsoft.module.organization.entity.Department;
|
|
|
import com.xjrsoft.module.schedule.vo.ClassroomJianyuekbVo;
|
|
|
import com.xjrsoft.module.schedule.vo.StudentJianyuekbVo;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
@@ -31,6 +32,48 @@ import java.util.Map;
|
|
|
@Slf4j
|
|
|
public class DataUtil {
|
|
|
|
|
|
+ /**
|
|
|
+ * 推送校区信息
|
|
|
+ * 此处将班级所属的部门当做校区进行推送
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<Long, String> insertSchoolDistrict(Db db, String tableName, Map<Long, String> ids) throws Exception {
|
|
|
+ String sql = "SELECT * FROM " + tableName + " WHERE id IN (" +
|
|
|
+ "SELECT DISTINCT org_id FROM base_class WHERE delete_mark = 0\n" +
|
|
|
+ ")";
|
|
|
+ List<Department> dataList = db.query(sql, Department.class);
|
|
|
+
|
|
|
+ Map<Long, String> idMap = new HashMap<>();
|
|
|
+ JsonParser jsonParser = new JsonParser();
|
|
|
+ for (Department department : dataList) {
|
|
|
+ String url = ScheduleUtil.apiUrl + "SchoolDistrict/Create";
|
|
|
+ JsonObject paramJson = new JsonObject();
|
|
|
+ paramJson.addProperty("name", department.getName());
|
|
|
+
|
|
|
+ paramJson.addProperty("not", department.getRemark());
|
|
|
+ paramJson.addProperty("sort", department.getSortCode());
|
|
|
+ paramJson.addProperty("shortName", department.getName());
|
|
|
+ long timestamp = System.currentTimeMillis();
|
|
|
+ String sign = ScheduleUtil.createSign(timestamp);
|
|
|
+ ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
|
|
|
+ if(ids != null && ids.get(department.getId()) != null){
|
|
|
+ url = ScheduleUtil.apiUrl + "SchoolDistrict/Update";
|
|
|
+ paramJson.addProperty("id", ids.get(department.getId()));
|
|
|
+ ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String result = ScheduleUtil.doPost(url, paramJson.toString(), sign, timestamp);
|
|
|
+ if(result == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ JsonObject resultJson = jsonParser.parse(result).getAsJsonObject();
|
|
|
+ idMap.put(department.getId(), resultJson.get("data").getAsString());
|
|
|
+ }
|
|
|
+ //插入记录表
|
|
|
+ insertRecord(db, tableName, idMap);
|
|
|
+ return idMap;
|
|
|
+ }
|
|
|
+
|
|
|
public Map<Long, String> insertClass(Db db, String tableName, Map<Long, String> gradeMap,
|
|
|
Map<Long, String> teacherMap, String semesterSerialNo, Map<Long, String> ids, Map<Long, String> classroomMap) throws Exception {
|
|
|
String sql = "SELECT * FROM " + tableName + " WHERE delete_mark = 0 and is_graduate = 1";
|
|
|
@@ -355,20 +398,23 @@ public class DataUtil {
|
|
|
* 插入年级
|
|
|
* @param db 数据库链接
|
|
|
* @param tableName 表名字
|
|
|
- * @param schoolDistrictId 校区id
|
|
|
+ * @param schoolDistrictMap 校区id
|
|
|
* @param ids 数据库id和jianyue的对应关系
|
|
|
* @return 返回数据库和jianyue的对应关系
|
|
|
*/
|
|
|
- public Map<Long, String> insertGrade(Db db, String tableName, String schoolDistrictId, Map<Long, String> ids) throws Exception {
|
|
|
+ public Map<Long, String> insertGrade(Db db, String tableName, Map<Long, String> schoolDistrictMap, Map<Long, String> ids) throws Exception {
|
|
|
String sql = "select * from " + tableName + " where delete_mark = 0 and status = 1";
|
|
|
List<BaseGrade> list = db.query(sql, BaseGrade.class);
|
|
|
|
|
|
JsonParser jsonParser = new JsonParser();
|
|
|
Map<Long, String> idMap = new HashMap<>();
|
|
|
+ for (Long l : schoolDistrictMap.keySet()) {
|
|
|
+
|
|
|
+ }
|
|
|
for (BaseGrade baseGrade : list) {
|
|
|
String url = ScheduleUtil.apiUrl + "eduyear/create";
|
|
|
JsonObject paramJson = new JsonObject();
|
|
|
- paramJson.addProperty("schoolDistrictId", schoolDistrictId);
|
|
|
+// paramJson.addProperty("schoolDistrictId", schoolDistrictId);
|
|
|
paramJson.addProperty("period", 4);
|
|
|
paramJson.addProperty("startYear", baseGrade.getTitle().replaceAll("年", ""));
|
|
|
paramJson.addProperty("extendId", baseGrade.getId().toString());
|