|
|
@@ -45,8 +45,11 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
DateTimeFormatter.ofPattern("yyyy-MM");
|
|
|
private static final String SOURCE_REAL = "real";
|
|
|
private static final String SOURCE_MISSING = "missing";
|
|
|
+ private static final String SCOPE_SCHOOL = "XX";
|
|
|
+ private static final long SCHOOL_SCOPE_ID = 0L;
|
|
|
private static final int JD_DRAFT = 1;
|
|
|
private static final int JD_PUBLISHED = 5;
|
|
|
+ private static final int JD_SUPERSEDED = 6;
|
|
|
|
|
|
/**
|
|
|
* 对当前用户部门完成一个已结束月份的月结。
|
|
|
@@ -81,30 +84,12 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
teamSnapshot.rebuildTeamSnapshot(db, cls.bjid, month, user);
|
|
|
|
|
|
List<ClassResult> results = calculate(db, classes, month);
|
|
|
- List<ClassResult> missing = new ArrayList<>();
|
|
|
- for (ClassResult result : results) {
|
|
|
- if (!result.missing.isEmpty())
|
|
|
- missing.add(result);
|
|
|
- }
|
|
|
- if (!missing.isEmpty()) {
|
|
|
- StringBuilder message = new StringBuilder("月结数据不完整,");
|
|
|
- message.append(missing.size()).append(" 个班级未发布:");
|
|
|
- for (int i = 0; i < Math.min(5, missing.size()); i++) {
|
|
|
- if (i > 0)
|
|
|
- message.append(";");
|
|
|
- ClassResult item = missing.get(i);
|
|
|
- message.append(item.cls.bjmc).append("[")
|
|
|
- .append(String.join("、", item.missing))
|
|
|
- .append("]");
|
|
|
- }
|
|
|
- if (missing.size() > 5)
|
|
|
- message.append(" 等");
|
|
|
- throw new IllegalArgumentException(message.toString());
|
|
|
- }
|
|
|
+ ensureComplete(results);
|
|
|
|
|
|
assignRanks(results);
|
|
|
deleteDraftBatch(db, month, bmid);
|
|
|
- long jdid = insertBatch(db, month, bmid, user);
|
|
|
+ long jdid = insertBatch(db, month, "BM", bmid, 1,
|
|
|
+ null, "部门星级班月结", user);
|
|
|
for (ClassResult result : results)
|
|
|
insertResult(db, jdid, result, user);
|
|
|
db.commit();
|
|
|
@@ -124,6 +109,88 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 手工补算或测试环境触发全校月结。
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unused")
|
|
|
+ public void closeSchoolByA() throws Exception {
|
|
|
+ HttpServletRequest request = super.req;
|
|
|
+ super.resp.setCharacterEncoding("UTF-8");
|
|
|
+ super.resp.setContentType("application/json;charset=UTF-8");
|
|
|
+ Writer writer = super.resp.getWriter();
|
|
|
+ Gson gson = new Gson();
|
|
|
+
|
|
|
+ try (Db db = Db.makeConn()) {
|
|
|
+ UserRunB user = UserU.rdUserByReq(request);
|
|
|
+ if (user == null)
|
|
|
+ throw new IllegalArgumentException("登录状态已失效,请重新登录");
|
|
|
+ YearMonth month = rdMonth(request.getParameter("month"));
|
|
|
+ Map<String, Object> data = closeSchoolMonth(
|
|
|
+ db, month, user, false, "星级班全校月结");
|
|
|
+ if (Boolean.TRUE.equals(data.get("created")))
|
|
|
+ db.commit();
|
|
|
+ ServU.wrOkDataByWriter(data, writer, gson);
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ ServU.wrErrMsgByWriter(null, e.getMessage(), writer, gson);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log4j.error("XjbMonthCloseServ.closeSchoolByA() 异常", e);
|
|
|
+ ServU.wrErrMsgByWriter(null, "全校星级班月结失败", writer, gson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成同一月份的更正版本,不覆盖原正式快照。
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unused")
|
|
|
+ public void correctSchoolByA() throws Exception {
|
|
|
+ HttpServletRequest request = super.req;
|
|
|
+ super.resp.setCharacterEncoding("UTF-8");
|
|
|
+ super.resp.setContentType("application/json;charset=UTF-8");
|
|
|
+ Writer writer = super.resp.getWriter();
|
|
|
+ Gson gson = new Gson();
|
|
|
+
|
|
|
+ try (Db db = Db.makeConn()) {
|
|
|
+ UserRunB user = UserU.rdUserByReq(request);
|
|
|
+ if (user == null)
|
|
|
+ throw new IllegalArgumentException("登录状态已失效,请重新登录");
|
|
|
+ YearMonth month = rdMonth(request.getParameter("month"));
|
|
|
+ String reason = StringUtils.trimToNull(request.getParameter("reason"));
|
|
|
+ if (reason == null)
|
|
|
+ throw new IllegalArgumentException("请填写更正原因");
|
|
|
+ Map<String, Object> data = closeSchoolMonth(
|
|
|
+ db, month, user, true, reason);
|
|
|
+ db.commit();
|
|
|
+ ServU.wrOkDataByWriter(data, writer, gson);
|
|
|
+ } catch (IllegalArgumentException e) {
|
|
|
+ ServU.wrErrMsgByWriter(null, e.getMessage(), writer, gson);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log4j.error("XjbMonthCloseServ.correctSchoolByA() 异常", e);
|
|
|
+ ServU.wrErrMsgByWriter(null, "星级班月结更正失败", writer, gson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 定时任务入口:每月 1 日生成上个月全校月结。
|
|
|
+ */
|
|
|
+ @SuppressWarnings("unused")
|
|
|
+ public void closeSchoolByTimer() throws Exception {
|
|
|
+ YearMonth month = YearMonth.now(CN_ZONE).minusMonths(1);
|
|
|
+ try (Db db = Db.makeConn()) {
|
|
|
+ Map<String, Object> data = closeSchoolMonth(
|
|
|
+ db, month, null, false, "星级班全校自动月结");
|
|
|
+ if (Boolean.TRUE.equals(data.get("created")))
|
|
|
+ db.commit();
|
|
|
+ log4j.info("星级班全校月结任务完成,月份={},班级数={},批次={},"
|
|
|
+ + "是否新生成={}",
|
|
|
+ data.get("month"), data.get("classCount"),
|
|
|
+ data.get("batchId"), data.get("created"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ log4j.error("XjbMonthCloseServ.closeSchoolByTimer() 异常,月份={}",
|
|
|
+ month, e);
|
|
|
+ throw e;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* PC 星级班总表只读取已发布月结。
|
|
|
*/
|
|
|
@@ -150,27 +217,42 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
}
|
|
|
|
|
|
SqlCmd batchCmd = new SqlCmd(
|
|
|
- "select XJB_JDID,NDY,FWLX,FWID,BB,ZT,FBSJ"
|
|
|
- + " from XJB_JD where NDY=:ndy and ZT=:status"
|
|
|
+ "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"
|
|
|
+ " 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);
|
|
|
List<Map<String, Object>> batches =
|
|
|
db.doSelMapListByC(batchCmd);
|
|
|
+ boolean legacyDepartmentScope = false;
|
|
|
+ if (batches == null || batches.isEmpty()) {
|
|
|
+ SqlCmd legacyCmd = new SqlCmd(
|
|
|
+ "select XJB_JDID,NDY,FWLX,FWID,BB,ZT,FBSJ,GZYY"
|
|
|
+ + " from XJB_JD where NDY=:ndy"
|
|
|
+ + " and FWLX='BM' and ZT=:status"
|
|
|
+ + " order by BB desc,XJB_JDID desc");
|
|
|
+ legacyCmd.wrStrParm("ndy", month.format(MONTH_FMT));
|
|
|
+ legacyCmd.wrIntParm("status", JD_PUBLISHED);
|
|
|
+ batches = db.doSelMapListByC(legacyCmd);
|
|
|
+ legacyDepartmentScope = true;
|
|
|
+ }
|
|
|
if (batches == null || batches.isEmpty())
|
|
|
throw new IllegalArgumentException("该月份暂无已发布月结");
|
|
|
Map<String, Object> batch = batches.get(0);
|
|
|
long jdid = rdLong(batch.get("xjb_jdid"), 0L);
|
|
|
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
- "select j.BJID,b.MC BJMC,nvl(d.MC,'') DWMC,"
|
|
|
+ "select j.BJID,b.MC BJMC,nvl(bm.MC,'') DWMC,"
|
|
|
+ "nvl(z.MC,'') ZYMC,j.SSDF,j.KTDF,j.SJDF,j.CSDF,"
|
|
|
+ "j.FJDF,j.KQDF,j.ZJF,j.KJF,j.ZF,j.XJ,"
|
|
|
+ "j.ZJFCS,j.KJFCS,j.QXSM,p.DWPM,p.DWCS,p.XXPM,p.XXCS"
|
|
|
+ " from XJB_JG j"
|
|
|
+ " inner join BJ b on b.BJID=j.BJID"
|
|
|
- + " left join DW d on d.DWID=j.DWID"
|
|
|
+ " left join ZY z on z.ZYID=j.ZYID"
|
|
|
+ + " left join BM bm on bm.BMID=z.FZBMID"
|
|
|
+ " left join XJB_PM p on p.XJB_JDID=j.XJB_JDID"
|
|
|
+ " and p.BJID=j.BJID"
|
|
|
+ " where j.XJB_JDID=:jdid and j.ZT=:status"
|
|
|
@@ -215,8 +297,11 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
Map<String, Object> data = new LinkedHashMap<>();
|
|
|
data.put("month", month.format(MONTH_FMT));
|
|
|
data.put("batchId", jdid);
|
|
|
+ data.put("version", rdInt(batch.get("bb")));
|
|
|
data.put("status", "已发布");
|
|
|
+ data.put("legacyDepartmentScope", legacyDepartmentScope);
|
|
|
data.put("publishedAt", formatTimestamp(batch.get("fbsj")));
|
|
|
+ data.put("correctionReason", rdStr(batch.get("gzyy")));
|
|
|
data.put("rows", rows);
|
|
|
data.put("departments", new ArrayList<>(departments));
|
|
|
data.put("majors", new ArrayList<>(majors));
|
|
|
@@ -231,10 +316,139 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private Map<String, Object> closeSchoolMonth(
|
|
|
+ Db db, YearMonth month, UserRunB user, boolean correction,
|
|
|
+ String reason) throws Exception {
|
|
|
+ if (!month.isBefore(YearMonth.now(CN_ZONE)))
|
|
|
+ throw new IllegalArgumentException("只能月结已经结束的月份");
|
|
|
+
|
|
|
+ Map<String, Object> current = rdCurrentSchoolBatch(db, month);
|
|
|
+ if (current != null && !correction) {
|
|
|
+ Map<String, Object> skipped = new LinkedHashMap<>();
|
|
|
+ skipped.put("month", month.format(MONTH_FMT));
|
|
|
+ skipped.put("batchId", rdLong(current.get("xjb_jdid"), 0L));
|
|
|
+ skipped.put("version", rdInt(current.get("bb")));
|
|
|
+ skipped.put("status", JD_PUBLISHED);
|
|
|
+ skipped.put("created", false);
|
|
|
+ skipped.put("classCount", rdInt(current.get("class_count")));
|
|
|
+ skipped.put("reason", rdStr(current.get("gzyy")));
|
|
|
+ return skipped;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ClassRow> classes = rdSchoolClasses(db);
|
|
|
+ if (classes.isEmpty())
|
|
|
+ throw new IllegalArgumentException("没有可月结的在用班级");
|
|
|
+
|
|
|
+ XjbJfServ teamSnapshot = new XjbJfServ();
|
|
|
+ for (ClassRow cls : classes)
|
|
|
+ teamSnapshot.rebuildTeamSnapshot(db, cls.bjid, month, user);
|
|
|
+
|
|
|
+ List<ClassResult> results = calculate(db, classes, month);
|
|
|
+ ensureComplete(results);
|
|
|
+ assignRanks(results);
|
|
|
+
|
|
|
+ Long previousId = null;
|
|
|
+ int version = 1;
|
|
|
+ if (current != null) {
|
|
|
+ previousId = rdLong(current.get("xjb_jdid"), 0L);
|
|
|
+ version = Math.max(1, rdInt(current.get("bb"))) + 1;
|
|
|
+ markBatchSuperseded(db, previousId);
|
|
|
+ }
|
|
|
+
|
|
|
+ long jdid = insertBatch(db, month, SCOPE_SCHOOL, SCHOOL_SCOPE_ID,
|
|
|
+ version, previousId, reason, user);
|
|
|
+ for (ClassResult result : results)
|
|
|
+ insertResult(db, jdid, result, user);
|
|
|
+
|
|
|
+ Map<String, Object> data = new LinkedHashMap<>();
|
|
|
+ data.put("month", month.format(MONTH_FMT));
|
|
|
+ data.put("batchId", jdid);
|
|
|
+ data.put("version", version);
|
|
|
+ data.put("status", JD_PUBLISHED);
|
|
|
+ data.put("created", true);
|
|
|
+ data.put("classCount", results.size());
|
|
|
+ data.put("previousBatchId", previousId);
|
|
|
+ data.put("reason", StringUtils.defaultString(reason));
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> rdCurrentSchoolBatch(
|
|
|
+ Db db, YearMonth month) throws Exception {
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select j.XJB_JDID,j.BB,j.ZT,j.GZYY,"
|
|
|
+ + "(select count(*) from XJB_JG g"
|
|
|
+ + " where g.XJB_JDID=j.XJB_JDID and g.ZT=:jgStatus)"
|
|
|
+ + " CLASS_COUNT from XJB_JD j"
|
|
|
+ + " where j.NDY=:ndy and j.FWLX=:fwlx"
|
|
|
+ + " and j.FWID=:fwid and j.ZT=:status"
|
|
|
+ + " 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);
|
|
|
+ List<Map<String, Object>> rows = db.doSelMapListByC(sqlc);
|
|
|
+ return rows == null || rows.isEmpty() ? null : rows.get(0);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<ClassRow> rdSchoolClasses(Db db) throws Exception {
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "select b.BJID,b.MC BJMC,b.DWID,b.ZYID,z.FZBMID DEPTID"
|
|
|
+ + " from BJ b"
|
|
|
+ + " inner join ZY z on z.ZYID=b.ZYID"
|
|
|
+ + " where b." + ObjC.JLZT_useStr
|
|
|
+ + " and b.BJZTM!=81 order by b.MC,b.BJID");
|
|
|
+ List<ClassRow> rows = new ArrayList<>();
|
|
|
+ for (Map<String, Object> row : db.doSelMapListByC(sqlc)) {
|
|
|
+ rows.add(new ClassRow(
|
|
|
+ rdLong(row.get("bjid"), 0L),
|
|
|
+ rdStr(row.get("bjmc")),
|
|
|
+ rdLongOrNull(row.get("dwid")),
|
|
|
+ rdLongOrNull(row.get("zyid")),
|
|
|
+ rdLongOrNull(row.get("deptid"))));
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ensureComplete(List<ClassResult> results) {
|
|
|
+ List<ClassResult> missing = new ArrayList<>();
|
|
|
+ for (ClassResult result : results) {
|
|
|
+ if (!result.missing.isEmpty())
|
|
|
+ missing.add(result);
|
|
|
+ }
|
|
|
+ if (missing.isEmpty())
|
|
|
+ return;
|
|
|
+
|
|
|
+ StringBuilder message = new StringBuilder("月结数据不完整,");
|
|
|
+ message.append(missing.size()).append(" 个班级未生成:");
|
|
|
+ for (int i = 0; i < Math.min(5, missing.size()); i++) {
|
|
|
+ if (i > 0)
|
|
|
+ message.append(";");
|
|
|
+ ClassResult item = missing.get(i);
|
|
|
+ message.append(item.cls.bjmc).append("[")
|
|
|
+ .append(String.join("、", item.missing))
|
|
|
+ .append("]");
|
|
|
+ }
|
|
|
+ if (missing.size() > 5)
|
|
|
+ message.append(" 等");
|
|
|
+ throw new IllegalArgumentException(message.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ private void markBatchSuperseded(Db db, long jdid) throws Exception {
|
|
|
+ SqlCmd sqlc = new SqlCmd(
|
|
|
+ "update XJB_JD set ZT=:superseded"
|
|
|
+ + " where XJB_JDID=:id and ZT=:published");
|
|
|
+ sqlc.wrIntParm("superseded", JD_SUPERSEDED);
|
|
|
+ sqlc.wrLongParm("id", jdid);
|
|
|
+ sqlc.wrIntParm("published", JD_PUBLISHED);
|
|
|
+ db.doModByC(sqlc);
|
|
|
+ }
|
|
|
+
|
|
|
private List<ClassRow> rdDepartmentClasses(Db db, long bmid)
|
|
|
throws Exception {
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
- "select b.BJID,b.MC BJMC,b.DWID,b.ZYID from BJ b"
|
|
|
+ "select b.BJID,b.MC BJMC,b.DWID,b.ZYID,z.FZBMID DEPTID"
|
|
|
+ + " from BJ b"
|
|
|
+ " inner join ZY z on z.ZYID=b.ZYID"
|
|
|
+ " where z.FZBMID=:bmid and b." + ObjC.JLZT_useStr
|
|
|
+ " and b.BJZTM!=81 order by b.MC,b.BJID");
|
|
|
@@ -245,7 +459,8 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
rdLong(row.get("bjid"), 0L),
|
|
|
rdStr(row.get("bjmc")),
|
|
|
rdLongOrNull(row.get("dwid")),
|
|
|
- rdLongOrNull(row.get("zyid"))));
|
|
|
+ rdLongOrNull(row.get("zyid")),
|
|
|
+ rdLongOrNull(row.get("deptid"))));
|
|
|
}
|
|
|
return rows;
|
|
|
}
|
|
|
@@ -601,7 +816,7 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
|
|
|
Map<Long, List<ClassResult>> departments = new LinkedHashMap<>();
|
|
|
for (ClassResult item : results) {
|
|
|
- departments.computeIfAbsent(item.cls.dwid, key ->
|
|
|
+ departments.computeIfAbsent(item.cls.deptId, key ->
|
|
|
new ArrayList<>()).add(item);
|
|
|
}
|
|
|
for (List<ClassResult> group : departments.values()) {
|
|
|
@@ -693,25 +908,28 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
db.doModByC(sqlc);
|
|
|
}
|
|
|
|
|
|
- private long insertBatch(Db db, YearMonth month, long bmid,
|
|
|
+ private long insertBatch(Db db, YearMonth month, String fwlx, long fwid,
|
|
|
+ int version, Long previousId, String reason,
|
|
|
UserRunB user) throws Exception {
|
|
|
long id = db.rdNextSeqVal("XJB_JDID");
|
|
|
Timestamp now = new Timestamp(System.currentTimeMillis());
|
|
|
XjbJdPo po = new XjbJdPo();
|
|
|
po.setXjb_jdid(id);
|
|
|
po.setNdy(month.format(MONTH_FMT));
|
|
|
- po.setFwlx("BM");
|
|
|
- po.setFwid(bmid);
|
|
|
- po.setBb(1);
|
|
|
+ po.setFwlx(fwlx);
|
|
|
+ po.setFwid(fwid);
|
|
|
+ po.setBb(version);
|
|
|
po.setZt(JD_PUBLISHED);
|
|
|
- po.setMs("星级班月结");
|
|
|
+ po.setMs(StringUtils.defaultIfBlank(reason, "星级班月结"));
|
|
|
po.setCjsj(now);
|
|
|
po.setFbsj(now);
|
|
|
- po.setJsryid(user.ryid);
|
|
|
- po.setJsbmid(user.bmid);
|
|
|
+ po.setJsryid(user == null ? null : user.ryid);
|
|
|
+ po.setJsbmid(user == null ? null : user.bmid);
|
|
|
+ po.setPrev_jdid(previousId);
|
|
|
+ po.setGzyy(StringUtils.trimToNull(reason));
|
|
|
Set<String> fields = new LinkedHashSet<>(Arrays.asList(
|
|
|
"xjb_jdid", "ndy", "fwlx", "fwid", "bb", "zt", "ms",
|
|
|
- "cjsj", "fbsj", "jsryid", "jsbmid"));
|
|
|
+ "cjsj", "fbsj", "jsryid", "jsbmid", "prev_jdid", "gzyy"));
|
|
|
db.doInsPo(po, fields);
|
|
|
return id;
|
|
|
}
|
|
|
@@ -746,8 +964,8 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
jg.setQxsm("");
|
|
|
jg.setZt(JD_PUBLISHED);
|
|
|
jg.setJlsj(new Timestamp(System.currentTimeMillis()));
|
|
|
- jg.setCjryid(user.ryid);
|
|
|
- jg.setGlbmid(user.bmid);
|
|
|
+ jg.setCjryid(user == null ? null : user.ryid);
|
|
|
+ jg.setGlbmid(user == null ? null : user.bmid);
|
|
|
Set<String> jgFields = new LinkedHashSet<>(Arrays.asList(
|
|
|
"xjb_jgid", "xjb_jdid", "ndy", "bjid", "dwid", "zyid",
|
|
|
"ssdf", "ktdf", "sjdf", "csdf", "fjdf", "kqdf",
|
|
|
@@ -773,12 +991,21 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
|
|
|
private YearMonth rdLatestPublishedMonth(Db db) throws Exception {
|
|
|
SqlCmd sqlc = new SqlCmd(
|
|
|
- "select max(NDY) NDY from XJB_JD where ZT=:status");
|
|
|
+ "select max(NDY) NDY from XJB_JD"
|
|
|
+ + " where FWLX=:fwlx and FWID=:fwid and ZT=:status");
|
|
|
+ sqlc.wrStrParm("fwlx", SCOPE_SCHOOL);
|
|
|
+ sqlc.wrLongParm("fwid", SCHOOL_SCOPE_ID);
|
|
|
sqlc.wrIntParm("status", JD_PUBLISHED);
|
|
|
db.doSelByC(sqlc);
|
|
|
- if (db.rowNum == 0)
|
|
|
- return null;
|
|
|
- String value = db.rdStrCol("ndy");
|
|
|
+ String value = db.rowNum == 0 ? null : db.rdStrCol("ndy");
|
|
|
+ if (StringUtils.isBlank(value)) {
|
|
|
+ SqlCmd legacy = new SqlCmd(
|
|
|
+ "select max(NDY) NDY from XJB_JD"
|
|
|
+ + " where FWLX='BM' and ZT=:status");
|
|
|
+ legacy.wrIntParm("status", JD_PUBLISHED);
|
|
|
+ db.doSelByC(legacy);
|
|
|
+ value = db.rowNum == 0 ? null : db.rdStrCol("ndy");
|
|
|
+ }
|
|
|
return StringUtils.isBlank(value) ? null
|
|
|
: YearMonth.parse(value, MONTH_FMT);
|
|
|
}
|
|
|
@@ -859,12 +1086,15 @@ public class XjbMonthCloseServ extends Serv {
|
|
|
final String bjmc;
|
|
|
final Long dwid;
|
|
|
final Long zyid;
|
|
|
+ final Long deptId;
|
|
|
|
|
|
- ClassRow(long bjid, String bjmc, Long dwid, Long zyid) {
|
|
|
+ ClassRow(long bjid, String bjmc, Long dwid, Long zyid,
|
|
|
+ Long deptId) {
|
|
|
this.bjid = bjid;
|
|
|
this.bjmc = bjmc;
|
|
|
this.dwid = dwid;
|
|
|
this.zyid = zyid;
|
|
|
+ this.deptId = deptId;
|
|
|
}
|
|
|
}
|
|
|
|