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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package cn.ksource.web.controller.wechat.uwyw;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
 
import cn.ksource.beans.SC_WORKFLOW_CI_HEALTH;
import cn.ksource.core.util.ConvertUtil;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
import cn.ksource.web.facade.health.HealthFacade;
import cn.ksource.web.facade.wechat.uwyw.UHealthFacade;
 
@Controller
@RequestMapping("/uwyw/uHealth")
public class UHealthControler {
    @Autowired
    UHealthFacade uHealthFacade;
    @Autowired
    HealthFacade healthFacade;
    /**
     * 跳转到所有健康检查工单页面
     */
    @RequestMapping("uHealth.html")
    public ModelAndView ewHealth(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealth");
        //查询工单状态
        Map<String, String> state = Constants.mapWORKFLOW_BASE_WFSTATE_PART;
        List status = new ArrayList();
        for (Map.Entry<String, String> entry : state.entrySet()) {  
            String key = entry.getKey();
            String value = entry.getValue();
            Map map = new HashMap();
            map.put("state", key);
            map.put("stateName", value);
            status.add(map);
        }
        //查询健康检查所有环节
        Map<String, String> node = Constants.healthNode;
        List nodes = new ArrayList();
        for (Map.Entry<String, String> entry : node.entrySet()) {  
            String key = entry.getKey();
            String value = entry.getValue();
            Map map = new HashMap();
            map.put("nodeId", key);
            map.put("nodeName", value);
            nodes.add(map);
        }
        modelAndView.addObject("nodes", nodes);
        modelAndView.addObject("status", status);
        return modelAndView;
    }
    /**
     * 查询工单列表
     */
    @RequestMapping(value="uHealthData.html")
    public ModelAndView eHealthData(HttpServletRequest request) {
        ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealthData");
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        List list = uHealthFacade.uHealthData(request);
        modelAndView.addObject("orderList", list);
        String flowstate = request.getParameter("flowstate");
        modelAndView.addObject("flowstate", flowstate);
        return modelAndView;
    }
    
    /**
     * 查询工单总数量
     */
    @RequestMapping(value="uHealthCount.html",method=RequestMethod.POST)
    public void eHealthCount(HttpServletRequest request,HttpServletResponse response) {
        
        int count = uHealthFacade.uHealthCount(request);
        WebUtil.write(response, String.valueOf(count));
    }
    /**
     * 健康检查工单详情
     */
    @RequestMapping("uHealthInfo.html")
    public ModelAndView ewHealthInfo(HttpServletRequest request,HttpServletResponse response) {
        ModelAndView modelAndView = new ModelAndView("/business/wechat/uwyw/uHealth/uHealthInfo");
        //查询健康检查基本信息
        String orderId = request.getParameter("orderId");
        String flowId = new String();
        if(StringUtil.notEmpty(orderId)) {
            SC_WORKFLOW_CI_HEALTH health = new SC_WORKFLOW_CI_HEALTH(orderId).getInstanceById();
            flowId = health.getFlow_id();
        }
        
        //通过工单编号查询工单基本信息
        Map baseMsg =  healthFacade.getHealthInfo(orderId);
        
        modelAndView.addObject("baseMsg", baseMsg);
        modelAndView.addObject("orderId", orderId);
        modelAndView.addObject("flowId", flowId);
        
        return modelAndView;
    }
    
    /**
     * 健康检查报告
     * @author chenlong
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uHealthReport.html")
    public String ewHealthReport(Model model,HttpServletRequest request){
        String orderId = request.getParameter("orderId");
        String flowId = request.getParameter("orderId");
        Map healthInfo = healthFacade.getHealthReportInfo(orderId,flowId);
        model.addAttribute("healthInfo", healthInfo);
        return "/business/wechat/uwyw/uHealth/uHealthReport";
    }
     
    /**
     * 跳转到健康检查日历页面
     */
    @RequestMapping("uHealthCheck.html")
    public String ewHealthCheck(Model model,HttpServletRequest request) {
        
        //查询当前年前五年和后五年
        int year = DateUtil.getYear();
        List years = new ArrayList();
        for(int i=5; i>=0; i--) {
            int preYear = year-i;
            years.add(preYear);
        }
        
        for(int i=1; i<5; i++) {
            int nextYear = year+i;
            years.add(nextYear);
        }
        
        model.addAttribute("years", years);
        
        model.addAttribute("year", DateUtil.getToday("yyyy"));
        model.addAttribute("month", DateUtil.getToday("MM"));
        
        List months = new ArrayList();
        for(int i=1; i<=12; i++) {
            if(i<10) {
                months.add("0"+i);
            } else {
                months.add(i);
            }
        }
        model.addAttribute("months", months);
        return "/business/wechat/uwyw/uHealth/uHealthCheck";
    }
    /**
     * 查询健康检查日历
     */
    @RequestMapping("uHealthCal.html")
    public String ewHealthCal(Model model,HttpServletRequest request,HttpServletResponse response) {
        
        String year = request.getParameter("year");
        String month = request.getParameter("month");
        
        Map result = uHealthFacade.queryHealthCalandar(request);
        List list = (List)result.get("monthDays");
        List weekDays = (List)result.get("weekDays");
        model.addAttribute("calandars", list);
        model.addAttribute("weeks", weekDays);
        
        
        Long[] dates = DateUtil.getDateFromMonth(ConvertUtil.obj2Int(year),ConvertUtil.obj2Int(month));
        List<Map> healths  = uHealthFacade.uHealthData(request);
        model.addAttribute("orderList", healths);
        return "/business/wechat/uwyw/uHealth/uHealthCal";
    }
    /**
     * 根据日期获取所有例行维护列表
     * @param model
     * @param request
     * @return
     */
    @RequestMapping("uHealthByDate.html")
    public String ewHealthByDate(Model model,HttpServletRequest request){
        return "/business/wechat/uwyw/uHealth/uHealthByDate";
    }
}