From c8a8bdc6eed49c8d3854fbe00e4bcc2748af2437 Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Tue, 18 Oct 2022 09:27:16 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=96=B0=E6=9D=83=E9=99=90=E5=88=86?= =?UTF-8?q?=E5=8F=91=E9=A2=86=E5=8F=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../permission/PermissionDistributeDAO.java | 35 + .../dao/permission/PermissionSubjectDAO.java | 5 +- .../permission/PermissionDistribute.java | 71 ++ .../PermissionDistributeExample.java | 953 ++++++++++++++++++ .../entity/permission/PermissionSubject.java | 15 +- .../permission/PermissionSubjectExample.java | 124 ++- .../IPermissionDistributeService.java | 20 + .../permission/IPermissionSubjectService.java | 4 + .../PermissionDistributeServiceImpl.java | 20 + .../PermissionSubjectServiceImpl.java | 14 + .../vo/permission/PermissionDistributeVO.java | 28 + .../permission/PermissionDistributeDAO.xml | 323 ++++++ .../permission/PermissionSubjectDAO.xml | 49 +- 13 files changed, 1602 insertions(+), 59 deletions(-) create mode 100644 src/main/java/club/joylink/rtss/dao/permission/PermissionDistributeDAO.java create mode 100644 src/main/java/club/joylink/rtss/entity/permission/PermissionDistribute.java create mode 100644 src/main/java/club/joylink/rtss/entity/permission/PermissionDistributeExample.java create mode 100644 src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java create mode 100644 src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java create mode 100644 src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java create mode 100644 src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java create mode 100644 src/main/java/club/joylink/rtss/vo/permission/PermissionDistributeVO.java create mode 100644 src/main/resources/mybatis/mapper/permission/PermissionDistributeDAO.xml diff --git a/src/main/java/club/joylink/rtss/dao/permission/PermissionDistributeDAO.java b/src/main/java/club/joylink/rtss/dao/permission/PermissionDistributeDAO.java new file mode 100644 index 000000000..da714919e --- /dev/null +++ b/src/main/java/club/joylink/rtss/dao/permission/PermissionDistributeDAO.java @@ -0,0 +1,35 @@ +package club.joylink.rtss.dao.permission; + +import java.util.List; + +import club.joylink.rtss.entity.permission.PermissionDistribute; +import club.joylink.rtss.entity.permission.PermissionDistributeExample; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +@Mapper +@Repository +public interface PermissionDistributeDAO { + long countByExample(PermissionDistributeExample example); + + int deleteByExample(PermissionDistributeExample example); + + int deleteByPrimaryKey(Long id); + + int insert(PermissionDistribute record); + + int insertSelective(PermissionDistribute record); + + List selectByExample(PermissionDistributeExample example); + + PermissionDistribute selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example); + + int updateByExample(@Param("record") PermissionDistribute record, @Param("example") PermissionDistributeExample example); + + int updateByPrimaryKeySelective(PermissionDistribute record); + + int updateByPrimaryKey(PermissionDistribute record); +} diff --git a/src/main/java/club/joylink/rtss/dao/permission/PermissionSubjectDAO.java b/src/main/java/club/joylink/rtss/dao/permission/PermissionSubjectDAO.java index a937a76bb..dbf598fbf 100644 --- a/src/main/java/club/joylink/rtss/dao/permission/PermissionSubjectDAO.java +++ b/src/main/java/club/joylink/rtss/dao/permission/PermissionSubjectDAO.java @@ -1,8 +1,9 @@ package club.joylink.rtss.dao.permission; +import java.util.List; + import club.joylink.rtss.entity.permission.PermissionSubject; import club.joylink.rtss.entity.permission.PermissionSubjectExample; -import java.util.List; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -31,4 +32,4 @@ public interface PermissionSubjectDAO { int updateByPrimaryKeySelective(PermissionSubject record); int updateByPrimaryKey(PermissionSubject record); -} \ No newline at end of file +} diff --git a/src/main/java/club/joylink/rtss/entity/permission/PermissionDistribute.java b/src/main/java/club/joylink/rtss/entity/permission/PermissionDistribute.java new file mode 100644 index 000000000..3675864c0 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/permission/PermissionDistribute.java @@ -0,0 +1,71 @@ +package club.joylink.rtss.entity.permission; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +/** + * @author + * + */ +@Data +public class PermissionDistribute implements Serializable { + private Long id; + + /** + * 关联权限id + */ + private Long permissionId; + + /** + * 分发来自subject id(rts_permission_subject) + */ + private Long sourceSubjectId; + + /** + * 总数量 + */ + private Integer amount; + + /** + * 剩余数量 + */ + private Integer remains; + + /** + * 是否永久:true/false + */ + private Boolean forever; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 修改时间 + */ + private Date updateTime; + + /** + * 开始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + + /** + * 创建者id + */ + private Long createId; + + /** + * 备注描述 + */ + private String dsc; + + private static final long serialVersionUID = 1L; +} diff --git a/src/main/java/club/joylink/rtss/entity/permission/PermissionDistributeExample.java b/src/main/java/club/joylink/rtss/entity/permission/PermissionDistributeExample.java new file mode 100644 index 000000000..998e16fb4 --- /dev/null +++ b/src/main/java/club/joylink/rtss/entity/permission/PermissionDistributeExample.java @@ -0,0 +1,953 @@ +package club.joylink.rtss.entity.permission; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class PermissionDistributeExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + private Integer limit; + + private Long offset; + + public PermissionDistributeExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public Integer getLimit() { + return limit; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public Long getOffset() { + return offset; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(Long value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(Long value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(Long value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(Long value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(Long value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(Long value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(Long value1, Long value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(Long value1, Long value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andPermissionIdIsNull() { + addCriterion("permission_id is null"); + return (Criteria) this; + } + + public Criteria andPermissionIdIsNotNull() { + addCriterion("permission_id is not null"); + return (Criteria) this; + } + + public Criteria andPermissionIdEqualTo(Long value) { + addCriterion("permission_id =", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdNotEqualTo(Long value) { + addCriterion("permission_id <>", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdGreaterThan(Long value) { + addCriterion("permission_id >", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdGreaterThanOrEqualTo(Long value) { + addCriterion("permission_id >=", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdLessThan(Long value) { + addCriterion("permission_id <", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdLessThanOrEqualTo(Long value) { + addCriterion("permission_id <=", value, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdIn(List values) { + addCriterion("permission_id in", values, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdNotIn(List values) { + addCriterion("permission_id not in", values, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdBetween(Long value1, Long value2) { + addCriterion("permission_id between", value1, value2, "permissionId"); + return (Criteria) this; + } + + public Criteria andPermissionIdNotBetween(Long value1, Long value2) { + addCriterion("permission_id not between", value1, value2, "permissionId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdIsNull() { + addCriterion("source_subject_id is null"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdIsNotNull() { + addCriterion("source_subject_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdEqualTo(Long value) { + addCriterion("source_subject_id =", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdNotEqualTo(Long value) { + addCriterion("source_subject_id <>", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdGreaterThan(Long value) { + addCriterion("source_subject_id >", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdGreaterThanOrEqualTo(Long value) { + addCriterion("source_subject_id >=", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdLessThan(Long value) { + addCriterion("source_subject_id <", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdLessThanOrEqualTo(Long value) { + addCriterion("source_subject_id <=", value, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdIn(List values) { + addCriterion("source_subject_id in", values, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdNotIn(List values) { + addCriterion("source_subject_id not in", values, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdBetween(Long value1, Long value2) { + addCriterion("source_subject_id between", value1, value2, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andSourceSubjectIdNotBetween(Long value1, Long value2) { + addCriterion("source_subject_id not between", value1, value2, "sourceSubjectId"); + return (Criteria) this; + } + + public Criteria andAmountIsNull() { + addCriterion("amount is null"); + return (Criteria) this; + } + + public Criteria andAmountIsNotNull() { + addCriterion("amount is not null"); + return (Criteria) this; + } + + public Criteria andAmountEqualTo(Integer value) { + addCriterion("amount =", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountNotEqualTo(Integer value) { + addCriterion("amount <>", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountGreaterThan(Integer value) { + addCriterion("amount >", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountGreaterThanOrEqualTo(Integer value) { + addCriterion("amount >=", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountLessThan(Integer value) { + addCriterion("amount <", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountLessThanOrEqualTo(Integer value) { + addCriterion("amount <=", value, "amount"); + return (Criteria) this; + } + + public Criteria andAmountIn(List values) { + addCriterion("amount in", values, "amount"); + return (Criteria) this; + } + + public Criteria andAmountNotIn(List values) { + addCriterion("amount not in", values, "amount"); + return (Criteria) this; + } + + public Criteria andAmountBetween(Integer value1, Integer value2) { + addCriterion("amount between", value1, value2, "amount"); + return (Criteria) this; + } + + public Criteria andAmountNotBetween(Integer value1, Integer value2) { + addCriterion("amount not between", value1, value2, "amount"); + return (Criteria) this; + } + + public Criteria andRemainsIsNull() { + addCriterion("remains is null"); + return (Criteria) this; + } + + public Criteria andRemainsIsNotNull() { + addCriterion("remains is not null"); + return (Criteria) this; + } + + public Criteria andRemainsEqualTo(Integer value) { + addCriterion("remains =", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsNotEqualTo(Integer value) { + addCriterion("remains <>", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsGreaterThan(Integer value) { + addCriterion("remains >", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsGreaterThanOrEqualTo(Integer value) { + addCriterion("remains >=", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsLessThan(Integer value) { + addCriterion("remains <", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsLessThanOrEqualTo(Integer value) { + addCriterion("remains <=", value, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsIn(List values) { + addCriterion("remains in", values, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsNotIn(List values) { + addCriterion("remains not in", values, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsBetween(Integer value1, Integer value2) { + addCriterion("remains between", value1, value2, "remains"); + return (Criteria) this; + } + + public Criteria andRemainsNotBetween(Integer value1, Integer value2) { + addCriterion("remains not between", value1, value2, "remains"); + return (Criteria) this; + } + + public Criteria andForeverIsNull() { + addCriterion("forever is null"); + return (Criteria) this; + } + + public Criteria andForeverIsNotNull() { + addCriterion("forever is not null"); + return (Criteria) this; + } + + public Criteria andForeverEqualTo(Boolean value) { + addCriterion("forever =", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverNotEqualTo(Boolean value) { + addCriterion("forever <>", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverGreaterThan(Boolean value) { + addCriterion("forever >", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverGreaterThanOrEqualTo(Boolean value) { + addCriterion("forever >=", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverLessThan(Boolean value) { + addCriterion("forever <", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverLessThanOrEqualTo(Boolean value) { + addCriterion("forever <=", value, "forever"); + return (Criteria) this; + } + + public Criteria andForeverIn(List values) { + addCriterion("forever in", values, "forever"); + return (Criteria) this; + } + + public Criteria andForeverNotIn(List values) { + addCriterion("forever not in", values, "forever"); + return (Criteria) this; + } + + public Criteria andForeverBetween(Boolean value1, Boolean value2) { + addCriterion("forever between", value1, value2, "forever"); + return (Criteria) this; + } + + public Criteria andForeverNotBetween(Boolean value1, Boolean value2) { + addCriterion("forever not between", value1, value2, "forever"); + 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(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date 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(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date 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(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date 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(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNull() { + addCriterion("start_time is null"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNotNull() { + addCriterion("start_time is not null"); + return (Criteria) this; + } + + public Criteria andStartTimeEqualTo(Date value) { + addCriterion("start_time =", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotEqualTo(Date value) { + addCriterion("start_time <>", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThan(Date value) { + addCriterion("start_time >", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThanOrEqualTo(Date value) { + addCriterion("start_time >=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThan(Date value) { + addCriterion("start_time <", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThanOrEqualTo(Date value) { + addCriterion("start_time <=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeIn(List values) { + addCriterion("start_time in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotIn(List values) { + addCriterion("start_time not in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeBetween(Date value1, Date value2) { + addCriterion("start_time between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotBetween(Date value1, Date value2) { + addCriterion("start_time not between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNull() { + addCriterion("end_time is null"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNotNull() { + addCriterion("end_time is not null"); + return (Criteria) this; + } + + public Criteria andEndTimeEqualTo(Date value) { + addCriterion("end_time =", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotEqualTo(Date value) { + addCriterion("end_time <>", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThan(Date value) { + addCriterion("end_time >", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThanOrEqualTo(Date value) { + addCriterion("end_time >=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThan(Date value) { + addCriterion("end_time <", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThanOrEqualTo(Date value) { + addCriterion("end_time <=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIn(List values) { + addCriterion("end_time in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotIn(List values) { + addCriterion("end_time not in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeBetween(Date value1, Date value2) { + addCriterion("end_time between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotBetween(Date value1, Date value2) { + addCriterion("end_time not between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andCreateIdIsNull() { + addCriterion("create_id is null"); + return (Criteria) this; + } + + public Criteria andCreateIdIsNotNull() { + addCriterion("create_id is not null"); + return (Criteria) this; + } + + public Criteria andCreateIdEqualTo(Long value) { + addCriterion("create_id =", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdNotEqualTo(Long value) { + addCriterion("create_id <>", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdGreaterThan(Long value) { + addCriterion("create_id >", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdGreaterThanOrEqualTo(Long value) { + addCriterion("create_id >=", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdLessThan(Long value) { + addCriterion("create_id <", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdLessThanOrEqualTo(Long value) { + addCriterion("create_id <=", value, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdIn(List values) { + addCriterion("create_id in", values, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdNotIn(List values) { + addCriterion("create_id not in", values, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdBetween(Long value1, Long value2) { + addCriterion("create_id between", value1, value2, "createId"); + return (Criteria) this; + } + + public Criteria andCreateIdNotBetween(Long value1, Long value2) { + addCriterion("create_id not between", value1, value2, "createId"); + return (Criteria) this; + } + + public Criteria andDscIsNull() { + addCriterion("dsc is null"); + return (Criteria) this; + } + + public Criteria andDscIsNotNull() { + addCriterion("dsc is not null"); + return (Criteria) this; + } + + public Criteria andDscEqualTo(String value) { + addCriterion("dsc =", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscNotEqualTo(String value) { + addCriterion("dsc <>", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscGreaterThan(String value) { + addCriterion("dsc >", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscGreaterThanOrEqualTo(String value) { + addCriterion("dsc >=", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscLessThan(String value) { + addCriterion("dsc <", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscLessThanOrEqualTo(String value) { + addCriterion("dsc <=", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscLike(String value) { + addCriterion("dsc like", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscNotLike(String value) { + addCriterion("dsc not like", value, "dsc"); + return (Criteria) this; + } + + public Criteria andDscIn(List values) { + addCriterion("dsc in", values, "dsc"); + return (Criteria) this; + } + + public Criteria andDscNotIn(List values) { + addCriterion("dsc not in", values, "dsc"); + return (Criteria) this; + } + + public Criteria andDscBetween(String value1, String value2) { + addCriterion("dsc between", value1, value2, "dsc"); + return (Criteria) this; + } + + public Criteria andDscNotBetween(String value1, String value2) { + addCriterion("dsc not between", value1, value2, "dsc"); + return (Criteria) this; + } + } + + /** + */ + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} diff --git a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java index fc1496a6e..05d6af8b2 100644 --- a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java +++ b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java @@ -1,7 +1,7 @@ package club.joylink.rtss.entity.permission; import java.io.Serializable; -import java.time.LocalDateTime; +import java.util.Date; import lombok.Data; /** @@ -53,17 +53,22 @@ public class PermissionSubject implements Serializable { /** * 开始时间 */ - private LocalDateTime startTime; + private Date startTime; /** * 结束时间 */ - private LocalDateTime endTime; + private Date endTime; /** * 创建时间 */ - private LocalDateTime createTime; + private Date createTime; + + /** + * 来自对应的分发id(rts_permission_distribute) + */ + private Long distributeId; private static final long serialVersionUID = 1L; -} \ No newline at end of file +} diff --git a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubjectExample.java b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubjectExample.java index 97eaecddf..0f67735f4 100644 --- a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubjectExample.java +++ b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubjectExample.java @@ -1,7 +1,7 @@ package club.joylink.rtss.entity.permission; -import java.time.LocalDateTime; import java.util.ArrayList; +import java.util.Date; import java.util.List; public class PermissionSubjectExample { @@ -635,52 +635,52 @@ public class PermissionSubjectExample { 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; } @@ -695,52 +695,52 @@ public class PermissionSubjectExample { 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; } @@ -755,55 +755,115 @@ public class PermissionSubjectExample { 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; } + + public Criteria andDistributeIdIsNull() { + addCriterion("distribute_id is null"); + return (Criteria) this; + } + + public Criteria andDistributeIdIsNotNull() { + addCriterion("distribute_id is not null"); + return (Criteria) this; + } + + public Criteria andDistributeIdEqualTo(Long value) { + addCriterion("distribute_id =", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdNotEqualTo(Long value) { + addCriterion("distribute_id <>", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdGreaterThan(Long value) { + addCriterion("distribute_id >", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdGreaterThanOrEqualTo(Long value) { + addCriterion("distribute_id >=", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdLessThan(Long value) { + addCriterion("distribute_id <", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdLessThanOrEqualTo(Long value) { + addCriterion("distribute_id <=", value, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdIn(List values) { + addCriterion("distribute_id in", values, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdNotIn(List values) { + addCriterion("distribute_id not in", values, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdBetween(Long value1, Long value2) { + addCriterion("distribute_id between", value1, value2, "distributeId"); + return (Criteria) this; + } + + public Criteria andDistributeIdNotBetween(Long value1, Long value2) { + addCriterion("distribute_id not between", value1, value2, "distributeId"); + return (Criteria) this; + } } /** @@ -900,4 +960,4 @@ public class PermissionSubjectExample { this(condition, value, secondValue, null); } } -} \ No newline at end of file +} diff --git a/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java b/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java new file mode 100644 index 000000000..5fe6d353e --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java @@ -0,0 +1,20 @@ +package club.joylink.rtss.services.permission; + +import club.joylink.rtss.vo.LoginUserInfoVO; +import club.joylink.rtss.vo.permission.PermissionDistributeVO; + +public interface IPermissionDistributeService { + + /** + * 分发权限 + * @param vo + * @param userInfoVO + */ + void distributePermission(PermissionDistributeVO vo , LoginUserInfoVO userInfoVO); + + /** + * 领取权限 + */ + void requestDistributePer(); + +} diff --git a/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java b/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java new file mode 100644 index 000000000..203327a77 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java @@ -0,0 +1,4 @@ +package club.joylink.rtss.services.permission; + +public interface IPermissionSubjectService { +} diff --git a/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java b/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java new file mode 100644 index 000000000..8ddea4d15 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java @@ -0,0 +1,20 @@ +package club.joylink.rtss.services.permission; + +import club.joylink.rtss.dao.permission.PermissionDistributeDAO; +import club.joylink.rtss.services.QRCodeManager; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +@Slf4j +public class PermissionDistributeServiceImpl implements IPermissionDistributeService{ + @Resource + private PermissionDistributeDAO distributeDAO; + @Resource + private QRCodeManager qrCodeManager; + + + +} diff --git a/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java b/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java new file mode 100644 index 000000000..143bd6f77 --- /dev/null +++ b/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java @@ -0,0 +1,14 @@ +package club.joylink.rtss.services.permission; + +import club.joylink.rtss.dao.permission.PermissionSubjectDAO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +@Slf4j +public class PermissionSubjectServiceImpl implements IPermissionSubjectService{ + @Resource + private PermissionSubjectDAO subjectDAO; +} diff --git a/src/main/java/club/joylink/rtss/vo/permission/PermissionDistributeVO.java b/src/main/java/club/joylink/rtss/vo/permission/PermissionDistributeVO.java new file mode 100644 index 000000000..6de8194b3 --- /dev/null +++ b/src/main/java/club/joylink/rtss/vo/permission/PermissionDistributeVO.java @@ -0,0 +1,28 @@ +package club.joylink.rtss.vo.permission; + +import club.joylink.rtss.entity.permission.PermissionDistribute; +import lombok.Data; + +import java.io.Serializable; +import java.time.LocalDateTime; + +@Data +public class PermissionDistributeVO implements Serializable { + + private static final long serialVersionUID = 2597089293400946877L; + private Long permissionId; + private String sourceSubjectId; + private Integer amount; + private Integer remains; + private Boolean forever; + private LocalDateTime createTime; + private LocalDateTime updateTime; + private LocalDateTime startTime; + private LocalDateTime endTime; + private String dsc; + + public PermissionDistribute toBean(){ + PermissionDistribute pd = new PermissionDistribute(); + return pd; + } +} diff --git a/src/main/resources/mybatis/mapper/permission/PermissionDistributeDAO.xml b/src/main/resources/mybatis/mapper/permission/PermissionDistributeDAO.xml new file mode 100644 index 000000000..70957da70 --- /dev/null +++ b/src/main/resources/mybatis/mapper/permission/PermissionDistributeDAO.xml @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, permission_id, source_subject_id, amount, remains, forever, create_time, update_time, + start_time, end_time, create_id, dsc + + + + + delete from rts_permission_distribute + where id = #{id,jdbcType=BIGINT} + + + delete from rts_permission_distribute + + + + + + insert into rts_permission_distribute (permission_id, source_subject_id, amount, + remains, forever, create_time, + update_time, start_time, end_time, + create_id, dsc) + values (#{permissionId,jdbcType=BIGINT}, #{sourceSubjectId,jdbcType=BIGINT}, #{amount,jdbcType=INTEGER}, + #{remains,jdbcType=INTEGER}, #{forever,jdbcType=BIT}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, + #{createId,jdbcType=BIGINT}, #{dsc,jdbcType=VARCHAR}) + + + insert into rts_permission_distribute + + + permission_id, + + + source_subject_id, + + + amount, + + + remains, + + + forever, + + + create_time, + + + update_time, + + + start_time, + + + end_time, + + + create_id, + + + dsc, + + + + + #{permissionId,jdbcType=BIGINT}, + + + #{sourceSubjectId,jdbcType=BIGINT}, + + + #{amount,jdbcType=INTEGER}, + + + #{remains,jdbcType=INTEGER}, + + + #{forever,jdbcType=BIT}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{startTime,jdbcType=TIMESTAMP}, + + + #{endTime,jdbcType=TIMESTAMP}, + + + #{createId,jdbcType=BIGINT}, + + + #{dsc,jdbcType=VARCHAR}, + + + + + + update rts_permission_distribute + + + id = #{record.id,jdbcType=BIGINT}, + + + permission_id = #{record.permissionId,jdbcType=BIGINT}, + + + source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT}, + + + amount = #{record.amount,jdbcType=INTEGER}, + + + remains = #{record.remains,jdbcType=INTEGER}, + + + forever = #{record.forever,jdbcType=BIT}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + start_time = #{record.startTime,jdbcType=TIMESTAMP}, + + + end_time = #{record.endTime,jdbcType=TIMESTAMP}, + + + create_id = #{record.createId,jdbcType=BIGINT}, + + + dsc = #{record.dsc,jdbcType=VARCHAR}, + + + + + + + + update rts_permission_distribute + set id = #{record.id,jdbcType=BIGINT}, + permission_id = #{record.permissionId,jdbcType=BIGINT}, + source_subject_id = #{record.sourceSubjectId,jdbcType=BIGINT}, + amount = #{record.amount,jdbcType=INTEGER}, + remains = #{record.remains,jdbcType=INTEGER}, + forever = #{record.forever,jdbcType=BIT}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + start_time = #{record.startTime,jdbcType=TIMESTAMP}, + end_time = #{record.endTime,jdbcType=TIMESTAMP}, + create_id = #{record.createId,jdbcType=BIGINT}, + dsc = #{record.dsc,jdbcType=VARCHAR} + + + + + + update rts_permission_distribute + + + permission_id = #{permissionId,jdbcType=BIGINT}, + + + source_subject_id = #{sourceSubjectId,jdbcType=BIGINT}, + + + amount = #{amount,jdbcType=INTEGER}, + + + remains = #{remains,jdbcType=INTEGER}, + + + forever = #{forever,jdbcType=BIT}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + start_time = #{startTime,jdbcType=TIMESTAMP}, + + + end_time = #{endTime,jdbcType=TIMESTAMP}, + + + create_id = #{createId,jdbcType=BIGINT}, + + + dsc = #{dsc,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update rts_permission_distribute + set permission_id = #{permissionId,jdbcType=BIGINT}, + source_subject_id = #{sourceSubjectId,jdbcType=BIGINT}, + amount = #{amount,jdbcType=INTEGER}, + remains = #{remains,jdbcType=INTEGER}, + forever = #{forever,jdbcType=BIT}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + start_time = #{startTime,jdbcType=TIMESTAMP}, + end_time = #{endTime,jdbcType=TIMESTAMP}, + create_id = #{createId,jdbcType=BIGINT}, + dsc = #{dsc,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} + + diff --git a/src/main/resources/mybatis/mapper/permission/PermissionSubjectDAO.xml b/src/main/resources/mybatis/mapper/permission/PermissionSubjectDAO.xml index 49c61160f..0adf9a829 100644 --- a/src/main/resources/mybatis/mapper/permission/PermissionSubjectDAO.xml +++ b/src/main/resources/mybatis/mapper/permission/PermissionSubjectDAO.xml @@ -13,6 +13,7 @@ + @@ -74,7 +75,7 @@ id, permission_id, subject_type, subject_id, amount, remains, `status`, forever, - start_time, end_time, create_time + start_time, end_time, create_time, distribute_id @@ -239,6 +240,9 @@ create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + distribute_id = #{record.distributeId,jdbcType=BIGINT}, + @@ -256,7 +260,8 @@ forever = #{record.forever,jdbcType=BIT}, start_time = #{record.startTime,jdbcType=TIMESTAMP}, end_time = #{record.endTime,jdbcType=TIMESTAMP}, - create_time = #{record.createTime,jdbcType=TIMESTAMP} + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + distribute_id = #{record.distributeId,jdbcType=BIGINT} @@ -294,6 +299,9 @@ create_time = #{createTime,jdbcType=TIMESTAMP}, + + distribute_id = #{distributeId,jdbcType=BIGINT}, + where id = #{id,jdbcType=BIGINT} @@ -308,7 +316,8 @@ forever = #{forever,jdbcType=BIT}, start_time = #{startTime,jdbcType=TIMESTAMP}, end_time = #{endTime,jdbcType=TIMESTAMP}, - create_time = #{createTime,jdbcType=TIMESTAMP} + create_time = #{createTime,jdbcType=TIMESTAMP}, + distribute_id = #{distributeId,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT} - \ No newline at end of file + From 5a3179df5a6022f81e6a78192be903118d7e64aa Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 19 Oct 2022 11:16:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E4=BB=BF?= =?UTF-8?q?=E7=9C=9F=E5=88=9B=E5=BB=BA=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=9B=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90=E5=AD=90=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E6=8E=A5=E5=8F=A3=EF=BC=88=E6=9C=AA=E5=AE=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simulation/SimulationV1Controller.java | 6 +- .../mapSystem/RtsMapSystemServiceImpl.java | 401 ++++++++---------- .../simulation/cbtc/SimulationService.java | 4 +- .../cbtc/SimulationServiceImpl.java | 44 +- .../cbtc/bo/SimulationWorkParam.java | 73 ---- .../cbtc/build/InterlockBuilder2.java | 4 +- .../cbtc/vo/SimulationWorkParamVO.java | 38 +- .../EmergencySimulationWorkServiceImpl.java | 4 +- .../work/MetroSimulationWorkServiceImpl.java | 44 +- .../RailwaySimulationWorkServiceImpl.java | 11 +- .../cbtc/work/SimulationWorkService.java | 9 +- .../work/SimulationWorkServiceManager.java | 6 +- 12 files changed, 258 insertions(+), 386 deletions(-) delete mode 100644 src/main/java/club/joylink/rtss/simulation/cbtc/bo/SimulationWorkParam.java diff --git a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java index 2eca86411..659d1d046 100644 --- a/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java +++ b/src/main/java/club/joylink/rtss/controller/simulation/SimulationV1Controller.java @@ -481,11 +481,11 @@ public class SimulationV1Controller { /** * 新仿真创建接口(新) */ - @PostMapping("/new") - public String createSimulation(@RequestBody @Validated SimulationWorkParamVO paramVO, + @PostMapping("/new/{mapId}") + public String createSimulation(@PathVariable long mapId, @RequestBody @Validated SimulationWorkParamVO paramVO, @RequestAttribute(name = AuthenticateInterceptor.LOGIN_INFO_KEY) LoginUserInfoVO loginUserInfoVO) { - return simulationService.createSimulation(loginUserInfoVO, paramVO); + return simulationService.createSimulation(mapId, paramVO, loginUserInfoVO); } /** diff --git a/src/main/java/club/joylink/rtss/services/mapSystem/RtsMapSystemServiceImpl.java b/src/main/java/club/joylink/rtss/services/mapSystem/RtsMapSystemServiceImpl.java index fc0dc9771..e8af806f3 100644 --- a/src/main/java/club/joylink/rtss/services/mapSystem/RtsMapSystemServiceImpl.java +++ b/src/main/java/club/joylink/rtss/services/mapSystem/RtsMapSystemServiceImpl.java @@ -5,6 +5,7 @@ import club.joylink.rtss.entity.RtsMapSystem; import club.joylink.rtss.entity.RtsMapSystemExample; import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.services.IMapService; +import club.joylink.rtss.services.permission.SystemAbilityService; import club.joylink.rtss.simulation.cbtc.Simulation; import club.joylink.rtss.simulation.cbtc.member.SimulationMember; import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; @@ -15,6 +16,7 @@ import club.joylink.rtss.vo.map.graph.MapMemberVO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cglib.core.internal.Function; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; @@ -32,6 +34,8 @@ public class RtsMapSystemServiceImpl implements RtsMapSystemService { private RtsMapSystemDAO rtsMapSystemDAO; @Autowired private IMapService iMapService; + @Autowired + private SystemAbilityService systemAbilityService; @Override public void create(MapSystemCreateVO createVO, long creatorId) { @@ -91,244 +95,201 @@ public class RtsMapSystemServiceImpl implements RtsMapSystemService { List msgList = new ArrayList<>(); MapVO mapData = iMapService.getMapDetail(mapId); + + String msgPrefix; + List mapMemberVOS; + List> fillCreatVOFunctions; for (Simulation.Type simType : paramVO.getSimTypes()) { + mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType); + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS, + String.format("%s成员列表为空,不能生成子系统", simType)); switch (simType) { case METRO: - generateMetroSystem(mapId, mapData, creatorId, msgList); + msgPrefix = "地铁CBTC系统"; + fillCreatVOFunctions = buildMetroFillCreateVOFunctions(msgList, msgPrefix, simType, mapMemberVOS); break; case RAILWAY: - generateRailwaySystem(mapId, mapData, creatorId, msgList); + msgPrefix = "大铁CTC系统"; + fillCreatVOFunctions = buildRailwayFillCreateVOFunctions(msgList, msgPrefix, simType, mapMemberVOS); break; case EMERGENCY: - break; + throw BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.exception("未实现"); +// msgPrefix = "紧急调度系统"; +// fillCreatVOFunctions = Collections.emptyList(); default: throw new IllegalStateException("Unexpected value: " + simType); } + //填充参数并创建子系统 + for (Function fillParamFunction : fillCreatVOFunctions) { + MapSystemCreateVO createVO = new MapSystemCreateVO(); + createVO.setMapId(mapId); + MapSystemCreateVO filledCreateVO = fillParamFunction.apply(createVO); + if (filledCreateVO != null) { + create(createVO, creatorId); + } + } } - return null; + + return msgList; } - private void generateRailwaySystem(long mapId, MapVO mapData, long creatorId, List msgList) { - String msgPrefix = "大铁CTC系统"; - Simulation.Type simType = Simulation.Type.RAILWAY; - List mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS, - String.format("%s成员列表为空,不能生成子系统", msgPrefix)); - - MapSystemCreateVO createVO; - SimulationWorkParamVO workParamVO; - SimulationWorkParamVO.InitParamVO initParamVO; - SimulationWorkParamVO.DomConfigVO domConfigVO; - //调度台终端 - Optional dispatcherOptional = mapMemberVOS.stream() - .filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DISPATCHER)) - .findFirst(); - if (dispatcherOptional.isEmpty()) { - msgList.add(String.format("%s无行调角色,未生成调度台", msgPrefix)); - } else { - MapMemberVO mapMemberVO = dispatcherOptional.get(); - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc("调度台"); - createVO.setName("调度台"); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } - //车站 - Optional stationSupervisorOptional = mapMemberVOS.stream() - .filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.STATION_SUPERVISOR)) - .findFirst(); - if (stationSupervisorOptional.isEmpty()) { - msgList.add(String.format("%s无行值角色,未生成调度台", msgPrefix)); - } else { - MapMemberVO mapMemberVO = stationSupervisorOptional.get(); - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc("车站"); - createVO.setName("车站"); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } - } - - private void generateMetroSystem(long mapId, MapVO mapData, long creatorId, List msgList) { - String msgPrefix = "地铁CBTC系统"; - Simulation.Type simType = Simulation.Type.METRO; - List mapMemberVOS = mapData.getGraphDataNew().getMemberMap().get(simType); - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertCollectionNotEmpty(mapMemberVOS, - String.format("%s成员列表为空,不能生成子系统", msgPrefix)); - - MapSystemCreateVO createVO; - SimulationWorkParamVO workParamVO; - SimulationWorkParamVO.InitParamVO initParamVO; - SimulationWorkParamVO.DomConfigVO domConfigVO; - String name; - //行调工作站 - name = "行调工作站"; - Optional dispatcherOptional = mapMemberVOS.stream() - .filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DISPATCHER)) - .findFirst(); - if (dispatcherOptional.isEmpty()) { - msgList.add(String.format("%s无行调角色,未生成%s", msgPrefix, name)); - } else { - MapMemberVO mapMemberVO = dispatcherOptional.get(); - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } - //行值工作站 - name = "现地工作站"; - Optional stationSupervisorOptional = mapMemberVOS.stream() - .filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.STATION_SUPERVISOR)) - .findFirst(); - if (dispatcherOptional.isEmpty()) { - msgList.add(String.format("%s无行值角色,未生成%s", name)); - } else { - MapMemberVO mapMemberVO = stationSupervisorOptional.get(); - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), null); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } + /** + * 构建填充{@link MapSystemCreateVO}的方法 + * + * @param msgList 记录特殊但不算异常的信息 + * @param msgPrefix 特殊信息的统一前缀 + * @param simType 仿真类型 + * @param mapMemberVOS 地图成员列表 + * @return 调用apply方法时,当地图子系统的参数有问题无法创建子系统时,返回null,否则返回填充好所有参数的{@link MapSystemCreateVO} + */ + private List> buildMetroFillCreateVOFunctions(List msgList, String msgPrefix, Simulation.Type simType, List mapMemberVOS) { + List> fillFunctions = new ArrayList<>(); + //ATS行调工作站 + Function dispatchSystem = (vo) -> { + String name = "ATS行调工作站"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER)) + .findFirst(); + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无行调成员,未生成%s", msgPrefix, name)); + } else { + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); + workParamVO.setType(simType); + workParamVO.setMemberId(memberOptional.get().getId()); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(true, false, false)); + return vo; + } + return null; + }; + //ATS现地工作站 + Function stationSystem = (vo) -> { + String name = "ATS现地工作站"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR)) + .findFirst(); + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无行值成员,未生成%s", msgPrefix, name)); + } else { + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); + workParamVO.setType(simType); + workParamVO.setMemberId(memberOptional.get().getId()); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(true, false, false)); + return vo; + } + return null; + }; //司机模拟驾驶系统 - name = "司机模拟驾驶系统"; - Optional driverOptional = mapMemberVOS.stream() - .filter(vo -> Objects.equals(vo.getType(), SimulationMember.Type.DRIVER)) - .findFirst(); - if (driverOptional.isEmpty()) { - msgList.add(String.format("%s无司机角色,未生成%s", msgPrefix, name)); - } else { - MapMemberVO mapMemberVO = driverOptional.get(); - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(mapMemberVO.getId(), Simulation.Client.DRIVE); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } - //大屏工作站 - name = "大屏工作站"; - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.C_ATS_BS); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, true, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - //ISCS工作站 - name = "ISCS工作站"; - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.ISCS); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(true, true, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - //运行图编制工作站 - name = "运行图编制工作站"; - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); - workParamVO.setType(simType); - - initParamVO = new SimulationWorkParamVO.InitParamVO(null, Simulation.Client.RUN_PLAN_DESIGN); - workParamVO.setInitParam(initParamVO); - - domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, true, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); + Function driveSystem = (vo) -> { + String name = "司机模拟驾驶系统"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DRIVER)) + .findFirst(); + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无司机角色,未生成%s", msgPrefix, name)); + } else { + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); + workParamVO.setType(simType); + workParamVO.setMemberId(memberOptional.get().getId()); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(true, false, false)); + return vo; + } + return null; + }; //综合演练 - name = "综合演练"; - Optional memberOptional = mapMemberVOS.stream().findFirst(); - if (memberOptional.isEmpty()) { - msgList.add(String.format("%s无成员,未生成%s", msgPrefix, name)); - } else { - createVO = new MapSystemCreateVO(); - createVO.setMapId(mapId); - createVO.setDesc(name); - createVO.setName(name); - - workParamVO = new SimulationWorkParamVO(); - createVO.setParamVO(workParamVO); + Function joint = (vo) -> { + String name = "综合演练"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER)) + .findFirst(); + String memberId; + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无行调成员,%s未设置默认扮演成员", msgPrefix, name)); + memberId = null; + } else { + memberId = memberOptional.get().getId(); + } + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); workParamVO.setType(simType); + workParamVO.setMemberId(memberId); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(false, false, false)); + return vo; + }; - initParamVO = new SimulationWorkParamVO.InitParamVO(memberOptional.get().getId(), null); - workParamVO.setInitParam(initParamVO); + fillFunctions.add(dispatchSystem); + fillFunctions.add(stationSystem); + fillFunctions.add(driveSystem); + fillFunctions.add(joint); - domConfigVO = new SimulationWorkParamVO.DomConfigVO(false, false, false); - workParamVO.setDomConfig(domConfigVO); - create(createVO, creatorId); - } + return fillFunctions; + } + + /** + * 构建大铁填充{@link MapSystemCreateVO}的方法列表 + * + * @param msgList 记录特殊的,但是不算异常的信息 + * @param msgPrefix msgList内容的统一前缀 + * @param mapMemberVOS 地图数据中的成员列表 + * @return 调用apply方法时,当地图子系统的参数有问题无法创建子系统时,返回null,否则返回填充好所有参数的{@link MapSystemCreateVO} + */ + private List> buildRailwayFillCreateVOFunctions(List msgList, String msgPrefix, Simulation.Type simType, List mapMemberVOS) { + List> fillFunctions = new ArrayList<>(); + //调度台 + Function dispatchSystem = (vo) -> { + String name = "调度台"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.DISPATCHER)) + .findFirst(); + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无行调成员,未生成%s", msgPrefix, name)); + } else { + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); + workParamVO.setType(simType); + workParamVO.setMemberId(memberOptional.get().getId()); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(true, false, false)); + return vo; + } + return null; + }; + //车站 + Function stationSystem = (vo) -> { + String name = "车站"; + Optional memberOptional = mapMemberVOS.stream() + .filter(member -> Objects.equals(member.getType(), SimulationMember.Type.STATION_SUPERVISOR)) + .findFirst(); + if (memberOptional.isEmpty()) { + msgList.add(String.format("%s无行值成员,未生成%s", msgPrefix, name)); + } else { + vo.setName(name); + vo.setDesc(name); + SimulationWorkParamVO workParamVO = new SimulationWorkParamVO(); + vo.setParamVO(workParamVO); + workParamVO.setType(simType); + workParamVO.setMemberId(memberOptional.get().getId()); + workParamVO.setDomConfig(new SimulationWorkParamVO.DomConfigVO(true, false, false)); + return vo; + } + return null; + }; + + fillFunctions.add(dispatchSystem); + fillFunctions.add(stationSystem); + + return fillFunctions; } private Optional findEntityOptional(long id) { diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java index cd3cb576b..edce27bfe 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationService.java @@ -12,12 +12,12 @@ public interface SimulationService { /** * 创建仿真 */ - String createSimulation(@NonNull LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO); + String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO); /** * 给仿真添加功能 */ - void addFunctions(String simulationId, Map> functionMap, LoginUserInfoVO loginInfo); + void addFunctions(String simulationId, Map functionMap, LoginUserInfoVO loginInfo); /** * 从仿真中移除功能 diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java index 93b10c9e6..95a3a91c1 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/SimulationServiceImpl.java @@ -34,9 +34,9 @@ public class SimulationServiceImpl implements SimulationService { private DefaultMessageSender defaultMessageSender; @Override - public String createSimulation(@NonNull LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + public String createSimulation(long mapId, SimulationWorkParamVO workParamVO, @NonNull LoginUserInfoVO loginUserInfoVO) { SimulationWorkService initService = simulationWorkServiceManager.getInitService(workParamVO.getType()); - Simulation simulation = initService.create(loginUserInfoVO, workParamVO); + Simulation simulation = initService.create(mapId, workParamVO, loginUserInfoVO); LoginUserInfoVO loginUserInfo = simulation.getBuildParams().getLoginUserInfo(); if (Objects.nonNull(loginUserInfo)) { @@ -58,8 +58,8 @@ public class SimulationServiceImpl implements SimulationService { initService.addJobs(simulation); initService.addMessagePublisher(simulation); initService.init(simulation); - if (!CollectionUtils.isEmpty(workParamVO.getFunctionMap())) { - initService.addFunctions(simulation, workParamVO.getFunctionMap(), loginUserInfoVO); + if (!CollectionUtils.isEmpty(workParamVO.getFunctionInfoMap())) { + initService.addFunctions(simulation, workParamVO.getFunctionInfoMap(), loginUserInfoVO); } applicationContext.publishEvent(new SimulationCreateSuccessEvent(this, simulation)); @@ -69,27 +69,31 @@ public class SimulationServiceImpl implements SimulationService { } @Override - public void addFunctions(@NonNull String simulationId, Map> functionMap, LoginUserInfoVO loginInfo) { - Simulation simulation = simulationManager.getById(simulationId, Simulation.class); - addFunctions(simulation, functionMap, loginInfo); - } - - private void addFunctions(@NonNull Simulation simulation, Map> functionMap, LoginUserInfoVO loginInfo) { - if (!CollectionUtils.isEmpty(functionMap)) { + public void addFunctions(@NonNull String simulationId, Map functionInfoMap, LoginUserInfoVO loginInfo) { + if (!CollectionUtils.isEmpty(functionInfoMap)) { + Simulation simulation = simulationManager.getById(simulationId, Simulation.class); Simulation.Type simulationType = simulation.getType(); SimulationWorkService initService = simulationWorkServiceManager.getInitService(simulationType); if (StringUtils.hasText(simulation.getCreatorId())) { BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(), "非仿真创建者不能使用该功能"); } - initService.addFunctions(simulation, functionMap, loginInfo); + initService.addFunctions(simulation, functionInfoMap, loginInfo); } } @Override public void removeFunctions(@NonNull String simulationId, List functions, LoginUserInfoVO loginInfo) { - Simulation simulation = simulationManager.getById(simulationId, Simulation.class); - removeFunctions(simulation, functions, loginInfo); + if (!CollectionUtils.isEmpty(functions)) { + Simulation simulation = simulationManager.getById(simulationId, Simulation.class); + Simulation.Type simulationType = simulation.getType(); + SimulationWorkService initService = simulationWorkServiceManager.getInitService(simulationType); + if (StringUtils.hasText(simulation.getCreatorId())) { + BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(), + "非仿真创建者不能使用该功能"); + } + initService.removeFunctions(simulation, functions); + } } @Override @@ -105,16 +109,4 @@ public class SimulationServiceImpl implements SimulationService { SimulationWorkService initService = simulationWorkServiceManager.getInitService(simulation.getType()); initService.reset(simulation); } - - private void removeFunctions(@NonNull Simulation simulation, List functions, LoginUserInfoVO loginInfo) { - if (!CollectionUtils.isEmpty(functions)) { - Simulation.Type simulationType = simulation.getType(); - SimulationWorkService initService = simulationWorkServiceManager.getInitService(simulationType); - if (StringUtils.hasText(simulation.getCreatorId())) { - BusinessExceptionAssertEnum.OPERATION_NOT_SUPPORTED.assertEquals(loginInfo.getAccountVO().getIdStr(), simulation.getCreatorId(), - "非仿真创建者不能使用该功能"); - } - initService.removeFunctions(simulation, functions); - } - } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/bo/SimulationWorkParam.java b/src/main/java/club/joylink/rtss/simulation/cbtc/bo/SimulationWorkParam.java deleted file mode 100644 index 79c478447..000000000 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/bo/SimulationWorkParam.java +++ /dev/null @@ -1,73 +0,0 @@ -package club.joylink.rtss.simulation.cbtc.bo; - -import club.joylink.rtss.simulation.cbtc.Simulation; -import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; -import club.joylink.rtss.util.JsonUtils; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.ToString; -import org.springframework.util.CollectionUtils; - -import java.util.HashMap; -import java.util.Map; - -@Getter -public class SimulationWorkParam { - private Simulation.Type type; - - private SimulationWorkParamVO.InitParamVO initParam; - - /** - * 仿真所使用的功能 - */ - @JsonInclude(value = JsonInclude.Include.NON_NULL) - private Map functionMap; - - /** - * 前端控制元素显隐的配置 - */ - private SimulationWorkParamVO.DomConfigVO domConfig; - - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) - @JsonSubTypes({ - @JsonSubTypes.Type(value = TrainingFunctionParam.class, name = "TRAINING"), - @JsonSubTypes.Type(value = LPFFunctionParam.class, name = "LPF") - }) - @Getter - @ToString - public static abstract class FunctionParam { - } - - @Getter - @Setter - @NoArgsConstructor - public static class TrainingFunctionParam extends FunctionParam { - private Long trainingId; - } - - @Getter - @Setter - @NoArgsConstructor - public static class LPFFunctionParam extends FunctionParam { - private Long dataId; - } - - public SimulationWorkParam(SimulationWorkParamVO vo) { - this.type = vo.getType(); - this.initParam = vo.getInitParam(); - Map> voFunctionMap = vo.getFunctionMap(); - if (!CollectionUtils.isEmpty(voFunctionMap)) { - this.functionMap = new HashMap<>(); - for (Map.Entry> entry : voFunctionMap.entrySet()) { - String json = JsonUtils.writeValueAsString(entry); - FunctionParam param = JsonUtils.read(json, FunctionParam.class); - this.functionMap.put(entry.getKey(), param); - } - } - this.domConfig = vo.getDomConfig(); - } -} diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java index 500eee4ec..ef869eed8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/build/InterlockBuilder2.java @@ -31,7 +31,7 @@ public class InterlockBuilder2 { static void checkAndBuildMapCILogicData(MapVO map, SimulationBuilder.SimulationDeviceBuildResult mapDataBuildResult) { MapLogicDataNewVO logicData = map.getLogicDataNew(); MapGraphDataNewVO graphData = map.getGraphDataNew(); - boolean railway = map.getConfigVO().isRailway(); + MapCiGenerateConfig generateConfig = graphData.getGenerateConfig(); Map elementMap = mapDataBuildResult.getDeviceMap(); List errMsgList = mapDataBuildResult.getErrMsgList(); @@ -49,7 +49,7 @@ public class InterlockBuilder2 { // 接近区段 InterlockBuilder2.buildApproachSections(logicData, elementMap, errMsgList); // ------------进路start------------- - if (railway) { + if (generateConfig != null && generateConfig.isRailway()) { InterlockBuilder2.buildRailRoute(graphData, logicData, elementMap, errMsgList, flsMap); } else { InterlockBuilder2.buildRoute(logicData, elementMap, errMsgList, flsMap); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/vo/SimulationWorkParamVO.java b/src/main/java/club/joylink/rtss/simulation/cbtc/vo/SimulationWorkParamVO.java index d53a069b9..36265fa42 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/vo/SimulationWorkParamVO.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/vo/SimulationWorkParamVO.java @@ -17,48 +17,51 @@ import java.util.Map; @Setter @NoArgsConstructor public class SimulationWorkParamVO { - private Long mapId; - @NotNull(message = "仿真类型不能为空") private Simulation.Type type; - private InitParamVO initParam; + /** + * 创建仿真时默认扮演的成员的id + */ + private String memberId; + + /** + * 创建仿真时默认使用的客户端 + */ + private Simulation.Client client; /** * 仿真所使用的功能 */ @JsonInclude(value = JsonInclude.Include.NON_NULL) - private Map> functionMap; + private Map functionInfoMap; /** - * 前端控制元素显隐的配置(后端暂时用不到,所以先用Map接收) + * 前端控制元素显隐的配置 */ private DomConfigVO domConfig; - public void addFunctionInfos(@NonNull Map> functionMap) { - if (CollectionUtils.isEmpty(this.functionMap)) { - this.functionMap = new LinkedHashMap<>(); + public void addFunctionInfos(@NonNull Map functionMap) { + if (CollectionUtils.isEmpty(this.functionInfoMap)) { + this.functionInfoMap = new LinkedHashMap<>(); } - this.functionMap.putAll(functionMap); + this.functionInfoMap.putAll(functionMap); } public void removeFunctions(Collection functions) { - if (!CollectionUtils.isEmpty(functionMap)) { - functions.forEach(function -> functionMap.remove(function)); + if (!CollectionUtils.isEmpty(functionInfoMap)) { + functions.forEach(function -> functionInfoMap.remove(function)); } } - /** - * 使用方式参数 - */ @Getter @Setter @NoArgsConstructor @AllArgsConstructor - public static class InitParamVO { - private String memberId; + public static class FunctionInfoVO { + private Simulation.Function function; - private Simulation.Client client; + private Long id; } @Getter @@ -72,5 +75,4 @@ public class SimulationWorkParamVO { private boolean hasTraining; } - } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/work/EmergencySimulationWorkServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/work/EmergencySimulationWorkServiceImpl.java index 7feb20949..5372d374a 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/work/EmergencySimulationWorkServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/work/EmergencySimulationWorkServiceImpl.java @@ -19,7 +19,7 @@ public class EmergencySimulationWorkServiceImpl implements SimulationWorkService } @Override - public Simulation create(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + public Simulation create(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO) { return null; } @@ -54,7 +54,7 @@ public class EmergencySimulationWorkServiceImpl implements SimulationWorkService } @Override - public void addFunctions(Simulation simulation, Map> functionMap, LoginUserInfoVO loginInfo) { + public void addFunctions(Simulation simulation, Map functionInfoMap, LoginUserInfoVO loginInfo) { } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/work/MetroSimulationWorkServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/work/MetroSimulationWorkServiceImpl.java index 21bbb7de1..b56481bdd 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/work/MetroSimulationWorkServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/work/MetroSimulationWorkServiceImpl.java @@ -26,7 +26,6 @@ import club.joylink.rtss.simulation.cbtc.depot.DepotService; import club.joylink.rtss.simulation.cbtc.device.virtual.VRDeviceLogicLoop; import club.joylink.rtss.simulation.cbtc.device.virtual.VRTrainRunningService; import club.joylink.rtss.simulation.cbtc.fault.FaultGenerator; -import club.joylink.rtss.simulation.cbtc.member.MemberManager; import club.joylink.rtss.simulation.cbtc.member.SimulationUser; import club.joylink.rtss.simulation.cbtc.onboard.ATP.ATPLogicLoop; import club.joylink.rtss.simulation.cbtc.onboard.TrainTargetUpdateService; @@ -35,10 +34,8 @@ import club.joylink.rtss.simulation.cbtc.passenger.strategy.LargePassengerFlowSt import club.joylink.rtss.simulation.cbtc.pis.PisLogicLoop; import club.joylink.rtss.simulation.cbtc.robot.SimulationRobotService; import club.joylink.rtss.simulation.cbtc.vo.SimulationWorkParamVO; -import club.joylink.rtss.simulation.cbtc.vo.TrainingParamVO; import club.joylink.rtss.simulation.rt.iscs.IscsStatusPublisher; import club.joylink.rtss.simulation.rt.pis.PisStatusPublisher; -import club.joylink.rtss.util.JsonUtils; import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.client.CommandDefinitionVO; import club.joylink.rtss.vo.client.iscs.device.IscsDeviceVO; @@ -87,8 +84,6 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { @Autowired private IscsSystemResourcesService iscsSystemResourcesService; @Autowired - private MemberManager memberManager; - @Autowired private DeviceStatusService deviceStatusService; @Autowired private DepotService depotService; @@ -143,10 +138,10 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { } @Override - public Simulation create(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + public Simulation create(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO) { checkParam(workParamVO); - SimulationBuildParams params = prepareSimulationParams(loginUserInfoVO, workParamVO); - String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), workParamVO.getMapId()); + SimulationBuildParams params = prepareSimulationParams(mapId, workParamVO, loginUserInfoVO); + String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId); Simulation simulation = new Simulation(group); simulation.setBuildParams(params); return simulation; @@ -215,13 +210,13 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { @Override public void runAsPlan(Simulation simulation, RunAsPlanParam param) { SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO(); - Map> functionMap = workParamVO.getFunctionMap(); + Map functionMap = workParamVO.getFunctionInfoMap(); if (CollectionUtils.isEmpty(functionMap)) { groupSimulationService.runAsPlan(simulation.getId(), param); } else { - for (Map.Entry> entry : functionMap.entrySet()) { + for (Map.Entry entry : functionMap.entrySet()) { Simulation.Function function = entry.getKey(); - Map funcParam = entry.getValue(); + SimulationWorkParamVO.FunctionInfoVO info = entry.getValue(); switch (function) { case LPF: boolean initSuccess = passengerFlowSimulateService.initPassengerFlow(simulation); @@ -246,11 +241,11 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { simulationLifeCycleService.reset(simulation); SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO(); - Map> functionMap = workParamVO.getFunctionMap(); + Map functionMap = workParamVO.getFunctionInfoMap(); if (!CollectionUtils.isEmpty(functionMap)) { - for (Map.Entry> entry : functionMap.entrySet()) { + for (Map.Entry entry : functionMap.entrySet()) { Simulation.Function function = entry.getKey(); - Map funcParam = entry.getValue(); + SimulationWorkParamVO.FunctionInfoVO info = entry.getValue(); switch (function) { case LPF: passengerFlowSimulateService.simulationReset(simulation); @@ -270,10 +265,10 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { } @Override - public void addFunctions(Simulation simulation, Map> functionMap, LoginUserInfoVO loginInfo) { - for (Map.Entry> entry : functionMap.entrySet()) { + public void addFunctions(Simulation simulation, Map functionInfoMap, LoginUserInfoVO loginInfo) { + for (Map.Entry entry : functionInfoMap.entrySet()) { Simulation.Function function = entry.getKey(); - Map param = entry.getValue(); + SimulationWorkParamVO.FunctionInfoVO info = entry.getValue(); switch (function) { case LPF: break; @@ -282,10 +277,8 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { case TRAINING_DESIGN: break; case TRAINING: - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertMapNotEmpty(param, "参数不能为空"); - TrainingParamVO paramVO = JsonUtils.read(JsonUtils.writeValueAsString(param), TrainingParamVO.class); - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(paramVO.getTrainingId(), "参数不能为空"); - iTrainingV1Service.loadTraining(simulation.getId(), paramVO.getTrainingId(), loginInfo.getAccountVO()); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(info, "参数不能为空"); + iTrainingV1Service.loadTraining(simulation.getId(), info.getId(), loginInfo.getAccountVO()); break; case EXAM: break; @@ -293,7 +286,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { throw new IllegalStateException("Unexpected value: " + function); } } - simulation.getBuildParams().getWorkParamVO().addFunctionInfos(functionMap); + simulation.getBuildParams().getWorkParamVO().addFunctionInfos(functionInfoMap); } @Override @@ -375,9 +368,8 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { SimulationBuilder.loadDepotInOutRoutePath(simulation); } - private SimulationBuildParams prepareSimulationParams(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + private SimulationBuildParams prepareSimulationParams(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO) { // 获取地图数据 - Long mapId = workParamVO.getMapId(); MapVO mapVO = iMapService.getMapDetail(mapId); List runLevelList = this.prepareRunLevelData(loginUserInfoVO, mapId); List parkTimeList = this.prepareParkTimeData(loginUserInfoVO, mapId); @@ -416,7 +408,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { RunPlanLoadVO loadPlan = null; Simulation.Type type = createParamVO.getType(); if (Simulation.Type.METRO == type) { - Map> functionMap = createParamVO.getFunctionMap(); + Map functionMap = createParamVO.getFunctionInfoMap(); if (CollectionUtils.isEmpty(functionMap)) { //优先使用用户的运行图 loadPlan = iLoadPlanService.findUserLoadPlan(userId, mapId, runPlanDate); @@ -424,7 +416,7 @@ public class MetroSimulationWorkServiceImpl implements SimulationWorkService { loadPlan = iLoadPlanService.findCommonLoadPlanOfMap(mapId); } } else { - for (Map.Entry> entry : functionMap.entrySet()) { + for (Map.Entry entry : functionMap.entrySet()) { Simulation.Function function = entry.getKey(); switch (function) { case LPF: diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/work/RailwaySimulationWorkServiceImpl.java b/src/main/java/club/joylink/rtss/simulation/cbtc/work/RailwaySimulationWorkServiceImpl.java index b87231462..9c1668537 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/work/RailwaySimulationWorkServiceImpl.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/work/RailwaySimulationWorkServiceImpl.java @@ -82,10 +82,10 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService { } @Override - public Simulation create(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + public Simulation create(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO) { checkParam(workParamVO); - SimulationBuildParams params = prepareSimulationParams(loginUserInfoVO, workParamVO); - String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), workParamVO.getMapId()); + SimulationBuildParams params = prepareSimulationParams(loginUserInfoVO, workParamVO, mapId); + String group = SimulationIdGenerator.generateGroup(loginUserInfoVO.getAccountVO().getId(), mapId); Simulation simulation = new Simulation(group); simulation.setBuildParams(params); return simulation; @@ -143,7 +143,7 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService { } @Override - public void addFunctions(Simulation simulation, Map> functionMap, LoginUserInfoVO loginInfo) { + public void addFunctions(Simulation simulation, Map functionInfoMap, LoginUserInfoVO loginInfo) { } @@ -152,9 +152,8 @@ public class RailwaySimulationWorkServiceImpl implements SimulationWorkService { } - private SimulationBuildParams prepareSimulationParams(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO) { + private SimulationBuildParams prepareSimulationParams(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO, long mapId) { // 获取地图数据 - Long mapId = workParamVO.getMapId(); MapVO mapVO = iMapService.getMapDetail(mapId); // 获取操作定义数据 List operationDefinitionList = iCommandService diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkService.java b/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkService.java index 633d2454b..f60881551 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkService.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkService.java @@ -14,7 +14,7 @@ import java.util.Map; public interface SimulationWorkService { Simulation.Type getType(); - Simulation create(LoginUserInfoVO loginUserInfoVO, SimulationWorkParamVO workParamVO); + Simulation create(long mapId, SimulationWorkParamVO workParamVO, LoginUserInfoVO loginUserInfoVO); void loadData(Simulation simulation); @@ -28,7 +28,7 @@ public interface SimulationWorkService { void reset(Simulation simulation); - void addFunctions(Simulation simulation, Map> functionMap, LoginUserInfoVO loginInfo); + void addFunctions(Simulation simulation, Map functionInfoMap, LoginUserInfoVO loginInfo); void removeFunctions(Simulation simulation, Collection functions); @@ -37,9 +37,8 @@ public interface SimulationWorkService { */ default void checkParam(@NonNull SimulationWorkParamVO workParamVO) { BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO, "仿真工作参数不能为空"); - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO.getMapId(), "仿真线路id不能为空"); BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotNull(workParamVO.getType(), "仿真类型不能为空"); - BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(!CollectionUtils.isEmpty(workParamVO.getFunctionMap()) - && workParamVO.getFunctionMap().size() > 1, "功能数量超限"); + BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.assertNotTrue(!CollectionUtils.isEmpty(workParamVO.getFunctionInfoMap()) + && workParamVO.getFunctionInfoMap().size() > 1, "功能数量超限"); } } diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkServiceManager.java b/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkServiceManager.java index e7fa98ef1..c1d193ac8 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkServiceManager.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/work/SimulationWorkServiceManager.java @@ -77,10 +77,10 @@ public class SimulationWorkServiceManager implements ApplicationContextAware { */ public void playMember(Simulation simulation) { SimulationWorkParamVO workParamVO = simulation.getBuildParams().getWorkParamVO(); - SimulationWorkParamVO.InitParamVO initParamVO = workParamVO.getInitParam(); - if (initParamVO != null && initParamVO.getMemberId() != null) { + String memberId = workParamVO.getMemberId(); + if (StringUtils.hasText(memberId)) { Long creatorId = simulation.getBuildParams().getLoginUserInfo().getAccountVO().getId(); - memberManager.playRole(simulation, creatorId, initParamVO.getMemberId()); + memberManager.playRole(simulation, creatorId, memberId); } } } From ef389ca8f43f14f2b4fff832fdc8e3407c9e9cca Mon Sep 17 00:00:00 2001 From: joylink_zhangsai <1021828630@qq.com> Date: Wed, 19 Oct 2022 13:34:23 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=90=E8=A1=8C=E5=9B=BE=E4=BA=A4=E8=B7=AF?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../joylink/rtss/dao/RunPlanRoutingDAO.java | 18 +++++++++-- .../joylink/rtss/services/ReleaseService.java | 32 ++++++++++--------- .../data/SimulationIscsDataRepository.java | 6 ++++ .../joylink/rtss/vo/client/ReleaseVO.java | 2 ++ 4 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java b/src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java index a02e89bb9..2c1ef4d45 100644 --- a/src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java +++ b/src/main/java/club/joylink/rtss/dao/RunPlanRoutingDAO.java @@ -2,12 +2,13 @@ package club.joylink.rtss.dao; import club.joylink.rtss.entity.RunPlanRouting; import club.joylink.rtss.entity.RunPlanRoutingExample; -import java.util.List; +import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; -import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.Select; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface RunPlanRoutingDAO { long countByExample(RunPlanRoutingExample example); @@ -52,4 +53,17 @@ public interface RunPlanRoutingDAO { "") Integer countUserRoutingBySectionData(@Param("userId") Long userId, @Param("mapId") Long mapId, @Param("sectionData") String sectionData); + @Insert("") + void batchInsert(List routings); } diff --git a/src/main/java/club/joylink/rtss/services/ReleaseService.java b/src/main/java/club/joylink/rtss/services/ReleaseService.java index 9ba3bcedd..972b65eee 100644 --- a/src/main/java/club/joylink/rtss/services/ReleaseService.java +++ b/src/main/java/club/joylink/rtss/services/ReleaseService.java @@ -24,51 +24,38 @@ import java.util.stream.Collectors; public class ReleaseService implements IReleaseService { @Autowired private MapDataDAO mapDataDAO; - @Autowired private RunPlanTemplateDAO runPlanTemplateDAO; - @Autowired private RunPlanLoadDAO runPlanLoadDAO; - @Autowired private Map3dDataDAO map3dDataDAO; - @Autowired private IMapService iMapService; - @Autowired private CommandDefinitionDAO commandDefinitionDAO; - @Autowired private RealLineDAO realLineDAO; - @Autowired private SchedulingPlanDAO schedulingPlanDAO; - @Autowired private RunPlanTemplateVersionDAO runPlanTemplateVersionDAO; - @Autowired private IbpDAO ibpDAO; - @Autowired private CacheController cacheController; - @Autowired private ScriptDraftDAO scriptDraftDAO; - @Autowired private ScriptDAO scriptDAO; - @Autowired private CompetitionDAO competitionDAO; - @Autowired private IscsDAO iscsDAO; - @Autowired private IRunPlanTemplateService iRunPlanTemplateService; + @Autowired + private RunPlanRoutingDAO runPlanRoutingDAO; @Override public ReleaseVO exportAsJson(Long mapId, ReleaseConfigVO config) { @@ -77,6 +64,11 @@ public class ReleaseService implements IReleaseService { ReleaseVO releaseVO = new ReleaseVO(mapId, lineCode); if (config.isMapData()) { //地图数据 releaseVO.setMapData(getMapDataWithBLOBs(mapId, mapInfo.getVersion())); + // 默认运行图交路数据 + RunPlanRoutingExample example = new RunPlanRoutingExample(); + example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull(); + List runPlanRoutings = runPlanRoutingDAO.selectByExampleWithBLOBs(example); + releaseVO.setRunPlanRoutings(runPlanRoutings); } if (config.isRealLineConfig()) { //线路配置 RealLineExample realLineExample = new RealLineExample(); @@ -197,6 +189,16 @@ public class ReleaseService implements IReleaseService { cacheController.remove(BusinessConsts.CachePrefix.Map + mapId); } + //更新运行图交路数据 + if (!CollectionUtils.isEmpty(releaseVO.getRunPlanRoutings())) { + // 默认运行图交路数据 + RunPlanRoutingExample example = new RunPlanRoutingExample(); + example.createCriteria().andMapIdEqualTo(mapId).andUserIdIsNull(); + runPlanRoutingDAO.deleteByExample(example); + releaseVO.getRunPlanRoutings().forEach(routing -> routing.setMapId(mapId)); + runPlanRoutingDAO.batchInsert(releaseVO.getRunPlanRoutings()); + } + if (!CollectionUtils.isEmpty(releaseVO.getRunPlanTemplateList())) { //删除旧的运行图相关数据 RunPlanTemplateExample runPlanTemplateExample = new RunPlanTemplateExample(); diff --git a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationIscsDataRepository.java b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationIscsDataRepository.java index 3ff158505..d5732a222 100644 --- a/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationIscsDataRepository.java +++ b/src/main/java/club/joylink/rtss/simulation/cbtc/data/SimulationIscsDataRepository.java @@ -42,8 +42,14 @@ public class SimulationIscsDataRepository { */ private final Map standPisMap = new HashMap<>(); + /** + * k - groupNumber + */ private final Map onboardPisStatusMap = new HashMap<>(); + /** + * k - standCode + */ private final Map standPisStatusMap = new HashMap<>(); private final List timedPlayParamVOS = new ArrayList<>(); diff --git a/src/main/java/club/joylink/rtss/vo/client/ReleaseVO.java b/src/main/java/club/joylink/rtss/vo/client/ReleaseVO.java index d011e5a62..e5d34219b 100644 --- a/src/main/java/club/joylink/rtss/vo/client/ReleaseVO.java +++ b/src/main/java/club/joylink/rtss/vo/client/ReleaseVO.java @@ -65,6 +65,8 @@ public class ReleaseVO { private List competitions; + private List runPlanRoutings; + public ReleaseVO(Long mapId, String realLineCode) { this.mapId = mapId; this.realLineCode = realLineCode; From d454a2a51c9f2b5fd3e432da762dd114b903c11b Mon Sep 17 00:00:00 2001 From: tiger_zhou <123456> Date: Wed, 19 Oct 2022 13:39:25 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E6=9D=83=E9=99=90=E5=88=86?= =?UTF-8?q?=E5=8F=91=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/permission/PermissionSubject.java | 13 +++++------- .../IPermissionDistributeService.java | 20 ------------------- .../permission/IPermissionSubjectService.java | 4 ---- .../PermissionDistributeServiceImpl.java | 20 ------------------- .../PermissionSubjectServiceImpl.java | 14 ------------- 5 files changed, 5 insertions(+), 66 deletions(-) delete mode 100644 src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java delete mode 100644 src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java delete mode 100644 src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java delete mode 100644 src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java diff --git a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java index 386a62f5a..80f4aca45 100644 --- a/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java +++ b/src/main/java/club/joylink/rtss/entity/permission/PermissionSubject.java @@ -1,6 +1,7 @@ package club.joylink.rtss.entity.permission; import java.io.Serializable; +import java.time.LocalDateTime; import java.util.Date; import lombok.Data; @@ -53,27 +54,23 @@ public class PermissionSubject implements Serializable { /** * 开始时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 结束时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 创建时间 */ - private Date createTime; - - /** - * 来自对应的分发id(rts_permission_distribute) - */ - private Long distributeId; + private LocalDateTime createTime; /** * 来自对应的分发id(rts_permission_distribute) */ private Long distributeId; +; private static final long serialVersionUID = 1L; } diff --git a/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java b/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java deleted file mode 100644 index 5fe6d353e..000000000 --- a/src/main/java/club/joylink/rtss/services/permission/IPermissionDistributeService.java +++ /dev/null @@ -1,20 +0,0 @@ -package club.joylink.rtss.services.permission; - -import club.joylink.rtss.vo.LoginUserInfoVO; -import club.joylink.rtss.vo.permission.PermissionDistributeVO; - -public interface IPermissionDistributeService { - - /** - * 分发权限 - * @param vo - * @param userInfoVO - */ - void distributePermission(PermissionDistributeVO vo , LoginUserInfoVO userInfoVO); - - /** - * 领取权限 - */ - void requestDistributePer(); - -} diff --git a/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java b/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java deleted file mode 100644 index 203327a77..000000000 --- a/src/main/java/club/joylink/rtss/services/permission/IPermissionSubjectService.java +++ /dev/null @@ -1,4 +0,0 @@ -package club.joylink.rtss.services.permission; - -public interface IPermissionSubjectService { -} diff --git a/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java b/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java deleted file mode 100644 index 8ddea4d15..000000000 --- a/src/main/java/club/joylink/rtss/services/permission/PermissionDistributeServiceImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package club.joylink.rtss.services.permission; - -import club.joylink.rtss.dao.permission.PermissionDistributeDAO; -import club.joylink.rtss.services.QRCodeManager; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -@Service -@Slf4j -public class PermissionDistributeServiceImpl implements IPermissionDistributeService{ - @Resource - private PermissionDistributeDAO distributeDAO; - @Resource - private QRCodeManager qrCodeManager; - - - -} diff --git a/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java b/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java deleted file mode 100644 index 143bd6f77..000000000 --- a/src/main/java/club/joylink/rtss/services/permission/PermissionSubjectServiceImpl.java +++ /dev/null @@ -1,14 +0,0 @@ -package club.joylink.rtss.services.permission; - -import club.joylink.rtss.dao.permission.PermissionSubjectDAO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -@Service -@Slf4j -public class PermissionSubjectServiceImpl implements IPermissionSubjectService{ - @Resource - private PermissionSubjectDAO subjectDAO; -}