Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified chat/chat-server/.DS_Store
Binary file not shown.
Binary file modified chat/chat-server/src/.DS_Store
Binary file not shown.
Binary file modified chat/chat-server/src/main/.DS_Store
Binary file not shown.
Binary file modified chat/chat-server/src/main/java/.DS_Store
Binary file not shown.
Binary file modified chat/chat-server/src/main/java/com/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ public ResponseEntity getUserList(@PathVariable String user_id, @PathVariable St
.content(v.getContent())
.createdAt(v.getCreatedAt())
.reservation_id(v.getReservation_id())
.confirmed(confirmed)
.confirmed(confirmed)
.is_image(v.getIs_image())
.build());
}
check.clear();
Expand Down Expand Up @@ -349,6 +350,7 @@ public ResponseEntity getUserList(@PathVariable String user_id, @PathVariable St
.createdAt(v.getCreatedAt())
.reservation_id(v.getReservation_id())
.confirmed(confirmed)
.is_image(v.getIs_image())
.build());
}
}
Expand All @@ -372,6 +374,7 @@ public ResponseEntity getUserList(@PathVariable String user_id, @PathVariable St
vtmp.addProperty("opponent_nickname", v.getOpponent_nickname());
vtmp.addProperty("reservation_id", v.getReservation_id());
vtmp.addProperty("confirmed", v.getConfirmed());
vtmp.addProperty("is_image", v.getIs_image());
jArray.add(vtmp);
}
temp.add("userlist", jArray);
Expand Down Expand Up @@ -399,7 +402,7 @@ public ResponseEntity getMessageList(@PathVariable String reservation_id, @Reque
}
vtmp.addProperty("id", e.getId());
vtmp.addProperty("content", e.getContent());
vtmp.addProperty("time", e.getCreatedAt());
vtmp.addProperty("created_at", e.getCreatedAt());
vtmp.addProperty("mine", mine);
vtmp.addProperty("receiver", e.getReceiver());
vtmp.addProperty("is_image", e.getIs_image());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void delete(
);


@Query(value = "SELECT distinct sender, receiver, content, created_At, reservation_id " +
@Query(value = "SELECT distinct sender, receiver, content, created_At, reservation_id, is_image " +
"FROM chat_msg m " +
"WHERE m.sender = :sender OR m.receiver = :sender " +
"ORDER BY m.id DESC",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public Iterable<MessageDto> getUserList(String sender) {
.receiver(String.valueOf(message[1]))
.content(String.valueOf(message[2]))
.createdAt(String.valueOf(message[3]))
.reservation_id(String.valueOf(message[4]))
.reservation_id(String.valueOf(message[4]))
.is_image((Boolean) message[5])
.build());
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ public class ObjectStorageService {
@Autowired
private MessageService messageService;

final String endPoint = "https://kr.object.ncloudstorage.com"; //Naver Cloud ObjectStorage End Point;
final String regionName = "kr-standard"; //Naver Cloud ObjectStorage region Name;
@Value("${cloud.objectStorage.credentials.accessKey}")
private String accessKey; //Naver Cloud ObjectStorage access Key;
@Value("${cloud.objectStorage.credentials.secretKey}")
private String secretKey; //Naver Cloud ObjectStorage secret Key;
// final String endPoint = "https://kr.object.ncloudstorage.com"; //Naver Cloud ObjectStorage End Point;
// final String regionName = "kr-standard"; //Naver Cloud ObjectStorage region Name;
// final String accessKey = "FDKsmR5tOoKNGPie5IK1";
// final String secretKey = "rIsdHa0cITlo4QMfJcUP1dLQ7REwFG9u2lN3pzem";

// S3 client
final AmazonS3 s3 = AmazonS3ClientBuilder.standard() // S3에 접근하기 위한 객체 builc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class ResponseUserList {
private String opponent_nickname;
private String reservation_id;
private Boolean confirmed;
private Boolean is_image;

@Builder
public ResponseUserList(
Long id, // 유저 id
Expand All @@ -30,7 +32,8 @@ public ResponseUserList(
String opponent_image, // 자신이 아닌 상대방 image
String opponent_nickname, // 자신이 아닌 상대방 닉네임
String reservation_id, // 예약 id
Boolean confirmed // 예약 확정 정보
Boolean confirmed, // 예약 확정 정보
Boolean is_image// image여부
) {
this.id = id;
this.sender = sender;
Expand All @@ -42,6 +45,6 @@ public ResponseUserList(
this.opponent_nickname = opponent_nickname;
this.reservation_id = reservation_id;
this.confirmed = confirmed;
this.is_image = is_image;
}

}
11 changes: 10 additions & 1 deletion chat/push-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,16 @@
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>

<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

import com.example.pushserver.Service.AuthService;
import com.example.pushserver.Service.CustomMessageService;
import com.example.pushserver.vo.RequestPush;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

@RestController
public class KakaoAPIController {
Expand All @@ -22,10 +20,54 @@ public class KakaoAPIController {
@Autowired
CustomMessageService customMessageService;

@PostMapping("/push/{push_case}")
public ResponseEntity ReserveDelete(@PathVariable int push_case, @RequestBody RequestPush vo) {
Gson gson = new Gson();
JsonObject temp = new JsonObject();
HttpHeaders responseHeaders = new HttpHeaders();
responseHeaders.add("Content-Type", "application/json; charset=UTF-8");
System.out.println(vo);
switch (push_case) {
case 1 : // 상담문의 -> 유저 브라우저 알림, 타투이스트 브라우저 알림, 타투이스트 카톡 알림
// 타투이스트 카카오 계정을 기반으로 메시지 보내기
System.out.println("상담문의");
break;
case 2 : // 예약확정 -> 유저 브라우저 알림, 유저 카톡 알림, 타투이스트 카톡 알림
// 유저 카카오 계정을 기반으로 메시지 보내기
System.out.println("예약확정");
break;
case 3 : // 예약취소 -> 유저 브라우저 알림, 유저 카톡 알림, 타투이스트 브라우저
System.out.println("예약취소");
break;
case 10 :
System.out.println("이력제공");
break;
case 20 :
System.out.println("작업시작");
break;
case 21 :
System.out.println("작업종료");
break;
case 30 :
System.out.println("새로운경매입찰");
break;
case 31 :
System.out.println("새로운채팅수신");
break;
case 32 :
System.out.println("경매입찰성공");
break;
}

temp.addProperty("success", true);
return new ResponseEntity<>(gson.toJson(temp), responseHeaders,HttpStatus.OK);
}

@GetMapping("/test")
public String serviceStart(String code) {
System.out.println(code);
if(authService.getKakaoAuthToken(code)) {
customMessageService.sendMyMessage();
// customMessageService.sendMyMessage();
return "메시지 전송 성공";
}else {
return "토큰발급 실패";
Expand Down Expand Up @@ -71,23 +113,4 @@ public String auctionCall(String code) {
return "토큰발급 실패";
}
}

// @GetMapping("/kakao")
// public ResponseEntity kakaoCall(@RequestParam String code) {
// Gson gson = new Gson();
// JsonObject temp = new JsonObject();
// HttpHeaders responseHeaders = new HttpHeaders();
// responseHeaders.add("Content-Type", "application/json; charset=UTF-8");
//
// System.out.println("code = " + code);
// if(authService.getKakaoAuthToken(code)) {
// customMessageService.sendMyMessage();
// temp.addProperty("success", true);
// return new ResponseEntity<>(gson.toJson(temp), responseHeaders, HttpStatus.OK);
// }else {
// temp.addProperty("success", "true");
// temp.addProperty("success", false);
// return new ResponseEntity<>(gson.toJson(temp), responseHeaders, HttpStatus.OK);
// }
// }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.example.pushserver.vo;

import lombok.Data;
import lombok.Getter;
import javax.validation.constraints.NotNull;

@Getter
@Data
public class RequestPush {
@NotNull(message = "User_id cannot be null")
private String user_id;

@NotNull(message="Tattooist_id cannot be null")
private String tattooist_id;

@NotNull(message="User_kakao cannot be null")
private String user_kakao;

@NotNull(message="Tattooist_kakao cannot be null")
private String tattooist_kakao;
}