fix:设备图片
This commit is contained in:
@@ -13,6 +13,7 @@ import com.zt.plat.framework.common.pojo.vo.BatchDeleteReqVO;
|
|||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
import com.zt.plat.framework.datapermission.core.annotation.DeptDataPermissionIgnore;
|
||||||
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
import com.zt.plat.framework.excel.core.util.ExcelUtils;
|
||||||
|
import com.zt.plat.module.qms.common.service.BusinessFileService;
|
||||||
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;
|
||||||
@@ -56,7 +57,7 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
|
|||||||
|
|
||||||
@Resource private DeviceInfomationService deviceInfomationService;
|
@Resource private DeviceInfomationService deviceInfomationService;
|
||||||
@Resource private DeviceProductService deviceProductService;
|
@Resource private DeviceProductService deviceProductService;
|
||||||
|
@Resource private BusinessFileService businessFileService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,9 +97,9 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
|
|||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新设备-设备信息")
|
@Operation(summary = "更新设备-设备信息")
|
||||||
@PreAuthorize("@ss.hasPermission('resource:device-infomation:update')")
|
@PreAuthorize("@ss.hasPermission('resource:device-infomation:update')")
|
||||||
public CommonResult<Boolean> updateDeviceInfomation(@Valid @RequestBody DeviceInfomationSaveReqVO updateReqVO) {
|
public CommonResult<DeviceInfomationRespVO> updateDeviceInfomation(@Valid @RequestBody DeviceInfomationSaveReqVO updateReqVO) {
|
||||||
deviceInfomationService.updateDeviceInfomation(updateReqVO);
|
DeviceInfomationDO entity = deviceInfomationService.updateDeviceInfomation(updateReqVO);
|
||||||
return success(true);
|
return success(BeanUtils.toBean(entity, DeviceInfomationRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@@ -123,16 +124,17 @@ public class DeviceInfomationController extends AbstractFileUploadController imp
|
|||||||
@Operation(summary = "获得设备-设备信息")
|
@Operation(summary = "获得设备-设备信息")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
public CommonResult<DeviceInfomationWithProductVO> getDeviceInfomation(@RequestParam("id") Long id) {
|
public CommonResult<DeviceInfomationWithProductVO> getDeviceInfomation(@RequestParam("id") Long id) {
|
||||||
DeviceInfomationWithProductVO deviceInfomation = deviceInfomationService.getDeviceWithProduct(id);
|
DeviceInfomationWithProductVO vo = deviceInfomationService.getDeviceWithProduct(id);
|
||||||
String customConfig = deviceInfomation.getCustomConfig();
|
String customConfig = vo.getCustomConfig();
|
||||||
if(!ObjectUtils.isEmpty(customConfig)){
|
if(!ObjectUtils.isEmpty(customConfig)){
|
||||||
try{
|
try{
|
||||||
deviceInfomation.setCustomConfigJson(JSON.parseObject(customConfig));
|
vo.setCustomConfigJson(JSON.parseObject(customConfig));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success(deviceInfomation);
|
vo.setBusinessFileRet(businessFileService.getBusinessFileList(id));
|
||||||
|
return success(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ package com.zt.plat.module.qms.resource.device.controller.vo;
|
|||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
|
import com.zt.plat.module.infra.api.businessfile.dto.BusinessFileWithUrlRespDTO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 设备-设备信息 Response VO")
|
@Schema(description = "管理后台 - 设备-设备信息 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -145,4 +148,8 @@ public class DeviceInfomationRespVO {
|
|||||||
@Schema(description = "数据采集设备类型")
|
@Schema(description = "数据采集设备类型")
|
||||||
@ExcelProperty("数据采集设备类型")
|
@ExcelProperty("数据采集设备类型")
|
||||||
private String collectDeviceType;
|
private String collectDeviceType;
|
||||||
|
|
||||||
|
// ===================扩展字段=========================
|
||||||
|
@Schema(description = "附件对象")
|
||||||
|
private CommonResult<List<BusinessFileWithUrlRespDTO>> businessFileRet;
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 设备-设备信息新增/修改 Request VO")
|
@Schema(description = "管理后台 - 设备-设备信息新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -110,4 +111,8 @@ public class DeviceInfomationSaveReqVO {
|
|||||||
@Schema(description = "数据采集设备类型")
|
@Schema(description = "数据采集设备类型")
|
||||||
private String collectDeviceType;
|
private String collectDeviceType;
|
||||||
|
|
||||||
|
//=================扩展字段==================>
|
||||||
|
@Schema(description = "删除的文件id")
|
||||||
|
private List<Long> deleteFileIdList;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -67,8 +67,8 @@ public interface DeviceInfomationService {
|
|||||||
*
|
*
|
||||||
* @param updateReqVO 更新信息
|
* @param updateReqVO 更新信息
|
||||||
*/
|
*/
|
||||||
void updateDeviceInfomation(@Valid DeviceInfomationSaveReqVO updateReqVO);
|
DeviceInfomationDO updateDeviceInfomation(@Valid DeviceInfomationSaveReqVO updateReqVO);
|
||||||
void updateDeviceInfomation(DeviceInfomationDO entity);
|
DeviceInfomationDO updateDeviceInfomation(DeviceInfomationDO entity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除设备-设备信息
|
* 删除设备-设备信息
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.module.qms.common.service.BusinessFileService;
|
||||||
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
import com.zt.plat.module.qms.core.constant.DataTypeConstant;
|
||||||
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;
|
||||||
@@ -48,6 +49,7 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService {
|
|||||||
private DeviceInfomationMapper deviceInfomationMapper;
|
private DeviceInfomationMapper deviceInfomationMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private DeviceProductService deviceProductService;
|
private DeviceProductService deviceProductService;
|
||||||
|
@Resource private BusinessFileService businessFileService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -276,17 +278,21 @@ public class DeviceInfomationServiceImpl implements DeviceInfomationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDeviceInfomation(DeviceInfomationSaveReqVO updateReqVO) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public DeviceInfomationDO updateDeviceInfomation(DeviceInfomationSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateDeviceInfomationExists(updateReqVO.getId());
|
validateDeviceInfomationExists(updateReqVO.getId());
|
||||||
// 更新
|
// 更新
|
||||||
DeviceInfomationDO updateObj = BeanUtils.toBean(updateReqVO, DeviceInfomationDO.class);
|
DeviceInfomationDO updateObj = BeanUtils.toBean(updateReqVO, DeviceInfomationDO.class);
|
||||||
deviceInfomationMapper.updateById(updateObj);
|
deviceInfomationMapper.updateById(updateObj);
|
||||||
|
businessFileService.deleteBusinessFileList(updateReqVO.getDeleteFileIdList());
|
||||||
|
return updateObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDeviceInfomation(DeviceInfomationDO entity) {
|
public DeviceInfomationDO updateDeviceInfomation(DeviceInfomationDO entity) {
|
||||||
deviceInfomationMapper.updateById(entity);
|
deviceInfomationMapper.updateById(entity);
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user