Commit 7b75c310 by 李小龙

fixBug

parent 437a22cd
...@@ -6,7 +6,7 @@ import com.makeit.common.page.PageVO; ...@@ -6,7 +6,7 @@ import com.makeit.common.page.PageVO;
import com.makeit.common.response.ApiResponseEntity; import com.makeit.common.response.ApiResponseEntity;
import com.makeit.common.response.ApiResponseUtils; import com.makeit.common.response.ApiResponseUtils;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.saas.device.PlatDeviceEditSaasDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
import com.makeit.global.aspect.tenant.TenantIdIgnore; import com.makeit.global.aspect.tenant.TenantIdIgnore;
import com.makeit.service.platform.device.PlatDeviceService; import com.makeit.service.platform.device.PlatDeviceService;
...@@ -42,8 +42,8 @@ public class SaasDeviceController { ...@@ -42,8 +42,8 @@ public class SaasDeviceController {
@ApiOperation("设备编辑") @ApiOperation("设备编辑")
@PostMapping("edit") @PostMapping("edit")
@TenantIdIgnore @TenantIdIgnore
public ApiResponseEntity<Void> edit(@RequestBody PlatDeviceEditDTO dto) { public ApiResponseEntity<Void> edit(@RequestBody PlatDeviceEditSaasDTO dto) {
platDeviceService.edit(dto); platDeviceService.saasEdit(dto);
return ApiResponseUtils.success(); return ApiResponseUtils.success();
} }
......
...@@ -61,7 +61,7 @@ public class PlatDeviceController { ...@@ -61,7 +61,7 @@ public class PlatDeviceController {
@Autowired @Autowired
private IotSyncTask iotSyncTask; private IotSyncTask iotSyncTask;
@ApiOperation("详情") @ApiOperation("手动同步")
@PostMapping("iotSyncTask") @PostMapping("iotSyncTask")
@AuthIgnore @AuthIgnore
@TenantIdIgnore @TenantIdIgnore
......
package com.makeit.dto.saas.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.dto.BaseTenantDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
/**
* <p>
* 设备
* </p>
*
* @author eugene young
* @since 2023-09-05
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PlatDevice对象", description = "设备")
public class PlatDeviceEditSaasDTO extends BaseTenantDTO {
@NotBlank(message = "设备名称不能为空")
@Size(max = 50, message = "设备名称最长为50个字符")
@ApiModelProperty(value = "设备名称")
private String name;
@ApiModelProperty(value = "设备安装方式")
private String installation;
@ApiModelProperty(value = "开关指示灯")
private String indicatorLight;
@ApiModelProperty(value = "设备属性json")
private String attribute;
@ApiModelProperty(value = "说明")
private String description;
@ApiModelProperty(value = "有效期-开始")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startDate;
@ApiModelProperty(value = "有效期-结束")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDate;
}
package com.makeit.entity.platform.device; package com.makeit.entity.platform.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.makeit.common.entity.BaseBusEntity; import com.makeit.common.entity.BaseBusEntity;
import com.makeit.module.iot.enums.DeviceState; import com.makeit.module.iot.enums.DeviceState;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
...@@ -72,7 +73,10 @@ public class PlatDevice extends BaseBusEntity { ...@@ -72,7 +73,10 @@ public class PlatDevice extends BaseBusEntity {
@ApiModelProperty(value = "设备类型 0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达") @ApiModelProperty(value = "设备类型 0-呼吸心率雷达 1-空间人体雷达 2-跌倒检测雷达")
private String category; private String category;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime startDate; private LocalDateTime startDate;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endDate; private LocalDateTime endDate;
......
...@@ -6,6 +6,7 @@ import com.makeit.common.page.PageVO; ...@@ -6,6 +6,7 @@ import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.saas.device.PlatDeviceEditSaasDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO; import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.device.PlatDevice; import com.makeit.entity.platform.device.PlatDevice;
...@@ -49,4 +50,6 @@ public interface PlatDeviceService extends IService<PlatDevice> { ...@@ -49,4 +50,6 @@ public interface PlatDeviceService extends IService<PlatDevice> {
* @return * @return
*/ */
PlatDeviceDetailDTO getDetailDTO(String deviceId); PlatDeviceDetailDTO getDetailDTO(String deviceId);
void saasEdit(PlatDeviceEditSaasDTO dto);
} }
...@@ -11,6 +11,7 @@ import com.makeit.common.page.PageVO; ...@@ -11,6 +11,7 @@ import com.makeit.common.page.PageVO;
import com.makeit.dto.platform.device.PlatDeviceDetailDTO; import com.makeit.dto.platform.device.PlatDeviceDetailDTO;
import com.makeit.dto.platform.device.PlatDeviceEditDTO; import com.makeit.dto.platform.device.PlatDeviceEditDTO;
import com.makeit.dto.platform.device.PlatDeviceQueryDTO; import com.makeit.dto.platform.device.PlatDeviceQueryDTO;
import com.makeit.dto.saas.device.PlatDeviceEditSaasDTO;
import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO; import com.makeit.dto.wechat.device.PlatDeviceEditWechatDTO;
import com.makeit.dto.wechat.device.PlatDeviceSetupDTO; import com.makeit.dto.wechat.device.PlatDeviceSetupDTO;
import com.makeit.entity.platform.auth.PlatOrg; import com.makeit.entity.platform.auth.PlatOrg;
...@@ -190,6 +191,31 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev ...@@ -190,6 +191,31 @@ public class PlatDeviceServiceImpl extends ServiceImpl<PlatDeviceMapper, PlatDev
return PageUtil.toPageVO(devicePage); return PageUtil.toPageVO(devicePage);
} }
@Override
public void saasEdit(PlatDeviceEditSaasDTO dto) {
PlatDevice db = getById(dto.getId());
String id = db.getId();
PlatDeviceOther other = platDeviceOtherService.getOne(new QueryWrapper<PlatDeviceOther>().lambda()
.eq(PlatDeviceOther::getDeviceId, db.getId()));
if (other == null) {
other = new PlatDeviceOther();
}
BeanUtils.copyProperties(dto, db);
db.setId(id);
BeanUtils.copyProperties(dto, other);
other.setDeviceId(id);
updateById(db);
deviceCacheUtil.put(db);
platDeviceOtherService.saveOrUpdate(other);
}
/** /**
* 设备信息 * 设备信息
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment