MesLineController.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. package com.huaxia.imes.controller;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.huaxia.comm.domain.imes.MesLine;
  4. import com.huaxia.imes.pojo.MesLineBO;
  5. import com.huaxia.imes.pojo.MesLineVO;
  6. import com.huaxia.imes.service.MesLineService;
  7. import com.ruoyi.common.core.controller.BaseController;
  8. import com.ruoyi.common.core.domain.AjaxResult;
  9. import com.ruoyi.common.core.domain.R;
  10. import com.ruoyi.common.core.page.TableDataInfo;
  11. import lombok.AllArgsConstructor;
  12. import lombok.extern.slf4j.Slf4j;
  13. import org.springframework.web.bind.annotation.*;
  14. import java.time.DayOfWeek;
  15. import java.time.LocalDate;
  16. import java.time.temporal.TemporalAdjusters;
  17. import java.util.List;
  18. import java.util.Map;
  19. /**
  20. * @author zx
  21. * @since 2024年10月29日
  22. * 智能产线控制器
  23. */
  24. @RestController
  25. @RequestMapping("open/mes/line")
  26. @Slf4j
  27. @AllArgsConstructor
  28. public class MesLineController extends BaseController {
  29. private MesLineService mesLineService;
  30. /**
  31. * 分页查询统计表
  32. *
  33. * @return
  34. */
  35. @GetMapping("/list")
  36. public AjaxResult queryList(MesLineBO bo, @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize) {
  37. IPage<MesLineVO> list = mesLineService.queryList(bo, pageNum, pageSize);
  38. return AjaxResult.success(new TableDataInfo(list.getRecords(), (int) list.getTotal()));
  39. }
  40. /**
  41. * 新增数据
  42. *
  43. * @param boy
  44. * @return
  45. */
  46. @PostMapping("/add")
  47. public R<Void> add(@RequestBody MesLine boy) {
  48. mesLineService.add(boy);
  49. return R.ok();
  50. }
  51. /**
  52. * 修改数据
  53. *
  54. * @param boy
  55. * @return
  56. */
  57. @PutMapping("/edit")
  58. public R<Void> edit(@RequestBody MesLine boy) {
  59. mesLineService.edit(boy);
  60. return R.ok();
  61. }
  62. /**
  63. * 删除数据
  64. *
  65. * @param ids
  66. * @return
  67. */
  68. @DeleteMapping("/remove")
  69. public R<Void> remove(Long[] ids) {
  70. mesLineService.delete(ids);
  71. return R.ok();
  72. }
  73. /**
  74. * 获取 星期1-7 统计数据
  75. *
  76. * @return
  77. */
  78. @GetMapping("/count_day")
  79. public R<Map<String, Map<String, Long>>> list() {
  80. return mesLineService.countDay();
  81. }
  82. /**
  83. * 获取每周的产线数据
  84. *
  85. * @return
  86. */
  87. @GetMapping("/week_qty")
  88. public R<Map<String, Map<String, Object>>> queryDay() {
  89. return mesLineService.queryDay();
  90. }
  91. /**
  92. * 获取本月总产量
  93. *
  94. * @return
  95. */
  96. @GetMapping("/month_total")
  97. public R<Map<String,Long>> getMonthTotal() {
  98. return mesLineService.getMonthTotal();
  99. }
  100. /**
  101. * 获取合格率(星期1-7)
  102. *
  103. * @return
  104. */
  105. @GetMapping("/pass_rate")
  106. public R<Map<String,List<Map<String,Map<String,Object>>>>> getPassRate() {
  107. return mesLineService.getPassRate();
  108. }
  109. /**
  110. * 获取人均产出(按月)
  111. *
  112. * @return
  113. */
  114. @GetMapping("/worker_qty")
  115. public R<Map<String,Map<String, Map<String,Object>>>> getWorkerQty() {
  116. return mesLineService.getWorkerQty();
  117. }
  118. }