util sql改造

webservice
qijirenjian 4 months ago
parent 3c5e8f27ad
commit 5cf5035023

@ -34,32 +34,31 @@ public class BillFieldUtil {
* @return Map * @return Map
*/ */
// TODO custom 问题sql // public static Map getFieldId(int formid, String num) {
public static Map getFieldId(int formid, String num) { //
// logger_6c507bbc.info("BillFieldUtil getFieldId start formid "+ formid);
logger_6c507bbc.info("BillFieldUtil getFieldId start formid "+ formid); // logger_6c507bbc.info("num "+ num);
logger_6c507bbc.info("num "+ num); // formid = Math.abs(formid);
formid = Math.abs(formid); // String sql = "";
String sql = ""; // if ("0".equals(num)) {
if ("0".equals(num)) { // sql = "select b.id,fieldname,detailtable from workflow_billfield b ,workflow_base a where b.billid=-" + formid + " and a.formid=b.billid and (detailtable='' or detailtable is null)";
sql = "select b.id,fieldname,detailtable from workflow_billfield b ,workflow_base a where b.billid=-" + formid + " and a.formid=b.billid and (detailtable='' or detailtable is null)"; // } else {
} else { // sql = "select b.id,fieldname,detailtable from workflow_billfield b ,workflow_base a where b.billid=-" + formid + " and a.formid=b.billid and detailtable='formtable_main_" + formid + "_dt" + num + "'";
sql = "select b.id,fieldname,detailtable from workflow_billfield b ,workflow_base a where b.billid=-" + formid + " and a.formid=b.billid and detailtable='formtable_main_" + formid + "_dt" + num + "'"; // }
} //
// logger_6c507bbc.info("sql "+ sql);
logger_6c507bbc.info("sql "+ sql); // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // String poolname = CONN_TYPE.workflow.getType();
String poolname = CONN_TYPE.workflow.getType(); // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // rs.executeSql(sql, poolname);
rs.executeSql(sql, poolname); // Map array = new HashMap();
Map array = new HashMap(); // while (rs.next()) {
while (rs.next()) { // logger_6c507bbc.info("fieldname "+ rs.getString("fieldname"));
logger_6c507bbc.info("fieldname "+ rs.getString("fieldname")); // array.put(Util.null2String(rs.getString("fieldname")).toLowerCase(), Util.null2String(rs.getString("id")));
array.put(Util.null2String(rs.getString("fieldname")).toLowerCase(), Util.null2String(rs.getString("id"))); // }
} // logger_6c507bbc.info("array "+ array);
logger_6c507bbc.info("array "+ array); // return array;
return array; // }
}
/** /**
* @Title: getlabelId * @Title: getlabelId
@ -73,34 +72,33 @@ public class BillFieldUtil {
* @throws * @throws
*/ */
//TODO 问题sql // public static String getlabelId(String name, int formid, String ismain, String num) {
public static String getlabelId(String name, int formid, String ismain, String num) { //
// logger_6c507bbc.info("BillFieldUtil getlabelId start ");
logger_6c507bbc.info("BillFieldUtil getlabelId start "); // logger_6c507bbc.info("name----------- " + name);
logger_6c507bbc.info("name----------- " + name); // logger_6c507bbc.info("formid----------- " + formid);
logger_6c507bbc.info("formid----------- " + formid); // logger_6c507bbc.info("ismain----------- " + ismain);
logger_6c507bbc.info("ismain----------- " + ismain); // logger_6c507bbc.info("num----------- " + num);
logger_6c507bbc.info("num----------- " + num); // String id = "";
String id = ""; // String sql = "";
String sql = ""; // formid = formid * -1;
formid = formid * -1; // if ("0".equals(ismain)) {
if ("0".equals(ismain)) { // sql = "select id,fieldname,detailtable from workflow_billfield where billid=-" + formid + " and (detailtable='' or detailtable is null) and lower(fieldname)='" + name + "'";
sql = "select id,fieldname,detailtable from workflow_billfield where billid=-" + formid + " and (detailtable='' or detailtable is null) and lower(fieldname)='" + name + "'"; // } else {
} else { // sql = "select id,fieldname,detailtable from workflow_billfield where billid=-" + formid + " and detailtable='formtable_main_" + formid + "_dt" + num + "' and lower(fieldname)='" + name + "'";
sql = "select id,fieldname,detailtable from workflow_billfield where billid=-" + formid + " and detailtable='formtable_main_" + formid + "_dt" + num + "' and lower(fieldname)='" + name + "'"; // }
} // // System.out.println(sql);
// System.out.println(sql); // logger_6c507bbc.info("sql----------- " + sql);
logger_6c507bbc.info("sql----------- " + sql); // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // String poolname_a1 = CONN_TYPE.workflow.getType();
String poolname_a1 = CONN_TYPE.workflow.getType(); // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // rs.executeSql(sql, poolname_a1);
rs.executeSql(sql, poolname_a1); // if (rs.next()) {
if (rs.next()) { // id = Util.null2String(rs.getString("id"));
id = Util.null2String(rs.getString("id")); // }
} // logger_6c507bbc.info("id----------- " + id);
logger_6c507bbc.info("id----------- " + id); // return id;
return id; // }
}
/** /**
* *
@ -119,7 +117,6 @@ public class BillFieldUtil {
String poolname_n1 = CONN_TYPE.workflow.getType(); String poolname_n1 = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
//TODO custom 已处理 int类型转string //TODO custom 已处理 int类型转string
//TODO custom
String sql = "select name,field_id from e10_core_business.dbo.field_option as workflow_selectItem where field_id ='"+id+"' and value_key= '" +val+"'"; String sql = "select name,field_id from e10_core_business.dbo.field_option as workflow_selectItem where field_id ='"+id+"' and value_key= '" +val+"'";
logger_6c507bbc.info("sql----------- " + sql); logger_6c507bbc.info("sql----------- " + sql);
recordSet.executeSql(sql, poolname_n1); recordSet.executeSql(sql, poolname_n1);
@ -184,24 +181,24 @@ public class BillFieldUtil {
* @param id * @param id
* @return * @return
*/ */
public static String getselectOptionStr(String val, String id) { // public static String getselectOptionStr(String val, String id) {
String str = "<option value=''></option>"; // String str = "<option value=''></option>";
RecordSet recordSet = I18nContextUtil.getBean(RecordSet.class); // RecordSet recordSet = I18nContextUtil.getBean(RecordSet.class);
String poolname_fi = CONN_TYPE.workflow.getType(); // String poolname_fi = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
//TODO custom 已处理 int类型转string // //TODO custom 已处理 int类型转string
recordSet.executeSql("select name,field_id,value_key from e10_core_business.dbo.field_option as workflow_selectItem where field_id = '" + id + "' order by value_key", poolname_fi); // recordSet.executeSql("select name,field_id,value_key from e10_core_business.dbo.field_option as workflow_selectItem where field_id = '" + id + "' order by value_key", poolname_fi);
while (recordSet.next()) { // while (recordSet.next()) {
String name = Util.null2String(recordSet.getString("name")); // String name = Util.null2String(recordSet.getString("name"));
String value = Util.null2String(recordSet.getString("value_key")); // String value = Util.null2String(recordSet.getString("value_key"));
if (value.equals(val)) { // if (value.equals(val)) {
str += "<option value='" + value + "' selected>" + name + "</option>"; // str += "<option value='" + value + "' selected>" + name + "</option>";
} else { // } else {
str += "<option value='" + value + "'>" + name + "</option>"; // str += "<option value='" + value + "'>" + name + "</option>";
} // }
} // }
return str; // return str;
} // }
/** /**
* *
@ -209,22 +206,22 @@ public class BillFieldUtil {
* @param nodeid * @param nodeid
* @return * @return
*/ */
public static boolean judgeNodeStart(String nodeid) { // public static boolean judgeNodeStart(String nodeid) {
boolean falg = false; // boolean falg = false;
String isstart = "0"; // String isstart = "0";
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname_y9 = CONN_TYPE.workflow.getType(); // String poolname_y9 = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
//TODO custom 已处理 int类型转string // //TODO custom 已处理 int类型转string
rs.executeSql("select * from wfp_node as workflow_nodebase where id='" + nodeid+"'", poolname_y9); // rs.executeSql("select * from wfp_node as workflow_nodebase where id='" + nodeid+"'", poolname_y9);
if (rs.next()) { // if (rs.next()) {
isstart = rs.getString("isstart"); // isstart = rs.getString("isstart");
} // }
if ("1".equals(isstart)) { // if ("1".equals(isstart)) {
falg = true; // falg = true;
} // }
return falg; // return falg;
} // }
/** /**
* *
@ -232,19 +229,18 @@ public class BillFieldUtil {
* @return * @return
*/ */
// TODO custom 问题sql // public String getNodename(String nodeid) {
public String getNodename(String nodeid) { // String nodename = "";
String nodename = ""; // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // String poolname_v8 = CONN_TYPE.workflow.getType();
String poolname_v8 = CONN_TYPE.workflow.getType(); // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // //TODO custom 已处理 int类型转string
//TODO custom 已处理 int类型转string // rs.executeSql("select id,nodename from wfp_node as workflow_nodebase where id='" + nodeid +"'", poolname_v8);
rs.executeSql("select id,nodename from wfp_node as workflow_nodebase where id='" + nodeid +"'", poolname_v8); // if (rs.next()) {
if (rs.next()) { // nodename = rs.getString("nodename");
nodename = rs.getString("nodename"); // }
} // return nodename;
return nodename; // }
}
/** /**
* *
@ -349,9 +345,15 @@ public class BillFieldUtil {
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname_tg = CONN_TYPE.workflow.getType(); String poolname_tg = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
rs.executeSql("select name from department as HrmSubCompany where id = " + spid, poolname_tg); String sql ="SELECT id , name " +
"FROM eteams.dbo.department HrmSubCompany " +
"WHERE id = "+spid+"and HrmSubCompany.virtualid = 1 " +
" AND HrmSubCompany.type = 'subcompany' " +
" AND HrmSubCompany.delete_type = 0 " +
" AND HrmSubCompany.tenant_key = 't6kj9c07jr'";
rs.executeSql(sql, poolname_tg);
if (rs.next()) { if (rs.next()) {
spname = Util.null2String(rs.getString("subcompanyname")); spname = Util.null2String(rs.getString("name"));
} }
logger_6c507bbc.info("spname----------- " + spname); logger_6c507bbc.info("spname----------- " + spname);
return spname; return spname;
@ -363,23 +365,22 @@ public class BillFieldUtil {
* @return * @return
*/ */
// TODO custom 问题sql // public String getTablename(String wfid) {
public String getTablename(String wfid) { // logger_6c507bbc.info("BillFieldUtil getSubcompanyname start ");
logger_6c507bbc.info("BillFieldUtil getSubcompanyname start "); // logger_6c507bbc.info("wfid----------- " + wfid);
logger_6c507bbc.info("wfid----------- " + wfid); // String tbname = "";
String tbname = ""; // String fmid = "";
String fmid = ""; // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // String poolname_tw = CONN_TYPE.workflow.getType();
String poolname_tw = CONN_TYPE.workflow.getType(); // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // rs.executeSql("select formid from wfp_base as workflow_base where id = " + wfid, poolname_tw);
rs.executeSql("select formid from wfp_base as workflow_base where id = " + wfid, poolname_tw); // if (rs.next()) {
if (rs.next()) { // fmid = Util.null2String(rs.getString("formid"));
fmid = Util.null2String(rs.getString("formid")); // tbname = "formtable_main_" + fmid.replace("-", "");
tbname = "formtable_main_" + fmid.replace("-", ""); // }
} // logger_6c507bbc.info("tbname----------- " + tbname);
logger_6c507bbc.info("tbname----------- " + tbname); // return tbname;
return tbname; // }
}
/** /**
* *
@ -442,72 +443,72 @@ public class BillFieldUtil {
* @param map IDmap * @param map IDmap
* @return * @return
*/ */
public Map<String, String> getIdsByWorkcode(String workcode, Map<String, String> map) { // public Map<String, String> getIdsByWorkcode(String workcode, Map<String, String> map) {
String ids = ""; // String ids = "";
Map<String, String> returnMap = new HashMap<String, String>(); // Map<String, String> returnMap = new HashMap<String, String>();
if (workcode != null && !workcode.equals("")) { // if (workcode != null && !workcode.equals("")) {
// 传入的工号为空 // // 传入的工号为空
String[] array = workcode.split(","); // String[] array = workcode.split(",");
for (int i = 0; i < array.length; i++) { // for (int i = 0; i < array.length; i++) {
if (array[i] != null) { // if (array[i] != null) {
array[i] = array[i].trim(); // array[i] = array[i].trim();
} // }
String userid = map.get(array[i]); // String userid = map.get(array[i]);
if (userid == null || userid.equals("")) { // if (userid == null || userid.equals("")) {
returnMap.put("msg", "工号" + array[i] + "不存在..."); // returnMap.put("msg", "工号" + array[i] + "不存在...");
return returnMap; // return returnMap;
} else { // } else {
ids += "," + userid; // ids += "," + userid;
} // }
} // }
if (ids != null) { // if (ids != null) {
ids = ids.replaceFirst(",", ""); // ids = ids.replaceFirst(",", "");
} // }
returnMap.put("msg", "ok"); // returnMap.put("msg", "ok");
returnMap.put("data", ids); // returnMap.put("data", ids);
} // }
return returnMap; // return returnMap;
} // }
/** /**
* ID * ID
* @param workcode * @param workcode
* @return * @return
*/ */
public Map<String, String> getIdsByWorkcode(String workcode) { // public Map<String, String> getIdsByWorkcode(String workcode) {
String ids = ""; // String ids = "";
Map<String, String> returnMap = new HashMap<String, String>(); // Map<String, String> returnMap = new HashMap<String, String>();
if (workcode != null && !workcode.equals("")) { // if (workcode != null && !workcode.equals("")) {
// 传入的工号为空 // // 传入的工号为空
String[] array = workcode.split(","); // String[] array = workcode.split(",");
for (int i = 0; i < array.length; i++) { // for (int i = 0; i < array.length; i++) {
if (array[i] != null) { // if (array[i] != null) {
array[i] = array[i].trim(); // array[i] = array[i].trim();
} // }
RecordSet rs = I18nContextUtil.getBean(RecordSet.class); // RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname_xj = CONN_TYPE.workflow.getType(); // String poolname_xj = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
rs.executeSql("select id,job_num from employee as HrmResource where job_num = '" + array[i] + "'", poolname_xj); // rs.executeSql("select id,job_num from employee as HrmResource where job_num = '" + array[i] + "'", poolname_xj);
// id // // id
String userid = ""; // String userid = "";
while (rs.next()) { // while (rs.next()) {
userid = Util.null2String(rs.getString("id")); // userid = Util.null2String(rs.getString("id"));
} // }
if (userid == null || userid.equals("")) { // if (userid == null || userid.equals("")) {
returnMap.put("msg", "工号" + array[i] + "不存在..."); // returnMap.put("msg", "工号" + array[i] + "不存在...");
return returnMap; // return returnMap;
} else { // } else {
ids += "," + userid; // ids += "," + userid;
} // }
} // }
if (ids != null) { // if (ids != null) {
ids = ids.replaceFirst(",", ""); // ids = ids.replaceFirst(",", "");
} // }
returnMap.put("msg", "ok"); // returnMap.put("msg", "ok");
returnMap.put("data", ids); // returnMap.put("data", ids);
} // }
return returnMap; // return returnMap;
} // }
/** /**
* *

Loading…
Cancel
Save