| | |
| | | public AjaxResult appAdd(@RequestBody TaskCreateVO createVO) { |
| | | return toAjax(sysTaskService.insertSysTask(createVO)); |
| | | } |
| | | |
| | | /** |
| | | * 检查任务是否重复(根据联系人电话和创建日期) |
| | | * @param phone 联系人电话 |
| | | * @param createDate 任务创建日期(格式:YYYY-MM-DD) |
| | | * @return 是否存在重复任务 |
| | | */ |
| | | @GetMapping("/checkDuplicate") |
| | | public AjaxResult checkDuplicate( |
| | | @RequestParam("phone") String phone, |
| | | @RequestParam("createDate") String createDate) { |
| | | |
| | | if (StringUtils.isEmpty(phone) || StringUtils.isEmpty(createDate)) { |
| | | return AjaxResult.error("参数不能为空"); |
| | | } |
| | | |
| | | boolean isDuplicate = sysTaskService.checkTaskDuplicate(phone, createDate); |
| | | |
| | | if (isDuplicate) { |
| | | return AjaxResult.error("该联系电话在该日期已有任务,不能重复提交"); |
| | | } |
| | | |
| | | return AjaxResult.success("未发现重复任务"); |
| | | } |
| | | |
| | | /** |
| | | * 修改任务(后台管理端) |
| | |
| | | TaskStatus newStatus = TaskStatus.getByCode(request.getTaskStatus()); |
| | | if (newStatus == null) { |
| | | return error("无效的任务状态"); |
| | | } |
| | | |
| | | // 如果是取消状态,保存取消原因 |
| | | if (newStatus == TaskStatus.CANCELLED && StringUtils.isNotEmpty(request.getCancelReason())) { |
| | | sysTaskService.saveCancelInfo(taskId, request.getCancelReason()); |
| | | } |
| | | |
| | | // 如果包含GPS位置信息,使用带位置的方法 |
| | |
| | | private Double altitude; |
| | | private Double speed; |
| | | private Double heading; |
| | | |
| | | // 取消相关字段 |
| | | private String cancelReason; // 取消原因(关联数据字典task_cancel_reason) |
| | | |
| | | public String getTaskStatus() { |
| | | return taskStatus; |
| | |
| | | public void setHeading(Double heading) { |
| | | this.heading = heading; |
| | | } |
| | | |
| | | public String getCancelReason() { |
| | | return cancelReason; |
| | | } |
| | | |
| | | public void setCancelReason(String cancelReason) { |
| | | this.cancelReason = cancelReason; |
| | | } |
| | | } |
| | | } |