• 时间默认值 前后台备份


    @RequestMapping(params = "list")
        public ModelAndView list(HttpServletRequest request) {
             String str1 = ""; 
             String str2 = "";
             long current=System.currentTimeMillis();//当前时间毫秒数
             long zero=current/(1000*3600*24)*(1000*3600*24)-TimeZone.getDefault().getRawOffset();//今天零点零分零秒的毫秒数
             long twelve=zero+24*60*60*1000-1;//今天23点59分59秒的毫秒数  
             try {
                 Timestamp times1 = new Timestamp(zero);//今天零点零分零秒
                 Timestamp times2 = new Timestamp(twelve);//今天23点59分59秒
                 SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式 
                 
                 str1 = df.format(times1);  
                 str2 = df.format(times2);  
                 request.setAttribute("startDate", str1);
                 request.setAttribute("endDate", str2);
             } catch (Exception e) {
                // TODO: handle exception
             }
              
            return new ModelAndView("com/jeecg/business_express/businessExpressList");
        }

    2、查询

    @RequestMapping(params = "datagrid")
        public void datagrid(BusinessExpressEntity businessExpress,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
            CriteriaQuery cq = new CriteriaQuery(BusinessExpressEntity.class, dataGrid);
            //查询条件组装器
            org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, businessExpress, request.getParameterMap());
            String businessCustomerinvoicecode = request.getParameter("businessCustomerinvoicecode1");//订单号、转单号、渠道转单号、内部单号
            String businessCheckindate_begin = request.getParameter("startDate");//收获开始时间
            String businessCheckindate_end = request.getParameter("endDate");//收获结束时间
            try{
            //自定义追加查询条件
                if(oConvertUtils.isNotEmpty(businessCheckindate_begin)){
                    try {
                        cq.ge("businessCheckindate", DateUtils.parseDate(businessCheckindate_begin, "yyyy-MM-dd hh:mm:ss"));
                    } catch (ParseException e) {
                        logger.error(e.toString());
                    }
                    cq.add();
                }
                if(oConvertUtils.isNotEmpty(businessCheckindate_end)){
                    try {
                        cq.le("businessCheckindate", DateUtils.parseDate(businessCheckindate_end, "yyyy-MM-dd hh:mm:ss"));
                    } catch (ParseException e) {
                        logger.error(e.toString());
                    }
                    cq.add();
                }
                if(StringUtil.isNotEmpty(businessCustomerinvoicecode)){
                    cq.add(Restrictions.sqlRestriction(" (business_customerinvoicecode like '%"+businessCustomerinvoicecode+"%' "
                                                     + " or business_serveinvoicecode like '%"+businessCustomerinvoicecode+"%' "
                                                     + " or business_seqinvoicecode like '%"+businessCustomerinvoicecode+"%' "
                                                     + " or channel_id like '%"+businessCustomerinvoicecode+"%')")); 
                }
                
            }catch (Exception e) {
                throw new BusinessException(e.getMessage());
            }
            cq.add();
            this.businessExpressService.getDataGridReturn(cq, true);
            TagUtil.datagrid(response, dataGrid);
        }

    3、前台页面及js

     <div id="tempSearchColums1" style="display: none;">
         <div name="searchColums1">&nbsp;&nbsp;&nbsp;&nbsp; </br>收货开始时间:
             <input type="text" id="startDate"  name="startDate" class="Wdate" style="180px;"  onClick="WdatePicker({dateFmt:'yyyy-MM-dd 00:00:00'})" 
                         autocomplete="off" value="${startDate}"/>  </div>
       </div>
       <div id="tempSearchColums2" style="display: none;">
         <div name="searchColums2">&nbsp;&nbsp;&nbsp;&nbsp; 收获结束日期:
         <input type="text" id="endDate"  name="endDate"  style="180px" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd 00:00:00'})" 
                         autocomplete="off" value="${endDate}"/>  </div>
       </div>
     $(document).ready(function(){
    
           var datagrid = $("#businessExpressListtb");
           datagrid.find("div[name='searchColums']").find("form#businessExpressListForm").append($("#tempSearchColums div[name='searchColums']").html());
           $("#tempSearchColums").html('');
           datagrid.find("div[name='searchColums']").find("form#businessExpressListForm").append($("#tempSearchColums1 div[name='searchColums1']").html());
           $("#tempSearchColums1").html('');
           datagrid.find("div[name='searchColums']").find("form#businessExpressListForm").append($("#tempSearchColums2 div[name='searchColums2']").html());
           $("#tempSearchColums2").html('');
           
    //        $('.datagrid-toolbar').children("span").append("<label style='background-color:#F08080;color:#F08080'>aaaaaaaaa</label>剔除");
    //        $('.datagrid-toolbar').children("span").append("<label style='background-color:#5F9EA0;color:#5F9EA0'>aaaaaaaaa</label>转单");
          
    
    });
  • 相关阅读:
    外部无法捕捉Realm的doGetAuthenticationInfo方法抛出的异常
    Redis多实例及主从搭建
    Redis安装
    window.showModalDialog两次加载问题清除缓存方法
    JQuery分页插件bs_pagination的应用
    解决IE11出现异常SCRIPT5011:不能执行已释放Script的代码
    通过CSS禁用页面模块的复制和粘贴功能
    C# toString()转换详细(转)
    百度ue富文本编辑器setContent方法报错初始化加载内容失败解决办法
    前端页面div float 后高度 height 自适应的问题
  • 原文地址:https://www.cnblogs.com/xueblvip/p/14692490.html
Copyright © 2020-2023  润新知