@Override public List<T> handle(ResultSet rs) throws SQLException { List<T> list = new LinkedList<>(); while (rs.next()) { try { T t = this.clz.newInstance(); BeanInfo beanInfo = Introspector.getBeanInfo(this.clz, Object.class); PropertyDescriptor[] descriptors = beanInfo.getPropertyDescriptors(); Map<String, Object> map = new HashMap<String, Object>(); for (PropertyDescriptor pd : descriptors) { String propertyName = pd.getName(); Class<?> propertyType = pd.getPropertyType(); if (propertyType.isAnnotationPresent(Entry.class)) { propertyName = propertyName + "_id"; } Object value = rs.getObject(propertyName); if (propertyType.isAnnotationPresent(Entry.class)) { value = getObject(value, propertyType); } map.put(pd.getName(), value); } BeanUtils.copyProperties(t, map); list.add(t); } catch (InstantiationException | IllegalAccessException | IntrospectionException | InvocationTargetException e) { e.printStackTrace(); } } return list; }
/** @param 从业人员信息(t_cyryxx) 注销 */ public boolean updateQyryxxZx(Qyryxx qyryxx) throws Exception { // TODO Auto-generated method stub boolean isSuccess = false; Date currentDate = new Date(); // 保存人员历史信息 Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx(); Qyryxx qyryxx_bak = new Qyryxx(); Wgcyryxx wgcyryxx_bak = new Wgcyryxx(); qyryxx_bak.setRyid(qyryxx.getRyid()); wgcyryxx_bak.setRyid(qyryxx.getRyid()); qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak); wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak); if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak); if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak); qyryxx_lsxx.setCzlx("注销"); qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx); // 修改从业人员信息 qyryxx.setZxbz("1"); qyryxx.setZxsj(currentDate); qyryxx.setCyryzt("离职"); qyryxxDao.updateQyryxx(qyryxx); // 人员信息操作日志 Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQyid(qyryxx.getQyid()); qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx); Ryxxczrz ryxxczrz = new Ryxxczrz(); ryxxczrz.setCzsj(currentDate); ryxxczrz.setCzlx("注销"); ryxxczrz.setCzr(qyryxx.getZxr()); ryxxczrz.setQybm(qyjbxx.getQybm()); ryxxczrz.setCyrybh(qyryxx.getCyrybh()); ryxxczrzDao.insertRyxxczrz(ryxxczrz); // 更新场所总人数 // if(!cyryxx_bak.getCsid().equals(cyryxx.getCsid())) // { Map map = new HashMap(); map.put("p_oldQyid", qyryxx_bak.getQyid()); map.put("p_newQyid", 0); qyZrsProcDao.updateQyzrs(map); // } //// 注销员工用户 int errResult = 0; if (sczhFlag(qyryxx_bak.getHylbdm(), qyryxx_bak.getGwbh()).equals("1")) { if (getUser(qyryxx_bak.getCyrybh()).equals("1")) { GgQyyh qyyh = new GgQyyh(); qyyh.setRyid(qyryxx.getRyid()); qyyh.setIsval("0"); // 是否可见 errResult = ggQyyhDao.zhuxQyYgyh(qyyh); } } if (errResult == 1) { return false; } isSuccess = true; return isSuccess; }
@Override public void saveDomain(BaseBusinessDomain busDomain, UserDomain user) throws Exception { BgMpjDomain domain = (BgMpjDomain) busDomain; BgMpjDomain bgDomain = null; BgMpj bo = new BgMpj(); if (StringUtils.isNotBlank(domain.getBgDjxh())) { bgDomain = (BgMpjDomain) this.getDomainByKey(domain); } if (bgDomain != null) { bgDomain.setXm(domain.getXm()); bgDomain.setGs(domain.getGs()); bgDomain.setZw(domain.getZw()); bgDomain.setDz(domain.getDz()); bgDomain.setDh(domain.getDh()); bgDomain.setSj(domain.getSj()); bgDomain.setCz(domain.getCz()); bgDomain.setWz(domain.getWz()); bgDomain.setYb(domain.getYb()); bgDomain.setDy(domain.getDy()); bgDomain.setXgrCzyDjxh(user.getCzyDjxh()); bgDomain.setXgrq(SysDateUtil.getCurrentDate()); BeanUtils.copyProperties(bo, bgDomain); businessSqlMapClientTemplate.update("updateBgMpjByKey", bo); } else { domain.setYxbz("Y"); domain.setCjrq(SysDateUtil.getCurrentDate()); domain.setXgrq(SysDateUtil.getCurrentDate()); domain.setCzyDjxh(user.getCzyDjxh()); domain.setCjrCzyDjxh(user.getCzyDjxh()); domain.setXgrCzyDjxh(user.getCzyDjxh()); BeanUtils.copyProperties(bo, domain); businessSqlMapClientTemplate.insert("insertBgMpj", bo); } }
@Override public PageInfo byMonitorCode(SiteBO siteBO) { try { PageHelper.startPage(siteBO.getPage(), siteBO.getRows()); Long t1 = System.currentTimeMillis(); Map<String, Object> re = Bean2Map.trans(siteBO); System.out.println(System.currentTimeMillis() - t1 + " : " + re); if ("-1".equals(siteBO.getMonitorCode())) { List<String> codes = ShiroCustomUtils.getMonitors(); if (codes.size() > 0) { re.put("monitorCode", codes.get(0)); } else { re.remove("monitorCode"); } } List<Site> list = siteDao.byMonitorCode(re); List<SiteBO> sbl = new ArrayList<>(); try { // TODO 连接REDIS获取实时统计数据 for (Site m : list) { SiteBO sb = new SiteBO(); BeanUtils.copyProperties(sb, m); Map<String, String> site = redisBasicService.getSiteHash(m.getSiteCode()); BeanUtils.populate(sb, site); Long counts = alarmHistoryService.getCountByCode(sb.getSiteCode()); sb.setTotalAlarm(counts); TerminalBO tb = terminalLogService.getSiteTerminalInfo(sb.getSiteCode()); if (tb != null) { if (tb.getSiteTerminalTotalNum() != null && tb.getSiteTerminalUnknowNum() != null) { int usingNum = tb.getSiteTerminalTotalNum(); int unKnownNum = tb.getSiteTerminalUnknowNum(); if (usingNum != 0 || unKnownNum != 0) { double rate = (usingNum + 0.0) / (unKnownNum + usingNum + 0.0); sb.setInstallationRate(String.format("%.2f", rate * 100) + "%"); } else { sb.setInstallationRate("0.0%"); } } } sbl.add(sb); } } catch (Exception e) { Map<String, SiteLiveData> liveLatest = siteLiveDataService.getAllLatest(); for (Site s : list) { SiteBO sb = new SiteBO(); BeanUtils.copyProperties(sb, s); if (liveLatest.containsKey(s.getSiteCode())) { BeanUtils.copyProperties(sb, liveLatest.get(s.getSiteCode())); } sbl.add(sb); } } return PageInfo.clone(list, sbl); } catch (Exception e) { e.printStackTrace(); } return null; }
/** @param 企业人员信息(t_qyryxx) 删除 */ public boolean deleteQyryxx(Qyryxx qyryxx) throws Exception { // TODO: implement boolean isSuccess = false; Date currentDate = new Date(); // 保存人员历史信息 Qyryxx_lsxx qyryxx_lsxx = new Qyryxx_lsxx(); Qyryxx qyryxx_bak = new Qyryxx(); Wgcyryxx wgcyryxx_bak = new Wgcyryxx(); qyryxx_bak.setRyid(qyryxx.getRyid()); qyryxx_bak = qyryxxDao.getQyryxx(qyryxx_bak); wgcyryxx_bak.setRyid(qyryxx.getRyid()); wgcyryxx_bak = wgcyryxxDao.getWgcyryxx(wgcyryxx_bak); if (qyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, qyryxx_bak); if (wgcyryxx_bak != null) BeanUtils.copyProperties(qyryxx_lsxx, wgcyryxx_bak); qyryxx_lsxx.setCzlx("删除"); qyryxx_lsxxDao.insertQyryxx_lsxx(qyryxx_lsxx); // 修改从业人员信息表 qyryxx.setScbz(1); qyryxx.setZxsj(currentDate); qyryxx.setZxr(qyryxx.getCzr()); qyryxxDao.updateQyryxx(qyryxx); // 更新场所总人数 Map map = new HashMap(); map.put("p_oldQyid", qyryxx_bak.getQyid()); map.put("p_newQyid", 0); qyZrsProcDao.updateQyzrs(map); // 人员信息操作日志 Qyjbxx qyjbxx = new Qyjbxx(); qyjbxx.setQyid(qyryxx_bak.getQyid()); qyjbxx = qyjbxxDao.getQyjbxx(qyjbxx); Ryxxczrz ryxxczrz = new Ryxxczrz(); ryxxczrz.setCzsj(currentDate); ryxxczrz.setCzlx("删除"); ryxxczrz.setCzr(qyryxx.getZxr()); ryxxczrz.setQybm(qyjbxx.getQybm()); ryxxczrz.setCyrybh(qyryxx_bak.getCyrybh()); ryxxczrzDao.insertRyxxczrz(ryxxczrz); int errCode = 0; // 删除员工用户 if (sczhFlag(qyryxx_bak.getHylbdm(), qyryxx_bak.getGwbh()).equals("1")) { if (getUser(qyryxx_bak.getCyrybh()).equals("1")) { GgQyyh qyyh = new GgQyyh(); qyyh.setRyid(qyryxx_bak.getRyid()); errCode = ggQyyhDao.delQyYgyh(qyyh); // 删除员工用户 } } if (errCode == 1) return false; return isSuccess; }
@Override public List<FTEStagingDTO> getFTEStaingDataForContractYear( Integer solId, Integer serviceScopeId, String startDate, String endDate) { List<FTEStagingDTO> fteStagingDTOs = new ArrayList<>(); String query = "from FTEStaging f where f.solution.solutionId=" + solId + " and f.opportunityScope.opportunityScopeId=" + serviceScopeId + " and monthYear >='" + startDate + "' and monthYear <='" + endDate + "'"; System.out.println("contract year query string : " + query); List<FTEStaging> fteStagings = getHibernateTemplate().find(query); for (FTEStaging fteStaging : fteStagings) { FTEStagingDTO fteStagingDTO = new FTEStagingDTO(); SolutionDTO solutionDTO = new SolutionDTO(); OpportunityScopeDTO opportunityScopeDTO = new OpportunityScopeDTO(); JobRoleStagesDTO jobRoleStagesDTO = new JobRoleStagesDTO(); try { org.apache.commons.beanutils.BeanUtils.copyProperties( solutionDTO, fteStaging.getSolution()); org.apache.commons.beanutils.BeanUtils.copyProperties( opportunityScopeDTO, fteStaging.getOpportunityScope()); org.apache.commons.beanutils.BeanUtils.copyProperties( jobRoleStagesDTO, fteStaging.getJobRoleStage()); } catch (Exception e) { e.printStackTrace(); } fteStagingDTO.setFtecount(fteStaging.getFtecount()); fteStagingDTO.setFtestagingId(fteStaging.getFtestagingId()); fteStagingDTO.setJobRoleStagesDTO(jobRoleStagesDTO); fteStagingDTO.setLocation(fteStaging.getLocation()); fteStagingDTO.setMonthYear(fteStaging.getMonthYear()); fteStagingDTO.setOpportunityScopeDTO(opportunityScopeDTO); fteStagingDTO.setSolutionDTO(solutionDTO); fteStagingDTO.setSubLocation(fteStaging.getSubLocation()); fteStagingDTOs.add(fteStagingDTO); } return fteStagingDTOs; }
public DeliveryOrder createDeliveryOrder(List<PurchaseOrderDetail> purchaseOrderDetailList) throws IllegalAccessException, InvocationTargetException { DeliveryOrder deliveryOrder = null; PurchaseOrder purchaseOrder = null; for (int i = 0; i < purchaseOrderDetailList.size(); i++) { PurchaseOrderDetail purchaseOrderDetail = purchaseOrderDetailList.get(i); if (deliveryOrder == null) { purchaseOrder = purchaseOrderDetail.getPurchaseOrder(); deliveryOrder = new DeliveryOrder(); BeanUtils.copyProperties(deliveryOrder, purchaseOrder); deliveryOrder.setDoNo( this.numberControlManager.generateNumber( purchaseOrder.getPlantSupplier().getDoNoPrefix(), 10)); deliveryOrder.setExternalDoNo(deliveryOrder.getDoNo()); deliveryOrder.setCreateDate(new Date()); deliveryOrder.setIsExport(false); deliveryOrder.setIsPrint(false); deliveryOrder.setIsRead(false); deliveryOrder.setStatus("Create"); } DeliveryOrderDetail deliveryOrderDetail = new DeliveryOrderDetail(); BeanUtils.copyProperties(deliveryOrderDetail, purchaseOrderDetail); deliveryOrderDetail.setDeliveryOrder(deliveryOrder); deliveryOrderDetail.setUnitCount(purchaseOrderDetail.getItem().getUnitCount()); deliveryOrderDetail.setQty(purchaseOrderDetail.getCurrentShipQty()); // deliveryOrderDetail.setOrderQty(purchaseOrderDetail.getQty()); deliveryOrderDetail.setReferenceOrderNo(purchaseOrderDetail.getPurchaseOrder().getPoNo()); deliveryOrderDetail.setReferenceSequence(purchaseOrderDetail.getSequence()); deliveryOrderDetail.setPurchaseOrderDetail(purchaseOrderDetail); deliveryOrder.addDeliveryOrderDetail(deliveryOrderDetail); // if (purchaseOrderDetail.getShipQty() == null) { // purchaseOrderDetail.setShipQty(BigDecimal.ZERO); // } // // purchaseOrderDetail.setShipQty(purchaseOrderDetail.getShipQty().add(purchaseOrderDetail.getCurrentShipQty())); this.purchaseOrderDetailManager.save(purchaseOrderDetail); } // this.purchaseOrderManager.tryClosePurchaseOrder(purchaseOrder.getPoNo()); this.save(deliveryOrder); return deliveryOrder; }
/** 编辑实体Full action的方法,首先获取entityfull的信息,返回到编辑页面 */ public String editKbDiseaseFull() { log.info(logprefix + "viewKbDisease"); try { if (kbDisease.getId() != null && kbDisease.getId() > 0) { KbDiseaseFull temKbDiseaseFull = kbDiseaseService.selectKbDiseaseFullById(kbDisease.getId()); BeanUtils.copyProperties(kbDiseaseFull, temKbDiseaseFull); actionMsg = getText("selectKbDiseaseByIdSuccess"); } else { actionMsg = getText("selectKbDiseaseByIdFail"); System.out.println(actionMsg); } return SUCCESS; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); log.error("类KbDiseaseAction的方法:selectKbDiseaseFullById错误" + e); } return "error"; }
@SuppressWarnings("unchecked") @Override public DeptContactMainVo view(String pname, String pincident, DeptContactParamVo params) { TDeptContactMain mainBo = new TDeptContactMain(); DeptContactMainVo mainVo = new DeptContactMainVo(); mainBo = this.deptContactDao.getMainBo(pname, pincident); try { BeanUtils.copyProperties(mainVo, mainBo); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } params.mainBo = mainBo; params.treeBo = deptContactDao.getTreeBoByMainBoId(mainBo.getId()); params.addParam("mainBo.initiatorName", mainBo.getInitiatorName()); params.addParam("mainBo.createDeptname", mainBo.getCreateDeptname()); params.addParam("mainBo.serial", deptContactCommonService.getSerialNumberText(mainBo)); params.addParam( DeptContactConstants.PARAMS_KEY_REF_ID, deptContactCommonService.getReferenceIds(mainBo.getId())); return mainVo; }
@Override public void saveOrUpdate(Historial historial) throws Exception { Thistorial thistorial = new Thistorial(); BeanUtils.copyProperties(thistorial, historial); HistorialDao historialDao = (HistorialDao) ServiceFinder.findBean("HistorialDao"); historialDao.saveOrUpdate(thistorial); }
@Override public List<Product> searchByCategory( Integer category, int pageNumber, int pageSize, boolean cascade) throws Exception { List<Product> find = null; if (category == null) { find = productDao.find(pageNumber, pageSize, null, null, null, null, null, null, null, false); } else { find = productDao.find( pageNumber, pageSize, null, null, new String[] {"category"}, new Object[] {category}, null, null, null, false); } if (cascade && find != null) { for (Product product : find) { Article article = articleDao.findById(product.getParentId()); BeanUtils.copyProperties(product, article); } } return find; }
public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { ShadeputyresearchproductionForm form = (ShadeputyresearchproductionForm) actionForm; Shadeputyresearchproduction bean = new Shadeputyresearchproduction(); Integer shadbi_id = (Integer) httpServletRequest.getSession().getAttribute("shadbi_id"); form.setShadbi_id(shadbi_id); try { org.apache.commons.beanutils.BeanUtils.copyProperties(bean, form); } catch (Exception ex) { } String tempproddate = form.getTempproddate(); if (tempproddate.equals("")) { tempproddate = null; } else { bean.setProddate(DateUtil.getCalendar(tempproddate).getTime()); } if (shadeputyresearchproductionDAO.modifyShadeputyresearchproduction(bean)) { return actionMapping.findForward("success"); } return actionMapping.findForward("failure"); }
public ActionForward initEditEscalation( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionErrors errors = new ActionErrors(); ActionForward forward = new ActionForward(); try { EscalationForm escalationForm = (EscalationForm) form; EscalationDao escalationDaoImpl = new EscalationDaoImpl(); EscalationDTO escalationDTO = new EscalationDTO(); String requestNo = escalationForm.getWorkflow_escalation_id(); populate(form, request); List escalation_template_list = escalationForm.getEscalation_template_list(); escalationDTO = escalationDaoImpl.getEscalationdtls(requestNo); BeanUtils.copyProperties(escalationForm, escalationDTO); escalationForm.setEscalation_template_list(escalation_template_list); } catch (Exception exp) { exp.printStackTrace(); errors.add("editEscalation", new ActionError("")); saveErrors(request, errors); return mapping.findForward("EditEscalation"); } forward = mapping.findForward("EditEscalation"); return (forward); }
/** * Copia as propriedades do bean de origem para o bean destino, as propriedades devem ter o mesmo * nome. * * @param destino O bean onde as propriedades serao atribuidas. * @param origem O bean de onde as propriedades serao extraÃdas. * @throws SystemException caso ocorra algum erro ao copiar o bean */ public static void copy(Object destino, Object origem) throws SystemException { try { BeanUtils.copyProperties(destino, origem); } catch (Exception e) { tratarExcecao(e); } }
/** * view KbDiseaseFull need give parmeter id get id from modle, * * @return */ public String viewKbDiseaseFull() { try { int getId = kbDisease.getId(); log.info(this.logprefix + ";id=" + getId); if (getId < 0) { log.error("error,id小于0不规范"); return "error"; } KbDiseaseFull temKbDiseaseFull = kbDiseaseService.selectKbDiseaseFullById(getId); if (temKbDiseaseFull != null) { BeanUtils.copyProperties(kbDiseaseFull, temKbDiseaseFull); return SUCCESS; } else { log.error("error,查询实体不存在。"); return "Error"; } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return "Error"; }
public static void copyProperties(Object dest, Object origem) { try { BeanUtils.copyProperties(dest, origem); } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } }
protected void loadData() { File file = new File(getPersistentFileName()); FileInputStream in = null; ObjectInputStream s = null; boolean serialVersionUIDFailure = false; try { if (file.exists()) { in = new FileInputStream(file); s = new ObjectInputStream(in); BeanUtils.copyProperties(this, s.readObject()); this.isExist = true; } else { this.isExist = false; } } catch (Exception ex) { ex.printStackTrace(); serialVersionUIDFailure = true; } finally { try { if (s != null) s.close(); if (in != null) in.close(); } catch (IOException e) { e.printStackTrace(); } } if (serialVersionUIDFailure) { file.delete(); } }
@SuppressWarnings("unchecked") public String getSearhData(DrugRequire message) { BaseDaoImpl<DrugView> dao = new BaseDaoImpl<DrugView>(); String hql = "from DrugView d where 1=1 "; // hql = addWhere(hql, message); Query queryObject = dao.getCurrentSession().createQuery(hql); List<DrugView> list = queryObject.list(); List<TDrugView> re = new ArrayList<TDrugView>(); for (DrugView drug : list) { TDrugView tview = new TDrugView(); try { BeanUtils.copyProperties(tview, drug); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InvocationTargetException e) { // TODO Auto-generated catch block e.printStackTrace(); } re.add(tview); } DataGrid dg = new DataGrid(); dg.setTotal(dao.count("select count(*) " + hql)); dg.setRows(re); return null; }
/** * 访问接口,将返回数据存到本地数据库 startDate 格式:yyyy-mm-dd * * @throws Exception */ @Deprecated public int importTainPlan(String schemeId, String startDate, String dayCount) throws Exception { // 调用后台接口之前推送一条消息到页面 quoteService.sendQuotes("", 0, 0, "plan.getInfo.begin"); List<PlanCrossInfo> listPlanCross = new ArrayList<PlanCrossInfo>(); List<CrossInfo> listCross = crossService.getUnitCrossInfoForChartId(schemeId); if (listCross != null && listCross.size() > 0) { for (CrossInfo cross : listCross) { PlanCrossInfo planCross = new PlanCrossInfo(); BeanUtils.copyProperties(planCross, cross); // 单独设置属性名不一样的字段 planCross.setPlanCrossId(UUID.randomUUID().toString()); planCross.setBaseChartId(cross.getChartId()); planCross.setBaseChartName(cross.getChartName()); planCross.setBaseCrossId(cross.getBaseCrossId()); planCross.setCrossStartDate(startDate.replaceAll("-", "")); String crossStartDate = cross.getCrossStartDate(); String crossEndDate = cross.getCrossEndDate(); // int crossDayGap = DateUtil.getDaysBetween(DateUtil.getFormateDay(crossStartDate), // DateUtil.getFormateDay(crossEndDate)); // planCross.setCrossEndDate(DateUtil.getDateByDay(startDate, -(Integer.valueOf(dayCount) + // crossDayGap))); planCross.setCrossEndDate("20140930"); listPlanCross.add(planCross); } } // 添加数据到表plan_cross int count = crossService.addPlanCrossInfo(listPlanCross); // 做交路计划,第一个参数传null,表示全部交路都做 // int crossCount = runPlanService.generateRunPlan(null, startDate, Integer.valueOf(dayCount)); // 全部处理完了,推送一条消息到页面 quoteService.sendQuotes("", 0, 0, "plan.end"); return 0; }
// 把请求封装成对象 protected void request2Obj(HttpServletRequest req, Object target) { try { BeanUtils.copyProperties(target, req.getParameterMap()); // 属性拷贝 } catch (Exception e) { e.printStackTrace(); } }
public ActionForward execute( ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) { AcademybaseinfoForm form = new AcademybaseinfoForm(); Integer abi_id = Integer.valueOf(httpServletRequest.getParameter("abi_id")); Academybaseinfo bean = new Academybaseinfo(); if (httpServletRequest.getParameter("abi_id") != null) { abi_id = Integer.valueOf(httpServletRequest.getParameter("abi_id")); bean = academybaseinfoDAO.getAcademybaseinfo(abi_id); } else { abi_id = (Integer) httpServletRequest.getSession().getAttribute("abi_id"); bean = academybaseinfoDAO.getAcademybaseinfo(abi_id); } try { org.apache.commons.beanutils.BeanUtils.copyProperties(form, bean); } catch (Exception ex) { return actionMapping.findForward("failure"); } form.setTempregisterdate(DateUtil.getCalendarString(form.getRegisterdate(), "yyyy-MM-dd")); httpServletRequest.setAttribute("academybaseinfoForm", form); httpServletRequest.getSession().setAttribute("acadname", form.getAcadname()); httpServletRequest.getSession().setAttribute("abi_id", abi_id); return actionMapping.findForward("success"); }
public RouteHandOverResolutionActionForm getRouteHandOverReqDtl( RouteHandOverResolutionActionForm routeHandOverActionForm) throws Exception { RouteHandOverResolutionDao routeHandOverRequestDaoImpl = new RouteHandOverResolutionDaoImpl(); RouteHandOverResolutionDto routeHandOverRequestDto = new RouteHandOverResolutionDto(); BeanUtils.copyProperties(routeHandOverRequestDto, routeHandOverActionForm); List<RouteHandOverResolutionDto> requestList = routeHandOverRequestDaoImpl.getRouteHandOverRequestDtl(routeHandOverRequestDto); for (RouteHandOverResolutionDto requestDto : requestList) { routeHandOverActionForm.setAbc(requestDto.getAbc()); routeHandOverActionForm.setPermissionCopy(requestDto.getPermissionCopy()); routeHandOverActionForm.setBgRecevingCopy(requestDto.getBgRecevingCopy()); routeHandOverActionForm.setDeviationCopy(requestDto.getDeviationCopy()); routeHandOverActionForm.setMaterialReco(requestDto.getMaterialReco()); routeHandOverActionForm.setAtReportSignoff(requestDto.getAtReportSignoff()); routeHandOverActionForm.setPenalityApplicable(requestDto.getPenalityApplicable()); routeHandOverActionForm.setNcFreeRouteDelivery(requestDto.getNcFreeRouteDelivery()); routeHandOverActionForm.setTimelyDelivery(requestDto.getTimelyDelivery()); routeHandOverActionForm.setCommitedDate(requestDto.getCommitedDate()); routeHandOverActionForm.setVendorProjMnt(requestDto.getVendorProjMnt()); routeHandOverActionForm.setProcessCompliance(requestDto.getProcessCompliance()); } return routeHandOverActionForm; }
/** * 商品在庫表リスト取得処理 * * @param form * @return * @throws IOException * @throws SQLException * @throws IllegalAccessException * @throws InvocationTargetException */ public static List<BookItemStock> getBookItemStockList(BookItemForm form) throws IOException, SQLException, IllegalAccessException, InvocationTargetException { BookItemStockDAO dao = new BookItemStockDAO(TransactionInfo.getConnection()); List<BookItemStock> bookItemStockList = new ArrayList<BookItemStock>(); List<Object> params = new ArrayList<Object>(); StringBuilder sql = new StringBuilder(); sql.append(choiceSQLSelect(form, params)); sql.append(CommonConstants.HALF_SPACE); sql.append(choiceSQLSort(form)); List<CommonDTO> retList = dao.select(sql.toString(), params); for (CommonDTO dto : retList) { BookItemStock bookItemStock = new BookItemStock(); ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class); BeanUtils.copyProperties(bookItemStock, SerializationUtils.clone((BookItemStockDTO) dto)); bookItemStock.setKabusoku( BookItemCommonBL.calcKabusoku(bookItemStock.getProperStock(), bookItemStock.getStock())); bookItemStockList.add(bookItemStock); } return bookItemStockList; }
@SuppressWarnings("deprecation") private void _loadForm(ActionForm form, ActionRequest req, ActionResponse res) { try { StructureForm structureForm = (StructureForm) form; Structure structure = (Structure) req.getAttribute(WebKeys.Structure.STRUCTURE); BeanUtils.copyProperties(structureForm, structure); structureForm.setFields(structure.getFields()); if (structure.getReviewInterval() != null) { String interval = structure.getReviewInterval(); Pattern p = Pattern.compile("(\\d+)([dmy])"); Matcher m = p.matcher(interval); boolean b = m.matches(); if (b) { structureForm.setReviewContent(true); String g1 = m.group(1); String g2 = m.group(2); structureForm.setReviewIntervalNum(g1); structureForm.setReviewIntervalSelect(g2); } } if (UtilMethods.isSet(structure.getDetailPage())) { Identifier ident = APILocator.getIdentifierAPI().find(structure.getDetailPage()); HTMLPage page = HTMLPageFactory.getLiveHTMLPageByIdentifier(ident); if (InodeUtils.isSet(page.getInode())) { structureForm.setDetailPage(page.getIdentifier()); } } } catch (Exception ex) { Logger.debug(EditStructureAction.class, ex.toString()); } }
/** * @Title: replyComment @Description: 卖家回复评论 * * @author <a href="*****@*****.**">蔡志杰</a> * @date 2015-8-25 下午4:35:02 * @version 1.0.0 * @param @param data * @param @param request * @param @return * @return Object 返回类型 * @throws */ @RequestMapping("/replyComment") public Object replyComment(String data, HttpServletRequest request) { log.info("---------CommentsManagerController.replyComment-----------"); log.info("----------------------data:" + data + "-------------------------"); HeadObject headObject = null; ResultObject resultObject = null; OrderCommentVO orderCommentVO = JSON.parseObject(data, OrderCommentVO.class); ValidationResult bindingResult = ValidationUtils.validateEntity(orderCommentVO); if (bindingResult.isHasErrors()) { return elementErrors(headObject, bindingResult); } try { MemberListDo memberListDo = APICommonUtil.getMemberListDo((String) request.getAttribute("sessionid")); if (null != memberListDo) { orderCommentVO.setCommentsType(CommentConstant.CommentsType.EXPLAIN.getKey()); orderCommentVO.setMemberId(Long.parseLong(memberListDo.getMemberId())); OrderComment record = new OrderComment(); BeanUtils.copyProperties(record, orderCommentVO); headObject = CommonHeadUtil.geneHeadObject("orderCommentService.saveOrderComment"); resultObject = (ResultObject) orderService.doServiceByServer(new RequestObject(headObject, record)); } else { return CommonUtil.notLoign(headObject); } } catch (Exception e) { e.printStackTrace(); log.error("数据处理异常{}", e); return processExpction(headObject); } return resultObject; }
@Override public void saveOrUpdate(Conocimiento conocimiento) throws Exception { Tconocimiento tconocimiento = new Tconocimiento(); BeanUtils.copyProperties(tconocimiento, conocimiento); ContenidoDao contenidoDao = (ContenidoDao) ServiceFinder.findBean("ContenidoDao"); contenidoDao.saveOrUpdate(tconocimiento); }
public String getByID() throws Exception { System.out.println("hello"); System.out.println("通过ID查找对象"); String cid = this.request.getParameter("chID"); int id = Integer.parseInt(cid); System.out.println(id); Channel cen = (Channel) channelDao.findObjectById(Channel.class, id); System.out.println(cen); ChannelVo vo = new ChannelVo(); BeanUtils.copyProperties(vo, cen); System.out.println(vo); JSONObject obj = new JSONObject(); System.out.println(cen.getId()); if (cen.getParentChannel() == null) { } else { vo.setParentChannel(cen.getParentChannel().getId()); vo.setParentName(cen.getParentChannel().getName()); } obj.element("chan", vo); PrintWriter out = this.response.getWriter(); out.write(obj.toString()); System.out.println(obj.toString()); out.flush(); return null; }
/* (非 Javadoc) * <p>Title: findAllFunctionList</p> * <p>Description:按节点查询所有程式 </p> * @param pid * @return */ public List<TreeGridModel> findAllFunctionList(Integer pid) { String hql = "from Permission t where t.status='A' "; if (pid == null || "".equals(pid)) { hql += " and t.pid is null"; } else { hql += " and t.pid=" + pid; } List<Permission> list = permissionPublicDao.find(hql); List<TreeGridModel> tempList = new ArrayList<TreeGridModel>(); for (Permission function : list) { TreeGridModel treeGridModel = new TreeGridModel(); try { BeanUtils.copyProperties(treeGridModel, function); if (pid == null || "".equals(pid)) { treeGridModel.setPid(null); } tempList.add(treeGridModel); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } return tempList; }
@Override public void flowStepUpdate(DeptContactParamVo params) { if (resultInfo.getOperateFlag()) { DeptContactMainVo mainVo = params.mainVo; TDeptContactMain mainBo = (TDeptContactMain) commonService.load(mainVo.getId(), TDeptContactMain.class); String taskUserLoginName = userInfo.getLoginName(); try { BeanUtils.copyProperties(mainBo, mainVo); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } mainBo.setUpdateTime(time); mainBo.setOperateDate(time); mainBo.setOperateUser(taskUserLoginName); mainBo.setOperateName(userInfo.getUserName()); params.mainBo = mainBo; deptContactCommonService.saveReferences(params); commonService.update(mainBo); } }
/** 编辑实体 action的方法,首先获取entity的信息,返回到编辑页面 */ public String editKbDisease() { log.info(logprefix + "editKbDisease"); try { // 实体的id可以为0 if (kbDisease.getId() != null && kbDisease.getId() >= 0) { KbDisease temKbDisease = kbDiseaseService.selectKbDiseaseById(kbDisease.getId()); if (temKbDisease != null) { BeanUtils.copyProperties(kbDiseaseModel, temKbDisease); // actionMsg = getText("selectKbDiseaseByIdSuccess"); return SUCCESS; } } return "PageNotExist"; } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); log.error("类KbDiseaseAction的方法:selectKbDiseaseById错误" + e); } return "error"; }