cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package cn.ksource.web.controller.business.pages;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.beans.GG_USER;
import cn.ksource.core.dao.BaseDao;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.web.LoginUser;
import cn.ksource.core.web.SysInfo;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.SysConstants;
import cn.ksource.web.facade.BusinessFacade;
 
 
@Controller
@RequestMapping("/business/pages/")
public class PagesController {
    
    @Autowired
    private BusinessFacade businessFacade;
    
    
    
    @Resource(name="baseDao")
    private BaseDao baseDao;
 
    @RequestMapping(value="desktop.html")
    public String desktop(HttpServletRequest request,HttpServletResponse response,ModelMap map){
        String path = "/business/pages/desktop";
        //得到当前用户信息,判断是否是领导
        /*LoginUser user =WebUtil.getLoginUser(request);
        String type =String.valueOf(user.getLoginUser().get("ACCOUNTTYPE"));
        System.out.println("................" + type);
        map.put("time", DateUtil.getPrevMonth("yyyy-MM"));
        String area =String.valueOf(user.getLoginUser().get("AREA_ID"));
            map.put("zhibiao","2fd257b556934669a3a7e1075db405cb");
            map.put("area",area);
            
        List<Map> newsList = newsFacade.getNewsList(7);
        map.put("newsList", newsList);
        map.put("dbgzList", reportFacade.getDbgzList());*/
        //查询(注意区域统计)
         /*上报情况:应报 实报 未报 待审核数 上报类型:正常上报,数据补报,数据修改 异常数据:异常数据*/
       // String year =String.valueOf(DateUtil.getYear());
        String[] date = String.valueOf(DateUtil.getPrevMonth("yyyy-MM")).split("-");
        Map<String,String> paramMap = new HashMap<String, String>();
        return path;
    }
    
    @RequestMapping("main.html")
    public ModelAndView onMainPageLoad(HttpServletRequest request){
        
        List<Map> yjgnList = WebUtil.getLoginUser(request).getYjgnList();
        Map map = new HashMap();
        
        map.put("yjgnList", yjgnList);
        map.put("user",WebUtil.getLoginUser(request).getLoginUser());
        LoginUser user =WebUtil.getLoginUser(request);
        String type =String.valueOf(user.getLoginUser().get("ACCOUNTTYPE"));
        System.out.println("................" + type);
        map.put("time", DateUtil.getPrevMonth("yyyy-MM"));
        String area =String.valueOf(user.getLoginUser().get("AREA_ID"));
        
        ModelAndView view=new ModelAndView("/business/pages/main");
        view.addObject("info",map);
        
        return view;
    }
    @RequestMapping("left.html")
    public ModelAndView onLeftPageLoad(HttpServletRequest request){
        String menuid = request.getParameter("menuid");
        //List<Map> menuList = WebUtil.getLoginUser(request).getGnList(menuid);
        //return new ModelAndView("/business/pages/left","menuList",menuList);
        return new ModelAndView("/business/pages/left");
    }
    /**
     * 我的信息
     * @param request
     * @param response
     * @return
     * @version V1.0.0
     * @author 杨凯
     * @date Jan 14, 2014 3:44:45 PM
     */
    @RequestMapping("MyInfo.html")
    public ModelAndView onMyInfoLoad(HttpServletRequest request,HttpServletResponse response){
        Map info = new GG_USER(WebUtil.getLoginedUserId(request)).getBeanMapById();
        return new ModelAndView("/business/pages/MyInfo","info",info);
    }
    
    
    
    @RequestMapping("changePwd.html")
    public ModelAndView onchangePwdLoad(HttpServletRequest request){
        System.out.println("onchangePwdLoad 24");
        
        try {
            //Thread.currentThread().sleep(5000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return new ModelAndView("/business/pages/changePwd");
    }
    
    @RequestMapping("changePwdSubmit.html")
    public ModelAndView onchangePwdSubmit(HttpServletRequest request){
        String oldPwd = request.getParameter("oldPwd");
        String newPwd = request.getParameter("newPwd");
        String userid = WebUtil.getLoginedUserId(request);
        boolean result = businessFacade.updateUserPwd(userid, oldPwd, newPwd);
        if (!result) {
            return WebUtil.goSysInfoPage(request,"原有密码不正确,请重新输入!","",SysInfo.Error);
        }
        return WebUtil.goSysInfoPage(request,"操作成功!",
                "window.top.closeDialog(0);",
                SysInfo.Success);
    }
    
    @RequestMapping("logout.html")
    public ModelAndView onLogOut(HttpServletRequest request,HttpServletResponse response){
        response.setHeader("Cache-Control", "no-cache");
        HttpSession session = request.getSession();
        session.removeAttribute(SysConstants.LOGIN_INFO_KEY);
        session.invalidate();
        return new ModelAndView("/business/LoginFailure",SysConstants.login_Failure_Err_Message,"正在退出登录...");
    }
    
    /**
     * 中间跳转界面
     */
    @RequestMapping("{id}/jump.html")
    public ModelAndView jump(@PathVariable("id") String id,HttpServletRequest request) {
        LoginUser loginUser = WebUtil.getLoginUser(request);
        Map ejgnMap = loginUser.getEjgnMap();
        if(null!=ejgnMap && ejgnMap.size()>0) {
            if(ejgnMap.containsKey(id)) {
                Object object = ejgnMap.get(id);
                if(null != object) {
                    Map ejMap = (Map)object;
                    if(null!=ejMap && ejMap.size()>0) {
                        Object obj = ejMap.get("MENULIST");
                        if(null!=obj) {
                            List<Map> list = (List)obj;
                            
                            if(list.size()>0) {
                                Map map = list.get(0);
                                String url = ConvertUtil.obj2StrBlank(map.get("ADDRESS"));
                                ModelAndView modelAndView = new ModelAndView("redirect:"+url);
                                return modelAndView;
                                /*String gnmc = ConvertUtil.obj2StrBlank(ejMap.get("GNMC"));
                                modelAndView.addObject("sjs", list);
                                modelAndView.addObject("gnmc", gnmc);
                                */
                            }
                            
                            
                        }
                    }
                }
            }
        }
        ModelAndView modelAndView = new ModelAndView("/business/nopermission");
        return modelAndView;
    }
    
}