wlzboy
2026-01-24 2f09efc660bf2cc94cbc5291ad25ca06fc9bdadf
ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
@@ -184,10 +184,9 @@
    @Log(title = "任务管理", businessType = BusinessType.INSERT)
    @PostMapping("/admin")
    public AjaxResult adminAdd(@RequestBody TaskCreateVO createVO) {
        return toAjax(sysTaskService.insertSysTask(createVO));
        Long taskId = sysTaskService.insertSysTask(createVO);
        return taskId > 0 ? AjaxResult.success("新增成功").put("taskId", taskId) : AjaxResult.error("新增失败");
    }
    /**
     * 新增任务(APP端)
@@ -195,7 +194,8 @@
    @Log(title = "任务创建", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult appAdd(@RequestBody TaskCreateVO createVO) {
        return toAjax(sysTaskService.insertSysTask(createVO));
        Long taskId = sysTaskService.insertSysTask(createVO);
        return taskId > 0 ? AjaxResult.success("新增成功").put("taskId", taskId) : AjaxResult.error("新增失败");
    }
    
    /**
@@ -331,17 +331,7 @@
        if (request.getLatitude() != null && request.getLongitude() != null) {
           String address= mapService.reverseGeocoding(request.getLongitude(), request.getLatitude());
           request.setLocationAddress(address);
            SysTaskLog locationLog = new SysTaskLog();
            locationLog.setLatitude(request.getLatitude());
            locationLog.setLongitude(request.getLongitude());
            locationLog.setLocationAddress(request.getLocationAddress());
            locationLog.setLocationProvince(request.getLocationProvince());
            locationLog.setLocationCity(request.getLocationCity());
            locationLog.setLocationDistrict(request.getLocationDistrict());
            locationLog.setGpsAccuracy(request.getGpsAccuracy());
            locationLog.setAltitude(request.getAltitude());
            locationLog.setSpeed(request.getSpeed());
            locationLog.setHeading(request.getHeading());
            SysTaskLog locationLog = getLocationLog(request);
            return toAjax(sysTaskService.changeTaskStatusWithLocation(taskId, newStatus, request.getRemark(), locationLog));
        }
@@ -349,6 +339,21 @@
        return toAjax(sysTaskService.changeTaskStatus(taskId, newStatus, request.getRemark()));
    }
    private static SysTaskLog getLocationLog(ChangeStatusRequest request) {
        SysTaskLog locationLog = new SysTaskLog();
        locationLog.setLatitude(request.getLatitude());
        locationLog.setLongitude(request.getLongitude());
        locationLog.setLocationAddress(request.getLocationAddress());
        locationLog.setLocationProvince(request.getLocationProvince());
        locationLog.setLocationCity(request.getLocationCity());
        locationLog.setLocationDistrict(request.getLocationDistrict());
        locationLog.setGpsAccuracy(request.getGpsAccuracy());
        locationLog.setAltitude(request.getAltitude());
        locationLog.setSpeed(request.getSpeed());
        locationLog.setHeading(request.getHeading());
        return locationLog;
    }
    /**
     * 查询任务统计信息(APP端)
     */