Merge branch 'dev_xq_0.0.1' of http://web.ronyao.com:3000/RYTEC/Real-time-monitoring into dev_xq_0.0.1

dev_xq_0.0.1
刘政 2 weeks ago
commit 8fcae28c5e

@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:13306/sz_admin_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Yanfa2023@
password: 123456
hikari:
#连接池名
pool-name: HikariCP

@ -1,7 +1,7 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/sz_admin_preview?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:13306/sz_admin_preview?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
hikari:

@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:13306/sz_admin_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Yanfa2023@
password: 123456
hikari:
#连接池名
pool-name: HikariCP

@ -3,7 +3,7 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:13306/sz_admin_test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Yanfa2023@
password: 123456
hikari:
#连接池名
pool-name: HikariCP

@ -0,0 +1,49 @@
package com.sz.admin.monitor.controller;
import com.sz.admin.monitor.pojo.dto.dataModel.DataModelDTO;
import com.sz.admin.monitor.pojo.que.dataModel.DataModelQue;
import com.sz.admin.monitor.service.impl.DataModelServiceImpl;
import com.sz.core.common.entity.ApiResult;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @author xq
* @description:
* @date 2026/3/14 12:35
*/
@Slf4j
@RestController
@RequestMapping("/data/model")
public class DataModelController {
@Autowired
private DataModelServiceImpl dataModelService;
@PostMapping("/getModelData")
public ApiResult<DataModelDTO> getModelData(@RequestBody DataModelQue que) {
return dataModelService.getModelData(que);
}
/**
*
*
* @param dataModelDTO
* @return
*/
@PostMapping("/saveOrUpdate/modelData")
public ApiResult saveOrUpdateModelData(
@RequestBody DataModelDTO dataModelDTO,
HttpServletRequest request,
HttpServletResponse response) {
return dataModelService.saveOrUpdateModelData(dataModelDTO, request, response);
}
@GetMapping("/test")
public ApiResult test() {
return ApiResult.success(dataModelService.getList());
}
}

@ -47,11 +47,13 @@ public class FileController {
}
@GetMapping("/getFile")
@SaIgnore
public ApiResult<FileStorageDTO> getFile(@RequestParam("id") String id) {
return fileService.getFile(id);
}
@PostMapping("/saveFile")
@SaIgnore
public ApiResult<FileStorageDTO> saveFile(@RequestParam("file") MultipartFile file) {
return fileService.saveFile(file);
}

@ -29,6 +29,11 @@ public class ModelContentDTO {
*/
private String id;
/**
*
*/
private Integer modelIndex=99;
/**
*
*/

@ -1,11 +1,14 @@
package com.sz.admin.monitor.pojo.dto.dataModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author xq
* @description:
@ -32,4 +35,12 @@ public class UserModelContentDTO {
*
*/
private String modelContentId;
/**
*
*/
private Date addTime;
/**
*
*/
private Date updateTime;
}

@ -2,6 +2,8 @@ package com.sz.admin.monitor.pojo.po;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.sz.admin.monitor.pojo.dto.dataModel.CanvasCfgDTO;
import io.swagger.v3.oas.annotations.media.Schema;
@ -16,7 +18,7 @@ import lombok.NoArgsConstructor;
* @author xq
* @date 2026/1/29 11:32
*/
@Table("ry_model_content")
@Table("ry_canvas_cfg")
@Schema(description = "画布配置数据对象")
@Data
@Builder
@ -26,6 +28,7 @@ public class CanvasCfgDO {
/**
* id
*/
@Id(keyType = KeyType.Generator, value = "uuid")
@Schema(description = "面板id")
private String id;

@ -1,6 +1,8 @@
package com.sz.admin.monitor.pojo.po;
import cn.hutool.core.bean.BeanUtil;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.sz.admin.monitor.pojo.dto.dataModel.GridCfgDTO;
import io.swagger.v3.oas.annotations.media.Schema;
@ -25,31 +27,32 @@ public class GridCfgDO {
/**
* id
*/
@Id(keyType = KeyType.Generator, value = "uuid")
@Schema(description = "主键ID")
private String id;
/**
* id
*/
@Schema(description = "主键ID")
@Schema(description = "用户id")
private String userId;
/**
*
*/
@Schema(description = "主键ID")
@Schema(description = "网格是否启用")
private Boolean enabled;
/**
*
*/
@Schema(description = "主键ID")
@Schema(description = "对齐")
private Boolean align;
/**
*
*/
@Schema(description = "主键ID")
@Schema(description = "大小")
private Integer size;
/**

@ -3,6 +3,8 @@ package com.sz.admin.monitor.pojo.po;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import com.sz.admin.monitor.pojo.dto.dataModel.ModelContentDTO;
import io.swagger.v3.oas.annotations.media.Schema;
@ -28,9 +30,16 @@ public class ModelContentDO {
/**
* id
*/
@Id(keyType = KeyType.Generator, value = "uuid")
@Schema(description = "模型id")
private String id;
/**
*
*/
@Schema(description = "模型索引")
private Integer modelIndex=99;
/**
*
*/
@ -104,6 +113,7 @@ public class ModelContentDO {
private String events;
public static final String ID = "id";
public static final String MODEL_INDEX = "model_index";
public static final String TITLE = "title";
public static final String TYPE = "type";
public static final String BINFO = "binfo";

@ -1,5 +1,7 @@
package com.sz.admin.monitor.pojo.po;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
@ -8,6 +10,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @description:
@ -22,8 +25,9 @@ import java.io.Serializable;
@AllArgsConstructor
public class UserModelContentDO implements Serializable {
/**
* id
* id
*/
@Id(keyType = KeyType.Generator, value = "uuid")
@Schema(description = "主键ID")
private String id;
/**
@ -41,6 +45,16 @@ public class UserModelContentDO implements Serializable {
*/
@Schema(description = "模型内容")
private String modelContentId;
/**
*
*/
@Schema(description = "添加时间")
private Date addTime;
/**
*
*/
@Schema(description = "修改时间")
private Date updateTime;
public static final String ID="id";
public static final String USER_ID="user_id";

@ -31,8 +31,9 @@ public class CanvasCfgServiceImpl extends ServiceImpl<CanvasCfgMapper, CanvasCfg
QueryWrapper queryWrapper = QueryWrapper
.create()
.from(CanvasCfgDO.class)
.where(CanvasCfgDO.USER_ID, canvasCfgDTO.getUserId())
.eq(CanvasCfgDO.USER_ID, canvasCfgDTO.getUserId())
.limit(1);
CanvasCfgDO one = getOne(queryWrapper);
// CanvasCfgDO one = getOne(new QueryWrapper<CanvasCfgDO>()

@ -58,7 +58,7 @@ public class DataModelServiceImpl {
QueryWrapper queryWrapper = QueryWrapper.create()
.from(CanvasCfgDO.class)
.where(CanvasCfgDO.USER_ID, que.getUserId())
.eq(CanvasCfgDO.USER_ID, que.getUserId())
.limit(1);
// 获取画板数据
@ -76,7 +76,7 @@ public class DataModelServiceImpl {
// 获取网格数据
GridCfgDO gridCfgDO = gridCfgService.getOne(QueryWrapper.create()
.from(GridCfgDO.class)
.where(GridCfgDO.USER_ID, que.getUserId())
.eq(GridCfgDO.USER_ID, que.getUserId())
.limit(1)
);
// GridCfgDO gridCfgDO = gridCfgService.getOne(new QueryWrapper<GridCfgDO>()
@ -91,8 +91,8 @@ public class DataModelServiceImpl {
//中间表
List<UserModelContentDO> userModelList = userModelContentService.list(QueryWrapper.create()
.from(UserModelContentDO.class)
.where(UserModelContentDO.USER_ID, userId)
.limit(1)
.eq(UserModelContentDO.USER_ID, userId)
.eq(UserModelContentDO.MENU_TYPE, que.getMenuType())
);
// List<UserModelContentDO> userModelList = userModelContentService.list(new QueryWrapper<UserModelContentDO>()
// .eq(UserModelContentDO.USER_ID, userId)
@ -114,7 +114,13 @@ public class DataModelServiceImpl {
.map(item -> item.getModelContentId())
.collect(Collectors.toList());
List<ModelContentDO> modelContentDOS = modelContentService.listByIds(collect);
List<ModelContentDO> modelContentDOS = modelContentService.list(QueryWrapper.create()
.from(ModelContentDO.class)
.in(ModelContentDO.ID, collect)
.orderBy(ModelContentDO.MODEL_INDEX, true)
);
// List<ModelContentDO> modelContentDOS = modelContentService.listByIds(collect);
for (ModelContentDO modelContentDO : modelContentDOS) {
objects.add(ModelContentDO.doConvertDTO(modelContentDO));
}
@ -175,8 +181,12 @@ public class DataModelServiceImpl {
throw new IllegalArgumentException("传值错误");
CanvasCfgDTO canvasCfg = dataModelDTO.getCanvasCfg();
GridCfgDTO gridCfg = dataModelDTO.getGridCfg();
List<ModelContentDTO> json = dataModelDTO.getJson();
List<ModelContentDTO> json=new ArrayList<>();
for (int i = 0; i < dataModelDTO.getJson().size(); i++) {
ModelContentDTO modelContentDTO = dataModelDTO.getJson().get(i);
modelContentDTO.setModelIndex(i);
json.add(modelContentDTO);
}
//保存、更新面板
canvasCfg.setUserId(userId);
canvasCfgService.saveOrUpdateCanvas(canvasCfg);
@ -191,7 +201,7 @@ public class DataModelServiceImpl {
//获取中间表
List<UserModelContentDO> list = userModelContentService.list(QueryWrapper.create()
.from(UserModelContentDO.class)
.where(UserModelContentDO.USER_ID, userId) //先写死
.eq(UserModelContentDO.USER_ID, userId) //先写死
.eq(UserModelContentDO.MENU_TYPE, dataModelDTO.getMenuType())
);
// List<UserModelContentDO> list = userModelContentService.list(new QueryWrapper<UserModelContentDO>()
@ -207,13 +217,8 @@ public class DataModelServiceImpl {
userModelContentService.remove(QueryWrapper.create()
.from(UserModelContentDO.class)
.where(UserModelContentDO.USER_ID, userId)
.eq(UserModelContentDO.USER_ID, userId)
.eq(UserModelContentDO.MENU_TYPE, dataModelDTO.getMenuType()));
// userModelContentService.remove(new QueryWrapper<UserModelContentDO>()
// .eq(UserModelContentDO.USER_ID, userId) //先写死
// .eq(UserModelContentDO.MENU_TYPE, dataModelDTO.getMenuType()));
return ApiResult.success();
}

@ -30,7 +30,7 @@ public class GridCfgServiceImpl extends ServiceImpl<GridCfgMapper, GridCfgDO> im
QueryWrapper queryWrapper = QueryWrapper.create()
.from(GridCfgDO.class)
.where(GridCfgDO.USER_ID, gridCfgDO.getUserId())
.eq(GridCfgDO.USER_ID, gridCfgDO.getUserId())
.limit(1);
GridCfgDO one = getOne(queryWrapper);

@ -53,21 +53,13 @@ public class ModelContentServiceImpl extends ServiceImpl<ModelContentMapper, Mod
QueryWrapper queryWrapper = QueryWrapper.create()
.select()
.from(UserModelContentDO.class)
.where(UserModelContentDO.MODEL_CONTENT_ID, modelContentDO.getId())
.eq(UserModelContentDO.MODEL_CONTENT_ID, modelContentDO.getId())
.eq(UserModelContentDO.MENU_TYPE, menuType)
//true:ASC false:DESC
.orderBy(UserModelContentDO.ID, false)
.limit(1);
List<UserModelContentDO> doList = userModelContentService.list(queryWrapper);
// List<UserModelContentDO> doList = userModelContentService.list(new QueryWrapper<UserModelContentDO>()
// .eq(UserModelContentDO.MODEL_CONTENT_ID, modelContentDO.getId())
// .eq(UserModelContentDO.MENU_TYPE, menuType)
// .orderByDesc(UserModelContentDO.ID)
// .last("limit 1")
// );
if (CollectionUtil.isEmpty(doList))
modelContentDO.setId(null);
else

@ -7,6 +7,7 @@ create table ry_user_model_content
) comment '用户模型关系';
-- auto-generated definition
create table ry_model_content
(
id varchar(32) not null comment '模型id'
@ -15,14 +16,18 @@ create table ry_model_content
type varchar(32) null comment '模型类型',
binfo varchar(128) null comment '位置json',
resize tinyint(1) null comment '调整大小(bool)',
rotate tinyint(1) null comment '锁定(bool)',
rotate tinyint(1) null comment '旋转',
`lock` tinyint(1) null comment '锁定',
active tinyint(1) null comment '动作(bool)',
hide tinyint(1) null comment '隐藏(bool)',
props varchar(128) null comment '属性(json)',
tag varchar(128) null comment 'vue组件名称',
common_animations varchar(128) null comment '动画(json)',
events varchar(128) null comment '事件'
) comment '模型内容';
events varchar(128) null comment '事件',
`index` int null comment '索引'
)
comment '模型内容';
create table ry_canvas_cfg
(

Loading…
Cancel
Save