Administrator
2023-08-12 ee89d67599e85222b1df11df6601ab5658475052
ard-work/src/main/java/com/ruoyi/app/patrolplan/service/impl/ArdAppPatrolpointRecordServiceImpl.java
@@ -359,4 +359,50 @@
        }
    }
    @Override
    public Results recordSolo(ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) {
        String toDay = ardAppPatrolpointRecordParam.getToDay();
        String planId = ardAppPatrolpointRecordParam.getPlanId();
        String userId = ardAppPatrolpointRecordParam.getUserId();
        QueryWrapper<ArdAppPatrolpointRecord> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("plan_id", planId).eq("user_id",userId).like("record_time", toDay);
        //当前计划选中时间里此用户的打卡记录
        List<ArdAppPatrolpointRecord> list = ardAppPatrolpointRecordMapper.selectList(queryWrapper);
        for (ArdAppPatrolpointRecord appPatrolpointRecord : list) {
            QueryWrapper<ArdAppPatrolpointRecordImg> queryWrapper1 = new QueryWrapper<>();
            queryWrapper1.eq("app_patrolponit_record_id", appPatrolpointRecord.getId());
            List<ArdAppPatrolpointRecordImg> list1 = recordImgMapper.selectList(queryWrapper1);
            List<String> strings = new ArrayList<>();
            for (ArdAppPatrolpointRecordImg ardAppPatrolpointRecordImg : list1) {
                strings.add(ardAppPatrolpointRecordImg.getImg());
            }
            appPatrolpointRecord.setImg(strings);
        }
        //打过卡的地点
        List<String> pointList = new ArrayList<>();
        for (ArdAppPatrolpointRecord appPatrolpointRecord : list) {
            pointList.add(appPatrolpointRecord.getAppPatrolpointsId());
        }
        //查询该计划的所有兴趣点
        List<ArdAlarmpointsWell> wellList = wellMapper.wellByPlanId(planId);
        for (ArdAlarmpointsWell ardAlarmpointsWell : wellList) {
            //所有应该打卡的地点ID
            String well = ardAlarmpointsWell.getId();
            //如果打开地点不包含应打卡地点,那说名这块儿没打卡
            if (!pointList.contains(well)) {
                ArdAppPatrolpointRecord ardAppPatrolpointRecord = new ArdAppPatrolpointRecord();
                ardAppPatrolpointRecord.setAppPatrolpointsId(well);
                ardAppPatrolpointRecord.setAppPatrolpointsName(ardAlarmpointsWell.getWellId());
                ardAppPatrolpointRecord.setPlanId(planId);
                ardAppPatrolpointRecord.setPlanName(list.get(0).getPlanName());
                ardAppPatrolpointRecord.setUserId(userId);
                ardAppPatrolpointRecord.setUserName(list.get(0).getUserName());
                ardAppPatrolpointRecord.setLatitude(ardAlarmpointsWell.getLatitude().toString());
                ardAppPatrolpointRecord.setLongitude(ardAlarmpointsWell.getLongitude().toString());
                list.add(ardAppPatrolpointRecord);
            }
        }
        return Results.succeed(list);
    }
}