public String getuser(String usrid, HttpServletRequest request) { String resu = ""; Database db = null; Rowset rs = null; try { db = Tools.getDatabase(true); String str_ALLUSRID = usrid; String[] ARR_USR = str_ALLUSRID.split("\\|"); String str_rtn = ""; for (int i = 0; i < ARR_USR.length; i++) { String str_USRID = ARR_USR[i]; if ((str_USRID != null) && (!str_USRID.equals(""))) { String str_SQL = "select USR_NAM from UTUSRMST where USR_ID = '" + str_USRID + "'"; rs = db.getRS(str_SQL); if (rs.next()) { String userpos = getUserInfo.getAttribute(str_USRID); if ((userpos == null) || (userpos.equals(""))) { userpos = " "; } if (str_rtn.equals("")) { str_rtn = str_USRID + "|" + rs.getString("USR_NAM") + "|" + userpos; } else { str_rtn = str_rtn + "||" + str_USRID + "|" + rs.getString("USR_NAM") + "|" + userpos; } } } } resu = str_rtn; } catch (Exception e) { Log.error(e); } finally { db.cleanup(); } return resu; }
public void CST_NO_onblur( DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) { Database db = null; Rowset rs = null; String sql = ""; String cstNo = ""; String cstId = ""; String cstNam = ""; try { db = Tools.getDatabase(true); cstId = Charset.nullToEmpty(serviceRequest.getParameter("value")); if (!cstId.equals("")) { sql = "select cst_no,cst_nam from ogcstmst where cst_id='" + cstId + "'"; rs = db.getRS(sql); if (rs.getRowCount() <= 0) { serviceRequest.addServiceReturnParameter("CSTFLG", "FALSE"); return; } else { if (rs.next()) { cstNo = Charset.nullToEmpty(rs.getString("cst_no")); cstNam = Charset.nullToEmpty(rs.getString("cst_nam")); } } } serviceRequest.addServiceReturnParameter("CSTFLG", "TRUE"); serviceRequest.addServiceReturnParameter("CST_NO", cstNo); serviceRequest.addServiceReturnParameter("CST_NAM", cstNam); } catch (Exception e) { Log.error(e); } finally { if (db != null) db.cleanup(); } }
private void initTBRTable(DataDom dataDom, String prjNo, Database db) throws Exception { String sql1 = "select PRJL_NO from YXPRJLIN where PRJ_NO = " + prjNo; String unit = getMonUnit(prjNo); Rowset rs = db.getRS(sql1); CommSequence seq = CommSequence.getInstance("YXDBJYLIN_SEQ"); while (rs.next()) { String prjlNo = Charset.nullToEmpty(rs.getString("PRJL_NO")); String sql = "insert into YXDBJYLIN(DBJYL_NO,PRJL_NO,PRJ_NO,IS_NTC,IS_RCV,MON_UNIT)values(" + seq.getNextValue() + "," + prjlNo + "," + Charset.nullToEmpty(prjNo) + "," + "'N', 'N'," + unit + ")"; db.execSqlUpdate(sql); } }
private void initNoSplitTbrTab(DataDom dataDom, String prjNo, Database db) throws Exception { String sql = "select t.TBR_NAM,t.TBR_NO,d.PRJL_NO from YXTBRMST t join YXBJDFLIN d on t.TBR_NO=d.TBR_NO where d.PRJ_NO = " + prjNo; Rowset rs = db.getRS(sql); Table ct1 = dataDom.getTable("YXDBJYLIN"); Row row = new Row(false, 0, 0, "new"); row.addColumn("PRJ_NO", Charset.nullToEmpty(prjNo)); String unit = getMonUnit(prjNo); row.addColumn("IS_NTC", "N"); row.addColumn("IS_RCV", "N"); row.addColumn("MON_UNIT", unit); if (rs.next()) { row.addColumn("PRJL_NO", Charset.nullToEmpty(rs.getString("PRJL_NO"))); row.addColumn("TBR_NO", rs.getString("TBR_NO")); ct1.getRows().put("0", row); creatSel(ct1.getField("TBR_NO"), sql, false, false); } else { ct1.clearRow(); } }
/** * 招标代理费生成 * * @param dataDom * @param sessionInfo * @param serviceRequest * @throws LiemsException */ public void creatDLFEE(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws LiemsException { Database db = null; Table table = dataDom.getTable("YXDBJYMST"); Row currRow = table.getRow(0L); try { db = Tools.getDatabase(true); String DBJY_NO = currRow.getColumnValue("DBJY_NO"); String PRJ_NO = currRow.getColumnValue("PRJ_NO"); String ORG_NO = currRow.getColumnValue("ORG_NO"); Vector<String> vc = new Vector<String>(); String sel1 = "select distinct TBR_NO from YXDBJYLIN where DBJY_NO=" + DBJY_NO + " and IS_ZB='01'"; Rowset rs = db.getRS(sel1); while (rs.next()) { // 查询投标单位 生成主表 String TBR_NO = rs.getString("TBR_NO"); CommSequence cs = CommSequence.getInstance("YXDLFMST_SEQ"); String TBDJ_NO = cs.getNextValue(); CommCodeNumber seq = new CommCodeNumber( "DLF", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId(), db); String TBDJ_ID = seq.getNextValue(); String insertSQL = " insert into YXDLFMST(DLF_NO,ORG_NO,DLF_STA,DLF_ID,PRJ_NO,TBR_NO,FSTUSR_ID,FSTUSR_DTM) " + " values(" + TBDJ_NO + "," + ORG_NO + ",'00','" + TBDJ_ID + "'," + PRJ_NO + ",'" + TBR_NO + "','" + sessionInfo.getUserId() + "',sysdate) "; vc.add(insertSQL); // 查询标包 生成子表明细数据 String sel2 = "select YXDBJYLIN.PRJL_NO,YXPRJLIN.DLFL_AMT from YXDBJYLIN,YXPRJLIN " + " where YXDBJYLIN.PRJL_NO=YXPRJLIN.PRJL_NO and YXDBJYLIN.TBR_NO = " + TBR_NO + " and YXDBJYLIN.DBJY_NO=" + DBJY_NO + " and YXDBJYLIN.IS_ZB='01'"; Rowset rs2 = db.getRS(sel2); while (rs2.next()) { String PRJL_NO = rs2.getString("PRJL_NO"); CommSequence cs2 = CommSequence.getInstance("YXDBJYLIN_SEQ"); String TBDJL_NO = cs2.getNextValue(); String DLFL_AMT = rs2.getString("DLFL_AMT"); insertSQL = " insert into YXDBJYLIN(DLFL_NO,DLF_NO,TBR_NO,PRJ_NO,PRJL_NO,DLFL_AMT,IS_JF) " + " values(" + TBDJL_NO + "," + TBDJ_NO + "," + TBR_NO + "," + PRJ_NO + "," + PRJL_NO + "," + DLFL_AMT + ", 'N')"; vc.add(insertSQL); } } db.execSqlUpdateBatch(vc); db.commit(); serviceRequest.addServiceReturnParameter("relString", "true"); } catch (Exception e) { e.printStackTrace(); serviceRequest.addServiceReturnParameter("relString", e.toString()); } finally { if (db != null) { db.cleanup(); } } }
public void save(DataDom dataDom, SessionInfo sessionInfo, ServiceRequest serviceRequest) throws LiemsException { Table table = dataDom.getTable("YXDBJYMST"); Table cTable = dataDom.getTable("YXDBJYLIN"); Row currRow = table.getRow(0L); if (currRow == null) { table.addRow(new Row(false, 0, 0, "new")); currRow = table.getRow(0L); } currRow.setFirstLastUserInfo(sessionInfo.getUserId()); String prjNo = currRow.getColumnValue("PRJ_NO"); Database db = null; try { db = Tools.getDatabase(false); if (currRow.getDataStatus().equals("new")) { currRow.addColumn("ORG_NO", sessionInfo.getDefaultOrg()); if ((currRow.getColumn("DBJY_ID") == null) || (currRow.getColumn("DBJY_ID").getValue() == null) || (currRow.getColumn("DBJY_ID").getValue().equals(""))) { CommCodeNumber KLTYPID = new CommCodeNumber("DBJY", sessionInfo.getCurrentLanguage(), sessionInfo.getUserId()); currRow.addColumn(new Column("DBJY_ID", KLTYPID.getNextValue())); } } else if ((currRow.getDataStatus().equals("modified")) && (CheckDate.isPrjNoChange(dataDom, db))) { deleteChildTable(dataDom, sessionInfo, serviceRequest, db); } String isSplit = Database.getValue(db, "select IS_SPLIT from YXPRJMST where PRJ_NO=" + prjNo); if ((prjNo != null) && (!(prjNo.equals(""))) && (Integer.parseInt(prjNo) > 0)) { if ((isSplit.equals("Y")) && (CheckDate.isTableEmpty( "YXDBJYLIN", dataDom, db, "PRJ_NO=" + prjNo, currRow.getPkValue("DBJY_NO")))) initTBRTable(dataDom, prjNo, db); else if ((isSplit.equals("N")) && (CheckDate.isTableEmpty( "YXDBJYLIN", dataDom, db, "PRJ_NO=" + prjNo, currRow.getPkValue("DBJY_NO")))) { initNoSplitTbrTab(dataDom, prjNo, db); } } super.save(dataDom, sessionInfo, serviceRequest, db); String pkValue = dataDom.getRootTable().getPkValue(); // String selString = "select PRJL_NO,dlf_sum from YXDBJYLIN where DBJY_NO=" + pkValue + " and dlf_sum is not null"; Rowset rs = db.getRS(selString); Vector<String> vc = new Vector<String>(); while (rs.next()) { String PRJL_NO = rs.getString("PRJL_NO"); String dlf_sum = Charset.nullToEmpty(rs.getString("dlf_sum")); if (!"".equals(dlf_sum)) { String upPrjInfoString = "update yxprjlin set DLFL_AMT=" + dlf_sum + " where PRJ_NO=" + prjNo + " and prjl_no=" + PRJL_NO; vc.add(upPrjInfoString); } } if (vc.size() > 0) { db.execSqlUpdateBatch(vc); } db.commit(); } catch (Exception e) { db.rollback(); table.refresh("B1YXM00200", sessionInfo); Log.error(e); serviceRequest.getMessage().addInfo("保存失败"); } finally { if (db != null) { db.cleanup(); } } initSel(dataDom, sessionInfo); dataDom.getChildTable().refresh("B1YXM00200", sessionInfo); }