提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.main.bs.beatSetting.controller; |
懒 |
2 |
|
2c65c3
|
3 |
import java.time.LocalDate; |
fd2207
|
4 |
import java.util.List; |
2c65c3
|
5 |
import javax.annotation.Resource; |
fd2207
|
6 |
import javax.servlet.http.HttpServletResponse; |
2c65c3
|
7 |
|
W |
8 |
import cn.hutool.core.util.ObjectUtil; |
|
9 |
import com.jcdm.common.core.domain.R; |
|
10 |
import com.jcdm.main.bs.beatSetting.domain.ProductNumTable; |
|
11 |
import com.jcdm.main.bs.beatSetting.service.ProductNumTableService; |
|
12 |
import com.jcdm.main.da.passingStationCollection.domain.DaPassingStationCollection; |
|
13 |
import com.jcdm.main.da.passingStationCollection.domain.ProductNumVO; |
|
14 |
import com.jcdm.main.da.passingStationCollection.service.IDaPassingStationCollectionService; |
fd2207
|
15 |
import org.springframework.security.access.prepost.PreAuthorize; |
懒 |
16 |
import org.springframework.beans.factory.annotation.Autowired; |
|
17 |
import org.springframework.web.bind.annotation.GetMapping; |
|
18 |
import org.springframework.web.bind.annotation.PostMapping; |
|
19 |
import org.springframework.web.bind.annotation.PutMapping; |
|
20 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
21 |
import org.springframework.web.bind.annotation.PathVariable; |
|
22 |
import org.springframework.web.bind.annotation.RequestBody; |
|
23 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
24 |
import org.springframework.web.bind.annotation.RestController; |
|
25 |
import com.jcdm.common.annotation.Log; |
|
26 |
import com.jcdm.common.core.controller.BaseController; |
|
27 |
import com.jcdm.common.core.domain.AjaxResult; |
|
28 |
import com.jcdm.common.enums.BusinessType; |
|
29 |
import com.jcdm.main.bs.beatSetting.domain.BsBeatSetting; |
|
30 |
import com.jcdm.main.bs.beatSetting.service.IBsBeatSettingService; |
|
31 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
32 |
import com.jcdm.common.core.page.TableDataInfo; |
|
33 |
|
|
34 |
/** |
acf56f
|
35 |
* 节拍设置Controller1 |
fd2207
|
36 |
* |
懒 |
37 |
* @author Yi |
|
38 |
* @date 2024-01-05 |
|
39 |
*/ |
|
40 |
@RestController |
|
41 |
@RequestMapping("/bs/beatSetting") |
|
42 |
public class BsBeatSettingController extends BaseController |
|
43 |
{ |
|
44 |
@Autowired |
|
45 |
private IBsBeatSettingService bsBeatSettingService; |
|
46 |
|
2c65c3
|
47 |
@Resource |
W |
48 |
private ProductNumTableService productNumTableService; |
|
49 |
|
|
50 |
@Resource |
|
51 |
private IDaPassingStationCollectionService daPassingStationCollectionService; |
|
52 |
|
fd2207
|
53 |
/** |
懒 |
54 |
* 查询节拍设置列表 |
|
55 |
*/ |
|
56 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:list')") |
|
57 |
@GetMapping("/list") |
|
58 |
public TableDataInfo list(BsBeatSetting bsBeatSetting) |
|
59 |
{ |
|
60 |
startPage(); |
|
61 |
List<BsBeatSetting> list = bsBeatSettingService.selectBsBeatSettingList(bsBeatSetting); |
|
62 |
return getDataTable(list); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 导出节拍设置列表 |
|
67 |
*/ |
|
68 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:export')") |
|
69 |
@Log(title = "节拍设置", businessType = BusinessType.EXPORT) |
|
70 |
@PostMapping("/export") |
|
71 |
public void export(HttpServletResponse response, BsBeatSetting bsBeatSetting) |
|
72 |
{ |
|
73 |
List<BsBeatSetting> list = bsBeatSettingService.selectBsBeatSettingList(bsBeatSetting); |
|
74 |
ExcelUtil<BsBeatSetting> util = new ExcelUtil<BsBeatSetting>(BsBeatSetting.class); |
|
75 |
util.exportExcel(response, list, "节拍设置数据"); |
|
76 |
} |
|
77 |
|
2c65c3
|
78 |
|
W |
79 |
@Log(title = "节拍设置", businessType = BusinessType.EXPORT) |
|
80 |
@PostMapping("/productNumExport") |
|
81 |
public void productNumExport(HttpServletResponse response, DaPassingStationCollection daPassingStationCollection) |
|
82 |
{ |
|
83 |
// LocalDate queryDate = daPassingStationCollection.getQueryDate(); |
|
84 |
// String queryMonth = daPassingStationCollection.getQueryMonth(); |
|
85 |
// if (ObjectUtil.isNull(queryDate) && ObjectUtil.isNull(queryMonth)){ |
|
86 |
// return R.fail("请选择月份或者日期"); |
|
87 |
// } |
|
88 |
// if (ObjectUtil.isNotEmpty(queryMonth) && ObjectUtil.isNotEmpty(queryDate)){ |
|
89 |
// String queryDateString = queryDate.toString(); |
|
90 |
// String queryMonthString = queryMonth.toString(); |
|
91 |
// if (!queryDateString.contains(queryMonthString)){ |
|
92 |
// return R.fail("请确认选择的月份和日期月份是否匹配"); |
|
93 |
// } |
|
94 |
// } |
|
95 |
List<ProductNumVO> productNum = daPassingStationCollectionService.getProductNum(daPassingStationCollection); |
|
96 |
ExcelUtil<ProductNumVO> util = new ExcelUtil<ProductNumVO>(ProductNumVO.class); |
|
97 |
util.exportExcel(response, productNum, "产量统计数据"); |
|
98 |
|
|
99 |
|
|
100 |
} |
|
101 |
|
fd2207
|
102 |
/** |
懒 |
103 |
* 获取节拍设置详细信息 |
|
104 |
*/ |
|
105 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:query')") |
|
106 |
@GetMapping(value = "/{id}") |
|
107 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
108 |
{ |
|
109 |
return success(bsBeatSettingService.selectBsBeatSettingById(id)); |
|
110 |
} |
|
111 |
|
|
112 |
/** |
|
113 |
* 新增节拍设置 |
|
114 |
*/ |
|
115 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:add')") |
|
116 |
@Log(title = "节拍设置", businessType = BusinessType.INSERT) |
|
117 |
@PostMapping |
|
118 |
public AjaxResult add(@RequestBody BsBeatSetting bsBeatSetting) |
|
119 |
{ |
|
120 |
return toAjax(bsBeatSettingService.insertBsBeatSetting(bsBeatSetting)); |
|
121 |
} |
|
122 |
|
|
123 |
/** |
|
124 |
* 修改节拍设置 |
|
125 |
*/ |
|
126 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:edit')") |
|
127 |
@Log(title = "节拍设置", businessType = BusinessType.UPDATE) |
|
128 |
@PutMapping |
|
129 |
public AjaxResult edit(@RequestBody BsBeatSetting bsBeatSetting) |
|
130 |
{ |
|
131 |
return toAjax(bsBeatSettingService.updateBsBeatSetting(bsBeatSetting)); |
|
132 |
} |
|
133 |
|
|
134 |
/** |
|
135 |
* 删除节拍设置 |
|
136 |
*/ |
|
137 |
@PreAuthorize("@ss.hasPermi('bs:beatSetting:remove')") |
|
138 |
@Log(title = "节拍设置", businessType = BusinessType.DELETE) |
|
139 |
@DeleteMapping("/{ids}") |
|
140 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
141 |
{ |
|
142 |
return toAjax(bsBeatSettingService.deleteBsBeatSettingByIds(ids)); |
|
143 |
} |
|
144 |
} |