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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
package cn.ksource.web.facade.workflow;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import cn.ksource.core.dao.BaseDao;
import cn.ksource.core.dao.SqlParameter;
import cn.ksource.core.util.JsonUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.core.web.WebUtil;
import cn.ksource.web.Constants;
@Service("templateFacade")
public class TemplateFacadeImpl implements TemplateFacade{
    @Autowired
    private BaseDao baseDao;
    /**
     * 查询事件管理流程节点配置
     */
    @Override
    public Map queryIncidentNodeDealConfig(Map<String, String> param) {
        String selectSql = "SELECT * FROM SC_WORKFLOW_INCIDENT_FLOWRULE WHERE  PROJECT_ID IS NULL ";
        Map map = baseDao.queryForMap(selectSql,new SqlParameter());
        return map;
    }
 
    /**
     * 保存事件管理流程模板配置
     */
    @Override
    public void saveIncidentNodeDealConfig(Map<String, String> param) {
        
        List listKfry = new ArrayList();
        if(!StringUtil.isEmpty(param.get("kfry"))){
            String[] kfry= param.get("kfry").split(",");
            if(null!=kfry && kfry.length>0) {
                for(String nodeId : kfry) {
                    String nodeName = Constants.incidentNode.get(nodeId);
                    Map map = new HashMap();
                    map.put("nodeId", nodeId);
                    map.put("nodeName", nodeName);
                    listKfry.add(map);
                }
            }
        }
        
        List listYcjszc = new ArrayList();
        if(!StringUtil.isEmpty(param.get("ycjszc"))){
            String[] ycjszc= param.get("ycjszc").split(",");
            if(null!=ycjszc && ycjszc.length>0) {
                for(String nodeId : ycjszc) {
                    String nodeName = Constants.incidentNode.get(nodeId);
                    Map map = new HashMap();
                    map.put("nodeId", nodeId);
                    map.put("nodeName", nodeName);
                    listYcjszc.add(map);
                }
            }
        }
        
        List listYxgcs = new ArrayList();
        if(!StringUtil.isEmpty(param.get("yxgcs"))){
            String[] yxgcs= param.get("yxgcs").split(",");
            if(null!=yxgcs && yxgcs.length>0) {
                for(String nodeId : yxgcs) {
                    String nodeName = Constants.incidentNode.get(nodeId);
                    Map map = new HashMap();
                    map.put("nodeId", nodeId);
                    map.put("nodeName", nodeName);
                    listYxgcs.add(map);
                }
            }
        }
        
        List listExgcs = new ArrayList();
        if(!StringUtil.isEmpty(param.get("exgcs"))){
            String[] exgcs= param.get("exgcs").split(",");
            if(null!=exgcs && exgcs.length>0) {
                for(String nodeId : exgcs) {
                    String nodeName = Constants.incidentNode.get(nodeId);
                    Map map = new HashMap();
                    map.put("nodeId", nodeId);
                    map.put("nodeName", nodeName);
                    listExgcs.add(map);
                }
            }
        }
        
        List listSxgcs = new ArrayList();
        if(!StringUtil.isEmpty(param.get("sxgcs"))){
            String[] sxgcs= param.get("sxgcs").split(",");
            if(null!=sxgcs && sxgcs.length>0) {
                for(String nodeId : sxgcs) {
                    String nodeName = Constants.incidentNode.get(nodeId);
                    Map map = new HashMap();
                    map.put("nodeId", nodeId);
                    map.put("nodeName", nodeName);
                    listSxgcs.add(map);
                }
            }
        }
        
        String id = param.get("id");
        
        
        String updateSql = new String();
        if(StringUtil.isEmpty(id)){
            param.put("id", StringUtil.getUUID());    
            updateSql = "INSERT INTO SC_WORKFLOW_INCIDENT_FLOWRULE (ID,KFRY,YCJSZC,YXGCS,EXGCS,SXGCS) VALUES(:id,:kfry,:ycjszc,:yxgcs,:exgcs,:sxgcs) ";
        }else{
            updateSql = "UPDATE SC_WORKFLOW_INCIDENT_FLOWRULE SET KFRY = :kfry,YCJSZC=:ycjszc,YXGCS=:yxgcs,EXGCS=:exgcs,SXGCS=:sxgcs WHERE ID = :id AND PROJECT_ID IS NULL";
            param.put("id", id);        
        }
        param.put("kfry", JsonUtil.list2Json(listKfry));
        param.put("ycjszc", JsonUtil.list2Json(listYcjszc));
        param.put("yxgcs", JsonUtil.list2Json(listYxgcs));
        param.put("exgcs", JsonUtil.list2Json(listExgcs));
        param.put("sxgcs", JsonUtil.list2Json(listSxgcs));
        
        baseDao.execute(updateSql, param);
    }
    /**
     * 查询问题管理流程节点配置
     */
    @Override
    public Map queryQuestionNodeDealConfig(Map<String, String> param) {
        String selectSql = "SELECT * FROM QUESTION_FLOWRULE WHERE CUSTOMER_ID IS NULL ";
        Map map = baseDao.queryForMap(selectSql,new SqlParameter());
        return map;
    }
    /**
     * 保存问题管理流程模板配置
     */
    @Override
    public void saveQuestionNodeDealConfig(Map<String, String> param) {
            
            List listwtfq = new ArrayList();
            if(!StringUtil.isEmpty(param.get("wtfq"))){
                String[] wtfq= param.get("wtfq").split(",");
                if(null!=wtfq && wtfq.length>0) {
                    for(String nodeId : wtfq) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listwtfq.add(map);
                    }
                }
            }
            
            List listwtsl = new ArrayList();
            if(!StringUtil.isEmpty(param.get("wtsl"))){
                String[] wtsl= param.get("wtsl").split(",");
                if(null!=wtsl && wtsl.length>0) {
                    for(String nodeId : wtsl) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listwtsl.add(map);
                    }
                }
            }
            
            List listwtsh = new ArrayList();
            if(!StringUtil.isEmpty(param.get("wtsh"))){
                String[] wtsh= param.get("wtsh").split(",");
                if(null!=wtsh && wtsh.length>0) {
                    for(String nodeId : wtsh) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listwtsh.add(map);
                    }
                }
            }
            
            List listwtzd = new ArrayList();
            if(!StringUtil.isEmpty(param.get("wtzd"))){
                String[] wtzd= param.get("wtzd").split(",");
                if(null!=wtzd && wtzd.length>0) {
                    for(String nodeId : wtzd) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listwtzd.add(map);
                    }
                }
            }
            
            List listfasp = new ArrayList();
            if(!StringUtil.isEmpty(param.get("fasp"))){
                String[] fasp= param.get("fasp").split(",");
                if(null!=fasp && fasp.length>0) {
                    for(String nodeId : fasp) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listfasp.add(map);
                    }
                }
            }
            
            List listfass = new ArrayList();
            if(!StringUtil.isEmpty(param.get("fass"))){
                String[] fass= param.get("fass").split(",");
                if(null!=fass && fass.length>0) {
                    for(String nodeId : fass) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listfass.add(map);
                    }
                }
            }
            
            List listwthg = new ArrayList();
            if(!StringUtil.isEmpty(param.get("wthg"))){
                String[] wthg= param.get("wthg").split(",");
                if(null!=wthg && wthg.length>0) {
                    for(String nodeId : wthg) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listwthg.add(map);
                    }
                }
            }
            List listclose = new ArrayList();
            if(!StringUtil.isEmpty(param.get("isclose"))){
                String[] close= param.get("isclose").split(",");
                if(null!=close && close.length>0) {
                    for(String nodeId : close) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listclose.add(map);
                    }
                }
            }
            List listback = new ArrayList();
            if(!StringUtil.isEmpty(param.get("isback"))){
                String[] back= param.get("isback").split(",");
                if(null!=back && back.length>0) {
                    for(String nodeId : back) {
                        String nodeName = Constants.questionNode.get(nodeId);
                        Map map = new HashMap();
                        map.put("nodeId", nodeId);
                        map.put("nodeName", nodeName);
                        listback.add(map);
                    }
                }
            }
            
            String updateSql = "";
            String id = param.get("id");
            if(StringUtil.isEmpty(id)){
                param.put("id", StringUtil.getUUID());
                updateSql = "INSERT INTO QUESTION_FLOWRULE(ID,WTFQ,WTSL,WTSH,WTZD,FASP,FASS,WTHG,CLOSEJD,GOBACKJD) VALUES(:id,:wtfq,:wtsl,:wtsh,:wtzd,:fasp,:fass,:wthg,:closejd,:gobackjd) ";
            }else{
                updateSql = "UPDATE QUESTION_FLOWRULE SET WTFQ = :wtfq,WTSL=:wtsl,WTSH=:wtsh,WTZD=:wtzd,FASP=:fasp,FASS=:fass,WTHG=:wthg ,CLOSEJD=:closejd,GOBACKJD=:gobackjd WHERE ID = :id AND CUSTOMER_ID IS NULL ";
                param.put("id", id);
            }
            param.put("wtfq", JsonUtil.list2Json(listwtfq));
            param.put("wtsl", JsonUtil.list2Json(listwtsl));
            param.put("wtsh", JsonUtil.list2Json(listwtsh));
            param.put("wtzd", JsonUtil.list2Json(listwtzd));
            param.put("fasp", JsonUtil.list2Json(listfasp));
            param.put("fass", JsonUtil.list2Json(listfass));
            param.put("wthg", JsonUtil.list2Json(listwthg));
            param.put("closejd", JsonUtil.list2Json(listclose));
            param.put("gobackjd", JsonUtil.list2Json(listback));            
            
            baseDao.execute(updateSql, param);
    }
    
    
 
}