提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.main.rm.repairRecord.controller; |
懒 |
2 |
|
8aafc5
|
3 |
import java.io.IOException; |
fd2207
|
4 |
import java.util.List; |
8aafc5
|
5 |
import java.util.stream.Collectors; |
W |
6 |
import javax.annotation.Resource; |
fd2207
|
7 |
import javax.servlet.http.HttpServletResponse; |
8aafc5
|
8 |
|
W |
9 |
import cn.hutool.core.collection.CollUtil; |
|
10 |
import com.alibaba.excel.EasyExcel; |
|
11 |
import com.alibaba.excel.ExcelWriter; |
|
12 |
import com.alibaba.excel.write.metadata.WriteSheet; |
|
13 |
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
|
14 |
import com.jcdm.common.core.domain.R; |
|
15 |
import com.jcdm.common.core.domain.entity.SysDictData; |
|
16 |
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling; |
|
17 |
import com.jcdm.main.bs.orderScheduling.vo.FollowReportVO; |
|
18 |
import com.jcdm.main.da.paramCollection.domain.DaParamCollection; |
|
19 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
|
20 |
import com.jcdm.main.rm.repairData.domain.RmRepairData; |
|
21 |
import com.jcdm.main.rm.repairRecord.vo.RmRepairDataVO; |
|
22 |
import com.jcdm.system.service.ISysDictDataService; |
fd2207
|
23 |
import org.springframework.security.access.prepost.PreAuthorize; |
懒 |
24 |
import org.springframework.beans.factory.annotation.Autowired; |
|
25 |
import org.springframework.web.bind.annotation.GetMapping; |
|
26 |
import org.springframework.web.bind.annotation.PostMapping; |
|
27 |
import org.springframework.web.bind.annotation.PutMapping; |
|
28 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
29 |
import org.springframework.web.bind.annotation.PathVariable; |
|
30 |
import org.springframework.web.bind.annotation.RequestBody; |
|
31 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
32 |
import org.springframework.web.bind.annotation.RestController; |
|
33 |
import com.jcdm.common.annotation.Log; |
|
34 |
import com.jcdm.common.core.controller.BaseController; |
|
35 |
import com.jcdm.common.core.domain.AjaxResult; |
|
36 |
import com.jcdm.common.enums.BusinessType; |
|
37 |
import com.jcdm.main.rm.repairRecord.domain.RmRepairRecord; |
|
38 |
import com.jcdm.main.rm.repairRecord.service.IRmRepairRecordService; |
|
39 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
40 |
import com.jcdm.common.core.page.TableDataInfo; |
|
41 |
|
|
42 |
/** |
|
43 |
* 返修记录Controller |
|
44 |
* |
|
45 |
* @author Yi |
|
46 |
* @date 2023-12-22 |
|
47 |
*/ |
|
48 |
@RestController |
|
49 |
@RequestMapping("/rm/repairRecord") |
|
50 |
public class RmRepairRecordController extends BaseController |
|
51 |
{ |
|
52 |
@Autowired |
|
53 |
private IRmRepairRecordService rmRepairRecordService; |
|
54 |
|
8aafc5
|
55 |
@Resource |
W |
56 |
private ISysDictDataService iSysDictDataService; |
|
57 |
|
fd2207
|
58 |
/** |
懒 |
59 |
* 查询返修记录列表 |
|
60 |
*/ |
|
61 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:list')") |
|
62 |
@GetMapping("/list") |
|
63 |
public TableDataInfo list(RmRepairRecord rmRepairRecord) |
|
64 |
{ |
|
65 |
startPage(); |
|
66 |
List<RmRepairRecord> list = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
|
67 |
return getDataTable(list); |
|
68 |
} |
|
69 |
|
|
70 |
/** |
8aafc5
|
71 |
* 获取返修数据列表 |
W |
72 |
* @param rmRepairRecord |
|
73 |
* @return |
|
74 |
*/ |
|
75 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:list')") |
|
76 |
@GetMapping("/getRepairReportList") |
|
77 |
public R getRepairReportList(RmRepairRecord rmRepairRecord) |
|
78 |
{ |
|
79 |
RmRepairDataVO repairReportList = rmRepairRecordService.getRepairReportList(rmRepairRecord); |
|
80 |
return R.ok(repairReportList); |
|
81 |
} |
|
82 |
|
|
83 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:export')") |
|
84 |
@Log(title = "返修数据报表导出", businessType = BusinessType.EXPORT) |
|
85 |
@PostMapping("/exportRepair") |
|
86 |
public void exportRepair(HttpServletResponse response, RmRepairRecord rmRepairRecord) |
|
87 |
{ |
|
88 |
RmRepairDataVO repairReportList = rmRepairRecordService.getRepairReportList(rmRepairRecord); |
|
89 |
// List<SysDictData> allDict = iSysDictDataService.selectDictDataList(null); |
|
90 |
String fileName = "追溯报表"; |
|
91 |
try { |
|
92 |
ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).build(); |
|
93 |
WriteSheet mainSheet = EasyExcel.writerSheet(0, "返修数据") |
|
94 |
.head(RmRepairRecord.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
95 |
.build(); |
|
96 |
WriteSheet sheet1 = EasyExcel.writerSheet(1, "拧紧数据") |
|
97 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
98 |
.build(); |
|
99 |
WriteSheet sheet2 = EasyExcel.writerSheet(2, "相机检测") |
|
100 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
101 |
.build(); |
|
102 |
WriteSheet sheet3 = EasyExcel.writerSheet(3, "外漏检测") |
|
103 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
104 |
.build(); |
|
105 |
WriteSheet sheet4 = EasyExcel.writerSheet(4, "机油加注") |
|
106 |
.head(DaParamCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
107 |
.build(); |
|
108 |
WriteSheet sheet5 = EasyExcel.writerSheet(5, "工位结果") |
|
109 |
.head(DaPassingStationCollection.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
|
110 |
.build(); |
|
111 |
excelWriter.write(repairReportList.getMainList(),mainSheet); |
|
112 |
excelWriter.write(repairReportList.getList1(),sheet1); |
|
113 |
excelWriter.write(repairReportList.getList2(),sheet2); |
|
114 |
excelWriter.write(repairReportList.getList3(),sheet3); |
|
115 |
excelWriter.write(repairReportList.getList4(),sheet4); |
|
116 |
excelWriter.write(repairReportList.getList5(),sheet5); |
|
117 |
response.setContentType("application/vnd.ms-excel;charset=utf-8"); |
|
118 |
response.setCharacterEncoding("UTF-8"); |
|
119 |
response.setHeader("Content-Disposition","attachment;filename="+fileName+".xlsx"); |
|
120 |
excelWriter.finish(); |
|
121 |
} catch (IOException e) { |
|
122 |
throw new RuntimeException(e); |
|
123 |
} |
|
124 |
} |
|
125 |
|
|
126 |
|
|
127 |
/** |
5fc587
|
128 |
* 不分页查询返修记录列表 |
懒 |
129 |
*/ |
|
130 |
@GetMapping("/noPagelist") |
|
131 |
public TableDataInfo noPagelist(RmRepairRecord rmRepairRecord) |
|
132 |
{ |
|
133 |
List<RmRepairRecord> list = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
|
134 |
return getDataTable(list); |
|
135 |
} |
|
136 |
|
|
137 |
/** |
fd2207
|
138 |
* 导出返修记录列表 |
懒 |
139 |
*/ |
|
140 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:export')") |
|
141 |
@Log(title = "返修记录", businessType = BusinessType.EXPORT) |
|
142 |
@PostMapping("/export") |
|
143 |
public void export(HttpServletResponse response, RmRepairRecord rmRepairRecord) |
|
144 |
{ |
|
145 |
List<RmRepairRecord> list = rmRepairRecordService.selectRmRepairRecordList(rmRepairRecord); |
|
146 |
ExcelUtil<RmRepairRecord> util = new ExcelUtil<RmRepairRecord>(RmRepairRecord.class); |
|
147 |
util.exportExcel(response, list, "返修记录数据"); |
|
148 |
} |
|
149 |
|
|
150 |
/** |
|
151 |
* 获取返修记录详细信息 |
|
152 |
*/ |
|
153 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:query')") |
|
154 |
@GetMapping(value = "/{id}") |
|
155 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
156 |
{ |
|
157 |
return success(rmRepairRecordService.selectRmRepairRecordById(id)); |
|
158 |
} |
|
159 |
|
|
160 |
/** |
|
161 |
* 新增返修记录 |
|
162 |
*/ |
|
163 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:add')") |
|
164 |
@Log(title = "返修记录", businessType = BusinessType.INSERT) |
|
165 |
@PostMapping |
|
166 |
public AjaxResult add(@RequestBody RmRepairRecord rmRepairRecord) |
|
167 |
{ |
|
168 |
return toAjax(rmRepairRecordService.insertRmRepairRecord(rmRepairRecord)); |
|
169 |
} |
|
170 |
|
|
171 |
/** |
|
172 |
* 修改返修记录 |
|
173 |
*/ |
|
174 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:edit')") |
|
175 |
@Log(title = "返修记录", businessType = BusinessType.UPDATE) |
|
176 |
@PutMapping |
|
177 |
public AjaxResult edit(@RequestBody RmRepairRecord rmRepairRecord) |
|
178 |
{ |
|
179 |
return toAjax(rmRepairRecordService.updateRmRepairRecord(rmRepairRecord)); |
|
180 |
} |
|
181 |
|
|
182 |
/** |
|
183 |
* 删除返修记录 |
|
184 |
*/ |
|
185 |
@PreAuthorize("@ss.hasPermi('rm:repairRecord:remove')") |
|
186 |
@Log(title = "返修记录", businessType = BusinessType.DELETE) |
|
187 |
@DeleteMapping("/{ids}") |
|
188 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
189 |
{ |
|
190 |
return toAjax(rmRepairRecordService.deleteRmRepairRecordByIds(ids)); |
|
191 |
} |
|
192 |
} |