Administrator
2023-08-10 973db3d9d601e538e2dca651fd16af53908faffb
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
@@ -148,13 +148,25 @@
        int year = Integer.parseInt(parts[0]);
        int month = Integer.parseInt(parts[1]);
        int day = Integer.parseInt(parts[2]);
        String monthZero;
        if(month<10){
            monthZero = String.format("%02d", month);
        }else {
            monthZero = String.valueOf(month);
        }
        JSONArray jsonArray = new JSONArray();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        for (int i = 1; i <= day; i++) {
            String di;
            if(i<10){
                di = String.format("%02d", i);
            }else {
                di = String.valueOf(i);
            }
            JSONObject jsonObject = new JSONObject();
            Boolean planBoolean = false;
            //循环每一天
            String ymd = year+"-"+month+"-"+i;
            String ymd = year+"-"+monthZero+"-"+di;
            Date ymdDate = dateFormat.parse(ymd);
            //匹配计划时间
            String cycle = ardAppPatrolplan.getCycle();
@@ -185,8 +197,20 @@
                    String[] part = recordTime.split("[-\\s:]");
                    int recordYear = Integer.parseInt(part[0]);
                    int recordMonth = Integer.parseInt(part[1]);
                    String recordMonthZero;
                    if(recordMonth<10){
                        recordMonthZero = String.format("%02d", recordMonth);
                    }else {
                        recordMonthZero = String.valueOf(recordMonth);
                    }
                    int recordDay = Integer.parseInt(part[2]);
                    String recordDate = recordYear+"-"+recordMonth+"-"+recordDay;
                    String recordDayZero;
                    if(recordDay<10){
                        recordDayZero = String.format("%02d", recordDay);
                    }else {
                        recordDayZero = String.valueOf(recordDay);
                    }
                    String recordDate = recordYear+"-"+recordMonthZero+"-"+recordDayZero;
                    //如果相等说明这天有打卡记录记录
                    if(ymd.equals(recordDate)){
                        or = true;
@@ -194,11 +218,12 @@
                    }
                }
            }
            jsonObject.put("toDay",ymd);
            jsonObject.put("toDay",ymd );
            jsonObject.put("plan",planBoolean);
            jsonObject.put("record",or);
            jsonArray.add(jsonObject);
        }
        return Results.succeed(jsonArray);
    }
}