| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | import com.ruoyi.system.applet.dto.AppealDTO; |
| | | import com.ruoyi.system.dto.TTaskAuditBatchDTO; |
| | | import com.ruoyi.system.dto.TaskDetailDto; |
| | | import com.ruoyi.system.model.TAppeal; |
| | | import com.ruoyi.system.model.TLocation; |
| | | import com.ruoyi.system.model.TTask; |
| | | import com.ruoyi.system.model.TTaskDetail; |
| | | import com.ruoyi.system.service.TAppealService; |
| | | import com.ruoyi.system.service.TLocationService; |
| | | import com.ruoyi.system.service.TTaskCleanService; |
| | | import com.ruoyi.system.service.TTaskDetailService; |
| | | import com.ruoyi.system.model.*; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.web.controller.tool.AmapApiClient; |
| | | import com.ruoyi.web.controller.tool.GeoChecker; |
| | | import com.ruoyi.web.controller.tool.PathParser; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | private TAppealService appealService; |
| | | @Autowired |
| | | private TLocationService locationService; |
| | | @Resource |
| | | private TInspectorService inspectorService; |
| | | |
| | | @ApiOperation(value = "上传任务") |
| | | @PostMapping(value = "/uploadTask") |
| | |
| | | if (task==null)return R.fail("任务不存在"); |
| | | TLocation location = locationService.getById(task.getLocationId()); |
| | | if (location==null)return R.fail("点位不存在"); |
| | | // try { |
| | | TInspector byId = inspectorService.getById(dto.getId()); |
| | | if (byId!=null){ |
| | | UpdateWrapper<TInspector> tInspectorUpdateWrapper = new UpdateWrapper<>(); |
| | | tInspectorUpdateWrapper.set("clear_status", dto.getClearStatus()); |
| | | tInspectorUpdateWrapper.set("unqualified", dto.getUnqualified()); |
| | | tInspectorUpdateWrapper.set("remark", dto.getRemark()); |
| | | tInspectorUpdateWrapper.set("picture", dto.getPicture()); |
| | | tInspectorUpdateWrapper.set("audio_url", dto.getAudioUrl()); |
| | | tInspectorUpdateWrapper.set("status", 1); |
| | | tInspectorUpdateWrapper.set("audit_time", 1); |
| | | tInspectorUpdateWrapper.set("audit_person", 1); |
| | | tInspectorUpdateWrapper.set("audit_status", 1); |
| | | tInspectorUpdateWrapper.set("audit_remark", 1); |
| | | tInspectorUpdateWrapper.eq("id", dto.getId()); |
| | | inspectorService.update(tInspectorUpdateWrapper); |
| | | }else{ |
| | | // try { |
| | | // String routeJson = AmapApiClient.getDrivingRoute(Double.parseDouble(location.getLocationLat()), |
| | | // Double.parseDouble(location.getLocationLon()), |
| | | // Double.parseDouble(location.getLocationLatEnd()), |
| | |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | taskDetailService.save(dto); |
| | | // 修改任务状态 |
| | | taskService.update(Wrappers.<TTask>lambdaUpdate().set(TTask::getStatus, 3).eq(TTask::getId, dto.getTaskId())); |
| | | taskDetailService.save(dto); |
| | | // 修改任务状态 |
| | | taskService.update(Wrappers.<TTask>lambdaUpdate().set(TTask::getStatus, 3).eq(TTask::getId, dto.getTaskId())); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | } |
| | | dto.setAppealPerson(tokenService.getLoginUserApplet().getUserId()+""); |
| | | appealService.save(dto); |
| | | List<TTaskDetail> taskDetails = taskDetailService.lambdaQuery() |
| | | .eq(TTaskDetail::getTaskId, dto.getTaskId()) |
| | | .eq(TTaskDetail::getAuditStatus, 1) |
| | | .eq(TTaskDetail::getHandleType,1) |
| | | .isNotNull(TTaskDetail::getClearStatus) |
| | | .orderByDesc(TTaskDetail::getCreateTime).list(); |
| | | // 使用 stream 去重,保留每个 taskId 最新的一条 |
| | | taskDetails = new ArrayList<>(taskDetails.stream() |
| | | .collect(Collectors.groupingBy( |
| | | TTaskDetail::getTaskId, |
| | | Collectors.collectingAndThen( |
| | | Collectors.toList(), |
| | | listAll -> listAll.get(0) |
| | | ) |
| | | )) |
| | | .values()); |
| | | // 添加任务详情 |
| | | TTaskDetail taskDetail = new TTaskDetail(); |
| | | taskDetail.setTaskId(dto.getTaskId()); |
| | | taskDetail.setHandleType(4); |
| | | taskDetail.setClearStatus(taskDetail.getClearStatus()); |
| | | taskDetail.setAppealId(dto.getId()); |
| | | taskDetailService.save(taskDetail); |
| | | return R.ok(); |
| | | } |