| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.pojo.DocUser; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | public static String time_yyyyMMdd = "yyyy-MM-dd"; |
| | | public static SimpleDateFormat sdfwithOutday = new SimpleDateFormat("yyyy_MM"); |
| | | public static SimpleDateFormat sdfwithday = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | public static SimpleDateFormat sdfwithFTP = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); |
| | | public static SimpleDateFormat sdfwithALL = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | /* |
| | | * 获取HttpServletRequest |
| | | */ |
| | |
| | | msg = sdf.format(time); |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * |
| | |
| | | * |
| | | * @return 获取当前session 中的用户对象 |
| | | */ |
| | | public static UserInf getUser(){ |
| | | public static DocUser getUser(){ |
| | | HttpSession session =getSession(); |
| | | Object obj=session.getAttribute("user"); |
| | | UserInf userInf = new UserInf(); |
| | | DocUser userInf = new DocUser(); |
| | | if(obj==null){ |
| | | userInf.setUName("未登录的用户账号"); |
| | | userInf.setUId(0L); |
| | | userInf.setURole(0); |
| | | userInf.setName("未登录的用户账号"); |
| | | userInf.setId(0L); |
| | | userInf.setRoleId("0"); |
| | | }else{ |
| | | userInf=(UserInf) session.getAttribute("user"); |
| | | userInf=(DocUser) session.getAttribute("user"); |
| | | } |
| | | return userInf; |
| | | } |
| | |
| | | smdate=sdf.parse(sdf.format(smdate)); |
| | | bdate=sdf.parse(sdf.format(bdate)); |
| | | } catch (ParseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | |
| | | smdate=sdf.parse(sdf.format(smdate)); |
| | | bdate=sdf.parse(sdf.format(bdate)); |
| | | } catch (ParseException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | Calendar cal = Calendar.getInstance(); |