97 lines
3.4 KiB
Java
97 lines
3.4 KiB
Java
package com.gunshi.project.xyt.controller;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.gunshi.core.result.R;
|
|
import com.gunshi.project.xyt.entity.so.GateHisPageSo;
|
|
import com.gunshi.project.xyt.entity.vo.GateStautsVo;
|
|
import com.gunshi.project.xyt.entity.vo.GateValveOplogVo;
|
|
import com.gunshi.project.xyt.model.GateValveKey;
|
|
import com.gunshi.project.xyt.model.GateValveReal;
|
|
import com.gunshi.project.xyt.service.GateValveRealService;
|
|
import com.gunshi.project.xyt.validate.markers.Insert;
|
|
import com.gunshi.project.xyt.validate.markers.Update;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.media.Schema;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.io.Serializable;
|
|
import java.math.BigDecimal;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 描述: 闸阀开关表
|
|
* author: xusan
|
|
* date: 2024-07-08 17:40:37
|
|
*/
|
|
@Tag(name = "闸阀开关表")
|
|
@RestController
|
|
@RequestMapping(value="/gateValveReal")
|
|
public class GateValveRealController {
|
|
|
|
@Autowired
|
|
private GateValveRealService service;
|
|
|
|
|
|
@Operation(summary = "新增")
|
|
@PostMapping("/insert")
|
|
public R<GateValveReal> insert(@Validated(Insert.class) @RequestBody GateValveReal dto) {
|
|
boolean result = service.save(dto);
|
|
return R.ok(result ? dto : null);
|
|
}
|
|
|
|
@Operation(summary = "修改")
|
|
@PostMapping("/update")
|
|
public R<GateValveReal> update(@Validated(Update.class) @RequestBody GateValveReal dto) {
|
|
boolean result = service.updateById(dto);
|
|
return R.ok(result ? dto : null);
|
|
}
|
|
|
|
@Operation(summary = "删除")
|
|
@GetMapping("/del/{id}")
|
|
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
|
return R.ok(service.removeById(id));
|
|
}
|
|
|
|
@Operation(summary = "列表")
|
|
@PostMapping("/list")
|
|
public R<List<GateStautsVo>> list() {
|
|
return R.ok(service.gateStatusList());
|
|
}
|
|
|
|
@Operation(summary = "通过闸阀查询实时流量")
|
|
@GetMapping("/realQ")
|
|
public R<BigDecimal> realQ(@RequestParam("valveCode") @Parameter(description = "闸阀编码") String valveCode) {
|
|
return R.ok(service.realQ(valveCode));
|
|
}
|
|
|
|
@Operation(summary = "调节闸阀")
|
|
@PostMapping("/control")
|
|
public R<String> control(@RequestBody GateValveKey gateValveKey) {
|
|
return R.ok(service.control(gateValveKey));
|
|
}
|
|
|
|
@Operation(summary = "闸阀操作日志-分页")
|
|
@PostMapping("/log/page")
|
|
public R<Page<GateValveOplogVo>> logPage(@RequestBody GateHisPageSo so) {
|
|
return R.ok(service.logPage(so));
|
|
}
|
|
|
|
|
|
@Operation(summary = "闸阀操作日志-导出")
|
|
@PostMapping("/log/export")
|
|
public void logExport(@RequestBody GateHisPageSo so, HttpServletResponse response) {
|
|
service.logExport(so,response);
|
|
}
|
|
|
|
@Operation(summary = "预计可供水时间")
|
|
@GetMapping("/supply/time")
|
|
public R<Map<BigDecimal, String>> supplyTime(@RequestParam(value = "year",required = false) @Parameter(description = "年份") Integer year,@RequestParam(value = "month",required = false) @Parameter(description = "月份") Integer month) {
|
|
return R.ok(service.supplyTime(year,month));
|
|
}
|
|
} |