# Conflicts:
#	yudao-module-fms/yudao-module-fms-server/src/test/java/cn/iocoder/yudao/module/fms/service/config/FmsAccountUserServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/insurance/monthrecord/HrmInsuranceMonthEmployeeRecordServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/performance/assessment/HrmPerformanceAssessmentProcessServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/recruit/candidate/HrmRecruitInterviewServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/recruit/post/HrmRecruitPostServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/salary/config/HrmSalaryGroupServiceImplTest.java
#	yudao-module-hrm/yudao-module-hrm-server/src/test/java/cn/iocoder/yudao/module/hrm/service/salary/slip/HrmSalarySlipServiceImplTest.java
This commit is contained in:
YunaiV
2026-08-30 19:42:48 +08:00
79 changed files with 1264 additions and 421 deletions
@@ -66,6 +66,8 @@ public interface ErrorCodeConstants {
ErrorCode OTA_FIRMWARE_NOT_EXISTS = new ErrorCode(1_050_008_000, "固件信息不存在");
ErrorCode OTA_FIRMWARE_PRODUCT_VERSION_DUPLICATE = new ErrorCode(1_050_008_001, "产品版本号重复");
ErrorCode OTA_FIRMWARE_DELETE_FAIL_TASK_IN_PROGRESS = new ErrorCode(1_050_008_002,
"删除 OTA 固件失败,原因:存在进行中的升级任务");
// ========== OTA 升级任务相关 1-050-008-100 ==========
@@ -105,4 +107,4 @@ public interface ErrorCodeConstants {
// ========== IoT 告警记录 1-050-014-000 ==========
ErrorCode ALERT_RECORD_NOT_EXISTS = new ErrorCode(1_050_014_000, "IoT 告警记录不存在");
}
}
@@ -83,10 +83,10 @@ public class IotDeviceMessageController {
@PostMapping("/send")
@Operation(summary = "发送消息", description = "可用于设备模拟")
@PreAuthorize("@ss.hasPermission('iot:device:message-end')")
@PreAuthorize("@ss.hasPermission('iot:device:message-send')")
public CommonResult<Boolean> sendDeviceMessage(@Valid @RequestBody IotDeviceMessageSendReqVO sendReqVO) {
deviceMessageService.sendDeviceMessage(BeanUtils.toBean(sendReqVO, IotDeviceMessage.class));
return success(true);
}
}
}
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
import cn.iocoder.yudao.module.iot.service.ota.IotOtaFirmwareService;
import cn.iocoder.yudao.module.iot.service.product.IotProductService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -48,6 +49,15 @@ public class IotOtaFirmwareController {
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除 OTA 固件")
@Parameter(name = "id", description = "固件编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('iot:ota-firmware:delete')")
public CommonResult<Boolean> deleteOtaFirmware(@RequestParam("id") Long id) {
otaFirmwareService.deleteOtaFirmware(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得 OTA 固件")
@PreAuthorize("@ss.hasPermission('iot:ota-firmware:query')")
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.IotOtaTaskPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
@@ -16,6 +17,12 @@ public interface IotOtaTaskMapper extends BaseMapperX<IotOtaTaskDO> {
IotOtaTaskDO::getName, name);
}
default Long selectCountByFirmwareIdAndStatus(Long firmwareId, Integer status) {
return selectCount(new LambdaQueryWrapper<IotOtaTaskDO>()
.eq(IotOtaTaskDO::getFirmwareId, firmwareId)
.eq(IotOtaTaskDO::getStatus, status));
}
default PageResult<IotOtaTaskDO> selectPage(IotOtaTaskPageReqVO pageReqVO) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaTaskDO>()
.eqIfPresent(IotOtaTaskDO::getFirmwareId, pageReqVO.getFirmwareId())
@@ -35,6 +35,13 @@ public interface IotOtaFirmwareService {
*/
void updateOtaFirmware(@Valid IotOtaFirmwareUpdateReqVO updateReqVO);
/**
* 删除 OTA 固件信息
*
* @param id 固件编号
*/
void deleteOtaFirmware(Long id);
/**
* 获取 OTA 固件信息
*
@@ -10,6 +10,8 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwa
import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareUpdateReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO;
import cn.iocoder.yudao.module.iot.dal.mysql.ota.IotOtaFirmwareMapper;
import cn.iocoder.yudao.module.iot.dal.mysql.ota.IotOtaTaskMapper;
import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskStatusEnum;
import cn.iocoder.yudao.module.iot.service.product.IotProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Lazy;
@@ -23,6 +25,7 @@ import java.util.Collections;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.OTA_FIRMWARE_DELETE_FAIL_TASK_IN_PROGRESS;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.OTA_FIRMWARE_NOT_EXISTS;
import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.OTA_FIRMWARE_PRODUCT_VERSION_DUPLICATE;
@@ -38,6 +41,8 @@ public class IotOtaFirmwareServiceImpl implements IotOtaFirmwareService {
@Resource
private IotOtaFirmwareMapper otaFirmwareMapper;
@Resource
private IotOtaTaskMapper otaTaskMapper;
@Lazy
@Resource
private IotProductService productService;
@@ -74,6 +79,19 @@ public class IotOtaFirmwareServiceImpl implements IotOtaFirmwareService {
otaFirmwareMapper.updateById(updateObj);
}
@Override
public void deleteOtaFirmware(Long id) {
// 1.1 校验存在
validateFirmwareExists(id);
// 1.2 校验是否有进行中的升级任务
if (otaTaskMapper.selectCountByFirmwareIdAndStatus(id, IotOtaTaskStatusEnum.IN_PROGRESS.getStatus()) > 0) {
throw exception(OTA_FIRMWARE_DELETE_FAIL_TASK_IN_PROGRESS);
}
// 2. 删除
otaFirmwareMapper.deleteById(id);
}
@Override
public IotOtaFirmwareDO getOtaFirmware(Long id) {
return otaFirmwareMapper.selectById(id);