diff --git a/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/swfa/BillFieldUtil.java b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/swfa/BillFieldUtil.java index 3c9394d..96ce592 100644 --- a/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/swfa/BillFieldUtil.java +++ b/secondev-history-action/src/main/java/com/weaver/seconddev/interfaces/swfa/BillFieldUtil.java @@ -34,32 +34,31 @@ public class BillFieldUtil { * @return Map */ - // TODO custom 问题sql - public static Map getFieldId(int formid, String num) { - - logger_6c507bbc.info("BillFieldUtil getFieldId start formid "+ formid); - logger_6c507bbc.info("num "+ num); - formid = Math.abs(formid); - String sql = ""; - 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)"; - } 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 + "'"; - } - - logger_6c507bbc.info("sql "+ sql); - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - rs.executeSql(sql, poolname); - Map array = new HashMap(); - while (rs.next()) { - logger_6c507bbc.info("fieldname "+ rs.getString("fieldname")); - array.put(Util.null2String(rs.getString("fieldname")).toLowerCase(), Util.null2String(rs.getString("id"))); - } - logger_6c507bbc.info("array "+ array); - return array; - } +// public static Map getFieldId(int formid, String num) { +// +// logger_6c507bbc.info("BillFieldUtil getFieldId start formid "+ formid); +// logger_6c507bbc.info("num "+ num); +// formid = Math.abs(formid); +// String sql = ""; +// 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)"; +// } 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 + "'"; +// } +// +// logger_6c507bbc.info("sql "+ sql); +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// rs.executeSql(sql, poolname); +// Map array = new HashMap(); +// while (rs.next()) { +// logger_6c507bbc.info("fieldname "+ rs.getString("fieldname")); +// array.put(Util.null2String(rs.getString("fieldname")).toLowerCase(), Util.null2String(rs.getString("id"))); +// } +// logger_6c507bbc.info("array "+ array); +// return array; +// } /** * @Title: getlabelId @@ -73,34 +72,33 @@ public class BillFieldUtil { * @throws */ - //TODO 问题sql - public static String getlabelId(String name, int formid, String ismain, String num) { - - logger_6c507bbc.info("BillFieldUtil getlabelId start "); - logger_6c507bbc.info("name----------- " + name); - logger_6c507bbc.info("formid----------- " + formid); - logger_6c507bbc.info("ismain----------- " + ismain); - logger_6c507bbc.info("num----------- " + num); - String id = ""; - String sql = ""; - formid = formid * -1; - 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 + "'"; - } else { - 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); - logger_6c507bbc.info("sql----------- " + sql); - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname_a1 = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - rs.executeSql(sql, poolname_a1); - if (rs.next()) { - id = Util.null2String(rs.getString("id")); - } - logger_6c507bbc.info("id----------- " + id); - return id; - } +// public static String getlabelId(String name, int formid, String ismain, String num) { +// +// logger_6c507bbc.info("BillFieldUtil getlabelId start "); +// logger_6c507bbc.info("name----------- " + name); +// logger_6c507bbc.info("formid----------- " + formid); +// logger_6c507bbc.info("ismain----------- " + ismain); +// logger_6c507bbc.info("num----------- " + num); +// String id = ""; +// String sql = ""; +// formid = formid * -1; +// 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 + "'"; +// } else { +// 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); +// logger_6c507bbc.info("sql----------- " + sql); +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname_a1 = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// rs.executeSql(sql, poolname_a1); +// if (rs.next()) { +// id = Util.null2String(rs.getString("id")); +// } +// logger_6c507bbc.info("id----------- " + id); +// return id; +// } /** * 选择框 显示名 @@ -119,7 +117,6 @@ public class BillFieldUtil { String poolname_n1 = CONN_TYPE.workflow.getType(); // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 //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+"'"; logger_6c507bbc.info("sql----------- " + sql); recordSet.executeSql(sql, poolname_n1); @@ -184,24 +181,24 @@ public class BillFieldUtil { * @param id * @return */ - public static String getselectOptionStr(String val, String id) { - String str = ""; - RecordSet recordSet = I18nContextUtil.getBean(RecordSet.class); - String poolname_fi = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - //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); - while (recordSet.next()) { - String name = Util.null2String(recordSet.getString("name")); - String value = Util.null2String(recordSet.getString("value_key")); - if (value.equals(val)) { - str += ""; - } else { - str += ""; - } - } - return str; - } +// public static String getselectOptionStr(String val, String id) { +// String str = ""; +// RecordSet recordSet = I18nContextUtil.getBean(RecordSet.class); +// String poolname_fi = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// //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); +// while (recordSet.next()) { +// String name = Util.null2String(recordSet.getString("name")); +// String value = Util.null2String(recordSet.getString("value_key")); +// if (value.equals(val)) { +// str += ""; +// } else { +// str += ""; +// } +// } +// return str; +// } /** * 判断节点是否为创建节点 @@ -209,22 +206,22 @@ public class BillFieldUtil { * @param nodeid * @return */ - public static boolean judgeNodeStart(String nodeid) { - boolean falg = false; - String isstart = "0"; - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname_y9 = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - //TODO custom 已处理 int类型转string - rs.executeSql("select * from wfp_node as workflow_nodebase where id='" + nodeid+"'", poolname_y9); - if (rs.next()) { - isstart = rs.getString("isstart"); - } - if ("1".equals(isstart)) { - falg = true; - } - return falg; - } +// public static boolean judgeNodeStart(String nodeid) { +// boolean falg = false; +// String isstart = "0"; +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname_y9 = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// //TODO custom 已处理 int类型转string +// rs.executeSql("select * from wfp_node as workflow_nodebase where id='" + nodeid+"'", poolname_y9); +// if (rs.next()) { +// isstart = rs.getString("isstart"); +// } +// if ("1".equals(isstart)) { +// falg = true; +// } +// return falg; +// } /** * 获取节点名称 @@ -232,19 +229,18 @@ public class BillFieldUtil { * @return */ - // TODO custom 问题sql - public String getNodename(String nodeid) { - String nodename = ""; - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname_v8 = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - //TODO custom 已处理 int类型转string - rs.executeSql("select id,nodename from wfp_node as workflow_nodebase where id='" + nodeid +"'", poolname_v8); - if (rs.next()) { - nodename = rs.getString("nodename"); - } - return nodename; - } +// public String getNodename(String nodeid) { +// String nodename = ""; +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname_v8 = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// //TODO custom 已处理 int类型转string +// rs.executeSql("select id,nodename from wfp_node as workflow_nodebase where id='" + nodeid +"'", poolname_v8); +// if (rs.next()) { +// nodename = rs.getString("nodename"); +// } +// return nodename; +// } /** * 获取计量单位内码 @@ -349,9 +345,15 @@ public class BillFieldUtil { RecordSet rs = I18nContextUtil.getBean(RecordSet.class); String poolname_tg = CONN_TYPE.workflow.getType(); // 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()) { - spname = Util.null2String(rs.getString("subcompanyname")); + spname = Util.null2String(rs.getString("name")); } logger_6c507bbc.info("spname----------- " + spname); return spname; @@ -363,23 +365,22 @@ public class BillFieldUtil { * @return */ - // TODO custom 问题sql - public String getTablename(String wfid) { - logger_6c507bbc.info("BillFieldUtil getSubcompanyname start "); - logger_6c507bbc.info("wfid----------- " + wfid); - String tbname = ""; - String fmid = ""; - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname_tw = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - rs.executeSql("select formid from wfp_base as workflow_base where id = " + wfid, poolname_tw); - if (rs.next()) { - fmid = Util.null2String(rs.getString("formid")); - tbname = "formtable_main_" + fmid.replace("-", ""); - } - logger_6c507bbc.info("tbname----------- " + tbname); - return tbname; - } +// public String getTablename(String wfid) { +// logger_6c507bbc.info("BillFieldUtil getSubcompanyname start "); +// logger_6c507bbc.info("wfid----------- " + wfid); +// String tbname = ""; +// String fmid = ""; +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname_tw = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// rs.executeSql("select formid from wfp_base as workflow_base where id = " + wfid, poolname_tw); +// if (rs.next()) { +// fmid = Util.null2String(rs.getString("formid")); +// tbname = "formtable_main_" + fmid.replace("-", ""); +// } +// logger_6c507bbc.info("tbname----------- " + tbname); +// return tbname; +// } /** * 把出差人员放在一起 @@ -442,72 +443,72 @@ public class BillFieldUtil { * @param map 所有人员 工号和ID的map * @return */ - public Map getIdsByWorkcode(String workcode, Map map) { - String ids = ""; - Map returnMap = new HashMap(); - if (workcode != null && !workcode.equals("")) { - // 传入的工号为空 - String[] array = workcode.split(","); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - array[i] = array[i].trim(); - } - String userid = map.get(array[i]); - if (userid == null || userid.equals("")) { - returnMap.put("msg", "工号" + array[i] + "不存在..."); - return returnMap; - } else { - ids += "," + userid; - } - } - if (ids != null) { - ids = ids.replaceFirst(",", ""); - } - returnMap.put("msg", "ok"); - returnMap.put("data", ids); - } - return returnMap; - } +// public Map getIdsByWorkcode(String workcode, Map map) { +// String ids = ""; +// Map returnMap = new HashMap(); +// if (workcode != null && !workcode.equals("")) { +// // 传入的工号为空 +// String[] array = workcode.split(","); +// for (int i = 0; i < array.length; i++) { +// if (array[i] != null) { +// array[i] = array[i].trim(); +// } +// String userid = map.get(array[i]); +// if (userid == null || userid.equals("")) { +// returnMap.put("msg", "工号" + array[i] + "不存在..."); +// return returnMap; +// } else { +// ids += "," + userid; +// } +// } +// if (ids != null) { +// ids = ids.replaceFirst(",", ""); +// } +// returnMap.put("msg", "ok"); +// returnMap.put("data", ids); +// } +// return returnMap; +// } /** * 根据工号获取ID * @param workcode * @return */ - public Map getIdsByWorkcode(String workcode) { - String ids = ""; - Map returnMap = new HashMap(); - if (workcode != null && !workcode.equals("")) { - // 传入的工号为空 - String[] array = workcode.split(","); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - array[i] = array[i].trim(); - } - RecordSet rs = I18nContextUtil.getBean(RecordSet.class); - String poolname_xj = CONN_TYPE.workflow.getType(); - // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 - rs.executeSql("select id,job_num from employee as HrmResource where job_num = '" + array[i] + "'", poolname_xj); - // id - String userid = ""; - while (rs.next()) { - userid = Util.null2String(rs.getString("id")); - } - if (userid == null || userid.equals("")) { - returnMap.put("msg", "工号" + array[i] + "不存在..."); - return returnMap; - } else { - ids += "," + userid; - } - } - if (ids != null) { - ids = ids.replaceFirst(",", ""); - } - returnMap.put("msg", "ok"); - returnMap.put("data", ids); - } - return returnMap; - } +// public Map getIdsByWorkcode(String workcode) { +// String ids = ""; +// Map returnMap = new HashMap(); +// if (workcode != null && !workcode.equals("")) { +// // 传入的工号为空 +// String[] array = workcode.split(","); +// for (int i = 0; i < array.length; i++) { +// if (array[i] != null) { +// array[i] = array[i].trim(); +// } +// RecordSet rs = I18nContextUtil.getBean(RecordSet.class); +// String poolname_xj = CONN_TYPE.workflow.getType(); +// // TODO E10执行sql方法第二参数必须指定源,默认使用流程源,单体客户无需修改,微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 +// rs.executeSql("select id,job_num from employee as HrmResource where job_num = '" + array[i] + "'", poolname_xj); +// // id +// String userid = ""; +// while (rs.next()) { +// userid = Util.null2String(rs.getString("id")); +// } +// if (userid == null || userid.equals("")) { +// returnMap.put("msg", "工号" + array[i] + "不存在..."); +// return returnMap; +// } else { +// ids += "," + userid; +// } +// } +// if (ids != null) { +// ids = ids.replaceFirst(",", ""); +// } +// returnMap.put("msg", "ok"); +// returnMap.put("data", ids); +// } +// return returnMap; +// } /** * 获取姓名