public List<SelectItem> getProductCodeList() { if (this.productCodeList != null && this.productCodeList.size() > 0) { return this.productCodeList; } String sql = "select contplancode,contplanname from lepplan"; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); for (int i = 1; i <= tSSRS.getMaxRow(); i++) { productCodeList.add(new SelectItem(tSSRS.GetText(i, 1), tSSRS.GetText(i, 2))); } return this.productCodeList; }
public List<SelectItem> getProductList() { if (productList == null) { productList = new ArrayList<SelectItem>(); } productList.clear(); ExeSQL tExeSQL = new ExeSQL(); String mngComSQL = "select contplancode, contplanname from lepplan order by contplancode"; SSRS tSSRS = tExeSQL.execSQL(mngComSQL); for (int i = 1; i <= tSSRS.MaxRow; i++) { SelectItem item = new SelectItem(tSSRS.GetText(i, 1), tSSRS.GetText(i, 2)); productList.add(item); } return productList; }
/** 根据ID取得数据 */ public void findById() { this.setSiteName(""); String sql = "select s.productcode," + "(case s.productcode when 'all' then '首页面' when 'register' then '注册页面' when 'actIndex' then '宣传页面' when 'readIndex' then '阅读投保须知页面' else p.contplanname end) as contplanname," + " s.sitename,s.sitecode,s.sitetype," + "s.url," + "s.content,s.paymode " + "from ledadsource s, lepplan p " + "where s.productcode = p.contplancode(+)"; String sqlWhere = getSqlWhere(); sql += sqlWhere; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); int rows = tSSRS.getMaxRow(); if (rows > 0) { this.setProductCode(tSSRS.GetText(1, 1)); this.setContplanname(tSSRS.GetText(1, 2)); this.setSiteName(tSSRS.GetText(1, 3)); this.setSiteCode(tSSRS.GetText(1, 4)); this.setSiteType(tSSRS.GetText(1, 5)); this.setUrl(tSSRS.GetText(1, 6)); this.setContent(tSSRS.GetText(1, 7)); String paymodesCode = tSSRS.GetText(1, 8); String[] paymodeArr = paymodesCode.split("\\$"); if (paymodeArr != null && paymodeArr.length > 0) { StringBuffer payModeNameSQL = new StringBuffer("select codename from ledcode where codetype='paymode'"); payModeNameSQL.append(" and code in("); for (int j = 0, numbers = paymodeArr.length; j < numbers; j++) { payModeNameSQL.append("'"); payModeNameSQL.append(paymodeArr[j]); payModeNameSQL.append("'"); if (j < numbers - 1) payModeNameSQL.append(","); } payModeNameSQL.append(")"); tSSRS = tExeSQL.execSQL(payModeNameSQL.toString()); String paymodeName = ""; for (int k = 1, totalRows = tSSRS.MaxRow; k <= totalRows; k++) { paymodeName = paymodeName + tSSRS.GetText(k, 1) + " "; } this.setPayModeNames(paymodeName); } } else { this.setProductCode(""); this.setContplanname(""); this.setSiteName(""); this.setSiteCode(""); this.setSiteType(""); this.setUrl(""); this.setContent(""); this.setPayModeNames(""); } }
public SelectItem[] getPayModelItems() { if (payModelItems != null && payModelItems.length > 0) { return payModelItems; } String payModeSQL = "select code,codename from ledcode where code<>'6' and codetype='paymode' order by code"; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = tExeSQL.execSQL(payModeSQL); payModelItems = new SelectItem[tSSRS.MaxRow]; for (int i = 1, totalRows = tSSRS.MaxRow; i <= totalRows; i++) { SelectItem item = new SelectItem(tSSRS.GetText(i, 1), tSSRS.GetText(i, 2)); payModelItems[i - 1] = item; } return payModelItems; }
private void queryComInfo() { String bankCode = this.getBankCode(); ExeSQL exeSQL = new ExeSQL(); comInfoList = new ArrayList<String[]>(); String relaComSQL = "select com.comCode,com.outComCode,com.Name,com.phone,com.SatrapName," + " (select a.codename from ledcode a where a.codetype='provience' and a.code=com.Province),(select a.codename from ledcode a where a.codetype='city' and a.code=com.City),'R'" + " from ledCom com where exists(select 1 from LEDBankComRela rela where rela.bankCode='" + bankCode + "' and rela.comCode=com.comCode)"; String notRelaComSQL = " union all select com.comCode,com.outComCode,com.Name,com.phone,com.SatrapName," + " (select a.codename from ledcode a where a.codetype='provience' and a.code=com.Province),(select a.codename from ledcode a where a.codetype='city' and a.code=com.City),'C'" + " from ledCom com where not exists(select 1 from LEDBankComRela rela where rela.bankCode='" + bankCode + "' and rela.comCode=com.comCode)"; String comSQL = relaComSQL + notRelaComSQL + " order by 1"; SSRS tSSRS = exeSQL.execSQL(comSQL); if (tSSRS == null) { this.setOperateCode("queryComInfo_Fail010"); this.operateNotice = ECPubFun.getDisplayString(valiConfig.getBundle(), this.operateCode, null); return; } for (int i = 1; i <= tSSRS.MaxRow; i++) { String[] tComInfo = new String[tSSRS.MaxCol + 2]; for (int j = 1; j < tSSRS.MaxCol; j++) { tComInfo[j - 1] = tSSRS.GetText(i, j); } String flag = tSSRS.GetText(i, tSSRS.MaxCol); if ("R".equals(flag)) { tComInfo[tSSRS.MaxCol - 1] = "已关联"; tComInfo[tSSRS.MaxCol] = ""; tComInfo[tSSRS.MaxCol + 1] = "取消关联"; } else if ("C".equals(flag)) { tComInfo[tSSRS.MaxCol - 1] = "未关联"; tComInfo[tSSRS.MaxCol] = "关联"; tComInfo[tSSRS.MaxCol + 1] = ""; } else { tComInfo[tSSRS.MaxCol - 1] = ""; tComInfo[tSSRS.MaxCol] = ""; tComInfo[tSSRS.MaxCol + 1] = ""; } this.setComInfo(tComInfo); comInfoList.add(tComInfo); } }
public List<SelectItem> getPolicyCurrencykList() { if (policyCurrencykList == null) { policyCurrencykList = new ArrayList<SelectItem>(); } policyCurrencykList.clear(); ExeSQL tExeSQL = new ExeSQL(); String polStateSQL = "select sitecode,sitename from ledadsource t where productcode='readIndex'"; SSRS tSSRS = tExeSQL.execSQL(polStateSQL); for (int i = 1; i <= tSSRS.MaxRow; i++) { SelectItem item = new SelectItem(tSSRS.GetText(i, 1), tSSRS.GetText(i, 1) + "---" + tSSRS.GetText(i, 2)); policyCurrencykList.add(item); } return policyCurrencykList; }
/** 取得所有广告来源URL */ public void find() { adList = new Vector<LEDAdSourceSchema>(); String sql = "select s.productcode," + "(case s.productcode when 'all' then '首页面' when 'register' then '注册页面' when 'actIndex' then '宣传页面' when 'readIndex' then '阅读投保须知页面' else p.contplanname end) as contplanname," + " s.sitename,s.sitecode,s.sitetype," + "s.url," + "s.content " + "from ledadsource s, lepplan p " + "where s.productcode = p.contplancode(+)"; String sqlWhere = getSqlWhere(); sql += sqlWhere; sql += " order by productcode"; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); for (int i = 1; i <= tSSRS.getMaxRow(); i++) { AdSourceMadel adSource = new AdSourceMadel(); adSource.setProductCode(tSSRS.GetText(i, 1)); adSource.setContplanname(tSSRS.GetText(i, 2)); adSource.setSiteName(tSSRS.GetText(i, 3)); adSource.setSiteCode(tSSRS.GetText(i, 4)); adSource.setSiteType(tSSRS.GetText(i, 5)); adSource.setUrl(tSSRS.GetText(i, 6)); adSource.setContent(tSSRS.GetText(i, 7)); adList.add(adSource); } }
public void queryOrderInfo() { orderInfoList = new ArrayList<String[]>(); String orderInfoSQL = "select ord.orderNo, cont.AppntName, (case cont.AppntSex when 'M' then '男' when 'F' then '女' else '不详' end)," + " cont.AppntBirthday,(select a.codename from ledcode a where codetype='idtype' and a.code=cont.AppntIDType), cont.AppntIDNo," + " cont.InsuredName, (case cont.InsuredSex when 'M' then '男' when 'F' then '女' else '不详' end), cont.InsuredBirthday," + " (select b.name from ledcom b where b.comcode=ord.managecom)," + " (select c.ContPlanName from lepplan c where c.PlanType='00' and c.ContPlanCode=ord.ContPlanCode),cont.Amnt, cont.Prem," + " (select a.codename from ledcode a where codetype='orderState' and a.code=ord.orderState),ord.ApplyDate,ord.AcceptDate," + " ord.AcceptPolDate,(select sitename from ledadsource t where t.sitecode=cont.currency and t.productcode='readIndex'), " + " (select addr.mobile from lecaddress addr where addr.customerno = cont.appntno and addr.addressno = appnt.addressno)" + " from LECOrderInfo ord,LECCont cont,lecappnt appnt where ord.OrderNo=cont.OrderNo and cont.contno = appnt.contno and ord.ManageCom=cont.ManageCom"; ArrayList<String[]> list = new ArrayList<String[]>(); orderInfoSQL = orderInfoSQL + getWherePart(list); orderInfoSQL = orderInfoSQL + " order by cont.OrderNo, cont.ContNo"; ExeSQL exeSQL = new ExeSQL(); SSRS tSSRS = exeSQL.execSQL(orderInfoSQL, list); if (tSSRS == null) { ECPubFun.addErrorMessage(Constants.BUNDLE_PROGRAM, "query_fail"); } else { for (int i = 1; i <= tSSRS.MaxRow; i++) { String[] tOrderInfo = new String[tSSRS.MaxCol]; for (int j = 2; j <= tSSRS.MaxCol; j++) { tOrderInfo[j - 2] = tSSRS.GetText(i, j - 1); } String tmobile = tSSRS.GetText(i, tSSRS.MaxCol); LisIDEA md = new LisIDEA(); try { tmobile = md.decryptString_pre(tmobile); } catch (Exception ex) { } tOrderInfo[tSSRS.MaxCol - 1] = tmobile; this.setOrderInfo(tOrderInfo); orderInfoList.add(tOrderInfo); } } }
/** * 检验网站缩写是否在数据库中存在 * * @param event */ public void checkSiteCode(ActionEvent event) { HtmlInputText inputText = (HtmlInputText) event.getComponent().findComponent("siteCode"); String siteCode = (String) inputText.getValue(); if (siteCode == null || "".equals(siteCode)) { this.setSiteType(""); return; } String sql = "select siteCode,siteType from ledadsource where siteCode='" + siteCode + "'"; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); int row = tSSRS.getMaxRow(); if (row > 0) { this.setSiteType(tSSRS.GetText(1, 2)); return; } this.setSiteType(""); }
@SuppressWarnings("deprecation") private boolean checkData() { // 校验停售日期不能小于当前日期 boolean flag = true; boolean isNum = true; for (int i = timeoutDef.length(); --i >= 0; ) { int chr = timeoutDef.charAt(i); if (chr < 48 || chr > 57) { errorMessage.append("超时时间必须是大于0的整数!"); flag = false; isNum = false; break; } } /* if(!"".equals(timeoutDef)&&isNum&&Integer.parseInt(timeoutDef)<=0){ errorMessage.append("超时时间必须是大于0的整数!"); flag=false; } */ String startdate = ""; String enddate = ""; FDate fDate = new FDate(); if (null != endDate) { enddate = fDate.getString(endDate); } if (null != startDate) { startdate = fDate.getString(startDate); } /* if (null!=endDate && PubFun.calInterval(PubFun.getCurrentDate(), enddate, "D") <= 0) { operateResult = "checkfail"; errorMessage.append("销售止期必须大于当前日期!"); flag = false; } if (null!=endDate && null!=startDate && PubFun.calInterval(startdate, enddate, "D") < 0) { operateResult = "checkfail"; errorMessage.append("销售止期不能小于销售起期!"); flag = false; } */ // 校验险种的相关信息 int n = risks.length; if (n == 0) { operateResult = "checkfail"; errorMessage.append("请选择计划要包含的产品!"); flag = false; } else { ExeSQL tExeSql = new ExeSQL(); int mainRiskCount = 0; for (int i = 0; i < n; i++) { String sql = "select subriskflag,startdate,enddate,riskname from leprisk where riskcode='" + risks[i] + "'"; SSRS tSSRS = tExeSql.execSQL(sql); // 每个产品组合有且仅有一个主险 if (tSSRS.GetText(1, 1).equals("M")) { planMainRisk = risks[i]; mainRiskCount++; } // 销售起期要在产品的销售起期之后,停售日期要在所有产品停售之前 int s = PubFun.calInterval(tSSRS.GetText(1, 2), startdate, "D"); if (null != startDate && s < 0) { operateResult = "checkfail"; errorMessage.append( tSSRS.GetText(1, 4) + "的销售起期是" + tSSRS.GetText(1, 2) + ",产品组合的销售起期不能早于产品的销售起期!"); flag = false; } int e = PubFun.calInterval(tSSRS.GetText(1, 3), enddate, "D"); if (null != endDate && e > 0) { operateResult = "checkfail"; errorMessage.append( tSSRS.GetText(1, 4) + "的销售止期是" + tSSRS.GetText(1, 3) + ",产品组合的销售止期不能晚于产品的销售止期!"); flag = false; } } if (mainRiskCount < 1) { operateResult = "checkfail"; errorMessage.append("保险计划必须包含一个主险!"); flag = false; } else if (mainRiskCount > 1) { operateResult = "checkfail"; errorMessage.append("保险计划仅可包含一个主险!"); flag = false; } } /* if (!introduce.equals("") && introduce.trim().getBytes().length > 1600) { operateResult = "checkfail"; errorMessage.append("产品组合介绍不能多于800个汉字!"); flag = false; } if (!rule.equals("") && rule.trim().getBytes().length > 1600) { operateResult = "checkfail"; errorMessage.append("产品组合投保规则不能多于800个汉字!"); flag = false; } */ if (upfile != null && !("".equals(upfile))) { String fileName = new File(upfile.getName()).getName(); String endwith = fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length()); endwith = endwith.toUpperCase(); if (endwith == null || (!endwith.equals("JPG") && !endwith.equals("GIF") && !endwith.equals("BMP"))) { operateResult = "checkfail"; errorMessage.append("您上载图片类型" + endwith + "有误,只能上载jpg格式文件"); System.out.println("上载图片类型错误!"); flag = false; } } else { operateResult = "checkfail"; errorMessage.append("请选择要上传的图片"); flag = false; } return flag; }
/** 保存数据 */ public void save() { if (this.getSiteName() == null || "".equals(this.getSiteName())) { operateResult = "Fail|" + "网站名称不能为空!"; return; } if (this.getSiteCode() == null || "".equals(this.getSiteCode())) { operateResult = "Fail|" + "网站缩写不能为空!"; return; } if (this.getProductCode() == null || "".equals(this.getProductCode())) { operateResult = "Fail|" + "产品不能为空!"; return; } if (this.getSiteType() == null || "".equals(this.getSiteType())) { operateResult = "Fail|" + "网站类型不能为空!"; return; } if (this.payModelList == null || this.payModelList.length < 1) { operateResult = "Fail|" + "支付方式不能为空!"; return; } String type = ""; String sql = "select siteCode,siteType from ledadsource where siteCode='" + this.getSiteCode() + "'"; ExeSQL tExeSQL = new ExeSQL(); SSRS tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); int row = tSSRS.getMaxRow(); if (row > 0) { type = tSSRS.GetText(1, 2); if (!this.getSiteType().equals(type)) { operateResult = "Fail|网站编码在数据库中已存在,输入的网站类型与存在的不一致!"; return; } } sql = "select siteCode from ledadsource where " + "siteCode='" + this.getSiteCode() + "' " + "and productcode='" + this.getProductCode() + "'"; tExeSQL = new ExeSQL(); tSSRS = new SSRS(); tSSRS = tExeSQL.execSQL(sql); row = tSSRS.getMaxRow(); if (row > 0) { operateResult = "Fail|" + "添加失败!该数据在数据库中已存在!"; return; } if ("all".equals(this.getProductCode())) { this.setVisitedPage("首页面"); } else if ("register".equals(this.getProductCode())) { this.setVisitedPage("注册页面"); } else if ("actIndex".equals(this.getProductCode())) { this.setVisitedPage("宣传页面"); } else if ("readIndex".equals(this.getProductCode())) { this.setVisitedPage("阅读投保须知页面"); } else { sql = "select contplanname from lepplan where contplancode='" + this.getProductCode() + "' and plantype='00'"; this.setVisitedPage(tExeSQL.getOneValue(sql)); } String siteUrl = "http://icare.metlife.com.cn/visit.jsf?source="; LisIDEA tLisIDEA = new LisIDEA(); siteUrl = siteUrl + tLisIDEA.encryptString(this.getSiteCode()); siteUrl = siteUrl + "&product=" + tLisIDEA.encryptString(this.getProductCode()); LEDAdSourceSchema tLEDAdSourceSchema = new LEDAdSourceSchema(); tLEDAdSourceSchema.setContent(this.getContent()); tLEDAdSourceSchema.setProductCode(this.getProductCode()); tLEDAdSourceSchema.setSiteCode(this.getSiteCode()); tLEDAdSourceSchema.setSiteName(this.getSiteName()); tLEDAdSourceSchema.setSiteType(this.getSiteType()); tLEDAdSourceSchema.setUrl(siteUrl); tLEDAdSourceSchema.setPayMode(this.getPayMode()); tLEDAdSourceSchema.setVisitedPage(this.getVisitedPage()); MMap map = new MMap(); map.put(tLEDAdSourceSchema, "INSERT"); PubSubmit tPubSubmit = new PubSubmit(); VData cVData = new VData(); cVData.add(map); if (!tPubSubmit.submitData(cVData, "")) { operateResult = "Fail|添加失败"; return; } else { operateResult = "Succ|添加成功"; initData(); find(); return; } }