|
|
@@ -0,0 +1,109 @@
|
|
|
+package com.xintong.visualinspection.controller.gettway;
|
|
|
+
|
|
|
+import com.alibaba.dubbo.config.annotation.Reference;
|
|
|
+import com.xintong.system.err.BusinessException;
|
|
|
+import com.xintong.visualinspection.bean.*;
|
|
|
+import com.xintong.visualinspection.controller.BaseController;
|
|
|
+import com.xintong.visualinspection.pojo.fwq.TaskData_F;
|
|
|
+import com.xintong.visualinspection.service.CheckAppealService_F;
|
|
|
+import com.xintong.visualinspection.service.TaskService_Q;
|
|
|
+import com.xintong.visualinspection.util.AuthorUtil;
|
|
|
+import com.xintong.visualinspection.util.Constants;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/q/task")
|
|
|
+public class TaskController_Q extends BaseController {
|
|
|
+ @Reference(version = "1.0.0",
|
|
|
+ application = "${dubbo.application.id}",
|
|
|
+ registry = "${dubbo.registry.address}")
|
|
|
+ private TaskService_Q taskService_q;
|
|
|
+ @Reference(version = "1.0.0",
|
|
|
+ application = "${dubbo.application.id}",
|
|
|
+ registry = "${dubbo.registry.address}")
|
|
|
+ private CheckAppealService_F checkAppealService_f;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @RequestMapping(value = "/add")
|
|
|
+
|
|
|
+ public String addtask(HttpServletRequest request, @Valid @RequestBody QzdCheckTask task) {
|
|
|
+ try {
|
|
|
+ taskService_q.addTask(task);
|
|
|
+ }catch (Exception e) {
|
|
|
+ throw new BusinessException(21501);
|
|
|
+ }
|
|
|
+ return super.returnSuccessResult("添加成功", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getall/{page}/{size}")
|
|
|
+ public String getall(HttpServletRequest request, @PathVariable Integer page, @PathVariable Integer size, @RequestBody QzdCheckTask qzdCheckTask) {
|
|
|
+ User user = getCurrentUser(request);
|
|
|
+ if (AuthorUtil.hasRole(user, Constants.ROLE_FWQ_ADMIN)
|
|
|
+ || AuthorUtil.hasRole(user, Constants.ROLE_FWQ)
|
|
|
+ || AuthorUtil.containsRole(user, "ROLE_FWQ")) {
|
|
|
+ qzdCheckTask.setChecked_dept((long) user.getOrganid());
|
|
|
+ } else if (AuthorUtil.hasRole(user, Constants.ROLE_JICHA)) {
|
|
|
+ qzdCheckTask.setCheckman(new Long(user.getId()));
|
|
|
+ }
|
|
|
+ Object ss = taskService_q.getAllTask(page, size, qzdCheckTask);
|
|
|
+ return super.returnSuccessResult(ss);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getone")
|
|
|
+ public String getStatusById(@RequestBody QzdCheckTask task) {
|
|
|
+ if (task.getRecord_id() == null) {
|
|
|
+ throw new BusinessException(20002);
|
|
|
+ }
|
|
|
+ QzdCheckTask tList = taskService_q.getTask(task);
|
|
|
+ return super.returnSuccessResult(tList);
|
|
|
+ }
|
|
|
+ @RequestMapping(value = "/dispatchById")
|
|
|
+ public String dispatchById(HttpServletRequest request, @RequestBody QzdCheckTask task) {
|
|
|
+ if (task.getId() == null) {
|
|
|
+ throw new BusinessException(20002);
|
|
|
+ }
|
|
|
+ if (task.getCheck_status() == null || "".equals(task.getCheck_status())) {
|
|
|
+ task.setCheck_status(Constants.STATUS_CHECK_DISPATCH);
|
|
|
+ }
|
|
|
+ User u = getCurrentUser(request);
|
|
|
+ task.setUpdate_user(u.getId().longValue());
|
|
|
+ taskService_q.updateStatus(task);
|
|
|
+ return super.returnSuccessResult("下发成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/getStatusById")
|
|
|
+ public String getStatusById(@RequestBody Task task) {
|
|
|
+ if (task.getId() == null) {
|
|
|
+ throw new BusinessException(20002);
|
|
|
+ }
|
|
|
+ List<TaskStatus> tList = taskService_q.getTaskStatusList(task.getId());
|
|
|
+ return super.returnSuccessResult(tList);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/update")
|
|
|
+ public String update(HttpServletRequest request, @Valid @RequestBody QzdCheckTask qzdCheckTask) {
|
|
|
+ if (qzdCheckTask.getId() == null) {
|
|
|
+ throw new BusinessException(20002);
|
|
|
+ }
|
|
|
+ User user = getCurrentUser(request);
|
|
|
+ qzdCheckTask.setUpdate_user(new Long(user.getId()));
|
|
|
+ taskService_q.updateStatus(qzdCheckTask);
|
|
|
+ if(qzdCheckTask.getAppeal_result()!=null && qzdCheckTask.getAppeal_id()!=null){
|
|
|
+ CheckAppeal_F checkAppeal = new CheckAppeal_F();
|
|
|
+ checkAppeal.setId(qzdCheckTask.getAppeal_id());
|
|
|
+ checkAppeal.setAppeal_result(qzdCheckTask.getAppeal_result());
|
|
|
+ checkAppealService_f.update(checkAppeal);
|
|
|
+ }
|
|
|
+ QzdCheckTask t = taskService_q.getTask(qzdCheckTask);
|
|
|
+ return super.returnSuccessResult("修改成功", t);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|