feat:设备后端接口-维护、巡检等
This commit is contained in:
@@ -59,6 +59,12 @@ public class DeviceMaintainController extends AbstractFileUploadController imple
|
||||
@Resource private DeviceMaintainService deviceMaintainService;
|
||||
@Resource private DeviceInfomationService deviceInfomationService;
|
||||
|
||||
@PostMapping("/saveMaintainVo")
|
||||
@Operation(summary = "创建或获取维护数据")
|
||||
public CommonResult<Boolean> saveMaintainVo(@RequestBody DeviceMaintainVO vo) {
|
||||
return deviceMaintainService.saveMaintainVo(vo);
|
||||
}
|
||||
|
||||
@PostMapping("/createOrGet")
|
||||
@Operation(summary = "创建或获取维护数据")
|
||||
public CommonResult<DeviceMaintainVO> createOrGet(@RequestBody JSONObject jsonObject) {
|
||||
@@ -88,7 +94,7 @@ public class DeviceMaintainController extends AbstractFileUploadController imple
|
||||
}
|
||||
|
||||
@GetMapping("/queryPageListWithCount")
|
||||
@Operation(summary = "维护-分页列表查询")
|
||||
@Operation(summary = "维护-分页列表查询(以设备为主数据)")
|
||||
public CommonResult<PageResult<DeviceMaintainVO>> queryPageListWithCount(@Valid DeviceMaintainPageReqVO pageReqVO) {
|
||||
PageResult<DeviceMaintainVO> pageResult = deviceMaintainService.queryPageListWithCount(pageReqVO);
|
||||
return success(pageResult);
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.admin;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordSaveReqVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zt.plat.framework.security.core.LoginUser;
|
||||
import com.zt.plat.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.*;
|
||||
import com.zt.plat.module.qms.resource.device.dal.mapper.DeviceUseRecordMapper;
|
||||
import com.zt.plat.module.qms.resource.device.service.DeviceInfomationService;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -31,6 +35,7 @@ import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import com.zt.plat.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static com.zt.plat.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
import static com.zt.plat.module.qms.enums.ErrorCodeConstants.DEVICE_USE_RECORD_NOT_EXISTS;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceUseRecordDO;
|
||||
import com.zt.plat.module.qms.resource.device.service.DeviceUseRecordService;
|
||||
@@ -49,14 +54,43 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
|
||||
}
|
||||
}
|
||||
|
||||
@Resource
|
||||
private DeviceUseRecordService deviceUseRecordService;
|
||||
@Resource private DeviceUseRecordService deviceUseRecordService;
|
||||
@Resource private DeviceInfomationService deviceInfomationService;
|
||||
@Resource private DeviceUseRecordMapper deviceUseRecordMapper;
|
||||
|
||||
@GetMapping("/queryPageListWithCount")
|
||||
@Operation(summary = "使用记录分页列表查询(以设备为主数据)")
|
||||
public CommonResult<PageResult<DeviceUseRecordVO>> queryPageListWithCount(@Valid DeviceUseRecordPageReqVO pageReqVO) {
|
||||
PageResult<DeviceUseRecordVO> pageResult = deviceUseRecordService.queryPageListWithCount(pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/queryLastUsingData")
|
||||
@Operation(summary = "查询设备最近一次使用中的记录")
|
||||
@Parameter(name = "deviceId", description = "设备ID", required = true, example = "1024")
|
||||
public CommonResult<DeviceUseRecordRespVO> queryLastUsingData(@RequestParam("deviceId") Long deviceId) {
|
||||
if(deviceId == null)
|
||||
return CommonResult.error(DEVICE_USE_RECORD_NOT_EXISTS.getCode(), "设备ID不能为空");
|
||||
LambdaQueryWrapper<DeviceUseRecordDO> query = new LambdaQueryWrapper<>();
|
||||
query.eq(DeviceUseRecordDO::getDeviceId, deviceId);
|
||||
query.isNull(DeviceUseRecordDO::getUseTimeEnd);
|
||||
query.orderByDesc(DeviceUseRecordDO::getUseTimeStart);
|
||||
query.last("LIMIT 1");
|
||||
DeviceUseRecordDO recordDO = deviceUseRecordMapper.selectOne( query);
|
||||
return success(BeanUtils.toBean(recordDO, DeviceUseRecordRespVO.class));
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建设备-使用记录")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-use-record:create')")
|
||||
public CommonResult<DeviceUseRecordRespVO> createDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO createReqVO) {
|
||||
return success(deviceUseRecordService.createDeviceUseRecord(createReqVO));
|
||||
public CommonResult<DeviceUseRecordRespVO> createDeviceUseRecord(@Valid @RequestBody DeviceUseRecordSaveReqVO reqVO) {
|
||||
Long deviceId = reqVO.getDeviceId();
|
||||
if(deviceId == null)
|
||||
return CommonResult.error(DEVICE_USE_RECORD_NOT_EXISTS.getCode(), "设备ID不能为空");
|
||||
//检查设备状态
|
||||
CommonResult<Boolean> checkResult = deviceInfomationService.checkDeviceUsable(deviceId);
|
||||
if(!checkResult.isSuccess())
|
||||
return CommonResult.error(checkResult);
|
||||
return deviceUseRecordService.createDeviceUseRecord(reqVO);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@@ -96,7 +130,6 @@ public class DeviceUseRecordController extends AbstractFileUploadController impl
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得设备-使用记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('qms:device-use-record:query')")
|
||||
public CommonResult<PageResult<DeviceUseRecordRespVO>> getDeviceUseRecordPage(@Valid DeviceUseRecordPageReqVO pageReqVO) {
|
||||
PageResult<DeviceUseRecordDO> pageResult = deviceUseRecordService.getDeviceUseRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, DeviceUseRecordRespVO.class));
|
||||
|
||||
@@ -23,10 +23,10 @@ public class DeviceUseRecordPageReqVO extends PageParam {
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "开始使用时间")
|
||||
private LocalDateTime useTimeStart;
|
||||
private LocalDateTime[] useTimeStart;
|
||||
|
||||
@Schema(description = "结束使用时间")
|
||||
private LocalDateTime useTimeEnd;
|
||||
private LocalDateTime[] useTimeEnd;
|
||||
|
||||
@Schema(description = "使用记录")
|
||||
private String useRemark;
|
||||
@@ -59,4 +59,24 @@ public class DeviceUseRecordPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
//=====================================扩展字段===============================================
|
||||
|
||||
@Schema(description = "产品id")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "管理编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Schema(description = "使用部门")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "产品id查询")
|
||||
private List<Long> productIdList;
|
||||
|
||||
@Schema(description = "设备ID列表")
|
||||
private List<Long> deviceIdList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.zt.plat.module.qms.resource.device.controller.vo;
|
||||
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceMaintainItemDO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 设备使用记录VO")
|
||||
@Data
|
||||
public class DeviceUseRecordVO extends DeviceUseRecordRespVO {
|
||||
|
||||
|
||||
//============大类字段============
|
||||
@Schema(description = "产品id")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "规格")
|
||||
private String specification;
|
||||
|
||||
@Schema(description = "型号")
|
||||
private String modelNo;
|
||||
|
||||
@Schema(description = "制造商")
|
||||
private String manufacturer;
|
||||
|
||||
//============设备字段============
|
||||
@Schema(description = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "别名")
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "管理编号")
|
||||
private String deviceCode;
|
||||
|
||||
@Schema(description = "资产编号")
|
||||
private String assetCode;
|
||||
|
||||
@Schema(description = "出厂编号")
|
||||
private String factoryCode;
|
||||
|
||||
@Schema(description = "所属部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "维修状态: 1-维修;0-正常")
|
||||
private Integer repairFlag;
|
||||
|
||||
@Schema(description = "降级状态")
|
||||
private Integer demoteFlag;
|
||||
|
||||
@Schema(description = "报废状态")
|
||||
private Integer scrapFlag;
|
||||
|
||||
@Schema(description = "停用状态")
|
||||
private Integer disableFlag;
|
||||
|
||||
@Schema(description = "外借状态")
|
||||
private Integer lendFlag;
|
||||
|
||||
@Schema(description = "使用中状态")
|
||||
private Integer inUseFlag;
|
||||
|
||||
@Schema(description = "验收状态")
|
||||
private String acceptFlag;
|
||||
|
||||
|
||||
//============其他字段============
|
||||
@Schema(description = "未提交数据量")
|
||||
private Integer runningCount;
|
||||
|
||||
@Schema(description = "已提交数据量")
|
||||
private Integer finishedCount;
|
||||
|
||||
@Schema(description = "截止时间不为空")
|
||||
private String useTimeEndFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.dataobject;
|
||||
|
||||
import com.zt.plat.module.qms.core.aspect.annotation.Dict;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class DeviceInfoWithBizConfigVO extends DeviceInfomationDO{
|
||||
|
||||
@Schema(description = "规则id")
|
||||
private String ruleId;
|
||||
|
||||
@Schema(description = "业务领域:点检|检定校准|期间核查|等")
|
||||
@Dict(dicCode = "device_business_domain")
|
||||
private String businessDomain;
|
||||
|
||||
@Schema(description = "是否需要")
|
||||
private Integer needFlag;
|
||||
|
||||
@Schema(description = "子业务类型")
|
||||
private String subDomainType;
|
||||
|
||||
@Schema(description = "频次类型")
|
||||
private String frequencyType;
|
||||
|
||||
@Schema(description = "频次")
|
||||
private String frequency;
|
||||
|
||||
@Schema(description = "频次说明")
|
||||
private String frequencyRemark;
|
||||
|
||||
@Schema(description = "报表模板")
|
||||
private String reportTemplateKey;
|
||||
|
||||
@Schema(description = "表单组件")
|
||||
private String formComponent;
|
||||
|
||||
@Schema(description = "处理方法")
|
||||
private String processMethod;
|
||||
|
||||
@Schema(description = "处理人")
|
||||
private String processUser;
|
||||
|
||||
@Schema(description = "标准/规范")
|
||||
private String standard;
|
||||
|
||||
@Schema(description = "检定/校准类型")
|
||||
private String calibrationCheckType;
|
||||
|
||||
}
|
||||
@@ -94,12 +94,12 @@ public class DeviceMaintainItemDO extends BusinessBaseDO {
|
||||
/**
|
||||
* 所属周期开始日期
|
||||
*/
|
||||
@TableField("FREQ_ITM_STRT")
|
||||
@TableField("FREQ_TM_STRT")
|
||||
private LocalDateTime frequencyTimeStart;
|
||||
/**
|
||||
* 所属周期截止日期
|
||||
*/
|
||||
@TableField("FREQ_ITM_END")
|
||||
@TableField("FREQ_TM_STRT")
|
||||
private LocalDateTime frequencyTimeEnd;
|
||||
/**
|
||||
* 检查标准
|
||||
|
||||
@@ -41,6 +41,6 @@ public interface DeviceMaintainMapper extends BaseMapperX<DeviceMaintainDO> {
|
||||
}
|
||||
|
||||
IPage<DeviceMaintainVO> queryPageListWithCount(Page<DeviceMaintainVO> page, @Param("param") DeviceMaintainPageReqVO param);
|
||||
DeviceMaintainVO queryMaintainVoById(@Param("id") Long id);
|
||||
DeviceMaintainVO queryVoById(@Param("id") Long id);
|
||||
|
||||
}
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.zt.plat.module.qms.resource.device.dal.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
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.dal.dataobject.DeviceUseRecordDO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceUseRecordPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 设备-使用记录 Mapper
|
||||
@@ -20,8 +24,8 @@ public interface DeviceUseRecordMapper extends BaseMapperX<DeviceUseRecordDO> {
|
||||
.eqIfPresent(DeviceUseRecordDO::getDeviceId, reqVO.getDeviceId())
|
||||
.likeIfPresent(DeviceUseRecordDO::getUserName, reqVO.getUserName())
|
||||
.eqIfPresent(DeviceUseRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(DeviceUseRecordDO::getUseTimeStart, reqVO.getUseTimeStart())
|
||||
.eqIfPresent(DeviceUseRecordDO::getUseTimeEnd, reqVO.getUseTimeEnd())
|
||||
.betweenIfPresent(DeviceUseRecordDO::getUseTimeStart, reqVO.getUseTimeStart())
|
||||
.betweenIfPresent(DeviceUseRecordDO::getUseTimeEnd, reqVO.getUseTimeEnd())
|
||||
.eqIfPresent(DeviceUseRecordDO::getUseRemark, reqVO.getUseRemark())
|
||||
.eqIfPresent(DeviceUseRecordDO::getStateBefore, reqVO.getStateBefore())
|
||||
.eqIfPresent(DeviceUseRecordDO::getStateRun, reqVO.getStateRun())
|
||||
@@ -35,4 +39,8 @@ public interface DeviceUseRecordMapper extends BaseMapperX<DeviceUseRecordDO> {
|
||||
.orderByDesc(DeviceUseRecordDO::getId));
|
||||
}
|
||||
|
||||
IPage<DeviceUseRecordVO> queryPageListWithCount(Page<DeviceUseRecordVO> page, @Param("param") DeviceUseRecordPageReqVO param);
|
||||
DeviceUseRecordVO queryVoById(@Param("id") Long id);
|
||||
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceProductDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
@@ -55,14 +56,17 @@ public class DeviceConfigBusinessRuleServiceImpl implements DeviceConfigBusiness
|
||||
DeviceInfomationDO deviceDO = deviceInfomationService.getDeviceInfomation(deviceId);
|
||||
DeviceProductDO productDO = deviceProductService.getDeviceProduct(deviceDO.getProductId());
|
||||
String path = productDO.getIdPath();
|
||||
String[] split = path.split("/");
|
||||
List<String> productIdList = new ArrayList<>();
|
||||
for (String s : split) {
|
||||
String id = s.replaceAll("/", "");
|
||||
if(id.equals("0"))
|
||||
continue;
|
||||
productIdList.add(s);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(path)){
|
||||
String[] split = path.split("/");
|
||||
for (String s : split) {
|
||||
String id = s.replaceAll("/", "");
|
||||
if(id.equals("0"))
|
||||
continue;
|
||||
productIdList.add(s);
|
||||
}
|
||||
}else
|
||||
productIdList.add(productDO.getId().toString());
|
||||
List<DeviceConfigBusinessRuleDO> ruleList = getByProductIdListAndBusinessDomain(productIdList, type);
|
||||
if(ruleList.isEmpty())
|
||||
return CommonResult.error(DEVICE_CONFIG_BUSINESS_RULE_NOT_EXISTS);
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.zt.plat.module.qms.resource.device.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
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.DeviceInfomationRespVO;
|
||||
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceInfomationSaveReqVO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfoWithBizConfigVO;
|
||||
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceInfomationDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 设备-设备信息 Service 接口
|
||||
@@ -27,6 +30,29 @@ public interface DeviceInfomationService {
|
||||
|
||||
List<Long> getIdListByProductIdList(List<Long> productIds);
|
||||
|
||||
|
||||
//查询需要“某个业务类型”的设备列表
|
||||
List<DeviceInfoWithBizConfigVO> getListNeedByRule(JSONObject params);
|
||||
|
||||
|
||||
// 更新设备的生命周期状态
|
||||
CommonResult<DeviceInfomationDO> updateLifeStatus(DeviceInfomationDO info, String bizType, Integer flag);
|
||||
|
||||
//更新“使用中”状态
|
||||
void updateDeviceInUseFlag(Long deviceId, Integer inUseFlag);
|
||||
// CommonResult<Boolean> updateDeviceRepairFlag(Long deviceId, Integer repairFlag);
|
||||
// CommonResult<Boolean> updateDeviceDemoteFlag(Long deviceId, Integer demoteFlag);
|
||||
// CommonResult<Boolean> updateDeviceScrapFlag(Long deviceId, Integer scrapFlag);
|
||||
// CommonResult<Boolean> updateDeviceDisableFlag(Long deviceId, Integer disableFlag);
|
||||
// CommonResult<Boolean> updateDeviceAcceptFlag(Long deviceId, String acceptFlag);
|
||||
// CommonResult<Boolean> updateDeviceLendFlag(Long deviceId, Integer lendFlag);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 创建设备-设备信息
|
||||
*
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user