|
|
@@ -230,11 +230,14 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
"select XJB_JDID,NDY,FWLX,FWID,BB,ZT,FBSJ,GZYY"
|
|
|
+ " from XJB_JD where NDY=:ndy and FWLX=:fwlx"
|
|
|
+ " and FWID=:fwid and ZT=:status"
|
|
|
+ + " and nvl(FBSJ,CJSJ)>=:minPublish"
|
|
|
+ " order by BB desc,XJB_JDID desc");
|
|
|
batchCmd.wrStrParm("ndy", month.format(MONTH_FMT));
|
|
|
batchCmd.wrStrParm("fwlx", SCOPE_SCHOOL);
|
|
|
batchCmd.wrLongParm("fwid", SCHOOL_SCOPE_ID);
|
|
|
batchCmd.wrIntParm("status", JD_PUBLISHED);
|
|
|
+ batchCmd.wrTimeParm("minPublish", Timestamp.valueOf(
|
|
|
+ month.plusMonths(1).atDay(1).atStartOfDay()));
|
|
|
List<Map<String, Object>> batches =
|
|
|
db.doSelMapListByC(batchCmd);
|
|
|
boolean legacyDepartmentScope = false;
|
|
|
@@ -243,9 +246,12 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
"select XJB_JDID,NDY,FWLX,FWID,BB,ZT,FBSJ,GZYY"
|
|
|
+ " from XJB_JD where NDY=:ndy"
|
|
|
+ " and FWLX='BM' and ZT=:status"
|
|
|
+ + " and nvl(FBSJ,CJSJ)>=:minPublish"
|
|
|
+ " order by BB desc,XJB_JDID desc");
|
|
|
legacyCmd.wrStrParm("ndy", month.format(MONTH_FMT));
|
|
|
legacyCmd.wrIntParm("status", JD_PUBLISHED);
|
|
|
+ legacyCmd.wrTimeParm("minPublish", Timestamp.valueOf(
|
|
|
+ month.plusMonths(1).atDay(1).atStartOfDay()));
|
|
|
batches = db.doSelMapListByC(legacyCmd);
|
|
|
legacyDepartmentScope = true;
|
|
|
}
|
|
|
@@ -406,12 +412,15 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
+ " CLASS_COUNT from XJB_JD j"
|
|
|
+ " where j.NDY=:ndy and j.FWLX=:fwlx"
|
|
|
+ " and j.FWID=:fwid and j.ZT=:status"
|
|
|
+ + " and nvl(j.FBSJ,j.CJSJ)>=:minPublish"
|
|
|
+ " order by j.BB desc,j.XJB_JDID desc");
|
|
|
sqlc.wrStrParm("ndy", month.format(MONTH_FMT));
|
|
|
sqlc.wrStrParm("fwlx", SCOPE_SCHOOL);
|
|
|
sqlc.wrLongParm("fwid", SCHOOL_SCOPE_ID);
|
|
|
sqlc.wrIntParm("status", JD_PUBLISHED);
|
|
|
sqlc.wrIntParm("jgStatus", JD_PUBLISHED);
|
|
|
+ sqlc.wrTimeParm("minPublish", Timestamp.valueOf(
|
|
|
+ month.plusMonths(1).atDay(1).atStartOfDay()));
|
|
|
List<Map<String, Object>> rows = db.doSelMapListByC(sqlc);
|
|
|
return rows == null || rows.isEmpty() ? null : rows.get(0);
|
|
|
}
|
|
|
@@ -432,9 +441,49 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
rdLongOrNull(row.get("zyid")),
|
|
|
rdLongOrNull(row.get("deptid"))));
|
|
|
}
|
|
|
+ ensureSchoolClassMasterData(db, rows.size());
|
|
|
return rows;
|
|
|
}
|
|
|
|
|
|
+ private void ensureSchoolClassMasterData(Db db, int joinableCount)
|
|
|
+ throws Exception {
|
|
|
+ SqlCmd countCmd = new SqlCmd(
|
|
|
+ "select count(*) CNT from BJ b where b."
|
|
|
+ + ObjC.JLZT_useStr + " and b.BJZTM!=81");
|
|
|
+ db.doSelByC(countCmd);
|
|
|
+ int activeCount = db.rowNum == 0 ? 0 : db.rdIntCol("cnt");
|
|
|
+ if (activeCount == joinableCount)
|
|
|
+ return;
|
|
|
+
|
|
|
+ SqlCmd missingCmd = new SqlCmd(
|
|
|
+ "select b.BJID,b.MC from BJ b"
|
|
|
+ + " left join ZY z on z.ZYID=b.ZYID"
|
|
|
+ + " where b." + ObjC.JLZT_useStr
|
|
|
+ + " and b.BJZTM!=81 and z.ZYID is null"
|
|
|
+ + " order by b.BJID");
|
|
|
+ StringBuilder message = new StringBuilder(
|
|
|
+ "在用班级主数据不完整:在用班 ")
|
|
|
+ .append(activeCount)
|
|
|
+ .append(" 个,具备有效专业关系 ")
|
|
|
+ .append(joinableCount)
|
|
|
+ .append(" 个");
|
|
|
+ List<Map<String, Object>> missing = db.doSelMapListByC(missingCmd);
|
|
|
+ if (missing != null && !missing.isEmpty()) {
|
|
|
+ message.append(";缺少专业关系:");
|
|
|
+ for (int i = 0; i < Math.min(10, missing.size()); i++) {
|
|
|
+ if (i > 0)
|
|
|
+ message.append("、");
|
|
|
+ message.append(rdStr(missing.get(i).get("MC")))
|
|
|
+ .append("(")
|
|
|
+ .append(rdLong(missing.get(i).get("bjid"), 0L))
|
|
|
+ .append(")");
|
|
|
+ }
|
|
|
+ if (missing.size() > 10)
|
|
|
+ message.append(" 等");
|
|
|
+ }
|
|
|
+ throw new IllegalStateException(message.toString());
|
|
|
+ }
|
|
|
+
|
|
|
private List<ClassRow> rdImportedClasses(Db db, YearMonth month, long impid)
|
|
|
throws Exception {
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
@@ -1110,7 +1159,8 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
pm.setXjb_pmid(db.rdNextSeqVal("XJB_PMID"));
|
|
|
pm.setXjb_jdid(jdid);
|
|
|
pm.setBjid(result.cls.bjid);
|
|
|
- pm.setDwid(result.cls.dwid);
|
|
|
+ pm.setDwid(result.cls.deptId == null
|
|
|
+ ? result.cls.dwid : result.cls.deptId);
|
|
|
pm.setDwpm(result.departmentRank);
|
|
|
pm.setDwcs(result.departmentClassCount);
|
|
|
pm.setXxpm(result.schoolRank);
|
|
|
@@ -1286,7 +1336,9 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
private YearMonth rdLatestPublishedMonth(Db db) throws Exception {
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
"select max(NDY) NDY from XJB_JD"
|
|
|
- + " where FWLX=:fwlx and FWID=:fwid and ZT=:status");
|
|
|
+ + " where FWLX=:fwlx and FWID=:fwid and ZT=:status"
|
|
|
+ + " and nvl(FBSJ,CJSJ)>=add_months("
|
|
|
+ + "to_date(NDY||'-01','YYYY-MM-DD'),1)");
|
|
|
sqlc.wrStrParm("fwlx", SCOPE_SCHOOL);
|
|
|
sqlc.wrLongParm("fwid", SCHOOL_SCOPE_ID);
|
|
|
sqlc.wrIntParm("status", JD_PUBLISHED);
|