|
@@ -1,28 +1,24 @@
|
|
|
package com.jjt.calc.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import com.jjt.calc.domain.TwinCalcHourSpec;
|
|
|
+import com.jjt.calc.service.ITwinCalcHourSpecService;
|
|
|
import com.jjt.common.annotation.Log;
|
|
|
import com.jjt.common.core.controller.BaseController;
|
|
|
import com.jjt.common.core.domain.AjaxResult;
|
|
|
+import com.jjt.common.core.page.TableDataInfo;
|
|
|
import com.jjt.common.enums.BusinessType;
|
|
|
-import com.jjt.calc.domain.TwinCalcHourSpec;
|
|
|
-import com.jjt.calc.service.ITwinCalcHourSpecService;
|
|
|
+import com.jjt.common.utils.StringUtils;
|
|
|
import com.jjt.common.utils.poi.ExcelUtil;
|
|
|
-import com.jjt.common.core.page.TableDataInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 按配方1小时统计数据Controller
|
|
@@ -30,10 +26,10 @@ import com.jjt.common.core.page.TableDataInfo;
|
|
|
* @author wukai
|
|
|
* @date 2025-01-18
|
|
|
*/
|
|
|
-@Api(tags="按配方1小时统计数据")
|
|
|
+@Api(tags = "按配方1小时统计数据")
|
|
|
@RestController
|
|
|
@RequestMapping("/calc/calcSpec")
|
|
|
-public class TwinCalcHourSpecController extends BaseController{
|
|
|
+public class TwinCalcHourSpecController extends BaseController {
|
|
|
@Resource
|
|
|
private ITwinCalcHourSpecService twinCalcHourSpecService;
|
|
|
|
|
@@ -43,9 +39,23 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@ApiOperation("查询按配方1小时统计数据列表")
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:list')")
|
|
|
@GetMapping("/list")
|
|
|
- public TableDataInfo list(TwinCalcHourSpec twinCalcHourSpec)
|
|
|
- {
|
|
|
+ public TableDataInfo list(TwinCalcHourSpec twinCalcHourSpec) {
|
|
|
startPage();
|
|
|
+ if (StringUtils.isNotEmpty(twinCalcHourSpec.getRemark())) {
|
|
|
+ String[] hours = twinCalcHourSpec.getRemark().split("-");
|
|
|
+ int start = Integer.parseInt(hours[0]);
|
|
|
+ int end = Integer.parseInt(hours[1]);
|
|
|
+ Map<String, Object> params = twinCalcHourSpec.getParams();
|
|
|
+ if (params == null) {
|
|
|
+ params = new HashMap<>();
|
|
|
+ }
|
|
|
+ String query = "(hour >= " + start + " and hour < " + end + ")";
|
|
|
+ if (start > end) {
|
|
|
+ query = "(hour >= " + start + " or hour < " + end + ")";
|
|
|
+ }
|
|
|
+ params.put("query", query);
|
|
|
+ twinCalcHourSpec.setParams(params);
|
|
|
+ }
|
|
|
List<TwinCalcHourSpec> list = twinCalcHourSpecService.selectTwinCalcHourSpecList(twinCalcHourSpec);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
@@ -57,8 +67,7 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:export')")
|
|
|
@Log(title = "按配方1小时统计数据", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
- public void export(HttpServletResponse response, TwinCalcHourSpec twinCalcHourSpec)
|
|
|
- {
|
|
|
+ public void export(HttpServletResponse response, TwinCalcHourSpec twinCalcHourSpec) {
|
|
|
List<TwinCalcHourSpec> list = twinCalcHourSpecService.selectTwinCalcHourSpecList(twinCalcHourSpec);
|
|
|
ExcelUtil<TwinCalcHourSpec> util = new ExcelUtil<TwinCalcHourSpec>(TwinCalcHourSpec.class);
|
|
|
util.exportExcel(response, list, "按配方1小时统计数据数据");
|
|
@@ -70,8 +79,7 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@ApiOperation("获取按配方1小时统计数据详细信息")
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
|
- public AjaxResult getInfo(@PathVariable("id") Long id)
|
|
|
- {
|
|
|
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
return success(twinCalcHourSpecService.selectTwinCalcHourSpecById(id));
|
|
|
}
|
|
|
|
|
@@ -82,8 +90,7 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:add')")
|
|
|
@Log(title = "按配方1小时统计数据", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
- public AjaxResult add(@RequestBody TwinCalcHourSpec twinCalcHourSpec)
|
|
|
- {
|
|
|
+ public AjaxResult add(@RequestBody TwinCalcHourSpec twinCalcHourSpec) {
|
|
|
return toAjax(twinCalcHourSpecService.insertTwinCalcHourSpec(twinCalcHourSpec));
|
|
|
}
|
|
|
|
|
@@ -94,8 +101,7 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:edit')")
|
|
|
@Log(title = "按配方1小时统计数据", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
- public AjaxResult edit(@RequestBody TwinCalcHourSpec twinCalcHourSpec)
|
|
|
- {
|
|
|
+ public AjaxResult edit(@RequestBody TwinCalcHourSpec twinCalcHourSpec) {
|
|
|
return toAjax(twinCalcHourSpecService.updateTwinCalcHourSpec(twinCalcHourSpec));
|
|
|
}
|
|
|
|
|
@@ -105,9 +111,8 @@ public class TwinCalcHourSpecController extends BaseController{
|
|
|
@ApiOperation("删除按配方1小时统计数据")
|
|
|
@PreAuthorize("@ss.hasPermi('calc:calcSpec:remove')")
|
|
|
@Log(title = "按配方1小时统计数据", businessType = BusinessType.DELETE)
|
|
|
- @DeleteMapping("/{ids}")
|
|
|
- public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
return toAjax(twinCalcHourSpecService.deleteTwinCalcHourSpecByIds(ids));
|
|
|
}
|
|
|
}
|