|
|
|
@ -44,166 +44,168 @@ import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
/** |
|
|
|
|
* @Description: 任务管理 |
|
|
|
|
* @Author: jeecg-boot |
|
|
|
|
* @Date: 2023-05-24 |
|
|
|
|
* @Date: 2023-05-24 |
|
|
|
|
* @Version: V1.0 |
|
|
|
|
*/ |
|
|
|
|
@Api(tags="任务管理") |
|
|
|
|
@Api(tags = "任务管理") |
|
|
|
|
@RestController |
|
|
|
|
@RequestMapping("/task/task") |
|
|
|
|
@Slf4j |
|
|
|
|
public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
@Autowired |
|
|
|
|
private ITaskService taskService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @param pageNo |
|
|
|
|
* @param pageSize |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-分页列表查询") |
|
|
|
|
@ApiOperation(value="任务管理-分页列表查询", notes="任务管理-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<?> queryPageList(Task task, |
|
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
|
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); |
|
|
|
|
Page<Task> page = new Page<Task>(pageNo, pageSize); |
|
|
|
|
IPage<Task> pageList = taskService.page(page, queryWrapper); |
|
|
|
|
//责任人回显
|
|
|
|
|
pageList.getRecords().forEach(task1 -> task1.setManagerUsers_dictText(taskService.getManagerUsers(task1.getManagerUsers()))); |
|
|
|
|
return Result.OK(pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-添加") |
|
|
|
|
@ApiOperation(value="任务管理-添加", notes="任务管理-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody Task task) { |
|
|
|
|
Task one = taskService.getOne(new LambdaQueryWrapper<Task>().like(Task::getFunctionTemplateName, task.getFunctionTemplateName())); |
|
|
|
|
if (!ObjectUtils.isEmpty(one)){ |
|
|
|
|
return Result.error("名字重复"); |
|
|
|
|
} |
|
|
|
|
taskService.save(task); |
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 编辑 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-编辑") |
|
|
|
|
@ApiOperation(value="任务管理-编辑", notes="任务管理-编辑") |
|
|
|
|
@PutMapping(value = "/edit") |
|
|
|
|
public Result<?> edit(@RequestBody Task task) { |
|
|
|
|
taskService.updateById(task); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id删除 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-通过id删除") |
|
|
|
|
@ApiOperation(value="任务管理-通过id删除", notes="任务管理-通过id删除") |
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<?> delete(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
taskService.removeById(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量删除 |
|
|
|
|
* |
|
|
|
|
* @param ids |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-批量删除") |
|
|
|
|
@ApiOperation(value="任务管理-批量删除", notes="任务管理-批量删除") |
|
|
|
|
@DeleteMapping(value = "/deleteBatch") |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) { |
|
|
|
|
this.taskService.removeByIds(Arrays.asList(ids.split(","))); |
|
|
|
|
return Result.OK("批量删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id查询 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-通过id查询") |
|
|
|
|
@ApiOperation(value="任务管理-通过id查询", notes="任务管理-通过id查询") |
|
|
|
|
@GetMapping(value = "/queryById") |
|
|
|
|
public Result<?> queryById(@RequestParam(name="id",required=true) String id) { |
|
|
|
|
Task task = taskService.getById(id); |
|
|
|
|
if(task==null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(task); |
|
|
|
|
} |
|
|
|
|
@Autowired |
|
|
|
|
private ITaskService taskService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出excel |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
* @param task |
|
|
|
|
*/ |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @param pageNo |
|
|
|
|
* @param pageSize |
|
|
|
|
* @param req |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-分页列表查询") |
|
|
|
|
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<?> queryPageList(Task task, |
|
|
|
|
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
|
|
|
|
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap()); |
|
|
|
|
Page<Task> page = new Page<Task>(pageNo, pageSize); |
|
|
|
|
IPage<Task> pageList = taskService.page(page, queryWrapper); |
|
|
|
|
//责任人回显
|
|
|
|
|
pageList.getRecords().forEach(task1 -> task1.setManagerUsers_dictText(taskService.getManagerUsers(task1.getManagerUsers()))); |
|
|
|
|
return Result.OK(pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-添加") |
|
|
|
|
@ApiOperation(value = "任务管理-添加", notes = "任务管理-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody Task task) { |
|
|
|
|
int count = taskService.count(new LambdaQueryWrapper<Task>().like(Task::getFunctionTemplateName, task.getFunctionTemplateName())); |
|
|
|
|
if (count > 0) { |
|
|
|
|
return Result.error("名字不能重复"); |
|
|
|
|
} |
|
|
|
|
taskService.save(task); |
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 编辑 |
|
|
|
|
* |
|
|
|
|
* @param task |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-编辑") |
|
|
|
|
@ApiOperation(value = "任务管理-编辑", notes = "任务管理-编辑") |
|
|
|
|
@PutMapping(value = "/edit") |
|
|
|
|
public Result<?> edit(@RequestBody Task task) { |
|
|
|
|
taskService.updateById(task); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id删除 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-通过id删除") |
|
|
|
|
@ApiOperation(value = "任务管理-通过id删除", notes = "任务管理-通过id删除") |
|
|
|
|
@DeleteMapping(value = "/delete") |
|
|
|
|
public Result<?> delete(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
taskService.removeById(id); |
|
|
|
|
return Result.OK("删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量删除 |
|
|
|
|
* |
|
|
|
|
* @param ids |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-批量删除") |
|
|
|
|
@ApiOperation(value = "任务管理-批量删除", notes = "任务管理-批量删除") |
|
|
|
|
@DeleteMapping(value = "/deleteBatch") |
|
|
|
|
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { |
|
|
|
|
this.taskService.removeByIds(Arrays.asList(ids.split(","))); |
|
|
|
|
return Result.OK("批量删除成功!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过id查询 |
|
|
|
|
* |
|
|
|
|
* @param id |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "任务管理-通过id查询") |
|
|
|
|
@ApiOperation(value = "任务管理-通过id查询", notes = "任务管理-通过id查询") |
|
|
|
|
@GetMapping(value = "/queryById") |
|
|
|
|
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { |
|
|
|
|
Task task = taskService.getById(id); |
|
|
|
|
if (task == null) { |
|
|
|
|
return Result.error("未找到对应数据"); |
|
|
|
|
} |
|
|
|
|
return Result.OK(task); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 导出excel |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
* @param task |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping(value = "/exportXls") |
|
|
|
|
public ModelAndView exportXls(HttpServletRequest request, Task task) { |
|
|
|
|
return super.exportXls(request, task, Task.class, "任务管理"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 通过excel导入数据 |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
* @param response |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
* 通过excel导入数据 |
|
|
|
|
* |
|
|
|
|
* @param request |
|
|
|
|
* @param response |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
|
|
|
|
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
return super.importExcel(request, response, Task.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/chehui") |
|
|
|
|
public Result<?> chehui(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.chehui(id); |
|
|
|
|
} |
|
|
|
|
@GetMapping(value = "/shenhe") |
|
|
|
|
public Result<?> shenhe(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.shenhe(id); |
|
|
|
|
} |
|
|
|
|
@GetMapping(value = "/tijiao") |
|
|
|
|
public Result<?> tijiao(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.tijiao(id); |
|
|
|
|
} |
|
|
|
|
@GetMapping(value = "/kaishi") |
|
|
|
|
public Result<?> kaishi(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.kaishi(id); |
|
|
|
|
} |
|
|
|
|
@GetMapping(value = "/fabu") |
|
|
|
|
public Result<?> fabu(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.fabu(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
@GetMapping(value = "/chehui") |
|
|
|
|
public Result<?> chehui(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.chehui(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/shenhe") |
|
|
|
|
public Result<?> shenhe(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.shenhe(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/tijiao") |
|
|
|
|
public Result<?> tijiao(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.tijiao(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/kaishi") |
|
|
|
|
public Result<?> kaishi(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.kaishi(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/fabu") |
|
|
|
|
public Result<?> fabu(@RequestParam(name = "id") String id) { |
|
|
|
|
return taskService.fabu(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|