| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- package com.ruoyi.web.controller.project;
- import com.ruoyi.common.config.RuoYiConfig;
- import com.ruoyi.common.core.controller.BaseController;
- import com.ruoyi.common.core.domain.AjaxResult;
- import com.ruoyi.common.core.domain.model.LoginUser;
- import com.ruoyi.common.core.page.TableDataInfo;
- import com.ruoyi.common.utils.file.FileUploadUtils;
- import com.ruoyi.common.utils.file.MimeTypeUtils;
- import com.ruoyi.project.bo.ProjectListInput;
- import com.ruoyi.project.bo.ProjectStaffRecordInput;
- import com.ruoyi.project.bo.ProjectStaffRecordOut;
- import com.ruoyi.project.bo.ProjectTaskListOut;
- import com.ruoyi.project.domain.ProjectStaff;
- import com.ruoyi.project.domain.ProjectStaffRecord;
- import com.ruoyi.project.domain.ProjectTask;
- import com.ruoyi.project.service.ProjectStaffRecordService;
- import com.ruoyi.project.service.ProjectStaffService;
- import com.ruoyi.project.service.ProjectTaskService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import java.awt.print.Pageable;
- import java.util.List;
- /**
- * 项目管理
- */
- @RestController
- @RequestMapping("/api/project")
- public class ProjectTaskController extends BaseController {
- @Autowired
- private ProjectTaskService projectTaskService;
- @Autowired
- private ProjectStaffService projectStaffService;
- @Autowired
- private ProjectStaffRecordService projectStaffRecordService;
- /**
- * 新增项目任务
- * @param projectTask
- * @return
- */
- @PostMapping("/add")
- public AjaxResult add( @RequestBody ProjectTask projectTask){
- if (projectTask.getAid()== null){
- return error("负责人不能为空");
- }
- return projectTaskService.addProjectTask(projectTask);
- }
- /**
- * 新增项目成员
- * @param in
- * @return
- */
- @PostMapping("/addStaff")
- public AjaxResult addStaff( @RequestBody ProjectStaff in){
- if (in.getAid()== null){
- return error("项目成员不能为空");
- }
- return projectStaffService.addStaff(in);
- }
- /**
- * 新增成员打卡
- * @param in
- * @return
- */
- @PostMapping("/addRecord")
- public AjaxResult addRecord( @RequestBody ProjectStaffRecord in){
- return projectStaffRecordService.add(in);
- }
- /**
- * 修改成员打卡
- * @param in
- * @return
- */
- @PostMapping("/updateRecord")
- public AjaxResult updateRecord( @RequestBody ProjectStaffRecord in){
- return projectStaffRecordService.update(in);
- }
- /**
- * 审核成员打卡
- * @param in
- * @return
- */
- @PostMapping("/examineRecord")
- public AjaxResult examineRecord( @RequestBody ProjectStaffRecord in){
- if (in.getProcessStatus()!=2 && in.getProcessStatus()!=3){
- return AjaxResult.error("审核状态错误");
- }
- return projectStaffRecordService.examineRecord(in);
- }
- /**
- * 审核成员打卡
- * @param in
- * @return
- */
- @PostMapping("/listRecord")
- public TableDataInfo listRecord( @RequestBody ProjectStaffRecordInput in){
- startPage();
- List<ProjectStaffRecordOut> list = projectStaffRecordService.listRecord(in);
- return getDataTable(list);
- }
- /**
- * 删除项目成员
- * @param in
- * @return
- */
- @PostMapping("/deleteStaff")
- public AjaxResult deleteStaff( @RequestBody ProjectStaff in){
- if (in.getId()== null){
- return error("项目成员编号不能为空");
- }
- return projectStaffService.deleteStaff(in);
- }
- /**
- * 删除项目
- * @param in
- * @return
- */
- @PostMapping("/deleteProject")
- public AjaxResult deleteProject( @RequestBody ProjectTask in){
- if (in.getId()== null){
- return error("项目编号不能为空");
- }
- return projectTaskService.deleteProject(in);
- }
- /**
- * 项目详情
- * @param id
- * @return
- */
- @GetMapping ("/details")
- public AjaxResult details( Long id){
- if (id== null){
- return error("项目编号不能为空");
- }
- return projectTaskService.details(id);
- }
- /**
- * 项目列表
- * @param
- * @return
- */
- @GetMapping ("/list")
- public TableDataInfo list(ProjectListInput in){
- startPage();
- List<ProjectTaskListOut> list=projectTaskService.list(in);
- return getDataTable(list);
- }
- /**
- * 上传项目文件
- * @param file
- * @return
- * @throws Exception
- */
- @PostMapping("/upload")
- public AjaxResult upload(@RequestParam("file") MultipartFile file) throws Exception{
- if (!file.isEmpty()){
- String avatar = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
- AjaxResult ajax = AjaxResult.success();
- ajax.put("imgUrl", avatar);
- return ajax;
- }
- return error("上传图片异常,请联系管理员");
- }
- }
|