DcTroubleshoot.jsp 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  1. <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" session="true" %>
  2. <%@ page import="java.io.File" %>
  3. <%@ page import="java.nio.file.Files" %>
  4. <%@ page import="java.sql.Connection" %>
  5. <%@ page import="java.sql.PreparedStatement" %>
  6. <%@ page import="java.sql.ResultSet" %>
  7. <%@ page import="java.sql.ResultSetMetaData" %>
  8. <%@ page import="java.sql.Types" %>
  9. <%@ page import="java.text.SimpleDateFormat" %>
  10. <%@ page import="java.util.ArrayList" %>
  11. <%@ page import="java.util.Date" %>
  12. <%@ page import="java.util.LinkedHashMap" %>
  13. <%@ page import="java.util.LinkedHashSet" %>
  14. <%@ page import="java.util.List" %>
  15. <%@ page import="java.util.Map" %>
  16. <%@ page import="java.util.Set" %>
  17. <%@ page import="javax.naming.Context" %>
  18. <%@ page import="javax.naming.InitialContext" %>
  19. <%@ page import="javax.sql.DataSource" %>
  20. <%@ page import="ss.AppB" %>
  21. <%!
  22. /*
  23. * 学生/家长账号状态排查页(只读)
  24. *
  25. * 用途:输入 学生姓名 / 班级 / 学号 / 手机号,一次查出该学生及其家长的
  26. * 档案、校卡、权益、家长账号、订阅、手机号重复等状态,并给出结论标签。
  27. *
  28. * 约束:
  29. * 1. 只读:全部 SQL 均为 SELECT,无任何写操作。
  30. * 2. 页面口令不写在本文件里,从服务器上的口令文件读取(见 PWD_FILE_CANDIDATES);
  31. * 文件缺失时页面拒绝运行。
  32. * 3. 独立文件:不修改 web.xml、不修改 cfg/**、不新增/不依赖任何 Java 类。
  33. * 取数只用标准 JNDI + JDBC(java:comp/env/jdbc/dc),
  34. * 不调用 PMS 平台内部 API,避免受内部方法改名影响。
  35. */
  36. /** 一次最多展示多少名学生,避免按班级搜索时全量渲染。 */
  37. private static final int MAX_STUDENT = 60;
  38. /** 会话中“已通过口令校验”的标记。 */
  39. private static final String SESS_OK = "dcTsOk";
  40. /** 页面口令文件的候选位置(按顺序探测,取第一个存在的)。 */
  41. private static final String[] PWD_FILE_CANDIDATES = {
  42. "/usr/local/tomcat/conf/dc-troubleshoot.pwd",
  43. "/usr/local/tomcat/webapps/ROOT/WEB-INF/dc-troubleshoot.pwd",
  44. "/opt/data/tmp/dc-troubleshoot.pwd"
  45. };
  46. /** JNDI 数据源名(见 web/META-INF/context.xml)。 */
  47. private static final String JNDI_dc = "java:comp/env/jdbc/dc";
  48. /** 学生人员类别、在用记录状态。 */
  49. private static final long RYLBM_student = 1100;
  50. private static final long JLZTM_use = 51;
  51. /** 订阅包含的服务项目。 */
  52. private static final int GRFW_ITEM_COUNT = 6;
  53. private static String grfwName(long xmm) {
  54. switch ((int) xmm) {
  55. case 111: return "电话 ZDSC";
  56. case 115: return "留言 ZDLL";
  57. case 121: return "语音 ZDCS";
  58. case 122: return "视频";
  59. case 123: return "课程";
  60. case 124: return "其他";
  61. default: return String.valueOf(xmm);
  62. }
  63. }
  64. private static String txt(Object o) {
  65. return o == null ? "" : String.valueOf(o);
  66. }
  67. /** HTML 转义。 */
  68. private static String esc(Object o) {
  69. String s = txt(o);
  70. StringBuilder b = new StringBuilder(s.length() + 16);
  71. for (int i = 0; i < s.length(); i++) {
  72. char ch = s.charAt(i);
  73. switch (ch) {
  74. case '&': b.append("&amp;"); break;
  75. case '<': b.append("&lt;"); break;
  76. case '>': b.append("&gt;"); break;
  77. case '"': b.append("&quot;"); break;
  78. case '\'': b.append("&#39;"); break;
  79. default: b.append(ch);
  80. }
  81. }
  82. return b.toString();
  83. }
  84. private static String trimToNull(String s) {
  85. if (s == null) return null;
  86. s = s.trim();
  87. return s.isEmpty() ? null : s;
  88. }
  89. private static String dt(Object o) {
  90. if (o == null) return "";
  91. if (o instanceof Date) return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format((Date) o);
  92. return String.valueOf(o);
  93. }
  94. private static String d8(Object o) {
  95. if (o == null) return "";
  96. if (o instanceof Date) return new SimpleDateFormat("yyyy-MM-dd").format((Date) o);
  97. return String.valueOf(o);
  98. }
  99. /** 直接取 Map 里的值格式化(cell() 会把值转成 String,不能再交给 dt())。 */
  100. private static String dtm(Map<String, Object> m, String key) {
  101. return dt(m.get(key));
  102. }
  103. private static String d8m(Map<String, Object> m, String key) {
  104. return d8(m.get(key));
  105. }
  106. /** 布尔(含 Y/N、1/0) 转 是/否。 */
  107. private static String yn(Object o) {
  108. String s = txt(o);
  109. if (s.isEmpty()) return "";
  110. if ("Y".equalsIgnoreCase(s) || "1".equals(s) || "TRUE".equalsIgnoreCase(s)) return "是";
  111. if ("N".equalsIgnoreCase(s) || "0".equals(s) || "FALSE".equalsIgnoreCase(s)) return "否";
  112. return s;
  113. }
  114. private static String num(Object o) {
  115. if (o == null) return "0";
  116. if (o instanceof Number) {
  117. Number n = (Number) o;
  118. if (n.doubleValue() == Math.floor(n.doubleValue())) return String.valueOf(n.longValue());
  119. }
  120. return String.valueOf(o);
  121. }
  122. private static long lng(Object o) {
  123. if (o == null) return 0L;
  124. if (o instanceof Number) return ((Number) o).longValue();
  125. try {
  126. return Long.parseLong(String.valueOf(o).trim());
  127. } catch (Exception e) {
  128. return 0L;
  129. }
  130. }
  131. /** 是否像手机号(11 位、以 1 开头、全数字)。学生的“账号”是姓名,不能当手机号统计。 */
  132. private static boolean isPhone(String s) {
  133. if (s == null) return false;
  134. String t = s.trim();
  135. if (t.length() != 11 || t.charAt(0) != '1') return false;
  136. for (int i = 1; i < t.length(); i++) {
  137. if (!Character.isDigit(t.charAt(i))) return false;
  138. }
  139. return true;
  140. }
  141. /** 读取页面口令;口令不写在代码里。 */
  142. private static String rdPagePwd() {
  143. for (String p : PWD_FILE_CANDIDATES) {
  144. try {
  145. File f = new File(p);
  146. if (f.isFile()) {
  147. String s = new String(Files.readAllBytes(f.toPath()),
  148. java.nio.charset.StandardCharsets.UTF_8).trim();
  149. if (!s.isEmpty()) return s;
  150. }
  151. } catch (Exception ignore) {
  152. // 忽略,继续探测下一个候选路径。
  153. }
  154. }
  155. return null;
  156. }
  157. /** 判断 sauth 目录下是否存在 rygw<人员ID> 序列化文件(家长权限缓存)。 */
  158. private static boolean sauthCacheExists(long ryid) {
  159. String dir = AppB.cfgSauthDir;
  160. if (dir == null) return false;
  161. String fileName = "rygw" + ryid;
  162. try {
  163. File d = new File(dir);
  164. if (new File(d, fileName).exists()) return true;
  165. File[] subs = d.listFiles();
  166. if (subs != null) {
  167. for (File s : subs) {
  168. if (s.isDirectory() && new File(s, fileName).exists()) return true;
  169. }
  170. }
  171. } catch (Exception ignore) {
  172. // 忽略。
  173. }
  174. return false;
  175. }
  176. private static String tag(String cls, String text) {
  177. return "<span class=\"tag " + cls + "\">" + esc(text) + "</span> ";
  178. }
  179. private static Connection getConn() throws Exception {
  180. Context ctx = new InitialContext();
  181. DataSource ds = (DataSource) ctx.lookup(JNDI_dc);
  182. Connection conn = ds.getConnection();
  183. try { conn.setAutoCommit(true); } catch (Exception ignore) { }
  184. return conn;
  185. }
  186. /**
  187. * 时间列统一取成 java.sql.Timestamp。
  188. * 实测 getObject( 对 DATE/TIMESTAMP 列可能返回非 java.util.Date 的实现类,
  189. * 直接用 instanceof 判断会漏掉,导致格式化不生效。
  190. */
  191. private static Object readTime(ResultSet rs, int idx) {
  192. try {
  193. java.sql.Timestamp ts = rs.getTimestamp(idx);
  194. if (ts != null) return ts;
  195. } catch (Exception ignore) {
  196. // 落到 getObject。
  197. }
  198. try {
  199. return rs.getObject(idx);
  200. } catch (Exception ignore) {
  201. return null;
  202. }
  203. }
  204. /** 只读查询:SQL 用 ? 占位,params 按顺序传入。结果列名统一转小写。 */
  205. private static List<Map<String, Object>> query(Connection conn, String sql, Object... params) throws Exception {
  206. List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
  207. PreparedStatement ps = null;
  208. ResultSet rs = null;
  209. try {
  210. ps = conn.prepareStatement(sql);
  211. int n = params == null ? 0 : params.length;
  212. for (int i = 0; i < n; i++) {
  213. Object p = params[i];
  214. if (p == null) ps.setNull(i + 1, Types.VARCHAR);
  215. else if (p instanceof Long) ps.setLong(i + 1, ((Long) p).longValue());
  216. else if (p instanceof Integer) ps.setInt(i + 1, ((Integer) p).intValue());
  217. else ps.setString(i + 1, String.valueOf(p));
  218. }
  219. rs = ps.executeQuery();
  220. ResultSetMetaData md = rs.getMetaData();
  221. int colCount = md.getColumnCount();
  222. String[] names = new String[colCount];
  223. boolean[] isTime = new boolean[colCount];
  224. for (int i = 1; i <= colCount; i++) {
  225. names[i - 1] = md.getColumnLabel(i).toLowerCase();
  226. int t = md.getColumnType(i);
  227. isTime[i - 1] = (t == Types.TIMESTAMP || t == Types.TIMESTAMP_WITH_TIMEZONE
  228. || t == Types.DATE || t == Types.TIME);
  229. }
  230. while (rs.next()) {
  231. Map<String, Object> row = new LinkedHashMap<String, Object>();
  232. for (int i = 1; i <= colCount; i++) {
  233. row.put(names[i - 1], isTime[i - 1] ? readTime(rs, i) : rs.getObject(i));
  234. }
  235. list.add(row);
  236. }
  237. } finally {
  238. if (rs != null) { try { rs.close(); } catch (Exception ignore) { } }
  239. if (ps != null) { try { ps.close(); } catch (Exception ignore) { } }
  240. }
  241. return list;
  242. }
  243. private static String cell(Map<String, Object> m, String key) {
  244. return txt(m.get(key));
  245. }
  246. %>
  247. <%
  248. request.setCharacterEncoding("UTF-8");
  249. // ============================ 1. 口令门 ============================
  250. String pwdErr = null;
  251. if ("logout".equals(request.getParameter("do"))) {
  252. session.removeAttribute(SESS_OK);
  253. }
  254. String realPwd = rdPagePwd();
  255. boolean authed = Boolean.TRUE.equals(session.getAttribute(SESS_OK));
  256. if (!authed) {
  257. String input = request.getParameter("pwd");
  258. if (realPwd == null) {
  259. pwdErr = "页面口令文件不存在,请管理员在服务器上创建:" + PWD_FILE_CANDIDATES[0];
  260. } else if (input != null) {
  261. if (realPwd.equals(input)) {
  262. session.setAttribute(SESS_OK, Boolean.TRUE);
  263. authed = true;
  264. } else {
  265. pwdErr = "口令不正确";
  266. }
  267. }
  268. }
  269. %>
  270. <!DOCTYPE html>
  271. <html lang="zh-CN">
  272. <head>
  273. <meta charset="UTF-8">
  274. <meta name="viewport" content="width=device-width, initial-scale=1">
  275. <title>学生/家长账号状态排查</title>
  276. <style>
  277. body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; margin: 0; padding: 16px 20px 60px; background: #f5f6f8; color: #222; font-size: 13px; }
  278. h1 { font-size: 18px; margin: 0 0 4px; }
  279. h2 { font-size: 15px; margin: 0 0 10px; }
  280. .sub { color: #666; margin-bottom: 14px; }
  281. .card { background: #fff; border: 1px solid #e2e5ea; border-radius: 6px; padding: 12px 14px; margin-bottom: 12px; }
  282. .stu { border-left: 4px solid #2b6cb0; }
  283. .block { margin-top: 12px; }
  284. .block > h3 { font-size: 13px; margin: 0 0 6px; color: #2b6cb0; border-bottom: 1px solid #eef1f5; padding-bottom: 4px; }
  285. table { border-collapse: collapse; width: 100%; }
  286. th, td { border: 1px solid #e6e9ee; padding: 4px 6px; text-align: left; vertical-align: top; word-break: break-all; }
  287. th { background: #fafbfc; font-weight: 600; white-space: nowrap; }
  288. .kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 2px 14px; }
  289. .kv div { padding: 1px 0; }
  290. .kv b { color: #555; font-weight: 500; }
  291. .tag { display: inline-block; padding: 1px 6px; border-radius: 10px; font-size: 12px; margin: 0 3px 3px 0; }
  292. .tag-danger { background: #fdecea; color: #b3261e; border: 1px solid #f5c6c2; }
  293. .tag-warn { background: #fff4e5; color: #a35a00; border: 1px solid #ffd8a8; }
  294. .tag-ok { background: #e7f6ec; color: #1b7a3d; border: 1px solid #b7e0c4; }
  295. .tag-info { background: #eef1f5; color: #55606e; border: 1px solid #dde2e8; }
  296. form.f { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
  297. form.f label { display: flex; flex-direction: column; gap: 3px; color: #555; }
  298. input[type=text], input[type=password], select { padding: 5px 7px; border: 1px solid #ccd2da; border-radius: 4px; font-size: 13px; min-width: 150px; }
  299. button { padding: 6px 16px; border: 0; border-radius: 4px; background: #2b6cb0; color: #fff; font-size: 13px; cursor: pointer; }
  300. .login { max-width: 380px; margin: 80px auto; background: #fff; border: 1px solid #e2e5ea; border-radius: 8px; padding: 26px 28px; }
  301. .login form { display: flex; gap: 8px; margin-top: 14px; }
  302. .login input { flex: 1; }
  303. .err { color: #b3261e; margin-top: 10px; }
  304. .hint { color: #777; }
  305. .mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
  306. .stuhead { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: baseline; }
  307. .stuhead .name { font-size: 16px; font-weight: 600; }
  308. .bad { color: #b3261e; font-weight: 600; }
  309. </style>
  310. </head>
  311. <body>
  312. <%
  313. if (!authed) {
  314. %>
  315. <div class="login">
  316. <h2>学生/家长账号状态排查</h2>
  317. <div class="hint">请输入页面口令后进入。本页仅内部排查使用,只读、无修复功能。</div>
  318. <form method="post" action="DcTroubleshoot.jsp">
  319. <input type="password" name="pwd" placeholder="页面口令" autofocus autocomplete="off">
  320. <button type="submit">进入</button>
  321. </form>
  322. <% if (pwdErr != null) { %><div class="err"><%= esc(pwdErr) %></div><% } %>
  323. </div>
  324. </body>
  325. </html>
  326. <%
  327. return;
  328. }
  329. // ============================ 2. 搜索条件与数据取数 ============================
  330. String pXm = trimToNull(request.getParameter("xm"));
  331. String pRyh = trimToNull(request.getParameter("ryh"));
  332. String pSjh = trimToNull(request.getParameter("sjh"));
  333. String pBjid = trimToNull(request.getParameter("bjid"));
  334. Long pBjidVal = null;
  335. if (pBjid != null) {
  336. try { pBjidVal = Long.valueOf(pBjid); } catch (Exception ignore) { }
  337. }
  338. boolean pAll = "1".equals(request.getParameter("all"));
  339. boolean searched = request.getParameter("xm") != null || request.getParameter("ryh") != null
  340. || request.getParameter("sjh") != null || request.getParameter("bjid") != null
  341. || request.getParameter("all") != null;
  342. boolean hasCond = pXm != null || pRyh != null || pSjh != null || pBjidVal != null;
  343. Connection conn = null;
  344. List<Map<String, Object>> classList = new ArrayList<Map<String, Object>>();
  345. List<Map<String, Object>> stuList = new ArrayList<Map<String, Object>>();
  346. String queryErr = null;
  347. StringBuilder diag = new StringBuilder();
  348. try {
  349. conn = getConn();
  350. // 班级下拉:BJ 中在用班级。
  351. classList = query(conn,
  352. "select b.bjid, b.mc, b.njm, b.dwid, d.mc dwmc"
  353. + " from bj b left join dw d on d.dwid = b.dwid"
  354. + " where b.jlztm = " + JLZTM_use
  355. + " order by b.njm, b.mc");
  356. if (searched && hasCond) {
  357. StringBuilder sql = new StringBuilder();
  358. List<Object> args = new ArrayList<Object>();
  359. sql.append("select * from (select r.ryid, r.xm, r.ryh, r.zh, r.grdh, r.rylbm, r.jlztm, r.ryztm, ")
  360. .append(" case when r.sfqy then 'Y' else 'N' end sfqy_y, r.dlcwcs, ")
  361. .append(" r.dwid, dw.mc dwmc, r.gwid, gw.mc gwmc, r.kaid, r.fzjzid, r.scdlsj, ")
  362. .append(" r.import_mark, r.pic_import_mark, r.src_excel, ")
  363. .append(" b.bjid, b.mc bjmc, b.njm, ")
  364. .append(" (select count(*) from ryka k where k.ryid = r.ryid) ryka_cnt, ")
  365. .append(" (select count(*) from jtcy j where j.ryid = r.ryid) jz_cnt ")
  366. .append(" from ry r ")
  367. .append(" left join bjcy bc on bc.ryid = r.ryid ")
  368. .append(" left join bj b on b.bjid = bc.bjid ")
  369. .append(" left join dw dw on dw.dwid = r.dwid ")
  370. .append(" left join gw gw on gw.gwid = r.gwid ")
  371. .append(" where r.rylbm = ").append(RYLBM_student).append(" ");
  372. if (!pAll) sql.append(" and r.jlztm = ").append(JLZTM_use).append(" ");
  373. if (pXm != null) { sql.append(" and r.xm like ? "); args.add("%" + pXm + "%"); }
  374. if (pRyh != null) { sql.append(" and r.ryh = ? "); args.add(pRyh); }
  375. if (pBjidVal != null) { sql.append(" and b.bjid = ? "); args.add(pBjidVal); }
  376. if (pSjh != null) {
  377. // 手机号反查:学生本人电话/账号/人员号,或家长关系里的手机,或家长账号的手机。
  378. sql.append(" and ( r.ryid in (select ryid from ry where jlztm = ").append(JLZTM_use)
  379. .append(" and (grdh = ? or zh = ? or ryh = ?)) ")
  380. .append(" or r.ryid in (select c.ryid from jtcy c where c.grdh = ?) ")
  381. .append(" or r.ryid in (select c.ryid from jtcy c join ry p on p.ryid = c.jzid")
  382. .append(" where p.grdh = ? or p.zh = ? or p.ryh = ?) ) ");
  383. for (int i = 0; i < 7; i++) args.add(pSjh);
  384. }
  385. sql.append(" order by b.njm, b.mc, r.ryh ) where rownum <= ").append(MAX_STUDENT);
  386. stuList = query(conn, sql.toString(), args.toArray());
  387. }
  388. } catch (Exception e) {
  389. queryErr = e.getClass().getSimpleName() + ": " + e.getMessage();
  390. }
  391. %>
  392. <h1>学生/家长账号状态排查</h1>
  393. <div class="sub">
  394. 按 姓名 / 班级 / 学号 / 手机号 查询学生档案、校卡绑定、权益、家长账号、订阅同步状态。
  395. 本页只读,不含任何修复操作。
  396. <a href="DcTroubleshoot.jsp?do=logout">退出</a>
  397. </div>
  398. <div class="card">
  399. <form class="f" method="get" action="DcTroubleshoot.jsp">
  400. <label>学生姓名<input type="text" name="xm" value="<%= esc(pXm) %>" placeholder="支持模糊,如 林盈盈"></label>
  401. <label>班级
  402. <select name="bjid">
  403. <option value="">(不限)</option>
  404. <%
  405. for (Map<String, Object> c : classList) {
  406. String bjid = cell(c, "bjid");
  407. boolean sel = bjid.equals(pBjid);
  408. %>
  409. <option value="<%= esc(bjid) %>"<%= sel ? " selected" : "" %>><%= esc(cell(c, "mc")) %> · <%= esc(cell(c, "dwmc")) %></option>
  410. <%
  411. }
  412. %>
  413. </select>
  414. </label>
  415. <label>学号<input type="text" name="ryh" value="<%= esc(pRyh) %>" placeholder="精确,如 220118175"></label>
  416. <label>手机号反查<input type="text" name="sjh" value="<%= esc(pSjh) %>" placeholder="家长或学生手机号"></label>
  417. <label>范围
  418. <select name="all">
  419. <option value="">仅在看(在用学员)</option>
  420. <option value="1"<%= pAll ? " selected" : "" %>>含历史/已注销人员</option>
  421. </select>
  422. </label>
  423. <button type="submit">搜索</button>
  424. </form>
  425. </div>
  426. <%
  427. if (queryErr != null) {
  428. %>
  429. <div class="card"><span class="tag tag-danger">查询失败</span> <span class="mono"><%= esc(queryErr) %></span></div>
  430. <%
  431. } else if (searched && hasCond) {
  432. %>
  433. <div class="card">
  434. 命中 <b><%= stuList.size() %></b> 名学生<%= stuList.size() >= MAX_STUDENT ? "(已达上限 " + MAX_STUDENT + ",请缩小条件)" : "" %>。
  435. </div>
  436. <%
  437. if (stuList.isEmpty()) {
  438. %>
  439. <div class="card"><span class="tag tag-info">无结果</span>
  440. 未找到匹配学员。可尝试:确认姓名写法、加上班级、或用学号/手机号精确反查;
  441. 若为已毕业人员,请把“范围”改为“含历史/已注销人员”。
  442. </div>
  443. <%
  444. }
  445. } else if (searched) {
  446. %>
  447. <div class="card"><span class="tag tag-info">请至少填写一个条件</span> 姓名、班级、学号、手机号任填其一。</div>
  448. <%
  449. }
  450. %>
  451. <%
  452. // ============================ 3. 逐个学生的明细 ============================
  453. if (queryErr == null && !stuList.isEmpty()) {
  454. try {
  455. for (Map<String, Object> s : stuList) {
  456. try {
  457. long ryid = lng(cell(s, "ryid"));
  458. String ryh = cell(s, "ryh");
  459. List<Map<String, Object>> parents = query(conn,
  460. "select c.jtcyid, c.jzid, c.xm jtcy_xm, c.grdh jtcy_grdh, c.jtgxm, c.jlztm jtcy_jlztm,"
  461. + " case when c.is_fzjz then 'Y' else 'N' end c_isfzjz,"
  462. + " p.zh p_zh, p.ryh p_ryh, p.grdh p_grdh, p.xm p_xm, p.rylbm p_rylbm, p.jlztm p_jlztm,"
  463. + " case when p.sfqy then 'Y' else 'N' end p_sfqy, p.dlcwcs p_dlcwcs, p.wbid2 p_wbid2,"
  464. + " p.scdlsj p_scdlsj, p.gwid p_gwid, gw.mc p_gwmc, p.dwid p_dwid,"
  465. + " l.mm l_mm, case when l.sfcsmm then 'Y' else 'N' end l_sfcsmm, l.gxsj l_gxsj"
  466. + " from jtcy c"
  467. + " left join ry p on p.ryid = c.jzid"
  468. + " left join gw gw on gw.gwid = p.gwid"
  469. + " left join lsmm l on l.ryid = c.jzid and l.jlztm = " + JLZTM_use
  470. + " where c.ryid = ?"
  471. + " order by c.jzid",
  472. ryid);
  473. List<Map<String, Object>> grfw = query(conn,
  474. "select grfwxmm, zdsc, zdll, zdcs, ljsc, ljll, ljcs, jzsj, jlztm,"
  475. + " case when sfty then 'Y' else 'N' end sfty_y"
  476. + " from grfw where ryid = ? order by grfwxmm",
  477. ryid);
  478. List<Map<String, Object>> ryka = query(conn,
  479. "select k.rykaid, k.kaid, k.jlztm ryka_jlztm,"
  480. + " ka.kah, ka.kaztm, ka.jlztm ka_jlztm, ka.mc ka_mc, ka.yxq"
  481. + " from ryka k left join ka on ka.kaid = k.kaid"
  482. + " where k.ryid = ? order by k.rykaid",
  483. ryid);
  484. List<Map<String, Object>> kaidCard = new ArrayList<Map<String, Object>>();
  485. String kaid = cell(s, "kaid");
  486. if (!kaid.isEmpty()) {
  487. kaidCard = query(conn,
  488. "select kaid, kah, kaztm, jlztm, yxq, mc from ka where kaid = ?",
  489. lng(kaid));
  490. }
  491. List<Map<String, Object>> makeCards = new ArrayList<Map<String, Object>>();
  492. if (!ryh.isEmpty()) {
  493. makeCards = query(conn,
  494. "select j.ryjhsjid, j.ryh, j.kah, j.bdsj, j.nfch, j.jlztm,"
  495. + " (select count(*) from xfjsjjh x where x.ryjhsjid = j.ryjhsjid and x.jlztm = " + JLZTM_use + ") sx_all,"
  496. + " (select count(*) from xfjsjjh x where x.ryjhsjid = j.ryjhsjid and x.jlztm = " + JLZTM_use
  497. + " and case when x.sfygx then 1 else 0 end = 1) sx_ok,"
  498. + " (select count(*) from ka k2 where k2.kah = j.kah) kh_in_ka"
  499. + " from ryjhsj j where j.ryh = ? order by j.bdsj desc",
  500. ryh);
  501. }
  502. List<Map<String, Object>> subs = query(conn,
  503. "select application_no, student_name, guardian_name, guardian_mobile, grade_name, class_name,"
  504. + " application_status, sync_status, pms_ryid, pms_jzid, paid_at, pay_order_no,"
  505. + " selected_package_name, amount_paid_cent, channel_code, remark, created_at"
  506. + " from c##dc_py.pp_application"
  507. + " where pms_ryid = ?"
  508. + " or pms_jzid in (select jzid from jtcy where ryid = ? and jzid is not null)"
  509. + " or guardian_mobile in (select grdh from jtcy where ryid = ? and grdh is not null)"
  510. + " or guardian_mobile in (select p.grdh from jtcy c join ry p on p.ryid = c.jzid"
  511. + " where c.ryid = ? and p.grdh is not null)"
  512. + " order by paid_at desc nulls last",
  513. ryid, ryid, ryid, ryid);
  514. List<Map<String, Object>> syncTasks = query(conn,
  515. "select application_no, sync_status, note, pms_ryid, pms_jzid, last_sync_at, updated_at"
  516. + " from c##dc_py.pp_sync_task"
  517. + " where pms_ryid = ?"
  518. + " or pms_jzid in (select jzid from jtcy where ryid = ? and jzid is not null)"
  519. + " order by updated_at desc nulls last",
  520. ryid, ryid);
  521. // ---- 手机号重复检查 ----
  522. Set<String> phones = new LinkedHashSet<String>();
  523. if (isPhone(cell(s, "grdh"))) phones.add(cell(s, "grdh").trim());
  524. if (isPhone(cell(s, "zh"))) phones.add(cell(s, "zh").trim());
  525. for (Map<String, Object> p : parents) {
  526. String ph = cell(p, "jtcy_grdh");
  527. if (ph.isEmpty()) ph = cell(p, "p_grdh");
  528. if (isPhone(ph)) phones.add(ph.trim());
  529. }
  530. Map<String, Integer> phoneAccounts = new LinkedHashMap<String, Integer>();
  531. for (String ph : phones) {
  532. List<Map<String, Object>> cnt = query(conn,
  533. "select count(*) cnt from ("
  534. + " select ryid from ry where jlztm = " + JLZTM_use + " and (grdh = ? or zh = ? or ryh = ?)"
  535. + " union"
  536. + " select jzid from jtcy where grdh = ? and jzid is not null"
  537. + " )",
  538. ph, ph, ph, ph);
  539. phoneAccounts.put(ph, cnt.isEmpty() ? 0 : (int) lng(cnt.get(0).get("cnt")));
  540. }
  541. // ---- 诊断标签 ----
  542. List<String> tags = new ArrayList<String>();
  543. String gwid = cell(s, "gwid");
  544. boolean gwidEmpty = gwid.isEmpty() || "0".equals(gwid);
  545. if (gwidEmpty) tags.add(tag("tag-danger", "岗位GWID为空 → 登录/刷卡会报500"));
  546. if (cell(s, "dwid").isEmpty()) tags.add(tag("tag-warn", "DWID(单位)为空"));
  547. if (cell(s, "bjmc").isEmpty()) tags.add(tag("tag-warn", "未分班(无班级记录)"));
  548. if (!"Y".equalsIgnoreCase(cell(s, "sfqy_y"))) tags.add(tag("tag-warn", "账号未启用(SFQY=N)"));
  549. if (lng(cell(s, "dlcwcs")) > 0) tags.add(tag("tag-warn", "登录错误次数=" + num(cell(s, "dlcwcs"))));
  550. if (kaid.isEmpty() && ryka.isEmpty()) {
  551. tags.add(tag("tag-danger", "卡未绑定(RY.KAID空且RYKA无记录) → 刷卡提示“卡无登记”"));
  552. } else if (kaid.isEmpty() && !ryka.isEmpty()) {
  553. tags.add(tag("tag-warn", "RY.KAID为空但有RYKA绑定记录,档案主卡未设置"));
  554. }
  555. if (!makeCards.isEmpty() && kaid.isEmpty()) {
  556. tags.add(tag("tag-warn", "有制卡记录(" + makeCards.size() + "条)但未绑定到档案"));
  557. }
  558. if (!makeCards.isEmpty()) {
  559. long sxAll = lng(makeCards.get(0).get("sx_all"));
  560. long sxOk = lng(makeCards.get(0).get("sx_ok"));
  561. // 说明:实测多数卡的“已更新”数量为 23/39 等 <100%,属常态,不影响刷卡登录,
  562. // 因此只在“一台都没下发”时报黄,其余只作中性提示,避免误导排查。
  563. if (sxOk == 0) tags.add(tag("tag-warn", "最新卡未下发到任何消费机"));
  564. else if (sxOk < sxAll) tags.add(tag("tag-info", "最新卡已下发 " + sxOk + "/" + sxAll + " 台(常态,通常不影响刷卡)"));
  565. if (lng(makeCards.get(0).get("kh_in_ka")) == 0) tags.add(tag("tag-warn", "最新制卡卡号不在 KA 卡库中"));
  566. }
  567. int grfwFound = 0;
  568. boolean grfwAllExpired = !grfw.isEmpty();
  569. Date now = new Date();
  570. for (Map<String, Object> g : grfw) {
  571. grfwFound++;
  572. Object jzsj = g.get("jzsj");
  573. if (!(jzsj instanceof Date) || ((Date) jzsj).after(now)) grfwAllExpired = false;
  574. }
  575. if (grfw.isEmpty()) {
  576. tags.add(tag("tag-danger", "无任何权益记录(GRFW为空) → 电话/留言/语音均不可用"));
  577. } else {
  578. if (grfwFound < GRFW_ITEM_COUNT) tags.add(tag("tag-warn", "权益不完整:" + grfwFound + "/" + GRFW_ITEM_COUNT + " 项"));
  579. if (grfwAllExpired) tags.add(tag("tag-danger", "权益已全部到期"));
  580. }
  581. for (Map<String, Object> p : parents) {
  582. long jzid = lng(p.get("jzid"));
  583. if (jzid == 0) { tags.add(tag("tag-warn", "存在未绑定家长的 JTCY 记录")); continue; }
  584. if (!sauthCacheExists(jzid)) tags.add(tag("tag-warn", "家长" + jzid + "缺权限缓存(rygw) → 小程序看不到入口"));
  585. if ("Y".equalsIgnoreCase(cell(p, "l_sfcsmm"))) tags.add(tag("tag-warn", "家长" + jzid + "仍标记为初始密码 → 登录会被要求改密"));
  586. if (cell(p, "p_gwid").isEmpty()) tags.add(tag("tag-warn", "家长" + jzid + "岗位为空"));
  587. }
  588. if (parents.isEmpty()) tags.add(tag("tag-info", "无家长关系记录(JTCY为空)"));
  589. for (Map.Entry<String, Integer> e : phoneAccounts.entrySet()) {
  590. if (e.getValue() > 1) {
  591. tags.add(tag("tag-warn", "手机号 " + e.getKey() + " 命中 " + e.getValue() + " 个账号 → 一键登录会提示多个账号"));
  592. }
  593. }
  594. boolean anySub = false;
  595. for (Map<String, Object> a : subs) {
  596. anySub = true;
  597. String syncStatus = cell(a, "sync_status");
  598. if (!"SUCCESS".equalsIgnoreCase(syncStatus)) {
  599. tags.add(tag("tag-warn", "订阅未同步 " + cell(a, "application_no")
  600. + ":" + (syncStatus.isEmpty() ? "PENDING" : syncStatus)));
  601. }
  602. }
  603. if (!anySub) tags.add(tag("tag-info", "按 学生RYID/家长JZID/手机号 未匹配到订阅申请"));
  604. %>
  605. <div class="card stu">
  606. <div class="stuhead">
  607. <span class="name"><%= esc(cell(s, "xm")) %></span>
  608. <span>学号 <b class="mono"><%= esc(ryh) %></b></span>
  609. <span>班级 <b><%= esc(cell(s, "bjmc")) %></b></span>
  610. <span class="mono">RYID <%= esc(cell(s, "ryid")) %></span>
  611. <span>单位 <%= esc(cell(s, "dwmc")) %></span>
  612. </div>
  613. <div class="block">
  614. <h3>诊断结论</h3>
  615. <div><%= tags.isEmpty() ? tag("tag-ok", "未发现异常") : String.join("", tags) %></div>
  616. </div>
  617. <div class="block">
  618. <h3>1. 学生档案</h3>
  619. <div class="kv">
  620. <div><b>RYID:</b><span class="mono"><%= esc(cell(s, "ryid")) %></span></div>
  621. <div><b>姓名:</b><%= esc(cell(s, "xm")) %></div>
  622. <div><b>学号:</b><span class="mono"><%= esc(ryh) %></span></div>
  623. <div><b>班级:</b><%= esc(cell(s, "bjmc")) %>(NJM <%= esc(cell(s, "njm")) %>)</div>
  624. <div><b>账号ZH:</b><%= esc(cell(s, "zh")) %></div>
  625. <div><b>个人电话GRDH:</b><%= esc(cell(s, "grdh")) %></div>
  626. <div><b>人员类别RYLBM:</b><%= esc(cell(s, "rylbm")) %></div>
  627. <div><b>记录状态JLZTM:</b><%= esc(cell(s, "jlztm")) %><%= JLZTM_use == lng(cell(s, "jlztm")) ? "(在用)" : "" %></div>
  628. <div><b>人员状态RYZTM:</b><%= esc(cell(s, "ryztm")) %></div>
  629. <div><b>是否启用SFQY:</b><%= yn(cell(s, "sfqy_y")) %></div>
  630. <div><b>登录错误次数:</b><%= esc(cell(s, "dlcwcs")) %></div>
  631. <div><b>单位DWID:</b><%= esc(cell(s, "dwid")) %> <%= esc(cell(s, "dwmc")) %></div>
  632. <div><b>岗位GWID:</b><%= esc(gwid) %> <%= esc(cell(s, "gwmc")) %><%= gwidEmpty ? tag("tag-danger", "为空") : "" %></div>
  633. <div><b>部门BMID:</b><%= esc(cell(s, "bmid")) %></div>
  634. <div><b>负责家长FZJZID:</b><span class="mono"><%= esc(cell(s, "fzjzid")) %></span></div>
  635. <div><b>上次登录SCDLSJ:</b><%= dtm(s, "scdlsj") %></div>
  636. <div><b>导入标记IMPORT_MARK:</b><%= esc(cell(s, "import_mark")) %></div>
  637. <div><b>照片导入标记:</b><%= esc(cell(s, "pic_import_mark")) %></div>
  638. <div><b>来源表SRC_EXCEL:</b><%= esc(cell(s, "src_excel")) %></div>
  639. </div>
  640. </div>
  641. <div class="block">
  642. <h3>2. 校卡绑定</h3>
  643. <table>
  644. <tr><th>来源</th><th>KAID</th><th>卡号KAH</th><th>卡状态KAZTM</th><th>有效期YXQ</th><th>在用状态</th><th>备注</th></tr>
  645. <tr>
  646. <td>RY.KAID(档案主卡)</td>
  647. <td><%= esc(kaid) %></td>
  648. <td><%= kaidCard.isEmpty() ? "" : esc(cell(kaidCard.get(0), "kah")) %></td>
  649. <td><%= kaidCard.isEmpty() ? "" : esc(cell(kaidCard.get(0), "kaztm")) %></td>
  650. <td><%= kaidCard.isEmpty() ? "" : dtm(kaidCard.get(0), "yxq") %></td>
  651. <td><%= kaidCard.isEmpty() ? "" : esc(cell(kaidCard.get(0), "jlztm")) %></td>
  652. <td><%= kaid.isEmpty() ? "<span class=\"bad\">未设置</span>" : "" %></td>
  653. </tr>
  654. <%
  655. for (Map<String, Object> k : ryka) {
  656. %>
  657. <tr>
  658. <td>RYKA 绑定</td>
  659. <td><%= esc(cell(k, "kaid")) %></td>
  660. <td><%= esc(cell(k, "kah")) %></td>
  661. <td><%= esc(cell(k, "kaztm")) %></td>
  662. <td><%= dtm(k, "yxq") %></td>
  663. <td>RYKA <%= esc(cell(k, "ryka_jlztm")) %> / 卡 <%= esc(cell(k, "ka_jlztm")) %></td>
  664. <td>RYKAID <%= esc(cell(k, "rykaid")) %></td>
  665. </tr>
  666. <%
  667. }
  668. if (ryka.isEmpty()) {
  669. %>
  670. <tr><td>RYKA 绑定</td><td colspan="6"><span class="bad">无绑定记录</span></td></tr>
  671. <%
  672. }
  673. %>
  674. </table>
  675. <div class="hint" style="margin-top:6px">
  676. 制卡记录(来自打印机项目,按学号):共 <%= makeCards.size() %> 条;“下发”= 该卡号推送到多少台消费机。
  677. </div>
  678. <table style="margin-top:6px">
  679. <tr><th>制卡ID</th><th>学号</th><th>卡号</th><th>制卡时间</th><th>房号NFCH</th><th>在KA卡库</th><th>下发(已更新/总数)</th></tr>
  680. <%
  681. for (Map<String, Object> m : makeCards) {
  682. %>
  683. <tr>
  684. <td class="mono"><%= esc(cell(m, "ryjhsjid")) %></td>
  685. <td class="mono"><%= esc(cell(m, "ryh")) %></td>
  686. <td class="mono"><%= esc(cell(m, "kah")) %></td>
  687. <td><%= dtm(m, "bdsj") %></td>
  688. <td><%= esc(cell(m, "nfch")) %></td>
  689. <td><%= lng(cell(m, "kh_in_ka")) > 0 ? "是" : "<span class=\"bad\">否</span>" %></td>
  690. <td><%= num(cell(m, "sx_ok")) %> / <%= num(cell(m, "sx_all")) %></td>
  691. </tr>
  692. <%
  693. }
  694. if (makeCards.isEmpty()) {
  695. %>
  696. <tr><td colspan="7">无制卡记录</td></tr>
  697. <%
  698. }
  699. %>
  700. </table>
  701. </div>
  702. <div class="block">
  703. <h3>3. 服务权益(GRFW)</h3>
  704. <table>
  705. <tr><th>项目</th><th>ZDSC</th><th>LJSC</th><th>ZDLL</th><th>LJLL</th><th>ZDCS</th><th>LJCS</th><th>JZSJ 截止</th><th>停用SFTY</th><th>在用状态</th></tr>
  706. <%
  707. for (Map<String, Object> g : grfw) {
  708. Object jzsj = g.get("jzsj");
  709. boolean expired = (jzsj instanceof Date) && !((Date) jzsj).after(new Date());
  710. %>
  711. <tr>
  712. <td><%= esc(grfwName(lng(g.get("grfwxmm")))) %></td>
  713. <td><%= num(g.get("zdsc")) %></td>
  714. <td><%= num(g.get("ljsc")) %></td>
  715. <td><%= num(g.get("zdll")) %></td>
  716. <td><%= num(g.get("ljll")) %></td>
  717. <td><%= num(g.get("zdcs")) %></td>
  718. <td><%= num(g.get("ljcs")) %></td>
  719. <td><%= dt(jzsj) %><%= expired ? " " + tag("tag-danger", "已过期") : "" %></td>
  720. <td><%= yn(cell(g, "sfty_y")) %></td>
  721. <td><%= esc(cell(g, "jlztm")) %></td>
  722. </tr>
  723. <%
  724. }
  725. if (grfw.isEmpty()) {
  726. %>
  727. <tr><td colspan="10"><span class="bad">无任何权益记录</span></td></tr>
  728. <%
  729. }
  730. %>
  731. </table>
  732. </div>
  733. <div class="block">
  734. <h3>4. 家长账号(JTCY → RY)</h3>
  735. <table>
  736. <tr>
  737. <th>家长RYID</th><th>姓名</th><th>账号ZH</th><th>手机GRDH</th><th>关系</th><th>负责家长</th>
  738. <th>类别</th><th>JLZTM</th><th>启用</th><th>微信绑定</th><th>末次登录</th>
  739. <th>岗位GWID</th><th>在用密码(前8位)</th><th>初始密码标记</th><th>密码更新时间</th><th>权限缓存rygw</th>
  740. </tr>
  741. <%
  742. for (Map<String, Object> p : parents) {
  743. long jzid = lng(p.get("jzid"));
  744. String lMm = cell(p, "l_mm");
  745. boolean initPwd = "Y".equalsIgnoreCase(cell(p, "l_sfcsmm"));
  746. boolean cacheOk = jzid > 0 && sauthCacheExists(jzid);
  747. String pName = cell(p, "p_xm");
  748. if (pName.isEmpty()) pName = cell(p, "jtcy_xm");
  749. String pPhone = cell(p, "p_grdh");
  750. if (pPhone.isEmpty()) pPhone = cell(p, "jtcy_grdh");
  751. %>
  752. <tr>
  753. <td class="mono"><%= esc(cell(p, "jzid")) %></td>
  754. <td><%= esc(pName) %></td>
  755. <td><%= esc(cell(p, "p_zh")) %></td>
  756. <td><%= esc(pPhone) %></td>
  757. <td><%= esc(cell(p, "jtgxm")) %></td>
  758. <td><%= yn(cell(p, "c_isfzjz")) %></td>
  759. <td><%= esc(cell(p, "p_rylbm")) %></td>
  760. <td><%= esc(cell(p, "p_jlztm")) %></td>
  761. <td><%= yn(cell(p, "p_sfqy")) %></td>
  762. <td><%= cell(p, "p_wbid2").isEmpty() ? "未绑定" : "已绑定" %></td>
  763. <td><%= dtm(p, "p_scdlsj") %></td>
  764. <td><%= esc(cell(p, "p_gwid")) %> <%= esc(cell(p, "p_gwmc")) %></td>
  765. <td class="mono"><%= lMm.isEmpty() ? "(无LSMM在用行)" : esc(lMm.substring(0, Math.min(8, lMm.length()))) %></td>
  766. <td><%= initPwd ? tag("tag-warn", "是") : "否" %></td>
  767. <td><%= dtm(p, "l_gxsj") %></td>
  768. <td><%= jzid == 0 ? tag("tag-info", "无家长") : (cacheOk ? tag("tag-ok", "存在") : tag("tag-warn", "缺失")) %></td>
  769. </tr>
  770. <%
  771. }
  772. if (parents.isEmpty()) {
  773. %>
  774. <tr><td colspan="16">无家长关系记录</td></tr>
  775. <%
  776. }
  777. %>
  778. </table>
  779. </div>
  780. <div class="block">
  781. <h3>5. 订阅记录(c##dc_py.pp_application)</h3>
  782. <table>
  783. <tr><th>申请号</th><th>学生</th><th>家长/手机</th><th>填写班级</th><th>套餐</th><th>金额(分)</th>
  784. <th>申请状态</th><th>同步状态</th><th>支付时间</th><th>PMS_RYID</th><th>PMS_JZID</th><th>渠道</th><th>交易号</th></tr>
  785. <%
  786. for (Map<String, Object> a : subs) {
  787. boolean okSync = "SUCCESS".equalsIgnoreCase(cell(a, "sync_status"));
  788. String ss = cell(a, "sync_status");
  789. %>
  790. <tr>
  791. <td class="mono"><%= esc(cell(a, "application_no")) %></td>
  792. <td><%= esc(cell(a, "student_name")) %></td>
  793. <td><%= esc(cell(a, "guardian_name")) %> <%= esc(cell(a, "guardian_mobile")) %></td>
  794. <td><%= esc(cell(a, "grade_name")) %> <%= esc(cell(a, "class_name")) %></td>
  795. <td><%= esc(cell(a, "selected_package_name")) %></td>
  796. <td><%= num(cell(a, "amount_paid_cent")) %></td>
  797. <td><%= esc(cell(a, "application_status")) %></td>
  798. <td><%= okSync ? tag("tag-ok", "SUCCESS") : tag("tag-warn", ss.isEmpty() ? "PENDING" : ss) %></td>
  799. <td><%= dtm(a, "paid_at") %></td>
  800. <td class="mono"><%= esc(cell(a, "pms_ryid")) %></td>
  801. <td class="mono"><%= esc(cell(a, "pms_jzid")) %></td>
  802. <td><%= esc(cell(a, "channel_code")) %></td>
  803. <td class="mono"><%= esc(cell(a, "pay_order_no")) %></td>
  804. </tr>
  805. <%
  806. }
  807. if (subs.isEmpty()) {
  808. %>
  809. <tr><td colspan="13">未匹配到订阅申请(按 学生RYID / 家长JZID / 家长手机号 三路匹配)</td></tr>
  810. <%
  811. }
  812. %>
  813. </table>
  814. <%
  815. if (!syncTasks.isEmpty()) {
  816. %>
  817. <div class="hint" style="margin-top:6px">同步任务(c##dc_py.pp_sync_task):</div>
  818. <table style="margin-top:4px">
  819. <tr><th>申请号</th><th>同步状态</th><th>说明NOTE</th><th>PMS_RYID</th><th>PMS_JZID</th><th>最后同步</th></tr>
  820. <%
  821. for (Map<String, Object> t : syncTasks) {
  822. %>
  823. <tr>
  824. <td class="mono"><%= esc(cell(t, "application_no")) %></td>
  825. <td><%= esc(cell(t, "sync_status")) %></td>
  826. <td><%= esc(cell(t, "note")) %></td>
  827. <td class="mono"><%= esc(cell(t, "pms_ryid")) %></td>
  828. <td class="mono"><%= esc(cell(t, "pms_jzid")) %></td>
  829. <td><%= dtm(t, "last_sync_at") %></td>
  830. </tr>
  831. <%
  832. }
  833. %>
  834. </table>
  835. <%
  836. }
  837. %>
  838. </div>
  839. <div class="block">
  840. <h3>6. 手机号重复检查</h3>
  841. <table>
  842. <tr><th>手机号</th><th>命中账号数</th><th>判定</th></tr>
  843. <%
  844. for (Map.Entry<String, Integer> e : phoneAccounts.entrySet()) {
  845. boolean dup = e.getValue() > 1;
  846. %>
  847. <tr>
  848. <td class="mono"><%= esc(e.getKey()) %></td>
  849. <td><%= e.getValue() %></td>
  850. <td><%= dup ? tag("tag-warn", "一号多账号,一键登录会提示“该手机号对应多个账号”") : tag("tag-ok", "正常") %></td>
  851. </tr>
  852. <%
  853. }
  854. if (phoneAccounts.isEmpty()) {
  855. %>
  856. <tr><td colspan="3">无手机号可比对</td></tr>
  857. <%
  858. }
  859. %>
  860. </table>
  861. <div class="hint" style="margin-top:6px">
  862. 命中账号数 = 在用人员的 账号/人员号/个人电话 命中数 ∪ 家长关系表中该手机对应的 JZID 数。
  863. </div>
  864. </div>
  865. </div>
  866. <%
  867. } catch (Exception ex) {
  868. %>
  869. <div class="card stu">
  870. <span class="tag tag-danger">该学生明细查询失败</span>
  871. <span class="mono"><%= esc(cell(s, "xm")) %> / RYID <%= esc(cell(s, "ryid")) %> / <%= esc(ex.toString()) %></span>
  872. </div>
  873. <%
  874. }
  875. }
  876. } catch (Exception e) {
  877. diag.append(e.getClass().getSimpleName()).append(": ").append(txt(e.getMessage()));
  878. }
  879. }
  880. if (conn != null) {
  881. try { conn.close(); } catch (Exception ignore) { }
  882. }
  883. %>
  884. <%
  885. if (diag.length() > 0) {
  886. %>
  887. <div class="card"><span class="tag tag-danger">明细查询异常</span> <span class="mono"><%= esc(diag.toString()) %></span></div>
  888. <%
  889. }
  890. %>
  891. </body>
  892. </html>