春风项目四线(合箱线、总装线)
jiang
2024-01-30 d82e4465e5e3c9e9f93a8ce7ce3b8c0f73fdf991
提交 | 用户 | 时间
fd2207 1 package com.jcdm.main.bs.formulaChild.controller;
2
3 import com.jcdm.common.annotation.Log;
4 import com.jcdm.common.core.controller.BaseController;
5 import com.jcdm.common.core.domain.AjaxResult;
83923e 6 import com.jcdm.common.core.page.TableDataInfo;
fd2207 7 import com.jcdm.common.enums.BusinessType;
83923e 8 import com.jcdm.common.utils.poi.ExcelUtil;
W 9 import com.jcdm.main.bs.formulaChild.Query.ProductProcessQuery;
fd2207 10 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
11 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
83923e 12 import com.jcdm.main.bs.formulaChild.service.impl.ProductProcessService;
W 13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.security.access.prepost.PreAuthorize;
15 import org.springframework.web.bind.annotation.*;
16
17 import javax.servlet.http.HttpServletResponse;
02bd0f 18 import java.util.Comparator;
83923e 19 import java.util.List;
02bd0f 20 import java.util.stream.Collectors;
fd2207 21
22 /**
23  * 配方配置子信息Controller
24  * 
25  * @author ruimin
26  * @date 2023-12-26
27  */
28 @RestController
29 @RequestMapping("/bs/formulaChild")
30 public class BsFormulaChildInfoController extends BaseController
31 {
32     @Autowired
33     private IBsFormulaChildInfoService bsFormulaChildInfoService;
83923e 34
W 35     @Autowired
36     private ProductProcessService productProcessService;
fd2207 37
717bf8 38     private static final String ZERO = "0";
W 39
fd2207 40     /**
41      * 查询配方配置子信息列表
42      */
43     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
44     @GetMapping("/list")
45     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
46     {
47         startPage();
48         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
49         for (BsFormulaChildInfo formulaChildInfo : list) {
50             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
51             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
1558d8 52             formulaChildInfo.setImg(formulaChildInfo.getPicture());
fd2207 53         }
aead81 54
W 55         return getDataTable(list);
56     }
57
58     /**
59      * 查询工艺流程
60      * @param bsFormulaChildInfo query
61      * @return list
62      */
63     @PostMapping("/getProductProcess")
64     public TableDataInfo getProductProcess(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
65     {
66         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
67         for (BsFormulaChildInfo formulaChildInfo : list) {
68             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
69             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
70             formulaChildInfo.setImg(formulaChildInfo.getPicture());
71         }
717bf8 72         list = list.stream()
W 73                 .filter(x -> !ZERO.equals(x.getSort())).sorted(Comparator.comparing(BsFormulaChildInfo::getSort)).collect(Collectors.toList());
fd2207 74         return getDataTable(list);
75     }
76
77     /**
aead81 78      * 查询工艺文件
W 79      * @param bsFormulaChildInfo query
83923e 80      * @return list
W 81      */
aead81 82     @PostMapping("/getMainProductProcess")
W 83     public TableDataInfo getMainProductProcess(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
83923e 84     {
aead81 85         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
W 86         for (BsFormulaChildInfo formulaChildInfo : list) {
87             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
88             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
89             formulaChildInfo.setImg(formulaChildInfo.getPicture());
90         }
91         list = list.stream()
92                 .filter(x -> ZERO.equals(x.getSort())).sorted(Comparator.comparing(BsFormulaChildInfo::getSort)).collect(Collectors.toList());
83923e 93         return getDataTable(list);
W 94     }
95
96     /**
fd2207 97      * 导出配方配置子信息列表
98      */
99     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
100     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
101     @PostMapping("/export")
102     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
103     {
104         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
105         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
106         util.exportExcel(response, list, "配方配置子信息数据");
107     }
108
109     /**
110      * 获取配方配置子信息详细信息
111      */
112     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
113     @GetMapping(value = "/{id}")
114     public AjaxResult getInfo(@PathVariable("id") Long id)
115     {
116         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
117     }
118
119     /**
120      * 新增配方配置子信息
121      */
122     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
123     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
124     @PostMapping
125     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
126     {
127         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
128     }
129
130     /**
131      * 修改配方配置子信息
132      */
133     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
134     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
135     @PutMapping
136     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
137     {
138         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
139     }
140
141     /**
142      * 删除配方配置子信息
143      */
144     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
145     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
146     @DeleteMapping("/{ids}")
147     public AjaxResult remove(@PathVariable Long[] ids)
148     {
149         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
150     }
151 }