Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
36f6243
Merge pull request #13 from BCSDLab/release/1.2.0
knight7024 Feb 2, 2020
07caf42
Merge pull request #15 from BCSDLab/hotfix/search_null
knight7024 Feb 9, 2020
4475f56
fix term type string to json
Feb 13, 2020
58f97ce
change `checking null or empty` to `hasText` method
Feb 13, 2020
224039e
refactor jsonconstructor module && adjust depencies
Feb 14, 2020
a9a81e4
Merge pull request #16 from BCSDLab/bugfix/term_type
knight7024 Feb 14, 2020
c7c6279
Merge pull request #17 from BCSDLab/bugfix/null_or_empty
knight7024 Feb 14, 2020
fc04443
Merge pull request #18 from BCSDLab/release/1.2.0
knight7024 Feb 14, 2020
99bb32e
add null check && adjust module a little
Feb 16, 2020
749fc1f
Merge pull request #19 from BCSDLab/bugfix/null_or_empty
knight7024 Feb 16, 2020
6beec89
fix bug which doesn't print valid count of my items
Feb 19, 2020
85e0bf3
rollback circle service condition
Feb 19, 2020
5a48a1d
Merge pull request #20 from BCSDLab/bugfix/market_my_item_count
knight7024 Feb 19, 2020
db05b53
Merge pull request #22 from BCSDLab/hotfix/bus_timetable_20200301
knight7024 Feb 29, 2020
bfdaec1
refactor chatbot bus feature by applying design patterns && remove un…
Mar 1, 2020
28c01a4
Merge pull request #23 from BCSDLab/release/1.3.0
knight7024 Mar 4, 2020
3673204
Merge pull request #24 from BCSDLab/feature/bus_logic_improvement
knight7024 Mar 4, 2020
b185296
add more bean validation && add nickname check
Mar 7, 2020
dd054d6
Merge pull request #26 from BCSDLab/bugfix/add_validation
knight7024 Mar 7, 2020
f4f097a
change nickname limitation 50 to 10
Mar 12, 2020
475d3ff
Merge pull request #27 from BCSDLab/bugfix/add_validation
knight7024 Mar 12, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import javax.inject.Inject;
import java.util.List;
import java.util.Map;

@Controller
public class CalendarController {
Expand All @@ -27,7 +28,7 @@ ResponseEntity<List<Calendar>> getCalendars(@ApiParam(required = true) @RequestP

@RequestMapping(value = "/term", method = RequestMethod.GET)
public @ResponseBody
ResponseEntity<String> getTerm() throws Exception {
ResponseEntity<Map<String, Object>> getTerm() throws Exception {
return new ResponseEntity<>(calendarService.getTerm(), HttpStatus.OK);
}
}
60 changes: 30 additions & 30 deletions src/main/java/koreatech/in/controller/KakaoBotController.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import koreatech.in.service.KakaoBotService;
import koreatech.in.skillresponse.KakaoBotEnum;
import koreatech.in.skillresponse.KakaoBot;
import koreatech.in.skillresponse.SkillResponse;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
Expand All @@ -25,66 +25,66 @@ public class KakaoBotController {

@RequestMapping(value = "/dinings", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public @ResponseBody
ResponseEntity requestDinings(@RequestBody String body) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(body);

// ['action']['params']['mealtime']
JsonElement action = jsonElement.getAsJsonObject().get("action");
JsonElement params = action.getAsJsonObject().get("params");
String mealtime = params.getAsJsonObject().get("mealtime").getAsString();

ResponseEntity<String> requestDinings(@RequestBody String body) {
String result;
try {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(body);

// ['action']['params']['mealtime']
JsonElement action = jsonElement.getAsJsonObject().get("action");
JsonElement params = action.getAsJsonObject().get("params");
String mealtime = params.getAsJsonObject().get("mealtime").getAsString();

result = kakaoBotService.crawlHaksik(mealtime);
} catch (Exception e) {
SkillResponse errorMsg = new SkillResponse();
errorMsg.addSimpleText("API 오류가 발생하였습니다.");
result = errorMsg.getSkillPayload().toString();
}

return new ResponseEntity<String>(result, HttpStatus.OK);
return new ResponseEntity<>(result, HttpStatus.OK);
}

@RequestMapping(value = "/buses/request", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public @ResponseBody
ResponseEntity requestBuses(@RequestBody String body) {
ResponseEntity<String> requestBuses(@RequestBody String body) {
SkillResponse busSkill = new SkillResponse();
busSkill.addQujckReplies("한기대→야우리", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "한기대→야우리");
busSkill.addQujckReplies("한기대→천안역", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "한기대→천안역");
busSkill.addQujckReplies("야우리→한기대", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "야우리→한기대");
busSkill.addQujckReplies("야우리→천안역", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "야우리→천안역");
busSkill.addQujckReplies("천안역→한기대", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "천안역→한기대");
busSkill.addQujckReplies("천안역→야우리", KakaoBotEnum.QuickRepliesActionType.MESSAGE.getTypeText(), "천안역→야우리");
busSkill.addQujckReplies("한기대→야우리", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "한기대→야우리");
busSkill.addQujckReplies("한기대→천안역", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "한기대→천안역");
busSkill.addQujckReplies("야우리→한기대", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "야우리→한기대");
busSkill.addQujckReplies("야우리→천안역", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "야우리→천안역");
busSkill.addQujckReplies("천안역→한기대", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "천안역→한기대");
busSkill.addQujckReplies("천안역→야우리", KakaoBot.QuickRepliesActionType.MESSAGE.getTypeText(), "천안역→야우리");

busSkill.addSimpleText("선택하세요!");

String busSkillStr = busSkill.getSkillPayload().toString();

return new ResponseEntity<String>(busSkillStr, HttpStatus.OK);
return new ResponseEntity<>(busSkillStr, HttpStatus.OK);
}

@RequestMapping(value = "/buses", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
public @ResponseBody
ResponseEntity returnBuses(@RequestBody String body) {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(body);

// ['action']['params']['place'], ['action']['params']['place1']
JsonElement action = jsonElement.getAsJsonObject().get("action");
JsonElement params = action.getAsJsonObject().get("params");
String depart = params.getAsJsonObject().get("place").getAsString();
String arrival = params.getAsJsonObject().get("place1").getAsString();

ResponseEntity<String> returnBuses(@RequestBody String body) {
String result;
try {
JsonParser jsonParser = new JsonParser();
JsonElement jsonElement = jsonParser.parse(body);

// ['action']['params']['place'], ['action']['params']['place1']
JsonElement action = jsonElement.getAsJsonObject().get("action");
JsonElement params = action.getAsJsonObject().get("params");
String depart = params.getAsJsonObject().get("place").getAsString();
String arrival = params.getAsJsonObject().get("place1").getAsString();

result = kakaoBotService.calculateBus(depart, arrival);
} catch (Exception e) {
SkillResponse errorMsg = new SkillResponse();
errorMsg.addSimpleText("API 오류가 발생하였습니다.");
result = errorMsg.getSkillPayload().toString();
}

return new ResponseEntity<String>(result, HttpStatus.OK);
return new ResponseEntity<>(result, HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ResponseEntity getLostItem(@ApiParam(required = true) @PathVariable int id) thro
@ApiOperation(value = "", authorizations = {@Authorization(value="Authorization")})
@RequestMapping(value = "/lost/lostItems/{id}", method = RequestMethod.PUT)
public @ResponseBody
ResponseEntity updateLostItem(@ApiParam(value="(optional: type, title, location, date, content, state, phone, is_phone_open, thumbnail)", required = false) @RequestBody @Validated(ValidationGroups.Update.class) LostItem lostItem, BindingResult bindingResult, @ApiParam(required = true) @PathVariable int id) throws Exception {
ResponseEntity updateLostItem(@ApiParam(value="(required: type), (optional: title, location, date, content, state, phone, is_phone_open, thumbnail)", required = false) @RequestBody @Validated(ValidationGroups.Update.class) LostItem lostItem, BindingResult bindingResult, @ApiParam(required = true) @PathVariable int id) throws Exception {
LostItem clear = new LostItem();
return new ResponseEntity<LostItem>(lostAndFoundService.updateLostItem((LostItem) StringXssChecker.xssCheck(lostItem, clear), id), HttpStatus.CREATED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class AdminCalendarController {
@ApiOperation(value = "", authorizations = {@Authorization(value="Authorization")})
@RequestMapping(value = "/admin/term", method = RequestMethod.POST)
public @ResponseBody
ResponseEntity<String> createTerm(@ApiParam(required = true, value = "10: 1학기 정규, 11: 1학기 계절, 20: 2학기 정규, 21: 2학기 계절") @RequestBody String term) {
ResponseEntity<String> createTerm(@ApiParam(required = true, value = "10: 1학기 정규, 11: 1학기 계절, 12: 1학기 계절 이후, 20: 2학기 정규, 21: 2학기 계절, 22: 2학기 계절 이후") @RequestBody String term) {

return new ResponseEntity<>(calendarService.createTermForAdmin(term), HttpStatus.CREATED);
}
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/koreatech/in/domain/BokDuck/Land.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
import io.swagger.annotations.ApiModelProperty;
import koreatech.in.annotation.ValidationGroups;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.*;
import java.util.Date;

public class Land {
@ApiModelProperty(notes = "고유 id", example = "10")
private Integer id;
@NotNull(groups = ValidationGroups.CreateAdmin.class, message = "원룸 건물 이름은 비워둘 수 없습니다.")
@ApiModelProperty(notes = "원룸 건물 이름", example = "10")
@Size(max = 255, message = "건물 이름은 255자 이내여야 합니다.")
@NotNull(groups = ValidationGroups.CreateAdmin.class, message = "건물 이름은 비워둘 수 없습니다.")
@ApiModelProperty(notes = "건물 이름", example = "라이프")
private String name;
@ApiModelProperty(notes = "고유 링크", example = "라이프")
@ApiModelProperty(hidden = true)
private String internal_name;
@ApiModelProperty(notes = "방 크기", example = "3.5")
private Double size;
Expand All @@ -33,14 +33,20 @@ public class Land {
private String address;
@ApiModelProperty(notes = "세부사항", example = "세부사항입니다.")
private String description;
@Max(value = Integer.MAX_VALUE, message = "입력할 수 없는 층수입니다.")
@Min(value = 0, message = "입력할 수 없는 층수입니다.")
@ApiModelProperty(notes = "층수", example = "4")
private Integer floor;
@Size(max = 255, message = "보증금은 255자 이내여야 합니다.")
@ApiModelProperty(notes = "보증금", example = "35.5")
private String deposit;
@Size(max = 255, message = "월세는 255자 이내여야 합니다.")
@ApiModelProperty(notes = "월세", example = "170(6개월)")
private String monthly_fee;
@Size(max = 255, message = "전세는 255자 이내여야 합니다.")
@ApiModelProperty(notes = "전세", example = "43.2")
private String charter_fee;
@Size(max = 255, message = "관리비는 255자 이내여야 합니다.")
@ApiModelProperty(notes = "관리비", example = "21(1인)/22(2인)/23(3인)")
private String management_fee;
@ApiModelProperty(notes = "냉장고 보유 여부", example = "1")
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/koreatech/in/domain/Circle/Circle.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import koreatech.in.annotation.ValidationGroups;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -15,6 +16,7 @@ public class Circle {
@NotNull(groups = ValidationGroups.CreateAdmin.class, message = "동아리 카테고리는 비워둘 수 없습니다.")
@ApiModelProperty(notes = "예술분야(C001), 공연분야(C002), 운동분야(C003), 학술분야(C004), 종교분야(C005), 사회봉사(C006), 준동아리(C007)", example = "C001")
private String category;
@Size(max = 50, message = "동아리 이름은 50자 이내여야 합니다.")
@NotNull(groups = ValidationGroups.CreateAdmin.class, message = "동아리 이름은 비워둘 수 없습니다.")
@ApiModelProperty(notes = "동아리 이름", example = "BCSD LAB")
private String name;
Expand All @@ -33,11 +35,14 @@ public class Circle {
private Boolean is_deleted;
@ApiModelProperty(notes = "담당교수", example = "교수님")
private String professor;
@Size(max = 255, message = "동아리방 위치 설명은 255자 이내여야 합니다.")
@ApiModelProperty(notes = "동아리방 위치", example = "동아리방 412호")
private String location;
@Size(max = 255, message = "주요사업 설명은 255자 이내여야 합니다.")
@ApiModelProperty(notes = "주요사업", example = "컴퓨터 고치기")
private String major_business;
@ApiModelProperty(notes = "메인 소개 홈페이지", example = "https://bcsdlab.com")
@Size(max = 255, message = "동아리 홈페이지 링크는 255자 이내여야 합니다.")
@ApiModelProperty(notes = "동아리 홈페이지", example = "https://bcsdlab.com")
private String introduce_url;
@ApiModelProperty(hidden = true)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/koreatech/in/domain/Community/Article.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jsoup.Jsoup;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

public class Article {
Expand All @@ -16,6 +17,7 @@ public class Article {
@NotNull(groups = { ValidationGroups.Create.class, ValidationGroups.CreateAdmin.class, ValidationGroups.Update.class, ValidationGroups.UpdateAdmin.class }, message = "board_id는 비워둘 수 없습니다.")
@ApiModelProperty(notes = "게시판의 고유 id", example = "10")
private Integer board_id;
@Size(max = 255, message = "제목은 255자 이내여야 합니다.")
@NotNull(groups = { ValidationGroups.Create.class, ValidationGroups.CreateAdmin.class }, message = "게시글 제목은 비워둘 수 없습니다.")
@ApiModelProperty(notes = "제목", example = "제목입니다.")
private String title;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/koreatech/in/domain/Faq/Faq.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import koreatech.in.annotation.ValidationGroups;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;

public class Faq {
@ApiModelProperty(notes = "고유 id", example = "10")
private Integer id;
@Size(max = 255, message = "질문은 255자 이내여야 합니다.")
@NotNull(groups = { ValidationGroups.CreateAdmin.class, ValidationGroups.UpdateAdmin.class }, message = "질문은 비워둘 수 없습니다.")
@ApiModelProperty(notes = "질문", example = "질문1")
private String question;
Expand Down
Loading