Skip to content

Commit

Permalink
Merge pull request #28 from BCSDLab/release/1.4.0
Browse files Browse the repository at this point in the history
Release/1.4.0
  • Loading branch information
knight7024 authored Mar 12, 2020
2 parents 28f4e5d + 475d3ff commit 4c92cb9
Show file tree
Hide file tree
Showing 43 changed files with 1,104 additions and 915 deletions.
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

0 comments on commit 4c92cb9

Please sign in to comment.