设备相关bug修复

This commit is contained in:
liux 2025-07-03 13:53:56 +08:00
parent 2e8aae096e
commit a415d405fc
3 changed files with 30 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import com.bonus.canteen.core.kitchen.dto.KitLongIdsDTO;
import com.bonus.canteen.core.kitchen.dto.KitchenDeviceListDTO;
import com.bonus.canteen.core.kitchen.vo.KitchenDeviceListVO;
import com.bonus.common.log.enums.OperaType;
@ -138,7 +139,7 @@ public class KitchenDeviceInfoController extends BaseController {
//@RequiresPermissions("kitchen:info:remove")
@SysLog(title = "厨房设备基础信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除厨房设备基础信息")
@PostMapping("/del")
public AjaxResult remove(@RequestBody List<Long> deviceIds) {
return toAjax(kitchenDeviceInfoService.deleteKitchenDeviceInfoByDeviceIds(deviceIds));
public AjaxResult remove(@RequestBody KitLongIdsDTO kitLongIdsDTO) {
return toAjax(kitchenDeviceInfoService.deleteKitchenDeviceInfoByDeviceIds(kitLongIdsDTO.getDeviceIds()));
}
}

View File

@ -0,0 +1,17 @@
package com.bonus.canteen.core.kitchen.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author xliu
* @date 2025/7/3 13:39
*/
@Data
public class KitLongIdsDTO {
@NotNull(message = "设备ID列表不能为空")
private List<Long> deviceIds;
}

View File

@ -85,13 +85,16 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpl<KitchenDeviceInfoM
@Override
public int insertKitchenDeviceInfo(KitchenDeviceInfo kitchenDeviceInfo) {
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceNo())){
throw new ServiceException("设备编号不能为空");
throw new ServiceException("设备编号不能为空");
}
if(kitchenDeviceInfo.getDeviceType() == null){
throw new ServiceException("设备类型不能为空");
throw new ServiceException("设备类型不能为空");
}
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceSn())){
throw new ServiceException("编设备sn号不能为空");
throw new ServiceException("设备sn号不能为空");
}
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceName())){
throw new ServiceException("设备名称号不能为空");
}
kitchenDeviceInfo.setDeviceNo(kitchenDeviceInfo.getDeviceNo() == null ? "2" : kitchenDeviceInfo.getDeviceNo().trim());
kitchenDeviceInfo.setCreateTime(DateUtils.getNowDate());
@ -129,7 +132,7 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpl<KitchenDeviceInfoM
throw new ServiceException("设备IP已存在请检查后重新输入");
}
if (kitchenDeviceInfo.getChannel() == null || kitchenDeviceInfo.getChannel() < 1) {
throw new ServiceException("摄像头设备的IP地址不能为空或小于1");
throw new ServiceException("摄像头设备的通道号不能为空或小于1");
}
bean = kitchenDeviceInfoMapper.selectOne(
Wrappers.<KitchenDeviceInfo>lambdaQuery()
@ -165,6 +168,9 @@ public class KitchenDeviceInfoServiceImpl extends ServiceImpl<KitchenDeviceInfoM
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceSn())){
throw new ServiceException("编设备sn号不能为空");
}
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getDeviceName())){
throw new ServiceException("设备名称号不能为空");
}
if(kitchenDeviceInfo.getDeviceType() == DeviceTypeEnum.CAMERA.getKey()) {
if(StringHelper.isNullOrEmptyString(kitchenDeviceInfo.getIp())){
throw new ServiceException("编设备ip号不能为空");