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
package cn.ksource.web.controller.uc;
 
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
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.beans.SC_WORKFLOW_CI_HEALTH_CIDETAIL;
import cn.ksource.beans.WORKFLOW_BASE;
import cn.ksource.beans.WORKFLOW_NODE;
import cn.ksource.core.page.PageInfo;
import cn.ksource.core.util.ParamsMapUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.core.workflow.WorkflowCoreService;
import cn.ksource.web.Constants;
import cn.ksource.web.facade.health.HealthFacade;
import cn.ksource.web.facade.uc.order.UcHealthFacade;
import cn.ksource.web.service.file.FileService;
import cn.ksource.web.service.workFlowSupport.WorkFlowSupportService;
 
@Controller
@RequestMapping("/uc/uchealth")
public class UcHealthController {
    
    @Resource(name="ucHealthFacade")
    private UcHealthFacade ucHealthFacade;
    @Resource
    private WorkflowCoreService workflowCoreService;
    @Resource
    private WorkFlowSupportService workFlowSupportService;
    @Resource
    private FileService fileService;
    @Resource
    private HealthFacade healthFacade;
    
    /**
     * 服务台健康检查列表
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="uchealthList.html", method=RequestMethod.GET)
    public ModelAndView healthList(HttpServletRequest request, HttpServletResponse response) {
        ModelAndView view = new ModelAndView("/uc/health/uchealthList");
        view.addObject("customerId", WebUtil.getWebLoginUserCusId(request));
        return view;
    }
    
    /**
     * 查询工单列表
     */
    @RequestMapping(value="uchealthListData.html",method=RequestMethod.POST)
    public ModelAndView healthListData(HttpServletRequest request,PageInfo pageInfo) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        ModelAndView modelAndView = new ModelAndView("/uc/health/uchealthListData");
        String customer_Id = WebUtil.getWebLoginUserCusId(request);
        params.put("customer_Id", customer_Id);
        params.put("businessType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_HEALTH+"");
        PageInfo info = ucHealthFacade.queryHealthOrderList(pageInfo,params);
        modelAndView.addObject("info", info);
        return modelAndView;
    }
    
    /**
     * 查询例行维保工单总数量
     */
    @RequestMapping(value="uchealthListCount.html",method=RequestMethod.POST)
    public void healthListCount(HttpServletRequest request,HttpServletResponse response) {
        Map<String, String> params = ParamsMapUtil.getParameterMap(request);
        String customer_Id = WebUtil.getWebLoginUserCusId(request);
        params.put("businessType", Constants.WORKFLOW_BASE_BUSINESS_TYPE_CI_HEALTH+"");
        params.put("customer_Id", customer_Id);
        int count = ucHealthFacade.queryHealthOrderCount(params);
        WebUtil.write(response, String.valueOf(count));
    }
    /**
     * 健康检查明细
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="uchealthDetail.html",method=RequestMethod.GET)
    public String healthDetail(Model model,HttpServletRequest request, HttpServletResponse response){
        getOrderInfo(request,model);
        return "/uc/health/uchealthDetail";
    }
    /**
     * 处理信息
     * @param model
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("uchealthDealInfoRead.html")
    public String healthDealInfoRead(Model model,HttpServletRequest request, HttpServletResponse response) {
        String orderId = request.getParameter("orderId");
        SC_WORKFLOW_CI_HEALTH health = new SC_WORKFLOW_CI_HEALTH(orderId).getInstanceById();
        List<Map> ciList = ucHealthFacade.getCiPatrolItem(orderId);
        model.addAttribute("ciList", ciList);
        model.addAttribute("health", health);
        return "/uc/health/uchealthDealInfoRead";
    }
    /**
     * 获取表单信息
     * @param request
     */
    private void getOrderInfo(HttpServletRequest request,Model model){
        String orderId = request.getParameter("orderId");
        String nodeId = request.getParameter("nodeId");
        String flowId = request.getParameter("flowId");
        
        if(!StringUtil.notEmpty(flowId)) {
            SC_WORKFLOW_CI_HEALTH health = new SC_WORKFLOW_CI_HEALTH(orderId).getInstanceById();
            flowId = health.getFlow_id();
        }
        
        //是否已响应
        if(StringUtil.isNotBlank(nodeId)){
            WORKFLOW_NODE node = new WORKFLOW_NODE(nodeId).getInstanceById();
            model.addAttribute("isAdmin",node.getIs_admin());
            if(node.getFlowstate()==1){
                model.addAttribute("isAnswer","true");
            }
            //是否可发送到下一环节
            WORKFLOW_BASE base = new WORKFLOW_BASE(flowId).getInstanceById();
            boolean isCanFinish = workflowCoreService.isCanToNextNode(base, new WORKFLOW_NODE(nodeId).getInstanceById());
            model.addAttribute("isCanFinish",isCanFinish);
        }
 
        //流程信息
        Map orderFlowInfo = workFlowSupportService.getOrderFlowInfo(flowId);
        model.addAttribute("orderFlowInfo",orderFlowInfo);
    }
    /**
     *工程师指标巡检
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value="healthItemPatrolRead.html",method=RequestMethod.GET)
    public String healthItemPatrolRead(Model model,HttpServletRequest request, HttpServletResponse response) {
        String patrolItemId = request.getParameter("patrolItemId");
        String flowId = request.getParameter("flowId");
        Map info = healthFacade.getPatrolItemInfo(patrolItemId);
        List fileList = fileService.getFileList(patrolItemId);
        model.addAttribute("info", info);
        model.addAttribute("fileList", fileList);
        return "/uc/health/healthItemPatrolRead";
    }
    @RequestMapping(value="healthCiPatrolRead.html",method=RequestMethod.GET)
    public String healthCiPatrolRead(Model model,HttpServletRequest request, HttpServletResponse response) {
        String patrolCiId = request.getParameter("patrolCiId");
        String flowId = request.getParameter("flowId");
        SC_WORKFLOW_CI_HEALTH_CIDETAIL info = new SC_WORKFLOW_CI_HEALTH_CIDETAIL(patrolCiId).getInstanceById();
        model.addAttribute("info", info);
        return "/uc/health/healthCiPatrolRead";
    }
    
    @RequestMapping(value="uchealthReport.html",method=RequestMethod.GET)
    public String getHealthReport(Model model,HttpServletRequest request,HttpServletResponse response){
        String orderId = request.getParameter("orderId");
        String flowId = request.getParameter("flowId");
        Map healthInfo = ucHealthFacade.getHealthReportInfo(orderId,flowId);
        model.addAttribute("healthInfo", healthInfo);
        return "/uc/health/uchealthReport";
    }
    
    /**
     * 健康检查明细表
     * @param request
     * @return
     */
    @RequestMapping("ucgetHealthCiDetail.html")
    public ModelAndView getHealthCiDetail(HttpServletRequest request){
        ModelAndView view = new ModelAndView("/uc/health/ucgetHealthCiDetail");
        String flowId=request.getParameter("flowId");
        Map infoMap=ucHealthFacade.getHealthCiDetail(flowId);
        view.addObject("dealerMap", infoMap.get("dealerMap"));
        view.addObject("ciList", infoMap.get("ciList"));
        return view;
    }
}