Browse Source

'指挥大屏-新建任务'

master
daixiantong 4 years ago
parent
commit
311cae5a73
1 changed files with 30 additions and 4 deletions
  1. +30
    -4
      src/main/java/com/taauav/front/controller/IndexInspectController.java

+ 30
- 4
src/main/java/com/taauav/front/controller/IndexInspectController.java View File

@@ -1,15 +1,21 @@
package com.taauav.front.controller;

import com.taauav.admin.entity.TauvInspect;
import com.taauav.admin.service.ITauvDriverPointService;
import com.taauav.admin.service.ITauvInspectService;
import com.taauav.common.bean.Response;
import com.taauav.common.constant.PermissionConstants;
import com.taauav.front.service.IUserInspectDriverService;
import com.taauav.front.service.IUserInspectService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
* 指挥大屏 - 任务管理 控制器
@@ -22,6 +28,10 @@ import javax.annotation.Resource;
public class IndexInspectController {
@Autowired
private IUserInspectDriverService inspectDriverService;
@Autowired
private IUserInspectService inspectService;
@Resource
private Response response;

/**
* 统计任务数量
@@ -40,4 +50,20 @@ public class IndexInspectController {
public Response list(@RequestParam("type") Integer type) {
return inspectDriverService.getInspectList(type);
}

/**
* 新建任务
* @param inspect
* @param bindingResult
* @return
*/
@PostMapping("/addTask")
public Response addTask(@RequestBody @Valid TauvInspect inspect , BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
List<FieldError> errorList = bindingResult.getFieldErrors();
String msg = bindingResult.getFieldError().getDefaultMessage();
return response.failure(msg);
}
return inspectService.addTask(inspect);
}
}

Loading…
Cancel
Save