|
|
@@ -1,5 +1,6 @@
|
|
|
package com.xintong.visualinspection.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
@@ -19,6 +20,7 @@ import com.xintong.visualinspection.bean.Task;
|
|
|
import com.xintong.visualinspection.bean.User;
|
|
|
import com.xintong.visualinspection.service.CheckAppealService;
|
|
|
import com.xintong.visualinspection.service.TaskService;
|
|
|
+import com.xintong.visualinspection.util.AuthorUtil;
|
|
|
import com.xintong.visualinspection.util.Constants;
|
|
|
|
|
|
/**
|
|
|
@@ -47,17 +49,21 @@ public class CheckAppealController extends BaseController {
|
|
|
// if(ca!=null) {
|
|
|
// throw new BusinessException(21201);
|
|
|
// }
|
|
|
-
|
|
|
- User u = getCurrentUser(request);
|
|
|
- checkAppeal.setAppeal_man(new Long(u.getId()));
|
|
|
- checkAppeal.setCheck_status(Constants.STATUS_APPEALING);
|
|
|
- if(u.getOrganid()!=null)
|
|
|
- checkAppeal.setAppeal_dept(new Long(u.getOrganid()));
|
|
|
- checkAppealService.insert(checkAppeal);
|
|
|
- Task task = taskService.getById(checkAppeal.getTask_id());
|
|
|
- task.setCheck_status(checkAppeal.getCheck_status());
|
|
|
- taskService.update(task);
|
|
|
- return super.returnSuccessResult("添加成功");
|
|
|
+ CheckAppeal ca = checkAppealService.getByTaskId(checkAppeal.getTask_id());
|
|
|
+ if(ca==null){
|
|
|
+ User u = getCurrentUser(request);
|
|
|
+ checkAppeal.setAppeal_man(new Long(u.getId()));
|
|
|
+ checkAppeal.setCheck_status(Constants.STATUS_APPEALING);
|
|
|
+ if(u.getOrganid()!=null)
|
|
|
+ checkAppeal.setAppeal_dept(new Long(u.getOrganid()));
|
|
|
+ checkAppealService.insert(checkAppeal);
|
|
|
+ Task task = taskService.getById(checkAppeal.getTask_id());
|
|
|
+ task.setCheck_status(checkAppeal.getCheck_status());
|
|
|
+ taskService.update(task);
|
|
|
+ return super.returnSuccessResult("添加成功");
|
|
|
+ }else{
|
|
|
+ throw new BusinessException(21401);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -100,6 +106,20 @@ public class CheckAppealController extends BaseController {
|
|
|
return super.returnSuccessResult(checkItemOne);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据taskid获取申诉数据
|
|
|
+ * @param checkItem
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getByTaskId")
|
|
|
+ public String getByTaskId(@RequestBody CheckAppeal checkAppeal){
|
|
|
+ if(checkAppeal.getTask_id()==null){
|
|
|
+ throw new BusinessException(20002);
|
|
|
+ }
|
|
|
+ CheckAppeal checkItemOne = checkAppealService.getByTaskId(checkAppeal.getTask_id()) ;
|
|
|
+ return super.returnSuccessResult(checkItemOne);
|
|
|
+ }
|
|
|
+
|
|
|
@RequestMapping(value = "/getList/{page}/{size}")
|
|
|
public String getList(@RequestBody CheckAppeal param ,@PathVariable Integer page,@PathVariable Integer size){
|
|
|
PageHelper.startPage(page, size);
|
|
|
@@ -108,5 +128,25 @@ public class CheckAppealController extends BaseController {
|
|
|
return super.returnSuccessResult(new PageInfo(checkAppeal));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 通过多条件获取考核任务
|
|
|
+ * @return
|
|
|
+ * String
|
|
|
+ * @exception
|
|
|
+ * @since 1.0.0
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/getTaskList/{page}/{size}")
|
|
|
+ public String getTaskList(HttpServletRequest request, @PathVariable Integer page,@PathVariable Integer size, @RequestBody Task task){
|
|
|
+ PageHelper.startPage(page, size);
|
|
|
+ User user = getCurrentUser(request);
|
|
|
+ if(AuthorUtil.hasRole(user, Constants.ROLE_STATION_ADMIN)
|
|
|
+ ||AuthorUtil.hasRole(user, Constants.ROLE_STATION)){
|
|
|
+ task.setChecked_dept((long)user.getOrganid());
|
|
|
+ }else if(AuthorUtil.hasRole(user, Constants.ROLE_JICHA)){
|
|
|
+ task.setRecheckman(new Long(user.getId()));
|
|
|
+ }
|
|
|
+ List<Task> taskList = taskService.getTaskList(task);
|
|
|
+ if(taskList==null) return super.returnSuccessResult(new PageInfo(new ArrayList()));
|
|
|
+ return super.returnSuccessResult(new PageInfo(taskList));
|
|
|
+ }
|
|
|
}
|