<%@ page import="com.engine.email.entity.EmailFlockSendAccountComInfo" %> <%@ page import="com.alibaba.fastjson.JSONObject" %> <%@ page import="weaver.hrm.User" %> <%@ page import="weaver.hrm.HrmUserVarify" %> <%@ page import="weaver.conn.RecordSet" %> <%@ page import="java.time.LocalDate" %> <%@ page import="java.time.format.DateTimeFormatter" %> <%@ page import="weaver.general.Util" %> <%@page contentType="text/html; charset=UTF-8" %> <% User user = HrmUserVarify.getUser(request, response); RecordSet rs = new RecordSet(); JSONObject result = new JSONObject(); JSONObject record = new JSONObject(); try { String currentDate = getCurrentDate(); String sql = " select * from uf_homePageDialo " + " where id = (" + " select max(id) from uf_homePageDialo" + " where startDate <= ? and endDate >= ?" + " ) "; rs.executeQuery(sql,currentDate,currentDate); String id = ""; String imgUrl = ""; String openUrl = ""; boolean isdialog = true; if (rs.next()){ id = Util.null2String(rs.getString("id")); imgUrl = Util.null2String(rs.getString("imgUrl")); openUrl = Util.null2String(rs.getString("openUrl")); } if(!"".equals(id)){ sql = "select count(1) as sl from uf_homePageDialo_dt1 where mainid = ? and userid = ? "; rs.executeQuery(sql,id,user.getUID()); while (rs.next()){ if(Util.getIntValue(rs.getString("sl"))>0){ isdialog = false; } } }else{ isdialog = false; } record.put("isdialog",isdialog); record.put("id",id); record.put("imgUrl",imgUrl); record.put("openUrl",openUrl); result.put("data", record); result.put("api_status", true); }catch (Exception e){ e.printStackTrace(); result.put("api_status", false); result.put("api_errormsg", "getVersionInfo catch exception : " + e.getMessage()); } out.print(JSONObject.toJSONString(result)); %> <%! /** * 获取当前日期,格式为 yyyy-MM-dd * @return 当前日期的字符串 */ public static String getCurrentDate() { // 获取当前日期 LocalDate currentDate = LocalDate.now(); // 定义日期格式 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 格式化日期为 yyyy-MM-dd 格式的字符串 return currentDate.format(formatter); } %>