-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from shortintern2020-A-labyrinth/masahito
Masahito
- Loading branch information
Showing
44 changed files
with
900 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#Wed Aug 26 19:54:40 JST 2020 | ||
gradle.version=6.5 |
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.apt.aptEnabled=false | ||
org.eclipse.jdt.apt.aptEnabled=true | ||
org.eclipse.jdt.apt.genSrcDir=target\\generated-sources\\annotations | ||
org.eclipse.jdt.apt.genTestSrcDir=target\\generated-test-sources\\test-annotations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/*テーブル作成*/ | ||
create table users ( | ||
id serial primary key, | ||
name varchar(30) not null, | ||
|
@@ -48,6 +49,7 @@ create table emojicode ( | |
emoji_code varchar(30) | ||
); | ||
|
||
|
||
insert into users(name, mail, filterlevel) values | ||
('ichigo.chocomint', '[email protected]', 1), | ||
('banana.chocomint', '[email protected]', 2), | ||
|
@@ -88,12 +90,33 @@ insert into requestfriend(userid, requestfriendid, create_at) values | |
(45, 67, '2019-07-19 07:19:19'), | ||
(89, 12, '2020-08-20 08:20:20') | ||
; | ||
|
||
insert into users(name, mail, filterlevel) values | ||
('ichigo.chocomint', '[email protected]', 1), | ||
('banana.chocomint', '[email protected]', 2), | ||
('pinapple.chocomint', '[email protected]', 3) | ||
; | ||
|
||
insert into emojicode(keyword, emoji_code) values | ||
('radio', ':radio:'), | ||
('movies', ':movie_camera:'), | ||
('bowling',':bowling:'), | ||
('bank',':bank:') | ||
; | ||
|
||
insert into talk(userid, friendid,contents,create_at) values | ||
(100, 101,'Hello World !', current_timestamp), | ||
(101,100, 'Hi !', current_timestamp), | ||
(101,100,'See you.','2020-08-25 10:23:23') | ||
; | ||
|
||
insert into emolog(userid,friendid,create_at,contents) values | ||
(101,100,'2020-08-25 10:23:23',':grinning: :smiley: :wink: :radio: :credit_card:'), | ||
(100,101,'2020-08-25 10:23:23',':wink: :radio: :credit_card: :grinning: :smiley:') | ||
;*/ | ||
|
||
|
||
|
||
insert into friend(userid, friendid, name, latestemolog) values | ||
(1, 2, 'hoge', 'emojihoge'), | ||
(2, 1, 'Trump', ':smile:'), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
src/main/java/com/example/demo/controller/ChatController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
package com.example.demo.controller; | ||
|
||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
|
||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
import org.springframework.ui.Model; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
//import java.util.Date; | ||
import com.vdurmont.emoji.EmojiParser; | ||
|
||
import org.springframework.stereotype.Controller; | ||
|
||
//chatページの表示 | ||
@Controller | ||
@RequestMapping(path = "/") | ||
public class ChatController { | ||
|
||
@Autowired | ||
JdbcTemplate jdbcTemplate; | ||
|
||
@RequestMapping(path = "/chat", method = RequestMethod.GET) | ||
public String chat(Model model){ | ||
//日付 | ||
//Date date = new Date(); | ||
|
||
String date = "8月18日"; | ||
model.addAttribute("date", date); | ||
|
||
//絵文字 | ||
//データを受け取る | ||
int u_id = 1; | ||
int f_id = 2; | ||
//SELECT contents FROM emolog WHERE userid== AND friendid AND create_at==date; | ||
/*List<Map<String, Object>> emojilist; | ||
emojilist = jdbcTemplate.queryForList("SELECT * FROM emolog"); | ||
String MyEmolog =""; | ||
String FriendEmolog =""; | ||
for(Map<String, Object> map : emojilist) { | ||
if(u_id == (Integer)map.get("userid") && f_id == (Integer)map.get("friendid") ){ | ||
//本当は一日分なので日付も欲しいですが | ||
MyEmolog += map.get("contents"); | ||
}else if(f_id == (Integer)map.get("userid") && u_id == (Integer)map.get("friendid")){ | ||
FriendEmolog +=map.get("contents"); | ||
} | ||
}*/ | ||
|
||
//絵文字の表示部分 | ||
//相手側 | ||
//String text = "An 😀awesome 😃string with a few 😉emojis!"; | ||
String text = ":grinning: :smiley: :wink: :radio: :credit_card: "; | ||
//String text =FriendEmolog; | ||
text = EmojiParser.parseToUnicode(text); | ||
model.addAttribute("FriendEmolog", text); | ||
//自分側 | ||
//text=MyEmolog; | ||
text = EmojiParser.parseToUnicode(text); | ||
model.addAttribute("MyEmolog", text); | ||
|
||
|
||
//チャット部分の表示 | ||
/*List<Map<String, Object>> list; | ||
//list = jdbcTemplate.queryForList("select * from users"); | ||
list = jdbcTemplate.queryForList("SELECT * FROM talk"); | ||
String MyMessage =""; | ||
String FriendMessage =""; | ||
for(Map<String, Object> map : list) { | ||
if(u_id == (Integer)map.get("userid") && f_id == (Integer)map.get("friendid") ){ | ||
//本当は一日分なので日付も欲しいですが | ||
MyMessage += map.get("contents"); | ||
}else if(f_id == (Integer)map.get("userid") && u_id == (Integer)map.get("friendid")){ | ||
FriendMessage +=map.get("contents"); | ||
} | ||
} | ||
model.addAttribute("MyChatMessage", MyMessage); | ||
model.addAttribute("FriendChatMessage", FriendMessage);*/ | ||
|
||
return "chat"; | ||
} | ||
|
||
/*自分用 | ||
@RequestMapping(path = "/", method = RequestMethod.GET) | ||
public String twitter_connect(Model model){ | ||
model.addAttribute("MyEmolog", "Hello Springboot"); | ||
return "chat"; | ||
}*/ | ||
|
||
|
||
//テキストボックス入力 | ||
/*@RequestMapping(value = "/chat", method = RequestMethod.GET) | ||
public String TextBox(Model model){ | ||
// 空のフォームオブジェクトをModelに設定 | ||
model.addAttribute("MessageBox", new Message()); | ||
// 遷移先を返す(この場合はinput.htmlが遷移先となる) | ||
return "chat"; | ||
}*/ | ||
|
||
/*@RequestMapping(value = "/chat", method = RequestMethod.POST) | ||
public String confirm(@ModelAttribute("MessageBox") Message form,Model model) { | ||
// 空のフォームオブジェクトをModelに設定 | ||
model.addAttribute("MessageBox", new Message()); | ||
// 遷移先を返す(この場合はconfirm.htmlが遷移先となる) | ||
return "chat"; | ||
}*/ | ||
|
||
|
||
//private static final Logger LOG = LoggerFactory.getLogger(ViewController.class); | ||
/* | ||
@Autowired | ||
JdbcTemplate jdbcTemplate; | ||
@RequestMapping(path = "/users", method = RequestMethod.GET) | ||
public String index() { | ||
List<Map<String, Object>> list; | ||
list = jdbcTemplate.queryForList("select * from users"); | ||
return list.toString(); | ||
} | ||
@RequestMapping(path = "/users/{id}", method = RequestMethod.GET) | ||
public String read(@PathVariable("id") String id) { | ||
List<Map<String, Object>> list; | ||
list = jdbcTemplate.queryForList("select * from users where id = ?", id); | ||
return list.toString(); | ||
} | ||
@RequestMapping(path = "/", method = RequestMethod.GET) | ||
public String twitter_connect() throws Exception{ | ||
return ""; | ||
}*/ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.