| | |
| | | } |
| | | |
| | | @Override |
| | | public Results executeDetails(RecordDetailsParam recordDetailsParam) throws ParseException { |
| | | public Results executeDetailsOld(RecordDetailsParam recordDetailsParam) throws ParseException { |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | SimpleDateFormat dateFormatTime = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); |
| | | String userId = SecurityUtils.getUserId(); |
| | |
| | | } |
| | | return Results.succeed(jsonArray); |
| | | } |
| | | |
| | | @Override |
| | | public Results executeDetails(RecordDetailsExParam recordDetailsExParam) throws ParseException { |
| | | String userId = SecurityUtils.getUserId(); |
| | | //获取参数 |
| | | Boolean plan = recordDetailsExParam.getPlan(); |
| | | String toDay = recordDetailsExParam.getToDay(); |
| | | JSONArray jsonArray = new JSONArray(); |
| | | if(plan){ |
| | | //查询这个用户下为执行人的所有巡检计划 |
| | | ArdAppPatrolplan ardAppPatrolplan = new ArdAppPatrolplan(); |
| | | ardAppPatrolplan.setUserId(SecurityUtils.getUserId()); |
| | | List<ArdAppPatrolplan> list = patrolplanMapper.executeList(ardAppPatrolplan); |
| | | //找出今天的单次和每日计划 |
| | | List<ArdAppPatrolplan> patrolplanList = new ArrayList<>(); |
| | | for (int i = 0; i < list.size(); i++) { |
| | | String cycle = list.get(i).getCycle(); |
| | | //如果是单次任务 |
| | | if(cycle.equals("once")){ |
| | | String begin = list.get(i).getPatroBeginTime(); |
| | | String b = begin.substring(0,10); |
| | | if(b.equals(toDay)){ |
| | | //是今天的计划 |
| | | patrolplanList.add(list.get(i)); |
| | | } |
| | | } |
| | | //如果是每日任务 |
| | | else if(cycle.equals("day")){ |
| | | String create = list.get(i).getCreateTime(); |
| | | String c = create.substring(0,10); |
| | | if(c.compareTo(toDay)<=0){ |
| | | //有今天的计划 |
| | | patrolplanList.add(list.get(i)); |
| | | } |
| | | } |
| | | } |
| | | if(patrolplanList.size()>0){ |
| | | //遍历今天的计划 |
| | | for (int i = 0; i < patrolplanList.size(); i++) { |
| | | String planId = patrolplanList.get(i).getId(); |
| | | String planName = patrolplanList.get(i).getPlanName(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("planId",planId); |
| | | jsonObject.put("planName",planName); |
| | | //查询这天有多少点 |
| | | List<ArdAlarmpointsWell> dayWells = wellMapper.wellByPlanId(planId); |
| | | int dayWellNum = dayWells.size(); |
| | | //查询这个用户的这个计划在今天打卡的条数 |
| | | QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("user_id",userId).eq("plan_id",planId).like("record_time",toDay); |
| | | List<ArdAppPatrolpointRecord> recordList = ardAppPatrolpointRecordMapper.selectList(queryWrapper); |
| | | int recordNum = recordList.size(); |
| | | //如果相等那这条今天的计划就是全部完成了 |
| | | if(recordNum==dayWellNum){ |
| | | jsonObject.put("type",true); |
| | | }else { |
| | | jsonObject.put("type",false); |
| | | } |
| | | jsonArray.add(jsonObject); |
| | | } |
| | | } |
| | | }else { |
| | | //没有计划 |
| | | return Results.succeed("[]"); |
| | | } |
| | | return Results.succeed(jsonArray); |
| | | } |
| | | } |