• javaCalendar使用


        /**
         * 累计使用 上月使用  本月使用 上周使用 本周使用 本月剩余
         * @param schoolId
         * @param currPage
         * @param pageSize
         * @return
         */
        @Override
        public PageBean<KwDevicePhoneSim> listSim(Integer schoolId, Integer currPage, Integer pageSize) {
    
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(new Date());
            calendar.setFirstDayOfWeek(Calendar.MONDAY);
            calendar.set(Calendar.DAY_OF_WEEK, 2);
            String fromDateWeek = simpleDateFormat.format(calendar.getTime());
            calendar.add(Calendar.WEEK_OF_YEAR,-1);
            String fromDateLastWeek = simpleDateFormat.format(calendar.getTime());
    
            Calendar calendar2 = Calendar.getInstance();
            calendar2.setFirstDayOfWeek(Calendar.MONDAY);
            calendar2.set(Calendar.DAY_OF_WEEK, 1);
            String toDateWeek = simpleDateFormat.format(calendar2.getTime());
            calendar.add(Calendar.WEEK_OF_YEAR,-1);
            String toDateLastWeek = simpleDateFormat.format(calendar2.getTime());
    
            Calendar calendar3 = Calendar.getInstance();
            calendar3.setTime(new Date());
            calendar3.set(Calendar.DAY_OF_MONTH, 0);
            String toDateLastMoth = simpleDateFormat.format(calendar3.getTime());
    
            Calendar calendar4 = Calendar.getInstance();
            calendar4.setTime(new Date());
            calendar4.set(Calendar.DAY_OF_MONTH, 1);
            calendar4.add(Calendar.MONTH,-1);
            String fromDateLastMonth = simpleDateFormat.format(calendar4.getTime());
    
            //这个月的第一天
            Calendar calendar5 = Calendar.getInstance();
            calendar5.setTime(new Date());
            calendar5.set(Calendar.DAY_OF_MONTH, 1);
            String fromDateMonth = simpleDateFormat.format(calendar5.getTime());
    
            String toDateMonth = simpleDateFormat.format(new Date());
    
            PageHelper.startPage(currPage, pageSize);
            List<KwDevicePhoneSim> phoneSimList = baseMapper.selectList(new QueryWrapper<KwDevicePhoneSim>().eq("school_id", schoolId));
            PageBean<KwDevicePhoneSim> pageBean = new PageBean<>(phoneSimList);
            List<KwDevicePhoneSim> list = pageBean.getList();
            for (KwDevicePhoneSim sim : list) {
                int allDur = getCallDuration(sim.getSimNumber(), null, null, false);//所有时间
                int weekDur = getCallDuration(sim.getSimNumber(), fromDateWeek, toDateWeek, true);//当前星期
                int lastWeekDur = getCallDuration(sim.getSimNumber(), fromDateLastWeek, toDateLastWeek, false);//上星期
                int monthDur = getCallDuration(sim.getSimNumber(), fromDateMonth, toDateMonth, true);//当前月
                int lastMonthDur = getCallDuration(sim.getSimNumber(), fromDateLastMonth, toDateLastMoth, false);//上个月
                sim.setAllDur(allDur).setWeekDur(weekDur).setLastWeekDur(lastWeekDur).setMonthDur(monthDur).setLastMonthDur(lastMonthDur);
                sim.setRemaim(sim.getPackages()*60 - monthDur);
               List<KwAttendanceDevice> device = deviceMapper.selectList(new QueryWrapper<KwAttendanceDevice>().eq("sim_id", sim.getId()).eq("school_id", schoolId));
                if (device.size()>0){
                    sim.setDeviceNo(device.get(0).getDeviceNo());
                    sim.setLocation(device.get(0).getLocation());
                }
            }
            return pageBean;
        }
    
    
  • 相关阅读:
    python 之路之函数01
    python之路07文件处理
    python 之路06day
    python之路05
    【漏洞预警】方程式又一波大规模 0day 攻击泄漏,微软这次要血崩
    PHP渗透中的奇淫技巧--检查相等时的漏洞
    中国气象局某分院官网漏洞打包(弱口令+SQL注入+padding oracle)
    【原创】实战padding oracle漏洞
    破解神器Hashcat使用简介
    关于void main()的误区
  • 原文地址:https://www.cnblogs.com/kltsee/p/16034049.html
Copyright © 2020-2023  润新知