MouldController.java 3.5 KB

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