Merge branch 'dyf-device' into 6170
This commit is contained in:
@ -61,13 +61,15 @@ public class HomePageController {
|
||||
/**
|
||||
* 获取设备使用数据
|
||||
*
|
||||
* @param deviceId 设备ID
|
||||
* @param deviceTypeId 设备ID (可选)
|
||||
* @param range 时间范围 1:半年 2:一年
|
||||
* @return 每月使用数据列表
|
||||
*/
|
||||
@GetMapping("/getEquipmentUsageData/{deviceId}/{range}")
|
||||
public R<List<Map<String, Object>>> getEquipmentUsageData(@PathVariable Long deviceId, @PathVariable Integer range) {
|
||||
return R.ok(deviceService.getEquipmentUsageData(deviceId, range));
|
||||
@GetMapping("/getEquipmentUsageData/{range}")
|
||||
public R<List<Map<String, Object>>> getEquipmentUsageData(@PathVariable Integer range,
|
||||
@RequestParam(required = false) Long deviceTypeId) {
|
||||
return R.ok(deviceService.getEquipmentUsageData(deviceTypeId, range));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,108 @@
|
||||
package com.fuyuanshen.web.controller.device.fence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceFenceAccessRecordBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo;
|
||||
import com.fuyuanshen.equipment.service.IDeviceFenceAccessRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 围栏进出记录
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/fys-equipment/fenceAccessRecord")
|
||||
public class DeviceFenceAccessRecordController extends BaseController {
|
||||
|
||||
private final IDeviceFenceAccessRecordService deviceFenceAccessRecordService;
|
||||
|
||||
/**
|
||||
* 查询围栏进出记录列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<DeviceFenceAccessRecordVo> list(DeviceFenceAccessRecordBo bo, PageQuery pageQuery) {
|
||||
return deviceFenceAccessRecordService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 围栏进出记录列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:export")
|
||||
@Log(title = "围栏进出记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(DeviceFenceAccessRecordBo bo, HttpServletResponse response) {
|
||||
List<DeviceFenceAccessRecordVo> list = deviceFenceAccessRecordService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "围栏进出记录", DeviceFenceAccessRecordVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取围栏进出记录详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<DeviceFenceAccessRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(deviceFenceAccessRecordService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增围栏进出记录
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:add")
|
||||
@Log(title = "围栏进出记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceFenceAccessRecordBo bo) {
|
||||
return toAjax(deviceFenceAccessRecordService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改围栏进出记录
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:edit")
|
||||
@Log(title = "围栏进出记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceFenceAccessRecordBo bo) {
|
||||
return toAjax(deviceFenceAccessRecordService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除围栏进出记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:fenceAccessRecord:remove")
|
||||
@Log(title = "围栏进出记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(deviceFenceAccessRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
package com.fuyuanshen.web.controller.device.fence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGeoFenceBo;
|
||||
import com.fuyuanshen.equipment.domain.dto.FenceCheckResponse;
|
||||
import com.fuyuanshen.equipment.domain.query.FenceCheckRequest;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGeoFenceVo;
|
||||
import com.fuyuanshen.equipment.service.IDeviceGeoFenceService;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 电子围栏
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-09-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/fys-equipment/geoFence")
|
||||
public class DeviceGeoFenceController extends BaseController {
|
||||
|
||||
private final IDeviceGeoFenceService deviceGeoFenceService;
|
||||
|
||||
/**
|
||||
* 查询电子围栏列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<DeviceGeoFenceVo> list(DeviceGeoFenceBo bo, PageQuery pageQuery) {
|
||||
return deviceGeoFenceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 电子围栏列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:export")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(DeviceGeoFenceBo bo, HttpServletResponse response) {
|
||||
List<DeviceGeoFenceVo> list = deviceGeoFenceService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "电子围栏", DeviceGeoFenceVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电子围栏详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<DeviceGeoFenceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(deviceGeoFenceService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增电子围栏
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:add")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceGeoFenceBo bo) {
|
||||
return toAjax(deviceGeoFenceService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改电子围栏
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:edit")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceGeoFenceBo bo) {
|
||||
return toAjax(deviceGeoFenceService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除电子围栏
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:geoFence:remove")
|
||||
@Log(title = "电子围栏", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(deviceGeoFenceService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 位置检查
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/check")
|
||||
public ResponseEntity<FenceCheckResponse> checkPosition(
|
||||
@Valid @RequestBody FenceCheckRequest request) {
|
||||
FenceCheckResponse response = deviceGeoFenceService.checkPosition(request);
|
||||
return ResponseEntity.ok(response);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user