MouldController.java 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. package com.hssx.cloudmodel.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.hssx.cloudmodel.entity.InjectionMolding;
  4. import com.hssx.cloudmodel.entity.Mould;
  5. import com.hssx.cloudmodel.entity.User;
  6. import com.hssx.cloudmodel.entity.vo.MouldVO;
  7. import com.hssx.cloudmodel.entity.vo.UserVO;
  8. import com.hssx.cloudmodel.service.*;
  9. import com.hssx.cloudmodel.util.HttpRespMsg;
  10. import com.hssx.cloudmodel.util.PageUtil;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.BeanUtils;
  13. import org.springframework.beans.factory.annotation.Autowired;
  14. import org.springframework.context.annotation.Configuration;
  15. import org.springframework.scheduling.annotation.EnableScheduling;
  16. import org.springframework.scheduling.annotation.Scheduled;
  17. import org.springframework.stereotype.Component;
  18. import org.springframework.stereotype.Controller;
  19. import org.springframework.web.bind.annotation.RequestMapping;
  20. import org.springframework.web.bind.annotation.RequestParam;
  21. import org.springframework.web.bind.annotation.ResponseBody;
  22. import java.util.List;
  23. /**
  24. * @author 吴涛涛
  25. * @since 2019-07-30
  26. */
  27. @Controller
  28. @RequestMapping("/mould")
  29. @Component
  30. @Configuration //1.主要用于标记配置类,兼备Component的效果。
  31. @EnableScheduling
  32. public class MouldController {
  33. @Autowired
  34. private MouldService mouldService;
  35. @Autowired
  36. private UserService userService;
  37. @Autowired
  38. private ProjectService projectService;
  39. /**
  40. * 添加/修改模具设备
  41. * 添加参数:equipmentId 设备id, modelNo 模具编号 ,modelName 模具名称 ,maintainCount 保养设定次数:"1,2,3"
  42. * 修改参数:id 模具id, settingLife 使用年限, initialModulus 初始模次 equipmentId 设备id,
  43. * produceCompanyId 生产方公司id,ocCycle 每模平均周期,rfid rfid码,maintainCount 保养设定次数:"1,2,3"
  44. *
  45. * materialType 材料牌号,color 颜色,size 模具尺寸,machineTonnage 吨位,mallWeight 成品重量(单位:G),headWeight 料头重量(单位:G)
  46. * maxShotWeight 最大射胶量(单位:G),minShotWeight 最小射胶量(单位:G),cycle 成型周期,commonModelTemperature 公模(动模)模温
  47. * motherModelTemperature 母模(定模)模温
  48. * 模具更新时多传的参数 preUpdateId 要被更新的模具的id dynamicId
  49. * @return
  50. */
  51. @ApiOperation("添加/修改模具")
  52. @RequestMapping("/addOrUpdate")
  53. @ResponseBody
  54. public HttpRespMsg addOrUpdate(Mould mould, InjectionMolding injectionMolding, String token, @RequestParam(required = false) Integer dynamicId) {
  55. HttpRespMsg msg = new HttpRespMsg();
  56. QueryWrapper<User> qw = new QueryWrapper<>();
  57. qw.eq("head_imgurl",token);
  58. User user = userService.getOne(qw);
  59. msg = mouldService.addAndUpdateMould(mould,user,dynamicId,injectionMolding);
  60. return msg;
  61. }
  62. /**
  63. * 更换模具云模盒
  64. * mouldId 模具id equipmentId 云模盒设备id token 用户身份凭证
  65. * @return
  66. */
  67. @ApiOperation("更换模具云模盒")
  68. @RequestMapping("/changeMouldEquipment")
  69. @ResponseBody
  70. public HttpRespMsg changeMouldEquipment(Mould mould,Integer mouldId, String token) {
  71. HttpRespMsg msg = new HttpRespMsg();
  72. msg = mouldService.changeMouldEquipment(mould,mouldId,token);
  73. return msg;
  74. }
  75. /**
  76. * 给项目分配模具获取该公司下的模具列表
  77. * parentId 当前人parentId ,id当前人id
  78. * @return
  79. */
  80. @ApiOperation("获取该公司下的模具列表")
  81. @RequestMapping("/modelList")
  82. @ResponseBody
  83. public HttpRespMsg addAndUpdateProject(User user) {
  84. HttpRespMsg msg = new HttpRespMsg();
  85. msg = projectService.getModelListByCompanyId(user);
  86. return msg;
  87. }
  88. /**
  89. * 给编辑项目时返回的项目里的模具和可供选择的模具
  90. * projectId 项目id ,token 人员身份凭证
  91. * @return
  92. */
  93. @ApiOperation("给编辑项目时返回的项目里的模具和可供选择的模具")
  94. @RequestMapping("/chooseModelList")
  95. @ResponseBody
  96. public HttpRespMsg chooseModelList(UserVO userVO) {
  97. HttpRespMsg msg = new HttpRespMsg();
  98. msg = projectService.getModelListByCompanyIdAndProjectId(userVO);
  99. return msg;
  100. }
  101. /**
  102. * 给项目分配模具获取该公司下的模具列表
  103. * token 当前人唯一权限 pageNum 当前页码,pageSize 每页条数 projectId 项目id筛选(默认传-1)
  104. * searchType 搜索类型0-模具编号,1-模具名称(默认传0) keyName 关键字查询
  105. * @return
  106. */
  107. @ApiOperation("模具列表")
  108. @RequestMapping("/list")
  109. @ResponseBody
  110. public HttpRespMsg list(UserVO userVO, PageUtil page,String token) {
  111. System.out.println("keyName"+userVO.getKeyName());
  112. HttpRespMsg msg = new HttpRespMsg();
  113. User user = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
  114. BeanUtils.copyProperties(user,userVO);
  115. msg = projectService.getModelListByUser(userVO,page);
  116. return msg;
  117. }
  118. /**
  119. * 模具详情
  120. * 参数 id 模具id,token 当前用户凭证
  121. * @return
  122. */
  123. @ApiOperation("模具详情")
  124. @RequestMapping("/detail")
  125. @ResponseBody
  126. public HttpRespMsg detail(MouldVO mouldVO){
  127. HttpRespMsg msg = mouldService.getMoildDetail(mouldVO);
  128. return msg;
  129. }
  130. /**
  131. * 模具详情
  132. * 参数 id 模具id
  133. * @return
  134. */
  135. @ApiOperation("删除模具")
  136. @RequestMapping("/delMould")
  137. @ResponseBody
  138. public HttpRespMsg delMould(Mould mould){
  139. HttpRespMsg msg = new HttpRespMsg();
  140. msg = mouldService.delMoule(mould);
  141. return msg;
  142. }
  143. /**
  144. * 模具保养提醒
  145. */
  146. @ApiOperation("模具保养提醒")
  147. @RequestMapping("/maintenanceReminder")
  148. @ResponseBody
  149. @Scheduled(cron = "0 0 12 * * ?")//配置时间点触发(每日中午12点)
  150. public HttpRespMsg maintenanceReminder() throws Exception {
  151. HttpRespMsg msg = mouldService.maintenanceReminder();
  152. return msg;
  153. }
  154. /**
  155. * 丢包数据检测
  156. */
  157. @ApiOperation("丢包数据检测")
  158. @RequestMapping("/packageLoss")
  159. @ResponseBody
  160. @Scheduled(cron = "0 0 23 * * ?")//配置时间点触发(每日中午00点)
  161. public HttpRespMsg packageLoss() throws Exception {
  162. HttpRespMsg msg = mouldService.packageLoss();
  163. return msg;
  164. }
  165. /**
  166. * 是否开启模具保养提醒
  167. * 参数 isMaintain 是否开启保养 0-是 1-否
  168. */
  169. @ApiOperation("模具保养提醒")
  170. @RequestMapping("/isMaintain")
  171. @ResponseBody
  172. public HttpRespMsg isMaintain(Mould mould) throws Exception {
  173. HttpRespMsg msg = mouldService.isMaintain(mould);
  174. return msg;
  175. }
  176. /**
  177. * 需要保养的模具列表
  178. * 参数 token 用户凭证
  179. */
  180. @ApiOperation("需要保养的模具列表")
  181. @RequestMapping("/maintainMouldList")
  182. @ResponseBody
  183. public HttpRespMsg maintainMouldList(UserVO userVO) throws Exception {
  184. HttpRespMsg msg = mouldService.maintainMouldList(userVO);
  185. return msg;
  186. }
  187. /**
  188. * 报废提醒的模具列表
  189. * 参数 token 用户凭证
  190. */
  191. @ApiOperation("报废提醒的模具列表")
  192. @RequestMapping("/scrapMouldList")
  193. @ResponseBody
  194. public HttpRespMsg scrapMouldList(UserVO userVO) throws Exception {
  195. HttpRespMsg msg = mouldService.scrapMouldList(userVO);
  196. return msg;
  197. }
  198. /**
  199. * 模具地图概览
  200. * token 当前人唯一权限
  201. * @return
  202. */
  203. @ApiOperation("模具地图概览")
  204. @RequestMapping("/listMap")
  205. @ResponseBody
  206. public HttpRespMsg listMap(UserVO userVO, String token) {
  207. HttpRespMsg msg = new HttpRespMsg();
  208. User user = userService.getOne(new QueryWrapper<User>().eq("head_imgurl", token));
  209. BeanUtils.copyProperties(user,userVO);
  210. msg = projectService.getModelListMapByUser(userVO);
  211. return msg;
  212. }
  213. }