diff --git a/game/src/main/resources/druid-test.yml b/game/src/main/resources/druid-test.yml index 579863aa..bc9a6a82 100644 --- a/game/src/main/resources/druid-test.yml +++ b/game/src/main/resources/druid-test.yml @@ -28,6 +28,6 @@ spring: testWhileIdle: true timeBetweenEvictionRunsMillis: 60000 url: jdbc:mysql://127.0.0.1/game?useUnicode=true&characterEncoding=UTF-8 - rname: root + username: root validationQuery: SELECT 1 FROM DUAL env: CCSENS_GAME \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/dto/RingDto.java b/tall/src/main/java/com/ccsens/tall/bean/dto/RingDto.java new file mode 100644 index 00000000..a24cd121 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/dto/RingDto.java @@ -0,0 +1,45 @@ +package com.ccsens.tall.bean.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +@Data +public class RingDto { + + @Data + @ApiModel("发送ring消息") + public static class RingSendDto { + @NotNull(message = "项目id不能为空") + @ApiModelProperty("项目id") + private Long projectId; + @ApiModelProperty("消息内容") + private String value; + @ApiModelProperty("接收的角色的id") + private List roleList; + } + + @Data + @ApiModel("查找ring消息") + public static class GetRingDto { + @NotNull(message = "项目id不能为空") + @ApiModelProperty("项目id") + private Long projectId; + @ApiModelProperty("页数") + private Integer page; + @ApiModelProperty("每页数量") + private Integer pageSize; + } + + @Data + @ApiModel("将消息设为已读") + public static class MessageId { + @ApiModelProperty("项目id") + private Long projectId; + @ApiModelProperty("消息id") + private List messageIdList; + } +} diff --git a/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java b/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java index 8a6f7628..2943fc46 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java +++ b/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithReadDto.java @@ -11,6 +11,8 @@ public class RingMessageWithReadDto extends BaseMessageDto{ @Getter public static class Data{ private Long msgId; + private Long projectId; + private Long roleId; } private Data data; @@ -21,10 +23,12 @@ public class RingMessageWithReadDto extends BaseMessageDto{ setTime(System.currentTimeMillis()); } - public RingMessageWithReadDto(Long msgId){ + public RingMessageWithReadDto(Long msgId,Long projectId,Long roleId){ this(); Data d = new Data(); d.setMsgId(msgId); + d.setProjectId(projectId); + d.setRoleId(roleId); setData(d); } } diff --git a/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithSendDto.java b/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithSendDto.java index b4096a83..9c74f25f 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithSendDto.java +++ b/tall/src/main/java/com/ccsens/tall/bean/dto/message/RingMessageWithSendDto.java @@ -12,7 +12,9 @@ public class RingMessageWithSendDto extends BaseMessageDto{ @Getter public static class Data{ private Long msgId; + private Long projectId; private String text; + private Long sendTime; } private Data data; @@ -23,11 +25,13 @@ public class RingMessageWithSendDto extends BaseMessageDto{ setTime(System.currentTimeMillis()); } - public RingMessageWithSendDto(Long msgId,String text){ + public RingMessageWithSendDto(Long msgId,Long projectId,String text,Long sendTime){ this(); Data d = new Data(); d.setMsgId(msgId); + d.setProjectId(projectId); d.setText(text); + d.setSendTime(sendTime); setData(d); } } diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsg.java b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsg.java new file mode 100644 index 00000000..56359985 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsg.java @@ -0,0 +1,117 @@ +package com.ccsens.tall.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysRingMsg implements Serializable { + private Long id; + + private Long projectId; + + private String value; + + private Long senderId; + + private Long time; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private String valueText; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getProjectId() { + return projectId; + } + + public void setProjectId(Long projectId) { + this.projectId = projectId; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value == null ? null : value.trim(); + } + + public Long getSenderId() { + return senderId; + } + + public void setSenderId(Long senderId) { + this.senderId = senderId; + } + + public Long getTime() { + return time; + } + + public void setTime(Long time) { + this.time = time; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + public String getValueText() { + return valueText; + } + + public void setValueText(String valueText) { + this.valueText = valueText == null ? null : valueText.trim(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", projectId=").append(projectId); + sb.append(", value=").append(value); + sb.append(", senderId=").append(senderId); + sb.append(", time=").append(time); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append(", valueText=").append(valueText); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsgExample.java b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsgExample.java new file mode 100644 index 00000000..2bf206e2 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingMsgExample.java @@ -0,0 +1,691 @@ +package com.ccsens.tall.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysRingMsgExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysRingMsgExample() { + 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; + } + + 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 andProjectIdIsNull() { + addCriterion("project_id is null"); + return (Criteria) this; + } + + public Criteria andProjectIdIsNotNull() { + addCriterion("project_id is not null"); + return (Criteria) this; + } + + public Criteria andProjectIdEqualTo(Long value) { + addCriterion("project_id =", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotEqualTo(Long value) { + addCriterion("project_id <>", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThan(Long value) { + addCriterion("project_id >", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdGreaterThanOrEqualTo(Long value) { + addCriterion("project_id >=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThan(Long value) { + addCriterion("project_id <", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdLessThanOrEqualTo(Long value) { + addCriterion("project_id <=", value, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdIn(List values) { + addCriterion("project_id in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotIn(List values) { + addCriterion("project_id not in", values, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdBetween(Long value1, Long value2) { + addCriterion("project_id between", value1, value2, "projectId"); + return (Criteria) this; + } + + public Criteria andProjectIdNotBetween(Long value1, Long value2) { + addCriterion("project_id not between", value1, value2, "projectId"); + return (Criteria) this; + } + + public Criteria andValueIsNull() { + addCriterion("value is null"); + return (Criteria) this; + } + + public Criteria andValueIsNotNull() { + addCriterion("value is not null"); + return (Criteria) this; + } + + public Criteria andValueEqualTo(String value) { + addCriterion("value =", value, "value"); + return (Criteria) this; + } + + public Criteria andValueNotEqualTo(String value) { + addCriterion("value <>", value, "value"); + return (Criteria) this; + } + + public Criteria andValueGreaterThan(String value) { + addCriterion("value >", value, "value"); + return (Criteria) this; + } + + public Criteria andValueGreaterThanOrEqualTo(String value) { + addCriterion("value >=", value, "value"); + return (Criteria) this; + } + + public Criteria andValueLessThan(String value) { + addCriterion("value <", value, "value"); + return (Criteria) this; + } + + public Criteria andValueLessThanOrEqualTo(String value) { + addCriterion("value <=", value, "value"); + return (Criteria) this; + } + + public Criteria andValueLike(String value) { + addCriterion("value like", value, "value"); + return (Criteria) this; + } + + public Criteria andValueNotLike(String value) { + addCriterion("value not like", value, "value"); + return (Criteria) this; + } + + public Criteria andValueIn(List values) { + addCriterion("value in", values, "value"); + return (Criteria) this; + } + + public Criteria andValueNotIn(List values) { + addCriterion("value not in", values, "value"); + return (Criteria) this; + } + + public Criteria andValueBetween(String value1, String value2) { + addCriterion("value between", value1, value2, "value"); + return (Criteria) this; + } + + public Criteria andValueNotBetween(String value1, String value2) { + addCriterion("value not between", value1, value2, "value"); + return (Criteria) this; + } + + public Criteria andSenderIdIsNull() { + addCriterion("sender_id is null"); + return (Criteria) this; + } + + public Criteria andSenderIdIsNotNull() { + addCriterion("sender_id is not null"); + return (Criteria) this; + } + + public Criteria andSenderIdEqualTo(Long value) { + addCriterion("sender_id =", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdNotEqualTo(Long value) { + addCriterion("sender_id <>", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdGreaterThan(Long value) { + addCriterion("sender_id >", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdGreaterThanOrEqualTo(Long value) { + addCriterion("sender_id >=", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdLessThan(Long value) { + addCriterion("sender_id <", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdLessThanOrEqualTo(Long value) { + addCriterion("sender_id <=", value, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdIn(List values) { + addCriterion("sender_id in", values, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdNotIn(List values) { + addCriterion("sender_id not in", values, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdBetween(Long value1, Long value2) { + addCriterion("sender_id between", value1, value2, "senderId"); + return (Criteria) this; + } + + public Criteria andSenderIdNotBetween(Long value1, Long value2) { + addCriterion("sender_id not between", value1, value2, "senderId"); + return (Criteria) this; + } + + public Criteria andTimeIsNull() { + addCriterion("time is null"); + return (Criteria) this; + } + + public Criteria andTimeIsNotNull() { + addCriterion("time is not null"); + return (Criteria) this; + } + + public Criteria andTimeEqualTo(Long value) { + addCriterion("time =", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotEqualTo(Long value) { + addCriterion("time <>", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThan(Long value) { + addCriterion("time >", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeGreaterThanOrEqualTo(Long value) { + addCriterion("time >=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThan(Long value) { + addCriterion("time <", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeLessThanOrEqualTo(Long value) { + addCriterion("time <=", value, "time"); + return (Criteria) this; + } + + public Criteria andTimeIn(List values) { + addCriterion("time in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotIn(List values) { + addCriterion("time not in", values, "time"); + return (Criteria) this; + } + + public Criteria andTimeBetween(Long value1, Long value2) { + addCriterion("time between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andTimeNotBetween(Long value1, Long value2) { + addCriterion("time not between", value1, value2, "time"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + 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); + } + } +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSend.java b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSend.java new file mode 100644 index 00000000..9f78d722 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSend.java @@ -0,0 +1,106 @@ +package com.ccsens.tall.bean.po; + +import java.io.Serializable; +import java.util.Date; + +public class SysRingSend implements Serializable { + private Long id; + + private Long ringId; + + private Long roleId; + + private Byte readStatus; + + private Date createdAt; + + private Date updatedAt; + + private Byte recStatus; + + private Long readTime; + + private static final long serialVersionUID = 1L; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getRingId() { + return ringId; + } + + public void setRingId(Long ringId) { + this.ringId = ringId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public Byte getReadStatus() { + return readStatus; + } + + public void setReadStatus(Byte readStatus) { + this.readStatus = readStatus; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Byte getRecStatus() { + return recStatus; + } + + public void setRecStatus(Byte recStatus) { + this.recStatus = recStatus; + } + + public Long getReadTime() { + return readTime; + } + + public void setReadTime(Long readTime) { + this.readTime = readTime; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", ringId=").append(ringId); + sb.append(", roleId=").append(roleId); + sb.append(", readStatus=").append(readStatus); + sb.append(", createdAt=").append(createdAt); + sb.append(", updatedAt=").append(updatedAt); + sb.append(", recStatus=").append(recStatus); + sb.append(", readTime=").append(readTime); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSendExample.java b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSendExample.java new file mode 100644 index 00000000..278cf6a7 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/po/SysRingSendExample.java @@ -0,0 +1,681 @@ +package com.ccsens.tall.bean.po; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class SysRingSendExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public SysRingSendExample() { + 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; + } + + 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 andRingIdIsNull() { + addCriterion("ring_id is null"); + return (Criteria) this; + } + + public Criteria andRingIdIsNotNull() { + addCriterion("ring_id is not null"); + return (Criteria) this; + } + + public Criteria andRingIdEqualTo(Long value) { + addCriterion("ring_id =", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdNotEqualTo(Long value) { + addCriterion("ring_id <>", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdGreaterThan(Long value) { + addCriterion("ring_id >", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdGreaterThanOrEqualTo(Long value) { + addCriterion("ring_id >=", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdLessThan(Long value) { + addCriterion("ring_id <", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdLessThanOrEqualTo(Long value) { + addCriterion("ring_id <=", value, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdIn(List values) { + addCriterion("ring_id in", values, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdNotIn(List values) { + addCriterion("ring_id not in", values, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdBetween(Long value1, Long value2) { + addCriterion("ring_id between", value1, value2, "ringId"); + return (Criteria) this; + } + + public Criteria andRingIdNotBetween(Long value1, Long value2) { + addCriterion("ring_id not between", value1, value2, "ringId"); + return (Criteria) this; + } + + public Criteria andRoleIdIsNull() { + addCriterion("role_id is null"); + return (Criteria) this; + } + + public Criteria andRoleIdIsNotNull() { + addCriterion("role_id is not null"); + return (Criteria) this; + } + + public Criteria andRoleIdEqualTo(Long value) { + addCriterion("role_id =", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdNotEqualTo(Long value) { + addCriterion("role_id <>", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdGreaterThan(Long value) { + addCriterion("role_id >", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdGreaterThanOrEqualTo(Long value) { + addCriterion("role_id >=", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdLessThan(Long value) { + addCriterion("role_id <", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdLessThanOrEqualTo(Long value) { + addCriterion("role_id <=", value, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdIn(List values) { + addCriterion("role_id in", values, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdNotIn(List values) { + addCriterion("role_id not in", values, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdBetween(Long value1, Long value2) { + addCriterion("role_id between", value1, value2, "roleId"); + return (Criteria) this; + } + + public Criteria andRoleIdNotBetween(Long value1, Long value2) { + addCriterion("role_id not between", value1, value2, "roleId"); + return (Criteria) this; + } + + public Criteria andReadStatusIsNull() { + addCriterion("read_status is null"); + return (Criteria) this; + } + + public Criteria andReadStatusIsNotNull() { + addCriterion("read_status is not null"); + return (Criteria) this; + } + + public Criteria andReadStatusEqualTo(Byte value) { + addCriterion("read_status =", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusNotEqualTo(Byte value) { + addCriterion("read_status <>", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusGreaterThan(Byte value) { + addCriterion("read_status >", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("read_status >=", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusLessThan(Byte value) { + addCriterion("read_status <", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusLessThanOrEqualTo(Byte value) { + addCriterion("read_status <=", value, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusIn(List values) { + addCriterion("read_status in", values, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusNotIn(List values) { + addCriterion("read_status not in", values, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusBetween(Byte value1, Byte value2) { + addCriterion("read_status between", value1, value2, "readStatus"); + return (Criteria) this; + } + + public Criteria andReadStatusNotBetween(Byte value1, Byte value2) { + addCriterion("read_status not between", value1, value2, "readStatus"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNull() { + addCriterion("created_at is null"); + return (Criteria) this; + } + + public Criteria andCreatedAtIsNotNull() { + addCriterion("created_at is not null"); + return (Criteria) this; + } + + public Criteria andCreatedAtEqualTo(Date value) { + addCriterion("created_at =", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotEqualTo(Date value) { + addCriterion("created_at <>", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThan(Date value) { + addCriterion("created_at >", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("created_at >=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThan(Date value) { + addCriterion("created_at <", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtLessThanOrEqualTo(Date value) { + addCriterion("created_at <=", value, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtIn(List values) { + addCriterion("created_at in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotIn(List values) { + addCriterion("created_at not in", values, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtBetween(Date value1, Date value2) { + addCriterion("created_at between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andCreatedAtNotBetween(Date value1, Date value2) { + addCriterion("created_at not between", value1, value2, "createdAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNull() { + addCriterion("updated_at is null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIsNotNull() { + addCriterion("updated_at is not null"); + return (Criteria) this; + } + + public Criteria andUpdatedAtEqualTo(Date value) { + addCriterion("updated_at =", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotEqualTo(Date value) { + addCriterion("updated_at <>", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThan(Date value) { + addCriterion("updated_at >", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtGreaterThanOrEqualTo(Date value) { + addCriterion("updated_at >=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThan(Date value) { + addCriterion("updated_at <", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtLessThanOrEqualTo(Date value) { + addCriterion("updated_at <=", value, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtIn(List values) { + addCriterion("updated_at in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotIn(List values) { + addCriterion("updated_at not in", values, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtBetween(Date value1, Date value2) { + addCriterion("updated_at between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andUpdatedAtNotBetween(Date value1, Date value2) { + addCriterion("updated_at not between", value1, value2, "updatedAt"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNull() { + addCriterion("rec_status is null"); + return (Criteria) this; + } + + public Criteria andRecStatusIsNotNull() { + addCriterion("rec_status is not null"); + return (Criteria) this; + } + + public Criteria andRecStatusEqualTo(Byte value) { + addCriterion("rec_status =", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotEqualTo(Byte value) { + addCriterion("rec_status <>", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThan(Byte value) { + addCriterion("rec_status >", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusGreaterThanOrEqualTo(Byte value) { + addCriterion("rec_status >=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThan(Byte value) { + addCriterion("rec_status <", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusLessThanOrEqualTo(Byte value) { + addCriterion("rec_status <=", value, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusIn(List values) { + addCriterion("rec_status in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotIn(List values) { + addCriterion("rec_status not in", values, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusBetween(Byte value1, Byte value2) { + addCriterion("rec_status between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andRecStatusNotBetween(Byte value1, Byte value2) { + addCriterion("rec_status not between", value1, value2, "recStatus"); + return (Criteria) this; + } + + public Criteria andReadTimeIsNull() { + addCriterion("read_time is null"); + return (Criteria) this; + } + + public Criteria andReadTimeIsNotNull() { + addCriterion("read_time is not null"); + return (Criteria) this; + } + + public Criteria andReadTimeEqualTo(Long value) { + addCriterion("read_time =", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeNotEqualTo(Long value) { + addCriterion("read_time <>", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeGreaterThan(Long value) { + addCriterion("read_time >", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeGreaterThanOrEqualTo(Long value) { + addCriterion("read_time >=", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeLessThan(Long value) { + addCriterion("read_time <", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeLessThanOrEqualTo(Long value) { + addCriterion("read_time <=", value, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeIn(List values) { + addCriterion("read_time in", values, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeNotIn(List values) { + addCriterion("read_time not in", values, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeBetween(Long value1, Long value2) { + addCriterion("read_time between", value1, value2, "readTime"); + return (Criteria) this; + } + + public Criteria andReadTimeNotBetween(Long value1, Long value2) { + addCriterion("read_time not between", value1, value2, "readTime"); + 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); + } + } +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/bean/vo/RingVo.java b/tall/src/main/java/com/ccsens/tall/bean/vo/RingVo.java new file mode 100644 index 00000000..2e29e394 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/bean/vo/RingVo.java @@ -0,0 +1,60 @@ +package com.ccsens.tall.bean.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +public class RingVo { + @Data + @ApiModel("返回ring消息") + public static class PageInfoRing{ + @ApiModelProperty("当前页数") + private Integer pageNum; + @ApiModelProperty("总页数") + private Integer totalPage ; + @JsonIgnore //"总数据量" + private Integer size ; + } + @Data + @ApiModel("返回ring消息") + public static class RingInfo{ + @ApiModelProperty("消息id") + private String messageId; + @ApiModelProperty("消息内容") + private String value ; + @ApiModelProperty("消息发送时间") + private Long time ; + @ApiModelProperty("是否是自己发送的消息") + private Integer mine ; + @ApiModelProperty("未读数量") + private Integer unread; + @ApiModelProperty("发送者信息") + private MsgSender sender; + @ApiModelProperty("接收角色的信息") + private List roleList; + } + + @Data + @ApiModel("接收/发送者信息") + public static class MsgReceiveRole{ + @ApiModelProperty("接收者的角色id") + private Long id; + @ApiModelProperty("接收者的角色名") + private String name; + @ApiModelProperty("该角色是否已读") + private Integer readStatus; + } + + @Data + @ApiModel("接收/发送者信息") + public static class MsgSender{ + @ApiModelProperty("发送者的id") + private Long id; + @ApiModelProperty("发送者的名字") + private String name; + } +} diff --git a/tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java b/tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java index 6e9d4e26..8c772e56 100644 --- a/tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java +++ b/tall/src/main/java/com/ccsens/tall/bean/vo/TaskVo.java @@ -348,6 +348,8 @@ public class TaskVo { private Long taskBeginTime; @ApiModelProperty("结束时间") private Long taskEndTime; + @ApiModelProperty("是否是自己的任务 0否 1是") + private Integer mine; } } diff --git a/tall/src/main/java/com/ccsens/tall/config/SpringConfig.java b/tall/src/main/java/com/ccsens/tall/config/SpringConfig.java index 8bcbf634..74197a67 100644 --- a/tall/src/main/java/com/ccsens/tall/config/SpringConfig.java +++ b/tall/src/main/java/com/ccsens/tall/config/SpringConfig.java @@ -155,7 +155,8 @@ public class SpringConfig implements WebMvcConfigurer { .addPathPatterns("/templates/**") .addPathPatterns("/hardware/**") .addPathPatterns("/labels/**") - .addPathPatterns("/charts/**"); + .addPathPatterns("/charts/**") + .addPathPatterns("/ring/**"); //super.addInterceptors(registry); } diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/ProMemberRoleDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/ProMemberRoleDao.java index 2bf4ed9d..0024797a 100644 --- a/tall/src/main/java/com/ccsens/tall/persist/dao/ProMemberRoleDao.java +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/ProMemberRoleDao.java @@ -9,4 +9,8 @@ import java.util.List; @Repository public interface ProMemberRoleDao extends ProMemberRoleMapper{ void insertBatch(List members); + + List selectUserIdByRoleId(Long roleId); + + List selectUserIdByProjectId(Long projectId); } diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingMsgDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingMsgDao.java new file mode 100644 index 00000000..cdb6c01e --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingMsgDao.java @@ -0,0 +1,18 @@ +package com.ccsens.tall.persist.dao; + +import com.ccsens.tall.bean.vo.RingVo; +import com.ccsens.tall.persist.mapper.SysRingMsgMapper; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface SysRingMsgDao extends SysRingMsgMapper { + + List selectRingInfoByProject(@Param("userId")Long userId, @Param("projectId")Long projectId, @Param("pageIndex")int pageIndex, @Param("pageSize")int pageSize); + + List selectRoleIdByUserId(@Param("userId")Long userId, @Param("projectId")Long projectId); + + void updateStatusByRoleIdAndMsgId(@Param("roleIdList")List roleIdList, @Param("messageIdList")List messageIdList); +} diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingSendDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingSendDao.java new file mode 100644 index 00000000..718876aa --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/SysRingSendDao.java @@ -0,0 +1,8 @@ +package com.ccsens.tall.persist.dao; + +import com.ccsens.tall.persist.mapper.SysRingSendMapper; +import org.springframework.stereotype.Repository; + +@Repository +public interface SysRingSendDao extends SysRingSendMapper { +} diff --git a/tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java b/tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java index 5b24ec13..90426ad7 100644 --- a/tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java +++ b/tall/src/main/java/com/ccsens/tall/persist/dao/TaskSubTimeDao.java @@ -14,7 +14,7 @@ public interface TaskSubTimeDao extends ProTaskSubTimeMapper{ void clearTaskRealTime(@Param("projectId")Long projectId); - List getKanbanTake(@Param("projectId")Long projectId, @Param("roleId")Long roleId,@Param("type") Integer type,@Param("memberId")Long memberId); + List getKanbanTake(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId,@Param("type") Integer type,@Param("memberId")Long memberId); - List getKanbanTakeByType(@Param("projectId")Long projectId, @Param("roleId")Long roleId, @Param("type")Integer type); + List getKanbanTakeByType(@Param("userId")Long userId,@Param("projectId")Long projectId, @Param("roleId")Long roleId, @Param("type")Integer type); } diff --git a/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingMsgMapper.java b/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingMsgMapper.java new file mode 100644 index 00000000..61ff47f6 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingMsgMapper.java @@ -0,0 +1,36 @@ +package com.ccsens.tall.persist.mapper; + +import com.ccsens.tall.bean.po.SysRingMsg; +import com.ccsens.tall.bean.po.SysRingMsgExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysRingMsgMapper { + long countByExample(SysRingMsgExample example); + + int deleteByExample(SysRingMsgExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysRingMsg record); + + int insertSelective(SysRingMsg record); + + List selectByExampleWithBLOBs(SysRingMsgExample example); + + List selectByExample(SysRingMsgExample example); + + SysRingMsg selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysRingMsg record, @Param("example") SysRingMsgExample example); + + int updateByExampleWithBLOBs(@Param("record") SysRingMsg record, @Param("example") SysRingMsgExample example); + + int updateByExample(@Param("record") SysRingMsg record, @Param("example") SysRingMsgExample example); + + int updateByPrimaryKeySelective(SysRingMsg record); + + int updateByPrimaryKeyWithBLOBs(SysRingMsg record); + + int updateByPrimaryKey(SysRingMsg record); +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingSendMapper.java b/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingSendMapper.java new file mode 100644 index 00000000..c4e8f8df --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/persist/mapper/SysRingSendMapper.java @@ -0,0 +1,30 @@ +package com.ccsens.tall.persist.mapper; + +import com.ccsens.tall.bean.po.SysRingSend; +import com.ccsens.tall.bean.po.SysRingSendExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SysRingSendMapper { + long countByExample(SysRingSendExample example); + + int deleteByExample(SysRingSendExample example); + + int deleteByPrimaryKey(Long id); + + int insert(SysRingSend record); + + int insertSelective(SysRingSend record); + + List selectByExample(SysRingSendExample example); + + SysRingSend selectByPrimaryKey(Long id); + + int updateByExampleSelective(@Param("record") SysRingSend record, @Param("example") SysRingSendExample example); + + int updateByExample(@Param("record") SysRingSend record, @Param("example") SysRingSendExample example); + + int updateByPrimaryKeySelective(SysRingSend record); + + int updateByPrimaryKey(SysRingSend record); +} \ No newline at end of file diff --git a/tall/src/main/java/com/ccsens/tall/service/IRingService.java b/tall/src/main/java/com/ccsens/tall/service/IRingService.java new file mode 100644 index 00000000..f88ff876 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/service/IRingService.java @@ -0,0 +1,16 @@ +package com.ccsens.tall.service; + +import com.ccsens.tall.bean.dto.RingDto; +import com.ccsens.tall.bean.vo.RingVo; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.github.pagehelper.PageInfo; + +import java.util.List; + +public interface IRingService { + void sendRingMsg(Long currentUserId, RingDto.RingSendDto ringSendDto) throws Exception; + + PageInfo getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto); + + void readRingMsg(Long currentUserId, RingDto.MessageId message) throws JsonProcessingException; +} diff --git a/tall/src/main/java/com/ccsens/tall/service/ProMemberService.java b/tall/src/main/java/com/ccsens/tall/service/ProMemberService.java index badf3cf9..7d865606 100644 --- a/tall/src/main/java/com/ccsens/tall/service/ProMemberService.java +++ b/tall/src/main/java/com/ccsens/tall/service/ProMemberService.java @@ -68,7 +68,7 @@ public class ProMemberService implements IProMemberService { List roleList = proRoleDao.selectByExample(roleExample); if(CollectionUtil.isNotEmpty(roleList)){ for(ProRole role :roleList){ - if(!role.getName().equals(WebConstant.ROLE_NAME.AllMember.phase)&&!role.getName().equals("MVP")) { + if(!role.getName().equals(WebConstant.ROLE_NAME.AllMember.phase)&&!role.getName().equals(WebConstant.ROLE_NAME.MVP.phase)) { //查找角色下所有成员 ProMemberRoleExample memberRoleExample = new ProMemberRoleExample(); memberRoleExample.createCriteria().andRoleIdEqualTo(role.getId()); @@ -77,7 +77,7 @@ public class ProMemberService implements IProMemberService { for (ProMemberRole memberRole:memberRoleList){ ProMember proMember = proMemberDao.selectByPrimaryKey(memberRole.getMemberId()); if(ObjectUtil.isNotNull(proMember)){ - Boolean flag = false; + boolean flag = false; if (CollectionUtil.isNotEmpty(members)) { for (ProjectVo.MembersByProject membersByProject : members) { if (membersByProject.getPhone().equals(proMember.getPhone())) { diff --git a/tall/src/main/java/com/ccsens/tall/service/RingService.java b/tall/src/main/java/com/ccsens/tall/service/RingService.java new file mode 100644 index 00000000..00b89421 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/service/RingService.java @@ -0,0 +1,170 @@ +package com.ccsens.tall.service; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.lang.Snowflake; +import cn.hutool.core.util.ObjectUtil; +import com.ccsens.tall.bean.dto.RingDto; +import com.ccsens.tall.bean.dto.message.BaseMessageDto; +import com.ccsens.tall.bean.dto.message.RingMessageWithReadDto; +import com.ccsens.tall.bean.dto.message.RingMessageWithSendDto; +import com.ccsens.tall.bean.po.SysRingMsg; +import com.ccsens.tall.bean.po.SysRingSend; +import com.ccsens.tall.bean.po.SysRingSendExample; +import com.ccsens.tall.bean.vo.RingVo; +import com.ccsens.tall.persist.dao.SysRingMsgDao; +import com.ccsens.tall.persist.dao.SysRingSendDao; +import com.ccsens.util.CodeEnum; +import com.ccsens.util.JacksonUtil; +import com.ccsens.util.config.RabbitMQConfig; +import com.ccsens.util.exception.BaseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.function.Consumer; + +/** + * @author 逗 + */ +@Slf4j +@Service +@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) +public class RingService implements IRingService{ + @Autowired + private Snowflake snowflake; + @Autowired + private SysRingMsgDao sysRingMsgDao; + @Autowired + private SysRingSendDao sysRingSendDao; + @Autowired + private IUserService userService; + @Autowired + private RabbitTemplate rabbitTemplate; + + + /** + * 发送ring消息 + * @param currentUserId 当前用户userid + * @param ringSendDto 发送的消息内容 + */ + @Override + public void sendRingMsg(Long currentUserId, RingDto.RingSendDto ringSendDto) throws Exception { + //获取当前时间 + Long time = System.currentTimeMillis(); + //将消息详情保存至数据库 + SysRingMsg ringMsg = new SysRingMsg(); + ringMsg.setId(snowflake.nextId()); + ringMsg.setProjectId(ringSendDto.getProjectId()); + ringMsg.setSenderId(currentUserId); + ringMsg.setTime(time); + ringMsg.setValueText(ringSendDto.getValue()); + if(ringSendDto.getValue().length() > 20){ + ringMsg.setValue(ringSendDto.getValue().substring(0,20)); + }else { + ringMsg.setValue(ringSendDto.getValue()); + } + sysRingMsgDao.insertSelective(ringMsg); + //所有接收者的userId + Set userIdSet = new HashSet<>(); + //添加消息详情与接收角色的关联信息 + if(CollectionUtil.isNotEmpty(ringSendDto.getRoleList())){ + for(Long roleId :ringSendDto.getRoleList()){ + SysRingSend sysRingSend = new SysRingSend(); + sysRingSend.setId(snowflake.nextId()); + sysRingSend.setRingId(ringMsg.getId()); + sysRingSend.setRoleId(roleId); + sysRingSendDao.insertSelective(sysRingSend); + List userIdList = userService.selectUserIdByRoleId(roleId); + userIdSet.addAll(userIdList); + } + } + List userIdList = new ArrayList<>(userIdSet); + //发送消息 + RingMessageWithSendDto ringMessageWithSendDto = new RingMessageWithSendDto( + ringMsg.getId(),ringSendDto.getProjectId(),ringMsg.getValue(),time); + ringMessageWithSendDto.setReceivers(BaseMessageDto.MessageUser.userIdToUsers(userIdList)); + rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, + JacksonUtil.beanToJson(ringMessageWithSendDto)); + } + + /** + * 查询ring消息 + * @param currentUserId userId + * @param getRingDto 查询条件 + * @return 时间倒叙查询最近10条信息。在返回的结果中需时间正序展示 + */ + @Override + public PageInfo getRingInfo(Long currentUserId, RingDto.GetRingDto getRingDto) { + //计算分页信息 + int pageIndex = 0; + int pageSize = 10; + if(ObjectUtil.isNotNull(getRingDto.getPageSize())) { + pageSize = getRingDto.getPageSize(); + } + if(ObjectUtil.isNotNull(getRingDto.getPage())) { + pageIndex = (getRingDto.getPage() - 1) * pageSize; + } + getRingDto.setPage(getRingDto.getPage() == null ? 1 : getRingDto.getPage()); + getRingDto.setPageSize(getRingDto.getPageSize() == null ? 10 : getRingDto.getPageSize()); + + PageHelper.startPage(getRingDto.getPage(), getRingDto.getPageSize()); + List ringInfoList = sysRingMsgDao.selectRingInfoByProject(currentUserId,getRingDto.getProjectId(),pageIndex,pageSize); + + CollectionUtil.sort(ringInfoList,new Comparator(){ + @Override + public int compare(RingVo.RingInfo o1, RingVo.RingInfo o2) { + return (int)(o1.getTime() - o2.getTime()); + } + }); + + return new PageInfo<>(ringInfoList); + } + + /** + * 阅读消息(将消息设为已读) + * @param currentUserId userId + * @param message 项目id,和消息id,可以多个。同时将多个消息设为已读 + */ + @Override + public void readRingMsg(Long currentUserId, RingDto.MessageId message) throws JsonProcessingException { + //获取当前用户在项目内的角色 + List roleIdList = sysRingMsgDao.selectRoleIdByUserId(currentUserId,message.getProjectId()); + log.info("阅读者的角色:{}",roleIdList.toString()); + //将每条消息的状态设为已读 + if(CollectionUtil.isNotEmpty(roleIdList) && CollectionUtil.isNotEmpty(message.getMessageIdList())){ + for(Long roleId : roleIdList){ + for(Long msgId : message.getMessageIdList()){ + //查找消息 + SysRingMsg sysRingMsg = sysRingMsgDao.selectByPrimaryKey(msgId); + if(ObjectUtil.isNull(sysRingMsg)){ + throw new BaseException(CodeEnum.PARAM_ERROR); + } + SysRingSendExample sysRingSendExample = new SysRingSendExample(); + sysRingSendExample.createCriteria().andRingIdEqualTo(msgId).andRoleIdEqualTo(roleId); + List sysRingSendList = sysRingSendDao.selectByExample(sysRingSendExample); + if(CollectionUtil.isNotEmpty(sysRingSendList)){ + for(SysRingSend sysRingSend : sysRingSendList){ + sysRingSend.setReadStatus((byte) 1); + sysRingSend.setReadTime(System.currentTimeMillis()); + sysRingSendDao.updateByPrimaryKeySelective(sysRingSend); + } + //将已读消息返回给发送者 + List userIdList = new ArrayList<>(); + userIdList.add(sysRingMsg.getSenderId()); + RingMessageWithReadDto ringMessageWithReadDto = new RingMessageWithReadDto(msgId,message.getProjectId(),roleId); + ringMessageWithReadDto.setReceivers(BaseMessageDto.MessageUser.userIdToUsers(userIdList)); + rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, + JacksonUtil.beanToJson(ringMessageWithReadDto)); + } + } + } + } + } +} diff --git a/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java b/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java index e8d319e6..d918b531 100644 --- a/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java +++ b/tall/src/main/java/com/ccsens/tall/service/TaskDeliverService.java @@ -249,13 +249,13 @@ public class TaskDeliverService implements ITaskDeliverService { userIdList.addAll(userService.selectUserIdByRoleId(postLogCheckerId)); } } - Set userIdSet = new HashSet<>(); +// Set userIdSet = new HashSet<>(); if (CollectionUtil.isNotEmpty(userIdList)) { HashSet h = new HashSet<>(userIdList); userIdList.clear(); userIdList.addAll(h); for (Long userId : userIdList) { - userIdSet.add(userId.toString()); +// userIdSet.add(userId.toString()); messageUser = new BaseMessageDto.MessageUser(); messageUser.setUserId(userId); messageUserList.add(messageUser); @@ -276,8 +276,11 @@ public class TaskDeliverService implements ITaskDeliverService { uploadMessageData.setUploadTime(System.currentTimeMillis()); uploadMessageData.setFile(uploadDeliver.getFileInfo()); uploadMessage.setData(uploadMessageData); + uploadMessage.setReceivers(messageUserList); + log.info("检查交付物:{}",JacksonUtil.beanToJson(uploadMessage)); rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, JacksonUtil.beanToJson(uploadMessage)); + // MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); // String s = JacksonUtil.beanToJson(uploadMessage); // InMessage inMessage = InMessage.newToUserMessage(currentUserId.toString(),userIdSet,null,messageRule,s); @@ -317,6 +320,8 @@ public class TaskDeliverService implements ITaskDeliverService { subTimeId = taskAndSubTime.getSubTimeId(); } } + }else { + throw new BaseException(CodeEnum.NOT_TASK); } if(ObjectUtil.isNull(subTimeId)){ ProTaskSubTimeExample taskSubTimeExample = new ProTaskSubTimeExample(); @@ -558,6 +563,16 @@ public class TaskDeliverService implements ITaskDeliverService { checkerDtoData.setCheckTime(checkTime); checkerDtoData.setIsChecker(checkDeliver.getCheckStatus()); checkerDto.setData(checkerDtoData); + //接收者 + if(CollectionUtil.isNotEmpty(userIdSet)) { + for (String userId : userIdSet) { + messageUser = new BaseMessageDto.MessageUser(); + messageUser.setUserId(Long.valueOf(userId)); + messageUserList.add(messageUser); + } + } + checkerDto.setReceivers(messageUserList); + log.info("检查交付物:{}",JacksonUtil.beanToJson(checkerDto)); rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, JacksonUtil.beanToJson(checkerDto)); // MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); @@ -724,13 +739,13 @@ public class TaskDeliverService implements ITaskDeliverService { ProTaskDetail task = taskDetailDao.selectByPrimaryKey(deliver.getTaskDetailId()); ProRole role = proRoleDao.selectByPrimaryKey(task.getExecutorRole()); //发送消息 - Set userIdSet = new HashSet<>(); +// Set userIdSet = new HashSet<>(); if (CollectionUtil.isNotEmpty(userIdList)) { HashSet h = new HashSet<>(userIdList); userIdList.clear(); userIdList.addAll(h); for (Long userId : userIdList) { - userIdSet.add(userId.toString()); +// userIdSet.add(userId.toString()); messageUser = new BaseMessageDto.MessageUser(); messageUser.setUserId(userId); messageUserList.add(messageUser); @@ -749,6 +764,7 @@ public class TaskDeliverService implements ITaskDeliverService { deleteMessageData.setDeleteTime(deleteTime); deleteMessageData.setUserId(currentUserId); deleteMessage.setData(deleteMessageData); + deleteMessage.setReceivers(messageUserList); rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, JacksonUtil.beanToJson(deleteMessage)); // MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); diff --git a/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java b/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java index e19460ec..83634afa 100644 --- a/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java +++ b/tall/src/main/java/com/ccsens/tall/service/TaskSubTimeService.java @@ -469,10 +469,10 @@ public class TaskSubTimeService implements ITaskSubTimeService { kanBan.setTypeName(entry.getValue()); PageHelper.startPage(page, pageSize); if (kanBan.getCode() <= 2) { - List kanBanTaskList = taskSubTimeDao.getKanbanTake(projectId, roleId, kanBan.getCode(), member.getId()); + List kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, kanBan.getCode(), member.getId()); kanBan.setTaskList(new PageInfo<>(kanBanTaskList)); } else { - List kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(projectId, roleId, kanBan.getCode()); + List kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, kanBan.getCode()); kanBan.setTaskList(new PageInfo<>(kanBanTaskList)); } kanBans.add(kanBan); @@ -483,49 +483,15 @@ public class TaskSubTimeService implements ITaskSubTimeService { kanBan.setTypeName(typeMap.get(type)); PageHelper.startPage(page, pageSize); if (kanBan.getCode() <= 2) { - List kanBanTaskList = taskSubTimeDao.getKanbanTake(projectId, roleId, type, member.getId()); + List kanBanTaskList = taskSubTimeDao.getKanbanTake(currentUserId,projectId, roleId, type, member.getId()); kanBan.setTaskList(new PageInfo<>(kanBanTaskList)); } else { - List kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(projectId, roleId, type); + List kanBanTaskList = taskSubTimeDao.getKanbanTakeByType(currentUserId,projectId, roleId, type); kanBan.setTaskList(new PageInfo<>(kanBanTaskList)); } kanBans.add(kanBan); } -// if (ObjectUtil.isNull(type)) { -// -// TaskVo.KanBan kanBan0 = new TaskVo.KanBan(); -// kanBan0.setCode(0); -// kanBan0.setTypeName("未开始"); -// PageHelper.startPage(page, pageSize); -// List kanBanTaskList0 = taskSubTimeDao.getKanbanTake(projectId, roleId, kanBan0.getCode(), member.getId()); -// kanBan0.setTaskList(new PageInfo<>(kanBanTaskList0)); -// -// TaskVo.KanBan kanBan1 = new TaskVo.KanBan(); -// kanBan1.setCode(1); -// kanBan1.setTypeName("进行中"); -// List kanBanTaskList1 = taskSubTimeDao.getKanbanTake(projectId, roleId, kanBan1.getCode(), member.getId()); -// kanBan1.setTaskList(new PageInfo<>(kanBanTaskList1)); -// -// TaskVo.KanBan kanBan2 = new TaskVo.KanBan(); -// kanBan2.setCode(2); -// kanBan2.setTypeName("已完成"); -// List kanBanTaskList2 = taskSubTimeDao.getKanbanTake(projectId, roleId, kanBan2.getCode(), member.getId()); -// kanBan2.setTaskList(new PageInfo<>(kanBanTaskList2)); -// -// kanBans.add(kanBan0); -// kanBans.add(kanBan1); -// kanBans.add(kanBan2); -// -// } else { -// TaskVo.KanBan kanBan = new TaskVo.KanBan(); -// kanBan.setCode(type); -// kanBan.setTypeName(typeMap.get(type)); -// PageHelper.startPage(page, pageSize); -// List kanBanTaskList0 = taskSubTimeDao.getKanbanTake(projectId, roleId, type, member.getId()); -// kanBan.setTaskList(new PageInfo<>(kanBanTaskList0)); -// kanBans.add(kanBan); -// } return kanBans; } diff --git a/tall/src/main/java/com/ccsens/tall/service/UserService.java b/tall/src/main/java/com/ccsens/tall/service/UserService.java index f2ff996f..ba54e11a 100644 --- a/tall/src/main/java/com/ccsens/tall/service/UserService.java +++ b/tall/src/main/java/com/ccsens/tall/service/UserService.java @@ -52,6 +52,8 @@ public class UserService implements IUserService { @Autowired private ProMemberDao memberDao; @Autowired + private ProRoleDao proRoleDao; + @Autowired private ProMemberRoleDao memberRoleDao; @Autowired private SysBalanceLogDao sysBalanceLogDao; @@ -411,7 +413,7 @@ public class UserService implements IUserService { */ private UserVo.UserSign getUserSign(String openId, String unionId, byte identifyType, String redirect) { - UserVo.UserSign userSignVo;//1.查找对应账户,不存在则注册 + UserVo.UserSign userSignVo; List authList = null; SysAuth theAuth = null; if (ObjectUtil.isNotNull(openId)) { @@ -437,7 +439,6 @@ public class UserService implements IUserService { theAuth.setCredential(unionId); authDao.insertSelective(theAuth); - } else { //新建用户并保存微信信息 SysUser user = new SysUser(); @@ -1025,17 +1026,27 @@ public class UserService implements IUserService { */ @Override public List selectUserIdByRoleId(Long roleId) { + ProRole role = proRoleDao.selectByPrimaryKey(roleId); + if(ObjectUtil.isNull(role)){ + return null; + } List userIdList = new ArrayList<>(); - ProMemberRoleExample proMemberRoleExample = new ProMemberRoleExample(); - proMemberRoleExample.createCriteria().andRoleIdEqualTo(roleId); - List memberRoleList = memberRoleDao.selectByExample(proMemberRoleExample); - if (CollectionUtil.isNotEmpty(memberRoleList)) { - for (ProMemberRole memberRole : memberRoleList) { - ProMember member = memberDao.selectByPrimaryKey(memberRole.getMemberId()); - Long userId = member.getUserId(); - userIdList.add(userId); - } + if(role.getName().equalsIgnoreCase(WebConstant.ROLE_NAME.AllMember.phase)){ + userIdList = memberRoleDao.selectUserIdByProjectId(role.getProjectId()); + }else { + userIdList = memberRoleDao.selectUserIdByRoleId(roleId); } +// List userIdList = new ArrayList<>(); +// ProMemberRoleExample proMemberRoleExample = new ProMemberRoleExample(); +// proMemberRoleExample.createCriteria().andRoleIdEqualTo(roleId); +// List memberRoleList = memberRoleDao.selectByExample(proMemberRoleExample); +// if (CollectionUtil.isNotEmpty(memberRoleList)) { +// for (ProMemberRole memberRole : memberRoleList) { +// ProMember member = memberDao.selectByPrimaryKey(memberRole.getMemberId()); +// Long userId = member.getUserId(); +// userIdList.add(userId); +// } +// } return userIdList; } diff --git a/tall/src/main/java/com/ccsens/tall/web/PluginController.java b/tall/src/main/java/com/ccsens/tall/web/PluginController.java index 50d3e3f0..1faec615 100644 --- a/tall/src/main/java/com/ccsens/tall/web/PluginController.java +++ b/tall/src/main/java/com/ccsens/tall/web/PluginController.java @@ -8,6 +8,7 @@ import com.ccsens.tall.service.ISysPluginService; import com.ccsens.tall.service.ITaskPluginService; import com.ccsens.util.JsonResponse; import com.ccsens.util.WebConstant; +import com.ccsens.util.annotation.OperateType; import io.jsonwebtoken.Claims; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; @@ -75,7 +76,7 @@ public class PluginController { return taskDetailId; } - + @OperateType(13) @ApiOperation(value = "评论", notes = "") @ApiImplicitParams({ }) diff --git a/tall/src/main/java/com/ccsens/tall/web/RingController.java b/tall/src/main/java/com/ccsens/tall/web/RingController.java new file mode 100644 index 00000000..ef359198 --- /dev/null +++ b/tall/src/main/java/com/ccsens/tall/web/RingController.java @@ -0,0 +1,66 @@ +package com.ccsens.tall.web; + +import com.ccsens.tall.bean.dto.RingDto; +import com.ccsens.tall.bean.dto.TaskDto; +import com.ccsens.tall.bean.vo.RingVo; +import com.ccsens.tall.service.IRingService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.WebConstant; +import com.github.pagehelper.PageInfo; +import io.jsonwebtoken.Claims; +import io.swagger.annotations.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +@Api(tags = "Ring消息相关API" , description = "") +@RestController +@RequestMapping("/ring") +public class RingController { + @Autowired + private IRingService ringService; + + + @ApiOperation(value = "发送ring消息", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/send", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse sendRingMsg(HttpServletRequest request, + @ApiParam @Validated @RequestBody RingDto.RingSendDto ringSendDto) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + ringService.sendRingMsg(currentUserId,ringSendDto); + return JsonResponse.newInstance().ok(); + } + + + @ApiOperation(value = "查看ring消息", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse> getRingInfo(HttpServletRequest request, + @ApiParam @Validated @RequestBody RingDto.GetRingDto getRingDto) throws Exception { + + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + PageInfo ringInfoList = ringService.getRingInfo(currentUserId,getRingDto); + return JsonResponse.newInstance().ok(ringInfoList); + } + + + @ApiOperation(value = "阅读消息(将消息设为已读)", notes = "") + @ApiImplicitParams({ + }) + @RequestMapping(value = "/read", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) + public JsonResponse readRingMsg(HttpServletRequest request, + @ApiParam @Validated @RequestBody RingDto.MessageId message) throws Exception { + Long currentUserId = Long.valueOf(((Claims) request.getAttribute(WebConstant.REQUEST_KEY_CLAIMS)).getSubject()); + ringService.readRingMsg(currentUserId,message); + return JsonResponse.newInstance().ok(); + } + +} diff --git a/tall/src/main/java/com/ccsens/tall/web/TaskController.java b/tall/src/main/java/com/ccsens/tall/web/TaskController.java index c9e90b8c..02f75be2 100644 --- a/tall/src/main/java/com/ccsens/tall/web/TaskController.java +++ b/tall/src/main/java/com/ccsens/tall/web/TaskController.java @@ -144,9 +144,6 @@ public class TaskController { @ApiOperation(value = "看板上修改任务信息", notes = "") @ApiImplicitParams({ - @ApiImplicitParam(name = "projectId", value = "项目id 必填", required = true, paramType = "query"), - @ApiImplicitParam(name = "type", value = "必填 任务状态 0未开始 1进行中 2已完成", required = true, paramType = "query"), - @ApiImplicitParam(name = "roleId", value = "角色id 不传则查找全部", required = true, paramType = "query") }) @RequestMapping(value = "kanban/change", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"}) public JsonResponse changeKanbanTake(HttpServletRequest request, diff --git a/tall/src/main/resources/application.yml b/tall/src/main/resources/application.yml index c88e995d..b2acd365 100644 --- a/tall/src/main/resources/application.yml +++ b/tall/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: test - include: util-test,common + active: dev + include: util-dev,common diff --git a/tall/src/main/resources/mapper_dao/ProMemberRoleDao.xml b/tall/src/main/resources/mapper_dao/ProMemberRoleDao.xml index a7603b3f..4f54dcac 100644 --- a/tall/src/main/resources/mapper_dao/ProMemberRoleDao.xml +++ b/tall/src/main/resources/mapper_dao/ProMemberRoleDao.xml @@ -12,4 +12,32 @@ + + + \ No newline at end of file diff --git a/tall/src/main/resources/mapper_dao/SysOperationDao.xml b/tall/src/main/resources/mapper_dao/SysOperationDao.xml index a0272c76..d80c7291 100644 --- a/tall/src/main/resources/mapper_dao/SysOperationDao.xml +++ b/tall/src/main/resources/mapper_dao/SysOperationDao.xml @@ -38,7 +38,7 @@ AND s.receiver_id = #{userId} AND s.send_type = #{sendType} AND s.init_read =0 - AND s.rec_status = 0 + AND s.rec_status = 0e AND o.rec_status = 0 + SELECT + m.id as messageId, + m.`value` as `value`, + m.`value_text` as `valueText`, + m.`time` as time, + if(m.sender_id = #{userId},1,0) as mine, + r.id as roleId, + r.name as roleName, + s.read_status as readStatus, + m.sender_id as senderId, + ( + SELECT + IF( u.nickname = '', a.identifier, u.nickname ) AS userName + FROM + t_sys_user u + LEFT JOIN t_sys_auth a ON u.id = a.user_id + AND a.identify_type = 3 + WHERE + u.rec_status = 0 + and + a.rec_status = 0 + and + u.id = m.sender_id + limit 1 + ) as senderName, + (SELECT count(read_status) FROM t_sys_ring_send WHERE ring_id = m.id and read_status = 0) as unread + FROM + t_sys_ring_msg m LEFT JOIN t_sys_ring_send s on m.id = s.ring_id + LEFT JOIN t_pro_role r on s.role_id = r.id + WHERE + ( + m.sender_id = #{userId} + or + s.role_id in ( + SELECT + r.id as rId + FROM + t_pro_role r LEFT JOIN t_pro_member_role mr on r.id = mr.role_id + LEFT JOIN t_pro_member m on mr.member_id = m.id + WHERE + (m.user_id = #{userId} + or + r.`name` = '全体成员' + ) + AND + r.project_id = #{projectId} + ) + ) + and + m.project_id = #{projectId} + ORDER BY m.time DESC + + + + + + + \ No newline at end of file diff --git a/tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml b/tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml index 1f85568e..a722a3fa 100644 --- a/tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml +++ b/tall/src/main/resources/mapper_dao/TaskSubTimeDao.xml @@ -37,7 +37,8 @@ d.executor_role as roleId, r.name as roleName, s.begin_time as taskBegintime, - s.end_time as taskEndTime + s.end_time as taskEndTime, + if(a.rId is not null or r.`name` = '全体成员',1,0) as mine FROM t_pro_task_detail d LEFT JOIN t_pro_task_sub_time s on d.id = s.task_detail_id LEFT JOIN t_pro_role r on r.id = d.executor_role @@ -53,9 +54,24 @@ and m.rec_status = 0 )t on t.sId = s.id + LEFT JOIN + ( + SELECT + r.id as rId + FROM + t_pro_role r Left join t_pro_member_role mr on r.id = mr.role_id + LEFT JOIN t_pro_member m on mr.member_id = m.id + WHERE + m.user_id = #{userId} + and m.rec_status = 0 + and r.rec_status = 0 + ) a on a.rId = r.id + WHERE d.project_id = #{projectId} and + d.rec_status = 0 + and d.level != 0 and @@ -64,6 +80,8 @@ and s.complated_status = #{type} and + FROM_UNIXTIME(s.begin_time/1000,'%Y-%m-%d %H:%m:%s') < NOW() + and ( ( d.finish_need_all = 0 @@ -75,6 +93,7 @@ t.mid > 0 ) ) + ORDER BY s.begin_time DESC \ No newline at end of file diff --git a/tall/src/main/resources/mapper_raw/SysRingMsgMapper.xml b/tall/src/main/resources/mapper_raw/SysRingMsgMapper.xml new file mode 100644 index 00000000..62e5681d --- /dev/null +++ b/tall/src/main/resources/mapper_raw/SysRingMsgMapper.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, project_id, value, sender_id, time, created_at, updated_at, rec_status + + + value_text + + + + + + delete from t_sys_ring_msg + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_ring_msg + + + + + + insert into t_sys_ring_msg (id, project_id, value, + sender_id, time, created_at, + updated_at, rec_status, value_text + ) + values (#{id,jdbcType=BIGINT}, #{projectId,jdbcType=BIGINT}, #{value,jdbcType=VARCHAR}, + #{senderId,jdbcType=BIGINT}, #{time,jdbcType=BIGINT}, #{createdAt,jdbcType=TIMESTAMP}, + #{updatedAt,jdbcType=TIMESTAMP}, #{recStatus,jdbcType=TINYINT}, #{valueText,jdbcType=LONGVARCHAR} + ) + + + insert into t_sys_ring_msg + + + id, + + + project_id, + + + value, + + + sender_id, + + + time, + + + created_at, + + + updated_at, + + + rec_status, + + + value_text, + + + + + #{id,jdbcType=BIGINT}, + + + #{projectId,jdbcType=BIGINT}, + + + #{value,jdbcType=VARCHAR}, + + + #{senderId,jdbcType=BIGINT}, + + + #{time,jdbcType=BIGINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + #{valueText,jdbcType=LONGVARCHAR}, + + + + + + update t_sys_ring_msg + + + id = #{record.id,jdbcType=BIGINT}, + + + project_id = #{record.projectId,jdbcType=BIGINT}, + + + value = #{record.value,jdbcType=VARCHAR}, + + + sender_id = #{record.senderId,jdbcType=BIGINT}, + + + time = #{record.time,jdbcType=BIGINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + value_text = #{record.valueText,jdbcType=LONGVARCHAR}, + + + + + + + + update t_sys_ring_msg + set id = #{record.id,jdbcType=BIGINT}, + project_id = #{record.projectId,jdbcType=BIGINT}, + value = #{record.value,jdbcType=VARCHAR}, + sender_id = #{record.senderId,jdbcType=BIGINT}, + time = #{record.time,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT}, + value_text = #{record.valueText,jdbcType=LONGVARCHAR} + + + + + + update t_sys_ring_msg + set id = #{record.id,jdbcType=BIGINT}, + project_id = #{record.projectId,jdbcType=BIGINT}, + value = #{record.value,jdbcType=VARCHAR}, + sender_id = #{record.senderId,jdbcType=BIGINT}, + time = #{record.time,jdbcType=BIGINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT} + + + + + + update t_sys_ring_msg + + + project_id = #{projectId,jdbcType=BIGINT}, + + + value = #{value,jdbcType=VARCHAR}, + + + sender_id = #{senderId,jdbcType=BIGINT}, + + + time = #{time,jdbcType=BIGINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + value_text = #{valueText,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_ring_msg + set project_id = #{projectId,jdbcType=BIGINT}, + value = #{value,jdbcType=VARCHAR}, + sender_id = #{senderId,jdbcType=BIGINT}, + time = #{time,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT}, + value_text = #{valueText,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=BIGINT} + + + update t_sys_ring_msg + set project_id = #{projectId,jdbcType=BIGINT}, + value = #{value,jdbcType=VARCHAR}, + sender_id = #{senderId,jdbcType=BIGINT}, + time = #{time,jdbcType=BIGINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/tall/src/main/resources/mapper_raw/SysRingSendMapper.xml b/tall/src/main/resources/mapper_raw/SysRingSendMapper.xml new file mode 100644 index 00000000..b1aecccf --- /dev/null +++ b/tall/src/main/resources/mapper_raw/SysRingSendMapper.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + 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, ring_id, role_id, read_status, created_at, updated_at, rec_status, read_time + + + + + delete from t_sys_ring_send + where id = #{id,jdbcType=BIGINT} + + + delete from t_sys_ring_send + + + + + + insert into t_sys_ring_send (id, ring_id, role_id, + read_status, created_at, updated_at, + rec_status, read_time) + values (#{id,jdbcType=BIGINT}, #{ringId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT}, + #{readStatus,jdbcType=TINYINT}, #{createdAt,jdbcType=TIMESTAMP}, #{updatedAt,jdbcType=TIMESTAMP}, + #{recStatus,jdbcType=TINYINT}, #{readTime,jdbcType=BIGINT}) + + + insert into t_sys_ring_send + + + id, + + + ring_id, + + + role_id, + + + read_status, + + + created_at, + + + updated_at, + + + rec_status, + + + read_time, + + + + + #{id,jdbcType=BIGINT}, + + + #{ringId,jdbcType=BIGINT}, + + + #{roleId,jdbcType=BIGINT}, + + + #{readStatus,jdbcType=TINYINT}, + + + #{createdAt,jdbcType=TIMESTAMP}, + + + #{updatedAt,jdbcType=TIMESTAMP}, + + + #{recStatus,jdbcType=TINYINT}, + + + #{readTime,jdbcType=BIGINT}, + + + + + + update t_sys_ring_send + + + id = #{record.id,jdbcType=BIGINT}, + + + ring_id = #{record.ringId,jdbcType=BIGINT}, + + + role_id = #{record.roleId,jdbcType=BIGINT}, + + + read_status = #{record.readStatus,jdbcType=TINYINT}, + + + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{record.recStatus,jdbcType=TINYINT}, + + + read_time = #{record.readTime,jdbcType=BIGINT}, + + + + + + + + update t_sys_ring_send + set id = #{record.id,jdbcType=BIGINT}, + ring_id = #{record.ringId,jdbcType=BIGINT}, + role_id = #{record.roleId,jdbcType=BIGINT}, + read_status = #{record.readStatus,jdbcType=TINYINT}, + created_at = #{record.createdAt,jdbcType=TIMESTAMP}, + updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{record.recStatus,jdbcType=TINYINT}, + read_time = #{record.readTime,jdbcType=BIGINT} + + + + + + update t_sys_ring_send + + + ring_id = #{ringId,jdbcType=BIGINT}, + + + role_id = #{roleId,jdbcType=BIGINT}, + + + read_status = #{readStatus,jdbcType=TINYINT}, + + + created_at = #{createdAt,jdbcType=TIMESTAMP}, + + + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + + + rec_status = #{recStatus,jdbcType=TINYINT}, + + + read_time = #{readTime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=BIGINT} + + + update t_sys_ring_send + set ring_id = #{ringId,jdbcType=BIGINT}, + role_id = #{roleId,jdbcType=BIGINT}, + read_status = #{readStatus,jdbcType=TINYINT}, + created_at = #{createdAt,jdbcType=TIMESTAMP}, + updated_at = #{updatedAt,jdbcType=TIMESTAMP}, + rec_status = #{recStatus,jdbcType=TINYINT}, + read_time = #{readTime,jdbcType=BIGINT} + where id = #{id,jdbcType=BIGINT} + + \ No newline at end of file diff --git a/util/src/main/java/com/ccsens/util/StringUtil.java b/util/src/main/java/com/ccsens/util/StringUtil.java index 63ea759c..7e410ce1 100644 --- a/util/src/main/java/com/ccsens/util/StringUtil.java +++ b/util/src/main/java/com/ccsens/util/StringUtil.java @@ -12,13 +12,17 @@ import java.util.regex.Pattern; public class StringUtil { + public final static String SPLIT_RANGE = "[到\\-至]"; + public final static String SPLIT = "-"; public final static String WEEK_DAY = "(每?隔\\d周)|(每?隔\\d星期)|(每?周[0-7]+)|(每?星期[0-7]+)|(每?周一)|(每?周二)|(每?周三)|(每?周四)|(每?周五)|(每?周六)|(每?周日)|(每?周天)"; + public final static String WEEK_DAY_CIRCLE = WEEK_DAY+SPLIT_RANGE+WEEK_DAY; public final static String DAY = "(每\\d+天)|(每\\d+日)|(每?隔\\d+天)|(每?隔\\d+日)|(\\d+号)|(\\d+日)|(\\d+\\-\\d+号)|(\\d+\\-\\d+日)|(\\d+到\\d+号)|(\\d+到\\d+日)"; public final static String CONTINUE_RANGE = ".*(到|\\-|至).*"; public final static String EVERY = "每(天|日|小时|时|分钟|分|秒)"; public final static String EVERY_WEEK = "每(周|星期)"; + public final static String EVERY_MONTH = "每月"; public final static String EVERY_NUM = "\\D*(\\d+)\\D*"; public final static String CHINESE_NUM = "([零一二三四五六七八九十百千万亿]+)"; @@ -29,13 +33,13 @@ public class StringUtil { public final static String DAY_REGEXP = "(每天)|(每日)|" + DAY; public final static String MONTH_REGEXP = EVERY_MONTH +"|(每隔\\d+月)|(\\d+月)|(每隔[零一二三四五六七八九十百千万亿]+月)|([零一二三四五六七八九十百千万亿]+月)"; - public final static String WEEK_REGEXP = WEEK_DAY + "|(每周)|(每星期)"; + public final static String WEEK_REGEXP = "(每?周[0-7]"+SPLIT_RANGE+"每?周[0-7])|" + WEEK_DAY + "|(每周)|(每星期)"; public final static String WEEK_FLAG_REGEXP = "(每?周)|(每?星期)"; public final static String NO_REPEAT = "不重复"; - public final static String SPLIT_RANGE = "[到\\-至]"; + public final static String NUMBER = "\\d+"; diff --git a/util/src/main/java/com/ccsens/util/cron/CronConstant.java b/util/src/main/java/com/ccsens/util/cron/CronConstant.java index f1855da6..0fdae1e5 100644 --- a/util/src/main/java/com/ccsens/util/cron/CronConstant.java +++ b/util/src/main/java/com/ccsens/util/cron/CronConstant.java @@ -39,7 +39,7 @@ public class CronConstant { // System.out.println("每月:" + month); // System.out.println("每月:" + getDate(month, start, end)); -// TaskCron day = getCronDay("八月8号-15号"); + TaskCron day = getCronDay("八月8号-15号"); // System.out.println("每月8号-15号:" + day); // System.out.println("每月8号-15号:" + getDate(day, start, end)); // @@ -154,6 +154,7 @@ public class CronConstant { } + /** * 根据自然语言转换成开始cron和结束cron * */ @@ -178,19 +179,21 @@ public class CronConstant { split = natureDate.split(StringUtil.SPLIT_RANGE); - String start = startCron.generateCron(split[0]); - taskCron.setStartCron(start); + //结束 + String endStr = null; if (split.length == 1) { + String start = startCron.generateCron(split[0]); + taskCron.setStartCron(start); List months = StringUtil.match(natureDate, StringUtil.MONTH_REGEXP); List weeks = StringUtil.match(natureDate, StringUtil.WEEK_REGEXP); - if (CollectionUtils.isEmpty(months) && months.contains("每月")) { + if (!CollectionUtils.isEmpty(months) && months.contains("每月")) { endStr = "每月1号0时0分"; taskCron.setFirstFlag(true); - } else if (CollectionUtils.isEmpty(weeks) &&(weeks.contains("每周") || - CollectionUtils.isEmpty(weeks) && weeks.contains("每星期"))) { + } else if (!CollectionUtils.isEmpty(weeks) &&(weeks.contains("每周") || + !CollectionUtils.isEmpty(weeks) && weeks.contains("每星期"))) { endStr = "每周1 "; taskCron.setFirstFlag(true); } else { @@ -198,7 +201,23 @@ public class CronConstant { endStr = reg.replaceAll(StringUtil.MINUTE_REGEXP,""); endStr += " 23时59分"; } + } else if (natureDate.contains(NatureConstant.SPACE_STR) && natureDate.split(NatureConstant.SPACE).length >= 2) { + // 多个分段且包含空格 + //空格分隔 认为最后一个是最小单位,前面都是xx-xx 例如:周一-周5 8点:周一-周五8点和周一到周五23:59:59 周一-周5 8点-9点:周一-周五8点和周一到周五9点 + String[] manyTypes = natureDate.split(NatureConstant.SPACE); + String last = manyTypes[manyTypes.length-1]; + String startStr = natureDate.substring(0, natureDate.indexOf(last)); + StringBuilder start = new StringBuilder(startStr); + StringBuilder end = new StringBuilder(startStr); + String[] mins = last.split(StringUtil.SPLIT_RANGE); + start.append(mins[0]); + taskCron.setStartCron(startCron.generateCron(start.toString())); + // TODO 根据时间单位,确认是时分秒日月周 + end.append(mins.length > 1 ? mins[1] : "23:59:59"); + endStr = end.toString(); } else { + String start = startCron.generateCron(split[0]); + taskCron.setStartCron(start); String reg = split[1].replaceAll("\\d+","\\\\d+"); endStr = split[0].replaceAll(reg, "") + split[1]; } @@ -258,6 +277,8 @@ public class CronConstant { private String month = ""; private String week = ""; + + /** * 将自然时间转化成cron * @param natureDate @@ -335,6 +356,12 @@ public class CronConstant { } else if (StringUtil.isMatch(nature, StringUtil.EVERY_WEEK)) { //每周默认是从每周一 set("1", type); + }else if (nature.split(StringUtil.SPLIT_RANGE).length > 1){ + //例如:每周一-周五 --> 1-5 + String[] arr = nature.split(StringUtil.SPLIT_RANGE); + int start = getNum(arr[0]); + int end = getNum(arr[1]); + set(start + "-" + end, type); } else if (StringUtil.isMatch(nature, StringUtil.WEEK_DAY)){ //每周几 int num = getNum(nature); @@ -360,6 +387,12 @@ public class CronConstant { // for (; start <= end; start++) { // set(String.valueOf(start), type); // } + } else if (nature.split(StringUtil.SPLIT_RANGE).length > 1){ + //例如:每周一-周五 --> 1-5 + String[] arr = nature.split(StringUtil.SPLIT_RANGE); + int start = getNum(arr[0]); + int end = getNum(arr[1]); + set(start + "-" + end, type); } else { //普通 int num = getNum(nature); diff --git a/util/src/main/java/com/ccsens/util/cron/NatureConstant.java b/util/src/main/java/com/ccsens/util/cron/NatureConstant.java index 531a7e76..eb0aec6c 100644 --- a/util/src/main/java/com/ccsens/util/cron/NatureConstant.java +++ b/util/src/main/java/com/ccsens/util/cron/NatureConstant.java @@ -15,6 +15,8 @@ public class NatureConstant { public static final String WORK_DAY = "工作日"; /**每周几*/ public static final String WEEK_ZHOU = "每?周[一二三四五六七日天0-7]"; + /**每周一到周五 */ + public static final String WEEK_EVERY = "每周[一二三四五六七日天0-7][到\\-至]周[一二三四五六七日天0-7]"; public static final String WEEK_XINGQI = "每?星期[一二三四五六七日天0-7]"; /**每月几号*/ public static final String EVERY_MONTH_DAY = "每月" + NUM + "号?日?"; @@ -42,6 +44,8 @@ public class NatureConstant { /**第几天*/ public static final String WHAT_DAY= "第" + NUM + "天?日?"; + public static final String SPACE = "\\s"; + public static final String SPACE_STR = " "; diff --git a/util/src/main/java/com/ccsens/util/cron/NatureToDate.java b/util/src/main/java/com/ccsens/util/cron/NatureToDate.java index bf7b6aa5..d35e5b9f 100644 --- a/util/src/main/java/com/ccsens/util/cron/NatureToDate.java +++ b/util/src/main/java/com/ccsens/util/cron/NatureToDate.java @@ -40,8 +40,9 @@ public class NatureToDate { // System.out.println("入职第一月:" + generateDates("入职第一月", start, end)); // System.out.println("入职第一年:" + generateDates("入职第一年", start, end)); // System.out.println("第八天:" + generateDates("第八天", start, end)); - System.out.println("每月15号下午5点:" + generateDates("每月15号下午5点", start, end)); +// System.out.println("每月15号下午5点:" + generateDates("每月15号下午5点", start, end)); + System.out.println("周一-周五 8点-9点: " + generateDates("周一-周五 8点-9点", start, end)); } @@ -93,7 +94,10 @@ public class NatureToDate { */ private static List dealSpecialKnow(String nature, Date startDate, Date endDate) { List taskDates = new ArrayList<>(); - if (StringUtil.isMatch(nature, NatureConstant.EVERY_MONTH_ZHOU) || StringUtil.isMatch(nature, NatureConstant.EVERY_MONTH_XINGQI) ) { + if(nature.contains(NatureConstant.SPACE_STR)){ + String[] natureArr = nature.split(NatureConstant.SPACE); + + } else if (StringUtil.isMatch(nature, NatureConstant.EVERY_MONTH_ZHOU) || StringUtil.isMatch(nature, NatureConstant.EVERY_MONTH_XINGQI) ) { //获取第几周 int endIndex = getWeekEndIndex(nature); String numStr = nature.substring(nature.indexOf("第") + 1, endIndex); @@ -247,6 +251,9 @@ public class NatureToDate { if (CronConstant.CronExpression.map.containsKey(nature)){ split[0] = nature; split[1] = nature; + } else if (StringUtil.isMatch(nature, NatureConstant.WEEK_EVERY)){ + String[] natureArr = nature.split(NatureConstant.SPACE); + } else if (nature.contains(NatureConstant.WORK_DAY)) { //工作日 split[0] = nature.replaceAll("工作日","周1"); @@ -286,8 +293,14 @@ public class NatureToDate { private static String dealSpecialTime(String nature){ nature = nature.replace("周日", "周0").replace("周天", "周0") .replace("星期日", "周0").replace("星期天", "周0") - .replace("周七", "周0").replace("周七", "周0") - .replace("星期七", "周0").replace("星期七", "周0") ; + .replace("周七", "周0").replace("星期七", "周0") + .replace("星期一", "周1").replace("周一", "周1") + .replace("星期二", "周2").replace("周二", "周2") + .replace("星期三", "周3").replace("周三", "周3") + .replace("星期四", "周4").replace("周四", "周4") + .replace("星期五", "周5").replace("周五", "周5") + .replace("星期六", "周6").replace("周六", "周6") + ; if (nature.contains(NatureConstant.PM)) { int start = nature.indexOf("下午"); int end = nature.indexOf("点", start) > 0 ? nature.indexOf("点", start) : nature.indexOf("时", start); diff --git a/util/src/test/java/com/ccsens/util/Base64Test.java b/util/src/test/java/com/ccsens/util/Base64Test.java index 7499305c..2c79076d 100644 --- a/util/src/test/java/com/ccsens/util/Base64Test.java +++ b/util/src/test/java/com/ccsens/util/Base64Test.java @@ -38,76 +38,11 @@ public class Base64Test { @Test public void test02() throws Exception { - String[] strings = new String[]{"1590997352223", - "1591545600000", - "1592150400000", - "1592755200000", - "1593360000000", - "1593964800000", - "1594569600000", - "1595174400000", - "1595779200000", - "1596384000000", - "1596988800000", - "1597593600000", - "1598198400000", - "1598803200000", - "1599408000000", - "1600012800000", - "1600617600000", - "1601222400000", - "1601827200000", - "1602432000000", - "1603036800000", - "1603641600000", - "1604246400000", - "1604851200000", - "1605456000000", - "1606060800000", - "1606665600000", - "1607270400000", - "1607875200000", - "1608480000000", - "1609084800000" - }; - String[] strings1 = new String[]{ - "1591315200000", - "1591574400000", - "1592179200000", - "1592784000000", - "1593388800000", - "1593993600000", - "1594598400000", - "1595203200000", - "1595808000000", - "1596412800000", - "1597017600000", - "1597622400000", - "1598227200000", - "1598832000000", - "1599436800000", - "1600041600000", - "1600646400000", - "1601251200000", - "1601856000000", - "1602460800000", - "1603065600000", - "1603670400000", - "1604275200000", - "1604880000000", - "1605484800000", - "1606089600000", - "1606694400000", - "1607299200000", - "1607904000000", - "1608508800000", - "1609113600000" - }; - for(int i = 0 ;i