MouldController.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package com.hssx.cloudmodel.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.hssx.cloudmodel.entity.Mould;
  4. import com.hssx.cloudmodel.entity.User;
  5. import com.hssx.cloudmodel.entity.vo.MouldVO;
  6. import com.hssx.cloudmodel.entity.vo.UserVO;
  7. import com.hssx.cloudmodel.service.*;
  8. import com.hssx.cloudmodel.util.HttpRespMsg;
  9. import com.hssx.cloudmodel.util.PageUtil;
  10. import io.swagger.annotations.ApiOperation;
  11. import org.springframework.beans.BeanUtils;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.stereotype.Controller;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.ResponseBody;
  16. import java.util.List;
  17. /**
  18. * @author 吴涛涛
  19. * @since 2019-07-30
  20. */
  21. @Controller
  22. @RequestMapping("/mould")
  23. public class MouldController {
  24. @Autowired
  25. private MouldService mouldService;
  26. @Autowired
  27. private UserService userService;
  28. @Autowired
  29. private ProjectService projectService;
  30. /**
  31. * 添加/修改模具设备
  32. * 添加参数:equipmentId 设备id, modelNo 模具编号 ,modelName 模具名称
  33. * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id,
  34. * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,area 工厂地址,factoryId 工厂id,factoryName 工厂名称
  35. * equipmentName 设备名称
  36. * @return
  37. */
  38. @ApiOperation("添加/修改模具")
  39. @RequestMapping("/addOrUpdate")
  40. @ResponseBody
  41. public HttpRespMsg addOrUpdate(Mould mould, String token) {
  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 = mouldService.addAndUpdateMould(mould,user);
  47. return msg;
  48. }
  49. /**
  50. * 给项目分配模具获取该公司下的模具列表
  51. * parentId 当前人parentId ,id当前人id
  52. * @return
  53. */
  54. @ApiOperation("获取该公司下的模具列表")
  55. @RequestMapping("/modelList")
  56. @ResponseBody
  57. public HttpRespMsg addAndUpdateProject(User user) {
  58. HttpRespMsg msg = new HttpRespMsg();
  59. msg = projectService.getModelListByCompanyId(user);
  60. return msg;
  61. }
  62. /**
  63. * 给项目分配模具获取该公司下的模具列表
  64. * token 当前人唯一权限 pageNum 当前页码,pageSize 每页条数 projectId 项目id筛选(默认传-1)
  65. * serchType 搜索类型0-模具编号,1-模具名称(默认传0) keyName 关键字查询
  66. * @return
  67. */
  68. @ApiOperation("模具列表")
  69. @RequestMapping("/list")
  70. @ResponseBody
  71. public HttpRespMsg list(UserVO userVO, PageUtil page,String token) {
  72. System.out.println("keyName"+userVO.getKeyName());
  73. HttpRespMsg msg = new HttpRespMsg();
  74. User user = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
  75. BeanUtils.copyProperties(user,userVO);
  76. msg = projectService.getModelListByUser(userVO,page);
  77. return msg;
  78. }
  79. /**
  80. * 模具详情
  81. * 参数 id 模具id
  82. * @return
  83. */
  84. @ApiOperation("模具详情")
  85. @RequestMapping("/detail")
  86. @ResponseBody
  87. public HttpRespMsg detail(MouldVO mouldVO){
  88. HttpRespMsg msg = mouldService.getMoildDetail(mouldVO);
  89. return msg;
  90. }
  91. }