1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- package com.hssx.cloudmodel.controller;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.hssx.cloudmodel.entity.Project;
- import com.hssx.cloudmodel.entity.User;
- import com.hssx.cloudmodel.service.ProjectService;
- import com.hssx.cloudmodel.service.UserService;
- import com.hssx.cloudmodel.util.HttpRespMsg;
- import com.hssx.cloudmodel.util.PageUtil;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import javax.servlet.http.HttpServletRequest;
- /**
- * @author 吴涛涛
- * @since 2019-07-27
- */
- @Controller
- @RequestMapping("/project")
- public class ProjectController{
- @Autowired
- private ProjectService projectService;
- @Autowired
- private UserService userService;
- /**
- * 添加/修改项目
- * 参数:projectName 项目名 ,customerCompanyIds 客户方公司ids "1,2,3",customerCompanyNames 客户方公司名字“1,2,3”
- * managerId 项目经理id 非必传
- * 修改时/添加时分配项目: id 项目id ,userIds 参与项目的用户id 如:“1,2,3”(多个或者一个)()
- * managerId 项目经理id 非必传, modelIds 模具ids 如 :"1,2,3"
- * flag 0-添加,1-修改
- *
- * @return
- */
- @ApiOperation("添加/修改项目")
- @RequestMapping("/add")
- @ResponseBody
- public HttpRespMsg addAndUpdateProject(Project project, HttpServletRequest request, Integer flag,String customerCompanyIds,
- String customerCompanyNames, String token,@RequestParam(required = false) String userIds,String modelIds) {
- HttpRespMsg msg = new HttpRespMsg();
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.eq("head_imgurl",token);
- User user = userService.getOne(qw);
- msg = projectService.addAndUpdateProject(project, flag, user,userIds,customerCompanyIds,customerCompanyNames,modelIds);
- return msg;
- }
- /**
- * 分配项目
- * 参数: pageNum 当前页码,pageSize 每页条数 keyName 关键字查询 token 用户唯一凭证
- *
- * @return
- */
- @ApiOperation("项目列表")
- @RequestMapping("/list")
- @ResponseBody
- public HttpRespMsg handOutProject(@RequestParam(required = false) String keyName, PageUtil page, String token) {
- User currentUser = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
- HttpRespMsg msg = projectService.getList(keyName,page,currentUser);
- return msg;
- }
- /**
- * 项目详情
- * 参数: id 项目id
- * @return
- */
- @ApiOperation("项目详情")
- @RequestMapping("/detail")
- @ResponseBody
- public HttpRespMsg getUserByCompanyIdOrSubordinateType(Project project) {
- HttpRespMsg msg = projectService.getProjectDetail(project);
- return msg;
- }
- }
|