|  |  | 
 |  |  |  | 
 |  |  | import java.text.ParseException; | 
 |  |  | import java.text.SimpleDateFormat; | 
 |  |  | import java.time.LocalDateTime; | 
 |  |  | import java.time.format.DateTimeFormatter; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | 
 |  |  |             //匹配打卡时间 | 
 |  |  |             Boolean or = false; | 
 |  |  |             if(planBoolean){ | 
 |  |  |                 //查询该计划的所有兴趣点 | 
 |  |  |                 List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId); | 
 |  |  |                 //查询该计划的所有执行人 | 
 |  |  |                 List<SysUser> userList = sysUserMapper.userByPlanId(planId); | 
 |  |  |                 //满勤多少条打卡记录 | 
 |  |  |                 int maxNum = wellList.size()*userList.size(); | 
 |  |  |                 //对比应打卡记录相等则true | 
 |  |  |                 if(list.size()==maxNum){ | 
 |  |  |                     or = true; | 
 |  |  |                 for (int j = 0; j < list.size(); j++) { | 
 |  |  |                     //获取打卡时间 | 
 |  |  |                     String toDayRecord = list.get(j).getRecordTime(); | 
 |  |  |                     String dr = toDayRecord.substring(0,10); | 
 |  |  |                     //如果打开日期和这天相同 | 
 |  |  |                     if(ymd.equals(dr)){ | 
 |  |  |                         //查询该计划的所有兴趣点 | 
 |  |  |                         List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId); | 
 |  |  |                         //查询该计划的所有执行人 | 
 |  |  |                         List<SysUser> userList = sysUserMapper.userByPlanId(planId); | 
 |  |  |                         //满勤多少条打卡记录 | 
 |  |  |                         int maxNum = wellList.size()*userList.size(); | 
 |  |  |                         //对比应打卡记录相等则true | 
 |  |  |                         if(list.size()==maxNum){ | 
 |  |  |                             or = true; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  | //                for (int j = 0; j < list.size(); j++) { | 
 |  |  | //                    //打卡时间拆分 | 
 |  |  | 
 |  |  |     @Override | 
 |  |  |     public Results executeDetailsOld(RecordDetailsParam recordDetailsParam) throws ParseException { | 
 |  |  |         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); | 
 |  |  |         SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); | 
 |  |  |         SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 
 |  |  |         String userId = SecurityUtils.getUserId(); | 
 |  |  |         //获取参数 | 
 |  |  |         String planId = recordDetailsParam.getPlanId(); | 
 |  |  | 
 |  |  |                 int planNum = dayNum+onceNum; | 
 |  |  |                 //这天总兴趣点数 | 
 |  |  |                 int wellNum = dayWell+onceWell; | 
 |  |  |                 QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>(); | 
 |  |  |                 queryWrapper.eq("user_id",userId).like("record_time",ymd); | 
 |  |  |                 List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper); | 
 |  |  |                 //已打卡总条数 | 
 |  |  |                 QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>(); | 
 |  |  |                 queryWrapper.eq("user_id",userId).like("record_time",ymd).isNull("del"); | 
 |  |  |                 List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper); | 
 |  |  |                 int num = list.size(); | 
 |  |  |                 //应打卡总条数 | 
 |  |  |                 int record = planNum*wellNum; | 
 |  |  |                 if(num==record){ | 
 |  |  |                 if(num>=record){ | 
 |  |  |                     recordBoolean = true; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Results son() { | 
 |  |  |  | 
 |  |  |         return null; | 
 |  |  |         DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | 
 |  |  |         //获取用户执行人 | 
 |  |  |         String userId = SecurityUtils.getUserId(); | 
 |  |  |         // 减少 10 秒 | 
 |  |  |         LocalDateTime now = LocalDateTime.now(); // 获取当前日期时间 | 
 |  |  |         LocalDateTime earlier = now.minusSeconds(10); // 减少30秒 | 
 |  |  |         RecordSonParam recordSonParam = new RecordSonParam(); | 
 |  |  |         recordSonParam.setUserId(userId); | 
 |  |  |         String n = fmt.format(now); | 
 |  |  |         recordSonParam.setTime(n); | 
 |  |  |         String e = fmt.format(earlier); | 
 |  |  |         recordSonParam.setBeforeTime(e); | 
 |  |  |         //根据姓名ID为执行人获取所有对应的计划名称 | 
 |  |  |         List<ArdAppPatrolplan> list = patrolplanMapper.planUser(recordSonParam); | 
 |  |  |         JSONArray jsonArray = new JSONArray(); | 
 |  |  |         JSONObject jsonObject = new JSONObject(); | 
 |  |  |         if(list.size()>0){ | 
 |  |  |             jsonObject.put("plan",true); | 
 |  |  |             jsonObject.put("user",list.get(0).getNickName()); | 
 |  |  |             jsonObject.put("name",list.get(0).getPlanName()); | 
 |  |  | //            list.get(0).setSon("已通知"); | 
 |  |  | //            patrolplanMapper.updateById(list.get(0)); | 
 |  |  |         }else { | 
 |  |  |             jsonObject.put("plan",false); | 
 |  |  |             jsonObject.put("user",null); | 
 |  |  |             jsonObject.put("name",null); | 
 |  |  |         } | 
 |  |  |         jsonArray.add(jsonObject); | 
 |  |  |         return Results.succeed(jsonArray); | 
 |  |  |     } | 
 |  |  | } |