The sample of calendar

本文介绍了一个用于查询工作日志的公共列表方法的实现细节。该方法可以根据不同的时间类型(如周、月、年或天)及用户ID来检索对应的工作日志记录,并支持模糊搜索。通过调整日期范围参数,系统能返回指定时间段内的所有相关日志。
public List getWorkDailyLogList(String type, Date date,String userId,String queryInfo)
    {
        StringBuffer sql = new StringBuffer("select guid, title as 标题,convert(char(10),createddate,20) as 日期");
        sql.append(getAppRelationCore().getPersonManagementFacade().getColumnStatement("Hr_dailylog")).append("  from Hr_dailyLog where convert(char(10),createddate,20) between ? and ?  and creator = ? and title like '%'+?+'%'");
        String params[] =  new String[4];
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTime(date);
        if(type.equals("week"))
        {
            calendar.set(GregorianCalendar.DAY_OF_WEEK,1);
            params[0] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
            calendar.set(GregorianCalendar.DAY_OF_WEEK,7);
            params[1] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
        }
        if(type.equals("month"))
        {
            calendar.set(GregorianCalendar.DAY_OF_MONTH,1);
            params[0] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
            calendar.set(GregorianCalendar.DAY_OF_MONTH,calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH));
            params[1] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
        }
        if(type.equals("year"))
        {
            calendar.set(GregorianCalendar.DAY_OF_YEAR,1);
            params[0] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
            calendar.set(GregorianCalendar.DAY_OF_YEAR,calendar.getActualMaximum(GregorianCalendar.DAY_OF_YEAR));
            params[1] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
        }
        if(type.equals("day"))
        {
            params[0] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
            params[1] = PortalUtil.convertDateToString(PortalUtil.SQL_DATE_PATTERN, calendar.getTime());
        }
        params[2] = userId;
        params[3] = queryInfo;
        return this.getCommonDAO().findBySQL(sql.toString(),params).getRows();  //To change body of implemented methods use File | Settings | File Templates.
    }
Warning (from warnings module): File "C:/Users/ASUS/AppData/Local/Programs/Python/Python313/DC-run/8.27程序包/可视化(cVeg).py", line 7 ds = xr.open_dataset(file_path, decode_times=True, use_cftime=False) DeprecationWarning: Usage of 'use_cftime' as a kwarg is deprecated. Please pass a 'CFDatetimeCoder' instance initialized with 'use_cftime' to the 'decode_times' kwarg instead. Example usage: time_coder = xr.coders.CFDatetimeCoder(use_cftime=True) ds = xr.open_dataset(decode_times=time_coder) Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\coding\times.py", line 337, in _decode_cf_datetime_dtype result = decode_cf_datetime( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\coding\times.py", line 587, in decode_cf_datetime dates = _decode_datetime_with_pandas(flat_num_dates, units, calendar, time_unit) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\coding\times.py", line 461, in _decode_datetime_with_pandas raise OutOfBoundsDatetime( pandas._libs.tslibs.np_datetime.OutOfBoundsDatetime: Cannot decode times from a non-standard calendar, '365_day', using pandas. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\conventions.py", line 412, in decode_cf_variables new_vars[k] = decode_cf_variable( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\conventions.py", line 239, in decode_cf_variable var = decode_times.decode(var, name=name) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\coding\times.py", line 1391, in decode dtype = _decode_cf_datetime_dtype( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\coding\times.py", line 349, in _decode_cf_datetime_dtype raise ValueError(msg) from err ValueError: unable to decode time units 'days since 1850-01-01' with "calendar '365_day'". Try opening your dataset with decode_times=False or installing cftime if it is not installed. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:/Users/ASUS/AppData/Local/Programs/Python/Python313/DC-run/8.27程序包/可视化(cVeg).py", line 7, in <module> ds = xr.open_dataset(file_path, decode_times=True, use_cftime=False) File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\backends\api.py", line 715, in open_dataset backend_ds = backend.open_dataset( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\backends\netCDF4_.py", line 686, in open_dataset ds = store_entrypoint.open_dataset( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\backends\store.py", line 49, in open_dataset vars, attrs, coord_names = conventions.decode_cf_variables( File "C:\Users\ASUS\AppData\Local\Programs\Python\Python313\Lib\site-packages\xarray\conventions.py", line 423, in decode_cf_variables raise type(e)(f"Failed to decode variable {k!r}: {e}") from e ValueError: Failed to decode variable 'time_bnds': unable to decode time units 'days since 1850-01-01' with "calendar '365_day'". Try opening your dataset with decode_times=False or installing cftime if it is not installed.
09-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值