liuxiaolong
2019-05-23 86b189ee9072db4bf2648c16307eff1da077e8e4
src/main/java/com/cloud/count/service/serviceImpl/CountServiceImpl.java
@@ -104,12 +104,12 @@
        // 从开始计算时间到现在的进校数
        //进校人数 = 当前报文totalEnters - 基准进校人数 + 校正值
        int inPeople = totalEnters - baseEnters + correctionPeople;
        int inPeople = totalEnters - baseEnters + correctionPeople + initialPeople;
        int outPeople = totalExits - baseExits;
        // 校内总人数 = 进校人数 - 出校人数 + 校内初始化人数 + 误差数量
        int allPeople = inPeople - outPeople + initialPeople;
        int allPeople = inPeople - outPeople;
        // 现在离开始统计的时间的小时数 7个多小时 按7个小时算
        //int hour = (int)(Math.abs(now-set)+3599)/3600;
@@ -135,7 +135,7 @@
        // 但是只会统计7:30,则7:30统计的数据默认为初始人数,并且以后的从7:30开始统计
        long hourset = set;
        for(int i=0;i<minute;i++){
            if( (mm==i) && (countType==0) ){
            if( (mm == i) && (countType==0) ){
                people[i]=initialPeople;
                set = hourset; //这行代码很重要,表示重新统计
            }else {
@@ -160,20 +160,21 @@
     * @return
     */
   private int getDataValue( Map<String, Object> map,int i,long start,long end,int initialPeople,int correctionPeople){
       String todayStr = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
        switch (i){
            case 1:
                map.put("countType","进校人数");
                Integer countInPeople = dao.countInPeople(start,end);
                countInPeople=countInPeople==null||countInPeople<0?0:countInPeople;
                Integer countInPeople = dao.countInPeople(start, end, todayStr);
                countInPeople=countInPeople==null||countInPeople < 0? 0 : countInPeople;
                return countInPeople+correctionPeople;
            case -1:
                map.put("countType","出校人数");
                Integer countOutPeople = dao.countOutPeople(start,end);
                return countOutPeople==null||countOutPeople<0?0:countOutPeople;
                Integer countOutPeople = dao.countOutPeople(start, end, todayStr);
                return countOutPeople==null||countOutPeople < 0? 0 : countOutPeople;
            case 0:
                map.put("countType","校内人数");
                Integer in = dao.countInPeople(start,end);
                Integer out = dao.countOutPeople(start,end);
                Integer in = dao.countInPeople(start, end, todayStr);
                Integer out = dao.countOutPeople(start, end, todayStr);
                in = in==null||in<0?0:in;
                out = out==null||out<0?0:out;
                return in-out+initialPeople+correctionPeople;