From 902a39bd0bfb5e129f174fb58f8b221f6032e463 Mon Sep 17 00:00:00 2001 From: weizhihong Date: Tue, 6 Dec 2022 11:13:10 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=94=9F=E6=88=90=E8=83=8C=E6=99=AF=E3=80=81=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/20221012-xia-paper.sql | 1 - sql/20221205-xia-rts_iscs_model_data.sql | 4 +- .../joylink/rtss/entity/paper/PaperUser.java | 8 +- .../rtss/entity/paper/PaperUserExample.java | 122 +++++------------- .../controller/IscsModelDataController.java | 32 ++++- .../rtss/iscs/entity/IscsModelData.java | 11 ++ .../iscs/entity/IscsModelDataExample.java | 121 +++++++++++++++++ .../iscs/services/IscsModelDataService.java | 119 +++++++++++++++-- ...FindIscsModelDataBasicInfoByPageReqVo.java | 91 +++++++++++++ .../rtss/iscs/vo/IscsModelDataBasicInfo.java | 14 ++ .../paper/PaperUserCreateService.java | 2 +- .../joylink/rtss/vo/client/PageQueryVO.java | 6 + .../paper/convertor/PaperUserConvertor.java | 2 +- .../vo/training2/rule/BgSceneStatusRule.java | 45 ++++++- .../rtss/vo/training2/rule/MapDeviceRule.java | 27 +++- .../vo/training2/rule/PropertyValueRule.java | 25 +++- .../mybatis/mapper/iscs/IscsModelDataDAO.xml | 46 ++++++- .../mybatis/mapper/paper/PaperUserDAO.xml | 43 ++---- 18 files changed, 559 insertions(+), 160 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/iscs/vo/FindIscsModelDataBasicInfoByPageReqVo.java diff --git a/sql/20221012-xia-paper.sql b/sql/20221012-xia-paper.sql index 7f2cb09d9..a4f7f1d56 100644 --- a/sql/20221012-xia-paper.sql +++ b/sql/20221012-xia-paper.sql @@ -62,7 +62,6 @@ CREATE TABLE `rts_paper_user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '用户试卷id', `user_id` bigint NOT NULL COMMENT '用户id', `pc_id` bigint NOT NULL COMMENT '生成用户试卷的paper_compostion的id', - `org_id` bigint NULL DEFAULT NULL COMMENT '组织id', `score` int NULL DEFAULT NULL COMMENT '用户最终得分', `start_time` datetime NULL DEFAULT NULL COMMENT '用户开始做题时间', `end_time` datetime NULL DEFAULT NULL COMMENT '用户结束做题时间', diff --git a/sql/20221205-xia-rts_iscs_model_data.sql b/sql/20221205-xia-rts_iscs_model_data.sql index 6ad301d6a..78c7c2d83 100644 --- a/sql/20221205-xia-rts_iscs_model_data.sql +++ b/sql/20221205-xia-rts_iscs_model_data.sql @@ -11,7 +11,7 @@ Target Server Version : 80029 File Encoding : 65001 - Date: 05/12/2022 09:17:49 + Date: 06/12/2022 09:53:18 */ SET NAMES utf8mb4; @@ -27,6 +27,8 @@ CREATE TABLE `rts_iscs_model_data` ( `view` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT 'iscs二级视图', `place` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '场所(车站、变电所、停车场等)', `data` blob NULL COMMENT '场所整个所有的模型的数据', + `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', + `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic; diff --git a/src/main/java/club/joylink/rtss/entity/paper/PaperUser.java b/src/main/java/club/joylink/rtss/entity/paper/PaperUser.java index ae08a3cdf..8655acaa5 100644 --- a/src/main/java/club/joylink/rtss/entity/paper/PaperUser.java +++ b/src/main/java/club/joylink/rtss/entity/paper/PaperUser.java @@ -2,6 +2,7 @@ package club.joylink.rtss.entity.paper; import java.io.Serializable; import java.time.LocalDateTime; +import java.util.Date; import lombok.Data; /** @@ -25,11 +26,6 @@ public class PaperUser implements Serializable { */ private Long pcId; - /** - * 组织id - */ - private Long orgId; - /** * 用户最终得分 */ @@ -56,4 +52,4 @@ public class PaperUser implements Serializable { private LocalDateTime createTime; private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/src/main/java/club/joylink/rtss/entity/paper/PaperUserExample.java b/src/main/java/club/joylink/rtss/entity/paper/PaperUserExample.java index f01601d12..3a85408e5 100644 --- a/src/main/java/club/joylink/rtss/entity/paper/PaperUserExample.java +++ b/src/main/java/club/joylink/rtss/entity/paper/PaperUserExample.java @@ -1,7 +1,7 @@ package club.joylink.rtss.entity.paper; -import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Date; import java.util.List; public class PaperUserExample { @@ -305,66 +305,6 @@ public class PaperUserExample { return (Criteria) this; } - public Criteria andOrgIdIsNull() { - addCriterion("org_id is null"); - return (Criteria) this; - } - - public Criteria andOrgIdIsNotNull() { - addCriterion("org_id is not null"); - return (Criteria) this; - } - - public Criteria andOrgIdEqualTo(Long value) { - addCriterion("org_id =", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotEqualTo(Long value) { - addCriterion("org_id <>", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdGreaterThan(Long value) { - addCriterion("org_id >", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdGreaterThanOrEqualTo(Long value) { - addCriterion("org_id >=", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdLessThan(Long value) { - addCriterion("org_id <", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdLessThanOrEqualTo(Long value) { - addCriterion("org_id <=", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdIn(List values) { - addCriterion("org_id in", values, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotIn(List values) { - addCriterion("org_id not in", values, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdBetween(Long value1, Long value2) { - addCriterion("org_id between", value1, value2, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotBetween(Long value1, Long value2) { - addCriterion("org_id not between", value1, value2, "orgId"); - return (Criteria) this; - } - public Criteria andScoreIsNull() { addCriterion("score is null"); return (Criteria) this; @@ -435,52 +375,52 @@ public class PaperUserExample { return (Criteria) this; } - public Criteria andStartTimeEqualTo(LocalDateTime value) { + public Criteria andStartTimeEqualTo(Date value) { addCriterion("start_time =", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeNotEqualTo(LocalDateTime value) { + public Criteria andStartTimeNotEqualTo(Date value) { addCriterion("start_time <>", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeGreaterThan(LocalDateTime value) { + public Criteria andStartTimeGreaterThan(Date value) { addCriterion("start_time >", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeGreaterThanOrEqualTo(LocalDateTime value) { + public Criteria andStartTimeGreaterThanOrEqualTo(Date value) { addCriterion("start_time >=", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeLessThan(LocalDateTime value) { + public Criteria andStartTimeLessThan(Date value) { addCriterion("start_time <", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeLessThanOrEqualTo(LocalDateTime value) { + public Criteria andStartTimeLessThanOrEqualTo(Date value) { addCriterion("start_time <=", value, "startTime"); return (Criteria) this; } - public Criteria andStartTimeIn(List values) { + public Criteria andStartTimeIn(List values) { addCriterion("start_time in", values, "startTime"); return (Criteria) this; } - public Criteria andStartTimeNotIn(List values) { + public Criteria andStartTimeNotIn(List values) { addCriterion("start_time not in", values, "startTime"); return (Criteria) this; } - public Criteria andStartTimeBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andStartTimeBetween(Date value1, Date value2) { addCriterion("start_time between", value1, value2, "startTime"); return (Criteria) this; } - public Criteria andStartTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andStartTimeNotBetween(Date value1, Date value2) { addCriterion("start_time not between", value1, value2, "startTime"); return (Criteria) this; } @@ -495,52 +435,52 @@ public class PaperUserExample { return (Criteria) this; } - public Criteria andEndTimeEqualTo(LocalDateTime value) { + public Criteria andEndTimeEqualTo(Date value) { addCriterion("end_time =", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeNotEqualTo(LocalDateTime value) { + public Criteria andEndTimeNotEqualTo(Date value) { addCriterion("end_time <>", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeGreaterThan(LocalDateTime value) { + public Criteria andEndTimeGreaterThan(Date value) { addCriterion("end_time >", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeGreaterThanOrEqualTo(LocalDateTime value) { + public Criteria andEndTimeGreaterThanOrEqualTo(Date value) { addCriterion("end_time >=", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeLessThan(LocalDateTime value) { + public Criteria andEndTimeLessThan(Date value) { addCriterion("end_time <", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeLessThanOrEqualTo(LocalDateTime value) { + public Criteria andEndTimeLessThanOrEqualTo(Date value) { addCriterion("end_time <=", value, "endTime"); return (Criteria) this; } - public Criteria andEndTimeIn(List values) { + public Criteria andEndTimeIn(List values) { addCriterion("end_time in", values, "endTime"); return (Criteria) this; } - public Criteria andEndTimeNotIn(List values) { + public Criteria andEndTimeNotIn(List values) { addCriterion("end_time not in", values, "endTime"); return (Criteria) this; } - public Criteria andEndTimeBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andEndTimeBetween(Date value1, Date value2) { addCriterion("end_time between", value1, value2, "endTime"); return (Criteria) this; } - public Criteria andEndTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andEndTimeNotBetween(Date value1, Date value2) { addCriterion("end_time not between", value1, value2, "endTime"); return (Criteria) this; } @@ -625,52 +565,52 @@ public class PaperUserExample { return (Criteria) this; } - public Criteria andCreateTimeEqualTo(LocalDateTime value) { + public Criteria andCreateTimeEqualTo(Date value) { addCriterion("create_time =", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeNotEqualTo(LocalDateTime value) { + public Criteria andCreateTimeNotEqualTo(Date value) { addCriterion("create_time <>", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeGreaterThan(LocalDateTime value) { + public Criteria andCreateTimeGreaterThan(Date value) { addCriterion("create_time >", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) { + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { addCriterion("create_time >=", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeLessThan(LocalDateTime value) { + public Criteria andCreateTimeLessThan(Date value) { addCriterion("create_time <", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) { + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { addCriterion("create_time <=", value, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeIn(List values) { + public Criteria andCreateTimeIn(List values) { addCriterion("create_time in", values, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeNotIn(List values) { + public Criteria andCreateTimeNotIn(List values) { addCriterion("create_time not in", values, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andCreateTimeBetween(Date value1, Date value2) { addCriterion("create_time between", value1, value2, "createTime"); return (Criteria) this; } - public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } diff --git a/src/main/java/club/joylink/rtss/iscs/controller/IscsModelDataController.java b/src/main/java/club/joylink/rtss/iscs/controller/IscsModelDataController.java index 9db52427d..b208a39c1 100644 --- a/src/main/java/club/joylink/rtss/iscs/controller/IscsModelDataController.java +++ b/src/main/java/club/joylink/rtss/iscs/controller/IscsModelDataController.java @@ -3,11 +3,15 @@ package club.joylink.rtss.iscs.controller; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.iscs.entity.IscsModelData; import club.joylink.rtss.iscs.services.IscsModelDataService; +import club.joylink.rtss.iscs.vo.FindIscsModelDataBasicInfoByPageReqVo; import club.joylink.rtss.iscs.vo.IscsModelDataBasicInfo; +import club.joylink.rtss.vo.client.PageVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.validation.constraints.NotNull; + /** * iscs 模型数据处理接口 *

@@ -54,7 +58,7 @@ import org.springframework.web.bind.annotation.*; */ @Slf4j @RestController -@RequestMapping("/api/v2/iscs") +@RequestMapping("/api/v2/iscs/model") public class IscsModelDataController { @Autowired private IscsModelDataService modelDataService; @@ -65,7 +69,7 @@ public class IscsModelDataController { * @param data 模型proto数据DataModelMap */ @PostMapping("/{system}/{view}/{place}/init") - public IscsModelDataBasicInfo storeModelData(@PathVariable("system") String system, @PathVariable("view") String view, @PathVariable("place") String place, @RequestBody byte[] data) { + public IscsModelDataBasicInfo storeModelData(@PathVariable("system") @NotNull String system, @PathVariable("view") @NotNull String view, @PathVariable("place") @NotNull String place, @RequestBody @NotNull byte[] data) { log.debug("==>>初始化模型数据 system = {} view = {} place = {}", system, view, place); final IscsModelData param = new IscsModelData(); param.setSystem(system); @@ -82,7 +86,7 @@ public class IscsModelDataController { */ @GetMapping("/{system}/{view}/{place}") @ResponseBody - public byte[] findModelData(@PathVariable("system") String system, @PathVariable("view") String view, @PathVariable("place") String place) { + public byte[] findModelDataByBasicInfo(@PathVariable("system") @NotNull String system, @PathVariable("view") @NotNull String view, @PathVariable("place") @NotNull String place) { log.debug("==>>获取模型数据 system = {} view = {} place = {}", system, view, place); final IscsModelDataBasicInfo param = new IscsModelDataBasicInfo(); param.setSystem(system); @@ -92,5 +96,25 @@ public class IscsModelDataController { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != rt && null != rt.getData(), "模型数据不存在"); return rt.getData(); } - + /** + * 获取模型数据 + * + * @return 模型proto数据DataModelMap + */ + @GetMapping("/{id}") + @ResponseBody + public byte[] findModelDataById(@PathVariable("id") @NotNull Long id) { + log.debug("==>>获取模型数据 id = {}", id); + final IscsModelData rt = modelDataService.findModelData(id); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != rt && null != rt.getData(), "模型数据不存在"); + return rt.getData(); + } + /** + * 分页查询ISCS模型数据基本信息 + */ + @PostMapping("/find/page") + public PageVO findModelDataByPage(@RequestBody FindIscsModelDataBasicInfoByPageReqVo req) { + log.debug("==>>分页查询ISCS模型数据基本信息 : {}", req.toString()); + return modelDataService.findModelDataByPage(req); + } } diff --git a/src/main/java/club/joylink/rtss/iscs/entity/IscsModelData.java b/src/main/java/club/joylink/rtss/iscs/entity/IscsModelData.java index 5ccea41d8..63df02e89 100644 --- a/src/main/java/club/joylink/rtss/iscs/entity/IscsModelData.java +++ b/src/main/java/club/joylink/rtss/iscs/entity/IscsModelData.java @@ -1,6 +1,7 @@ package club.joylink.rtss.iscs.entity; import java.io.Serializable; +import java.time.LocalDateTime; import lombok.Data; /** @@ -29,6 +30,16 @@ public class IscsModelData implements Serializable { */ private String place; + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + /** * 场所整个所有的模型的数据 */ diff --git a/src/main/java/club/joylink/rtss/iscs/entity/IscsModelDataExample.java b/src/main/java/club/joylink/rtss/iscs/entity/IscsModelDataExample.java index 04fccffd5..1bdd2b4b1 100644 --- a/src/main/java/club/joylink/rtss/iscs/entity/IscsModelDataExample.java +++ b/src/main/java/club/joylink/rtss/iscs/entity/IscsModelDataExample.java @@ -1,5 +1,6 @@ package club.joylink.rtss.iscs.entity; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -393,6 +394,126 @@ public class IscsModelDataExample { addCriterion("place not between", value1, value2, "place"); return (Criteria) this; } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(LocalDateTime value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(LocalDateTime value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(LocalDateTime value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(LocalDateTime value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(LocalDateTime value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(LocalDateTime value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(LocalDateTime value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(LocalDateTime value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(LocalDateTime value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(LocalDateTime value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } } /** diff --git a/src/main/java/club/joylink/rtss/iscs/services/IscsModelDataService.java b/src/main/java/club/joylink/rtss/iscs/services/IscsModelDataService.java index c558b3b45..30c06ca60 100644 --- a/src/main/java/club/joylink/rtss/iscs/services/IscsModelDataService.java +++ b/src/main/java/club/joylink/rtss/iscs/services/IscsModelDataService.java @@ -4,12 +4,21 @@ import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.iscs.dao.IscsModelDataDAO; import club.joylink.rtss.iscs.entity.IscsModelData; import club.joylink.rtss.iscs.entity.IscsModelDataExample; +import club.joylink.rtss.iscs.vo.FindIscsModelDataBasicInfoByPageReqVo; import club.joylink.rtss.iscs.vo.IscsModelDataBasicInfo; +import club.joylink.rtss.vo.client.PageVO; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; +import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @Service public class IscsModelDataService { @@ -22,15 +31,18 @@ public class IscsModelDataService { @Transactional(readOnly = false, rollbackFor = Exception.class) public IscsModelDataBasicInfo storeModelData(final IscsModelData md) { //参数校验 - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(),"参数校验失败"); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(), "参数校验失败"); // - IscsModelData has = findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); + IscsModelData has = findBasicBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); + final LocalDateTime now = LocalDateTime.now(); + md.setUpdateTime(now); if (null != has) {//更新 md.setId(has.getId()); + md.setCreateTime(now); modelDataDao.updateByPrimaryKeySelective(md); } else {//新增 modelDataDao.insertSelective(md); - has = findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); + has = findBasicBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); } // IscsModelDataBasicInfo rt = new IscsModelDataBasicInfo(); @@ -42,23 +54,114 @@ public class IscsModelDataService { } /** - * 根据完整基本模型信息获取模型数据 + * 根据完整基本模型信息获取模型数据(包括大字段信息) */ - @Transactional(readOnly = true, rollbackFor = Exception.class) + @Transactional(readOnly = true) public IscsModelData findModelData(final IscsModelDataBasicInfo md) { //参数校验 - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(),"参数校验失败"); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertTrue(null != md.getSystem() && null != md.getView() && null != md.getPlace(), "参数校验失败"); // - return findBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); + return findAllBySystemViewAndPlace(md.getSystem(), md.getView(), md.getPlace()); + } + + /** + * 根据完整基本模型信息获取模型数据(包括大字段信息) + */ + @Transactional(readOnly = true) + public IscsModelData findModelData(final Long id) { + return modelDataDao.selectByPrimaryKey(id); + } + + /** + * 分页查询ISCS模型数据基本信息 + */ + @Transactional(readOnly = true) + public PageVO findModelDataByPage(FindIscsModelDataBasicInfoByPageReqVo req) { + IscsModelDataExample example = new IscsModelDataExample(); + if (req.getLogicAnd()) { + final IscsModelDataExample.Criteria andCriteria = example.createCriteria(); + if (StringUtils.hasText(req.getSystem())) { + if (req.getLike()) { + andCriteria.andSystemLike(String.format("%%%s%%", req.getSystem())); + } else { + andCriteria.andSystemEqualTo(req.getSystem()); + } + } + if (StringUtils.hasText(req.getView())) { + if (req.getLike()) { + andCriteria.andViewLike(String.format("%%%s%%", req.getView())); + } else { + andCriteria.andViewEqualTo(req.getView()); + } + } + if (StringUtils.hasText(req.getPlace())) { + if (req.getLike()) { + andCriteria.andPlaceLike(String.format("%%%s%%", req.getPlace())); + } else { + andCriteria.andPlaceEqualTo(req.getPlace()); + } + } + } else { + if (StringUtils.hasText(req.getSystem())) { + if (req.getLike()) { + example.or().andSystemLike(String.format("%%%s%%", req.getSystem())); + } else { + example.or().andSystemEqualTo(req.getSystem()); + } + } + if (StringUtils.hasText(req.getView())) { + if (req.getLike()) { + example.or().andViewLike(String.format("%%%s%%", req.getView())); + } else { + example.or().andViewEqualTo(req.getView()); + } + } + if (StringUtils.hasText(req.getPlace())) { + if (req.getLike()) { + example.or().andPlaceLike(String.format("%%%s%%", req.getPlace())); + } else { + example.or().andPlaceEqualTo(req.getPlace()); + } + } + } + // + final String orderBy = req.getOrderByType().with() + (req.getDesc() ? " desc" : ""); + PageHelper.clearPage(); + PageHelper.startPage(req.getPageNum(), req.getPageSize(), orderBy); + Page sqlPage = (Page) this.modelDataDao.selectByExample(example); + List rtList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(sqlPage.getResult())) { + rtList = sqlPage.getResult().stream().map((IscsModelData md) -> { + final IscsModelDataBasicInfo bi = new IscsModelDataBasicInfo(); + bi.setId(md.getId()); + bi.setSystem(md.getSystem()); + bi.setView(md.getView()); + bi.setPlace(md.getPlace()); + bi.setCreateTime(md.getCreateTime()); + bi.setUpdateTime(md.getUpdateTime()); + return bi; + }).collect(Collectors.toList()); + } + return PageVO.convert(sqlPage, rtList); } /** * 根据基本信息查询模型(不包括大字段信息) */ - private IscsModelData findBySystemViewAndPlace(String system, String view, String place) { + private IscsModelData findBasicBySystemViewAndPlace(String system, String view, String place) { IscsModelDataExample example = new IscsModelDataExample(); example.createCriteria().andSystemEqualTo(system).andViewEqualTo(view).andPlaceEqualTo(place); List list = modelDataDao.selectByExample(example); return null != list && list.size() > 0 ? list.get(0) : null; } + + /** + * 根据基本信息查询模型(包括大字段信息) + */ + private IscsModelData findAllBySystemViewAndPlace(String system, String view, String place) { + IscsModelDataExample example = new IscsModelDataExample(); + example.createCriteria().andSystemEqualTo(system).andViewEqualTo(view).andPlaceEqualTo(place); + List list = modelDataDao.selectByExampleWithBLOBs(example); + return null != list && list.size() > 0 ? list.get(0) : null; + } } diff --git a/src/main/java/club/joylink/rtss/iscs/vo/FindIscsModelDataBasicInfoByPageReqVo.java b/src/main/java/club/joylink/rtss/iscs/vo/FindIscsModelDataBasicInfoByPageReqVo.java new file mode 100644 index 000000000..2b0bc9fd9 --- /dev/null +++ b/src/main/java/club/joylink/rtss/iscs/vo/FindIscsModelDataBasicInfoByPageReqVo.java @@ -0,0 +1,91 @@ +package club.joylink.rtss.iscs.vo; + +import club.joylink.rtss.vo.client.PageQueryVO; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import lombok.Data; + +import java.util.HashMap; +import java.util.Map; + +/** + * 分页查询ISCS模型数据基本信息 + */ +@Data +public class FindIscsModelDataBasicInfoByPageReqVo extends PageQueryVO { + /** + * iscs一级系统(如FAS、PIS、AFC等) + */ + private String system; + /** + * iscs二级视图 + */ + private String view; + /** + * 场所(车站、变电所、停车场等) + */ + private String place; + /** + * 当查询条件有多个时,条件间关系:true-且,false-或;默认值为true + */ + private Boolean logicAnd = true; + /** + * 默认true,true-模糊查询,false-精确查询 + */ + private Boolean like = true; + /** + * 是否降序,true-降序,false-升序,默认值为true; + */ + private Boolean desc = true; + /** + * 排序类型,默认按创建时间排序,序列化为数值:1-system,2-view,3-place,4-create_time ,5-update_time + */ + private OrderByType orderByType = OrderByType.OrderByCreateTime; + + ///////////////////////////////////////////// + public static enum OrderByType { + OrderBySystem(1, "system"), + OrderByView(2, "view"), + OrderByPlace(3, "place"), + OrderByCreateTime(4, "create_time"), + OrderByUpdateTime(5, "update_time"), + ; + private Integer value; + private String orderBy; + + private OrderByType(Integer value, String orderBy) { + this.value = value; + this.orderBy = orderBy; + } + + public String with() { + return this.orderBy; + } + + @JsonCreator + public static OrderByType getItem(Integer value) { + return map.get(value); + } + + @JsonValue + public Integer getValue() { + return this.value; + } + + private static Map map = new HashMap<>(); + + static { + for (OrderByType t : values()) { + map.put(t.value, t); + } + } + } + + @Override + public String toString() { + return + "system='" + system + '\'' + + ", view='" + view + '\'' + + ", place='" + place + '\'' + super.toString(); + } +} diff --git a/src/main/java/club/joylink/rtss/iscs/vo/IscsModelDataBasicInfo.java b/src/main/java/club/joylink/rtss/iscs/vo/IscsModelDataBasicInfo.java index 0fc525786..5f76b342a 100644 --- a/src/main/java/club/joylink/rtss/iscs/vo/IscsModelDataBasicInfo.java +++ b/src/main/java/club/joylink/rtss/iscs/vo/IscsModelDataBasicInfo.java @@ -2,6 +2,11 @@ package club.joylink.rtss.iscs.vo; import lombok.Data; +import java.time.LocalDateTime; + +/** + * 模型数据基本信息 + */ @Data public class IscsModelDataBasicInfo { /** @@ -20,4 +25,13 @@ public class IscsModelDataBasicInfo { * 场所(车站、变电所、停车场等) */ private String place; + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; } diff --git a/src/main/java/club/joylink/rtss/services/paper/PaperUserCreateService.java b/src/main/java/club/joylink/rtss/services/paper/PaperUserCreateService.java index d84d25869..98a444879 100644 --- a/src/main/java/club/joylink/rtss/services/paper/PaperUserCreateService.java +++ b/src/main/java/club/joylink/rtss/services/paper/PaperUserCreateService.java @@ -81,7 +81,7 @@ public class PaperUserCreateService { PaperUser paper = new PaperUser(); paper.setUserId(user.getId()); paper.setPcId(pcId); - paper.setOrgId(orgId); +// paper.setOrgId(orgId); paper.setCreateTime(LocalDateTime.now()); paper.setStartTime(LocalDateTime.now()); paperUserDAO.insertSelective(paper); diff --git a/src/main/java/club/joylink/rtss/vo/client/PageQueryVO.java b/src/main/java/club/joylink/rtss/vo/client/PageQueryVO.java index 906372b76..7588f6492 100644 --- a/src/main/java/club/joylink/rtss/vo/client/PageQueryVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/PageQueryVO.java @@ -31,4 +31,10 @@ public class PageQueryVO { this.pageSize = pageSize; } + @Override + public String toString() { + return + " pageNum=" + pageNum + + ", pageSize=" + pageSize; + } } diff --git a/src/main/java/club/joylink/rtss/vo/paper/convertor/PaperUserConvertor.java b/src/main/java/club/joylink/rtss/vo/paper/convertor/PaperUserConvertor.java index 889c0031d..e820adb0a 100644 --- a/src/main/java/club/joylink/rtss/vo/paper/convertor/PaperUserConvertor.java +++ b/src/main/java/club/joylink/rtss/vo/paper/convertor/PaperUserConvertor.java @@ -12,7 +12,7 @@ public class PaperUserConvertor { to.setId(from.getId()); to.setUserId(from.getUserId()); to.setPcId(from.getPcId()); - to.setOrgId(from.getOrgId()); +// to.setOrgId(from.getOrgId()); to.setScore(from.getScore()); to.setStartTime(from.getStartTime()); to.setEndTime(from.getEndTime()); diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java index b9c7cd631..2d1d35759 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/BgSceneStatusRule.java @@ -1,5 +1,6 @@ package club.joylink.rtss.vo.training2.rule; +import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.MapPrdTypeEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.simulation.cbtc.Simulation; @@ -338,6 +339,39 @@ public enum BgSceneStatusRule { return getBgScene(simulation); } }, + STATION_OPEN_AUTO_SETTING_BG_SCENE("全站进路交ATS自动控背景") { + @Override + public String doHandle(Simulation simulation, MapElement mapElement) { + Station station = (Station) mapElement; + if(!station.isInterlock()) { + throw new SimulationException(SimulationExceptionType.Simulation_Map_Data_Error); + } + if (BusinessConsts.MapPrd.PrdType.Type01.equals(simulation.getBuildParams().getProdType())) { + if(station.isCentralized()) { + station.setControlMode(Station.ControlMode.Local); + }else{ + station.getDeviceStation().setControlMode(Station.ControlMode.Local); + } + } + List routeList3 = simulation.getRepository().getRouteList(); + for (Route route : routeList3) { + if (Objects.equals(route.getInterlockStation(), station)) { + if (route.isAtsControl()) { + route.setAtsControl(false); + } + } + } + return getBgScene(simulation); + } + }, + STATION_CENTER_CONTROL_BG_SCENE ("车站设置中控背景") { + @Override + public String doHandle(Simulation simulation, MapElement mapElement) { + Station station = (Station) mapElement; + station.setControlMode(Station.ControlMode.Local); + return getBgScene(simulation); + } + }, STAND_EARLY_DEPART_BG_SCENE("提前发车背景") { @Override public String doHandle(Simulation simulation, MapElement mapElement) { @@ -379,15 +413,22 @@ public enum BgSceneStatusRule { return getBgScene(simulation); } }, - STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停") { + STAND_CANCEL_JUMP_STOP_BG_SCENE("站台取消设置跳停背景") { @Override public String doHandle(Simulation simulation, MapElement mapElement) { Stand stand = (Stand) mapElement; stand.setAllSkip(true); return getBgScene(simulation); } + }, + STAND_STRATEGY_BG_SCENE("人工折返策略设置背景") { + @Override + public String doHandle(Simulation simulation, MapElement mapElement) { + Stand stand = (Stand) mapElement; + stand.setTypeStrategy(Stand.TurnBackType.AUTO); + return getBgScene(simulation); + } } - ; /** diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java index e5da48b39..629b920af 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/MapDeviceRule.java @@ -7,6 +7,7 @@ import lombok.Getter; import org.springframework.util.StringUtils; import java.util.ArrayList; +import java.util.Comparator; import java.util.List; import java.util.Random; import java.util.function.Function; @@ -18,7 +19,9 @@ public enum MapDeviceRule { @Override public List filterMapDeviceList(Simulation simulation) { List stationList = simulation.getBuildParams().getMap().getGraphDataNew().getStationList() - .stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation()).map(MapStationNewVO::getCode) + .stream().filter(s -> s.isVisible() && s.isCentralized() && s.isCiStation()) + .sorted(Comparator.comparing(MapStationNewVO::getSn)) + .map(MapStationNewVO::getCode) .map(code -> simulation.getRepository().getByCode(code, Station.class)) .collect(Collectors.toList()); return generateRandomElement(stationList, 1); @@ -27,9 +30,15 @@ public enum MapDeviceRule { STAND_LIST("站台列表"){ @Override public List filterMapDeviceList(Simulation simulation) { - List stationList = STATION_LIST.filterMapDeviceList(simulation); - Station station = stationList.get(0); - return MapDeviceRule.generateRandomElement(station.getAllStandList(), 2); + List stationList = simulation.getRepository().getStandList().stream().filter(stand -> { + if (stand.getStation() != null && stand.getStation().isDepot()) + return false; + if (!stand.isVisible() || !stand.hasDoor() || stand.isSmall()) { // 特殊站台 + return false; + } + return true; + }).collect(Collectors.toList()); + return MapDeviceRule.generateRandomElement(stationList, 2); } }, ROUTE_LIST("进路列表") { @@ -92,7 +101,15 @@ public enum MapDeviceRule { return generateRandomElement(sectionList, 2); } }, - + CONTROL_STATION_LIST("控制模式的车站列表") { + @Override + public List filterMapDeviceList(Simulation simulation) { + //找到所有有控制模式的车站 + List stationList = simulation.getRepository().getStationList().stream() + .filter(Station::isHasControlMode).collect(Collectors.toList()); + return MapDeviceRule.generateRandomElement(stationList, 1); + } + } ; private String description; diff --git a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java index d123ca852..94979b50e 100644 --- a/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java +++ b/src/main/java/club/joylink/rtss/vo/training2/rule/PropertyValueRule.java @@ -113,14 +113,35 @@ public enum PropertyValueRule { return buttonVO.getCode(); } }, - SIGNAL_FIRST_ROUTE_CODE_LIST("信号机关联的第一条进路编码列表") { + SIGNAL_FIRST_ROUTE_CODE_LIST("信号机关联的进路编码列表") { @Override public Object resolve(Simulation simulation, Object mapElement) { Signal signal = (Signal) mapElement; Route route = signal.getRouteList().get(0); return List.of(route.getCode()); } - } + }, + SIGNAL_FIRST_ROUTE_NAME("信号机关联的进路名称") { + @Override + public Object resolve(Simulation simulation, Object mapElement) { + Signal signal = (Signal) mapElement; + Route route = signal.getRouteList().get(0); + return route.getName(); + } + }, + CENTER_CONTROL_STATION_CODE_LIST("站控转中控时车站列表") { + @Override + public Object resolve(Simulation simulation, Object mapElement) { + Station station = (Station) mapElement; + return List.of(station.getCode()); + } + }, + CENTER_CONTROL_STATION_NAME("站控转中控时车站名称") { + @Override + public Object resolve(Simulation simulation, Object mapElement) { + return ((Station) mapElement).getName(); + } + }, ; private final String description; diff --git a/src/main/resources/mybatis/mapper/iscs/IscsModelDataDAO.xml b/src/main/resources/mybatis/mapper/iscs/IscsModelDataDAO.xml index caf27fc99..de3c1c13b 100644 --- a/src/main/resources/mybatis/mapper/iscs/IscsModelDataDAO.xml +++ b/src/main/resources/mybatis/mapper/iscs/IscsModelDataDAO.xml @@ -6,6 +6,8 @@ + + @@ -69,7 +71,7 @@ - id, `system`, `view`, place + id, `system`, `view`, place, create_time, update_time `data` @@ -140,9 +142,11 @@ insert into rts_iscs_model_data (id, `system`, `view`, - place, `data`) + place, create_time, update_time, + `data`) values (#{id,jdbcType=BIGINT}, #{system,jdbcType=VARCHAR}, #{view,jdbcType=VARCHAR}, - #{place,jdbcType=VARCHAR}, #{data,jdbcType=LONGVARBINARY}) + #{place,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{data,jdbcType=LONGVARBINARY}) insert into rts_iscs_model_data @@ -159,6 +163,12 @@ place, + + create_time, + + + update_time, + `data`, @@ -176,6 +186,12 @@ #{place,jdbcType=VARCHAR}, + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + #{data,jdbcType=LONGVARBINARY}, @@ -202,6 +218,12 @@ place = #{record.place,jdbcType=VARCHAR}, + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + `data` = #{record.data,jdbcType=LONGVARBINARY}, @@ -216,6 +238,8 @@ `system` = #{record.system,jdbcType=VARCHAR}, `view` = #{record.view,jdbcType=VARCHAR}, place = #{record.place,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, `data` = #{record.data,jdbcType=LONGVARBINARY} @@ -226,7 +250,9 @@ set id = #{record.id,jdbcType=BIGINT}, `system` = #{record.system,jdbcType=VARCHAR}, `view` = #{record.view,jdbcType=VARCHAR}, - place = #{record.place,jdbcType=VARCHAR} + place = #{record.place,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} @@ -243,6 +269,12 @@ place = #{place,jdbcType=VARCHAR}, + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + `data` = #{data,jdbcType=LONGVARBINARY}, @@ -254,6 +286,8 @@ set `system` = #{system,jdbcType=VARCHAR}, `view` = #{view,jdbcType=VARCHAR}, place = #{place,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, `data` = #{data,jdbcType=LONGVARBINARY} where id = #{id,jdbcType=BIGINT} @@ -261,7 +295,9 @@ update rts_iscs_model_data set `system` = #{system,jdbcType=VARCHAR}, `view` = #{view,jdbcType=VARCHAR}, - place = #{place,jdbcType=VARCHAR} + place = #{place,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/paper/PaperUserDAO.xml b/src/main/resources/mybatis/mapper/paper/PaperUserDAO.xml index 3e0b5b757..f9c56e0e5 100644 --- a/src/main/resources/mybatis/mapper/paper/PaperUserDAO.xml +++ b/src/main/resources/mybatis/mapper/paper/PaperUserDAO.xml @@ -5,7 +5,6 @@ - @@ -71,7 +70,7 @@ - id, user_id, pc_id, org_id, score, start_time, end_time, cause, create_time + id, user_id, pc_id, score, start_time, end_time, cause, create_time