fix:设备数据接口、使用记录接口调整

This commit is contained in:
FCL
2026-03-04 11:20:18 +08:00
parent d179bd9379
commit 8a9c74b9a9
15 changed files with 240 additions and 168 deletions

View File

@@ -16,6 +16,7 @@ import com.zt.plat.framework.excel.core.util.ExcelUtils;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationWithProductVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService; import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService;
import com.zt.plat.module.qms.resource.device.service.DeviceProductService; import com.zt.plat.module.qms.resource.device.service.DeviceProductService;
@@ -119,16 +120,15 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得设备-设备信息") @Operation(summary = "获得设备-设备信息")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
// @PreAuthorize("@ss.hasPermission('resource:device-infomation:query')") public CommonResult<DeviceInfomationWithProductVO> getDeviceInfomation(@RequestParam("id") Long id) {
public CommonResult<DeviceInfomationRespVO> getDeviceInfomation(@RequestParam("id") Long id) { DeviceInfomationWithProductVO deviceInfomation = deviceInfomationService.getDeviceWithProduct(id);
DeviceInfomationDO deviceInfomation = deviceInfomationService.getDeviceInfomation(id); return success(deviceInfomation);
return success(BeanUtils.toBean(deviceInfomation, DeviceInfomationRespVO.class));
} }
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得设备-设备信息分页") @Operation(summary = "获得设备-设备信息分页")
// @PreAuthorize("@ss.hasPermission('resource:device-infomation:query')") public CommonResult<PageResult<DeviceInfomationWithProductVO>> getDeviceInfomationPage(@Valid DeviceInfomationPageReqVO pageReqVO) {
public CommonResult<PageResult<DeviceInfomationRespVO>> getDeviceInfomationPage(@Valid DeviceInfomationPageReqVO pageReqVO) {
Long productId = pageReqVO.getProductId(); Long productId = pageReqVO.getProductId();
if(productId != null){ if(productId != null){
List<Long> productIds = deviceProductService.getIdListByIdPath(productId); List<Long> productIds = deviceProductService.getIdListByIdPath(productId);
@@ -142,8 +142,8 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
deviceStatus = "{\"Enable\":\"1\"}"; deviceStatus = "{\"Enable\":\"1\"}";
if(!ObjectUtils.isEmpty(deviceStatus)) if(!ObjectUtils.isEmpty(deviceStatus))
pageReqVO.setDeviceStatusJson(JSON.parseObject(deviceStatus)); pageReqVO.setDeviceStatusJson(JSON.parseObject(deviceStatus));
PageResult<DeviceInfomationDO> pageResult = deviceInfomationService.getDeviceInfomationPage(pageReqVO); PageResult<DeviceInfomationWithProductVO> pageResult = deviceInfomationService.getDeviceInfomationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DeviceInfomationRespVO.class)); return success(pageResult);
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@@ -153,7 +153,7 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
public void exportDeviceInfomationExcel(@Valid DeviceInfomationPageReqVO pageReqVO, public void exportDeviceInfomationExcel(@Valid DeviceInfomationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<DeviceInfomationDO> list = deviceInfomationService.getDeviceInfomationPage(pageReqVO).getList(); List<DeviceInfomationWithProductVO> list = deviceInfomationService.getDeviceInfomationPage(pageReqVO).getList();
// 导出 Excel // 导出 Excel
ExcelUtils.write(response, "设备-设备信息.xls", "数据", DeviceInfomationRespVO.class, ExcelUtils.write(response, "设备-设备信息.xls", "数据", DeviceInfomationRespVO.class,
BeanUtils.toBean(list, DeviceInfomationRespVO.class)); BeanUtils.toBean(list, DeviceInfomationRespVO.class));

View File

@@ -63,8 +63,8 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
@GetMapping("/queryPageListWithCount") @GetMapping("/queryPageListWithCount")
@Operation(summary = "使用记录分页列表查询(以设备为主数据)") @Operation(summary = "使用记录分页列表查询(以设备为主数据)")
public CommonResult<PageResult<DeviceUseRecordVO>> queryPageListWithCount(@Valid DeviceUseRecordPageReqVO pageReqVO) { public CommonResult<PageResult<DeviceInfomationWithProductVO>> queryPageListWithCount(@Valid DeviceUseRecordPageReqVO pageReqVO) {
PageResult<DeviceUseRecordVO> pageResult = deviceUseRecordService.queryPageListWithCount(pageReqVO); PageResult<DeviceInfomationWithProductVO> pageResult = deviceUseRecordService.queryPageListWithCount(pageReqVO);
return success(pageResult); return success(pageResult);
} }
@@ -98,7 +98,7 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新设备-使用记录") @Operation(summary = "更新设备-使用记录")
@PreAuthorize("@ss.hasPermission('qms:device-use-record:update')") // @PreAuthorize("@ss.hasPermission('qms:device-use-record:update')")
public CommonResult<Boolean> updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO reqVO) { public CommonResult<Boolean> updateDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO reqVO) {
Long deviceId = reqVO.getDeviceId(); Long deviceId = reqVO.getDeviceId();
if(deviceId == null) if(deviceId == null)
@@ -110,7 +110,7 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除设备-使用记录") @Operation(summary = "删除设备-使用记录")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('qms:device-use-record:delete')") // @PreAuthorize("@ss.hasPermission('qms:device-use-record:delete')")
public CommonResult<Boolean> deleteDeviceUseRecord(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteDeviceUseRecord(@RequestParam("id") Long id) {
deviceUseRecordService.deleteDeviceUseRecord(id); deviceUseRecordService.deleteDeviceUseRecord(id);
return success(true); return success(true);
@@ -128,7 +128,7 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得设备-使用记录") @Operation(summary = "获得设备-使用记录")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('qms:device-use-record:query')") // @PreAuthorize("@ss.hasPermission('qms:device-use-record:query')")
public CommonResult<DeviceUseRecordRespVO> getDeviceUseRecord(@RequestParam("id") Long id) { public CommonResult<DeviceUseRecordRespVO> getDeviceUseRecord(@RequestParam("id") Long id) {
DeviceUseRecordDO deviceUseRecord = deviceUseRecordService.getDeviceUseRecord(id); DeviceUseRecordDO deviceUseRecord = deviceUseRecordService.getDeviceUseRecord(id);
return success(BeanUtils.toBean(deviceUseRecord, DeviceUseRecordRespVO.class)); return success(BeanUtils.toBean(deviceUseRecord, DeviceUseRecordRespVO.class));

View File

@@ -16,6 +16,9 @@ import static com.zt.plat.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH
@Data @Data
public class DeviceInfomationPageReqVO extends PageParam { public class DeviceInfomationPageReqVO extends PageParam {
@Schema(description = "id", example = "32101")
private Long id;
@Schema(description = "设备大类id", example = "32101") @Schema(description = "设备大类id", example = "32101")
private Long productId; private Long productId;

View File

@@ -0,0 +1,25 @@
package com.zt.plat.module.qms.resource.device.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/*
* 设备含使用记录数
* */
@Data
public class DeviceInfomationUseRecordVO extends DeviceInfomationWithProductVO {
//============使用记录数============
@Schema(description = "未提交数据量")
private Integer runningCount;
@Schema(description = "已提交数据量")
private Integer finishedCount;
//============查询字段============
@Schema(description = "截止时间不为空")
private String useTimeEndFlag;
}

View File

@@ -0,0 +1,48 @@
package com.zt.plat.module.qms.resource.device.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
/*
* 设备与大类实体
*
* */
@Data
public class DeviceInfomationWithProductVO extends DeviceInfomationRespVO{
//=========设备字段============
private Long companyId;
private String companyName;
private Long deptId;
@Schema(description = "所属部门名称")
private String deptName;
private Long postId;
private Long tenantId;
private String updaterName;
private String creatorName;
private LocalDateTime createTime;
private LocalDateTime updateTime;
private String creator;
private String updater;
//============大类字段============
@Schema(description = "规格")
private String specification;
@Schema(description = "型号")
private String modelNo;
@Schema(description = "制造商")
private String manufacturer;
}

View File

@@ -1,5 +1,6 @@
package com.zt.plat.module.qms.resource.device.controller.vo; package com.zt.plat.module.qms.resource.device.controller.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import java.util.*; import java.util.*;
@@ -24,9 +25,11 @@ public class DeviceUseRecordSaveReqVO {
private Long userId; private Long userId;
@Schema(description = "开始使用时间") @Schema(description = "开始使用时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime useTimeStart; private LocalDateTime useTimeStart;
@Schema(description = "结束使用时间") @Schema(description = "结束使用时间")
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime useTimeEnd; private LocalDateTime useTimeEnd;
@Schema(description = "使用记录") @Schema(description = "使用记录")

View File

@@ -7,6 +7,7 @@ import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission; import com.zt.plat.module.qms.core.aspect.annotation.QmsPermission;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationWithProductVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -26,7 +27,7 @@ import static com.zt.plat.module.qms.enums.QmsPermissionConstant.DEVICE_MANAGER;
@Mapper @Mapper
public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> { public interface DeviceInfomationMapper extends BaseMapperX<DeviceInfomationDO> {
Page<DeviceInfomationDO> selectPage(IPage<?> page, @Param("param") DeviceInfomationPageReqVO param); Page<DeviceInfomationWithProductVO> selectPage(IPage<?> page, @Param("param") DeviceInfomationPageReqVO param);
//查询需要“某个业务类型”的设备列表 //查询需要“某个业务类型”的设备列表
List<DeviceInfoWithBizConfigVO> getListNeedByRule(@Param("param") Map<String, Object> param); List<DeviceInfoWithBizConfigVO> getListNeedByRule(@Param("param") Map<String, Object> param);

View File

@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zt.plat.framework.common.pojo.PageResult; import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX; import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX; import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationWithProductVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceUseRecordDO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceUseRecordDO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@@ -39,8 +39,10 @@ public interface DeviceUseRecordMapper extends BaseMapperX<DeviceUseRecordDO> {
.orderByDesc(DeviceUseRecordDO::getId)); .orderByDesc(DeviceUseRecordDO::getId));
} }
IPage<DeviceUseRecordVO> queryPageListWithCount(Page<DeviceUseRecordVO> page, @Param("param") DeviceUseRecordPageReqVO param); IPage<DeviceInfomationWithProductVO> queryPageListWithCount(Page<DeviceInfomationWithProductVO> page, @Param("param") DeviceUseRecordPageReqVO param);
DeviceUseRecordVO queryVoById(@Param("id") Long id);
// DeviceUseRecordVO queryVoById(@Param("id") Long id);
} }

View File

@@ -6,6 +6,7 @@ import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationPageReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationRespVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO; import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationWithProductVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO; import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
@@ -90,6 +91,7 @@ public interface DeviceInfomationService {
* @return 设备-设备信息 * @return 设备-设备信息
*/ */
DeviceInfomationDO getDeviceInfomation(Long id); DeviceInfomationDO getDeviceInfomation(Long id);
DeviceInfomationWithProductVO getDeviceWithProduct(Long id);
/** /**
* 获得设备-设备信息分页 * 获得设备-设备信息分页
@@ -97,6 +99,6 @@ public interface DeviceInfomationService {
* @param pageReqVO 分页查询 * @param pageReqVO 分页查询
* @return 设备-设备信息分页 * @return 设备-设备信息分页
*/ */
PageResult<DeviceInfomationDO> getDeviceInfomationPage(DeviceInfomationPageReqVO pageReqVO); PageResult<DeviceInfomationWithProductVO> getDeviceInfomationPage(DeviceInfomationPageReqVO pageReqVO);
} }

Some files were not shown because too many files have changed in this diff Show More