TbE2eIbpOrderDao.java
4.27 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
package com.sitech.ismp.coll.busi.e2e.dao;
import java.sql.SQLException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.sitech.ismp.coll.busi.e2e.E2EConstant;
import com.sitech.ismp.coll.busi.e2e.domain.TbE2eIbpOrder;
import com.sitech.util.DES3;
import com.sitech.util.Formater;
public class TbE2eIbpOrderDao extends OracleBaseDao {
public TbE2eIbpOrderDao(Map<String, String> params) {
super(params);
}
@SuppressWarnings("unchecked")
public List<TbE2eIbpOrder> selectTbE2eIbpOrder(Map<String, String> params,
String productType, Date fileTime) {
try {
String sFileTime = Formater.datetimeToString(fileTime);
String tagType = E2EConstant.getIbpProductTag(productType);
String sql = "" +
"select t.*" +
" from TB_E2E_IBP_ORDER t" +
" where t.FILE_TIME = to_date('"+sFileTime+"', 'yyyy-mm-dd hh24:mi:ss')" +
" and t.TAG_TYPE = '" + tagType + "'" +
" and SYSTEM_NAME != '数字家庭平台'";
String taskNames = params.get("TASK_NAME");
if (taskNames != null && !"".equals(taskNames.trim())) {
String[] taskName = taskNames.split("\\$");
sql += " and (t.TASK_NAME like '%" + taskName[0] + "%'";
for (int i = 1; i < taskName.length; i++) {
sql += " or t.TASK_NAME like '%" + taskName[i] + "%'";
}
sql += ")";
}
String systemNames = params.get("SYSTEM_NAME");
if (systemNames != null && !"".equals(systemNames.trim())) {
String[] systemName = systemNames.split("\\$");
sql += " and (t.SYSTEM_NAME like '%" + systemName[0] + "%'";
for (int i = 1; i < systemName.length; i++) {
sql += " or t.SYSTEM_NAME like '%" + systemName[i] + "%'";
}
sql += ")";
}
String orderProcStatuses = params.get("ORDER_PROC_STATUS");
if (orderProcStatuses != null && !"".equals(orderProcStatuses.trim())) {
String[] orderProcStatus = orderProcStatuses.split("\\$");
sql += " and (t.ORDER_PROC_STATUS like '%" + orderProcStatus[0] + "%'";
for (int i = 1; i < orderProcStatus.length; i++) {
sql += " or t.ORDER_PROC_STATUS like '%" + orderProcStatus[i] + "%'";
}
sql += ")";
}
String orderStatus = params.get("ORDER_STATUS");
if (orderStatus != null && !orderStatus.equals("")) {
sql += " and ORDER_STATUS ='" + orderStatus + "'";
}
System.out.println(sql);
return sqlmapClient.queryForList("selectTbE2eIbpOrder", sql);
} catch (Exception e) {
error.error("Exception while selectTbE2eIbpOrder", e);
return null;
}
}
@SuppressWarnings("unchecked")
public List<Map<String, Object>> selectIbpCrmOrder(String productTag,
Date fileTime) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("TAG_TYPE", productTag);
map.put("FILE_TIME", fileTime);
try {
return sqlmapClient.queryForList("selectIbpCrmOrder", map);
} catch (SQLException e) {
error.error("Exception while selectIbpCrmOrder", e);
return null;
}
}
public List<TbE2eIbpOrder> selectTbE2eIbpOrderForOneStop(String crmId, String p6Id) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("SYSTEM_NAME", "综资");
map.put("crmId", crmId);
map.put("p6Id", p6Id);
try {
return sqlmapClient.queryForList("selectTbE2eIbpOrderForOneStop", map);
} catch (SQLException e) {
error.error("Exception while selectTbE2eIbpOrderForOneStop", e);
return null;
}
}
/**
* 根据P6_ID查询IBP
*/
@SuppressWarnings("unchecked")
public List<TbE2eIbpOrder> selectTbE2eIbpOrderByP6(String p6Id) {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("P6_ID", p6Id);
map.put("SYSTEM_NAME", "数字家庭平台");
try {
return sqlmapClient.queryForList("selectTbE2eIbpOrderByP6", map);
} catch (SQLException e) {
error.error("Exception while selectTbE2eIbpOrderByP6", e);
return null;
}
}
public static void main(String[] args) {
Map<String,String> params = new HashMap<String, String>();
params.put("JDBC.Driver", "oracle.jdbc.driver.OracleDriver");
params.put("JDBC.ConnectionURL", "jdbc:oracle:thin:@172.21.0.77:1527:bnms");
params.put("JDBC.Username", "bnms15");
params.put("JDBC.Password", DES3.encrypt("bnms15"));
TbE2eIbpOrderDao dao = new TbE2eIbpOrderDao(params);
System.out.println(dao.selectTbE2eIbpOrderByP6("31166139"));
}
}