FlowBussinessDescManageServiceImpl.java
9.0 KB
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
package com.skua.modules.flow;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.flow.custombiz.handle.IFlowBusinessDescService;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* 镜检照片管理
*/
@Service("flowBusinessDescService")
public class FlowBussinessDescManageServiceImpl implements IFlowBusinessDescService {
@Override
public Map<String, String> getFlowBusinessDesc(List<Map<String, String>> businessList) {
JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
Map<String,String> resultMap = new HashMap<String,String>();
if(businessList!=null&&businessList.size()>0) {
Map<String,String> tableMap = new HashMap<String,String>();
for(Map<String, String> map : businessList) {
String tablename = map.get("businessTable");
String id = map.get("businessId");
tableMap.put(tablename, ConvertUtils.getString(tableMap.get(tablename),"")+","+id);
}
Set<String> tableSet = tableMap.keySet();
for(String tableName : tableSet) {
if(tableName.equals("check_microscopic_manage")) {
//镜检业务流程
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'"+s.trim()+"'").collect(Collectors.joining(","));
String sql = "select id,create_by,'-镜检申请' as title from check_microscopic_manage where id in("+inSqlPart+")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for(Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("create_by"))+""+ConvertUtils.getString(dataMap.get("title")));
}
}else if(tableName.equals("equipment_repair")) {
//设备维修流程
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'"+s.trim()+"'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(b.equipment_name,'-维修申请') as title " +
"FROM " +
" equipment_repair a " +
"LEFT JOIN equipment_info b ON a.info_id = b.id " +
"WHERE " +
" a.id in ("+inSqlPart+")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for(Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if ("problem_report_plan".equals(tableName)) {
// 报警
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(problem_name,'-问题上报') as title " +
"FROM " +
" problem_report_plan a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if ("equipment_defect_management".equals(tableName)) {
// 缺陷上报
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(equipment_name,'-缺陷上报') as title " +
"FROM " +
" equipment_defect_management a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
} else if (tableName.equals("emergency_risk_event")) {
//应急风险事件
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(a.risk_name,'-应急风险事件') as title " +
"FROM " +
" emergency_risk_event a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}
else if (tableName.equals("ajh_rectification_info")) {
//安全隐患
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT((select struct_name from sys_struct_dict where id = a.rec_ord_body),'-安全隐患流程') as title " +
"FROM " +
" ajh_rectification_info a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if ("alarm_record_history".equals(tableName)) {
// 报警
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(alarm_param_name,'-报警申请') as title " +
"FROM " +
" alarm_record_history a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if (tableName.equals("productive_task")) {
//生产任务
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(a.task_name,'-生产任务流程') as title " +
"FROM " +
" productive_task a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if (tableName.equals("data_assessment_socre_master")) {
//生产任务
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(a.create_by,'-考核评价审批') as title " +
"FROM " +
" data_assessment_socre_master a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if (tableName.equals("dangerous_operation_manage")) {
//危险作业
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(a.operation_name,'-危险作业审批') as title " +
"FROM " +
" dangerous_operation_manage a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}
}
}
return resultMap;
}
}