ProjectController.java 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package com.hssx.cloudmodel.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.hssx.cloudmodel.entity.Project;
  4. import com.hssx.cloudmodel.entity.User;
  5. import com.hssx.cloudmodel.service.ProjectService;
  6. import com.hssx.cloudmodel.service.UserService;
  7. import com.hssx.cloudmodel.util.HttpRespMsg;
  8. import com.hssx.cloudmodel.util.PageUtil;
  9. import io.swagger.annotations.ApiOperation;
  10. import org.springframework.beans.factory.annotation.Autowired;
  11. import org.springframework.stereotype.Controller;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RequestParam;
  14. import org.springframework.web.bind.annotation.ResponseBody;
  15. import javax.servlet.http.HttpServletRequest;
  16. /**
  17. * @author 吴涛涛
  18. * @since 2019-07-27
  19. */
  20. @Controller
  21. @RequestMapping("/project")
  22. public class ProjectController{
  23. @Autowired
  24. private ProjectService projectService;
  25. @Autowired
  26. private UserService userService;
  27. /**
  28. * 添加/修改项目
  29. * 参数:projectName 项目名 ,customerCompanyIds 客户方公司ids "1,2,3",customerCompanyNames 客户方公司名字“1,2,3”
  30. * managerId 项目经理id 非必传
  31. * 修改时/添加时分配项目: id 项目id ,userIds 参与项目的用户id 如:“1,2,3”(多个或者一个)()
  32. * managerId 项目经理id 非必传, modelIds 模具ids 如 :"1,2,3"
  33. * flag 0-添加,1-修改
  34. *
  35. * @return
  36. */
  37. @ApiOperation("添加/修改项目")
  38. @RequestMapping("/add")
  39. @ResponseBody
  40. public HttpRespMsg addAndUpdateProject(Project project, HttpServletRequest request, Integer flag,String customerCompanyIds,
  41. String customerCompanyNames, String token,@RequestParam(required = false) String userIds,String modelIds) {
  42. HttpRespMsg msg = new HttpRespMsg();
  43. QueryWrapper<User> qw = new QueryWrapper<>();
  44. qw.eq("head_imgurl",token);
  45. User user = userService.getOne(qw);
  46. msg = projectService.addAndUpdateProject(project, flag, user,userIds,customerCompanyIds,customerCompanyNames,modelIds);
  47. return msg;
  48. }
  49. /**
  50. * 分配项目
  51. * 参数: pageNum 当前页码,pageSize 每页条数 keyName 关键字查询 token 用户唯一凭证
  52. *
  53. * @return
  54. */
  55. @ApiOperation("项目列表")
  56. @RequestMapping("/list")
  57. @ResponseBody
  58. public HttpRespMsg handOutProject(@RequestParam(required = false) String keyName, PageUtil page, String token) {
  59. User currentUser = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
  60. HttpRespMsg msg = projectService.getList(keyName,page,currentUser);
  61. return msg;
  62. }
  63. /**
  64. * 项目详情
  65. * 参数: id 项目id
  66. * @return
  67. */
  68. @ApiOperation("项目详情")
  69. @RequestMapping("/detail")
  70. @ResponseBody
  71. public HttpRespMsg getUserByCompanyIdOrSubordinateType(Project project) {
  72. HttpRespMsg msg = projectService.getProjectDetail(project);
  73. return msg;
  74. }
  75. }