| | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonSyntaxException; |
| | | import com.whyc.pojo.UserInf; |
| | | import org.springframework.web.context.ContextLoader; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | |
| | | * |
| | | * @return 获取当前session 中的用户对象 |
| | | */ |
| | | /*public static Object getUser(){ |
| | | public static Object getUser(){ |
| | | HttpSession session =getSession(); |
| | | Object obj=session.getAttribute("user"); |
| | | User_inf user_inf = new User_inf(); |
| | | UserInf userInf = new UserInf(); |
| | | if(obj==null){ |
| | | user_inf.setUName("superuser"); |
| | | user_inf.setUId(1002); |
| | | userInf.setUName("superuser"); |
| | | userInf.setUId(1002L); |
| | | }else{ |
| | | user_inf=(User_inf) session.getAttribute("user"); |
| | | userInf=(UserInf) session.getAttribute("user"); |
| | | } |
| | | return user_inf; |
| | | }*/ |
| | | return userInf; |
| | | } |
| | | |
| | | //获取某年某月的起始和结束时间 |
| | | //需要注意的是:月份是从0开始的,比如说如果输入5的话,实际上显示的是4月份的最后一天,千万不要搞错了哦 |