Рефакторинг

This commit is contained in:
Mark Struchkov 2019-05-11 16:08:42 +03:00
parent a496ac0097
commit d8add9f109
5 changed files with 49 additions and 75 deletions

View File

@ -33,7 +33,7 @@
<properties>
<gson.ver>2.8.5</gson.ver>
<vksdk.ver>0.5.13-SNAPSHOT</vksdk.ver>
<log4j.ver>1.2.17</log4j.ver>
<slf4j.ver>1.7.26</slf4j.ver>
</properties>
<dependencies>
@ -43,9 +43,9 @@
<version>${gson.ver}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.ver}</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.ver}</version>
</dependency>
<dependency>

View File

@ -14,7 +14,7 @@ public class BoxAnswer {
}
public BoxAnswer(BoxAnswer target) {
private BoxAnswer(BoxAnswer target) {
if (target != null) {
this.message = target.getMessage();
this.keyboard = target.getKeyboard();
@ -69,6 +69,45 @@ public class BoxAnswer {
return new BoxAnswer(this);
}
public static Builder builder() {
return new BoxAnswer().new Builder();
}
public class Builder {
private Builder() {
}
public Builder message(String message) {
BoxAnswer.this.message = message;
return this;
}
public Builder keyBoard(String keyBoard) {
BoxAnswer.this.keyboard = keyBoard;
return this;
}
public Builder lat(Float lat) {
BoxAnswer.this.lat = lat;
return this;
}
public Builder aLong(Float aLong) {
BoxAnswer.this.aLong = aLong;
return this;
}
public Builder steckerId(Integer stickerId) {
BoxAnswer.this.stickerId = stickerId;
return this;
}
public BoxAnswer build() {
return BoxAnswer.this;
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;

View File

@ -1,66 +0,0 @@
package org.sadtech.bot.core.domain;
public class MailSend {
private String message;
private String keyboard;
private Float lat;
private Float aLong;
private Integer stickerId;
public MailSend() {
}
public String getKeyboard() {
return keyboard;
}
public void setKeyboard(String keyboard) {
this.keyboard = keyboard;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Float getLat() {
return lat;
}
public void setLat(Float lat) {
this.lat = lat;
}
public Float getaLong() {
return aLong;
}
public void setaLong(Float aLong) {
this.aLong = aLong;
}
public Integer getStickerId() {
return stickerId;
}
public void setStickerId(Integer stickerId) {
this.stickerId = stickerId;
}
@Override
public String toString() {
return "MailSend{" +
"message='" + message + '\'' +
", keyboard='" + keyboard + '\'' +
", lat=" + lat +
", aLong=" + aLong +
", stickerId=" + stickerId +
'}';
}
}

View File

@ -4,8 +4,8 @@ import org.sadtech.bot.core.domain.BoxAnswer;
public interface Sent {
void send(Integer idPerson, String message);
void send(Integer personId, String message);
void send(Integer idPerson, BoxAnswer boxAnswer);
void send(Integer personId, BoxAnswer boxAnswer);
}

View File

@ -1,15 +1,16 @@
package org.sadtech.bot.core.service.impl;
import com.google.gson.JsonObject;
import org.apache.log4j.Logger;
import org.sadtech.bot.core.repository.EventRepository;
import org.sadtech.bot.core.service.RawEventService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Queue;
public class RawEventServiceImpl implements RawEventService {
private static final Logger log = Logger.getLogger(RawEventServiceImpl.class);
private static final Logger log = LoggerFactory.getLogger(RawEventServiceImpl.class);
private final EventRepository eventRepository;